[Insight-users] All zero output with ResampleImageFilter (ITK 3.4)
Luis Ibanez
luis.ibanez at kitware.com
Tue Dec 2 17:33:34 EST 2008
Hi Victor,
1) How did you arrive to the conclusion
that all the output values are zeros ?
because you see a black image in a visualization tool ?
or because you actually used a program to check the
pixel values ?
2) If you set the Similarty Transform to be an Identity,
do you see an proper image in the output ?
Please let us know,
Thanks
Luis
--------------------------------
Víctor Rodrigo Córdoba wrote:
> Hi All.
>
> I have the following function to register models (modReader) to the size
> of an active contour (contActivo). Xsize, ysize and zsize are the number
> of rows, columns and slices of active contour bounding box.
>
> When I execute it, the output of the Resample filter is all zero. I
> don't know what I'm doing wrong.
> I need your help.
>
> typedef signed short PixelType;
> typedef itk::Image< PixelType, 3 > ImageType;
> typedef double FPixelType;
> typedef itk::Image< FPixelType, 3 > FImageType;
> typedef itk::ImageSeriesReader< ImageType > ReaderType;
>
> ImageType::Pointer adaptarModeloImg4D(ReaderType::Pointer modReader,int
> xsize,int ysize,int zsize,FImageType::Pointer contActivo)
> {
> typedef itk::ResampleImageFilter<ImageType,ImageType> ResampleFilter;
> ResampleFilter::Pointer filResample = ResampleFilter::New();
> filResample->SetInput(modReader->GetOutput());
>
> typedef itk::LinearInterpolateImageFunction<ImageType, double >
> InterpolatorType;
> InterpolatorType::Pointer interpolator = InterpolatorType::New();
> filResample->SetInterpolator(interpolator);
> filResample->SetDefaultPixelValue(0);
>
> const FImageType::SpacingType& spacing = contActivo->GetSpacing();
> const FImageType::PointType& origin = contActivo->GetOrigin();
> FImageType::SizeType sizeCA =
> contActivo->GetLargestPossibleRegion().GetSize();
> ImageType::SizeType sizeMod =
> modReader->GetOutput()->GetLargestPossibleRegion().GetSize();
> filResample->SetOutputOrigin(origin);
> filResample->SetOutputSpacing(spacing);
> filResample->SetSize(sizeCA);
>
> // Computing scale on rows, columns and slices
> double scaleX = (double)xsize/(double)sizeMod[1];
> double scaleY = (double)ysize/(double)sizeMod[0];
> double scaleZ = (double)zsize/(double)sizeMod[2];
>
> // Tanking the minimum scale
> double scale = scaleX<scaleY ? scaleX:scaleY;
> scale = scale<scaleZ ? scale:scaleZ;
>
> typedef itk::Similarity3DTransform< double > TransformType;
> TransformType::Pointer transform = TransformType::New();
> transform->SetScale(scale);
>
> // Computing the beginning of the active contour
> int posY= floor(((double)sizeCA[0]-(double)sizeMod[0]*scale)/2);
> int posX= floor(((double)sizeCA[1]-(double)sizeMod[1]*scale)/2);
> int posZ= floor(((double)sizeCA[2]-(double)sizeMod[2]*scale)/2);
>
> // Moving model to active contour beginning
> TransformType::OutputVectorType translation;
> translation[0] = posY-origin[0];
> translation[1] = posX-origin[1];
> translation[2] = posZ-origin[2];
>
> // Updating resample filter
> transform->SetTranslation(translation);
> filResample->SetTransform(transform);
> filResample->Update();
>
> return filResample->GetOutput();
> }
>
> Thank you.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
More information about the Insight-users
mailing list