X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=tools%2FclitkImageExtractLine.cxx;h=a4040dd2b05f1a6ce39ab52eb873e277286970f7;hb=91dc23d0440db7c36cabdb46271bebe30a28819c;hp=bd7c97816e4a5e6fa1292b5832ce3af96bb16fc6;hpb=b90df15e193f919926bd6688e4f3a774ba84373d;p=clitk.git diff --git a/tools/clitkImageExtractLine.cxx b/tools/clitkImageExtractLine.cxx index bd7c978..a4040dd 100644 --- a/tools/clitkImageExtractLine.cxx +++ b/tools/clitkImageExtractLine.cxx @@ -22,6 +22,10 @@ * @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 @@ -43,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) { @@ -75,16 +80,104 @@ 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 + else if (lastIndex[0]-firstIndex[0]==0 && lastIndex[1]-firstIndex[1]==0 && lastIndex[2]-firstIndex[2]>0) + direction=1; + else if (lastIndex[0]-firstIndex[0]==0 && lastIndex[1]-firstIndex[1]>0 && lastIndex[2]-firstIndex[2]==0) + direction=2; + else if (lastIndex[0]-firstIndex[0]>0 && lastIndex[1]-firstIndex[1]==0 && lastIndex[2]-firstIndex[2]==0) + direction=3; + else{ + //std::cout<GetLargestPossibleRegion().GetSize(); + DD(dim); + DD(direction); + + int a=0, b=0, c=0; + + if (direction==2){ + a=0; + b=1; + c=2; + } + if (direction==1){ + a=0; + b=2; + c=1; + } + if (direction==3){ + a=2; + b=0; + c=1; + } + + double val[dim[b]]; + for (int i=0; i iter(input, firstIndex, lastIndex); + iter.GoToBegin(); + // std::cout<<"B"<