I have a PET image represented as a list of lists of grey value intensities. Here you can find the file in a "MAT" format (you can import it like: filteredData = Flatten[#,1]&@Import["filteredData.mat", "MAT"];).

I am using MorphologicalPerimeter[] to implement a threshold based simple image segmentation. My code looks like this:

  ArrayPlot@filteredData, {
 {actThreshPercent, 1, 100, 1}

For threshold = 40:

enter image description here

If I increase the threshold, the perimeter of the curve that is returned by MorphologicalPerimeter[] becomes smaller then larger and so on. Shouldn't it be steadily smaller as the threshold increases ?

For threshold = 55:

enter image description here

Specs: Mathematica 11, Mac OSX.


The problem is that you are applying MorphologicalPerimeter to the ArrayPlot (and not just the data within the plot). Use Image instead:

Manipulate[MorphologicalPerimeter[Image[filteredData, ImageSize -> 500], 
  tau*Max@filteredData/100.], {tau, 1, 100}]

and you will see the perimeter shrinks monotonically as you increase the threshold parameter.

There are lots of ways to superimpose images. First, turn the data into an image

img = ColorNegate[Image[filteredData, ImageSize -> 500] // ImageAdjust] 

then use ImageMultiply

Manipulate[ImageMultiply[img, ColorNegate@
   MorphologicalPerimeter[Image[filteredData, ImageSize -> 500], 
    tau*Max@filteredData/100.]], {tau, 1, 100}]
  • $\begingroup$ Thanks bill. How could I superimpose the resultant image to my original one? $\endgroup$ – stathisk Aug 27 '16 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.