From: Vivien Delmon Date: Tue, 14 Jun 2011 07:35:20 +0000 (+0200) Subject: Add --noAutoCrop option to clitkExtractLung X-Git-Tag: v1.3.0~321^2~5 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=cf35c87a6dd45a7daf171d2adca9766846a0f127;p=clitk.git Add --noAutoCrop option to clitkExtractLung --- diff --git a/segmentation/clitkExtractLung.ggo b/segmentation/clitkExtractLung.ggo index 5f53b4d..12dd3e7 100644 --- a/segmentation/clitkExtractLung.ggo +++ b/segmentation/clitkExtractLung.ggo @@ -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 diff --git a/segmentation/clitkExtractLungFilter.h b/segmentation/clitkExtractLungFilter.h index 50d553a..fa472ba 100644 --- a/segmentation/clitkExtractLungFilter.h +++ b/segmentation/clitkExtractLungFilter.h @@ -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; diff --git a/segmentation/clitkExtractLungFilter.txx b/segmentation/clitkExtractLungFilter.txx index 67d3f5e..1a94591 100644 --- a/segmentation/clitkExtractLungFilter.txx +++ b/segmentation/clitkExtractLungFilter.txx @@ -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(trachea, GetBackgroundValue()); + if (GetAutoCrop()) + trachea = clitk::AutoCrop(trachea, GetBackgroundValue()); StopCurrentStep(trachea); PrintMemory(GetVerboseMemoryFlag(), "after delete trachea"); } @@ -321,7 +323,8 @@ GenerateOutputInformation() //-------------------------------------------------------------------- StartNewStep("Cropping lung"); PrintMemory(GetVerboseMemoryFlag(), "Before Autocropfilter"); - working_mask = clitk::AutoCrop(working_mask, GetBackgroundValue()); + if (GetAutoCrop()) + working_mask = clitk::AutoCrop(working_mask, GetBackgroundValue()); StopCurrentStep(working_mask); //-------------------------------------------------------------------- diff --git a/segmentation/clitkExtractLungGenericFilter.txx b/segmentation/clitkExtractLungGenericFilter.txx index e103310..2dd396f 100644 --- a/segmentation/clitkExtractLungGenericFilter.txx +++ b/segmentation/clitkExtractLungGenericFilter.txx @@ -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);