X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=segmentation%2FclitkExtractMediastinumFilter.h;h=411e20f9a012f16dee145f44f5767ce9b50d0787;hb=d30d301ddbebb5f290f8d9c0104dc6448ea531e1;hp=6c252d49b51714e41994f58d9ece50c84db4fe47;hpb=e008d74b0ecdc4ca2eaae8c429901a78f9ef5c31;p=clitk.git diff --git a/segmentation/clitkExtractMediastinumFilter.h b/segmentation/clitkExtractMediastinumFilter.h index 6c252d4..411e20f 100644 --- a/segmentation/clitkExtractMediastinumFilter.h +++ b/segmentation/clitkExtractMediastinumFilter.h @@ -20,6 +20,7 @@ #define CLITKEXTRACTMEDIASTINUMFILTER_H #include "clitkFilterBase.h" +#include "clitkFilterWithAnatomicalFeatureDatabaseManagement.h" namespace clitk { @@ -30,18 +31,40 @@ namespace clitk { - Patient label image - Lungs label image - Bones label image + - Trachea label image */ //-------------------------------------------------------------------- template class ITK_EXPORT ExtractMediastinumFilter: - public clitk::FilterBase, - public itk::ImageToImageFilter + public virtual clitk::FilterBase, + public clitk::FilterWithAnatomicalFeatureDatabaseManagement, + public itk::ImageToImageFilter > { public: + /** Some convenient typedefs. */ + typedef TImageType ImageType; + typedef typename ImageType::ConstPointer ImageConstPointer; + typedef typename ImageType::Pointer ImagePointer; + typedef typename ImageType::RegionType ImageRegionType; + typedef typename ImageType::PixelType ImagePixelType; + typedef typename ImageType::SizeType ImageSizeType; + typedef typename ImageType::IndexType ImageIndexType; + typedef typename ImageType::PointType ImagePointType; + + /** Some convenient typedefs. */ + typedef uchar MaskImagePixelType; + typedef itk::Image MaskImageType; + typedef typename MaskImageType::ConstPointer MaskImageConstPointer; + typedef typename MaskImageType::Pointer MaskImagePointer; + typedef typename MaskImageType::RegionType MaskImageRegionType; + typedef typename MaskImageType::SizeType MaskImageSizeType; + typedef typename MaskImageType::IndexType MaskImageIndexType; + typedef typename MaskImageType::PointType MaskImagePointType; + /** Standard class typedefs. */ - typedef itk::ImageToImageFilter Superclass; + typedef itk::ImageToImageFilter Superclass; typedef ExtractMediastinumFilter Self; typedef itk::SmartPointer Pointer; typedef itk::SmartPointer ConstPointer; @@ -53,63 +76,64 @@ namespace clitk { itkTypeMacro(ExtractMediastinumFilter, InPlaceImageFilter); FILTERBASE_INIT; - /** Some convenient typedefs. */ - typedef TImageType ImageType; - typedef typename ImageType::ConstPointer ImageConstPointer; - typedef typename ImageType::Pointer ImagePointer; - typedef typename ImageType::RegionType ImageRegionType; - typedef typename ImageType::PixelType ImagePixelType; - typedef typename ImageType::SizeType ImageSizeType; - typedef typename ImageType::IndexType ImageIndexType; - /** Connect inputs */ - void SetInputPatientLabelImage(const TImageType * image, ImagePixelType bg=0); - void SetInputLungLabelImage(const TImageType * image, ImagePixelType bg=0, - ImagePixelType fgLeftLung=1, ImagePixelType fgRightLung=2); - void SetInputBonesLabelImage(const TImageType * image, ImagePixelType bg=0); + void SetInput(const ImageType * image); + void SetInputPatientLabelImage(const MaskImageType * image, MaskImagePixelType bg=0); + void SetInputLungLabelImage(const MaskImageType * image, MaskImagePixelType bg=0, + MaskImagePixelType fgLeftLung=1, MaskImagePixelType fgRightLung=2); + void SetInputBonesLabelImage(const MaskImageType * image, MaskImagePixelType bg=0); + void SetInputTracheaLabelImage(const MaskImageType * image, MaskImagePixelType bg=0); + // Output filename (for AFBD) + itkSetMacro(OutputMediastinumFilename, std::string); + itkGetConstMacro(OutputMediastinumFilename, std::string); + /** ImageDimension constants */ - itkStaticConstMacro(ImageDimension, unsigned int, TImageType::ImageDimension); + itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension); - // Set all options at a time - template - void SetArgsInfo(ArgsInfoType arg); - // Background / Foreground - itkSetMacro(BackgroundValuePatient, ImagePixelType); - itkGetConstMacro(BackgroundValuePatient, ImagePixelType); - GGO_DefineOption(patientBG, SetBackgroundValuePatient, ImagePixelType); + itkSetMacro(BackgroundValuePatient, MaskImagePixelType); + itkGetConstMacro(BackgroundValuePatient, MaskImagePixelType); - itkSetMacro(BackgroundValueLung, ImagePixelType); - itkGetConstMacro(BackgroundValueLung, ImagePixelType); - GGO_DefineOption(lungBG, SetBackgroundValueLung, ImagePixelType); + itkSetMacro(BackgroundValueLung, MaskImagePixelType); + itkGetConstMacro(BackgroundValueLung, MaskImagePixelType); - itkSetMacro(BackgroundValueBones, ImagePixelType); - itkGetConstMacro(BackgroundValueBones, ImagePixelType); - GGO_DefineOption(bonesBG, SetBackgroundValueBones, ImagePixelType); + itkSetMacro(BackgroundValueBones, MaskImagePixelType); + itkGetConstMacro(BackgroundValueBones, MaskImagePixelType); - itkGetConstMacro(BackgroundValue, ImagePixelType); - itkGetConstMacro(ForegroundValue, ImagePixelType); + itkGetConstMacro(BackgroundValue, MaskImagePixelType); + itkGetConstMacro(ForegroundValue, MaskImagePixelType); - itkSetMacro(ForegroundValueLeftLung, ImagePixelType); - itkGetConstMacro(ForegroundValueLeftLung, ImagePixelType); - GGO_DefineOption(lungLeft, SetForegroundValueLeftLung, ImagePixelType); + itkSetMacro(ForegroundValueLeftLung, MaskImagePixelType); + itkGetConstMacro(ForegroundValueLeftLung, MaskImagePixelType); - itkSetMacro(ForegroundValueRightLung, ImagePixelType); - itkGetConstMacro(ForegroundValueRightLung, ImagePixelType); - GGO_DefineOption(lungRight, SetForegroundValueRightLung, ImagePixelType); + itkSetMacro(ForegroundValueRightLung, MaskImagePixelType); + itkGetConstMacro(ForegroundValueRightLung, MaskImagePixelType); + + itkSetMacro(BackgroundValueTrachea, MaskImagePixelType); + itkGetConstMacro(BackgroundValueTrachea, MaskImagePixelType); itkSetMacro(IntermediateSpacing, double); itkGetConstMacro(IntermediateSpacing, double); - GGO_DefineOption(spacing, SetIntermediateSpacing, double); itkSetMacro(FuzzyThreshold1, double); itkGetConstMacro(FuzzyThreshold1, double); - GGO_DefineOption(fuzzy1, SetFuzzyThreshold1, double); itkSetMacro(FuzzyThreshold2, double); itkGetConstMacro(FuzzyThreshold2, double); - GGO_DefineOption(fuzzy2, SetFuzzyThreshold2, double); + + itkSetMacro(FuzzyThreshold3, double); + itkGetConstMacro(FuzzyThreshold3, double); + + itkBooleanMacro(UseBones); + itkSetMacro(UseBones, bool); + itkGetConstMacro(UseBones, bool); + + itkSetMacro(UpperThreshold, double); + itkGetConstMacro(UpperThreshold, double); + + itkSetMacro(LowerThreshold, double); + itkGetConstMacro(LowerThreshold, double); protected: ExtractMediastinumFilter(); @@ -119,21 +143,30 @@ namespace clitk { virtual void GenerateInputRequestedRegion(); virtual void GenerateData(); - itkSetMacro(BackgroundValue, ImagePixelType); - itkSetMacro(ForegroundValue, ImagePixelType); - - ImagePixelType m_BackgroundValuePatient; - ImagePixelType m_BackgroundValueLung; - ImagePixelType m_BackgroundValueBones; - ImagePixelType m_ForegroundValueLeftLung; - ImagePixelType m_ForegroundValueRightLung; - - ImagePixelType m_BackgroundValue; - ImagePixelType m_ForegroundValue; + itkSetMacro(BackgroundValue, MaskImagePixelType); + itkSetMacro(ForegroundValue, MaskImagePixelType); + MaskImagePixelType m_BackgroundValuePatient; + MaskImagePixelType m_BackgroundValueLung; + MaskImagePixelType m_BackgroundValueBones; + MaskImagePixelType m_BackgroundValueTrachea; + MaskImagePixelType m_ForegroundValueLeftLung; + MaskImagePixelType m_ForegroundValueRightLung; + + MaskImagePixelType m_BackgroundValue; + MaskImagePixelType m_ForegroundValue; + + typename MaskImageType::Pointer output; + double m_IntermediateSpacing; double m_FuzzyThreshold1; double m_FuzzyThreshold2; + double m_FuzzyThreshold3; + bool m_UseBones; + double m_UpperThreshold; + double m_LowerThreshold; + + std::string m_OutputMediastinumFilename; private: ExtractMediastinumFilter(const Self&); //purposely not implemented