X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=itk%2FclitkCropLikeImageFilter.txx;h=73dd7a7d1532f0f885d1a35f71296145b9691f9f;hb=204087abbc2842775d6df583e9588ee60aaf9bef;hp=74be28ef641a20ddce21c20569d26f7cb939d7b1;hpb=fdc97293cc66a4894a2c1c4f04f53d6473ab8ab2;p=clitk.git diff --git a/itk/clitkCropLikeImageFilter.txx b/itk/clitkCropLikeImageFilter.txx index 74be28e..73dd7a7 100644 --- a/itk/clitkCropLikeImageFilter.txx +++ b/itk/clitkCropLikeImageFilter.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,16 +14,17 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html - ======================================================================-====*/ + ===========================================================================**/ #ifndef CLITKCROPLIKEIMAGEFILTER_TXX #define CLITKCROPLIKEIMAGEFILTER_TXX // clitk #include "clitkCommon.h" +#include "clitkPasteImageFilter.h" // itk -#include "itkPasteImageFilter.h" +//#include "itkPasteImageFilter.h" //-------------------------------------------------------------------- template @@ -110,6 +111,7 @@ GenerateOutputInformation() { likeStart = m_LikeImage->GetLargestPossibleRegion().GetIndex(); likeOrigin = m_LikeImage->GetOrigin(); likeSpacing = m_LikeImage->GetSpacing(); + output->CopyInformation(m_LikeImage); } else { // Only load the header (allows to use 'like' with any image type) @@ -135,6 +137,16 @@ GenerateOutputInformation() { << ") of 'like' is " << likeSpacing[i] << "."); } } + + // Check that we must crop along each dimension. If not, we use the + // size of the input image + for(unsigned int i=0; iGetLargestPossibleRegion().GetIndex()[i]; + likeSize[i] = input->GetLargestPossibleRegion().GetSize()[i]; + } + } + // Define output region m_OutputRegion.SetIndex(likeStart); m_OutputRegion.SetSize(likeSize); @@ -217,7 +229,7 @@ GenerateData() { output->FillBuffer(GetBackgroundValue()); // Paste image inside - typedef itk::PasteImageFilter PasteFilterType; + typedef clitk::PasteImageFilter PasteFilterType; typename PasteFilterType::Pointer pasteFilter = PasteFilterType::New(); //pasteFilter->ReleaseDataFlagOn(); // change nothing ? // pasteFilter->InPlaceOn(); // makt it seg fault