[Insight-users] Volume overlay

Sara Rolfe smrolfe at u.washington.edu
Thu Feb 10 15:15:20 EST 2011


I'm attaching my code.  The rescale intensity filter worked great to  
get the image data in the right right range.  But I'm still having a  
problem when I try to add the regions which will be labeled with  
color.  I move the data into the intensity range 100-200, and then use  
the add image filter to add the labeled image on top, so that I can  
use a piecewise colormap in VTK to apply colors to these values.  I  
think the add images may be where the problem is.  What I would rather  
do is mask the image with the labels so that the pixels in the image  
were replaced with the label value for all non-zero labels.  Is there  
anything like this implemented, or would I need to go through pixel by  
pixel and change the values?  I've only seen binary mask filters.

Thanks,
Sara



On Feb 10, 2011, at 10:56 AM, David Doria wrote:

> 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
>
> David

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110210/333f798e/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: VolumeRenderOverlay.cxx
Type: application/octet-stream
Size: 9289 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110210/333f798e/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110210/333f798e/attachment-0001.htm>


More information about the Insight-users mailing list