X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=tools%2FclitkProfileImageGenericFilter.cxx;h=3c6d6b79ff1f1d4084ddf5cb46a1639b77d73819;hb=e01ff4c52156fd3827d8aed581a21cc236d9ac43;hp=82298151116fc67a2505603e01d5b4dedfd11829;hpb=c3f5fb33ede3fc84e36a9f97d530f93f5fe49e44;p=clitk.git diff --git a/tools/clitkProfileImageGenericFilter.cxx b/tools/clitkProfileImageGenericFilter.cxx index 8229815..3c6d6b7 100644 --- a/tools/clitkProfileImageGenericFilter.cxx +++ b/tools/clitkProfileImageGenericFilter.cxx @@ -30,9 +30,7 @@ #include "clitkProfileImageGenericFilter.h" // itk include -#include "itkBinaryThresholdImageFilter.h" -#include "itkMaskImageFilter.h" -#include "itkMaskNegatedImageFilter.h" +#include #include @@ -88,25 +86,40 @@ ProfileImageGenericFilter::UpdateWithInputImageType() // Reading input typename InputImageType::Pointer input = this->template GetInput(0); - - // Main filter typedef typename InputImageType::PixelType PixelType; + typedef typename InputImageType::IndexType IndexType; typedef itk::Image OutputImageType; + + //Iterator + IndexType pointBegin, pointEnd; + + for (int i = 0; i < mArgsInfo.point1_given; ++i) { + pointBegin[i] = mArgsInfo.point1_arg[i]; + pointEnd[i] = mArgsInfo.point2_arg[i]; + } + + itk::LineConstIterator itProfile(input, pointBegin, pointEnd); + itProfile.GoToBegin(); + while (!itProfile.IsAtEnd()) + { + + ++itProfile; + } // Filter - typedef itk::BinaryThresholdImageFilter BinaryThresholdImageFilterType; - typename BinaryThresholdImageFilterType::Pointer thresholdFilter=BinaryThresholdImageFilterType::New(); - thresholdFilter->SetInput(input); - thresholdFilter->SetInsideValue(mArgsInfo.fg_arg); + //typedef itk::BinaryThresholdImageFilter BinaryThresholdImageFilterType; + //typename BinaryThresholdImageFilterType::Pointer thresholdFilter=BinaryThresholdImageFilterType::New(); + //thresholdFilter->SetInput(input); + /*thresholdFilter->SetInsideValue(mArgsInfo.fg_arg); if (mArgsInfo.lower_given) thresholdFilter->SetLowerThreshold(static_cast(mArgsInfo.lower_arg)); if (mArgsInfo.upper_given) thresholdFilter->SetUpperThreshold(static_cast(mArgsInfo.upper_arg)); - /* Three modes : + Three modes : - FG -> only use FG value for pixel in the Foreground (or Inside), keep input values for outside - BG -> only use BG value for pixel in the Background (or Outside), keep input values for inside - both -> use FG and BG (real binary image) - */ + if (mArgsInfo.mode_arg == std::string("both")) { thresholdFilter->SetOutsideValue(mArgsInfo.bg_arg); thresholdFilter->Update(); @@ -134,7 +147,7 @@ ProfileImageGenericFilter::UpdateWithInputImageType() } // Write/Save results this->template SetNextOutput(outputImage); - } + }*/ } //--------------------------------------------------------------------