Medical Image Processing with IDL. This is a three-day course on image processing in IDL, with an...
-
Upload
alexys-gamble -
Category
Documents
-
view
217 -
download
2
Transcript of Medical Image Processing with IDL. This is a three-day course on image processing in IDL, with an...
Medical Image Medical Image Processing Processing
with IDLwith IDL
Medical Image Processing with IDLMedical Image Processing with IDL
This is a three-day course on image processing in IDL, with an emphasis on hands-on demonstration of image processing techniques commonly used in medical research.
Central to the course is an explanation of how to use IDL’s DICOM toolkit to read, write, copy and query DICOM format files, through several examples and exercises.
Participants should be familiar with the IDL programming language, having completed RSI’s Introduction to IDL course, or having at least 3 months experience using IDL.
Course ObjectivesCourse Objectives
1. IDL and the DICOM standard (Day 1)– Overview of the DICOM standard– Introduction to IDL's DICOM toolkit– Examples of querying, reading, writing and cloning DICOM
files with IDL
2. Image processing in IDL (Day 2-3)– Diagnostic and statistical routines– Pixel operations– Neighborhood operations– Global transforms– Geometric operations– Feature extraction
Part I: IDL and the DICOM StandardPart I: IDL and the DICOM Standard
The DICOM StandardThe DICOM Standard
DICOM (Digital Imaging and Communications in Medicine) was developed in response to the growing need for a standard format for digital imagery produced by instruments from various vendors.
The DICOM standard is intended to– promote communication of digital imagery, regardless of
device manufacturer– facilitate development of PACS that can interface with other
hospital systems– allow creation of databases that can be interrogated by a
wide variety of devices distributed geographically.
The DICOM standard is currently in version 3. It is documented in 17 "parts", which can be downloaded from the DICOM homepage: http://medical.nema.org.
The DICOM StandardThe DICOM Standard
Part 1: Introduction and OverviewPart 2: ConformancePart 3: Information Object Definitions Part 4: Service Class Specifications Part 5: Data Structure and Semantics Part 6: Data Dictionary Part 7: Message Exchange Part 8: Network Communication Support for Message ExchangePart 9: Point to Point Communication Support for Message ExchangePart 10: Media Storage and File Format for Media Interchange Part 11: Media Storage Application Profiles Part 12: Media Formats and Physical Media for Media Interchange Part 14: Grayscale Standard Display Function Part 15: Security and System Management Profiles Part 16: Content Mapping ResourcePart 17: Explanatory InformationPart 18: Web Access to DICOM Persistent Objects
The DICOM StandardThe DICOM Standard
Diagnostic imaging modalities using DICOM today include– NM - Nuclear Medicine– PET - Positron Emission Tomography– MR - Magnetic Resonance– XR - X-Ray– US - Ultrasound– CT - Computed Tomography– RT - Radiation Therapy– CR - Computed Radiography
DICOM FilesDICOM Files
DICOMHeader
patient info, modality,
image size,etc. Header
Contains information, organized in attributes or data elements, describing the contents of the file.
DataContains image pixel data, the structure and encoding of which is described in the header. The file can contain multiple frames as well as compressed data.
A file conforming to DICOM standard PS 3.10 is known as a DICOM file. DICOM files have two components:
DICOM File Header StructureDICOM File Header Structure
An attribute or data element is comprised of four fields:
• Tag - a unique numeric label that identifies the attribute• Value representation (VR) - a two-character code describing the
type and format of the attribute's value• Value length - the length of the attribute's data• Value field - the attribute's data
Tag VRValueLength
Value Field
DICOM File Header StructureDICOM File Header Structure
• Attribute tags are expressed in the form
(gggg, eeee)
where gggg is the four-digit group and eeee is the four-digit element number, both in hexadecimal notation.
• Even-valued groups are public, defined by the DICOM standard; odd-valued groups are private, defined by users of the format. Examples:
– group 0008 : file creation information– group 0010 : patient information– group 0018 : imaging device parameters
• A full list of attribute tags and their VRs are given in DICOM PS 3.6, the Data Dictionary. A subset of these tags are listed in the Medical Imaging in IDL reference document.
DICOM File Header Structure: ExampleDICOM File Header Structure: Example
Tag VR
Value Length
Description Value Field
(0010,0000) UL 1 Group 0010 Length 62
(0010,0010) PN 8 Patient's Name Doe John
(0010,0020) LO 11 Patient's ID 123-45-6789
(0010,0030) DA 8 Patient's Birth Date 19360513
(0010,0040) CS 1 Patient's Sex M
DICOM File: C:\RSI\IDL62\examples\data\mr_abdomen.dcm
The IDL DICOM ToolkitThe IDL DICOM Toolkit
The IDL DICOM toolkit consists of two interfaces to DICOM format files:
IDLffDICOM IDLffDICOMex
These interfaces– conform to DICOM standard PS 3.10 for reading DICOM
files; IDLffDICOMex can also write DICOM files– employ an object-oriented programming methodology– can be used at the command line or within an IDL program– are fully documented, with examples, in IDL's Online Help
system
The IDL DICOM ToolkitThe IDL DICOM Toolkit
IDLffDICOM
• provides basic read access to a DICOM file, including– group/element tag– value representation– length– data values– file header preamble– data dictionary description for individual elements– embedded sequences of elements
• is included in the standard IDL distribution• has procedural wrappers QUERY_DICOM and READ_DICOM
The IDL DICOM ToolkitThe IDL DICOM Toolkit
IDLffDICOMex
• can query, read, clone, or create new DICOM files• can read and write both public and private attributes including
sequences and sets of repeating tags within sequences• can read and write compressed DICOM files on Windows and
UNIX-based platforms• can copy DICOM attributes from one file to another• supports JPEG and JPEG2000 files (except Mac OS X)• is built on an industry-standard commercial DICOM library from
Merge Technologies, Inc. (www.merge.com)• requires a special IDL license
IDL Variable Type: ObjectIDL Variable Type: Object
IDL's DICOM toolkit is implemented using object technology, a programming methodology used, for example, in java and C++
Terminology:
class - an abstract data type, where methods and properties are defined
object - an instance of a class
method - a program defining what an object can do
property - a datum of an object
Example: IDL is a programming language.
IDL Variable Type: ObjectIDL Variable Type: Object
An IDL object consists of a reference + a heap variable; the heap
variable is persistent in memory.
Creation
Use
Destruction
file = 'C:\MIPI\images\PET_1.dcm'odcm = obj_new('idlffdicomex', file)
odcm->getproperty, modality=m
obj_destroy, odcm
class nameobject reference
method invocation operator
method property
object_lifecycle.pro
IDL Variable Type: PointerIDL Variable Type: Pointer
Pointers are a persistent data type similar to objects, consisting of a
reference and a heap variable.
IDL pointers are unlike C pointers in that they do not directly access
memory.
Creation
Use
Destruction
pointer_lifecycle.pro
p = ptr_new('My dog has fleas.')
print, *p
ptr_free, p
pointer reference
pointer dereference operator
The IDLffDICOM ClassThe IDLffDICOM Class
• Introduced in IDL 5.2 (1998) to support the growing use of the DICOM standard.
• API
• Examples
1. dumping header tags to screen or file
2. retrieving header tag descriptions, VRs and values
3. reading image pixel data
4. data visualization (TV & TVSCL, IIMAGE, IVOLUME)• Procedural wrappers
odcm = obj_new('idlffdicom')
The IDLffDICOM Class: Example 1The IDLffDICOM Class: Example 1
Read a DICOM file and dump its attributes to a text file.
View the dump file CT_1_hdr.txt.
; Make a new DICOM file object.odcm = obj_new('idlffdicom')
; Read the contents of a DICOM file.file = 'C:\MIPI\images\CT_1.dcm'info = odcm->read(file)
; Dump its attributes to a text file.odcm->dumpelements, 'CT_1_hdr.txt'
idlffdicom_ex1.pro
The IDLffDICOM Class: Example 2The IDLffDICOM Class: Example 2
Extract one attribute's data from a DICOM file header.
ref = odcm->getreference('0008'x,'0060'x)vr = odcm->getvr('0008'x,'0060'x)vl = odcm->getlength('0008'x,'0060'x)dsc = odcm->getdescription('0008'x,'0060'x)val = odcm->getvalue('0008'x,'0060'x)
; Print attribute's description and value.print, dsc, *val[0]
idlffdicom_ex2.pro
The attribute referenced by (0008,0060) lists the modality of the device used to create the image.
The IDLffDICOM Class: Example 3The IDLffDICOM Class: Example 3
Read image pixel data and attributes for displaying the data.
; Get display attributes.n_images = odcm->getvalue('0028'x,'0008'x)xsize = odcm->getvalue('0028'x,'0011'x)ysize = odcm->getvalue('0028'x,'0010'x)bit_depth = odcm->getvalue('0028'x,'0101'x)
; Get the image pixel data.image = odcm->getvalue('7fe0'x,'0010'x)
idlffdicom_ex3.pro
Group 0028 gives information about the image, group 7fe0 gives the image pixel data.
The IDLffDICOM Class: Example 4The IDLffDICOM Class: Example 4
tv, *image[0], /ordertvscl, *image[0], /orderiimage, *image[0], /orderivolume, image_stack, /order
idlffdicom_ex4a.proidlffdicom_ex4b.pro
The iTools can also be used for simple image processing; more on that later in the course.
Display image pixel data from a DICOM file. Image data can be displayed in IDL with
• TV / TVSCL• IIMAGE• IVOLUME
The IDLffDICOM ClassThe IDLffDICOM Class
The IDLffDICOM class has two procedural wrappers.
QUERY_DICOM - tests that the file is a DICOM file, optionally returning a structure of information
READ_DICOM - reads the image pixel data from a DICOM file
The wrappers are written in the IDL language.
idlffdicom_wrappers.pro
ok = query_dicom(dicom_file, info)
image = read_dicom(dicom_file)
The IDLffDICOM Class: ProblemsThe IDLffDICOM Class: Problems
1. What is the patient's name in CT_2.dcm in the course files? What is the referring physician's name?
2. Read the image pixel data from mr_brain.dcm in the examples/data subdirectory of the IDL distribution. Display the data with TV in a window sized for the image.
3. Write a program to read the first four images from mr_abdomen.dcm (also in examples/data) and display them in a 2x2 grid in IIMAGE.
The IDLffDICOMex ClassThe IDLffDICOMex Class
• Introduced in IDL 6.1 (2004) to upgrade IDL's ability to work with DICOM, especially the ability to clone and write DICOM files.
• API
• Examples– read the attributes into an array of IDL structures– retrieve and display image pixel data– query the attributes of a DICOM file– clone a DICOM file and alter its attributes– create a new DICOM file
• The DICOM_VIEWER demo application
odcm = obj_new('idlffdicomex', file)
The IDLffDICOMex Class: Example 1The IDLffDICOMex Class: Example 1
Read the attributes of a DICOM file into an array of IDL structures.
; File is opened read-only, by default.file = 'C:\MIPI\images\US_10.dcm'odcm = obj_new('idlffdicomex', file)
; Dump attributes to a structure array.tags = odcm->enumeratetags()
; Dump attributes to a file.tags = odcm->enumeratetags( $
filename='US_10_hdr.txt')
idlffdicomex_ex1.pro
All attributes are read by default, though a subset can also bespecified.
The IDLffDICOMex Class: Example 2The IDLffDICOMex Class: Example 2
Read image pixel data and display with IIMAGE.
; Display image pixel data with IIMAGE.iimage, odcm->getpixeldata()
idlffdicomex_ex2.pro
Note that the GetPixelData method automatically flips the image data; setting the ORDER keyword to IIMAGE (or TVor TVSCL) is not necessary.
The IDLffDICOMex Class: Example 3The IDLffDICOMex Class: Example 3
Check that an attribute exists before attempting to read it.
; Is the transfer syntax attribute present?is_present = odcm->queryvalue('0002,0010')
if is_present eq 2 then begin; Use GetProperty or GetValue to; retrieve the transfer syntax.odcm->getproperty, transfer_syntax=tsts1 = odcm->getvalue('0002,0010')
endif
idlffdicomex_ex3a.proidlffdicomex_ex3b.pro
Use QueryValue to test for an attribute's existence. An error results from attempting to access an attribute that doesn't exist.
The IDLffDICOMex Class: Example 4The IDLffDICOMex Class: Example 4
Clone a DICOM file.
old_file = 'C:\MIPI\images\CR_1.dcm'new_file = 'C:\MIPI\images\MIPI_CR_1.dcm'odcm = obj_new('idlffdicomex', new_file, $
clone=old_file)
; Change the image type, then commit change.type = ['ORIGINAL','SECONDARY']odcm->setproperty, image_type=typeodcm->commit
idlffdicomex_ex4.pro
Original DICOM files (i.e., directly from a scanner) should not be modified. Instead, the file should be cloned and labeled as such.
The IDLffDICOMex Class: Example 5The IDLffDICOMex Class: Example 5
Create a new DICOM file.
; Create a new DICOM file, specifying ; its type with the SOP_CLASS keyword.; Commit the changes.file = 'C:\MIPI\images\new.dcm'odcm = obj_new('idlffdicomex', file, $
/create, /non_conforming, $sop_class='STANDARD_NM')
odcm->commit
idlffdicomex_ex5.pro
The IDLffDICOMex Class: ProblemsThe IDLffDICOMex Class: Problems
1. Read only the tags from group (0002) in the clone file MIPI_CR_1.img. Write the tags to a text file. Compare them with the elements of the same group in CR_1.dcm.
2. Write a program to read the image pixel data from mr_brain.dcm (in the examples/data subdirectory of the IDL distribution) and display them with TV in a window sized for the image. Compare with problem #2 for IDLffDICOM.
3. Clone CR_1.dcm and reduce the size of the file by selecting a transfer syntax that supports compression.
4. Read the file ctscan.dat from the examples/data subdirectory and create a new (nonconforming) DICOM file with its image pixel data.
Further InformationFurther Information
For more information on IDL'sDICOM capabilites, see
• http://www.rsinc.com/dicom– Toolkit information– Conformance statement
• http://www.rsinc.com/webinar– "IDL Medical Imaging
Suite" presentation
• Medical Imaging in IDL in the IDL Online Help
Part II: Image Processing in IDLPart II: Image Processing in IDL
Images and Image ProcessingImages and Image Processing
negation
input operation output
An image is a discrete, two-dimensional signal representing a physical phenomenon.
Image processing is the body of methods for extracting information
from images, typically expressed as a functional relationship
between input and output images.
OutlineOutline
1. IDL arrays and diagnostic/statistical routines2. Pixel operations
• stretching/scaling, window center and width, thresholding, masking, negation, mathematical operations, equalization
3. Neighborhood operations• smoothing, median filtering, convolution, sharpening, edge
detection4. Global transforms
• Fourier and Radon transforms5. Geometric operations
• rotating, scaling and resizing images; registration, fusion6. Feature extraction methods
• regions of interest (ROI), region growing, morphological operators, segmentation
IDL Arrays IDL Arrays and Diagnostic / Statistical Routinesand Diagnostic / Statistical Routines
IDL ArraysIDL Arrays
• IDL is an array-based language.• Images, image stacks and cines are represented in IDL as 2-, 3-
or 4-D arrays, consisting of– 1-, 2-, 4- or 8-byte unsigned integers– 2-, 4- or 8-byte signed integers– 4- or 8-byte floating point values
• Array operations are faster than scalar operations.– example: find maximum pixel value of image
• IDL has many built-in, array-oriented routines for image processing (see Online Help).
array_operation_ex.pro
Diagnostic and Statistical RoutinesDiagnostic and Statistical Routines
A list of routines used to get information about an image.
HELP SIZE MIN
MAX WHERE ARRAY_INDICES
MOMENT MEDIAN ARRAY_EQUAL
TOTAL PRODUCT IMAGE_STATISTICS
FINITE HISTOGRAM N_ELEMENTS
UNIQ SORT
helpful_routines_ex.pro
HistogramHistogram
The histogram is the graph of the frequency distribution of an image's pixel values. Integrate the histogram over pixel value to obtain thecumulative histogram.
image
histogram
histogram_ex.pro
h = histogram(image, locations=x)plot, x, h
c = total(h, /cumulative)plot, x, c
ProblemsProblems
1. Write a function that returns the range of values in an array.
2. Write a function that returns the odd values of an input array. (Hint: use WHERE)
Pixel OperationsPixel Operations
Pixel OperationsPixel Operations
• Given an input image A, a pixel operator F yields an image B where the value of B at a particular pixel (x,y) depends only on the same pixel in A.
• Operations– stretching / scaling– window center and width– mathematical operations– thresholding and masking– histogram equalization
A
B
Stretching / ScalingStretching / Scaling
Stretching or scaling enhances the contrast inan image by broadening a selected region of theimage's histogram.
The IDL minimum operator <returns the smaller of its twooperands, the maximumoperator > returns the larger.Both are array operators.
scaling_ex.pro
scaled_image = (image > lo) < hi
original
scaled
Window Center and WidthWindow Center and Width
The window center and width define an intensityrange into which the pixels of an image are scaled.
These quantities are commonly known as thebrightness and contrast of the image.
lo = center - width/2hi = center + width/2scaled_image = (image > lo) < hi
window_settings_ex.pro
original
scaled
Arithmetic OperationsArithmetic Operations
Arithmetic operators, which are array operatorsin IDL, can be applied directly to the pixel valuesof an image.
In this example, the range ofimage pixel intensities is halved, decreasing the separation of the fine detailsof the image.
image *= 0.5
arithmetic_ex.pro
original
scaled
ThresholdingThresholding
Thresholding is a simple form of segmentation.Pixels that satisfy a relational operation are set
to1, the rest are set to 0, giving a binary image.
Thresholding is typically usedto separate an image's fore-ground and background features. Here, attempt to separate the bone from the soft tissue in this CT image.
binary_image = image ge threshold
original
binary result
thresholding_ex.pro
MaskingMasking
Like thresholding, image masks are created with rela-tional operators. When applied, a mask blocks pixelsbeneath it, allowing the remaining pixels to pass.
This example uses the WHERE function to identifypixels associated with boneand set those pixels to a newvalue, identified with a yellow color.
i_mask = where(image ge threshold)masked_image[i_mask] = max(image)
original
masked image
masking_ex.pro
Histogram EqualizationHistogram Equalization
Histogram equalization increases the contrast in an image byremapping its pixel values, spreading the image's histogram over the full range of intensity values.
eq_image = hist_equal(image)
equalization_ex.pro
original image histogram equalized histogram equalized image
ProblemsProblems
1. Make an IDL function to set the window center and width for an image.
2. Construct a mask to remove a square region of 100x100 pixels from the center of the image kidney20.dcm.
3. Create a new image from kidney20.dcm where the black pixels around the edge are transparent.
Neighborhood OperationsNeighborhood Operations
Neighborhood OperationsNeighborhood Operations
• Given an input image A, a neighborhood operator F yields an image B where the value of B at a particular pixel (x,y) depends on pixels in the neighborhood of the same pixel in A.
• Operations– smoothing– median filtering– convolution– sharpening– edge enhancement
A
B
SmoothingSmoothing
Smoothing removes high-frequency informationfrom an image. Smoothing is typically used toattenuate noise or soften an image.
The SMOOTH function is used toapply a rectangular running-mean(or tophat) filter to an image.
smoothing_ex.pro
smoothed_image = smooth(image, 5)
original
filtered imagesmoothing
kernel
Median FilteringMedian Filtering
Median filtering replaces each point in an imagewith the median intensity value of a two-dimensional neighborhood of a given width.
Median filtering removes outlying values from animage without altering or introducing new pixelsinto the image, thereby preserving edges in theimage.
median_filtering_ex.pro
smoothed_image = median(image, 5)
original
filtered image
ConvolutionConvolution
Convolution is the process of mathematically
blending a kernel with an image. The choice of
kernel determines the nature of the output image.
Here, a Laplacian kernel is used
to differentiate the input image. In
the resulting image, higher pixel
intensities denote regions of rapid
change.
convolution_ex.pro
kernel = intarr(3,3) - 1kernel[1,1] = 8d_image = convol(image, kernel, 9)
original
differentiatedimage
Laplaciankernel
SharpeningSharpening
Sharpening enhances contrast by boosting thehigh-frequency components of an image.
Many techniques exist.Here, a highpass filteredimage is added to the original image. TheLaplacian kernel from the previous slide is used.
sharpening_ex.pro
original
sharpened image
hipass = convol(image, kernel, 9)sharp = image + hipass
Edge EnhancementEdge Enhancement
Edge enhancement routines use differentiating kernels to increasethe brightness of edges in an image. Different kernels can be usedto enhance different edges in the image.
r_image = roberts(image)s_image = sobel(image)
original image with Sobel filter with Roberts filterwith horizontaldifference filter
edge_enhancement_ex.pro
ProblemsProblems
1. Write a program to display the difference between images filtered with the SMOOTH and MEDIAN functions.
2. Use CONVOL to apply a Gaussian smoothing kernel to an image. Compare the result with output from SMOOTH for the same kernel size.
3. Demonstrate that prior smoothing of an image can improve the results of edge enhancement routines.
Global TransformsGlobal Transforms
Global TransformsGlobal Transforms
• Given an input image A, a global transform F yields an image B where the value of B at a particular pixel (x,y) depends on all the pixels in A.
• Operations– Fast Fourier transform– Radon transform
A
B
Fast Fourier TransformFast Fourier Transform
The fast Fourier transform (FFT) is an algorithm for transformingdiscrete data between the physical and frequency domains.
IDL's FFT can operate on arrays of up to 8 dimensions; the FFT isperformed on each dimension separately the same routine isused for all image and cine data.
; Forward transform.image_hat = fft(image)
; Inverse transform.image = fft(image_hat, /inverse)
Fourier
transform
physical domain
frequency domain
forward in
vers
e
Fast Fourier Transform: SpectrumFast Fourier Transform: Spectrum
The power spectrum is a graph of the relative frequency contrib-utions to the total variance of an array represented in the frequency domain.
; Power spectrum.power = abs(image_hat)^2
imageshifted powerspectrum - log
shiftedpower spectrum
powerspectrum
spectrum_ex.pro
Fast Fourier Transform: FilteringFast Fourier Transform: Filtering
Filtering is used to alter an image by attenuating, isolating or removing features of the image in the frequency domain.
filte
rso
pera
tion
s lowpass bandstopbandpasshighpass
exponentialButterworthideal
filters_and_operations_ex.pro
Fast Fourier Transform: ExampleFast Fourier Transform: Example
Lowpass filter an image using an ideal filter with a cutoff at 1/4 theNyquist frequency for the image.
image_hat = fft(image)cutoff = (xsize < ysize) / 8filter = dist(xsize,ysize) le cutoffimage_lowpass = fft(image_hat*filter, /inverse)
image filtered imagefiltered
power spectrumpower spectrum
lowpass_ex.pro
Radon TransformRadon Transform
The Radon transform is used in reconstructing imagery from CTscanners. Here, a mask is constructed to brighten edges in an image.
radon_ex2.pro
; Forward transform.image_hat = radon(image, rho=rho, theta=theta)
; Inverse transform.image = radon(image_hat, /backproject, $
rho=rho, theta=theta)
image contrastbackprojectionedge-enhanced Radon transform
ProblemsProblems
1. Sharpen an image using Fourier filtering. Compare the results with those from SHARPENING_EX in the previous section.
Geometric OperationsGeometric Operations
Geometric OperationsGeometric Operations
• A geometric operator F maps the pixels of an image A into a new coordinate system to obtain the image B.
• Operations– manipulating (rotating, cropping, etc.) images– registration– image fusion A
B
Manipulating ImagesManipulating Images
IDL provides built-in array operators and array manipulationroutines that can be used to transform an image's geometry.
Examples:• Cropping• Padding• Extracting image planes• Rotating/Flipping
– ROTATE, SHIFT, TRANSPOSE• Resizing
– REBIN, CONGRID
manipulation_ex.pro
RegistrationRegistration
Registration is a procedure for determining the best spatial fit fortwo or more images that overlap a scene.
Methods:• cross-correlation• control points
registration_ex1.proregistration_ex2.pro
image 2image 1
calcium map
Image FusionImage Fusion
Image fusion is a procedure for melding images from differentmodalities that overlap the same scene.
IDL application: the IDLmedFusion class fuses two images, usingone of 23 blending functions, producing an indexed or an RGBimage as a result.
idlmedfusion__define.pro fusion_image_demo.pro
ProblemsProblems
1. Crop the text from US_10.dcm in the MIPI image directory.
Feature Extraction MethodsFeature Extraction Methods
Feature Extraction MethodsFeature Extraction Methods
• Given an input image A, a feature extraction operator F selects, emphasizes, or modifies certain aspects of image A.
• Operations– regions of interest (ROIs), region growing– morphological operations– segmentation
A
B
Regions of Interest (ROI)Regions of Interest (ROI)
A region of interest (ROI) is a subset of an image marked for further analysis.
In IDL, an ROI is defined pointwise by a set of verticesenclosing the subset.
IDL has built-in tools for defining ROIs both interactively and algorithmically.
Regions of Interest (ROI)Regions of Interest (ROI)
• Manual or interactive ROI definition:– XROI– IIMAGE
• Automatic or algorithmic ROI definition:– CONTOUR– SEARCH2D / SEARCH3D– REGION_GROW
• Quantification:– IDLanROI class– IMAGE_STATISTICS
Regions of Interest (ROI)Regions of Interest (ROI)
• An object of the IDLanROI class represents the set of vertices defining an ROI.
• API
• Used for– computing statistics– adding/removing points– generating a binary mask– rotating, translating or scaling the ROI– checking whether a point is interior/exterior to the ROI
oroi = obj_new('idlanroi')
Regions of Interest (ROI) : Example 1Regions of Interest (ROI) : Example 1
Interactively define an ROI with XROI, then compute statistics and
define a mask with IDLanROI.
xroi_ex.pro
Regions of Interest (ROI): Example 2Regions of Interest (ROI): Example 2
Perform a flood fill analysis with
SEARCH2D, automatically defining
a region.
Recover the bounding points of the region
with CONTOUR, obtaining the vertices
of an ROI.
Compute ROI statistics; construct an
image mask.
search2d_ex.pro
Regions of Interest (ROI): Example 3Regions of Interest (ROI): Example 3
Region growing is a process by which an initial region is expanded
to include neighboring "like" pixels, based on certain limits.
region_grow_ex.pro
new_region = region_grow(img, region, $threshold=[215,255])
initial region (red) threshold method multiplier method
Morphological OperationsMorphological Operations
Morphological operators emphasize shapes in binary (b) or grayscale (g) images, based on the geometry of a structuringkernel.
Library routines:• ERODE [b,g]
• DILATE [b,g]
• MORPH_CLOSE [b,g]
• MORPH_OPEN [b,g]
• MORPH_GRADIENT [g]
• MORPH_DISTANCE [b]
• MORPH_HITORMISS [b]
• MORPH_THIN [b]
• MORPH_TOPHAT [g]
• WATERSHED [g]
hit
miss
MORPH_HITORMISS
Morphological Operations: Example 1Morphological Operations: Example 1
The morphological closing operation fills small gaps in a binary or
grayscale image.
morph_close_ex.pro
closethreshold
bmoz = moz le 250Bkernel = replicate(1,3,3)bmoz = morph_close(bmoz, kernel)
Morphological Operations: Example 2Morphological Operations: Example 2
The morphological gradient operation highlights edges of objects
in a grayscale image.
morph_gradient_ex.pro
gradient + thresholdgradient
r = 2 disc = shift(dist(2*r+1), r, r) le rgrad = morph_gradient(img, disc)
original
SegmentationSegmentation
Image segmentation is the process of subdividing an image into
distinct regions, based upon some set of criteria.
In IDL, thresholding and the morphological operators can be used
for segmentation.
Segmentation: ExampleSegmentation: Example
How many cells are in this image?
It is possible to count the cells by
eye, but if hundreds of images
were to be processed, automation
would be more efficient.
LABEL_REGION can be used to index the
autonomous regions of a binary image.
label_region_ex.pro
regions = label_region(bimage)
ProblemsProblems
1. Define ROIs from the two regions created in the example program REGION_GROW_EX.
2. Experiment with altering the geometry of the structuring elements in the MORPH_* examples. How sensitive are the results to the size and shape of the structuring elements?
3. Use LABEL_REGION to count the cells in rbcells.jpg in the examples/data subdirectory.
ReferencesReferences
DICOM information• Official NEMA site http://medical.nema.org• Prof. Chris Rorden
http://www.psychology.nottingham.ac.uk/staff/cr1/dicom.html• Dr. David Clunie
http://www.dclunie.com/medical-image-faq/html/toc.html
Image processing• Easton, R. Fundamentals of Digital Image Processing. Short
course, Rochester Institute of Technology, July 1988.• Gonzales, R.C. and R.E. Woods. Digital Image Processing.
Reading, Massachusetts: Addison-Wesley, 1992.• Russ, J.C. The Image Processing Handbook. Second edition.
Boca Raton, Florida: CRC Press, 1995.
Contact InformationContact Information
RSI Global Services
4990 Pearl East Circle
Boulder, CO 80301
tel +1 303 786 9900
fax +1 303 786 9909
http://www.rsinc.com