diff --git a/apps/VoxelizerTool/VoxelizerToolApplicationData.cpp b/apps/VoxelizerTool/VoxelizerToolApplicationData.cpp index 68a0f6a..40228c3 100644 --- a/apps/VoxelizerTool/VoxelizerToolApplicationData.cpp +++ b/apps/VoxelizerTool/VoxelizerToolApplicationData.cpp @@ -1,93 +1,87 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ radiotherapy quantitative evaluation library // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See rttbCopyright.txt or // http://www.dkfz.de/en/sidt/projects/rttb/copyright.html // // 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. // //------------------------------------------------------------------------ -/*! -// @file -// @version $Revision: 1221 $ (last changed revision) -// @date $Date: 2015-12-01 13:43:31 +0100 (Di, 01 Dez 2015) $ (last change date) -// @author $Author: hentsch $ (last changed by) -*/ #include "VoxelizerToolApplicationData.h" #include "VoxelizerToolCmdLineParser.h" namespace rttb { namespace apps { namespace voxelizerTool { ApplicationData:: ApplicationData() { this->reset(); } void ApplicationData:: reset() { _structFile = ""; _referenceFile = ""; _outputFilename = ""; _regEx=""; _multipleStructs = false; _binaryVoxelization = false; _addStructures = false; - _noStrictVoxelization = false; + _noStrictVoxelization = false; } void populateAppData(boost::shared_ptr argParser, ApplicationData& appData) { appData._structFile = argParser->get(argParser->OPTION_STRUCT_FILE); appData._referenceFile = argParser->get(argParser->OPTION_REFERENCE_FILE); appData._outputFilename = argParser->get(argParser->OPTION_OUTPUT_FILE_NAME); - appData._referenceFileLoadStyle = argParser->get>(argParser->OPTION_REFERENCE_FILE_LOAD_STYLE); - //only valid option for reading structs is dicom until now. - appData._structFileLoadStyle.emplace_back("dicom"); + appData._referenceFileLoadStyle = argParser->get(argParser->OPTION_REFERENCE_FILE_LOAD_STYLE); + //only valid option for reading structs is dicom until now. + appData._structFileLoadStyle = "dicom"; appData._regEx = argParser->get(argParser->OPTION_REGEX); if (argParser->isSet(argParser->OPTION_MULTIPLE_STRUCTS)) { appData._multipleStructs = true; if (argParser->isSet(argParser->OPTION_ADDSTRUCTURES)) { appData._addStructures = true; } else { appData._addStructures = false; } } if (argParser->isSet(argParser->OPTION_BINARY_VOXELIZATION)) { appData._binaryVoxelization = true; } if (argParser->isSet(argParser->OPTION_ADDSTRUCTURES)) { appData._multipleStructs = false; appData._addStructures = true; } if (argParser->isSet(argParser->OPTION_NO_STRICT_VOXELIZATION)) { appData._noStrictVoxelization = true; } } } } } diff --git a/apps/VoxelizerTool/VoxelizerToolApplicationData.h b/apps/VoxelizerTool/VoxelizerToolApplicationData.h index 4155d42..f68ee09 100644 --- a/apps/VoxelizerTool/VoxelizerToolApplicationData.h +++ b/apps/VoxelizerTool/VoxelizerToolApplicationData.h @@ -1,73 +1,66 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ radiotherapy quantitative evaluation library // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See rttbCopyright.txt or // http://www.dkfz.de/en/sidt/projects/rttb/copyright.html // // 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. // //------------------------------------------------------------------------ -/*! -// @file -// @version $Revision: 1221 $ (last changed revision) -// @date $Date: 2015-12-01 13:43:31 +0100 (Di, 01 Dez 2015) $ (last change date) -// @author $Author: hentsch $ (last changed by) -*/ #ifndef __VoxelizerApplicationData_h #define __VoxelizerApplicationData_h #include "boost/shared_ptr.hpp" #include "rttbDoseAccessorInterface.h" #include "rttbStructureSetGeneratorInterface.h" #include #include namespace rttb { namespace apps { namespace voxelizerTool { class VoxelizerCmdLineParser; /*! @class ApplicationData @brief Class for storing all relevant variables needed in VoxelizerTool */ class ApplicationData { public: - typedef std::vector LoadingStyleArgType; core::DoseAccessorInterface::DoseAccessorPointer _dose; core::StructureSetGeneratorInterface::StructureSetPointer _struct; std::string _structFile; std::string _referenceFile; std::string _outputFilename; std::string _regEx; - LoadingStyleArgType _referenceFileLoadStyle; - LoadingStyleArgType _structFileLoadStyle; + std::string _referenceFileLoadStyle; + std::string _structFileLoadStyle; bool _multipleStructs; bool _binaryVoxelization; bool _addStructures; bool _noStrictVoxelization; /*! @brief Resets the variables. */ void reset(); ApplicationData(); }; /*! @brief Reads the necessary arguments from the VoxelizerCmdLineParser and writes them in the respective variables of ApplicationData. */ void populateAppData(boost::shared_ptr argParser, ApplicationData& appData); } } } #endif diff --git a/code/io/utils/rttbDoseLoader.cpp b/code/io/utils/rttbDoseLoader.cpp index ab783b9..3f515bc 100644 --- a/code/io/utils/rttbDoseLoader.cpp +++ b/code/io/utils/rttbDoseLoader.cpp @@ -1,108 +1,107 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ radiotherapy quantitative evaluation library // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See rttbCopyright.txt or // http://www.dkfz.de/en/sidt/projects/rttb/copyright.html // // 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. // //------------------------------------------------------------------------ #ifndef __RTTB_DOSE_LOADER_H #define __RTTB_DOSE_LOADER_H #include "rttbDoseIteratorInterface.h" #include "rttbExceptionMacros.h" #include "rttbDicomFileDoseAccessorGenerator.h" #include "rttbDicomHelaxFileDoseAccessorGenerator.h" #include "rttbITKImageFileAccessorGenerator.h" namespace rttb { namespace io { namespace utils { /*! @brief loads a dicom dose from a file. @exception Throws an rttb::Exception if loading fails @sa DicomFileDoseAccessorGenerator */ rttb::core::DoseAccessorInterface::DoseAccessorPointer loadDicomDose(const std::string& fileName) { rttb::io::dicom::DicomFileDoseAccessorGenerator generator(fileName); return generator.generateDoseAccessor(); } /*! @brief loads a helax dose from a file. @exception Throws an rttb::Exception if loading fails @sa DicomHelaxFileDoseAccessorGenerator */ rttb::core::DoseAccessorInterface::DoseAccessorPointer loadHelaxDose(const std::string& path) { rttb::io::helax::DicomHelaxFileDoseAccessorGenerator generator(path); return generator.generateDoseAccessor(); } /*! @brief loads an itk dose from a file. @exception Throws an rttb::Exception if loading fails. @details Might be of all formats that ITK know (*.mhd, *.nrrd, ...). The absolute image values are taken as dose. @sa ITKImageFileAccessorGenerator */ rttb::core::DoseAccessorInterface::DoseAccessorPointer loadITKDose(const std::string& fileName) { rttb::io::itk::ITKImageFileAccessorGenerator generator(fileName); return generator.generateDoseAccessor(); } rttb::core::DoseAccessorInterface::DoseAccessorPointer loadITKDicomDose(const std::string& fileName) { rttb::io::itk::ITKImageFileAccessorGenerator generator(fileName); return generator.generateDoseAccessor(true); } /*! @brief loads a dose from a file based on the loadingStyle. @params args[0]: determines the loadingStyle @exception Throws an rttb::Exception if loading fails */ rttb::core::DoseAccessorInterface::DoseAccessorPointer loadDose(const std::string& fileName, - const std::vector& args) + const std::string& loadStyle) { rttb::core::DoseAccessorInterface::DoseAccessorPointer result; - if (args.empty() || args[0] == "dicom") + if (loadStyle == "" || loadStyle == "dicom") { result = loadDicomDose(fileName); } - else if (args[0] == "helax") + else if (loadStyle == "helax") { result = loadHelaxDose(fileName); } - else if (args[0] == "itk") + else if (loadStyle == "itk") { result = loadITKDose(fileName); } - else if (args[0] == "itkDicom") + else if (loadStyle == "itkDicom") { result = loadITKDicomDose(fileName); } else { - rttbDefaultExceptionStaticMacro(<< "Unknown io style selected. Cannot load data. Selected style: " - << args[0]); + rttbDefaultExceptionStaticMacro(<< "Unknown io style selected. Cannot load data. Selected style: " << loadStyle); } return result; } } } } #endif diff --git a/code/io/utils/rttbStructLoader.cpp b/code/io/utils/rttbStructLoader.cpp index 897ebc4..e93409b 100644 --- a/code/io/utils/rttbStructLoader.cpp +++ b/code/io/utils/rttbStructLoader.cpp @@ -1,86 +1,77 @@ // ----------------------------------------------------------------------- // RTToolbox - DKFZ radiotherapy quantitative evaluation library // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See rttbCopyright.txt or // http://www.dkfz.de/en/sidt/projects/rttb/copyright.html // // 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. // //------------------------------------------------------------------------ -/*! -// @file -// @version $Revision: 1674 $ (last changed revision) -// @date $Date: 2017-01-27 10:34:46 +0100 (Fr, 27 Jan 2017) $ (last change date) -// @author $Author: hentsch $ (last changed by) -*/ #ifndef __RTTB_STRUCT_LOADER_H #define __RTTB_STRUCT_LOADER_H #include "rttbDicomFileStructureSetGenerator.h" #include "rttbExceptionMacros.h" namespace rttb { namespace io { namespace utils { - using LoadingStyleArgType = std::vector; - /*! @brief loads a dicom struct from a file. You may pass a structure name regex. If is not empty, it will be used to filter structure in the loading process. Only structures with a name matching the reg ex will be loaded. This speeds up the loading process significantly if you need only one structure out of a structure set. @exception Throws an rttb::Exception if loading fails @sa DicomFileStructureSetGenerator */ rttb::core::StructureSetGeneratorInterface::StructureSetPointer loadDicomStruct( const std::string& fileName, const std::string& structNameRegex = "") { rttb::io::dicom::DicomFileStructureSetGenerator generator(fileName); if (!structNameRegex.empty()) { generator.setStructureLabelFilterActive(true); generator.setFilterRegEx(structNameRegex); } return generator.generateStructureSet(); } /*! @brief loads a struct from a file based on the loadingStyle. You may pass a structure name regex. If is not empty, it will be used to filter structure in the loading process. Only structures with a name matching the reg ex will be loaded. This speeds up the loading process significantly if you need only one structure out of a structure set. @exception Throws an rttb::Exception if loading fails @details voxelized itk images are read in generateMask() directly */ rttb::core::StructureSetGeneratorInterface::StructureSetPointer loadStruct( - const std::string& fileName, const LoadingStyleArgType& args, const std::string& structNameRegex = "") + const std::string& fileName, const std::string& loadStyle, const std::string& structNameRegex = "") { rttb::core::StructureSetGeneratorInterface::StructureSetPointer result; - if (args.empty() || args[0] == "dicom") + if (loadStyle == "" || loadStyle == "dicom") { result = rttb::io::utils::loadDicomStruct(fileName, structNameRegex); } else { - rttbDefaultExceptionStaticMacro(<< "Unknown io style selected. Cannot load data. Selected style: " - << args[0]); + rttbDefaultExceptionStaticMacro(<< "Unknown io style selected. Cannot load data. Selected style: " << loadStyle); } return result; } } } } #endif