/*========================================================================= 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://oncora1.lyon.fnclcc.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 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 -------------------------------------------------*/ // clitk include #include "clitkImageExtractLine_ggo.h" #include "clitkIO.h" #include "clitkImageCommon.h" #include //-------------------------------------------------------------------- int main(int argc, char * argv[]) { // Init command line GGO(clitkImageExtractLine, args_info); CLITK_INIT; // Declare main types typedef float PixelType; const unsigned int Dimension=3; typedef itk::Image ImageType; // Check options if (args_info.firstIndex_given != Dimension) { std::cerr << "Please give " << Dimension << "values to --firstIndex option" << std::endl; exit(0); } if (args_info.lastIndex_given != Dimension) { std::cerr << "Please give " << Dimension << "values to --lastIndex option" << std::endl; exit(0); } // Read image ImageType::Pointer input = clitk::readImage(args_info.input_arg, args_info.verbose_flag); // Get first and last index typedef ImageType::IndexType IndexType; IndexType firstIndex; IndexType lastIndex; ImageType::SpacingType spacing = input->GetSpacing(); 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(); // If isocenter is used double isoDistance = 0.0; if (args_info.isocenter_given) { // isoCenter is in mm IndexType isoCenter; for(unsigned int i=0; i