X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=segmentation%2FclitkExtractMediastinumFilter.h;h=3144c95be73a468f37d27e453342a6e406f73240;hb=595624eb4297e747630105d45017de69733caef2;hp=0c4e444a1c56b6db006a320f15d8f97eeb2d1657;hpb=e23e998e1f27aaf0a4a65b019cdfe73784206067;p=clitk.git diff --git a/segmentation/clitkExtractMediastinumFilter.h b/segmentation/clitkExtractMediastinumFilter.h index 0c4e444..3144c95 100644 --- a/segmentation/clitkExtractMediastinumFilter.h +++ b/segmentation/clitkExtractMediastinumFilter.h @@ -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,35 +14,60 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html - ======================================================================-====*/ + ===========================================================================**/ #ifndef CLITKEXTRACTMEDIASTINUMFILTER_H #define CLITKEXTRACTMEDIASTINUMFILTER_H -#include "clitkFilterBase.h" +#include "clitkStructuresExtractionFilter.h" namespace clitk { //-------------------------------------------------------------------- /* Try to extract the mediastinum part of a thorax CT. - Inputs : - - Patient label image - - Lungs label image - - Bones label image - - Trachea label image + Input masks needed : + - Patient + - Lungs + - Bones [Optional] + - Trachea + - VertebralBody */ //-------------------------------------------------------------------- template class ITK_EXPORT ExtractMediastinumFilter: - public clitk::FilterBase, - public itk::ImageToImageFilter + public clitk::StructuresExtractionFilter { 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; + + typedef itk::Image MaskSliceType; + typedef typename MaskSliceType::Pointer MaskSlicePointer; + typedef typename MaskSliceType::PointType MaskSlicePointType; + /** Standard class typedefs. */ - typedef itk::ImageToImageFilter Superclass; + // typedef itk::ImageToImageFilter Superclass; + typedef clitk::StructuresExtractionFilter Superclass; typedef ExtractMediastinumFilter Self; typedef itk::SmartPointer Pointer; typedef itk::SmartPointer ConstPointer; @@ -54,73 +79,52 @@ 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; - typedef typename ImageType::PointType ImagePointType; - /** 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 SetInputTracheaLabelImage(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); - - 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, ImagePixelType); - itkGetConstMacro(BackgroundValueTrachea, ImagePixelType); - GGO_DefineOption(lungBG, SetBackgroundValueTrachea, ImagePixelType); + 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); + itkBooleanMacro(UseBones); + itkSetMacro(UseBones, bool); + itkGetConstMacro(UseBones, bool); - itkSetMacro(FuzzyThreshold2, double); - itkGetConstMacro(FuzzyThreshold2, double); - GGO_DefineOption(fuzzy2, SetFuzzyThreshold2, double); + itkSetMacro(DistanceMaxToAnteriorPartOfTheVertebralBody, double); + itkGetConstMacro(DistanceMaxToAnteriorPartOfTheVertebralBody, double); - itkSetMacro(FuzzyThreshold3, double); - itkGetConstMacro(FuzzyThreshold3, double); - GGO_DefineOption(fuzzy3, SetFuzzyThreshold3, double); + void SetFuzzyThreshold(std::string tag, double value); + double GetFuzzyThreshold(std::string tag); protected: ExtractMediastinumFilter(); @@ -129,24 +133,28 @@ namespace clitk { virtual void GenerateOutputInformation(); virtual void GenerateInputRequestedRegion(); virtual void GenerateData(); - - itkSetMacro(BackgroundValue, ImagePixelType); - itkSetMacro(ForegroundValue, ImagePixelType); - - ImagePixelType m_BackgroundValuePatient; - ImagePixelType m_BackgroundValueLung; - ImagePixelType m_BackgroundValueBones; - ImagePixelType m_BackgroundValueTrachea; - ImagePixelType m_ForegroundValueLeftLung; - ImagePixelType m_ForegroundValueRightLung; - - ImagePixelType m_BackgroundValue; - ImagePixelType m_ForegroundValue; - + + MaskImagePixelType m_BackgroundValuePatient; + MaskImagePixelType m_BackgroundValueLung; + MaskImagePixelType m_BackgroundValueBones; + MaskImagePixelType m_BackgroundValueTrachea; + MaskImagePixelType m_ForegroundValueLeftLung; + MaskImagePixelType m_ForegroundValueRightLung; + + MaskImagePointer output; + MaskImagePointer patient; + MaskImagePointer lung; + MaskImagePointer bones; + MaskImagePointer trachea; + + std::map m_FuzzyThreshold; double m_IntermediateSpacing; - double m_FuzzyThreshold1; - double m_FuzzyThreshold2; - double m_FuzzyThreshold3; + bool m_UseBones; + double m_DistanceMaxToAnteriorPartOfTheVertebralBody; + + void RemovePostPartOfVertebralBody(); + + std::string m_OutputMediastinumFilename; private: ExtractMediastinumFilter(const Self&); //purposely not implemented