]> Creatis software - clitk.git/commitdiff
Add --noAutoCrop option to clitkExtractLung
authorVivien Delmon <vivien.delmon@creatis.insa-lyon.fr>
Tue, 14 Jun 2011 07:35:20 +0000 (09:35 +0200)
committerVivien Delmon <vivien.delmon@creatis.insa-lyon.fr>
Tue, 14 Jun 2011 07:35:20 +0000 (09:35 +0200)
segmentation/clitkExtractLung.ggo
segmentation/clitkExtractLungFilter.h
segmentation/clitkExtractLungFilter.txx
segmentation/clitkExtractLungGenericFilter.txx

index 5f53b4d1926312ed855300abe6404180dda82b5c..12dd3e7040823c00e0676c005d95ec63d7522c94 100644 (file)
@@ -61,3 +61,4 @@ section "Step 6 : fill holes"
 option "doNotFillHoles"                -  "Do not fill holes if set"                 flag on
 option "dir"                   d  "Directions (axes) to perform filling (defaults to 2,1,0)"   int multiple no
 
+option "noAutoCrop"    -       "If set : do no crop final mask to BoundingBox"                         flag    off
index 50d553ae41ce9c130d9ba7acfde941354f3d1fd6..fa472ba711db3bff2c7ed8094380fc6b3505936c 100644 (file)
@@ -191,6 +191,11 @@ namespace clitk {
     itkGetConstMacro(FillHolesFlag, bool);
     itkBooleanMacro(FillHolesFlag);
 
+    // Step Auto Crop
+    itkSetMacro(AutoCrop, bool);
+    itkGetConstMacro(AutoCrop, bool);
+    itkBooleanMacro(AutoCrop);
+
   protected:
     ExtractLungFilter();
     virtual ~ExtractLungFilter() {}
@@ -212,6 +217,7 @@ namespace clitk {
     MaskImagePixelType m_BackgroundValue;
     MaskImagePixelType m_ForegroundValue;
     int m_MinimalComponentSize;
+    bool m_AutoCrop;
 
     // Step 1
     InputImagePixelType m_UpperThreshold;
index 67d3f5e641c08bb357a57c0b51fc17805287de45..1a945917be9149b76617dfca22c40de34f533db6 100644 (file)
@@ -96,6 +96,7 @@ ExtractLungFilter():
   
   // Step 6
   FillHolesFlagOn();
+  AutoCropOn();
 }
 //--------------------------------------------------------------------
 
@@ -311,7 +312,8 @@ GenerateOutputInformation()
   //--------------------------------------------------------------------
   PrintMemory(GetVerboseMemoryFlag(), "before autocropfilter");
   if (m_Seeds.size() != 0) { // if ==0 ->no trachea found
-    trachea = clitk::AutoCrop<MaskImageType>(trachea, GetBackgroundValue());
+    if (GetAutoCrop())
+      trachea = clitk::AutoCrop<MaskImageType>(trachea, GetBackgroundValue());
     StopCurrentStep<MaskImageType>(trachea);  
     PrintMemory(GetVerboseMemoryFlag(), "after delete trachea");
   }
@@ -321,7 +323,8 @@ GenerateOutputInformation()
   //--------------------------------------------------------------------
   StartNewStep("Cropping lung");
   PrintMemory(GetVerboseMemoryFlag(), "Before Autocropfilter");
-  working_mask = clitk::AutoCrop<MaskImageType>(working_mask, GetBackgroundValue());
+  if (GetAutoCrop())
+    working_mask = clitk::AutoCrop<MaskImageType>(working_mask, GetBackgroundValue());
   StopCurrentStep<MaskImageType>(working_mask);
 
   //--------------------------------------------------------------------
index e103310e1efe7d89c455bc28003386afd88a1dc5..2dd396fb3a2498fb0a5ff15e3dc01a2bf6af6db8 100644 (file)
@@ -102,6 +102,7 @@ SetOptionsFromArgsInfoToFilter(FilterType * f)
   
   f->SetOpenCloseFlag(mArgsInfo.openclose_flag);
   f->SetOpenCloseRadius(mArgsInfo.opencloseRadius_arg);
+  f->SetAutoCrop(!mArgsInfo.noAutoCrop_flag);
   
   if (mArgsInfo.doNotFillHoles_given)
     f->SetFillHolesFlag(false);