From: Romulo Pinho Date: Mon, 20 Aug 2012 13:14:25 +0000 (+0200) Subject: some verbose/debug messages X-Git-Tag: v1.3.0~16 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=6b3340701c3f6f4c87c1366b3090258c8df93deb;p=clitk.git some verbose/debug messages --- diff --git a/tools/clitkDicom2Image.cxx b/tools/clitkDicom2Image.cxx index 6410714..07a8565 100644 --- a/tools/clitkDicom2Image.cxx +++ b/tools/clitkDicom2Image.cxx @@ -57,6 +57,8 @@ int main(int argc, char * argv[]) for(unsigned int i=0; iSetFileName(input_files[i]); header->SetMaxSizeLoadEntry(16384); // required ? diff --git a/tools/clitkWriteDicomSeriesGenericFilter.txx b/tools/clitkWriteDicomSeriesGenericFilter.txx index d49c51e..9bc52dc 100644 --- a/tools/clitkWriteDicomSeriesGenericFilter.txx +++ b/tools/clitkWriteDicomSeriesGenericFilter.txx @@ -196,10 +196,15 @@ WriteDicomSeriesGenericFilter::UpdateWithDimAndPixelType() } } - filter->Update(); - input = filter->GetOutput(); + try { + filter->Update(); + input = filter->GetOutput(); + } catch( itk::ExceptionObject & excp ) { + std::cerr << "Error: Exception thrown while resampling!!" << std::endl; + std::cerr << excp << std::endl; + } } - + // In some cases, due to resampling approximation issues, // the number of slices in the MHD file may be different (smaller) // from the number of files in the template dicom directory. @@ -208,6 +213,9 @@ WriteDicomSeriesGenericFilter::UpdateWithDimAndPixelType() // in verbose mode const RegionType volumeRegion = input->GetLargestPossibleRegion(); const SizeType& volumeSize = volumeRegion.GetSize(); + if (m_Verbose) { + std::cout << volumeRegion << volumeSize << std::endl; + } if (Dimension == 3 && volumeSize[2] < numberOfFilenames) { if (m_Verbose) std::cout << "Warning: The number of files in " << m_ArgsInfo.inputDir_arg << " (" << filenames_in.size() << " files) is greater than the number of slices in MHD (" << volumeSize[2] << " slices). Using only " << volumeSize[2] << " files." << std::endl; @@ -233,9 +241,11 @@ WriteDicomSeriesGenericFilter::UpdateWithDimAndPixelType() for (unsigned int i = 0; i < numberOfKeysGiven; i++) { std::string entryId(m_ArgsInfo.key_arg[i] ); std::string value( m_ArgsInfo.tag_arg[i] ); + std::cout << entryId << " " << value << std::endl; for(unsigned int fni = 0; fni( *((*dictionary)[fni]), entryId, value ); } + // Output directory and filenames itksys::SystemTools::MakeDirectory( m_ArgsInfo.outputDir_arg ); // create if it doesn't exist @@ -251,6 +261,7 @@ WriteDicomSeriesGenericFilter::UpdateWithDimAndPixelType() // Write try { seriesWriter->Update(); + std::cerr << "filter update" << std::endl; } catch( itk::ExceptionObject & excp ) { std::cerr << "Error: Exception thrown while writing the series!!" << std::endl; std::cerr << excp << std::endl;