]> Creatis software - clitk.git/blobdiff - segmentation/clitkExtractBonesFilter.txx
Add ROI tab
[clitk.git] / segmentation / clitkExtractBonesFilter.txx
index 3e8cc491c63e5c4200bca7f8d5c79f4b43229dc6..e00945e14fcc9cdcb98903b4cf988f191ebd06e3 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
@@ -14,7 +14,7 @@
 
   - BSD        See included LICENSE.txt file
   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
-  ======================================================================-====*/
+  ===========================================================================**/
 
 #ifndef CLITKEXTRACTBONESSFILTER_TXX
 #define CLITKEXTRACTBONESSFILTER_TXX
@@ -24,6 +24,7 @@
 #include "clitkSetBackgroundImageFilter.h"
 #include "clitkSegmentationUtils.h"
 #include "clitkAutoCropFilter.h"
+#include "clitkFillMaskFilter.h"
 
 // itk
 #include "itkBinaryThresholdImageFilter.h"
@@ -63,6 +64,7 @@ ExtractBonesFilter():
   SetRadius2(s);
   SetSampleRate2(0);
   AutoCropOn();
+  FillHolesOn();
 }
 //--------------------------------------------------------------------
 
@@ -78,41 +80,6 @@ SetInput(const TInputImageType * image)
 //--------------------------------------------------------------------
 
 
-//--------------------------------------------------------------------
-template <class TInputImageType>
-template<class ArgsInfoType>
-void 
-clitk::ExtractBonesFilter<TInputImageType>::
-SetArgsInfo(ArgsInfoType mArgsInfo)
-{
-  SetVerboseOption_GGO(mArgsInfo);
-  SetVerboseStep_GGO(mArgsInfo);
-  SetWriteStep_GGO(mArgsInfo);
-  SetVerboseWarningOff_GGO(mArgsInfo);
-  
-  SetOutputBonesFilename_GGO(mArgsInfo);
-
-  SetInitialSmoothing_GGO(mArgsInfo);
-  SetSmoothingConductanceParameter_GGO(mArgsInfo);
-  SetSmoothingNumberOfIterations_GGO(mArgsInfo);
-  SetSmoothingTimeStep_GGO(mArgsInfo);
-  SetSmoothingUseImageSpacing_GGO(mArgsInfo);
-
-  SetMinimalComponentSize_GGO(mArgsInfo);
-  SetUpperThreshold1_GGO(mArgsInfo);
-  SetLowerThreshold1_GGO(mArgsInfo);
-  SetFullConnectivity_GGO(mArgsInfo);
-
-  SetUpperThreshold2_GGO(mArgsInfo);
-  SetLowerThreshold2_GGO(mArgsInfo);
-  SetRadius2_GGO(mArgsInfo);
-  SetSampleRate2_GGO(mArgsInfo);
-  SetAutoCrop_GGO(mArgsInfo);
-
-  SetAFDBFilename_GGO(mArgsInfo);
-}
-//--------------------------------------------------------------------
-
 
 //--------------------------------------------------------------------
 template <class TInputImageType>
@@ -262,6 +229,20 @@ GenerateOutputInformation() {
 
   output = setBackgroundFilter->GetOutput();
 
+  //--------------------------------------------------------------------
+  //--------------------------------------------------------------------
+  // Fill Bones
+  if (GetFillHoles()) {
+    StartNewStep("Fill Holes");
+    typedef clitk::FillMaskFilter<InternalImageType> FillMaskFilterType;
+    typename FillMaskFilterType::Pointer fillMaskFilter = FillMaskFilterType::New();
+    fillMaskFilter->SetInput(output);
+    fillMaskFilter->AddDirection(2);
+    fillMaskFilter->Update();   
+    output = fillMaskFilter->GetOutput();
+    StopCurrentStep<InternalImageType>(output);
+  }
+
   //--------------------------------------------------------------------
   //--------------------------------------------------------------------
   // [Optional]
@@ -297,7 +278,7 @@ GenerateData() {
   this->GraftOutput(caster->GetOutput());
 
   // Store image filenames into AFDB 
-  GetAFDB()->SetImageFilename("bones", this->GetOutputBonesFilename());  
+  GetAFDB()->SetImageFilename("Bones", this->GetOutputBonesFilename());  
   WriteAFDB();
   return;
 }