[Insight-users] "Zoom -> Paste -> Write" pipeline problem

Arturo Caissut arturo_caissut at tiscali.it
Mon Sep 14 09:56:06 EDT 2009


Ok, maybe I'm stupid or something, but I still cannot make
ResampleFilter work as I need. I cannot obtain anything but a blank
image as an output, and I cannot figure why.

My resample part's code looks like this:

|
typedef itk::RGBPixel<double> RGBPixelType;
typedef itk::Image<RGBPixelType, 3> PartImageType;

typedef itk::VectorResampleImageFilter<PartImageType, PartImageType>
ResamplerType;
typedef itk::AffineTransform<double,3> TransformType;
typedef
itk::VectorNearestNeighborInterpolateImageFunction<PartImageType,
double> InterpolatorType;

ResamplerType::Pointer resampler = ResamplerType::New();
InterpolatorType::Pointer interpolator = InterpolatorType::New();

RGBPixelType outPixel;
outPixel.Set(0,0,0);

PartImageType::DirectionType direction;
direction.SetIdentity();
resampler->SetOutputDirection(direction);

TransformType::Pointer transform = TransformType::New();

resampler->SetTransform(transform);
resampler->SetInterpolator(interpolator);
resampler->SetDefaultPixelValue(outPixel);
resampler->SetOutputOrigin(InputImage->GetOrigin());
resampler->SetSize(NewSize);
resampler->SetInput(InputImage);
resampler->Update();
|

What's wrong with this? I'm sure the flaw to be here, because if I try
to export InputImage and visualize it I have no problem at all. I also
tried it with a itkIdentityTransform, and the output is a blank image as
well. Have I got to cast my RGB image or something?


Arturo




>> Bill Lorensen ha scritto:
>>   
>>     
>>> You can use ResampleImageFilter to "zoom". Be sure to use the
>>> NearestNeighborInterpolateImageFunction since the atlas is segmented
>>> and not continuous data.
>>>
>>> On Thu, Sep 10, 2009 at 9:10 PM, Arturo Caissut
>>> <arturo_caissut at tiscali.it> wrote:
>>>   
>>>     
>>>       
>>>> Hi all,
>>>>
>>>> I'm in a little trouble with the final part of a small utility I'm
>>>> writing, and I'd appreciate very much your help to solve it, as usual.
>>>>
>>>> The goal of the program I'm writing is to extract one off the 116 parts
>>>> of the Tzourio-Mazoyer's AAL atlas from it, and then save such a part on
>>>> an arbitrary sized 3D image. It doesn't really matter where this
>>>> segmented part is situated, nor if it is scaled (in a geometrical sense)
>>>> or not, since the output of my program is supposed to become the input
>>>> of another tool I already wrote, that makes the user able to adjust size
>>>> and position of the segmented image at will: I just need a bunch of
>>>> correctly shaped white pixels somewhere on a black image, with the only
>>>> (deadly for me) condition that atlas image and output image must have
>>>> the same voxel size.
>>>>
>>>> I wrote all the related and unrelated stuff, then I started with a
>>>> threshold filter to obtain an RGB image with black background and white
>>>> voxels where the segmented part is situated. It obviously worked. Now,
>>>> since I don't know which part my user should want to obtain, I won't try
>>>> to "cut away" at runtime a right sized area around the segmented part to
>>>> save it as an output image, but I'll reduce (or enlarge) the whole atlas
>>>> thresholded image (let's call this "the atlas size segmented image")
>>>> instead, and then I'll paste such a reduced (or enlarged) version of the
>>>> image on a black properly sized "collector" image I created.
>>>>
>>>> Needing a way to "zoom" the atlas segmented image, I thought I could
>>>> easily do it by resetting its spacing and regions values (multiplying
>>>> these values by a "scale" needed factor deduced comparing the output
>>>> dimensions with the original ones), but shall I be able to paste an
>>>> image with -let's say- spacing = (0.5, 0.5, 0.5) on another one with
>>>> spacing = (1, 1, 1)? Since ITK has a "pixel based mind", I think that'd
>>>> be a mistake, wouldn't it?
>>>> Perhaps I should try an "hybrid" approach and copy the atlas size
>>>> segmented image on a vtkImageData to handle the image from an "higher"
>>>> point of view?
>>>>
>>>>
>>>> Thank you for your time, I'm sorry if I've been a little chaotic in
>>>> explaining my situation but it's 3 am here and I've worked at this
>>>> project for three full days now, so I really, really, REALLY need to sleep.
>>>> Arturo
>>>> _____________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.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
>>>>
>>>>     
>>>>       
>>>>         
>>>   
>>>     
>>>       
>>   
>>     
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.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
>
>   



More information about the Insight-users mailing list