]> Creatis software - clitk.git/blobdiff - segmentation/clitkExtractLymphStationsFilter.h
[VV] New feature to jump on image origin
[clitk.git] / segmentation / clitkExtractLymphStationsFilter.h
index d1301579699fcc99f09498018c46033678807554..8d160b1aad557945d3b13be3f54b7435b991f0b0 100644 (file)
@@ -23,6 +23,9 @@
 #include "clitkFilterBase.h"
 #include "clitkFilterWithAnatomicalFeatureDatabaseManagement.h"
 
+// vtk
+#include <vtkPolyData.h>
+
 namespace clitk {
   
   //--------------------------------------------------------------------
@@ -70,24 +73,36 @@ namespace clitk {
     typedef typename MaskImageType::IndexType    MaskImageIndexType; 
     typedef typename MaskImageType::PointType    MaskImagePointType; 
 
+    typedef itk::Image<MaskImagePixelType, 2>    MaskSliceType;
+    typedef typename MaskSliceType::Pointer      MaskSlicePointer;
+    typedef typename MaskSliceType::PointType    MaskSlicePointType;
+
     /** ImageDimension constants */
     itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
     FILTERBASE_INIT;
    
-    /** Main options (from ggo) */
-    template <class ArgsInfoType>
-    void SetArgsInfo(ArgsInfoType & argsinfo);
-
     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(InjectedThresholdForS8, double);
+    itkGetConstMacro(InjectedThresholdForS8, double);
+
     // Station 7
-    itkSetMacro(FuzzyThreshold, double);
-    itkGetConstMacro(FuzzyThreshold, double);
-    itkSetMacro(Station7Filename, std::string);
-    itkGetConstMacro(Station7Filename, std::string);
+
+    // 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);
 
   protected:
     ExtractLymphStationsFilter();
@@ -98,32 +113,106 @@ namespace clitk {
     virtual void GenerateData();
     
     ImageConstPointer  m_Input;
-    MaskImagePointer   m_Support;
+    MaskImagePointer   m_Mediastinum;
     MaskImagePointer   m_Working_Support;
-    MaskImagePointer   m_Output;
+    std::map<std::string, MaskImagePointer> m_ListOfStations;
     MaskImagePixelType m_BackgroundValue;
-    MaskImagePixelType m_ForegroundValue;    
-
-    // Common 
-    MaskImagePointer m_Trachea;
+    MaskImagePixelType m_ForegroundValue;
+    std::map<std::string, bool> m_ComputeStationMap;
+
+    bool CheckForStation(std::string station);
+    void Remove_Structures(std::string station, std::string s);
+
+    // Global parameters
+    typedef std::map<std::string, double> FuzzyThresholdByStructureType;
+    std::map<std::string, FuzzyThresholdByStructureType> m_FuzzyThreshold;    
+
+    // Station 8
+    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_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_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 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();
+    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_Posterior_Limits();       
-    std::string      m_Station7Filename;
-    MaskImagePointer m_working_trachea;
-    double           m_FuzzyThreshold;
+    void ExtractStation_7_Posterior_Limits();   
+    void ExtractStation_7_Remove_Structures();
+    MaskImagePointer m_Working_Trachea;
     MaskImagePointer m_LeftBronchus;
     MaskImagePointer m_RightBronchus;
-    MaskImagePointer m_Station7;
-
+    typedef std::vector<MaskImageType::PointType> 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();
-    MaskImagePointer m_Station4RL;
+    void ExtractStation_4RL_AP_Limits();
+    MaskImagePointer m_RightSupport;
+    MaskImagePointer m_LeftSupport;
 
   private:
     ExtractLymphStationsFilter(const Self&); //purposely not implemented
@@ -137,6 +226,10 @@ namespace clitk {
 
 #ifndef ITK_MANUAL_INSTANTIATION
 #include "clitkExtractLymphStationsFilter.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"
 #endif