Authors belong to:
- University of LYON http://www.universite-lyon.fr/
- - Léon Bérard cancer center http://oncora1.lyon.fnclcc.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
- BSD See included LICENSE.txt file
- CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
-======================================================================-====*/
+===========================================================================**/
#ifndef clitkWriteDicomSeriesGenericFilter_txx
#define clitkWriteDicomSeriesGenericFilter_txx
if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed short..." << std::endl;
UpdateWithDimAndPixelType<Dimension, signed short>();
}
- // else if(PixelType == "unsigned_short"){
- // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl;
- // UpdateWithDimAndPixelType<Dimension, unsigned short>();
- // }
+ else if(PixelType == "unsigned_short"){
+ if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl;
+ UpdateWithDimAndPixelType<Dimension, unsigned short>();
+ }
else if (PixelType == "unsigned_char") {
if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl;
// if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl;
// UpdateWithDimAndPixelType<Dimension, signed char>();
// }
+ else if (PixelType == "double") {
+ if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and double..." << std::endl;
+ UpdateWithDimAndPixelType<Dimension, double>();
+ }
else {
if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl;
UpdateWithDimAndPixelType<Dimension, float>();
}
}
- 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.
// 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;
const std::vector<DictionaryType*>* dictionary = reader->GetMetaDataDictionaryArray();
// Get keys
- unsigned int numberOfKeysGiven=0;
- if(m_ArgsInfo.midP_flag && m_ArgsInfo.key_given)
- std::cerr<<"Error: both keys and midP option are given"<<std::endl;
- else if (m_ArgsInfo.midP_flag)
- numberOfKeysGiven=1;
- else
- numberOfKeysGiven=m_ArgsInfo.key_given;
+ unsigned int numberOfKeysGiven=m_ArgsInfo.key_given;
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<numberOfFilenames; fni++)
itk::EncapsulateMetaData<std::string>( *((*dictionary)[fni]), entryId, value );
}
+
// Output directory and filenames
itksys::SystemTools::MakeDirectory( m_ArgsInfo.outputDir_arg ); // create if it doesn't exist