]> Creatis software - clitk.git/blobdiff - segmentation/clitkExtractLymphStationsFilter.h
Merge branch 'master' of /home/dsarrut/clitk3.server
[clitk.git] / segmentation / clitkExtractLymphStationsFilter.h
index 8d160b1aad557945d3b13be3f54b7435b991f0b0..4c7c669d964524b24e7cb7ec6c113340aaada037 100644 (file)
@@ -76,6 +76,9 @@ namespace clitk {
     typedef itk::Image<MaskImagePixelType, 2>    MaskSliceType;
     typedef typename MaskSliceType::Pointer      MaskSlicePointer;
     typedef typename MaskSliceType::PointType    MaskSlicePointType;
+    typedef typename MaskSliceType::RegionType   MaskSliceRegionType; 
+    typedef typename MaskSliceType::SizeType     MaskSliceSizeType; 
+    typedef typename MaskSliceType::IndexType    MaskSliceIndexType; 
 
     /** ImageDimension constants */
     itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
@@ -87,8 +90,8 @@ namespace clitk {
     itkSetMacro(ForegroundValue, MaskImagePixelType);
 
     // Station 8
-    itkSetMacro(DistanceMaxToAnteriorPartOfTheSpine, double);
-    itkGetConstMacro(DistanceMaxToAnteriorPartOfTheSpine, double);
+    // itkSetMacro(DistanceMaxToAnteriorPartOfTheSpine, double);
+    //itkGetConstMacro(DistanceMaxToAnteriorPartOfTheSpine, double);
     itkSetMacro(EsophagusDiltationForAnt, MaskImagePointType);
     itkGetConstMacro(EsophagusDiltationForAnt, MaskImagePointType);
     itkSetMacro(EsophagusDiltationForRight, MaskImagePointType);
@@ -97,12 +100,20 @@ namespace clitk {
     itkGetConstMacro(InjectedThresholdForS8, double);
 
     // Station 7
+    itkGetConstMacro(S7_UseMostInferiorPartOnlyFlag, bool);
+    itkSetMacro(S7_UseMostInferiorPartOnlyFlag, bool);
+    itkBooleanMacro(S7_UseMostInferiorPartOnlyFlag);
 
     // All stations
     bool GetComputeStation(std::string s);
     void AddComputeStation(std::string station) ;
     void SetFuzzyThreshold(std::string station, std::string tag, double value);
     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);
 
   protected:
     ExtractLymphStationsFilter();
@@ -116,6 +127,7 @@ namespace clitk {
     MaskImagePointer   m_Mediastinum;
     MaskImagePointer   m_Working_Support;
     std::map<std::string, MaskImagePointer> m_ListOfStations;
+    std::map<std::string, MaskImagePointer> m_ListOfSupports;
     MaskImagePixelType m_BackgroundValue;
     MaskImagePixelType m_ForegroundValue;
     std::map<std::string, bool> m_ComputeStationMap;
@@ -123,45 +135,77 @@ namespace clitk {
     bool CheckForStation(std::string station);
     void Remove_Structures(std::string station, std::string s);
 
+    // Functions common to several stations
+    double FindCarina();
+    double FindApexOfTheChest();
+    double FindSuperiorBorderOfAorticArch();
+    double FindInferiorBorderOfAorticArch();
+    void FindLeftAndRightBronchi();
+    void FindLineForS7S8Separation(MaskImagePointType & A, MaskImagePointType & B);
+    MaskImagePointer FindAntPostVessels();
+    MaskImagePointer FindAntPostVessels2();
+
     // Global parameters
     typedef std::map<std::string, double> FuzzyThresholdByStructureType;
     std::map<std::string, FuzzyThresholdByStructureType> m_FuzzyThreshold;    
+    typedef std::map<std::string, double> ThresholdByStructureType;
+    std::map<std::string, ThresholdByStructureType> m_Threshold;    
+
+    // 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, 
+                                       double offset, double maxSupPosition);
+    MaskImagePointer LimitsWithTrachea(MaskImageType * input, 
+                                       int extremaDirection, int lineDirection, 
+                                       double offset);
 
     // Station 8
-    double m_DistanceMaxToAnteriorPartOfTheSpine;
+    // double m_DistanceMaxToAnteriorPartOfTheSpine;
     double m_DiaphragmInferiorLimit;
-    double m_CarinaZ;
     double m_OriginOfRightMiddleLobeBronchusZ;
     double m_InjectedThresholdForS8;
     MaskImagePointer m_Esophagus;
     MaskImagePointType m_EsophagusDiltationForAnt;
     MaskImagePointType m_EsophagusDiltationForRight;
-    MaskImagePointer EnlargeEsophagusDilatationRadiusInferiorly(MaskImagePointer & eso);
+
     void ExtractStation_8();
     void ExtractStation_8_SetDefaultValues();
     void ExtractStation_8_SI_Limits();
-    void ExtractStation_8_Post_Limits();
-    void ExtractStation_8_Ant_Sup_Limits();
-    void ExtractStation_8_Ant_Inf_Limits();
-    void ExtractStation_8_Ant_Injected_Limits();
-    void ExtractStation_8_LR_1_Limits();
-    void ExtractStation_8_LR_2_Limits();
+    void ExtractStation_8_Ant_Limits();
+    void ExtractStation_8_Left_Sup_Limits();
+    void ExtractStation_8_Left_Inf_Limits();
     void ExtractStation_8_Single_CCL_Limits();
-    void ExtractStation_8_LR_Limits();
     void ExtractStation_8_Remove_Structures();
-    void ExtractStation_8_LR_Limits_old();
-    void ExtractStation_8_LR_Limits_old2();
-    
+
     // Station 3P
     void ExtractStation_3P();
     void ExtractStation_3P_SetDefaultValues();
-    void ExtractStation_3P_SI_Limits();
+    void ExtractStation_3P_LR_inf_Limits();
+    void ExtractStation_3P_LR_sup_Limits_2();
     void ExtractStation_3P_Remove_Structures();
-    void ExtractStation_3P_Ant_Limits();
-    void ExtractStation_3P_Post_Limits();
     void ExtractStation_3P_LR_sup_Limits();
-    void ExtractStation_3P_LR_sup_Limits_2();
-    void ExtractStation_3P_LR_inf_Limits();
+
+    // Station 3A
+    void ExtractStation_3A();
+    void ExtractStation_3A_SetDefaultValues();
+    void ExtractStation_3A_AntPost_S5();
+    void ExtractStation_3A_AntPost_S6();
+    void ExtractStation_3A_AntPost_Superiorly();
+    void ExtractStation_3A_Remove_Structures();
+    void ExtractStation_3A_PostToBones();
 
     // Station 2RL
     void ExtractStation_2RL();
@@ -175,20 +219,18 @@ namespace clitk {
     void ExtractStation_2RL_SeparateRL();
     vtkSmartPointer<vtkPolyData> Build3DMeshFrom2DContour(const std::vector<ImagePointType> & points);
 
-    // Station 3A
-    void ExtractStation_3A();
-    void ExtractStation_3A_SetDefaultValues();
-    void ExtractStation_3A_SI_Limits();
-    void ExtractStation_3A_Ant_Limits();
-    void ExtractStation_3A_Post_Limits();
-
     // Station 7
     void ExtractStation_7();
     void ExtractStation_7_SetDefaultValues();
     void ExtractStation_7_SI_Limits();
-    void ExtractStation_7_RL_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;
     MaskImagePointer m_Working_Trachea;
     MaskImagePointer m_LeftBronchus;
     MaskImagePointer m_RightBronchus;
@@ -226,6 +268,7 @@ 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"