X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=tools%2FclitkImageExtractLine.cxx;h=5360b02359a4f33521a20fa00aa530ee808d45ed;hb=aa1d6708838babe498d528c39c93095432b108a2;hp=0cf94540c70519aa9a50c74546a478ed45dbacf0;hpb=1e034c70105f0926939acaaa27ddb46e904ae8bf;p=clitk.git diff --git a/tools/clitkImageExtractLine.cxx b/tools/clitkImageExtractLine.cxx index 0cf9454..5360b02 100644 --- a/tools/clitkImageExtractLine.cxx +++ b/tools/clitkImageExtractLine.cxx @@ -22,12 +22,17 @@ * @file clitkImageExtractLine.cxx * @author David Sarrut * @date 23 Feb 2008 08:37:53 + * @modified by Loïc Grevillot + * @date 10 March 2011 + * Option -I added, in order to integrate plans perpendicular to a line + -------------------------------------------------*/ // clitk include #include "clitkImageExtractLine_ggo.h" #include "clitkIO.h" #include "clitkImageCommon.h" +#include "clitkCommon.h" #include //-------------------------------------------------------------------- @@ -42,6 +47,7 @@ int main(int argc, char * argv[]) typedef float PixelType; const unsigned int Dimension=3; typedef itk::Image ImageType; + typedef itk::Size SizeType; // Check options if (args_info.firstIndex_given != Dimension) { @@ -74,16 +80,100 @@ int main(int argc, char * argv[]) length = sqrt(length); // Loop +// std::vector depth; +// std::vector values; +// itk::LineConstIterator iter(input, firstIndex, lastIndex); +// iter.GoToBegin(); +// while (!iter.IsAtEnd()) { +// values.push_back(iter.Get()); +// ++iter; +// } +// double step = length/values.size(); + std::vector depth; std::vector values; itk::LineConstIterator iter(input, firstIndex, lastIndex); - iter.GoToBegin(); - while (!iter.IsAtEnd()) { - values.push_back(iter.Get()); - ++iter; + int direction=0; + + // args_info.integral_arg=0, so, it does not compute the integral + if (args_info.integral_arg==0){ + iter.GoToBegin(); + while (!iter.IsAtEnd()) { + values.push_back(iter.Get()); + ++iter; + } + } + // args_info.integral_arg=1, so, it computes the integral + if (args_info.integral_arg!=0){ + int a=0, b=0, c=0; + if (args_info.integralAxis_arg==0){ + a=1; + b=0; + c=2; + } + else if (args_info.integralAxis_arg==1){ + a=0; + b=1; + c=2; + } + else if (args_info.integralAxis_arg==2){ + a=2; + b=0; + c=1; + } + else {std::cout<<"Wrong axis"<GetLargestPossibleRegion().GetSize(); + DD(dim); + DD(direction); + + double val[dim[b]]; + for (int i=0; i iter(input, firstIndex, lastIndex); + iter.GoToBegin(); + // std::cout<<"B"<