Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a series of endoscopic images taken by two cameras at the same time.

A color image:

enter image description here

and a fluorescent image indicating cancerous cells

enter image description here

I now want to overlay the two images to indicate the cancer in the color image.

ImageCompose[img1, {img2, 0.35}]

enter image description here

you can see that it does not match exactly. I need a way to match both images. Another problem is, sometimes the color camera zoomed a little in while the fluorescent image does not.

In the fluorescent image everything but the bright area should be omitted.

The color image is the basis and the fluoro image should be fitted to it, preferably in some false coloring.

Here are two corresponding images: pair 1

im1col=Import["http://i.imgur.com/shzDETI.jpg"]
im1fluo=Import["http://i.imgur.com/Yh9iAXH.jpg"]

pair2

im2col=Import["http://i.imgur.com/ZnUJFrv.jpg"]
im2fluo=Import["http://imgur.com/VHlrpNj.jpg"]
share|improve this question
    
@Pickett thanks, corrected. –  spore234 May 29 at 10:23
    
What is the meaning of the axis ticks marks? If the images can be zoomed independently you'll need some scale hint to match the relative sizes –  belisarius May 29 at 12:13
    
@belisarius the axis are just arbitrary points and are only there because I converted the images from matlab files. An ideal solution would be an algorithm that could detect wheter the image is zoomed and scale the fluoro image accordingly. –  spore234 May 29 at 13:57
    
I don't think that is possible. If it were, you should be able to detect the cancerous cells just from the color image –  belisarius May 29 at 14:20

1 Answer 1

I'm providing what I've done so far. I'm using Binarize to detect the yellow part of the fluorescent image which is not great, but I hope this answer can save someone who knows how to do that in a better way some grunt work.

im1col = Import["http://i.imgur.com/shzDETI.jpg"];
im1fluo = Import["http://i.imgur.com/Yh9iAXH.jpg"];
removeFrame[img_] := 
 ColorNegate@ImageCrop@DeleteSmallComponents@ColorNegate@Binarize[img]
highlightCancerousCells[img_, fluo_] := HighlightImage[
  ImageCrop@img,
  ImagePad[
   removeFrame[fluo],
   {{#, 0}, {#2, 0}} & @@ (ImageDimensions[ImageCrop@img] - 
      ImageDimensions[removeFrame[fluo]])
   ]
  ]
highlightCancerousCells[im1col, im1fluo]

example image

The algorithm can be outlined thus:

  1. Take the fluorescent image and crop away everything but the fluorescent part
  2. Crop away the whitespace at the top and right side of the color image. This preserves the axes on the bottom left side.
  3. Check the difference in image dimensions between the new fluorescent image and the color image. Pad the fluorescent image accordingly on the bottom left side with black color.
  4. Use the binarized version of the fluorescent image, in which everything is black except for the yellow parts, to highlight the color image.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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