]> Creatis software - clitk.git/blobdiff - segmentation/clitkExtractMediastinumFilter.h
Moved from repository clitk to clitk.private/tests_dav
[clitk.git] / segmentation / clitkExtractMediastinumFilter.h
index f0d24b4300d451423c8a951e604f0fe1bf377e72..3144c95be73a468f37d27e453342a6e406f73240 100644 (file)
@@ -3,7 +3,7 @@
 
   Authors belong to: 
   - University of LYON              http://www.universite-lyon.fr/
-  - Léon Bérard cancer center       http://oncora1.lyon.fnclcc.fr
+  - Léon Bérard cancer center       http://www.centreleonberard.fr
   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
 
   This software is distributed WITHOUT ANY WARRANTY; without even
 
   - BSD        See included LICENSE.txt file
   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
-  ======================================================================-====*/
+  ===========================================================================**/
 
 #ifndef CLITKEXTRACTMEDIASTINUMFILTER_H
 #define CLITKEXTRACTMEDIASTINUMFILTER_H
 
-#include "clitkFilterBase.h"
-#include "clitkFilterWithAnatomicalFeatureDatabaseManagement.h"
+#include "clitkStructuresExtractionFilter.h"
 
 namespace clitk {
   
   //--------------------------------------------------------------------
   /*
     Try to extract the mediastinum part of a thorax CT.
-    Inputs : 
-    - Patient label image
-    - Lungs label image
-    - Bones label image
-    - Trachea label image
+    Input masks needed : 
+    - Patient
+    - Lungs 
+    - Bones [Optional]
+    - Trachea
+    - VertebralBody 
   */
   //--------------------------------------------------------------------
   
   template <class TImageType>
   class ITK_EXPORT ExtractMediastinumFilter: 
-    public virtual clitk::FilterBase, 
-    public clitk::FilterWithAnatomicalFeatureDatabaseManagement,
-    public itk::ImageToImageFilter<TImageType, itk::Image<uchar, 3> > 
+    public clitk::StructuresExtractionFilter<TImageType>
   {
 
   public:
@@ -63,8 +61,13 @@ 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;
+
     /** Standard class typedefs. */
-    typedef itk::ImageToImageFilter<TImageType, MaskImageType> Superclass;
+    //    typedef itk::ImageToImageFilter<TImageType, MaskImageType> Superclass;
+    typedef clitk::StructuresExtractionFilter<TImageType> Superclass;
     typedef ExtractMediastinumFilter            Self;
     typedef itk::SmartPointer<Self>             Pointer;
     typedef itk::SmartPointer<const Self>       ConstPointer;
@@ -83,78 +86,45 @@ namespace clitk {
                                 MaskImagePixelType fgLeftLung=1, MaskImagePixelType fgRightLung=2);
     void SetInputBonesLabelImage(const MaskImageType * image, MaskImagePixelType bg=0);
     void SetInputTracheaLabelImage(const MaskImageType * image, MaskImagePixelType bg=0);
-   
-   // Output filename  (for AFBD)
+
+    // Output filename  (for AFBD)
     itkSetMacro(OutputMediastinumFilename, std::string);
     itkGetConstMacro(OutputMediastinumFilename, std::string);
 
     /** ImageDimension constants */
     itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
 
-    // Set all options at a time
-    template<class ArgsInfoType>
-      void SetArgsInfo(ArgsInfoType arg);
-   
     // Background / Foreground
     itkSetMacro(BackgroundValuePatient, MaskImagePixelType);
     itkGetConstMacro(BackgroundValuePatient, MaskImagePixelType);
-    // GGO_DefineOption(patientBG, SetBackgroundValuePatient, MaskImagePixelType);
     
     itkSetMacro(BackgroundValueLung, MaskImagePixelType);
     itkGetConstMacro(BackgroundValueLung, MaskImagePixelType);
-    // GGO_DefineOption(lungBG, SetBackgroundValueLung, MaskImagePixelType);
     
     itkSetMacro(BackgroundValueBones, MaskImagePixelType);
     itkGetConstMacro(BackgroundValueBones, MaskImagePixelType);
-    // GGO_DefineOption(bonesBG, SetBackgroundValueBones, MaskImagePixelType);
     
-    itkGetConstMacro(BackgroundValue, MaskImagePixelType);
-    itkGetConstMacro(ForegroundValue, MaskImagePixelType);
-
     itkSetMacro(ForegroundValueLeftLung, MaskImagePixelType);
     itkGetConstMacro(ForegroundValueLeftLung, MaskImagePixelType);
-    // GGO_DefineOption(lungLeft, SetForegroundValueLeftLung, MaskImagePixelType);
     
     itkSetMacro(ForegroundValueRightLung, MaskImagePixelType);
     itkGetConstMacro(ForegroundValueRightLung, MaskImagePixelType);
-    // GGO_DefineOption(lungRight, SetForegroundValueRightLung, MaskImagePixelType);
     
     itkSetMacro(BackgroundValueTrachea, MaskImagePixelType);
     itkGetConstMacro(BackgroundValueTrachea, MaskImagePixelType);
-    // GGO_DefineOption(lungBG, SetBackgroundValueTrachea, MaskImagePixelType);
     
     itkSetMacro(IntermediateSpacing, double);
     itkGetConstMacro(IntermediateSpacing, double);
-    GGO_DefineOption(spacing, SetIntermediateSpacing, double);
-
-    itkSetMacro(FuzzyThreshold1, double);
-    itkGetConstMacro(FuzzyThreshold1, double);
-    GGO_DefineOption(fuzzy1, SetFuzzyThreshold1, double);
-
-    itkSetMacro(FuzzyThreshold2, double);
-    itkGetConstMacro(FuzzyThreshold2, double);
-    GGO_DefineOption(fuzzy2, SetFuzzyThreshold2, double);
-
-    itkSetMacro(FuzzyThreshold3, double);
-    itkGetConstMacro(FuzzyThreshold3, double);
-    GGO_DefineOption(fuzzy3, SetFuzzyThreshold3, double);
-
-    itkSetMacro(DistanceMaxToAnteriorPartOfTheSpine, double);
-    itkGetConstMacro(DistanceMaxToAnteriorPartOfTheSpine, double);
-    GGO_DefineOption(antSpine, SetDistanceMaxToAnteriorPartOfTheSpine, double);
 
     itkBooleanMacro(UseBones);
     itkSetMacro(UseBones, bool);
     itkGetConstMacro(UseBones, bool);
-    GGO_DefineOption_Flag(useBones, SetUseBones);
 
-    itkSetMacro(UpperThreshold, double);
-    itkGetConstMacro(UpperThreshold, double);
-    GGO_DefineOption(upper, SetUpperThreshold, double);
+    itkSetMacro(DistanceMaxToAnteriorPartOfTheVertebralBody, double);
+    itkGetConstMacro(DistanceMaxToAnteriorPartOfTheVertebralBody, double);
 
-    itkSetMacro(LowerThreshold, double);
-    itkGetConstMacro(LowerThreshold, double);
-    GGO_DefineOption(lower, SetLowerThreshold, double);
+    void SetFuzzyThreshold(std::string tag, double value);
+    double GetFuzzyThreshold(std::string tag);
 
   protected:
     ExtractMediastinumFilter();
@@ -163,10 +133,7 @@ namespace clitk {
     virtual void GenerateOutputInformation();
     virtual void GenerateInputRequestedRegion();
     virtual void GenerateData();
-       
-    itkSetMacro(BackgroundValue, MaskImagePixelType);
-    itkSetMacro(ForegroundValue, MaskImagePixelType);
-    
+         
     MaskImagePixelType m_BackgroundValuePatient;
     MaskImagePixelType m_BackgroundValueLung;
     MaskImagePixelType m_BackgroundValueBones;
@@ -174,19 +141,18 @@ namespace clitk {
     MaskImagePixelType m_ForegroundValueLeftLung;
     MaskImagePixelType m_ForegroundValueRightLung;
 
-    MaskImagePixelType m_BackgroundValue;
-    MaskImagePixelType m_ForegroundValue;
-
-    typename MaskImageType::Pointer output;
+    MaskImagePointer output;
+    MaskImagePointer patient;
+    MaskImagePointer lung;
+    MaskImagePointer bones;
+    MaskImagePointer trachea;
 
+    std::map<std::string, double> m_FuzzyThreshold;
     double m_IntermediateSpacing;
-    double m_FuzzyThreshold1;
-    double m_FuzzyThreshold2;
-    double m_FuzzyThreshold3;
-    double m_DistanceMaxToAnteriorPartOfTheSpine;
-    bool m_UseBones;
-    double m_UpperThreshold;
-    double m_LowerThreshold;
+    bool   m_UseBones;
+    double m_DistanceMaxToAnteriorPartOfTheVertebralBody;
+
+    void RemovePostPartOfVertebralBody();
     
     std::string m_OutputMediastinumFilename;