X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=itk%2FclitkCropLikeImageFilter.h;h=cc7623f5741a49a2d4e0efc735e95ecd8a9311a5;hb=fc2b78aedceae6ebeb0dbe8aae649bc84fd8e235;hp=221f61cd3fc7934738d7b9980352f4c6c9d06899;hpb=fdc97293cc66a4894a2c1c4f04f53d6473ab8ab2;p=clitk.git diff --git a/itk/clitkCropLikeImageFilter.h b/itk/clitkCropLikeImageFilter.h index 221f61c..cc7623f 100644 --- a/itk/clitkCropLikeImageFilter.h +++ b/itk/clitkCropLikeImageFilter.h @@ -1,9 +1,9 @@ /*========================================================================= Program: vv http://www.creatis.insa-lyon.fr/rio/vv - Authors belong to: + 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,21 +14,26 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html - ======================================================================-====*/ + ===========================================================================**/ #ifndef CLITKCROPLIKEIMAGEFILTER_H #define CLITKCROPLIKEIMAGEFILTER_H +// clitk +#include "clitkBoundingBoxUtils.h" +#include "clitkImageCommon.h" + +// itk #include namespace clitk { - + //-------------------------------------------------------------------- /* Perform various cropping operation on a image */ //-------------------------------------------------------------------- - + template class ITK_EXPORT CropLikeImageFilter: public itk::ImageToImageFilter { public: @@ -37,10 +42,10 @@ namespace clitk { typedef itk::ImageToImageFilter Superclass; typedef itk::SmartPointer Pointer; typedef itk::SmartPointer ConstPointer; - + /** Method for creation through the object factory. */ itkNewMacro(Self); - + /** Run-time type information (and related methods). */ itkTypeMacro(CropLikeImageFilter, ImageToImageFilter); @@ -60,19 +65,22 @@ namespace clitk { // Set Background if 'like' is greater than input itkSetMacro(BackgroundValue, PixelType); - itkGetConstMacro(BackgroundValue, PixelType); + itkGetConstMacro(BackgroundValue, PixelType); /** ImageDimension constants */ itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension); + // I dont want to verify inputs information + virtual void VerifyInputInformation() { } + protected: CropLikeImageFilter(); virtual ~CropLikeImageFilter() {} - + virtual void GenerateOutputInformation(); virtual void GenerateData(); virtual void GenerateInputRequestedRegion(); - + PixelType m_BackgroundValue; RegionType m_OutputRegion; RegionType m_Region; @@ -81,22 +89,44 @@ namespace clitk { PointType m_Origin; const itk::ImageBase * m_LikeImage; std::vector m_CropAlongThisDimension; - + PointType m_StartPoint; // start point in physical world - IndexType m_StartSourceIndex; // start index in "source" image - IndexType m_StartDestIndex; // start index in "destination" image - + IndexType m_StartSourceIndex; // start index in "source" image + IndexType m_StartDestIndex; // start index in "destination" image + PointType m_StopPoint; // stop point in physical world - IndexType m_StopSourceIndex; // stop index in "source" image - IndexType m_StopDestIndex; // stop index in "destination" image - + IndexType m_StopSourceIndex; // stop index in "source" image + IndexType m_StopDestIndex; // stop index in "destination" image + private: CropLikeImageFilter(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented - + }; // end class //-------------------------------------------------------------------- + + //-------------------------------------------------------------------- + // Convenient function + template + typename ImageType::Pointer + ResizeImageLike(const ImageType * input, + const itk::ImageBase * like, + typename ImageType::PixelType BG); + + template + typename ImageType::Pointer + ResizeImageLike(const ImageType * input, + typename itk::ImageBase::RegionType * like, + typename ImageType::PixelType BG); + + template + typename ImageType::Pointer + ResizeImageLike(const ImageType * input, + typename itk::BoundingBox::Pointer bb, + typename ImageType::PixelType BG); + + } // end namespace clitk //--------------------------------------------------------------------