X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=itk%2FclitkCropLikeImageFilter.h;h=cc7623f5741a49a2d4e0efc735e95ecd8a9311a5;hb=fc2b78aedceae6ebeb0dbe8aae649bc84fd8e235;hp=9281fcad71fc7ec7ce2c7cd5a049a76078670861;hpb=5b568893e14e5d955fa14f653bd176b54c6aee0c;p=clitk.git diff --git a/itk/clitkCropLikeImageFilter.h b/itk/clitkCropLikeImageFilter.h index 9281fca..cc7623f 100644 --- a/itk/clitkCropLikeImageFilter.h +++ b/itk/clitkCropLikeImageFilter.h @@ -1,7 +1,7 @@ /*========================================================================= 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://www.centreleonberard.fr - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr @@ -19,16 +19,21 @@ #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,7 +65,7 @@ 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); @@ -71,11 +76,11 @@ namespace clitk { protected: CropLikeImageFilter(); virtual ~CropLikeImageFilter() {} - + virtual void GenerateOutputInformation(); virtual void GenerateData(); virtual void GenerateInputRequestedRegion(); - + PixelType m_BackgroundValue; RegionType m_OutputRegion; RegionType m_Region; @@ -84,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 //--------------------------------------------------------------------