From: dsarrut Date: Mon, 1 Feb 2010 15:53:41 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: v1.2.0~844 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=894303629c17b343135c71a151bc911e96aedfb8;p=clitk.git *** empty log message *** --- diff --git a/filters/clitkBinarizeImageGenericFilter.txx b/filters/clitkBinarizeImageGenericFilter.txx index a41f33a..6b993e5 100644 --- a/filters/clitkBinarizeImageGenericFilter.txx +++ b/filters/clitkBinarizeImageGenericFilter.txx @@ -10,6 +10,8 @@ * ===================================================*/ +#include "itkMaskImageFilter.h" + namespace clitk { @@ -17,9 +19,9 @@ namespace clitk template BinarizeImageGenericFilter::BinarizeImageGenericFilter(): ImageToImageGenericFilter("Binarize") { - InitializeImageType<2>(); + // InitializeImageType<2>(); InitializeImageType<3>(); - InitializeImageType<4>(); + //InitializeImageType<4>(); } //-------------------------------------------------------------------- @@ -28,10 +30,10 @@ namespace clitk template template void BinarizeImageGenericFilter::InitializeImageType() { - ADD_IMAGE_TYPE(Dim, char); + //ADD_IMAGE_TYPE(Dim, char); ADD_IMAGE_TYPE(Dim, short); - ADD_IMAGE_TYPE(Dim, int); - ADD_IMAGE_TYPE(Dim, float); + //ADD_IMAGE_TYPE(Dim, int); + //ADD_IMAGE_TYPE(Dim, float); } //-------------------------------------------------------------------- @@ -73,6 +75,13 @@ namespace clitk typedef itk::BinaryThresholdImageFilter BinaryThresholdImageFilterType; typename BinaryThresholdImageFilterType::Pointer thresholdFilter=BinaryThresholdImageFilterType::New(); thresholdFilter->SetInput(input); + + if (mArgsInfo.setFG_flag) { + double fg = mArgsInfo.fg_arg; + mArgsInfo.fg_arg = mArgsInfo.bg_arg; + mArgsInfo.bg_arg = fg; + } + if(mArgsInfo.lower_given) thresholdFilter->SetLowerThreshold(static_cast(mArgsInfo.lower_arg)); if(mArgsInfo.upper_given) thresholdFilter->SetUpperThreshold(static_cast(mArgsInfo.upper_arg)); @@ -81,19 +90,37 @@ namespace clitk DD(mArgsInfo.lower_arg); DD(mArgsInfo.upper_arg); - DD(mArgsInfo.inside_arg); - DD(mArgsInfo.outside_arg); - DD(mArgsInfo.inside_given); - DD(mArgsInfo.outside_given); + DD(mArgsInfo.fg_arg); + DD(mArgsInfo.bg_arg); + DD(mArgsInfo.fg_given); + DD(mArgsInfo.bg_given); - thresholdFilter->SetInsideValue(mArgsInfo.inside_arg); - thresholdFilter->SetOutsideValue(mArgsInfo.outside_arg); + thresholdFilter->SetInsideValue(mArgsInfo.fg_arg); + thresholdFilter->SetOutsideValue(mArgsInfo.bg_arg); thresholdFilter->Update(); - - // Write/Save results - typename OutputImageType::Pointer outputImage = thresholdFilter->GetOutput(); - this->template SetNextOutput(outputImage); + + // If no BG or no FG : new image, copy input with MaskImageFilter + // If setFG -> FG BG have been changed + if (0) { + if (mArgsInfo.setBG_flag || mArgsInfo.setFG_flag) { + DD("set BG!!!!"); + //if () + typedef itk::MaskImageFilter maskFilterType; + typename maskFilterType::Pointer maskFilter = maskFilterType::New(); + maskFilter->SetInput1(input); + maskFilter->SetInput2(thresholdFilter->GetOutput()); + maskFilter->Update(); + typename InputImageType::Pointer outputImage = maskFilter->GetOutput(); + // Write/Save results + this->template SetNextOutput(outputImage); + } + } + else { + typename OutputImageType::Pointer outputImage = thresholdFilter->GetOutput(); + // Write/Save results + this->template SetNextOutput(outputImage); + } } //-------------------------------------------------------------------- diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index ef6e50d..c2ee433 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -5,7 +5,7 @@ INCLUDE(${PROJECT_SOURCE_DIR}/cmake/common.cmake) SET(clitkGGO_SRC clitkImageResample_ggo.c - clitkBinarizeImage_ggo.c + # ../filters/clitkBinarizeImage_ggo.c ) ADD_LIBRARY(clitkGGO STATIC ${clitkGGO_SRC}) @@ -84,5 +84,5 @@ ADD_EXECUTABLE(clitkGuerreroVentilation clitkGuerreroVentilation.cxx TARGET_LINK_LIBRARIES(clitkGuerreroVentilation clitkCommon ITKIO ITKBasicFilters clitkFilters) -ADD_EXECUTABLE(clitkBinarizeImage clitkBinarizeImage.cxx clitkBinarizeImage_ggo.c) +ADD_EXECUTABLE(clitkBinarizeImage clitkBinarizeImage.cxx) TARGET_LINK_LIBRARIES(clitkBinarizeImage ITKIO clitkCommon) diff --git a/tools/clitkBinarizeImage.ggo b/tools/clitkBinarizeImage.ggo deleted file mode 100644 index c974fe4..0000000 --- a/tools/clitkBinarizeImage.ggo +++ /dev/null @@ -1,15 +0,0 @@ -#File clitkBinarizeImage.ggo -Package "clitkBinarizeImage" -version "1.0" -purpose "" - -option "config" - "Config file" string no -option "imagetypes" - "Verbose available image type" flag off -option "verbose" v "Verbose" flag off - -option "input" i "Input image filename" string yes -option "output" o "Output image filename" string yes -option "lower" l "Lower intensity (default=min)" double no -option "upper" u "Upper intensity (default=max)" double no -option "inside" - "Inside value" double no default="1" -option "outside" - "Outside value" double no default="0" diff --git a/vv/vvToolBinarize.cxx b/vv/vvToolBinarize.cxx index a7579d8..05af495 100644 --- a/vv/vvToolBinarize.cxx +++ b/vv/vvToolBinarize.cxx @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: vvToolBinarize.cxx,v $ Language: C++ - Date: $Date: 2010/01/29 13:54:37 $ - Version: $Revision: 1.1 $ + Date: $Date: 2010/02/01 15:54:25 $ + Version: $Revision: 1.2 $ Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr) Copyright (C) 2008 @@ -267,14 +267,16 @@ void vvToolBinarize::GetArgsInfoFromGUI() { } } - mArgsInfo.inside_arg = mFGSlider->GetValue(); - mArgsInfo.outside_arg = mBGSlider->GetValue(); + mArgsInfo.fg_arg = mFGSlider->GetValue(); + mArgsInfo.bg_arg = mBGSlider->GetValue(); if (inverseBGandFG) { - mArgsInfo.inside_arg = mBGSlider->GetValue(); - mArgsInfo.outside_arg = mFGSlider->GetValue(); + mArgsInfo.fg_arg = mBGSlider->GetValue(); + mArgsInfo.bg_arg = mFGSlider->GetValue(); } - mArgsInfo.inside_given = 1; - mArgsInfo.outside_given = 1; + mArgsInfo.fg_given = 1; + mArgsInfo.bg_given = 1; + + mArgsInfo.setBG_flag = true; mArgsInfo.verbose_flag = true;