X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=segmentation%2FclitkExtractLungFilter.h;h=50d553ae41ce9c130d9ba7acfde941354f3d1fd6;hb=573d80d0f7a17607d2ee883c21c940c0ba020282;hp=6ec698d3a204bc98dddd17190dafa44ba8e83209;hpb=44ebb81a500e42cf19964d209e14a59812a0dd4d;p=clitk.git diff --git a/segmentation/clitkExtractLungFilter.h b/segmentation/clitkExtractLungFilter.h index 6ec698d..50d553a 100644 --- a/segmentation/clitkExtractLungFilter.h +++ b/segmentation/clitkExtractLungFilter.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,7 +14,7 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html - ======================================================================-====*/ + ===========================================================================**/ #ifndef CLITKEXTRACTLUNGSFILTER_H #define CLITKEXTRACTLUNGSFILTER_H @@ -24,6 +24,7 @@ #include "clitkDecomposeAndReconstructImageFilter.h" #include "clitkExplosionControlledThresholdConnectedImageFilter.h" #include "clitkSegmentationUtils.h" +#include "clitkFilterWithAnatomicalFeatureDatabaseManagement.h" // itk #include "itkStatisticsImageFilter.h" @@ -55,15 +56,17 @@ namespace clitk { //-------------------------------------------------------------------- //-------------------------------------------------------------------- - template + template class ITK_EXPORT ExtractLungFilter: public virtual clitk::FilterBase, - public itk::ImageToImageFilter + public clitk::FilterWithAnatomicalFeatureDatabaseManagement, + public itk::ImageToImageFilter > { public: /** Standard class typedefs. */ - typedef itk::ImageToImageFilter Superclass; + typedef itk::Image MaskImageType; + typedef itk::ImageToImageFilter Superclass; typedef ExtractLungFilter Self; typedef itk::SmartPointer Pointer; typedef itk::SmartPointer ConstPointer; @@ -85,7 +88,6 @@ namespace clitk { typedef typename ImageType::IndexType InputImageIndexType; typedef typename ImageType::PointType InputImagePointType; - typedef TMaskImageType MaskImageType; typedef typename MaskImageType::ConstPointer MaskImageConstPointer; typedef typename MaskImageType::Pointer MaskImagePointer; typedef typename MaskImageType::RegionType MaskImageRegionType; @@ -95,7 +97,8 @@ namespace clitk { typedef typename MaskImageType::PointType MaskImagePointType; itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension); - typedef int InternalPixelType; + // typedef int InternalPixelType; + typedef uchar InternalPixelType; typedef itk::Image InternalImageType; typedef typename InternalImageType::Pointer InternalImagePointer; typedef typename InternalImageType::IndexType InternalIndexType; @@ -103,14 +106,15 @@ namespace clitk { /** Connect inputs */ void SetInput(const ImageType * image); - void SetInputPatientMask(MaskImageType * mask, MaskImagePixelType BG); itkSetMacro(PatientMaskBackgroundValue, MaskImagePixelType); itkGetConstMacro(PatientMaskBackgroundValue, MaskImagePixelType); - GGO_DefineOption(patientBG, SetPatientMaskBackgroundValue, MaskImagePixelType); - // Set all options at a time - template - void SetArgsInfo(ArgsInfoType arg); + // Output filename (for AFBD) + itkSetMacro(OutputLungFilename, std::string); + itkGetMacro(OutputLungFilename, std::string); + + itkSetMacro(OutputTracheaFilename, std::string); + itkGetMacro(OutputTracheaFilename, std::string); // Get output (only availabe after update !) typename MaskImageType::Pointer GetTracheaImage() { return trachea; } @@ -122,72 +126,70 @@ namespace clitk { // For common segmentation processes itkSetMacro(MinimalComponentSize, int); itkGetConstMacro(MinimalComponentSize, int); - GGO_DefineOption(minSize, SetMinimalComponentSize, int); // Step 1 options RemoveAir itkSetMacro(UpperThreshold, InputImagePixelType); itkGetConstMacro(UpperThreshold, InputImagePixelType); - GGO_DefineOption(upper, SetUpperThreshold, InputImagePixelType); itkSetMacro(NumberOfSlicesToSkipBeforeSearchingSeed, int); itkGetConstMacro(NumberOfSlicesToSkipBeforeSearchingSeed, int); - GGO_DefineOption(skipslices, SetNumberOfSlicesToSkipBeforeSearchingSeed, int); itkSetMacro(LowerThreshold, InputImagePixelType); itkGetConstMacro(LowerThreshold, InputImagePixelType); itkSetMacro(UseLowerThreshold, bool); itkGetConstMacro(UseLowerThreshold, bool); itkBooleanMacro(UseLowerThreshold); - GGO_DefineOption_WithTest(lower, SetLowerThreshold, InputImagePixelType, UseLowerThreshold); void SetLabelizeParameters1(LabelParamType * a) { m_LabelizeParameters1 = a; } itkGetConstMacro(LabelizeParameters1, LabelParamType*); - GGO_DefineOption_LabelParam(1, SetLabelizeParameters1, LabelParamType); // Step 2 options FindTrachea itkSetMacro(UpperThresholdForTrachea, InputImagePixelType); itkGetConstMacro(UpperThresholdForTrachea, InputImagePixelType); - GGO_DefineOption(upperThresholdForTrachea, SetUpperThresholdForTrachea, InputImagePixelType); itkSetMacro(MultiplierForTrachea, double); itkGetConstMacro(MultiplierForTrachea, double); - GGO_DefineOption(multiplierForTrachea, SetMultiplierForTrachea, double); itkSetMacro(ThresholdStepSizeForTrachea, InputImagePixelType); itkGetConstMacro(ThresholdStepSizeForTrachea, InputImagePixelType); - GGO_DefineOption(thresholdStepSizeForTrachea, SetThresholdStepSizeForTrachea, InputImagePixelType); void AddSeed(InternalIndexType s); std::vector & GetSeeds() { return m_Seeds; } - GGO_DefineOption_Vector(seed, AddSeed, InternalIndexType, ImageType::ImageDimension, true); + + itkSetMacro(TracheaVolumeMustBeCheckedFlag, bool); + itkGetConstMacro(TracheaVolumeMustBeCheckedFlag, bool); + itkBooleanMacro(TracheaVolumeMustBeCheckedFlag); + + itkSetMacro(VerboseRegionGrowingFlag, bool); + itkGetConstMacro(VerboseRegionGrowingFlag, bool); + itkBooleanMacro(VerboseRegionGrowingFlag); // Step 3 options ExtractLung itkSetMacro(NumberOfHistogramBins, int); itkGetConstMacro(NumberOfHistogramBins, int); - GGO_DefineOption(bins, SetNumberOfHistogramBins, int); void SetLabelizeParameters2(LabelParamType* a) { m_LabelizeParameters2 = a; } itkGetConstMacro(LabelizeParameters2, LabelParamType*); - GGO_DefineOption_LabelParam(2, SetLabelizeParameters2, LabelParamType); // Step 4 options RemoveTrachea itkSetMacro(RadiusForTrachea, int); itkGetConstMacro(RadiusForTrachea, int); - GGO_DefineOption(radius, SetRadiusForTrachea, int); void SetLabelizeParameters3(LabelParamType * a) { m_LabelizeParameters3 = a; } itkGetConstMacro(LabelizeParameters3, LabelParamType*); - GGO_DefineOption_LabelParam(3, SetLabelizeParameters3, LabelParamType); // Step 5 final openclose - itkSetMacro(FinalOpenClose, bool); - itkGetConstMacro(FinalOpenClose, bool); - itkBooleanMacro(FinalOpenClose); - GGO_DefineOption_Flag(openclose, SetFinalOpenClose); + itkSetMacro(OpenCloseFlag, bool); + itkGetConstMacro(OpenCloseFlag, bool); + itkBooleanMacro(OpenCloseFlag); - itkSetMacro(FinalOpenCloseRadius, int); - itkGetConstMacro(FinalOpenCloseRadius, int); - GGO_DefineOption(opencloseRadius, SetFinalOpenCloseRadius, int); + itkSetMacro(OpenCloseRadius, int); + itkGetConstMacro(OpenCloseRadius, int); + + // Step 6 fill holes + itkSetMacro(FillHolesFlag, bool); + itkGetConstMacro(FillHolesFlag, bool); + itkBooleanMacro(FillHolesFlag); protected: ExtractLungFilter(); @@ -195,12 +197,12 @@ namespace clitk { // Main members InputImageConstPointer input; - MaskImageConstPointer patient; + MaskImagePointer patient; InputImagePointer working_input; - typename InternalImageType::Pointer working_image; - typename InternalImageType::Pointer trachea_tmp; + std::string m_OutputLungFilename; + std::string m_OutputTracheaFilename; + MaskImagePointer working_mask; MaskImagePointer trachea; - MaskImagePointer output; unsigned int m_MaxSeedNumber; // Global options @@ -223,6 +225,8 @@ namespace clitk { double m_MultiplierForTrachea; std::vector m_Seeds; int m_NumberOfSlicesToSkipBeforeSearchingSeed; + bool m_TracheaVolumeMustBeCheckedFlag; + bool m_VerboseRegionGrowingFlag; // Step 3 int m_NumberOfHistogramBins; @@ -233,11 +237,16 @@ namespace clitk { LabelParamType* m_LabelizeParameters3; // Step 5 - bool m_FinalOpenClose; - int m_FinalOpenCloseRadius; + bool m_OpenCloseFlag; + int m_OpenCloseRadius; + + // Step 6 + bool m_FillHolesFlag; + InputImageSizeType m_FillHolesDirections; // Main functions virtual void GenerateOutputInformation(); + virtual void GenerateInputRequestedRegion(); virtual void GenerateData(); // Functions for trachea extraction