An Drew 08

Embed Size (px)

Citation preview

  • 8/6/2019 An Drew 08

    1/35

    Medical Image ProcessingMedical Image Processing

    By:By: AmitAmit ChoudharyChoudhary

  • 8/6/2019 An Drew 08

    2/35

    ProblemProblem The specific problem this project deals with is findingThe specific problem this project deals with is finding

    nerve clusters in an ultrasound image.nerve clusters in an ultrasound image.

    Variation of patient anatomies may create difficulties forVariation of patient anatomies may create difficulties forthe clinician when trying to locate nerves and nervethe clinician when trying to locate nerves and nerveclusters.clusters.

  • 8/6/2019 An Drew 08

    3/35

    PurposePurpose

    Create software that accurately identifies nerves in anCreate software that accurately identifies nerves in an

    ultrasound image.ultrasound image.

  • 8/6/2019 An Drew 08

    4/35

    Dealing with TextureDealing with Texture

    To create software that identifies nerves, we assume thatTo create software that identifies nerves, we assume that

    nerves have a unique texture.nerves have a unique texture.

    To the untrained eye, an ultrasound image has very fewTo the untrained eye, an ultrasound image has very few

    discernable features.discernable features. Using MatLab, we can essentially zoom in on an imageUsing MatLab, we can essentially zoom in on an image

    and look at the grayscale value of every pixel to see ifand look at the grayscale value of every pixel to see if

    there are patterns that arise from the Regionsthere are patterns that arise from the Regions--ofof--Interest.Interest.

    RegionsRegions--ofof--InterestInterest ororROIROI are the areas that a clinicianare the areas that a clinicianidentifies as nerve clusters.identifies as nerve clusters.

  • 8/6/2019 An Drew 08

    5/35

    ProcessProcess

    1.1. Collect Samples and get clinicians to identify ROICollect Samples and get clinicians to identify ROI

    2.2. Extract ROI using MatLabExtract ROI using MatLab

    3.3. Break ROI into smaller patchesBreak ROI into smaller patches

    4.4. Find statistical measures of patches that will define theFind statistical measures of patches that will define the

    texture of nerve clusterstexture of nerve clusters

    5.5. Detect nerve clusters in unmarked images by breakingDetect nerve clusters in unmarked images by breaking

    up an entire unmarked image into patches, find theup an entire unmarked image into patches, find the

    statistical measures of those patches, and mark the onesstatistical measures of those patches, and mark the onesthat resemble the patches from our ROIs.that resemble the patches from our ROIs.

  • 8/6/2019 An Drew 08

    6/35

    ProcessProcess

    1.1. Collect samples and have an expert clinician manuallyCollect samples and have an expert clinician manually

    identify the nerve clusters, or ROI.identify the nerve clusters, or ROI.

  • 8/6/2019 An Drew 08

    7/35

    ProcessProcess

    2.2. Extraction of RegionExtraction of Region--ofof--Interest.Interest.

    How does MatLab process images?How does MatLab process images?

    There is a command in MatLab There is a command in MatLab imread(NameOfImage)imread(NameOfImage) that allows that allowsus to break down an entire image into an (m x n x 3) matrix, where mus to break down an entire image into an (m x n x 3) matrix, where mand n is the resolution of the image. The 3and n is the resolution of the image. The 3rdrd dimension representsdimension representsthe three RGB values. ( Red / Green / Blue )the three RGB values. ( Red / Green / Blue )

    In this case, the image we are looking at is calledIn this case, the image we are looking at is called20060726_orbach6_ax1.tiff

    and is a 379 by 476 pixel image.379 by 476 pixel image.

    So if we typeSo if we typeImg=imread('20060726_orbach6_ax1.tiff');

    into MatLab, we get a 379 by 476 by 3 matrix called Img, where therange of the values are from 0 to 255.

  • 8/6/2019 An Drew 08

    8/35

    ProcessProcess2.2. Extraction of RegionsExtraction of Regions--ofof--Interest.Interest.

    a)a) Get the contour.Get the contour.

    b)b) Insert Seeds.Insert Seeds.

    c)c) Dilate the seeds repeatedly, negating the parts of the new dilationDilate the seeds repeatedly, negating the parts of the new dilationthat overlap with the contour. Repeat dilations until the lastthat overlap with the contour. Repeat dilations until the last

    dilation is the same as the previous dilation.dilation is the same as the previous dilation.

  • 8/6/2019 An Drew 08

    9/35

    ProcessProcess2.2. Extraction of RegionsExtraction of Regions--ofof--Interest.Interest.

    a)a) TheThe ContourContour is the boundary of the ROI.is the boundary of the ROI.

    In the Img, the ROI is marked by a very specific yellow. TheIn the Img, the ROI is marked by a very specific yellow. TheRGB value of this yellow is (251, 225, 1). To create the Contour,RGB value of this yellow is (251, 225, 1). To create the Contour,we make a new zerowe make a new zero--matrix the same size as Img, (379,476).matrix the same size as Img, (379,476).We then make an If statement that places a 1 in all the matrixWe then make an If statement that places a 1 in all the matrix

    entries that have RGB values equal to (251, 225, 1).entries that have RGB values equal to (251, 225, 1).

    Contour

  • 8/6/2019 An Drew 08

    10/35

    ProcessProcess2.2. Extraction of RegionsExtraction of Regions--ofof--Interest.Interest.

    a)a) Get the contour.Get the contour.

    b)b) Insert Seeds.Insert Seeds.

    c)c) Dilate the seeds repeatedly, negating the parts of the new dilationDilate the seeds repeatedly, negating the parts of the new dilationthat overlap with the contour. Repeat dilations until the lastthat overlap with the contour. Repeat dilations until the last

    dilation is the same as the previous dilation.dilation is the same as the previous dilation.

    ROI

  • 8/6/2019 An Drew 08

    11/35

    ProcessProcess2.2. Extraction of RegionsExtraction of Regions--ofof--Interest.Interest.

    a)a) Get the contour.Get the contour.

    b)b) Insert Seeds.Insert Seeds.

    c)c) Dilate the seeds repeatedly, negating the parts of the new dilationDilate the seeds repeatedly, negating the parts of the new dilationthat overlap with the contour. Repeat dilations until the lastthat overlap with the contour. Repeat dilations until the last

    dilation is the same as the previous dilation.dilation is the same as the previous dilation.

    1st Dilation

  • 8/6/2019 An Drew 08

    12/35

    ProcessProcess2.2. Extraction of RegionsExtraction of Regions--ofof--Interest.Interest.

    a)a) Get the contour.Get the contour.

    b)b) Insert Seeds.Insert Seeds.

    c)c) Dilate the seeds repeatedly, negating the parts of the new dilationDilate the seeds repeatedly, negating the parts of the new dilationthat overlap with the contour. Repeat dilations until the lastthat overlap with the contour. Repeat dilations until the last

    dilation is the same as the previous dilation.dilation is the same as the previous dilation.1-194-417-71-194-417-7

    9th Dilation

  • 8/6/2019 An Drew 08

    13/35

    ProcessProcess2.2. Extraction of RegionsExtraction of Regions--ofof--Interest.Interest.

    a)a) Get the contour.Get the contour.

    b)b) Insert Seeds.Insert Seeds.

    c)c) Dilate the seeds repeatedly, negating the parts of the new dilationDilate the seeds repeatedly, negating the parts of the new dilationthat overlap with the contour. Repeat dilations until the lastthat overlap with the contour. Repeat dilations until the last

    dilation is the same as the previous dilation.dilation is the same as the previous dilation.

    20th Dilation

  • 8/6/2019 An Drew 08

    14/35

    ProcessProcess2.2. Extraction of RegionsExtraction of Regions--ofof--Interest.Interest.

    a)a) Get the contour.Get the contour.

    b)b) Insert Seeds.Insert Seeds.

    c)c) Dilate the seeds repeatedly, negating the parts of the new dilationDilate the seeds repeatedly, negating the parts of the new dilationthat overlap with the contour. Repeat dilations until the lastthat overlap with the contour. Repeat dilations until the last

    dilation is the same as the previous dilation.dilation is the same as the previous dilation.

    31st Dilation

  • 8/6/2019 An Drew 08

    15/35

    ProcessProcess2.2. Extraction of RegionsExtraction of Regions--ofof--Interest.Interest.

    a)a) Get the contour.Get the contour.

    b)b) Insert Seeds.Insert Seeds.

    c)c) Dilate the seeds repeatedly, negating the parts of the new dilationDilate the seeds repeatedly, negating the parts of the new dilationthat overlap with the contour. Repeat dilations until the lastthat overlap with the contour. Repeat dilations until the last

    dilation is the same as the previous dilation.dilation is the same as the previous dilation.

    62nd Dilation

  • 8/6/2019 An Drew 08

    16/35

    ProcessProcess3.3.Break ROI into smaller patchesBreak ROI into smaller patches

    Now MatLab has a map that tells it where the nerve clusters are in ourNow MatLab has a map that tells it where the nerve clusters are in our

    image. Remember this is still in a marked image so we arent close toimage. Remember this is still in a marked image so we arent close to

    solving the problem yet.solving the problem yet.

    Convert the whole image to grayscale so we arent dealing with the 3Convert the whole image to grayscale so we arent dealing with the 3rdrddimension, RGB, anymore. This is done by taking the mean of thedimension, RGB, anymore. This is done by taking the mean of the

    three RGB values.three RGB values.

    In this project, we are using 5x5 patches, which means we areIn this project, we are using 5x5 patches, which means we are

    looking at a box of 25 pixels.looking at a box of 25 pixels.

    For this particular image, there are 2,911 5x5 different patches we can fitFor this particular image, there are 2,911 5x5 different patches we can fit

    within the ROI.within the ROI.

    We now have a (5x5x2,911) array of grayscale patches.We now have a (5x5x2,911) array of grayscale patches.

  • 8/6/2019 An Drew 08

    17/35

    ProcessProcess3.3.Break ROI into smaller patchesBreak ROI into smaller patches

  • 8/6/2019 An Drew 08

    18/35

    ProcessProcessHow do we define texture using statisticalHow do we define texture using statistical

    measures?measures?

  • 8/6/2019 An Drew 08

    19/35

    ProcessProcess4.4. Find Statistical Measures of PatchesFind Statistical Measures of Patches

    AA GLCMGLCM is a matrix that is calculated by how often a pixel withis a matrix that is calculated by how often a pixel with

    grayscale valuegrayscale value iioccurs horizontally adjacent to a pixel withoccurs horizontally adjacent to a pixel with

    valuevaluejj..

  • 8/6/2019 An Drew 08

    20/35

    ProcessProcess

    4.4. Find Statistical Measures of PatchesFind Statistical Measures of Patches

    AA Gray level CoGray level Co--Occurrence Matrix (GLCM)Occurrence Matrix (GLCM)

    is a matrix that is calculated by how often a pixel with grayscaleis a matrix that is calculated by how often a pixel with grayscale

    valuevalue iioccurs horizontally adjacent to a pixel with grayscaleoccurs horizontally adjacent to a pixel with grayscalevaluevaluejj..

    The range of the image is scaled fromThe range of the image is scaled from

    [0 255] to [1 8][0 255] to [1 8]

    4747 5050 5454 5555 5454

    5252 5454 5757 5858 5555

    5858 5858 6060 6060 5757

    5757 5555 5454 5353 5151

    6060 5959 5757 5454 5353

    11 33 55 55 44

    44 55 66 77 55

    88 88 77 66 55

    77 66 66 66 55

    88 88 77 66 55

    Patch: Scaled Patch:

  • 8/6/2019 An Drew 08

    21/35

    ProcessProcess

    4.4. Find Statistical Measures of PatchesFind Statistical Measures of PatchesExample: Find the GLCM of the patch.Example: Find the GLCM of the patch.

    4747 5050 5454 5555 5454

    5252 5454 5757 5858 5555

    5858 5858 6060 6060 5757

    5757 5555 5454 5353 5151

    6060 5959 5757 5454 5353

    11 33 55 55 44

    44 55 66 77 55

    88 88 77 66 55

    77 66 66 66 55

    88 88 77 66 55

    Patch: Scaled Patch:

  • 8/6/2019 An Drew 08

    22/35

    ProcessProcess4.4. Find Statistical Measures of PatchesFind Statistical Measures of Patches

    Properties of GLCMs to note:Properties of GLCMs to note:

    1.1. The entries in the diagonal represent no change from one pixel toThe entries in the diagonal represent no change from one pixel to

    the next.the next.2.2. As you move farther from the diagonal, it indicates greaterAs you move farther from the diagonal, it indicates greater

    contrast.contrast.

    3.3. The most contrast are those in the top right and bottom leftThe most contrast are those in the top right and bottom left

    corners of the GLCM: entries (1,8) and (8,1).corners of the GLCM: entries (1,8) and (8,1).

  • 8/6/2019 An Drew 08

    23/35

    ProcessProcess

    4.4. Find Statistical Measures of PatchesFind Statistical Measures of Patches

    Gray CoGray Co--PropsProps is a tool used for evaluating a GLCM. It isis a tool used for evaluating a GLCM. It is

    comprised of four properties: contrast, correlation, energy, andcomprised of four properties: contrast, correlation, energy, and

    homogeneity.homogeneity.

    The value of these four properties describes the GLCM, and in turn,The value of these four properties describes the GLCM, and in turn,

    our ROI.our ROI.

    To find these four properties, first turn all the elements of the GLCMTo find these four properties, first turn all the elements of the GLCM

    into probabilities so that the sum of its elements is equal to 1.into probabilities so that the sum of its elements is equal to 1.

  • 8/6/2019 An Drew 08

    24/35

    ProcessProcess

    4.4. Find Statistical Measures of PatchesFind Statistical Measures of Patches

    i represents the GLCM row

    j represents the GLCM column

    p(i,j) represents the probability of the i,j entry

    ji

    jip,

    2),(),(||2

    ,

    jipjiji

    Correlation:

    Contrast: Energy:

    ji ji

    jip

    , 1

    ),( ji ji

    jipujjuii,

    ),())((WW

    Homogeneity:

  • 8/6/2019 An Drew 08

    25/35

    ProcessProcess

    4.4. Find Statistical Measures of PatchesFind Statistical Measures of Patches

    a)a) Contrast:Contrast: returns a measure of the intensity contrast between areturns a measure of the intensity contrast between apixel and its neighbor over the whole patch.pixel and its neighbor over the whole patch.

    ),(|| 2

    ,

    jipjiji

    Range = [0 (size(GLCM,1)Range = [0 (size(GLCM,1)--1)^2]1)^2]

    Contrastis 0 fora constantimage.Contrastis 0 fora constantimage.

    A patchthatgoes from 1 to 8 and 8 to 1A patchthatgoes from 1 to 8 and 8 to 1repeatedly willhavethemaximum contrast.repeatedly willhavethemaximum contrast.

  • 8/6/2019 An Drew 08

    26/35

    ProcessProcess

    4.4. Find Statistical Measures of PatchesFind Statistical Measures of Patches

    b)b) Correlation:Correlation: Returns a measure of how correlated a pixel is toReturns a measure of how correlated a pixel is toits neighbor over the whole patch.its neighbor over the whole patch.

    Range = [Range = [--1 1]1 1]

    Correlationis 1 fora perfectly positivelyCorrelationis 1 fora perfectly positivelycorrelatedimage.correlatedimage.

    CorrelationisCorrelationis --1 fora perfectlynegatively1 fora perfectlynegativelycorrelatedimage.correlatedimage.

    CorrelationCorrelationisis NaNNaN fora constantimage.fora constantimage.

    ji ji

    jipujjuii

    ,

    ),())((WW

  • 8/6/2019 An Drew 08

    27/35

    ProcessProcess

    4.4. Find Statistical Measures of PatchesFind Statistical Measures of Patches

    c)c) Energy:Energy: Returns the sum of squared elements in the GLCM.Returns the sum of squared elements in the GLCM.

    Range = [0 1]Range = [0 1]

    Energyis 1 fora constantimage.Energyis 1 fora constantimage.

    As energygets closertozero,itindicates anAs energygets closertozero,itindicates anincreaseof change fromone pixeltothenext.increaseof change fromone pixeltothenext.

    ji jip,2

    ),(

  • 8/6/2019 An Drew 08

    28/35

    ProcessProcess

    4.4. Find Statistical Measures of PatchesFind Statistical Measures of Patches

    d)d) Homogeneity:Homogeneity: Returns a value that measure the closeness ofReturns a value that measure the closeness ofthe distribution of elements in the GLCM to the GLCM diagonal.the distribution of elements in the GLCM to the GLCM diagonal.

    Range = [0 1]

    Range = [0 1]

    Homogeneityis 1 foradiagonal GLCM.Homogeneityis 1 foradiagonal GLCM.

    Homogeneityis ameasureof smoothness.Homogeneityis ameasureof smoothness.

    ji ji

    jip

    , 1

    ),(

  • 8/6/2019 An Drew 08

    29/35

    ProcessProcess

    Example: Find the coExample: Find the co--propsprops

    00 00 11 00 11 00 00 00

    00 00 00 00 00 00 00 00

    00 00 00 00 00 00 00 00

    00 00 00 00 11 00 00 00

    00 00 00 11 11 11 00 0000 00 00 00 33 22 11 00

    00 00 00 00 11 33 00 00

    00 00 00 00 00 00 22 22

    GLCM:

    12

    3

    4

    5

    6

    7

    8

    1 2 3 4 5 6 7 8

    00 00 .05.05 00 .05.05 00 00 00

    00 00 00 00 00 00 00 00

    00 00 00 00 00 00 00 00

    00 00 00 00 .05.05 00 00 00

    00 00 00 .05.05 .05.05 .05.05 00 0000 00 00 00 .15.15 .1.1 .05.05 00

    00 00 00 00 .05.05 .15.15 00 00

    00 00 00 00 00 00 .1.1 .1.1

    1

    2

    3

    4

    56

    7

    8

    1 2 3 4 5 6 7 8

    GLCM: sum of elements equals 1

  • 8/6/2019 An Drew 08

    30/35

    ProcessProcess

    4.4. Find Statistical Measures of PatchesFind Statistical Measures of Patches

    a)a) Contrast:Contrast: returns a measure of the intensity contrast between areturns a measure of the intensity contrast between apixel and its neighbor over the whole patch.pixel and its neighbor over the whole patch.

    ),(|| 2

    ,

    jipjiji

    Range = [0 (size(GLCM,1)Range = [0 (size(GLCM,1)--1)^2]1)^2]

    Contrastis 0 fora constantimage.Contrastis 0 fora constantimage.

    A patchthatgoes from 1 to 8 and 8 to 1A patchthatgoes from 1 to 8 and 8 to 1repeatedly willhavethemaximum contrast.repeatedly willhavethemaximum contrast.

  • 8/6/2019 An Drew 08

    31/35

    ProcessProcess

    4.4. Find Statistical Measures of PatchesFind Statistical Measures of Patches

    a)a) Contrast:Contrast: returns a measure of the intensity contrast between areturns a measure of the intensity contrast between apixel and its neighbor over the whole patch.pixel and its neighbor over the whole patch.

    ),(|| 2

    ,

    jipjiji

    7/47/4oror1.751.75

  • 8/6/2019 An Drew 08

    32/35

    ProcessProcess

    4.4. Find Statistical Measures of PatchesFind Statistical Measures of Patches

    c)c) Energy:Energy: Returns the sum of squared elements in the GLCM.Returns the sum of squared elements in the GLCM.

    Range = [0 1]Range = [0 1]

    Energyis 1 fora constantimage.Energyis 1 fora constantimage.

    As energygets closertozero,itindicates anAs energygets closertozero,itindicates anincreaseof change fromone pixeltothenext.increaseof change fromone pixeltothenext.

    ji jip,2

    ),(

  • 8/6/2019 An Drew 08

    33/35

    ProcessProcess

    4.4. Find Statistical Measures of PatchesFind Statistical Measures of Patches

    c)c) Energy:Energy: Returns the sum of squared elements in the GLCM.Returns the sum of squared elements in the GLCM.

    38/40038/400OrOr.095.095

    ji jip,2

    ),(

  • 8/6/2019 An Drew 08

    34/35

    ProcessProcess

    4.4. Find Statistical Measures of PatchesFind Statistical Measures of Patches

    d)d) Homogeneity:Homogeneity: Returns a value that measure the closeness ofReturns a value that measure the closeness ofthe distribution of elements in the GLCM to the GLCM diagonal.the distribution of elements in the GLCM to the GLCM diagonal.

    Range = [0 1]

    Range = [0 1]

    Homogeneityis 1 foradiagonal GLCM.Homogeneityis 1 foradiagonal GLCM.

    Homogeneityis ameasureof smoothness.Homogeneityis ameasureof smoothness.

    ji ji

    jip

    , 1

    ),(

  • 8/6/2019 An Drew 08

    35/35

    ProcessProcess

    4.4. Find Statistical Measures of PatchesFind Statistical Measures of Patches

    d)d) Homogeneity:Homogeneity: Returns a value that measure the closeness ofReturns a value that measure the closeness ofthe distribution of elements in the GLCM to the GLCM diagonal.the distribution of elements in the GLCM to the GLCM diagonal.

    143/240Or.5958

    ji ji

    jip

    , 1

    ),(