[Insight-users] Origin in shrink image filter wrong?
Lodron, Gerald
Gerald.Lodron at joanneum.at
Tue Dec 15 04:42:41 EST 2009
Hi
I try to downsample a DICOM image with shrink image filter and i come to no sollution. The problem is that the origin of the result is wrong:
When i load the same DICOM 3D image with the same code and downsample one of them by factor two the images should be aligned, am i right? So when i use the checkerboard the only difference should be the ressolution, am i right? But the images are not aligned so what went wrong? I am really at the end of my vodoo.
I use ITK 3.16.0 with following settings on:
ITK_IMAGE_BEHAVES_AS_ORIENTED_IMAGE
ITK_USE_CENTERED_PIXEL_COORDINATES_CONSISTENTLY
ITK_USE_CONSOLATED_MORPHOLOGY
ITK_USE_OPTIMIZED_REGISTRATION_METHODS
ITK_USE_ORIENTED_IMAGE_DIRECTION
ITK_USE_PATENTED
ITK_USE_REGION_VALIDATION_IN_ITERATORS
ITK_USE_REVIEW
ITK_USE_SYSTEM_GDCM (i installed and use gdcm 2.0.14)
ITK_USE_TEMPLATE_META_PROGRAMMING_LOOP_UNROLLING
The rest is off.
Here my pseudocode
vtkImageData image1; //3D image of short
vtkImageData image2; //the same
//Image1 is exactly the same as image 2, i use vtkCheckerboard to compare them and they are the same
//first i convert both to ITK
Itk::VTKImageToImageFilter<...>::Pointer connector1 = ...::New();
Itk::VTKImageToImageFilter<...>::Pointer connector2 = ...::New();
Connector1->SetInput(...)
...
Itk::OrientedImage<...>::pointer image1ITK;
Itk::OrientedImage<...>::pointer image2ITK;
//now i use shrink image filter to downsample one of them
itk::ShrinkImageFilter<>::Pointer filter = itk::ShrinkImageFilter<>::New();
filter->SetInput(image2ITK);
filter->SetShrinkFactor(2);
Itk::OrientedImage<...>::pointer image2ITKSmall = filter->getOutput();
//and back to vtk
Itk::ImageToVTKImageFilter::Pointer c1 = ...::New();
Itk::ImageToVTKImageFilter::Pointer c2 = ...::New();
C1->setInput(image1ITK);
//C2->setInput(image2ITK); //with that the images are aligned
C2->setInput(image2ITKSmall); //with that not aligned
//back to vtk and visualize with checkerboard
vtkImageCheckerboard* Checkerboard= vtkImageCheckerboard::New();
Checkerboard->SetInput(0, C1->getOutput());
Checkerboard->SetInput(1, C2->getOutput());
Checkerboard->SetNumberOfDivisions(2, 2, 2);
//visualize Checkerboard->getOutput()
...
More information about the Insight-users
mailing list