From fbeb37a42e28477c9e92e866e3610f99e57f2449 Mon Sep 17 00:00:00 2001 From: dsarrut Date: Tue, 15 Feb 2011 11:29:05 +0000 Subject: [PATCH] add options --- segmentation/clitkExtractPatient.ggo | 1 + .../clitkExtractPatientGenericFilter.h | 2 + .../clitkExtractPatientGenericFilter.txx | 53 ++++++++++++++++++- 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/segmentation/clitkExtractPatient.ggo b/segmentation/clitkExtractPatient.ggo index 6b15a6a..9aed69e 100644 --- a/segmentation/clitkExtractPatient.ggo +++ b/segmentation/clitkExtractPatient.ggo @@ -10,6 +10,7 @@ option "verboseStep" - "Verbose each step" flag off option "writeStep" w "Write image at each step" flag off option "verboseOption" - "Display options values" flag off option "verboseWarningOff" - "Do not display warning" flag off +option "verboseMemory" - "Display memory usage" flag off section "I/O" diff --git a/segmentation/clitkExtractPatientGenericFilter.h b/segmentation/clitkExtractPatientGenericFilter.h index 23b1ecf..487c4f4 100644 --- a/segmentation/clitkExtractPatientGenericFilter.h +++ b/segmentation/clitkExtractPatientGenericFilter.h @@ -48,6 +48,8 @@ namespace clitk //-------------------------------------------------------------------- void SetArgsInfo(const ArgsInfoType & a); + template + void SetOptionsFromArgsInfoToFilter(FilterType * f); //-------------------------------------------------------------------- // Main function called each time the filter is updated diff --git a/segmentation/clitkExtractPatientGenericFilter.txx b/segmentation/clitkExtractPatientGenericFilter.txx index e2b2e97..9435288 100644 --- a/segmentation/clitkExtractPatientGenericFilter.txx +++ b/segmentation/clitkExtractPatientGenericFilter.txx @@ -55,6 +55,57 @@ void clitk::ExtractPatientGenericFilter::SetArgsInfo(const ArgsInf //-------------------------------------------------------------------- +//-------------------------------------------------------------------- +template +template +void +clitk::ExtractPatientGenericFilter:: +SetOptionsFromArgsInfoToFilter(FilterType * f) +{ + f->SetVerboseOptionFlag(mArgsInfo.verbose_flag); + f->SetVerboseStepFlag(mArgsInfo.verboseStep_flag); + f->SetWriteStepFlag(mArgsInfo.writeStep_flag); + f->SetVerboseWarningFlag(!mArgsInfo.verboseWarningOff_flag); + f->SetVerboseMemoryFlag(mArgsInfo.verboseMemory_flag); + + f->SetAFDBFilename(mArgsInfo.afdb_arg); + f->SetOutputPatientFilename(mArgsInfo.output_arg); + + f->SetUpperThreshold(mArgsInfo.upper_arg); + f->SetLowerThreshold(mArgsInfo.lower_arg); + + f->SetDecomposeAndReconstructDuringFirstStep(mArgsInfo.erode1_flag); + + // Convert to SizeType + typename FilterType::InputImageSizeType s; + if (mArgsInfo.radius1_given) { + ConvertOptionMacro(mArgsInfo.radius1, s, 3, false); + f->SetRadius1(s); + } + + f->SetMaximumNumberOfLabels1(mArgsInfo.max1_arg); + f->SetNumberOfNewLabels1(mArgsInfo.new1_arg); + + f->SetDecomposeAndReconstructDuringSecondStep(mArgsInfo.erode2_flag); + + // Convert to SizeType + if (mArgsInfo.radius2_given) { + ConvertOptionMacro(mArgsInfo.radius2, s, 3, false); + f->SetRadius2(s); + } + + f->SetMaximumNumberOfLabels2(mArgsInfo.max2_arg); + f->SetNumberOfNewLabels2(mArgsInfo.new2_arg); + + f->SetFirstKeep(mArgsInfo.firstKeep_arg); + f->SetLastKeep(mArgsInfo.lastKeep_arg); + + f->SetFinalOpenClose(mArgsInfo.openClose_flag); + f->SetAutoCrop(!mArgsInfo.noAutoCrop_flag); +} +//-------------------------------------------------------------------- + + //-------------------------------------------------------------------- // Update with the number of dimensions and the pixeltype //-------------------------------------------------------------------- @@ -76,8 +127,8 @@ void clitk::ExtractPatientGenericFilter::UpdateWithInputImageType( this->SetFilterBase(filter); // Set global Options - filter->SetArgsInfo(mArgsInfo); filter->SetInput(input); + SetOptionsFromArgsInfoToFilter(filter); // Go ! filter->Update(); -- 2.47.1