X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=segmentation%2FclitkExtractLymphStationsFilter.h;h=5fb011b64646cd3633dce2f5ec1cb4578ec125b9;hb=d30d301ddbebb5f290f8d9c0104dc6448ea531e1;hp=e6b11a753f4630e33788b71e201f2c9745566e1c;hpb=2d513dbdb78fe0a0e2c3980eea894699f3496192;p=clitk.git diff --git a/segmentation/clitkExtractLymphStationsFilter.h b/segmentation/clitkExtractLymphStationsFilter.h index e6b11a7..5fb011b 100644 --- a/segmentation/clitkExtractLymphStationsFilter.h +++ b/segmentation/clitkExtractLymphStationsFilter.h @@ -19,29 +19,29 @@ #ifndef CLITKEXTRACTLYMPHSTATIONSFILTER_H #define CLITKEXTRACTLYMPHSTATIONSFILTER_H +// clitk #include "clitkFilterBase.h" +#include "clitkFilterWithAnatomicalFeatureDatabaseManagement.h" namespace clitk { //-------------------------------------------------------------------- /* Try to extract the LymphStations part of a thorax CT. - Inputs : - - Patient label image - - Lungs label image - - Bones label image + Need a set of Anatomical Features (AFDB) */ //-------------------------------------------------------------------- template class ITK_EXPORT ExtractLymphStationsFilter: - public clitk::FilterBase, - public itk::ImageToImageFilter + public virtual clitk::FilterBase, + public clitk::FilterWithAnatomicalFeatureDatabaseManagement, + public itk::ImageToImageFilter > { public: /** Standard class typedefs. */ - typedef itk::ImageToImageFilter Superclass; + typedef itk::ImageToImageFilter > Superclass; typedef ExtractLymphStationsFilter Self; typedef itk::SmartPointer Pointer; typedef itk::SmartPointer ConstPointer; @@ -50,8 +50,7 @@ namespace clitk { itkNewMacro(Self); /** Run-time type information (and related methods). */ - itkTypeMacro(ExtractLymphStationsFilter, InPlaceImageFilter); - FILTERBASE_INIT; + itkTypeMacro(ExtractLymphStationsFilter, ImageToImageFilter); /** Some convenient typedefs. */ typedef TImageType ImageType; @@ -61,47 +60,42 @@ namespace clitk { typedef typename ImageType::PixelType ImagePixelType; typedef typename ImageType::SizeType ImageSizeType; typedef typename ImageType::IndexType ImageIndexType; + typedef typename ImageType::PointType ImagePointType; - /** Connect inputs */ - void SetInputMediastinumLabelImage(const TImageType * image, ImagePixelType bg=0); - void SetInputTracheaLabelImage(const TImageType * image, ImagePixelType bg=0); - - /** ImageDimension constants */ - itkStaticConstMacro(ImageDimension, unsigned int, TImageType::ImageDimension); - - // Set all options at a time - template - void SetArgsInfo(ArgsInfoType arg); - - // Background / Foreground - itkSetMacro(BackgroundValueMediastinum, ImagePixelType); - itkGetConstMacro(BackgroundValueMediastinum, ImagePixelType); - //GGO_DefineOption(MediastinumBG, SetBackgroundValueMediastinum, ImagePixelType); - - itkSetMacro(BackgroundValueTrachea, ImagePixelType); - itkGetConstMacro(BackgroundValueTrachea, ImagePixelType); - //GGO_DefineOption(TracheaBG, SetBackgroundValueTrachea, ImagePixelType); - - itkGetConstMacro(BackgroundValue, ImagePixelType); - itkGetConstMacro(ForegroundValue, ImagePixelType); - - itkSetMacro(CarenaZPositionInMM, double); - itkGetConstMacro(CarenaZPositionInMM, double); - GGO_DefineOption(carenaZposition, SetCarenaZPositionInMM, double); - - itkSetMacro(MiddleLobeBronchusZPositionInMM, double); - itkGetConstMacro(MiddleLobeBronchusZPositionInMM, double); - GGO_DefineOption(middleLobeBronchusZposition, SetMiddleLobeBronchusZPositionInMM, double); - - itkSetMacro(IntermediateSpacing, double); - itkGetConstMacro(IntermediateSpacing, double); - GGO_DefineOption(spacing, SetIntermediateSpacing, double); - - itkSetMacro(FuzzyThreshold1, double); - itkGetConstMacro(FuzzyThreshold1, double); - GGO_DefineOption(fuzzy1, SetFuzzyThreshold1, double); + typedef uchar MaskImagePixelType; + typedef itk::Image MaskImageType; + 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; + /** ImageDimension constants */ + itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension); + FILTERBASE_INIT; + + itkGetConstMacro(BackgroundValue, MaskImagePixelType); + itkGetConstMacro(ForegroundValue, MaskImagePixelType); + itkSetMacro(BackgroundValue, MaskImagePixelType); + itkSetMacro(ForegroundValue, MaskImagePixelType); + + // Station 8 + itkSetMacro(DistanceMaxToAnteriorPartOfTheSpine, double); + itkGetConstMacro(DistanceMaxToAnteriorPartOfTheSpine, double); + itkSetMacro(EsophagusDiltationForAnt, MaskImagePointType); + itkGetConstMacro(EsophagusDiltationForAnt, MaskImagePointType); + itkSetMacro(EsophagusDiltationForRight, MaskImagePointType); + itkGetConstMacro(EsophagusDiltationForRight, MaskImagePointType); + itkSetMacro(FuzzyThresholdForS8, double); + itkGetConstMacro(FuzzyThresholdForS8, double); + + // Station 7 + itkSetMacro(FuzzyThreshold, double); + itkGetConstMacro(FuzzyThreshold, double); + itkSetMacro(Station7Filename, std::string); + itkGetConstMacro(Station7Filename, std::string); protected: ExtractLymphStationsFilter(); @@ -110,26 +104,61 @@ namespace clitk { virtual void GenerateOutputInformation(); virtual void GenerateInputRequestedRegion(); virtual void GenerateData(); - - itkSetMacro(BackgroundValue, ImagePixelType); - itkSetMacro(ForegroundValue, ImagePixelType); - - ImageConstPointer m_mediastinum; - ImageConstPointer m_trachea; - ImagePointer m_working_image; - ImagePointer m_working_trachea; - ImagePointer m_output; - - ImagePixelType m_BackgroundValueMediastinum; - ImagePixelType m_BackgroundValueTrachea; - ImagePixelType m_BackgroundValue; - ImagePixelType m_ForegroundValue; - - double m_CarenaZPositionInMM; - double m_MiddleLobeBronchusZPositionInMM; - double m_IntermediateSpacing; - double m_FuzzyThreshold1; + ImageConstPointer m_Input; + MaskImagePointer m_Mediastinum; + MaskImagePointer m_Working_Support; + std::map m_ListOfStations; + MaskImagePixelType m_BackgroundValue; + MaskImagePixelType m_ForegroundValue; + + // Station 8 + double m_DistanceMaxToAnteriorPartOfTheSpine; + double m_DiaphragmInferiorLimit; + double m_CarinaZ; + double m_OriginOfRightMiddleLobeBronchusZ; + double m_FuzzyThresholdForS8; + MaskImagePointType m_EsophagusDiltationForAnt; + MaskImagePointType m_EsophagusDiltationForRight; + MaskImagePointer EnlargeEsophagusDilatationRadiusInferiorly(MaskImagePointer & eso); + void ExtractStation_8(); + void ExtractStation_8_SI_Limits(); + void ExtractStation_8_AP_Limits(); + void ExtractStation_8_LR_Limits(); + + // Station 7 + void ExtractStation_7(); + void ExtractStation_7_SI_Limits(); + void ExtractStation_7_RL_Limits(); + void ExtractStation_7_Posterior_Limits(); + std::string m_Station7Filename; + MaskImagePointer m_working_trachea; + double m_FuzzyThreshold; + MaskImagePointer m_LeftBronchus; + MaskImagePointer m_RightBronchus; + MaskImagePointer m_Station7; + typedef std::vector ListOfPointsType; + ListOfPointsType m_RightMostInLeftBronchus; + ListOfPointsType m_AntMostInLeftBronchus; + ListOfPointsType m_PostMostInLeftBronchus; + ListOfPointsType m_LeftMostInRightBronchus; + ListOfPointsType m_AntMostInRightBronchus; + ListOfPointsType m_PostMostInRightBronchus; + + void FindExtremaPointsInBronchus(MaskImagePointer input, + int direction, + double distance_max_from_center_point, + ListOfPointsType & LR, + ListOfPointsType & Ant, + ListOfPointsType & Post); + // Station 4RL + void ExtractStation_4RL(); + void ExtractStation_4RL_SI_Limits(); + void ExtractStation_4RL_LR_Limits(); + void ExtractStation_4RL_AP_Limits(); + MaskImagePointer m_RightSupport; + MaskImagePointer m_LeftSupport; + private: ExtractLymphStationsFilter(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented @@ -142,6 +171,9 @@ namespace clitk { #ifndef ITK_MANUAL_INSTANTIATION #include "clitkExtractLymphStationsFilter.txx" +#include "clitkExtractLymphStation_8.txx" +#include "clitkExtractLymphStation_7.txx" +#include "clitkExtractLymphStation_4RL.txx" #endif #endif