[Insight-users] Volume overlay

Sara Rolfe smrolfe at u.washington.edu
Thu Feb 10 16:49:39 EST 2011


The labels image has unsigned chars between 0-4.  I implemented the  
iterator like you suggested, and now the value range is correct.   
However, the display looks incorrect.  I am thinking that it may be a  
VTK issue now.

On Feb 10, 2011, at 1:29 PM, robert tamburo wrote:

> What's the value of your label? In your previous code, the output of  
> the add filter is set to unsigned char, so you may have typecasting  
> issues as David alluded to.
>
> Your current code looks okay to me. Try writing bwImage to disk to  
> determine if there is an ITK or VTK issue.
>
>
> On Thu, Feb 10, 2011 at 3:15 PM, Sara Rolfe  
> <smrolfe at u.washington.edu> wrote:
> 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
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110210/f266c7eb/attachment.htm>


More information about the Insight-users mailing list