[Insight-users] Volume overlay

David Doria daviddoria at gmail.com
Thu Feb 10 13:56:29 EST 2011


On Thu, Feb 10, 2011 at 1:38 PM, Sara Rolfe <smrolfe at u.washington.edu>wrote:

> Hello,
>
> I'm attempting to overlay an image with color.  I've had trouble finding
> documentation on this, either in ITK or VTK.  The way I'm going about it is
> to scale the values of the image down and then use the add image filter to
> add the labels on top.  I could then use VTK to create a corresponding
> colormap.
>
> However, I'm getting stuck on something that should be very simple.  My
> operations to combine the two images are failing.  I think the problem is
> the SubtractConstantFromImageFilter.  I've checked the output and it looks
> like the constant is not being subtracted.  The input to this filter is an
> image with a value of 0 for the background and 255 for the object.  I'd like
> to change these to 0 and 1.  The pixel type is unsigned char.  I use the
> following:
>
> SubFilterType::Pointer subFilter = SubFilterType::New();
> InputPixelType subValue = 254;
> subFilter->SetConstant(subValue);
> subFilter->SetInput( imageInverter->GetOutput() );
> subFilter->Update();
>
> But the output image is still 0 - 255.  Am I missing something simple?
>
> Also, is there a better way to accomplish this task, or any examples
> showing something similar?
>
> Thanks,
> Sara
>
> Can you provide a compilable code snippet? I'm also not sure what you mean
by "overlay with color"?

Something that jumps out is that if you subtract 254 from an unsigned char
you will be assigning a negative value to an unsigned char which is
undefined.

If all you are trying to do is map (0-255) to (0-1) you could use
itkRescaleIntensityImageFilter
http://www.itk.org/Wiki/ITK/Examples/ImageProcessing/RescaleIntensityImageFilter
<http://www.itk.org/Wiki/ITK/Examples/ImageProcessing/RescaleIntensityImageFilter>
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110210/e0f995d9/attachment.htm>


More information about the Insight-users mailing list