X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=segmentation%2FclitkExtractLungFilter.h;h=3183457dde0a6eb7ff06d445670cb132523a2ae8;hb=a24b0a699298efe54b53c53cb215455fecd633fe;hp=cf94b07f73e023d660c0a927aa7054f610d3b5ae;hpb=090511076dfb931319d0ec16fa5a08f2467362b6;p=clitk.git diff --git a/segmentation/clitkExtractLungFilter.h b/segmentation/clitkExtractLungFilter.h index cf94b07..3183457 100644 --- a/segmentation/clitkExtractLungFilter.h +++ b/segmentation/clitkExtractLungFilter.h @@ -25,11 +25,9 @@ #include "clitkExplosionControlledThresholdConnectedImageFilter.h" #include "clitkSegmentationUtils.h" #include "clitkFilterWithAnatomicalFeatureDatabaseManagement.h" -#include "tree.hh" // itk #include "itkStatisticsImageFilter.h" -#include "itkTreeContainer.h" namespace clitk { @@ -57,45 +55,18 @@ namespace clitk { */ //-------------------------------------------------------------------- - - //-------------------------------------------------------------------- - -class Bifurcation -{ -public: - typedef itk::Index<3> IndexType; - typedef itk::Point PointType; - typedef double PixelType; - Bifurcation(IndexType _index, PixelType _l, PixelType _l1, PixelType _l2) { - index = _index; - _l = l; - _l1 = l1; - _l2 = l2; - } - IndexType index; - PointType point; - PixelType l; - PixelType l1; - PixelType l2; - typedef itk::Index<3> NodeType; - typedef tree TreeType; - typedef TreeType::iterator TreeIterator; - TreeIterator treeIter; -}; //-------------------------------------------------------------------- - - - //-------------------------------------------------------------------- - template + template class ITK_EXPORT ExtractLungFilter: public virtual clitk::FilterBase, public clitk::FilterWithAnatomicalFeatureDatabaseManagement, - public itk::ImageToImageFilter + 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; @@ -117,7 +88,6 @@ public: 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; @@ -133,18 +103,21 @@ public: typedef typename InternalImageType::IndexType InternalIndexType; typedef LabelizeParameters LabelParamType; - typedef Bifurcation BifurcationType; - typedef MaskImageIndexType NodeType; - typedef tree TreeType; - typedef typename TreeType::iterator TreeIterator; - /** Connect inputs */ void SetInput(const ImageType * image); - void SetInputPatientMask(MaskImageType * mask, MaskImagePixelType BG); itkSetMacro(PatientMaskBackgroundValue, MaskImagePixelType); itkGetConstMacro(PatientMaskBackgroundValue, MaskImagePixelType); GGO_DefineOption(patientBG, SetPatientMaskBackgroundValue, MaskImagePixelType); + // Output filename (for AFBD) + itkSetMacro(OutputLungFilename, std::string); + itkGetMacro(OutputLungFilename, std::string); + GGO_DefineOption(output, SetOutputLungFilename, std::string); + + itkSetMacro(OutputTracheaFilename, std::string); + itkGetMacro(OutputTracheaFilename, std::string); + GGO_DefineOption(outputTrachea, SetOutputTracheaFilename, std::string); + // Set all options at a time template void SetArgsInfo(ArgsInfoType arg); @@ -216,15 +189,21 @@ public: itkGetConstMacro(LabelizeParameters3, LabelParamType*); GGO_DefineOption_LabelParam(3, SetLabelizeParameters3, LabelParamType); - // Step 5 options LungSeparation - // itkSetMacro(FinalOpenClose, bool); - // itkGetConstMacro(FinalOpenClose, bool); - // itkBooleanMacro(FinalOpenClose); + // Step 5 final openclose + itkSetMacro(OpenClose, bool); + itkGetConstMacro(OpenClose, bool); + itkBooleanMacro(OpenClose); + GGO_DefineOption_Flag(openclose, SetOpenClose); - // Bronchial bifurcations - itkSetMacro(FindBronchialBifurcations, bool); - itkGetConstMacro(FindBronchialBifurcations, bool); - itkBooleanMacro(FindBronchialBifurcations); + itkSetMacro(OpenCloseRadius, int); + itkGetConstMacro(OpenCloseRadius, int); + GGO_DefineOption(opencloseRadius, SetOpenCloseRadius, int); + + // Step 6 fill holes + itkSetMacro(FillHoles, bool); + itkGetConstMacro(FillHoles, bool); + itkBooleanMacro(FillHoles); + GGO_DefineOption_Flag(doNotFillHoles, SetFillHoles); protected: ExtractLungFilter(); @@ -234,6 +213,8 @@ public: InputImageConstPointer input; MaskImageConstPointer patient; InputImagePointer working_input; + std::string m_OutputLungFilename; + std::string m_OutputTracheaFilename; typename InternalImageType::Pointer working_image; typename InternalImageType::Pointer trachea_tmp; MaskImagePointer trachea; @@ -270,21 +251,18 @@ public: LabelParamType* m_LabelizeParameters3; // Step 5 - // bool m_FinalOpenClose; - bool m_FindBronchialBifurcations; - - virtual void GenerateOutputInformation(); - virtual void GenerateData(); + bool m_OpenClose; + int m_OpenCloseRadius; - TreeType m_SkeletonTree; - - void TrackFromThisIndex(std::vector & listOfBifurcations, - MaskImagePointer skeleton, - MaskImageIndexType index, - MaskImagePixelType label, - TreeIterator currentNode); - + // Step 6 + bool m_FillHoles; + InputImageSizeType m_FillHolesDirections; + // Main functions + virtual void GenerateOutputInformation(); + virtual void GenerateData(); + + // Functions for trachea extraction bool SearchForTracheaSeed(int skip); void SearchForTrachea(); void TracheaRegionGrowing();