X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=itk%2FclitkResampleImageWithOptionsFilter.txx;h=35eae54c2f0206a337a3c75b765ac468809d560a;hb=bb584c26a90ee926ae1769537b36123c815ea942;hp=beb85cc28adc45b01e48382c111281ef1ed0fe8c;hpb=c6af1ad959db0f78028d4cb11b6eb75f2cadc4ba;p=clitk.git diff --git a/itk/clitkResampleImageWithOptionsFilter.txx b/itk/clitkResampleImageWithOptionsFilter.txx index beb85cc..35eae54 100644 --- a/itk/clitkResampleImageWithOptionsFilter.txx +++ b/itk/clitkResampleImageWithOptionsFilter.txx @@ -3,7 +3,7 @@ Authors belong to: - University of LYON http://www.universite-lyon.fr/ - - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr + - Léon Bérard cancer center http://www.centreleonberard.fr - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr This software is distributed WITHOUT ANY WARRANTY; without even @@ -14,10 +14,10 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html - ======================================================================-====*/ + ===========================================================================**/ // clitk -#include "clitkCommon.h" +#include "clitkDD.h" // itk include #include "itkImage.h" @@ -54,7 +54,10 @@ ResampleImageWithOptionsFilter():itk::ImageToImageFilterGetOutput(0); // OutputImageRegionType region; @@ -188,18 +199,11 @@ GenerateData() InputImagePointer input = dynamic_cast(itk::ProcessObject::GetInput(0)); static const unsigned int dim = InputImageType::ImageDimension; - // Set regions and allocate - //this->GetOutput()->SetRegions(m_OutputRegion); - //this->GetOutput()->Allocate(); - // this->GetOutput()->FillBuffer(m_DefaultPixelValue); - // Create main Resample Image Filter typedef itk::ResampleImageFilter FilterType; typename FilterType::Pointer filter = FilterType::New(); filter->GraftOutput(this->GetOutput()); - // this->GetOutput()->Print(std::cout); - // this->GetOutput()->SetBufferedRegion(this->GetOutput()->GetLargestPossibleRegion()); - // this->GetOutput()->Print(std::cout); + this->GetOutput()->SetBufferedRegion(this->GetOutput()->GetLargestPossibleRegion()); // Print options if needed if (m_VerboseOptions) { @@ -220,15 +224,22 @@ GenerateData() std::cout << "LastDimIsTime = " << m_LastDimensionIsTime << std::endl; } + // Compute origin based on image corner + typename FilterType::OriginPointType origin = input->GetOrigin(); + for(unsigned int i=0; iGetSpacing()[i]; + origin[i] += 0.5 * m_OutputSpacing[i]; + } + // Instance of the transform object to be passed to the resample // filter. By default, identity transform is applied filter->SetTransform(m_Transform); filter->SetSize(m_OutputSize); filter->SetOutputSpacing(m_OutputSpacing); - filter->SetOutputOrigin(input->GetOrigin()); + filter->SetOutputOrigin(m_OutputOrigin); filter->SetDefaultPixelValue(m_DefaultPixelValue); filter->SetNumberOfThreads(this->GetNumberOfThreads()); - filter->SetOutputDirection(input->GetDirection()); // <-- NEEDED if we want to keep orientation (in case of PermutAxes for example) + filter->SetOutputDirection(m_OutputDirection); // <-- NEEDED if we want to keep orientation (in case of PermutAxes for example) // Select interpolator switch (m_InterpolationType) {