[vtkusers] [Insight-users] itk/vtk rgb/luminance translation confusion
Matt McCormick
matt.mccormick at kitware.com
Tue Sep 17 19:12:46 EDT 2013
Hi Rishi,
I believe there is an error in how the vtkSmartPointer's are being
passed around the functions. If the code is moved out of the
functions to inline, it appears to work correctly.
HTH,
Matt
On Wed, Sep 4, 2013 at 10:15 PM, Rishi Graham <rishig at soe.ucsc.edu> wrote:
> Hello,
>
> I am a complete itk/vtk noob. Please excuse the vague title, I am
> absolutely baffled as to exactly where my code is going wrong. For this
> reason, I am also unsure how to search the insight-users archive for similar
> issues (although I have tried). I admit, it's been a while since I was
> regularly coding in c++, so there is probably a very simple mistake
> somewhere. I am trying to do something I think is fairly simple and getting
> results I was not expecting. The code, input, and output screenshots are
> attached. I'm running this on a Mac (OS 10.8.4), with ITK version 4.4.1,
> VTK6.0.0. Here is a rundown of what I'm trying to do and what's unexpected.
>
> The goal is to produce a vtkRenderWindow with 2 images as follows.
> Image1:
> 1) loaded from jpeg as an rgb image
> 2) run through ImageToVTKImageFilter (with a flip filter to get the
> orientation right)
> 3) rendered and displayed (as the "raw" input data)
>
> Image2:
> 1) loaded from jpeg as an rgb image
> 2) run through an RGBToLuminanceFilter
> 3) cast back into RGB with CastImageFilter
> 4) run through ImageToVTKImageFilter (with a flip filter to get the
> orientation right)
> 5) rendered and displayed (as the "processed" output data)
>
> I expect that Image1 will look like the original jpg, while Image2 will just
> be a greyscale version of the original. This happens as expected when the
> input files contain different pictures (attached "GoodOutput.png").
> However, if I load the same jpg file in step 1 for both images, then what I
> see is the expected (greyscale) output in the Image2 slot, and a flipped
> version of the greyscale image in the Image1 slot ("BadOutput.png"). This
> same result holds if I duplicate the file and pass in the two different (but
> identical) input files. Any idea where I have gone wrong?
>
> I set this up as a simple test case, my ultimate goal is to extract an ROI
> from an RGB image, processing it as grayscale, then placing the result back
> into the original (color) image. If there is a better way to go about this,
> I'd love to know!
>
> Thank you for your time,
> -Rishi.
>
>
>
>
>
>
>
> _____________________________________
> 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.php
>
> 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
>
More information about the vtkusers
mailing list