[Insight-users] WG: Origin in shrink image filter wrong?
Lodron, Gerald
Gerald.Lodron at joanneum.at
Tue Dec 15 08:59:58 EST 2009
No, the only restriction i found is that the smaller image must came first :-)
Here the exact code snippet:
double l1 = vtkImage1->GetLength();
double l2 = vtkImage2->GetLength();
if(l1<l2)
{
m_Checkerboard->SetInput(0, vtkImage1);
m_Checkerboard->SetInput(1, vtkImage2);
}
else
{
m_Checkerboard->SetInput(0, vtkImage2);
m_Checkerboard->SetInput(1, vtkImage1);
}
Best regards
-----Ursprüngliche Nachricht-----
Von: Bill Lorensen [mailto:bill.lorensen at gmail.com]
Gesendet: Dienstag, 15. Dezember 2009 14:51
An: Lodron, Gerald
Cc: insight-users at itk.org
Betreff: Re: [Insight-users] WG: Origin in shrink image filter wrong?
I believe that the two inputs to checkerboard must have the same number of pixels in i, j, and k. I am surprised it did not crash.
On Tue, Dec 15, 2009 at 4:58 AM, Lodron, Gerald <Gerald.Lodron at joanneum.at> wrote:
>
> Maybe that helps:
>
> vtkImageData image1; //Spacing: (8.5 8.5 4), Origin (-275 -275
> -1285), Dimensions(64,64,64), Increments(0,0,0),
> Extent(0,63,0,63,0,63), Bounds(-275,266,-275,266,-1285,-1033)
>
> vtkImageData image2; // the same
> ...
> Blabla
> ...
> vtkImageData shrinkedImage; //Spacing: (17 17 8), Origin (-270 -270
> -1283), Dimensions(32,32,32), Increments(0,0,0),
> Extent(0,31,0,31,0,31), Bounds(-270,262,-270,262,-1283,-1035)
>
> -----Ursprüngliche Nachricht-----
> Von: insight-users-bounces at itk.org
> [mailto:insight-users-bounces at itk.org] Im Auftrag von Lodron, Gerald
> Gesendet: Dienstag, 15. Dezember 2009 10:43
> An: insight-users at itk.org
> Betreff: [Insight-users] Origin in shrink image filter wrong?
>
> 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()); SetInput(1,
> Checkerboard->C2->getOutput()); SetNumberOfDivisions(2, 2, 2);
>
> //visualize Checkerboard->getOutput()
> ...
>
>
>
>
>
>
>
> _____________________________________
> 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
> _____________________________________
> 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
>
More information about the Insight-users
mailing list