X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=tools%2FclitkImageExtractLine.cxx;h=b4ef60340ce2c2752999c28b2d2390de9df26874;hb=046c745470683943ba4f0e6abd72ed27446d0cc2;hp=94590a0a7a152c7abfde290b3fafae02607e0862;hpb=931a42358442f4ee4f314613c991c838d4b4e3b7;p=clitk.git diff --git a/tools/clitkImageExtractLine.cxx b/tools/clitkImageExtractLine.cxx index 94590a0..b4ef603 100644 --- a/tools/clitkImageExtractLine.cxx +++ b/tools/clitkImageExtractLine.cxx @@ -1,32 +1,43 @@ -/*------------------------------------------------------------------------- - - Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de - l'Image). All rights reserved. See Doc/License.txt or - http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details. - +/*========================================================================= + Program: vv http://www.creatis.insa-lyon.fr/rio/vv + + Authors belong to: + - University of LYON http://www.universite-lyon.fr/ + - Léon Bérard cancer center http://www.centreleonberard.fr + - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr + This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - - -------------------------------------------------------------------------*/ + PURPOSE. See the copyright notices for more information. + + It is distributed under dual licence + - BSD See included LICENSE.txt file + - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +===========================================================================**/ #ifndef CLITKIMAGEEXTRACTLINE_CXX #define CLITKIMAGEEXTRACTLINE_CXX - /** ------------------------------------------------- * @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 //-------------------------------------------------------------------- -int main(int argc, char * argv[]) { +int main(int argc, char * argv[]) +{ // Init command line GGO(clitkImageExtractLine, args_info); @@ -36,7 +47,8 @@ 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) { std::cerr << "Please give " << Dimension << "values to --firstIndex option" << std::endl; @@ -58,7 +70,7 @@ int main(int argc, char * argv[]) { double length = 0.0; for(unsigned int i=0; i 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); + + std::vector val(dim[b]); + for (int i=0; i iter(input, firstIndex, lastIndex); + iter.GoToBegin(); + // std::cout<<"B"<