X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=segmentation%2FclitkExtractLymphStationsFilter.h;h=080bdb7185169bfed1113a1e6ee19935330caa04;hb=dd3badf7621c63f24a8dcfb831af3dcaf41fbe6c;hp=4c7c669d964524b24e7cb7ec6c113340aaada037;hpb=3e4ea302a9ca9505aab212b8b3c2e29bcf6fa179;p=clitk.git diff --git a/segmentation/clitkExtractLymphStationsFilter.h b/segmentation/clitkExtractLymphStationsFilter.h index 4c7c669..080bdb7 100644 --- a/segmentation/clitkExtractLymphStationsFilter.h +++ b/segmentation/clitkExtractLymphStationsFilter.h @@ -20,14 +20,32 @@ #define CLITKEXTRACTLYMPHSTATIONSFILTER_H // clitk -#include "clitkFilterBase.h" -#include "clitkFilterWithAnatomicalFeatureDatabaseManagement.h" +#include "clitkStructuresExtractionFilter.h" +#include "clitkLabelImageOverlapMeasureFilter.h" // vtk #include namespace clitk { + class SupportLimitsType { + public: + std::string station_limit; + std::string station; + std::string structure_limit; + std::string structure; + double offset; + void Read(istream & is) { + is >> station_limit; + is >> station; + is >> structure_limit; + is >> structure; + std::string s; + is >> s; + offset = atof(s.c_str()); + } + }; + //-------------------------------------------------------------------- /* Try to extract the LymphStations part of a thorax CT. @@ -37,14 +55,12 @@ namespace clitk { template class ITK_EXPORT ExtractLymphStationsFilter: - public virtual clitk::FilterBase, - public clitk::FilterWithAnatomicalFeatureDatabaseManagement, - public itk::ImageToImageFilter > + public clitk::StructuresExtractionFilter { public: /** Standard class typedefs. */ - typedef itk::ImageToImageFilter > Superclass; + typedef clitk::StructuresExtractionFilter Superclass; typedef ExtractLymphStationsFilter Self; typedef itk::SmartPointer Pointer; typedef itk::SmartPointer ConstPointer; @@ -83,15 +99,13 @@ namespace clitk { /** 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); @@ -111,9 +125,16 @@ namespace clitk { double GetFuzzyThreshold(std::string station, std::string tag); void SetThreshold(std::string station, std::string tag, double value); double GetThreshold(std::string station, std::string tag); - itkGetConstMacro(ComputeStationsSupportsFlag, bool); - itkSetMacro(ComputeStationsSupportsFlag, bool); - itkBooleanMacro(ComputeStationsSupportsFlag); + itkGetConstMacro(ForceSupportsFlag, bool); + itkSetMacro(ForceSupportsFlag, bool); + itkBooleanMacro(ForceSupportsFlag); + + itkGetConstMacro(CheckSupportFlag, bool); + itkSetMacro(CheckSupportFlag, bool); + itkBooleanMacro(CheckSupportFlag); + + itkGetConstMacro(SupportLimitsFilename, std::string); + itkSetMacro(SupportLimitsFilename, std::string); protected: ExtractLymphStationsFilter(); @@ -123,6 +144,17 @@ namespace clitk { virtual void GenerateInputRequestedRegion(); virtual void GenerateData(); + // To avoid repeat "this->" + AnatomicalFeatureDatabase * GetAFDB() { return clitk::FilterWithAnatomicalFeatureDatabaseManagement::GetAFDB(); } + void WriteAFDB() { clitk::FilterWithAnatomicalFeatureDatabaseManagement::WriteAFDB(); } + void LoadAFDB() { clitk::FilterWithAnatomicalFeatureDatabaseManagement::LoadAFDB(); } + void StartNewStep(std::string s) { clitk::FilterBase::StartNewStep(s); } + void StartSubStep() { clitk::FilterBase::StartSubStep(); } + template + void StopCurrentStep(typename TInternalImageType::Pointer p, std::string txt="") { clitk::FilterBase::StopCurrentStep(p, txt); } + void StopCurrentStep() {clitk::FilterBase::StopCurrentStep(); } + void StopSubStep() {clitk::FilterBase::StopSubStep(); } + ImageConstPointer m_Input; MaskImagePointer m_Mediastinum; MaskImagePointer m_Working_Support; @@ -131,9 +163,18 @@ namespace clitk { MaskImagePixelType m_BackgroundValue; MaskImagePixelType m_ForegroundValue; std::map m_ComputeStationMap; + std::string m_SupportLimitsFilename; + std::vector m_ListOfSupportLimits; bool CheckForStation(std::string station); void Remove_Structures(std::string station, std::string s); + void WriteImageSupport(std::string support); + void WriteImageStation(std::string station); + void ComputeOverlapWithRef(std::string station); + void Support_SI_Limit(const std::string station_limit, const std::string station, + const std::string structure_limit, const std::string structure, + const double offset); + void ReadSupportLimits(std::string filename); // Functions common to several stations double FindCarina(); @@ -142,7 +183,7 @@ namespace clitk { double FindInferiorBorderOfAorticArch(); void FindLeftAndRightBronchi(); void FindLineForS7S8Separation(MaskImagePointType & A, MaskImagePointType & B); - MaskImagePointer FindAntPostVessels(); + MaskImagePointer FindAntPostVesselsOLD(); MaskImagePointer FindAntPostVessels2(); // Global parameters @@ -153,17 +194,10 @@ namespace clitk { // Station's supports void ExtractStationSupports(); - void Support_SupInf_S1RL(); void Support_LeftRight_S1R_S1L(); - void Support_SupInf_S2R_S2L(); void Support_LeftRight_S2R_S2L(); - void Support_SupInf_S4R_S4L(); void Support_LeftRight_S4R_S4L(); void Support_Post_S1S2S4(); - void Support_S3P(); - void Support_S3A(); - void Support_S5(); - void Support_S6(); MaskImagePointer LimitsWithTrachea(MaskImageType * input, int extremaDirection, int lineDirection, @@ -171,9 +205,7 @@ namespace clitk { MaskImagePointer LimitsWithTrachea(MaskImageType * input, int extremaDirection, int lineDirection, double offset); - // Station 8 - // double m_DistanceMaxToAnteriorPartOfTheSpine; double m_DiaphragmInferiorLimit; double m_OriginOfRightMiddleLobeBronchusZ; double m_InjectedThresholdForS8; @@ -201,36 +233,53 @@ namespace clitk { // Station 3A void ExtractStation_3A(); void ExtractStation_3A_SetDefaultValues(); - void ExtractStation_3A_AntPost_S5(); - void ExtractStation_3A_AntPost_S6(); + void ExtractStation_3A_Post_Left_Limits_With_Aorta_S5_Support(); + void ExtractStation_3A_Post_Limits_With_Dilated_Aorta_S6_Support(); void ExtractStation_3A_AntPost_Superiorly(); void ExtractStation_3A_Remove_Structures(); - void ExtractStation_3A_PostToBones(); // Station 2RL void ExtractStation_2RL(); void ExtractStation_2RL_SetDefaultValues(); - void ExtractStation_2RL_SI_Limits(); - void ExtractStation_2RL_Ant_Limits(); - void ExtractStation_2RL_Ant_Limits2(); - void ExtractStation_2RL_Post_Limits(); - void ExtractStation_2RL_LR_Limits(); - void ExtractStation_2RL_Remove_Structures(); - void ExtractStation_2RL_SeparateRL(); + void ExtractStation_2RL_Ant_Limits(std::string s); + void ExtractStation_2RL_Remove_Structures(std::string s); + void ExtractStation_2RL_Cut_BrachioCephalicVein_superiorly_when_it_split(); vtkSmartPointer Build3DMeshFrom2DContour(const std::vector & points); + // Station 1RL + void ExtractStation_1RL(); + void ExtractStation_1RL_SetDefaultValues(); + void ExtractStation_1RL_Ant_Limits(); + void ExtractStation_1RL_Post_Limits(); + + // Station 4RL + void ExtractStation_4RL_SetDefaultValues(); + void ExtractStation_4L(); + void ExtractStation_4R(); + void ExtractStation_S4L_S5_Limits_Aorta_LeftPulmonaryArtery(int KeepPoint); + + // Station 5 + void ExtractStation_5_SetDefaultValues(); + void ExtractStation_5(); + void ExtractStation_5_Limits_AscendingAorta_Ant(); + + // Station 6 + void ExtractStation_6_SetDefaultValues(); + void ExtractStation_6(); + + // Station 7 void ExtractStation_7(); void ExtractStation_7_SetDefaultValues(); void ExtractStation_7_SI_Limits(); void ExtractStation_7_RL_Interior_Limits(); - void ExtractStation_7_RL_Limits_OLD(); void ExtractStation_7_Posterior_Limits(); void ExtractStation_7_Remove_Structures(); bool m_S7_UseMostInferiorPartOnlyFlag; - bool m_ComputeStationsSupportsFlag; + bool m_ForceSupportsFlag; + bool m_CheckSupportFlag; MaskImagePointer m_Working_Trachea; MaskImagePointer m_LeftBronchus; MaskImagePointer m_RightBronchus; @@ -248,14 +297,6 @@ namespace clitk { 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 @@ -269,12 +310,16 @@ namespace clitk { #ifndef ITK_MANUAL_INSTANTIATION #include "clitkExtractLymphStationsFilter.txx" #include "clitkExtractLymphStation_Supports.txx" -#include "clitkExtractLymphStation_8.txx" #include "clitkExtractLymphStation_3P.txx" #include "clitkExtractLymphStation_2RL.txx" #include "clitkExtractLymphStation_3A.txx" -#include "clitkExtractLymphStation_7.txx" #include "clitkExtractLymphStation_4RL.txx" +#include "clitkExtractLymphStation_1RL.txx" +#include "clitkExtractLymphStation_5.txx" +#include "clitkExtractLymphStation_6.txx" + +#include "clitkExtractLymphStation_8.txx" +#include "clitkExtractLymphStation_7.txx" #endif #endif