diff --git a/Applications/Combiner/include/mapCombineRApplicationData.h b/Applications/Combiner/include/mapCombineRApplicationData.h index 0ab4c36..e590622 100644 --- a/Applications/Combiner/include/mapCombineRApplicationData.h +++ b/Applications/Combiner/include/mapCombineRApplicationData.h @@ -1,66 +1,66 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_COMBINER_PLICATION_DATA_H #define __MAP_COMBINER_PLICATION_DATA_H #include "mapString.h" #include "mapRegistrationBase.h" #include "itksys/CommandLineArguments.hxx" namespace map { namespace apps { namespace combineR { struct ApplicationData { /** Loaded Registrations.*/ - typedef std::vector< ::map::core::RegistrationBase::Pointer> RegistrationListType; + using RegistrationListType = std::vector< ::map::core::RegistrationBase::Pointer>; RegistrationListType _spRegList; std::vector< ::map::core::String> _regFileList; std::vector _inversionList; ::map::core::String _outputFileName; ::map::core::String _logFileName; bool _showVersion; bool _detailedOutput; bool _showHelp; void Reset(); ApplicationData(); }; /** Parse the application argument passed when starting the application.**/ unsigned int ParseArguments(int argc, char** argv, ApplicationData& appData); - } - } -} + } // namespace combineR + } // namespace apps +} // namespace map #endif diff --git a/Applications/Combiner/include/mapCombineRHelper.h b/Applications/Combiner/include/mapCombineRHelper.h index e6d4ec9..394e658 100644 --- a/Applications/Combiner/include/mapCombineRHelper.h +++ b/Applications/Combiner/include/mapCombineRHelper.h @@ -1,42 +1,42 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_COMBINER_HELPER_H #define __MAP_COMBINER_HELPER_H #include "mapRegistrationBase.h" namespace map { namespace apps { namespace combineR { map::core::RegistrationBase::Pointer invertRegistration(map::core::RegistrationBase* reg); map::core::RegistrationBase::Pointer combineRegistration(map::core::RegistrationBase* reg1, map::core::RegistrationBase* reg2); bool writeRegistration(map::core::RegistrationBase* reg, const map::core::String& fileName); } } -} +} // namespace map #endif diff --git a/Applications/Combiner/source/mapCombineR.cpp b/Applications/Combiner/source/mapCombineR.cpp index 9b99602..82e940c 100644 --- a/Applications/Combiner/source/mapCombineR.cpp +++ b/Applications/Combiner/source/mapCombineR.cpp @@ -1,257 +1,257 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapCombineRApplicationData.h" #include "mapCombineRHelper.h" #include "mapRegistrationFileReader.h" #include "mapRegistrationFileWriter.h" #include "mapConvert.h" #include "itkStdStreamLogOutput.h" #include "itkVersion.h" #ifdef MAP_DISABLE_ITK_IO_FACTORY_AUTO_REGISTER /* The mapR needs the IO factories to be registered in cases where MatchPoint is built without auto registration (e.g. for use in MITK) mapR has to add the registration helper manually.*/ #include "itkImageIOFactoryRegisterManager.h" #endif //MAP_DISABLE_ITK_IO_FACTORY_AUTO_REGISTER map::apps::combineR::ApplicationData appData; /** Main function/entry point of the program. When execute use "-?" to get the usage instructions. * See CombineRApplicationData::ParseArguments for the codes segement that specifies the instructions. * @retval 0 normal exit. * @retval 1 showed version info or help. * @retval 2 Invalid usage. No arguments given. * @retval 3 Invalid usage. Wrong arguments given. * @retval 5 Error while loading (or inverting) registrations. * @retval 6 Error while combining registrations. * @retval 7 Error while saving combined registration. */ int main(int argc, char** argv) { int result = 0; std::cout << "combineR - Generic registration combination tool for MatchPoint." << std::endl; switch (map::apps::combineR::ParseArguments(argc, argv, appData)) { case 1: { //showed version or help info. Done. return 1; } case 2: { std::cerr << "Missing Parameters. Use one of the following flags for more information:" << std::endl; std::cerr << "-? or --help" << std::endl; return 2; } case 3: { //wrong option usage. return 3; } } map::core::Logbook::setDefaultLogFileName(appData._logFileName); ::itk::StdStreamLogOutput::Pointer spStreamLogOutput = ::itk::StdStreamLogOutput::New(); spStreamLogOutput->SetStream(std::cout); map::core::Logbook::addAdditionalLogOutput(spStreamLogOutput); if (appData._detailedOutput) { map::core::Logbook::setLogbookToDebugMode(); } std::cout << std::endl << "*******************************************" << std::endl; std::vector::const_iterator fileListPos; std::vector::const_iterator invListPos = appData._inversionList.begin(); for (fileListPos = appData._regFileList.begin(); fileListPos != appData._regFileList.end(); ++fileListPos, ++invListPos) { std::cout << "Reg file 1: " << *fileListPos; if (*invListPos) { std::cout << "(inverted)"; } std::cout << std::endl; } std::cout << "Output reg file: " << appData._outputFileName << std::endl; //load registrations appData._spRegList.clear(); try { for (fileListPos = appData._regFileList.begin(); fileListPos != appData._regFileList.end(); ++fileListPos) { std::cout << std::endl << "read registration file "<< fileListPos - appData._regFileList.begin() +1 << "... "; map::io::RegistrationFileReader::Pointer spRegReader = map::io::RegistrationFileReader::New(); map::io::RegistrationFileReader::LoadedRegistrationPointer spReg = spRegReader->read(*fileListPos); appData._spRegList.push_back(spReg); std::cout << "done." << std::endl; } } catch (::itk::ExceptionObject& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e << std::endl; return 5; } catch (std::exception& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e.what() << std::endl; return 5; } catch (...) { std::cerr << "Error!!! unknown error while reading registration file." << std::endl; return 5; } //invert registrations try { invListPos = appData._inversionList.begin(); - for (map::apps::combineR::ApplicationData::RegistrationListType::iterator regPos = appData._spRegList.begin(); regPos != appData._spRegList.end(); ++regPos, ++invListPos) + for (auto regPos = appData._spRegList.begin(); regPos != appData._spRegList.end(); ++regPos, ++invListPos) { if (*invListPos) { std::cout << std::endl << "invert registration #"<< regPos - appData._spRegList.begin() + 1 << "... "; map::core::RegistrationBase::Pointer invertedReg = map::apps::combineR::invertRegistration(regPos->GetPointer()); if (invertedReg.IsNotNull()) { *regPos = invertedReg; std::cout << "done." << std::endl; } else { std::cerr << "Error!!! Unable to invert registration.unknown Unsupported dimensionality." << std::endl; return 5; } } } } catch (::itk::ExceptionObject& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e << std::endl; return 5; } catch (std::exception& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e.what() << std::endl; return 5; } catch (...) { std::cerr << "Error!!! unknown error while inverting registration." << std::endl; return 5; } //combine registrations map::core::RegistrationBase::Pointer combinedReg = appData._spRegList.front(); try { - for (map::apps::combineR::ApplicationData::RegistrationListType::iterator regPos = appData._spRegList.begin()+1; regPos != appData._spRegList.end(); ++regPos) + for (auto regPos = appData._spRegList.begin()+1; regPos != appData._spRegList.end(); ++regPos) { std::cout << std::endl << "combine registration #"<< regPos - appData._spRegList.begin() + 1 << "... "; map::core::RegistrationBase::Pointer interimReg = map::apps::combineR::combineRegistration(combinedReg, regPos->GetPointer()); if (interimReg.IsNotNull()) { combinedReg = interimReg; std::cout << "done." << std::endl; } else { std::cerr << "Error!!! Unable to combine registration." << std::endl; return 6; } } } catch (::itk::ExceptionObject& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e << std::endl; return 6; } catch (std::exception& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e.what() << std::endl; return 6; } catch (...) { std::cerr << "Error!!! unknown error while inverting registration." << std::endl; return 6; } try { std::cout << std::endl << "write final combine registration... "; if (!map::apps::combineR::writeRegistration(combinedReg, appData._outputFileName)) { std::cerr << "Error!!! Unable to write combined registration." << std::endl; return 7; } - else - { + + std::cout << "done." << std::endl; - } + } catch (::itk::ExceptionObject& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e << std::endl; return 7; } catch (std::exception& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e.what() << std::endl; return 7; } catch (...) { std::cerr << "Error!!! unknown error while inverting registration." << std::endl; return 7; } std::cout << std::endl; return result; } diff --git a/Applications/Combiner/source/mapCombineRApplicationData.cpp b/Applications/Combiner/source/mapCombineRApplicationData.cpp index c1f71d6..3543fb7 100644 --- a/Applications/Combiner/source/mapCombineRApplicationData.cpp +++ b/Applications/Combiner/source/mapCombineRApplicationData.cpp @@ -1,183 +1,183 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapCombineRApplicationData.h" #include "mapConfigure.h" #include "itksys/SystemTools.hxx" namespace map { namespace apps { namespace combineR { int unknown_argument(const char* argument, void* call_data) { std::cout << "Got unknown argument: \"" << argument << "\"" << std::endl; return 0; } ApplicationData:: ApplicationData() { this->Reset(); } void ApplicationData:: Reset() { _spRegList.clear(); _regFileList.clear(); _inversionList.clear(); _outputFileName = ""; _logFileName = ""; _showVersion = false; _showHelp = false; _detailedOutput = false; } bool containsHelpTag(int argc, char** argv) { - while(argc) + while(argc != 0) { map::core::String value = argv[0]; if (value == "--help" || value == "-h" || value == "-?") { return true; } ++argv; --argc; } return false; } bool containsVersionTag(int argc, char** argv) { - while(argc) + while(argc != 0) { map::core::String value = argv[0]; if (value == "--version" || value == "-v") { return true; } ++argv; --argc; } return false; } unsigned int ParseArguments(int argc, char** argv, ApplicationData& appData) { appData.Reset(); appData._showHelp = containsHelpTag(argc,argv); appData._showVersion = containsVersionTag(argc,argv); if (appData._showHelp) { std::cout << std::endl << "Usage: " << std::endl << std::endl; std::cout << " combineR [-] [ [+|-] [... [+|-] ]]" << std::endl << std::endl; std::cout << " Output: File path to the output registration file that will" << std::endl; std::cout << " be generated." << std::endl; std::cout << " RegN: File path to the n-th registration file that should" << std::endl; std::cout << " be combined. You may invert the registration by" << std::endl; std::cout << " putting \" - \" in front of the reg file. " << std::endl; std::cout << " Putting \" + \" in front of the reg file, is the" << std::endl; std::cout << " same then using no sign at all: the registration" << std::endl; std::cout << " will be combined as it is" << std::endl << std::endl; std::cout << " Command-Line Options:" << std::endl << std::endl; std::cout << " -h: Display this help" << std::endl; std::cout << " --help: Display this help" << std::endl; std::cout << " -?: Display this help" << std::endl; std::cout << " -v: Show version information" << std::endl; std::cout << " --version: Show version information" << std::endl<< std::endl; std::cout << " Example:" << std::endl << std::endl; std::cout << " combineR ouput.mapr input1.mapr input2.mapr - input3.mapr" << std::endl << std::endl; - std::cout << " This will combine \"input1.mapr\", \"input2.mapr\" and the inverted \"input3.mapr\". The output file name will be \"output.mapr\"." + std::cout << R"( This will combine "input1.mapr", "input2.mapr" and the inverted "input3.mapr". The output file name will be "output.mapr".)" << std::endl; return 1; } if (appData._showVersion) { std::cout << std::endl << "Version: " << MAP_FULL_VERSION_STRING << std::endl; return 1; } --argc; //skip executable argument; ++argv; - if (!argc) + if (argc == 0) { std::cerr << "Wrong command line: insufficient number of arguments." << std::endl; std::cerr << "Use one of the following flags for more information:" << std::endl; std::cerr << "-? or --help" << std::endl; return 2; } appData._outputFileName = argv[0]; --argc; ++argv; bool invertReg = false; - while(argc) + while(argc != 0) { map::core::String value = argv[0]; if (value == "-") { invertReg = true; } else if (value != "+") //per default it is always plus, so ignore "+" { appData._regFileList.push_back(value); appData._inversionList.push_back(invertReg); invertReg = false; } --argc; ++argv; } if (appData._regFileList.empty()) { std::cerr << "Wrong command line option or insufficient number of arguments." << std::endl; std::cerr << "Use one of the following flags for more information:" << std::endl; std::cerr << "-? or --help" << std::endl; return 3; } return 0; }; - } - } -} + } // namespace combineR + } // namespace apps +} // namespace map diff --git a/Applications/Combiner/source/mapCombineRHelper.cpp b/Applications/Combiner/source/mapCombineRHelper.cpp index 97108b9..c9f2a91 100644 --- a/Applications/Combiner/source/mapCombineRHelper.cpp +++ b/Applications/Combiner/source/mapCombineRHelper.cpp @@ -1,148 +1,161 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapCombineRHelper.h" #include "mapExceptionObjectMacros.h" #include "mapRegistrationCombinator.h" #include "mapRegistrationFileWriter.h" template map::core::RegistrationBase::Pointer doInversion(map::core::RegistrationBase* reg) { map::core::RegistrationBase::Pointer result; typedef map::core::Registration CastedInputType; typedef map::core::Registration CastedResultType; typename CastedInputType::Pointer castedReg = dynamic_cast(reg); if (castedReg.IsNotNull()) { typename CastedResultType::Pointer castedResult = CastedResultType::New(); map::core::RegistrationManipulator manipulator(castedResult); manipulator.setDirectMapping(const_cast(&(castedReg->getInverseMapping()))); manipulator.setInverseMapping(const_cast(&(castedReg->getDirectMapping()))); result = castedResult; } return result; } map::core::RegistrationBase::Pointer map::apps::combineR::invertRegistration(map::core::RegistrationBase* reg) { map::core::RegistrationBase::Pointer result; - if (reg) + if (reg != nullptr) { result = doInversion<2,2>(reg); - if (result.IsNull()) result = doInversion<3,3>(reg); - if (result.IsNull()) result = doInversion<2,3>(reg); - if (result.IsNull()) result = doInversion<3,2>(reg); + if (result.IsNull()) { result = doInversion<3,3>(reg); +} + if (result.IsNull()) { result = doInversion<2,3>(reg); +} + if (result.IsNull()) { result = doInversion<3,2>(reg); +} } return result; }; template map::core::RegistrationBase::Pointer doCombination(map::core::RegistrationBase* reg1, map::core::RegistrationBase* reg2) { map::core::RegistrationBase::Pointer result; typedef map::core::Registration CastedReg1Type; typedef map::core::Registration CastedReg2Type; typedef map::core::Registration CastedResultType; typename CastedReg1Type::Pointer castedReg1 = dynamic_cast(reg1); typename CastedReg2Type::Pointer castedReg2 = dynamic_cast(reg2); if (castedReg1.IsNotNull() && castedReg2.IsNotNull()) { typename map::core::RegistrationCombinator::Pointer combinator = map::core::RegistrationCombinator::New(); typename map::core::RegistrationCombinator::CombinedRegistrationPointer castedResult; castedResult = combinator->process(*(castedReg1.GetPointer()),*(castedReg2.GetPointer())); result = castedResult; } return result; } map::core::RegistrationBase::Pointer map::apps::combineR::combineRegistration(map::core::RegistrationBase* reg1, map::core::RegistrationBase* reg2) { map::core::RegistrationBase::Pointer result; if(reg1->getTargetDimensions() != reg2->getMovingDimensions()) { mapDefaultExceptionStaticMacro(<<"Cannot combine registration. Target dimension of reg 1 does not equal moving dimension of reg 2. Target dim reg 1: "<getTargetDimensions()<<"; moving dim reg 2: "<getMovingDimensions()); } result = doCombination<2,2,2>(reg1,reg2); - if (result.IsNull()) result = doCombination<3,3,3>(reg1,reg2); - if (result.IsNull()) result = doCombination<2,3,2>(reg1,reg2); - if (result.IsNull()) result = doCombination<2,2,3>(reg1,reg2); - if (result.IsNull()) result = doCombination<3,2,2>(reg1,reg2); - if (result.IsNull()) result = doCombination<2,3,3>(reg1,reg2); - if (result.IsNull()) result = doCombination<3,3,2>(reg1,reg2); - if (result.IsNull()) result = doCombination<3,2,3>(reg1,reg2); + if (result.IsNull()) { result = doCombination<3,3,3>(reg1,reg2); +} + if (result.IsNull()) { result = doCombination<2,3,2>(reg1,reg2); +} + if (result.IsNull()) { result = doCombination<2,2,3>(reg1,reg2); +} + if (result.IsNull()) { result = doCombination<3,2,2>(reg1,reg2); +} + if (result.IsNull()) { result = doCombination<2,3,3>(reg1,reg2); +} + if (result.IsNull()) { result = doCombination<3,3,2>(reg1,reg2); +} + if (result.IsNull()) { result = doCombination<3,2,3>(reg1,reg2); +} return result; }; template bool doWriting(map::core::RegistrationBase* reg, const map::core::String& fileName) { bool result = false; typedef map::core::Registration CastedInputType; typename CastedInputType::Pointer castedReg = dynamic_cast(reg); if (castedReg.IsNotNull()) { typename map::io::RegistrationFileWriter::Pointer writer = map::io::RegistrationFileWriter::New(); writer->write(castedReg,fileName); result = true; } return result; } bool map::apps::combineR::writeRegistration(map::core::RegistrationBase* reg, const map::core::String& fileName) { - if(!reg) + if(reg == nullptr) { mapDefaultExceptionStaticMacro(<<"Cannot write registration. Passed pointer is invalid"); } bool result = doWriting<2,2>(reg,fileName); - if (!result) result = doWriting<3,3>(reg,fileName); - if (!result) result = doWriting<2,3>(reg,fileName); - if (!result) result = doWriting<3,2>(reg,fileName); + if (!result) { result = doWriting<3,3>(reg,fileName); +} + if (!result) { result = doWriting<2,3>(reg,fileName); +} + if (!result) { result = doWriting<3,2>(reg,fileName); +} return result; }; diff --git a/Applications/Mapper/include/mapRApplicationData.h b/Applications/Mapper/include/mapRApplicationData.h index 2d79d79..d552a6e 100644 --- a/Applications/Mapper/include/mapRApplicationData.h +++ b/Applications/Mapper/include/mapRApplicationData.h @@ -1,119 +1,119 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_RAPPLICATION_DATA_H #define __MAP_RAPPLICATION_DATA_H #include "mapString.h" #include "mapGenericImageReader.h" #include "mapRegistrationFileReader.h" #include "itksys/CommandLineArguments.hxx" namespace map { namespace apps { namespace mapR { struct ImageMappingInterpolator { enum Type { Unkown = 0, //< undefined/unknown NearestNeighbor = 1, //< use nearest neighbor Linear = 2, //< use linear BSpline_3 = 3, //< use a 3rd order spline WSinc_Hamming = 4, //< use a wsinc with hamming window WSinc_Welch = 5 //< use a wsinc with welch window }; }; class ApplicationData { public: /** Loaded Image.*/ ::itk::DataObject::Pointer _input; ::map::core::String _inputFileName; ::map::io::GenericImageReader::GenericOutputImageType::Pointer _spRefImage; ::map::core::String _refFileName; ::map::io::RegistrationFileReader::LoadedRegistrationPointer _spReg; ::map::core::String _regFileName; ::map::core::String _outputFileName; ::map::core::String _logFileName; int _upperSeriesLimit; ::map::io::ImageSeriesReadStyle::Type _seriesReadStyle; ::map::core::String _seriesReadStyleStr; ::map::io::ImageSeriesReadStyle::Type _seriesWriteStyle; ::map::core::String _seriesWriteStyleStr; bool _inputIsImage; ImageMappingInterpolator::Type _interpolatorType; ::map::core::String _interpolatorTypeStr; bool _showVersion; bool _detailedOutput; bool _showHelp; double _paddingValue; bool _noFailOnErrors; int _fileCount; ::map::io::GenericImageReader::LoadedPixelType _loadedPixelType; ::map::io::GenericImageReader::LoadedComponentType _loadedComponentType; unsigned int _loadedDimensions; ::map::io::GenericImageReader::MetaDataDictionaryArrayType _loadedMetaDataDictArray; ::map::io::GenericImageReader::MetaDataDictionaryArrayType _loadedRefMetaDataDictArray; /** Parse the application argument passed when starting the application. * If no error or special request occurred the return is 0. Otherwise the return values * have the following meaning: \n * 1: incorrect use of flag -ex. -ex is last argument, but parameter name is missing.\n * 2: incorrect use of flag -m. -m is last argument, but media id is missing.\n * 3: incorrect use of flag -p. -p is last argument, but parameter name is missing.\n * 4: incorrect use of flag -l, -m and -p. Only one of them can be set.\n * 5: incorrect use of flag -m or -p. ControllerID must be specified.\n * 6: help flag was set.\n * 7: version flag was set.\n * @param argc Number of parameter arguments * @param argv Pointer to the passed arguments * @return Result code of the parsing (see above).**/ unsigned int ParseArguments(int argc, char** argv); void Reset(); ApplicationData(); protected: itksys::CommandLineArguments cmdParser; }; - } - } -} + } // namespace mapR + } // namespace apps +} // namespace map #endif diff --git a/Applications/Mapper/include/mapRHelper.h b/Applications/Mapper/include/mapRHelper.h index 678e3a7..8fdfa91 100644 --- a/Applications/Mapper/include/mapRHelper.h +++ b/Applications/Mapper/include/mapRHelper.h @@ -1,544 +1,544 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_R_HELPER_H #define __MAP_R_HELPER_H #include "itkImageFileWriter.h" #include "itkStdStreamLogOutput.h" #include "itkImageSeriesWriter.h" #include "itkNumericSeriesFileNames.h" #include "itkGDCMImageIO.h" #include "itkVersion.h" #include #include #include #include #include #include "gdcmUIDGenerator.h" #include "mapConvert.h" #include "mapExceptionObjectMacros.h" #include "mapImageMappingTask.h" #include "mapGenericImageReader.h" #include "mapRegistrationFileReader.h" #include "mapPointSetMappingTask.h" #include "mapSimpleLandMarkFileWriter.h" #include "mapContinuousElements.h" #include "mapRApplicationData.h" namespace map { namespace apps { namespace mapR { template class TProcessingPolicy> void handleGenericImage(const ApplicationData& appData) { switch (appData._loadedComponentType) { case ::itk::ImageIOBase::UCHAR: { TProcessingPolicy::processData(appData); break; } case ::itk::ImageIOBase::CHAR: { TProcessingPolicy::processData(appData); break; } case ::itk::ImageIOBase::USHORT: { TProcessingPolicy::processData(appData); break; } case ::itk::ImageIOBase::SHORT: { TProcessingPolicy::processData(appData); break; } case ::itk::ImageIOBase::UINT: { TProcessingPolicy::processData(appData); break; } case ::itk::ImageIOBase::INT: { TProcessingPolicy::processData(appData); break; } case ::itk::ImageIOBase::ULONG: { TProcessingPolicy::processData(appData); break; } case ::itk::ImageIOBase::LONG: { TProcessingPolicy::processData(appData); break; } case ::itk::ImageIOBase::FLOAT: { TProcessingPolicy::processData(appData); break; } case ::itk::ImageIOBase::DOUBLE: { TProcessingPolicy::processData(appData); break; } default: { mapDefaultExceptionStaticMacro(<< "The file uses a pixel component type that is not supported in this application."); } } } /** Helper class that contains the logic that handles the data loading according to the settings in appData. * the loaded data will be stored in app data. */ class LoadingLogic { public: LoadingLogic(ApplicationData& appData); void loadRegistration(); void loadInput(); void loadReferenceImage(); protected: ApplicationData& _appData; }; template class ProcessingLogic { public: typedef ::itk::Image ImageType; - typedef typename ::map::core::continuous::Elements::InternalPointSetType PointSetType; + using PointSetType = typename ::map::core::continuous::Elements::InternalPointSetType; /** Generates meta data dictionaries with the correct meta data (correlated with needed DICOM tags) to ensure * the correct dicom file generation for each slice of the passed image. * @pre pImage must point to a valid instance.*/ static std::vector generateSliceDictionaries(ImageType* pImage, const map::core::String& uidPrefix, const ApplicationData& appData) { if (!pImage) { mapDefaultExceptionStaticMacro(<< "Cannot generate slice dictionaries. Passed image pointer is invalid (NULL)."); } // Copy the dictionary from the image itk::MetaDataDictionary mappedDict; mappedDict = pImage->GetMetaDataDictionary(); if (appData._loadedMetaDataDictArray.size()) { mappedDict = appData._loadedMetaDataDictArray[0]; } std::vector outputArray; //////////////////////////////////////////// //Step 1: set everything that is valid for all slices // To keep the new series in the same study as the original we need // to keep the same study UID. But we need new series and frame of // reference UID's. gdcm::UIDGenerator suid; std::string seriesUID = suid.Generate(); gdcm::UIDGenerator fuid; std::string frameOfReferenceUID = fuid.Generate(); if (appData._loadedRefMetaDataDictArray.size()) { //result has the same frame of reference UID then template image itk::ExposeMetaData(appData._loadedRefMetaDataDictArray[0], "0020|0052", frameOfReferenceUID); } // Set the UID's for the study, series and frame of reference itk::EncapsulateMetaData(mappedDict, "0020|000e", seriesUID); itk::EncapsulateMetaData(mappedDict, "0020|0052", frameOfReferenceUID); map::core::OStringStream stream; // Series Description - Append new description to current series // description std::string oldSeriesDesc; itk::ExposeMetaData(mappedDict, "0008|103e", oldSeriesDesc); stream.str(""); stream << "regd_" << oldSeriesDesc; // This is an long string and there is a 64 character limit in the // standard unsigned lengthDesc = stream.str().length(); std::string seriesDesc(stream.str(), 0, lengthDesc > 64 ? 64 : lengthDesc); itk::EncapsulateMetaData(mappedDict, "0008|103e", seriesDesc); // Derivation Description - How this image was derived stream.str(""); stream << "mapped by using \"" << map::core::FileDispatch::getFullName( appData._regFileName) << "\" registration file; software: mapR; MatchPoint version: " << MAP_SOURCE_VERSION << ", itk version:" << ITK_SOURCE_VERSION; lengthDesc = stream.str().length(); std::string derivationDesc(stream.str(), 0, lengthDesc > 1024 ? 1024 : lengthDesc); itk::EncapsulateMetaData(mappedDict, "0008|2111", derivationDesc); // Slice Thickness: For now, we store the z spacing stream.str(""); stream << pImage->GetSpacing()[2]; itk::EncapsulateMetaData(mappedDict, "0018|0050", stream.str()); // Spacing Between Slices itk::EncapsulateMetaData(mappedDict, "0018|0088", stream.str()); /////////////////////////////////////////////// //Step 2: Generate a dictionary per slice and // adapt slice specific values itk::ImageRegion<3>::SizeValueType sliceCount = pImage->GetLargestPossibleRegion().GetSize(2); for (itk::ImageRegion<3>::SizeValueType currentSliceIndex = 0; currentSliceIndex < sliceCount; ++currentSliceIndex) { // Create a new dictionary for this slice itk::MetaDataDictionary* pDict = new itk::MetaDataDictionary; // Copy the dictionary from the first slice *pDict = mappedDict; // Set the UID's for the SOP gdcm::UIDGenerator sopuid; std::string sopInstanceUID = sopuid.Generate(); itk::EncapsulateMetaData(*pDict, "0008|0018", sopInstanceUID); itk::EncapsulateMetaData(*pDict, "0002|0003", sopInstanceUID); // Change fields that are slice specific map::core::OStringStream value; value.str(""); value << currentSliceIndex + 1; // Image Number itk::EncapsulateMetaData(*pDict, "0020|0013", value.str()); // Image Position Patient: This is calculated by computing the // physical coordinate of the first pixel in each slice. typename ImageType::PointType position; typename ImageType::IndexType index; index[0] = 0; index[1] = 0; index[2] = currentSliceIndex; pImage->TransformIndexToPhysicalPoint(index, position); value.str(""); value << position[0] << "\\" << position[1] << "\\" << position[2]; itk::EncapsulateMetaData(*pDict, "0020|0032", value.str()); // Slice Location: For now, we store the z component of the Image // Position Patient. value.str(""); value << position[2]; itk::EncapsulateMetaData(*pDict, "0020|1041", value.str()); // Save the dictionary outputArray.push_back(pDict); } return outputArray; } /**write the image data according to the settings in appData. * @pre pImage must point to a valid instance. * @TODO should this method be reworked * right now the tags of dicom image will only be transfered if they are 3D and the series read style is set to DICOM or GDCM. * Thus 2D DICOM images are missed as well as 3D DICOM images that are stored as one image file (default series style).*/ static void doWriting(ImageType* pImage, const ApplicationData& appData) { if (!pImage) { mapDefaultExceptionStaticMacro(<< "Cannot write data. Passed image pointer is invalid (NULL)."); } std::cout << std::endl << "save output file ... "; if (appData._loadedDimensions > 2 && (appData._seriesWriteStyle == map::io::ImageSeriesReadStyle::Dicom || appData._seriesWriteStyle == map::io::ImageSeriesReadStyle::Numeric || appData._seriesWriteStyle == map::io::ImageSeriesReadStyle::GDCM)) { typedef ::itk::Image < TPixelType, IDim - 1 > OutputImageType; - typedef ::itk::NumericSeriesFileNames OutputNamesGeneratorType; + using OutputNamesGeneratorType = ::itk::NumericSeriesFileNames; typedef ::itk::ImageSeriesWriter< ImageType, OutputImageType > SeriesWriterType; - typedef ::itk::GDCMImageIO ImageIOType; + using ImageIOType = ::itk::GDCMImageIO; ImageIOType::Pointer spGDCMIO = ImageIOType::New(); OutputNamesGeneratorType::Pointer outputNames = OutputNamesGeneratorType::New(); outputNames->SetStartIndex(1); outputNames->SetEndIndex(pImage->GetLargestPossibleRegion().GetSize(pImage->GetImageDimension() - 1)); // Generate the file names map::core::String tempLen = map::core::convert::toStr(static_cast(outputNames->GetEndIndex())); map::core::String seriesFormat = map::core::FileDispatch::createFullPath( map::core::FileDispatch::getPath(appData._outputFileName), map::core::FileDispatch::getName(appData._outputFileName) + ".%0" + map::core::convert::toStrGeneric(tempLen.length()) + "d" + map::core::FileDispatch::getExtension( appData._outputFileName)); std::cout << "(" << seriesFormat << ")... "; outputNames->SetSeriesFormat(seriesFormat.c_str()); // do the output typename SeriesWriterType::Pointer spSeriesWriter = SeriesWriterType::New(); spSeriesWriter->SetInput(pImage); spSeriesWriter->SetFileNames(outputNames->GetFileNames()); std::vector outputArray = generateSliceDictionaries(pImage, spGDCMIO->GetUIDPrefix(), appData); if ((appData._seriesWriteStyle == map::io::ImageSeriesReadStyle::Dicom) || (appData._seriesWriteStyle == map::io::ImageSeriesReadStyle::GDCM)) { spGDCMIO->KeepOriginalUIDOn(); spSeriesWriter->SetImageIO(spGDCMIO); spSeriesWriter->SetMetaDataDictionaryArray(&outputArray); } spSeriesWriter->Update(); for (std::vector::iterator pos = outputArray.begin(); pos != outputArray.end(); ++pos) { delete *pos; } } else { std::cout << "(" << appData._outputFileName << ")... "; - typedef ::itk::ImageFileWriter< ImageType > ImageWriterType; + using ImageWriterType = ::itk::ImageFileWriter; typename ImageWriterType::Pointer spImageWriter = ImageWriterType::New(); spImageWriter->SetInput(pImage); spImageWriter->SetFileName(appData._outputFileName.c_str()); spImageWriter->SetUseCompression(true); spImageWriter->Update(); } std::cout << "done." << std::endl; }; static typename ::itk::InterpolateImageFunction< ImageType >::Pointer generateInterpolator( ImageMappingInterpolator::Type interpolatorType) { - typedef ::itk::InterpolateImageFunction< ImageType > BaseInterpolatorType; + using BaseInterpolatorType = ::itk::InterpolateImageFunction< ImageType >; typename BaseInterpolatorType::Pointer result; switch (interpolatorType) { case ImageMappingInterpolator::NearestNeighbor: { result = ::itk::NearestNeighborInterpolateImageFunction::New(); break; } case ImageMappingInterpolator::BSpline_3: { typename ::itk::BSplineInterpolateImageFunction::Pointer spInterpolator = ::itk::BSplineInterpolateImageFunction::New(); spInterpolator->SetSplineOrder(3); result = spInterpolator; break; } case ImageMappingInterpolator::WSinc_Hamming: { result = ::itk::WindowedSincInterpolateImageFunction::New(); break; } case ImageMappingInterpolator::WSinc_Welch: { result = ::itk::WindowedSincInterpolateImageFunction >::New(); break; } default: { result = ::itk::LinearInterpolateImageFunction::New(); break; } } return result; }; static typename ImageType::Pointer doMapping(const ApplicationData& appData) { - typedef ::itk::ImageBase TemplateImageType; + using TemplateImageType = ::itk::ImageBase; typedef map::core::Registration RegistrationType; typedef map::core::ImageMappingTask MapperType; typename MapperType::Pointer spMapper = MapperType::New(); - ImageType* pCastedInput = dynamic_cast(appData._input.GetPointer()); + auto* pCastedInput = dynamic_cast(appData._input.GetPointer()); typename ImageType::Pointer spResult; - RegistrationType* pCastedReg = dynamic_cast(appData._spReg.GetPointer()); + auto* pCastedReg = dynamic_cast(appData._spReg.GetPointer()); - typename MapperType::ResultImageDescriptorType::Pointer spResultDesc = NULL; + typename MapperType::ResultImageDescriptorType::Pointer spResultDesc = nullptr; if (appData._spRefImage.IsNotNull()) { - TemplateImageType* pCastedTemplate = dynamic_cast + auto* pCastedTemplate = dynamic_cast (appData._spRefImage.GetPointer()); spResultDesc = map::core::createFieldRepresentation(*pCastedTemplate); } try { std::cout << std::endl << "map input file... "; spMapper->setInputImage(pCastedInput); spMapper->setRegistration(pCastedReg); spMapper->setResultImageDescriptor(spResultDesc); spMapper->setPaddingValue(appData._paddingValue); spMapper->setImageInterpolator(generateInterpolator(appData._interpolatorType)); if (appData._noFailOnErrors) { spMapper->setThrowOnMappingError(false); spMapper->setErrorValue(appData._paddingValue); } spMapper->execute(); spResult = spMapper->getResultImage(); std::cout << "done." << std::endl; } catch (::itk::ExceptionObject& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e << std::endl; } catch (std::exception& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e.what() << std::endl; } catch (...) { std::cerr << "Error!!! Unkown error while mapping image." << std::endl; } return spResult; }; static typename PointSetType::Pointer doPointSetMapping(const ApplicationData& appData) { - typedef ::itk::ImageBase TemplateImageType; + using TemplateImageType = ::itk::ImageBase; typedef map::core::Registration RegistrationType; typedef map::core::PointSetMappingTask MapperType; typename MapperType::Pointer spMapper = MapperType::New(); - PointSetType* pCastedInput = dynamic_cast(appData._input.GetPointer()); + auto* pCastedInput = dynamic_cast(appData._input.GetPointer()); typename PointSetType::Pointer spResult; RegistrationType* pCastedReg = dynamic_cast(appData._spReg.GetPointer()); try { std::cout << std::endl << "map input file... "; spMapper->setInputPointSet(pCastedInput); spMapper->setRegistration(pCastedReg); if (appData._noFailOnErrors) { spMapper->setThrowOnMappingError(false); spMapper->setErrorPointValue(appData._paddingValue); } spMapper->execute(); spResult = spMapper->getResultPointSet(); std::cout << "done." << std::endl; } catch (::itk::ExceptionObject& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e << std::endl; } catch (std::exception& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e.what() << std::endl; } catch (...) { std::cerr << "Error!!! Unkown error while mapping image." << std::endl; } return spResult; }; static void processData(const ApplicationData& appData) { if (appData._inputIsImage) { typename ImageType::Pointer mappedImage = doMapping(appData); doWriting(mappedImage, appData); } else { typename PointSetType::Pointer mappedPoints = doPointSetMapping(appData); std::cout << std::endl << "save output file ... "; ::map::utilities::saveLandMarksToFile(appData._outputFileName, mappedPoints); std::cout << std::endl << "done"; } } }; - } - } -} + } // namespace mapR + } // namespace apps +} // namespace map #endif diff --git a/Applications/Mapper/source/mapR.cpp b/Applications/Mapper/source/mapR.cpp index dee4966..b11866e 100644 --- a/Applications/Mapper/source/mapR.cpp +++ b/Applications/Mapper/source/mapR.cpp @@ -1,233 +1,233 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapRApplicationData.h" #include "mapRHelper.h" #ifdef MAP_DISABLE_ITK_IO_FACTORY_AUTO_REGISTER /* The mapR needs the IO factories to be registered in cases where MatchPoint is built without auto registration (e.g. for use in MITK) mapR has to add the registration helper manually.*/ #include "itkImageIOFactoryRegisterManager.h" #endif //MAP_DISABLE_ITK_IO_FACTORY_AUTO_REGISTER map::apps::mapR::ApplicationData appData; -void onMAPEvent(::itk::Object*, const itk::EventObject& event, void*) +void onMAPEvent(::itk::Object* /*unused*/, const itk::EventObject& event, void* /*unused*/) { std::cout << " > > > "; event.Print(std::cout); std::cout << std::endl; } /** Main entry point for the application. * @retval 0 normal exit. * @retval 1 showed help or version info. * @retval 2 Invalid usage. Missing parameters. * @retval 3 Invalid usage. Wrong option usage. * @retval 4 Error while loading input image. * @retval 5 Error while loading registration. * @retval 6 Error while loading reference image. * @retval 9 Error while mapping or writing result image. */ int main(int argc, char** argv) { int result = 0; std::cout << "mapR - Generic image mapping tool for MatchPoint." << std::endl; switch (appData.ParseArguments(argc, argv)) { case 1: { //showed version or help info. Done. return 1; } case 2: { std::cerr << "Missing Parameters. Use one of the following flags for more information:" << std::endl; std::cerr << "-? or --help" << std::endl; return 2; } case 3: { //wrong option usage. return 3; } } if (appData._fileCount < 1) { std::cerr << "Missing Parameters. Use one of the following flags for more information:" << std::endl; std::cerr << "-? or --help" << std::endl; return 2; } map::core::Logbook::setDefaultLogFileName(appData._logFileName); ::itk::StdStreamLogOutput::Pointer spStreamLogOutput = ::itk::StdStreamLogOutput::New(); spStreamLogOutput->SetStream(std::cout); map::core::Logbook::addAdditionalLogOutput(spStreamLogOutput); if (appData._detailedOutput) { map::core::Logbook::setLogbookToDebugMode(); } std::cout << std::endl << "*******************************************" << std::endl; std::cout << "Input file: " << appData._inputFileName << std::endl; std::cout << "Registration file: "; if (appData._regFileName.empty()) { std::cout << "unspecified -> Identity transform will be used" << std::endl; } else { std::cout << appData._regFileName << std::endl; } std::cout << "Series read style: " << appData._seriesReadStyleStr << std::endl; std::cout << "Series write style: " << appData._seriesWriteStyleStr << std::endl; std::cout << "Interpolation style: "; if (appData._interpolatorType == map::apps::mapR::ImageMappingInterpolator::Unkown) { std::cout << "unknown interpolator defined by user. Abort mapping. User defined interpolator string: " << appData._interpolatorTypeStr << std::endl; return 3; } - else - { + + std::cout << appData._interpolatorType << "(" << appData._interpolatorTypeStr << ")" << std::endl; - } + if (!(appData._refFileName.empty())) { std::cout << "Template file: " << appData._refFileName << std::endl; } map::apps::mapR::LoadingLogic loadingLogic(appData); try { loadingLogic.loadInput(); } catch (::itk::ExceptionObject& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e << std::endl; return 4; } catch (std::exception& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e.what() << std::endl; return 4; } catch (...) { std::cerr << "Error!!! unknown error while reading input image." << std::endl; return 4; } try { loadingLogic.loadRegistration(); } catch (::itk::ExceptionObject& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e << std::endl; return 5; } catch (std::exception& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e.what() << std::endl; return 5; } catch (...) { std::cerr << "Error!!! unknown error while reading registration file." << std::endl; return 5; } try { loadingLogic.loadReferenceImage(); } catch (::itk::ExceptionObject& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e << std::endl; return 6; } catch (std::exception& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e.what() << std::endl; return 6; } catch (...) { std::cerr << "Error!!! unknown error while reading template image." << std::endl; return 6; } try { if (appData._loadedDimensions == 2) { map::apps::mapR::handleGenericImage<2, map::apps::mapR::ProcessingLogic>(appData); } else if (appData._loadedDimensions == 3) { map::apps::mapR::handleGenericImage<3, map::apps::mapR::ProcessingLogic>(appData); } } catch (::itk::ExceptionObject& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e << std::endl; return 9; } catch (std::exception& e) { std::cerr << "Error!!!" << std::endl; std::cerr << e.what() << std::endl; return 9; } catch (...) { std::cerr << "Error!!! unknown error while mapping and writing image." << std::endl; return 9; } std::cout << std::endl; return result; } diff --git a/Applications/Mapper/source/mapRApplicationData.cpp b/Applications/Mapper/source/mapRApplicationData.cpp index ef42425..16f8eb0 100644 --- a/Applications/Mapper/source/mapRApplicationData.cpp +++ b/Applications/Mapper/source/mapRApplicationData.cpp @@ -1,300 +1,300 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapRApplicationData.h" #include "mapConfigure.h" #include "itksys/SystemTools.hxx" namespace map { namespace apps { namespace mapR { int unknown_argument(const char* argument, void* call_data) { std::cout << "Got unknown argument: \"" << argument << "\"" << std::endl; return 0; } ApplicationData:: ApplicationData() { this->Reset(); } void ApplicationData:: Reset() { _inputFileName = ""; _outputFileName = ""; _regFileName = ""; _refFileName = ""; _logFileName = ""; _showVersion = false; _showHelp = false; _detailedOutput = false; _paddingValue = 0.0; _noFailOnErrors = false; _upperSeriesLimit = 0; _loadedPixelType = ::itk::ImageIOBase::SCALAR; _loadedComponentType = ::itk::ImageIOBase::UCHAR; _loadedDimensions = 1; _inputIsImage = true; _seriesReadStyle = io::ImageSeriesReadStyle::Default; _seriesWriteStyle = io::ImageSeriesReadStyle::Default; _seriesReadStyleStr = "default"; _seriesWriteStyleStr = ""; _interpolatorType = ImageMappingInterpolator::Linear; _interpolatorTypeStr = "linear"; _fileCount = 0; } unsigned int ApplicationData:: ParseArguments(int argc, char** argv) { this->Reset(); if (argc > 1) { ::map::core::String dummyArg = argv[1]; if (dummyArg.substr(0, 1) != "-") { //argument is the input file. Store the argument and move to next position. _inputFileName = dummyArg; ++_fileCount; --argc; ++argv; } } if (argc > 1) { ::map::core::String dummyArg = argv[1]; if (dummyArg.substr(0, 1) != "-") { //argument is the reg file. Store the argument and move to next position before parsing starts. _regFileName = dummyArg; ++_fileCount; --argc; ++argv; } } cmdParser.Initialize(argc, argv); cmdParser.SetUnknownArgumentCallback(unknown_argument); cmdParser.AddArgument("--output", itksys::CommandLineArguments::SPACE_ARGUMENT, &_outputFileName, "Specifies name and location of the output file. Default is the location of the input file and a name constructed from the name of the input file and the registration file."); cmdParser.AddArgument("-o", itksys::CommandLineArguments::SPACE_ARGUMENT, &_outputFileName, "Specifies name and location of the output file. Default is the location of the input file and a name constructed from the name of the input file and the registration file."); cmdParser.AddArgument("--FOVtemplate", itksys::CommandLineArguments::SPACE_ARGUMENT, &_refFileName, "Specifies name and location of the file that serves as template for the target field of view. Thus this file defines spacing, size, origin and orientation of the output image. Default is that the input image is used as template."); cmdParser.AddArgument("-t", itksys::CommandLineArguments::SPACE_ARGUMENT, &_refFileName, "Specifies name and location of the file that serves as template for the target field of view. Thus this file defines spacing, size, origin and orientation of the output image. Default is that the input image is used as template."); cmdParser.AddArgument("--padding", itksys::CommandLineArguments::SPACE_ARGUMENT, &_paddingValue, "Specifies the value that should be used for pixels of the result image that are not covered by the mapped input image. Default value is '0.0'."); cmdParser.AddArgument("-p", itksys::CommandLineArguments::SPACE_ARGUMENT, &_paddingValue, "Specifies the value that should be used for pixels of the result image that are not covered by the mapped input image. Default value is '0.0'."); cmdParser.AddArgument("-v", itksys::CommandLineArguments::NO_ARGUMENT, &_showVersion, "Shows the version of the program."); cmdParser.AddArgument("-d", itksys::CommandLineArguments::NO_ARGUMENT, &_detailedOutput, "Program has a more detailed (debug) output."); cmdParser.AddArgument("--details", itksys::CommandLineArguments::NO_ARGUMENT, &_detailedOutput, "Program has a more detailed (debug) output."); cmdParser.AddArgument("-h", itksys::CommandLineArguments::NO_ARGUMENT, &_showHelp, "Shows this help information for the program."); cmdParser.AddArgument("--help", itksys::CommandLineArguments::NO_ARGUMENT, &_showHelp, "Shows this help information for the program."); cmdParser.AddArgument("-?", itksys::CommandLineArguments::NO_ARGUMENT, &_showHelp, "Shows this help information for the program."); cmdParser.AddArgument("-u", itksys::CommandLineArguments::SPACE_ARGUMENT, &_upperSeriesLimit, "Only relevant in combination with numeric read style. Defines the upper index of the numeric image stack."); cmdParser.AddArgument("--upperSeriesLimit", itksys::CommandLineArguments::SPACE_ARGUMENT, &_upperSeriesLimit, "Only relevant in combination with numeric read style. Defines the upper index of the numeric image stack."); cmdParser.AddArgument("-r", itksys::CommandLineArguments::SPACE_ARGUMENT, &_seriesReadStyleStr, "Defines the read style for input and template image. Valid values are: 'default': like dicom but does not force series output; 'dicom': in current version it is equal to use 'gdcm'; 'gdcm': uses the dicom series file names reader and GDCM to load the images; 'none': only the specified file will be read; 'numeric': uses the numeric series file names reader and forces an output as series of 2D images."); cmdParser.AddArgument("--seriesReader", itksys::CommandLineArguments::SPACE_ARGUMENT, &_seriesReadStyleStr, "Defines the read style for input and template image. Valid values are: 'default': like dicom but does not force series output; 'dicom': in current version it is equal to use 'gdcm'; 'gdcm': uses the dicom series file names reader and GDCM to load the images; 'none': only the specified file will be read; 'numeric': uses the numeric series file names reader and forces an output as series of 2D images."); cmdParser.AddArgument("-w", itksys::CommandLineArguments::SPACE_ARGUMENT, &_seriesWriteStyleStr, "Defines the write style for the result image by overwriting the settings implied by the read style. Valid values are: 'default': output depends on the specified file format; 'dicom': uses the dicom series file names reader and forces an output as series of 2D images; 'gdcm': forces an output as series of 2D images; 'none': see default; 'numeric': forces an output as series of 2D images."); cmdParser.AddArgument("--seriesWriter", itksys::CommandLineArguments::SPACE_ARGUMENT, &_seriesWriteStyleStr, "Defines the write style for the result image by overwriting the settings implied by the read style. Valid values are: 'default': output depends on the specified file format; 'dicom': uses the dicom series file names reader and forces an output as series of 2D images; 'gdcm': further forces an output as series of 2D images; 'none': see default; 'numeric': forces an output as series of 2D images."); cmdParser.AddArgument("-i", itksys::CommandLineArguments::SPACE_ARGUMENT, &_interpolatorTypeStr, "Defines the interpolator that should be used for mapping the image. Default value is 'linear'. Valid values are: 'nn': uses a nearest neighbor interpolator; 'linear': uses a simple linear interpolator; 'bspline_3': uses a 3rd order B spline interpolator; 'hamming': uses a wsinc with hamming window as interpolator; 'welch': uses a wsinc with welch window as interpolator."); cmdParser.AddArgument("--interpolator", itksys::CommandLineArguments::SPACE_ARGUMENT, &_interpolatorTypeStr, "Defines the interpolator that should be used for mapping the image. Default value is 'linear'. Valid values are: 'nn': uses a nearest neighbor interpolator; 'linear': uses a simple linear interpolator; 'bspline_3': uses a 3rd order B spline interpolator; 'hamming': uses a wsinc with hamming window as interpolator; 'welch': uses a wsinc with welch window as interpolator."); cmdParser.AddArgument("--handleMappingFailure", itksys::CommandLineArguments::NO_ARGUMENT, &_noFailOnErrors, "If this flag is activated the mapping process will not faile if the registration is not sufficiently defined. Instead it will use the padding value (-p) to mark any voxel that could not be map due to the insufficent registration with the padding value."); cmdParser.AddArgument("--log", itksys::CommandLineArguments::SPACE_ARGUMENT, &_logFileName, "Specifies name and location of the log file. Default (flag not set) is that no log file is written."); cmdParser.AddArgument("-l", itksys::CommandLineArguments::SPACE_ARGUMENT, &_logFileName, "Specifies name and location of the log file. Default (flag not set) is that no log file is written."); - if (!cmdParser.Parse()) + if (cmdParser.Parse() == 0) { std::cerr << "Wrong command line option or insufficient number of arguments." << std::endl; std::cerr << "The last correct argument was: " << argv[cmdParser.GetLastArgument()] << std::endl << "Use one of the following flags for more information:" << std::endl; std::cerr << "-? or --help" << std::endl; return 3; }; if (_showHelp) { std::cout << std::endl << "Usage: " << std::endl << std::endl; std::cout << " mapR [] [options]" << std::endl << std::endl; std::cout << " Input: File path to the image that should be mapped." << std::endl; std::cout << " Reg: File path to the registration file that specifies" << std::endl; std::cout << " the registration that should be used for mapping." << std::endl; std::cout << " Optional: If no reg file is specified, an identity" << std::endl; std::cout << " transform will be used for mapping." << std::endl << std::endl; std::cout << "Command-Line Options:" << std::endl << std::endl; std::cout << cmdParser.GetHelp() << std::endl << std::endl; std::cout << " Example:" << std::endl << std::endl; std::cout << " mapR input.dcm reg.mapr -t target.dcm" << std::endl << std::endl; std::cout << - " This will map \"input.png\" by using \"reg.mapr\". The field of view of the output image is defined by \"target.dcm\". The output will be in the directory of the input. The output file name will be \"input_reg.dcm\"." + R"( This will map "input.png" by using "reg.mapr". The field of view of the output image is defined by "target.dcm". The output will be in the directory of the input. The output file name will be "input_reg.dcm".)" << std::endl; return 1; } if (_showVersion) { std::cout << std::endl << "Version: " << MAP_FULL_VERSION_STRING << std::endl; return 1; } if (_fileCount < 1) { return 2; } if (_outputFileName.empty()) { ::map::core::String path = core::FileDispatch::getPath(_inputFileName); ::map::core::String inputName = core::FileDispatch::getName(_inputFileName); ::map::core::String inputExt = core::FileDispatch::getExtension(_inputFileName); ::map::core::String regName = core::FileDispatch::getName(_regFileName); _outputFileName = core::FileDispatch::createFullPath(path, inputName + "_" + regName + inputExt); } if (_seriesReadStyleStr == "none") { _seriesReadStyle = io::ImageSeriesReadStyle::None; } else if (_seriesReadStyleStr == "dicom") { _seriesReadStyle = io::ImageSeriesReadStyle::Dicom; } else if (_seriesReadStyleStr == "numeric") { _seriesReadStyle = io::ImageSeriesReadStyle::Numeric; } else if (_seriesReadStyleStr == "gdcm") { _seriesReadStyle = io::ImageSeriesReadStyle::GDCM; } if (!_seriesWriteStyleStr.empty()) { if (_seriesWriteStyleStr == "none") { _seriesWriteStyle = io::ImageSeriesReadStyle::None; } else if (_seriesWriteStyleStr == "dicom") { _seriesWriteStyle = io::ImageSeriesReadStyle::Dicom; } else if (_seriesWriteStyleStr == "numeric") { _seriesWriteStyle = io::ImageSeriesReadStyle::Numeric; } else if (_seriesWriteStyleStr == "gdcm") { _seriesWriteStyle = io::ImageSeriesReadStyle::GDCM; } } else { _seriesWriteStyle = _seriesReadStyle; _seriesWriteStyleStr = _seriesReadStyleStr; } if (_interpolatorTypeStr == "nn") { _interpolatorType = ImageMappingInterpolator::NearestNeighbor; } else if (_interpolatorTypeStr == "linear") { _interpolatorType = ImageMappingInterpolator::Linear; } else if (_interpolatorTypeStr == "bspline_3") { _interpolatorType = ImageMappingInterpolator::BSpline_3; } else if (_interpolatorTypeStr == "hamming") { _interpolatorType = ImageMappingInterpolator::WSinc_Hamming; } else if (_interpolatorTypeStr == "welch") { _interpolatorType = ImageMappingInterpolator::WSinc_Welch; } else { _interpolatorType = ImageMappingInterpolator::Unkown; } return 0; }; - } - } -} + } // namespace mapR + } // namespace apps +} // namespace map diff --git a/Applications/Mapper/source/mapRHelper.cpp b/Applications/Mapper/source/mapRHelper.cpp index 2fa0988..dc35219 100644 --- a/Applications/Mapper/source/mapRHelper.cpp +++ b/Applications/Mapper/source/mapRHelper.cpp @@ -1,259 +1,259 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapRHelper.h" #include "mapGenericImageReader.h" #include "mapDummyRegistrationAlgorithm.h" #include "mapSimpleLandMarkFileReader.h" map::apps::mapR::LoadingLogic::LoadingLogic(ApplicationData& appData): _appData(appData) { }; template map::core::RegistrationBase::Pointer GenerateDummyReg() { - typedef map::algorithm::DummyRegistrationAlgorithm DummyRegType; + using DummyRegType = map::algorithm::DummyRegistrationAlgorithm; typename DummyRegType::Pointer regAlg = DummyRegType::New(); map::core::RegistrationBase::Pointer dummyReg = regAlg->getRegistration().GetPointer(); return dummyReg; } void map::apps::mapR::LoadingLogic:: loadRegistration() { map::io::RegistrationFileReader::LoadedRegistrationPointer spReg; if (_appData._regFileName.empty()) { std::cout << std::endl << "generate identity transform... "; if (_appData._loadedDimensions == 2) { spReg = GenerateDummyReg<2>(); } else if (_appData._loadedDimensions == 3) { spReg = GenerateDummyReg<3>(); } else { mapDefaultExceptionStaticMacro( << "Cannot generate identity transform. Dimensionality of loaded input image is not supported. LoadedDimensions: " << _appData._loadedDimensions); } std::cout << "done." << std::endl; } else { map::io::RegistrationFileReader::Pointer spRegReader = map::io::RegistrationFileReader::New(); std::cout << std::endl << "read registration file... "; spReg = spRegReader->read(_appData._regFileName); std::cout << "done." << std::endl; if (_appData._detailedOutput) { std::cout << std::endl << "Registration info:" << std::endl; _appData._spReg->Print(std::cout); std::cout << std::endl; } if (spReg->getMovingDimensions() != spReg->getTargetDimensions() || spReg->getMovingDimensions() != _appData._loadedDimensions) { mapDefaultExceptionStaticMacro( << "Loaded registration and loaded image have no equal dimensionality. Registration cannot be used to map the image."); } } _appData._spReg = spReg; }; ::itk::DataObject::Pointer loadGenericPointSet(const ::map::core::String& filename, unsigned int& loadedDimensions) { ::itk::DataObject::Pointer result; if (!(filename.empty())) { try { - typedef ::map::core::continuous::Elements<2>::InternalPointSetType PointSetType; + using PointSetType = ::map::core::continuous::Elements<2>::InternalPointSetType; result = ::map::utilities::loadLandMarksFromFile(filename).GetPointer(); loadedDimensions = 2; } catch (...) { } try { - typedef ::map::core::continuous::Elements<3>::InternalPointSetType PointSetType; + using PointSetType = ::map::core::continuous::Elements<3>::InternalPointSetType; result = ::map::utilities::loadLandMarksFromFile(filename).GetPointer(); loadedDimensions = 3; } catch (...) { } } return result; }; void map::apps::mapR::LoadingLogic:: loadInput() { map::io::GenericImageReader::GenericOutputImageType::Pointer loadedImage; unsigned int loadedDimensions = 0; map::io::GenericImageReader::LoadedPixelType loadedPixelType = ::itk::ImageIOBase::UNKNOWNPIXELTYPE; map::io::GenericImageReader::LoadedComponentType loadedComponentType = ::itk::ImageIOBase::UNKNOWNCOMPONENTTYPE; map::io::GenericImageReader::MetaDataDictionaryArrayType loadedMetaDataDictArray; map::io::GenericImageReader::Pointer spReader = map::io::GenericImageReader::New(); spReader->setSeriesReadStyle(_appData._seriesReadStyle); spReader->setFileName(_appData._inputFileName); spReader->setUpperSeriesLimit(_appData._upperSeriesLimit); std::cout << std::endl << "read input file... "; ::map::core::String loadErrorString; try { loadedImage = spReader->GetOutput(loadedDimensions, loadedPixelType, loadedComponentType); loadedMetaDataDictArray = spReader->getMetaDictionaryArray(); } catch (const std::exception& e) { loadErrorString = e.what(); } if (loadedImage.IsNotNull()) { std::cout << "done." << std::endl; if (_appData._detailedOutput) { std::cout << "Input image info:" << std::endl; loadedImage->Print(std::cout); std::cout << std::endl; } if (loadedPixelType != ::itk::ImageIOBase::SCALAR) { mapDefaultExceptionStaticMacro(<< "Unsupported input image. Only simple scalar images are supported in this version."); } if (loadedDimensions < 2 || loadedDimensions > 3) { mapDefaultExceptionStaticMacro(<< "Unsupported input image. Only 2D and 3D images are supported in this version."); } _appData._input = loadedImage; _appData._inputIsImage = true; _appData._loadedDimensions = loadedDimensions; _appData._loadedPixelType = loadedPixelType; _appData._loadedComponentType = loadedComponentType; _appData._loadedMetaDataDictArray = loadedMetaDataDictArray; } else //*try to load simple point set { _appData._input = loadGenericPointSet(_appData._inputFileName, loadedDimensions); if (_appData._input.IsNotNull()) { std::cout << "Input point set info:" << std::endl; _appData._input->Print(std::cout); } _appData._loadedDimensions = loadedDimensions; _appData._inputIsImage = false; } if (_appData._input.IsNull()) { mapDefaultExceptionStaticMacro(<< " Unable to load input. File is not existing or has an unsupported format." << std::endl << "Error details: " << loadErrorString); } }; void map::apps::mapR::LoadingLogic:: loadReferenceImage() { if (!(_appData._refFileName.empty())) { map::io::GenericImageReader::GenericOutputImageType::Pointer loadedImage; unsigned int loadedDimensions; map::io::GenericImageReader::LoadedPixelType loadedPixelType; map::io::GenericImageReader::LoadedComponentType loadedComponentType; map::io::GenericImageReader::MetaDataDictionaryArrayType loadedMetaDataDictArray; map::io::GenericImageReader::Pointer spReader = map::io::GenericImageReader::New(); spReader->setSeriesReadStyle(_appData._seriesReadStyle); spReader->setFileName(_appData._refFileName); spReader->setUpperSeriesLimit(_appData._upperSeriesLimit); std::cout << std::endl << "read template file... "; loadedImage = spReader->GetOutput(loadedDimensions, loadedPixelType, loadedComponentType); loadedMetaDataDictArray = spReader->getMetaDictionaryArray(); if (loadedImage.IsNotNull()) { std::cout << "done." << std::endl; if (_appData._detailedOutput) { std::cout << "Input image info:" << std::endl; loadedImage->Print(std::cout); std::cout << std::endl; } } else { mapDefaultExceptionStaticMacro( << " Unable to load template image. File is not existing or has an unsupported format."); } if (loadedDimensions != _appData._spReg->getTargetDimensions()) { mapDefaultExceptionStaticMacro( << " Unsupported template image. Template image dimensions does not match registration."); } _appData._spRefImage = loadedImage; _appData._loadedRefMetaDataDictArray = loadedMetaDataDictArray; } }; diff --git a/Applications/Matcher/include/matchRApplicationData.h b/Applications/Matcher/include/matchRApplicationData.h index 51d47d7..17db3d7 100644 --- a/Applications/Matcher/include/matchRApplicationData.h +++ b/Applications/Matcher/include/matchRApplicationData.h @@ -1,108 +1,108 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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: 1371 $ (last changed revision) // @date $Date: 2016-05-23 17:56:37 +0200 (Mo, 23 Mai 2016) $ (last change date) // @author $Author: floca $ (last changed by) // Subversion HeadURL: $HeadURL: https://svn.inet.dkfz-heidelberg.de/sbr/Sources/SBR-Projects/MatchPoint/trunk/Applications/Mapper/include/matchRApplicationData.h $ */ #ifndef __MAP_RAPPLICATION_DATA_H #define __MAP_RAPPLICATION_DATA_H #include "mapString.h" #include "mapGenericImageReader.h" #include "mapRegistrationFileReader.h" #include "mapRegistrationAlgorithmBase.h" #include "itksys/CommandLineArguments.hxx" namespace map { namespace apps { namespace matchR { class ApplicationData { public: ::map::algorithm::RegistrationAlgorithmBase::Pointer _algorithm; ::map::core::String _algorithmFileName; /** Loaded Images.*/ ::map::io::GenericImageReader::GenericOutputImageType::Pointer _spMovingImage; ::map::core::String _movingFileName; ::map::io::GenericImageReader::GenericOutputImageType::Pointer _spTargetImage; ::map::core::String _targetFileName; ::itk::DataObject::Pointer _genericMovingMask; ::map::core::String _movingMaskFileName; ::itk::DataObject::Pointer _genericTargetMask; ::map::core::String _targetMaskFileName; ::itk::DataObject::Pointer _genericTargetPointSet; ::map::core::String _targetPointSetFileName; ::itk::DataObject::Pointer _genericMovingPointSet; ::map::core::String _movingPointSetFileName; ::map::core::String _outputFileName; ::map::core::String _logFileName; int _upperSeriesLimit; ::map::io::ImageSeriesReadStyle::Type _seriesReadStyle; ::map::core::String _seriesReadStyleStr; std::vector<::map::core::String> _parameterStrs; typedef std::map<::map::core::String, ::map::core::String> ParameterMapType; ParameterMapType _parameterMap; bool _showVersion; bool _detailedOutput; bool _showHelp; int _fileCount; unsigned int _loadedDimensions; /** Parse the application argument passed when starting the application. * If no error or special request occurred the return is 0. Otherwise the return values * have the following meaning: \n * 1: help or "show version" was requested.\n * 2: Error. Not all mandatory arguments where given.\n * 3: Incorrect use of flag(s).\n * @param argc Number of parameter arguments * @param argv Pointer to the passed arguments * @return Result code of the parsing (see above).**/ unsigned int ParseArguments(int argc, char** argv); void Reset(); ApplicationData(); protected: itksys::CommandLineArguments cmdParser; }; - } - } -} + } // namespace matchR + } // namespace apps +} // namespace map #endif diff --git a/Applications/Matcher/include/matchRHelper.h b/Applications/Matcher/include/matchRHelper.h index 7dfb9e5..34384a3 100644 --- a/Applications/Matcher/include/matchRHelper.h +++ b/Applications/Matcher/include/matchRHelper.h @@ -1,370 +1,370 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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: 1261 $ (last changed revision) // @date $Date: 2016-02-29 18:23:44 +0100 (Mo, 29 Feb 2016) $ (last change date) // @author $Author: floca $ (last changed by) // Subversion HeadURL: $HeadURL: https://svn.inet.dkfz-heidelberg.de/sbr/Sources/SBR-Projects/MatchPoint/trunk/Applications/Mapper/include/matchRHelper.h $ */ #ifndef __MAP_R_HELPER_H #define __MAP_R_HELPER_H #include "itkStdStreamLogOutput.h" #include "mapConvert.h" #include "mapExceptionObjectMacros.h" #include "mapRegistration.h" #include "mapGenericImageReader.h" #include "mapRegistrationFileWriter.h" #include "mapImageRegistrationAlgorithmInterface.h" #include "mapMaskedRegistrationAlgorithmInterface.h" #include "mapMetaPropertyAlgorithmInterface.h" #include "mapPointSetRegistrationAlgorithmInterfaceV2.h" #include #include #include #include #include #include #include #include #include #include #include "matchRApplicationData.h" namespace map { namespace apps { namespace matchR { /** Helper function to load the algorithm into the passed app data structure.*/ void loadAlgorithm(ApplicationData& appData); /** Helper function to load the moving image into the passed app data structure.*/ void loadMovingImage(ApplicationData& appData); /** Helper function to load the target image into the passed app data structure.*/ void loadTargetImage(ApplicationData& appData); /** Helper function to load the target point set (if set) into the passed app data structure.*/ void loadTargetPointSet(ApplicationData& appData); /** Helper function to load the moving point set (if set) into the passed app data structure.*/ void loadMovingPointSet(ApplicationData& appData); /** Helper function to load the moving mask into the passed app data structure.*/ void loadMovingMask(ApplicationData& appData); /** Helper function to load the target mask into the passed app data structure.*/ void loadTargetMask(ApplicationData& appData); /** Helper function to load the meta parameter map for the algorithm into the passed app data structure.*/ void loadParameterMap(ApplicationData& appData); ::map::core::MetaPropertyBase::Pointer wrapMetaProperty(const ::map::algorithm::MetaPropertyInfo* pInfo, const ::map::core::String& valueStr); template class ProcessingLogic { public: typedef ::map::core::Registration RegistrationType; typedef ::map::algorithm::RegistrationAlgorithm AlgorithmType; - void onMapAlgorithmEvent(::itk::Object*, const itk::EventObject& event) + void onMapAlgorithmEvent(::itk::Object* /*unused*/, const itk::EventObject& event) { - const map::events::AlgorithmEvent* pAlgEvent = dynamic_cast + const auto* pAlgEvent = dynamic_cast (&event); - const map::events::AlgorithmIterationEvent* pIterationEvent = + const auto* pIterationEvent = dynamic_cast(&event); - const map::events::AlgorithmWrapperEvent* pWrapEvent = + const auto* pWrapEvent = dynamic_cast(&event); - const map::events::AlgorithmResolutionLevelEvent* pLevelEvent = + const auto* pLevelEvent = dynamic_cast(&event); - const map::events::InitializingAlgorithmEvent* pInitEvent = + const auto* pInitEvent = dynamic_cast(&event); - const map::events::StartingAlgorithmEvent* pStartEvent = + const auto* pStartEvent = dynamic_cast(&event); - const map::events::StoppingAlgorithmEvent* pStoppingEvent = + const auto* pStoppingEvent = dynamic_cast(&event); - const map::events::StoppedAlgorithmEvent* pStoppedEvent = + const auto* pStoppedEvent = dynamic_cast(&event); - const map::events::FinalizingAlgorithmEvent* pFinalizingEvent = + const auto* pFinalizingEvent = dynamic_cast(&event); - const map::events::FinalizedAlgorithmEvent* pFinalizedEvent = + const auto* pFinalizedEvent = dynamic_cast(&event); - if (pInitEvent) + if (pInitEvent != nullptr) { std::cout << "Initializing algorithm ..." << std::endl; } - else if (pStartEvent) + else if (pStartEvent != nullptr) { std::cout << "Starting algorithm ..." << std::endl; } - else if (pStoppingEvent) + else if (pStoppingEvent != nullptr) { std::cout << "Stopping algorithm ..." << std::endl; } - else if (pStoppedEvent) + else if (pStoppedEvent != nullptr) { std::cout << "Stopped algorithm ..." << std::endl; if (!pStoppedEvent->getComment().empty()) { std::cout << "Stopping condition: " << pStoppedEvent->getComment() << std::endl; } } - else if (pFinalizingEvent) + else if (pFinalizingEvent != nullptr) { std::cout << "Finalizing algorithm and results ..." << std::endl; } - else if (pFinalizedEvent) + else if (pFinalizedEvent != nullptr) { std::cout << "Finalized algorithm ..." << std::endl; } - else if (pIterationEvent) + else if (pIterationEvent != nullptr) { if (_appData->_detailedOutput) { - typedef map::algorithm::facet::IterativeAlgorithmInterface IIterativeAlgorithm; + using IIterativeAlgorithm = map::algorithm::facet::IterativeAlgorithmInterface; - const IIterativeAlgorithm* pIterative = dynamic_cast + const auto* pIterative = dynamic_cast (this->_appData->_algorithm.GetPointer()); IIterativeAlgorithm::IterationCountType count = 0; std::cout << "["; - if (pIterative && pIterative->hasIterationCount()) + if ((pIterative != nullptr) && pIterative->hasIterationCount()) { std::cout << pIterative->getCurrentIteration(); } std::cout << "] " << pIterationEvent->getComment() << std::endl; } else { std::cout << "."; } } - else if (pLevelEvent) + else if (pLevelEvent != nullptr) { if (_appData->_detailedOutput) { - typedef map::algorithm::facet::MultiResRegistrationAlgorithmInterface IMultiResAlgorithm; - const IMultiResAlgorithm* pResAlg = dynamic_cast + using IMultiResAlgorithm = map::algorithm::facet::MultiResRegistrationAlgorithmInterface; + const auto* pResAlg = dynamic_cast (this->_appData->_algorithm.GetPointer()); map::algorithm::facet::MultiResRegistrationAlgorithmInterface::ResolutionLevelCountType count = 0; std::cout << std::endl << "**************************************" << std::endl; std::cout << "New resolution level"; - if (pResAlg && pResAlg->hasLevelCount()) + if ((pResAlg != nullptr) && pResAlg->hasLevelCount()) { std::cout << " [# " << pResAlg->getCurrentLevel() + 1 << "]"; } std::cout << std::endl << "**************************************" << std::endl << std::endl; } else { std::cout << std::endl; } } - else if (pAlgEvent && !pWrapEvent) + else if ((pAlgEvent != nullptr) && (pWrapEvent == nullptr)) { std::cout << pAlgEvent->getComment() << std::endl; } }; /**write the registration data according to the settings in appData. * @pre pReg must point to a valid instance.*/ void doWriting(RegistrationType* pReg) { if (!pReg) { mapDefaultExceptionStaticMacro( << "Cannot write data. Passed registration pointer is invalid (NULL)."); } std::cout << std::endl << "save output file ... "; std::cout << "(" << this->_appData->_outputFileName << ")... "; typedef ::map::io::RegistrationFileWriter WriterType; typename WriterType::Pointer spWriter = WriterType::New(); spWriter->setExpandLazyKernels(false); spWriter->write(pReg, this->_appData->_outputFileName); std::cout << "done." << std::endl; }; typename RegistrationType::Pointer doRegistration() { - typedef typename ::map::core::discrete::Elements::InternalImageType ImageType; - typedef typename ::map::core::continuous::Elements::InternalPointSetType PointSetType; - typedef typename ::itk::SpatialObject MaskType; + using ImageType = typename ::map::core::discrete::Elements::InternalImageType; + using PointSetType = typename ::map::core::continuous::Elements::InternalPointSetType; + using MaskType = typename ::itk::SpatialObject; //Now cast to the right interface (ImageRegistrationAlgorithmBase) //to set the images typedef map::algorithm::facet::ImageRegistrationAlgorithmInterface ImageRegistrationAlgorithmInterfaceType; - ImageRegistrationAlgorithmInterfaceType* pImageInterface = + auto* pImageInterface = dynamic_cast(this->_appData->_algorithm.GetPointer()); if (pImageInterface) { - const ImageType* moving = dynamic_cast(this->_appData->_spMovingImage.GetPointer()); - const ImageType* target = dynamic_cast(this->_appData->_spTargetImage.GetPointer()); + const auto* moving = dynamic_cast(this->_appData->_spMovingImage.GetPointer()); + const auto* target = dynamic_cast(this->_appData->_spTargetImage.GetPointer()); pImageInterface->setMovingImage(moving); pImageInterface->setTargetImage(target); } else { mapDefaultExceptionStaticMacro("Error. Wrong algorithm seemed to be loaded. Image Registration interface is missing. Check DLL."); } //Now cast to the right interface (PointSetRegistrationAlgorithmInterfaceV2) //to set the images typedef map::algorithm::facet::PointSetRegistrationAlgorithmInterfaceV2 PointSetRegistrationAlgorithmInterfaceType; - PointSetRegistrationAlgorithmInterfaceType* pPSInterface = + auto* pPSInterface = dynamic_cast(this->_appData->_algorithm.GetPointer()); if (pPSInterface) { - const PointSetType* moving = dynamic_cast(this->_appData->_genericMovingPointSet.GetPointer()); - const PointSetType* target = dynamic_cast(this->_appData->_genericTargetPointSet.GetPointer()); + const auto* moving = dynamic_cast(this->_appData->_genericMovingPointSet.GetPointer()); + const auto* target = dynamic_cast(this->_appData->_genericTargetPointSet.GetPointer()); if (pPSInterface->getMovingPointSetCount()>0) { - if (moving) + if (moving) { pPSInterface->setMovingPointSet(moving); - else + } else { if (pPSInterface->getMovingPointSetCount(true) > 0) { mapDefaultExceptionStaticMacro("Error. Algorithm requires moving point set, but no point set specified."); } } } if (pPSInterface->getTargetPointSetCount()>0) { - if (target) + if (target) { pPSInterface->setTargetPointSet(target); - else + } else { if (pPSInterface->getTargetPointSetCount(true) > 0) { mapDefaultExceptionStaticMacro("Error. Algorithm requires target point set, but no point set specified."); } } } } else if (this->_appData->_genericMovingPointSet.IsNotNull() || this->_appData->_genericTargetPointSet.IsNotNull()) { std::cout << "WARNING: algorithm does not support point sets. User specified point sets will be ignored."; } //Now cast to the mask supporting interface //to set the masks typedef map::algorithm::facet::MaskedRegistrationAlgorithmInterface MaskedRegistrationAlgorithmInterfaceType; - MaskedRegistrationAlgorithmInterfaceType* pMInterface = + auto* pMInterface = dynamic_cast(this->_appData->_algorithm.GetPointer()); if (pMInterface) { - const MaskType* moving = dynamic_cast(this->_appData->_genericMovingMask.GetPointer()); - const MaskType* target = dynamic_cast(this->_appData->_genericTargetMask.GetPointer()); + const auto* moving = dynamic_cast(this->_appData->_genericMovingMask.GetPointer()); + const auto* target = dynamic_cast(this->_appData->_genericTargetMask.GetPointer()); pMInterface->setMovingMask(moving); pMInterface->setTargetMask(target); } else if (this->_appData->_genericMovingMask.IsNotNull() || this->_appData->_genericTargetMask.IsNotNull()) { std::cout << "WARNING: algorithm does not support masks. User specified masks will be ignored."; } //Add observer for algorithm events. typename ::itk::MemberCommand< ProcessingLogic >::Pointer command = ::itk::MemberCommand< ProcessingLogic >::New(); command->SetCallbackFunction(this, &ProcessingLogic::onMapAlgorithmEvent); unsigned long observerID = this->_appData->_algorithm->AddObserver(map::events::AlgorithmEvent(), command); //Set meta properties - ::map::algorithm::facet::MetaPropertyAlgorithmInterface* pMetaInterface = + auto* pMetaInterface = dynamic_cast< ::map::algorithm::facet::MetaPropertyAlgorithmInterface*>(this->_appData->_algorithm.GetPointer()); - if (pMetaInterface) + if (pMetaInterface != nullptr) { for (auto paramItr : this->_appData->_parameterMap) { ::map::algorithm::MetaPropertyInfo::Pointer info = pMetaInterface->getPropertyInfo(paramItr.first); if (info.IsNotNull() && info->isWritable()) { std::cout << "Set meta property: " << paramItr.first << " = " <getName() << "; property type: " << info->getTypeName()); } else { pMetaInterface->setProperty(paramItr.first, prop); } } } } //Cast algorithm, start the registration and get the result typename RegistrationType::Pointer result; - AlgorithmType* castedAlgorithm = dynamic_cast(this->_appData->_algorithm.GetPointer()); + auto* castedAlgorithm = dynamic_cast(this->_appData->_algorithm.GetPointer()); if (castedAlgorithm) { result = castedAlgorithm->getRegistration(); } else { mapDefaultExceptionStaticMacro("Error. Wrong algorithm seemed to be loaded. Cannot be casted to determine the registration. Check DLL."); } return result; }; void processData() { typename RegistrationType::Pointer reg = doRegistration(); doWriting(reg); }; ProcessingLogic(const ApplicationData& appData) : _appData(&appData) { }; protected: const ApplicationData* _appData; }; - } - } -} + } // namespace matchR + } // namespace apps +} // namespace map #endif diff --git a/Applications/Matcher/source/matchR.cpp b/Applications/Matcher/source/matchR.cpp index 78925fc..4ef0ff4 100644 --- a/Applications/Matcher/source/matchR.cpp +++ b/Applications/Matcher/source/matchR.cpp @@ -1,233 +1,233 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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: 1371 $ (last changed revision) // @date $Date: 2016-05-23 17:56:37 +0200 (Mo, 23 Mai 2016) $ (last change date) // @author $Author: floca $ (last changed by) // Subversion HeadURL: $HeadURL: https://svn.inet.dkfz-heidelberg.de/sbr/Sources/SBR-Projects/MatchPoint/trunk/Applications/Mapper/source/matchR.cpp $ */ #include "matchRApplicationData.h" #include "matchRHelper.h" #ifdef MAP_DISABLE_ITK_IO_FACTORY_AUTO_REGISTER /* The matchR needs the IO factories to be registered in cases where MatchPoint is built without auto registration (e.g. for use in MITK) matchR has to add the registration helper manually.*/ #include "itkImageIOFactoryRegisterManager.h" #endif //MAP_DISABLE_ITK_IO_FACTORY_AUTO_REGISTER map::apps::matchR::ApplicationData appData; -void onMAPEvent(::itk::Object*, const itk::EventObject& event, void*) +void onMAPEvent(::itk::Object* /*unused*/, const itk::EventObject& event, void* /*unused*/) { std::cout << " > > > "; event.Print(std::cout); std::cout << std::endl; } #define mapCatchAppMacro(rcode, x) \ catch (::itk::ExceptionObject& e) \ { \ std::cerr << "Error!!!" << std::endl; \ std::cerr << e << std::endl; \ return rcode; \ } \ catch (std::exception& e) \ { \ std::cerr << "Error!!!" << std::endl; \ std::cerr << e.what() << std::endl; \ return rcode; \ } \ catch (...) \ { \ std::cerr << x << std::endl; \ return rcode; \ } /** Main entry point for the application. * @retval 0 normal exit. * @retval 1 showed help or version info. * @retval 2 Invalid usage. Missing parameters. * @retval 3 Invalid usage. Wrong option usage. * @retval 4 Error while loading moving image. * @retval 5 Error while loading target image. * @retval 6 Error while loading algorithm. * @retval 7 Error while loading meta parameter. * @retval 8 Error while registering and storing registration. * @retval 9 Error while loading moving point set. * @retval 10 Error while loading target point set. * @retval 11 Error while loading moving mask image. * @retval 12 Error while loading target mask image. */ int main(int argc, char** argv) { int result = 0; std::cout << "matchR - Generic light weight image registration tool for MatchPoint." << std::endl; switch (appData.ParseArguments(argc, argv)) { case 1: { //showed version or help info. Done. return 1; } case 2: { std::cerr << "Missing Parameters. Use one of the following flags for more information:" << std::endl; std::cerr << "-? or --help" << std::endl; return 2; } case 3: { //wrong option usage. return 3; } } if (appData._fileCount < 1) { std::cerr << "Missing Parameters. Use one of the following flags for more information:" << std::endl; std::cerr << "-? or --help" << std::endl; return 2; } map::core::Logbook::setDefaultLogFileName(appData._logFileName); ::itk::StdStreamLogOutput::Pointer spStreamLogOutput = ::itk::StdStreamLogOutput::New(); spStreamLogOutput->SetStream(std::cout); map::core::Logbook::addAdditionalLogOutput(spStreamLogOutput); if (appData._detailedOutput) { map::core::Logbook::setLogbookToDebugMode(); } std::cout << std::endl << "*******************************************" << std::endl; std::cout << "Moving file: " << appData._movingFileName << std::endl; std::cout << "Target file: " << appData._targetFileName << std::endl; std::cout << "Algorithm location: " << appData._algorithmFileName << std::endl; std::cout << "Moving mask file: "; if (appData._movingMaskFileName.empty()) { std::cout << "disabled" << std::endl; } else { std::cout << appData._movingMaskFileName << std::endl; } std::cout << "Target mask file: "; if (appData._targetMaskFileName.empty()) { std::cout << "disabled" << std::endl; } else { std::cout << appData._targetMaskFileName << std::endl; } std::cout << "Moving point set file: "; if (appData._movingPointSetFileName.empty()) { std::cout << "disabled" << std::endl; } else { std::cout << appData._movingPointSetFileName << std::endl; } std::cout << "Target point set file: "; if (appData._targetPointSetFileName.empty()) { std::cout << "disabled" << std::endl; } else { std::cout << appData._targetPointSetFileName << std::endl; } std::cout << "Series read style: " << appData._seriesReadStyleStr << std::endl; try { map::apps::matchR::loadMovingImage(appData); } mapCatchAppMacro(4, "Error!!! unknown error while reading moving image.") try { map::apps::matchR::loadTargetImage(appData); } mapCatchAppMacro(5, "Error!!! unknown error while reading target image.") try { map::apps::matchR::loadAlgorithm(appData); } mapCatchAppMacro(6, "Error!!! unknown error while reading registration file.") try { map::apps::matchR::loadTargetPointSet(appData); } mapCatchAppMacro(9, "Error!!! unknown error while reading target point set.") try { map::apps::matchR::loadMovingPointSet(appData); } mapCatchAppMacro(10, "Error!!! unknown error while reading moving point set.") try { map::apps::matchR::loadMovingMask(appData); } mapCatchAppMacro(11, "Error!!! unknown error while reading moving mask.") try { map::apps::matchR::loadTargetMask(appData); } mapCatchAppMacro(12, "Error!!! unknown error while reading target mask.") try { map::apps::matchR::loadParameterMap(appData); } mapCatchAppMacro(7, "Error!!! unknown error while parsing the meta parameters.") try { if (appData._loadedDimensions == 2) { map::apps::matchR::ProcessingLogic<2> logic(appData); logic.processData(); } else if (appData._loadedDimensions == 3) { map::apps::matchR::ProcessingLogic<3> logic(appData); logic.processData(); } } mapCatchAppMacro(8, "Error!!! unknown error while mapping and writing image.") std::cout << std::endl; return result; } diff --git a/Applications/Matcher/source/matchRApplicationData.cpp b/Applications/Matcher/source/matchRApplicationData.cpp index d03574a..72f0bc9 100644 --- a/Applications/Matcher/source/matchRApplicationData.cpp +++ b/Applications/Matcher/source/matchRApplicationData.cpp @@ -1,252 +1,252 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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: 1371 $ (last changed revision) // @date $Date: 2016-05-23 17:56:37 +0200 (Mo, 23 Mai 2016) $ (last change date) // @author $Author: floca $ (last changed by) // Subversion HeadURL: $HeadURL: https://svn.inet.dkfz-heidelberg.de/sbr/Sources/SBR-Projects/MatchPoint/trunk/Applications/Mapper/source/matchRApplicationData.cpp $ */ #include "matchRApplicationData.h" #include "mapConfigure.h" #include "itksys/SystemTools.hxx" namespace map { namespace apps { namespace matchR { int unknown_argument(const char* argument, void* call_data) { std::cout << "Got unknown argument: \"" << argument << "\"" << std::endl; return 0; } ApplicationData:: ApplicationData() { this->Reset(); } void ApplicationData:: Reset() { _algorithmFileName = ""; _movingFileName = ""; _movingMaskFileName = ""; _targetFileName = ""; _targetMaskFileName = ""; _outputFileName = ""; _logFileName = ""; _targetPointSetFileName = ""; _movingPointSetFileName = ""; _parameterStrs.clear(); _parameterMap.clear(); _showVersion = false; _showHelp = false; _detailedOutput = false; _upperSeriesLimit = 0; _loadedDimensions = 1; _seriesReadStyle = io::ImageSeriesReadStyle::Default; _seriesReadStyleStr = "default"; _fileCount = 0; } unsigned int ApplicationData:: ParseArguments(int argc, char** argv) { this->Reset(); if (argc > 1) { ::map::core::String dummyArg = argv[1]; if (dummyArg.substr(0, 1) != "-") { //argument is the moving file. Store the argument and move to next position. _movingFileName = dummyArg; ++_fileCount; --argc; ++argv; } } if (argc > 1) { ::map::core::String dummyArg = argv[1]; if (dummyArg.substr(0, 1) != "-") { //argument is the target file. Store the argument and move to next position. _targetFileName = dummyArg; ++_fileCount; --argc; ++argv; } } if (argc > 1) { ::map::core::String dummyArg = argv[1]; if (dummyArg.substr(0, 1) != "-") { //argument is the algorithm. Store the argument and move to next position before parsing starts. _algorithmFileName = dummyArg; ++_fileCount; --argc; ++argv; } } cmdParser.Initialize(argc, argv); cmdParser.SetUnknownArgumentCallback(unknown_argument); cmdParser.AddArgument("--output", itksys::CommandLineArguments::SPACE_ARGUMENT, &_outputFileName, "Specifies name and location of the output file. Default is the location of the input file and a name constructed from the name of the input file and the registration file."); cmdParser.AddArgument("-o", itksys::CommandLineArguments::SPACE_ARGUMENT, &_outputFileName, "Specifies name and location of the output file. Default is the location of the input file and a name constructed from the name of the input file and the registration file."); cmdParser.AddArgument("--target-mask", itksys::CommandLineArguments::SPACE_ARGUMENT, &_targetMaskFileName, "Specifies name and location of the file that specifies a target mask image."); cmdParser.AddArgument("-t", itksys::CommandLineArguments::SPACE_ARGUMENT, &_targetMaskFileName, "Specifies name and location of the file that specifies a target mask image."); cmdParser.AddArgument("--moving-mask", itksys::CommandLineArguments::SPACE_ARGUMENT, &_movingMaskFileName, "Specifies name and location of the file that specifies a moving mask image."); cmdParser.AddArgument("-m", itksys::CommandLineArguments::SPACE_ARGUMENT, &_movingMaskFileName, "Specifies name and location of the file that specifies a moving mask image."); cmdParser.AddArgument("--target-pointset", itksys::CommandLineArguments::SPACE_ARGUMENT, &_targetPointSetFileName, "Specifies name and location of the file that specifies the optional target point set."); cmdParser.AddArgument("--moving-pointset", itksys::CommandLineArguments::SPACE_ARGUMENT, &_movingPointSetFileName, "Specifies name and location of the file that specifies the optional moving point set."); cmdParser.AddArgument("--parameters", itksys::CommandLineArguments::MULTI_ARGUMENT, &_parameterStrs, - "Allows to define meta properties that are passed to the algorithm. Each value defines a meta property and its value(s). The structure of the value string must be =; e.g. -p \"myProp=10\". If you want to pass vector values (e.g. algorithm scales) seperate the value by space; e.g. -p \"Scales= 1 2 3 10\"."); + R"(Allows to define meta properties that are passed to the algorithm. Each value defines a meta property and its value(s). The structure of the value string must be =; e.g. -p "myProp=10". If you want to pass vector values (e.g. algorithm scales) seperate the value by space; e.g. -p "Scales= 1 2 3 10".)"); cmdParser.AddArgument("-p", itksys::CommandLineArguments::MULTI_ARGUMENT, &_parameterStrs, - "Allows to define meta properties that are passed to the algorithm. Each value defines a meta property and its value(s). The structure of the value string must be =; e.g. -p \"myProp=10\". If you want to pass vector values (e.g. algorithm scales) seperate the value by space; e.g. -p \"Scales= 1 2 3 10\"."); + R"(Allows to define meta properties that are passed to the algorithm. Each value defines a meta property and its value(s). The structure of the value string must be =; e.g. -p "myProp=10". If you want to pass vector values (e.g. algorithm scales) seperate the value by space; e.g. -p "Scales= 1 2 3 10".)"); cmdParser.AddArgument("-v", itksys::CommandLineArguments::NO_ARGUMENT, &_showVersion, "Shows the version of the program."); cmdParser.AddArgument("-d", itksys::CommandLineArguments::NO_ARGUMENT, &_detailedOutput, "Program has a more detailed (debug) output."); cmdParser.AddArgument("--details", itksys::CommandLineArguments::NO_ARGUMENT, &_detailedOutput, "Program has a more detailed (debug) output."); cmdParser.AddArgument("-h", itksys::CommandLineArguments::NO_ARGUMENT, &_showHelp, "Shows this help information for the program."); cmdParser.AddArgument("--help", itksys::CommandLineArguments::NO_ARGUMENT, &_showHelp, "Shows this help information for the program."); cmdParser.AddArgument("-?", itksys::CommandLineArguments::NO_ARGUMENT, &_showHelp, "Shows this help information for the program."); cmdParser.AddArgument("-u", itksys::CommandLineArguments::SPACE_ARGUMENT, &_upperSeriesLimit, "Only relevant in combination with numeric read style. Defines the upper index of the numeric image stack."); cmdParser.AddArgument("--upperSeriesLimit", itksys::CommandLineArguments::SPACE_ARGUMENT, &_upperSeriesLimit, "Only relevant in combination with numeric read style. Defines the upper index of the numeric image stack."); cmdParser.AddArgument("-r", itksys::CommandLineArguments::SPACE_ARGUMENT, &_seriesReadStyleStr, "Defines the read style for input and template image. Valid values are: 'default': like dicom but does not force series output; 'dicom': in current version it is equal to use 'gdcm'; 'gdcm': uses the dicom series file names reader and GDCM to load the images; 'none': only the specified file will be read; 'numeric': uses the numeric series file names reader and forces an output as series of 2D images."); cmdParser.AddArgument("--seriesReader", itksys::CommandLineArguments::SPACE_ARGUMENT, &_seriesReadStyleStr, "Defines the read style for input and template image. Valid values are: 'default': like dicom but does not force series output; 'dicom': in current version it is equal to use 'gdcm'; 'gdcm': uses the dicom series file names reader and GDCM to load the images; 'none': only the specified file will be read; 'numeric': uses the numeric series file names reader and forces an output as series of 2D images."); cmdParser.AddArgument("--log", itksys::CommandLineArguments::SPACE_ARGUMENT, &_logFileName, "Specifies name and location of the log file. Default (flag not set) is that no log file is written."); cmdParser.AddArgument("-l", itksys::CommandLineArguments::SPACE_ARGUMENT, &_logFileName, "Specifies name and location of the log file. Default (flag not set) is that no log file is written."); - if (!cmdParser.Parse()) + if (cmdParser.Parse() == 0) { std::cerr << "Wrong command line option or insufficient number of arguments." << std::endl; std::cerr << "The last correct argument was: " << argv[cmdParser.GetLastArgument()] << std::endl << "Use one of the following flags for more information:" << std::endl; std::cerr << "-? or --help" << std::endl; return 3; }; if (_showHelp) { std::cout << std::endl << "Usage: " << std::endl << std::endl; std::cout << " matchR [options]" << std::endl << std::endl; std::cout << " Moving: File path to the image that is the moving image." << std::endl; std::cout << " Target: File path to the image that is the target image." << std::endl; std::cout << " Alg: File path to the registration algorithm that should be used." << std::endl; std::cout << "Command-Line Options:" << std::endl << std::endl; std::cout << cmdParser.GetHelp() << std::endl << std::endl; std::cout << " Example:" << std::endl << std::endl; std::cout << " matchR moving.dcm target.dcm myFancyAlgorithm.dll" << std::endl << std::endl; std::cout << - " This will match \"moving.dcm\" onto \"target.dcm\" by using the algorithm \"myFancyAlgorithm.dcm\". The output will be in the directory of the input. The output file name will be \"moving_to_taget.reg\"." + R"( This will match "moving.dcm" onto "target.dcm" by using the algorithm "myFancyAlgorithm.dcm". The output will be in the directory of the input. The output file name will be "moving_to_taget.reg".)" << std::endl; return 1; } if (_showVersion) { std::cout << std::endl << "Version: " << MAP_FULL_VERSION_STRING << std::endl; return 1; } if (_fileCount < 3) { return 2; } if (_outputFileName.empty()) { ::map::core::String path = core::FileDispatch::getPath(_movingFileName); ::map::core::String movingName = core::FileDispatch::getName(_movingFileName); ::map::core::String targetName = core::FileDispatch::getName(_targetFileName); _outputFileName = core::FileDispatch::createFullPath(path, movingName + "_TO_" + targetName + ".mapr"); } if (_seriesReadStyleStr == "none") { _seriesReadStyle = io::ImageSeriesReadStyle::None; } else if (_seriesReadStyleStr == "dicom") { _seriesReadStyle = io::ImageSeriesReadStyle::Dicom; } else if (_seriesReadStyleStr == "numeric") { _seriesReadStyle = io::ImageSeriesReadStyle::Numeric; } else if (_seriesReadStyleStr == "gdcm") { _seriesReadStyle = io::ImageSeriesReadStyle::GDCM; } return 0; }; - } - } -} + } // namespace matchR + } // namespace apps +} // namespace map diff --git a/Applications/Matcher/source/matchRHelper.cpp b/Applications/Matcher/source/matchRHelper.cpp index 4918db9..e3a92c8 100644 --- a/Applications/Matcher/source/matchRHelper.cpp +++ b/Applications/Matcher/source/matchRHelper.cpp @@ -1,660 +1,660 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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: 1083 $ (last changed revision) // @date $Date: 2015-09-08 11:18:31 +0200 (Di, 08 Sep 2015) $ (last change date) // @author $Author: debusc $ (last changed by) // Subversion HeadURL: $HeadURL: https://svn.inet.dkfz-heidelberg.de/sbr/Sources/SBR-Projects/MatchPoint/trunk/Applications/Mapper/source/matchRHelper.cpp $ */ #include "matchRHelper.h" #include "mapGenericImageReader.h" #include "mapDeploymentDLLAccess.h" #include "mapDeploymentDLLHandle.h" #include "mapMetaProperty.h" #include "mapContinuousElements.h" #include "mapSimpleLandMarkFileReader.h" #include "itkDataObject.h" #include "itkCastImageFilter.h" #include "itkImageMaskSpatialObject.h" #include #include /**helper function that takes a string and splits it by a given delimeter*/ template void split(const ::map::core::String &s, char delim, Out result) { std::stringstream ss; ss.str(s); ::map::core::String item; while (std::getline(ss, item, delim)) { *(result++) = item; } } template void handleImageCast(const ::map::io::GenericImageReader::GenericOutputImageType* inputImage, ::map::io::GenericImageReader::GenericOutputImageType::Pointer& castedImage) { typedef ::itk::Image InputImageType; - typedef typename ::map::core::discrete::Elements::InternalImageType CastedImageType; + using CastedImageType = typename ::map::core::discrete::Elements::InternalImageType; typedef ::itk::CastImageFilter FilterType; - const InputImageType* input = dynamic_cast(inputImage); + const auto* input = dynamic_cast(inputImage); typename FilterType::Pointer caster = FilterType::New(); caster->SetInput(input); caster->Update(); typename CastedImageType::Pointer casted = caster->GetOutput(); castedImage = casted.GetPointer(); } template void handleGenericImageCast(map::io::GenericImageReader::LoadedComponentType loadedComponentType, const ::map::io::GenericImageReader::GenericOutputImageType* inputImage, ::map::io::GenericImageReader::GenericOutputImageType::Pointer& castedImage) { switch (loadedComponentType) { case ::itk::ImageIOBase::UCHAR: { handleImageCast(inputImage, castedImage); break; } case ::itk::ImageIOBase::CHAR: { handleImageCast(inputImage, castedImage); break; } case ::itk::ImageIOBase::USHORT: { handleImageCast(inputImage, castedImage); break; } case ::itk::ImageIOBase::SHORT: { handleImageCast(inputImage, castedImage); break; } case ::itk::ImageIOBase::UINT: { handleImageCast(inputImage, castedImage); break; } case ::itk::ImageIOBase::INT: { handleImageCast(inputImage, castedImage); break; } case ::itk::ImageIOBase::ULONG: { handleImageCast(inputImage, castedImage); break; } case ::itk::ImageIOBase::LONG: { handleImageCast(inputImage, castedImage); break; } case ::itk::ImageIOBase::FLOAT: { handleImageCast(inputImage, castedImage); break; } case ::itk::ImageIOBase::DOUBLE: { handleImageCast(inputImage, castedImage); break; } default: { mapDefaultExceptionStaticMacro(<< "The file uses a pixel component type that is not supported in this application."); } } } void ::map::apps::matchR::loadAlgorithm(::map::apps::matchR::ApplicationData& appData) { - map::deployment::RegistrationAlgorithmBasePointer spAlgorithmBase = NULL; + map::deployment::RegistrationAlgorithmBasePointer spAlgorithmBase = nullptr; std::cout << std::endl << "Load registration algorithm..." << std::endl; - map::deployment::DLLHandle::Pointer spHandle = NULL; + map::deployment::DLLHandle::Pointer spHandle = nullptr; spHandle = map::deployment::openDeploymentDLL(appData._algorithmFileName); if (spHandle.IsNull()) { mapDefaultExceptionStaticMacro(<< "Cannot open deployed registration algorithm file."); } std::cout << "... libary opened..." << std::endl; if (appData._detailedOutput) { std::cout << "Algorithm information: " << std::endl; spHandle->getAlgorithmUID().Print(std::cout, 2); std::cout << std::endl; } //Now load the algorthm from DLL spAlgorithmBase = map::deployment::getRegistrationAlgorithm(spHandle); if (spAlgorithmBase.IsNotNull()) { std::cout << "... done" << std::endl << std::endl; if (spAlgorithmBase->getMovingDimensions() != spAlgorithmBase->getTargetDimensions() || spAlgorithmBase->getMovingDimensions() != appData._loadedDimensions) { mapDefaultExceptionStaticMacro(<< "Loaded algorithm and loaded imagey have no equal dimensionality. Algorithm cannot be used to register the image."); } appData._algorithm = spAlgorithmBase; } else { mapDefaultExceptionStaticMacro(<< "Cannot create algorithm instance"); } }; void ::map::apps::matchR::loadMovingImage(::map::apps::matchR::ApplicationData& appData) { map::io::GenericImageReader::GenericOutputImageType::Pointer loadedImage; unsigned int loadedDimensions; map::io::GenericImageReader::LoadedPixelType loadedPixelType; map::io::GenericImageReader::LoadedComponentType loadedComponentType; map::io::GenericImageReader::MetaDataDictionaryArrayType loadedMetaDataDictArray; map::io::GenericImageReader::Pointer spReader = map::io::GenericImageReader::New(); spReader->setSeriesReadStyle(appData._seriesReadStyle); spReader->setFileName(appData._movingFileName); spReader->setUpperSeriesLimit(appData._upperSeriesLimit); std::cout << std::endl << "Read moving image file... "; loadedImage = spReader->GetOutput(loadedDimensions, loadedPixelType, loadedComponentType); loadedMetaDataDictArray = spReader->getMetaDictionaryArray(); if (loadedImage.IsNotNull()) { std::cout << "done." << std::endl; if (appData._detailedOutput) { std::cout << "Moving image info:" << std::endl; loadedImage->Print(std::cout); std::cout << std::endl; } } else { mapDefaultExceptionStaticMacro(<< " Unable to load moving image. File is not existing or has an unsupported format."); } if (loadedPixelType != ::itk::ImageIOBase::SCALAR) { mapDefaultExceptionStaticMacro(<< "Unsupported moving image. Only simple scalar images are supported in this version."); } if (loadedDimensions < 2 || loadedDimensions > 3) { mapDefaultExceptionStaticMacro(<< "Unsupported moving image. Only 2D and 3D images are supported in this version."); } else if(loadedComponentType == 2) { handleGenericImageCast<2>(loadedComponentType, loadedImage, loadedImage); } else { handleGenericImageCast<3>(loadedComponentType, loadedImage, loadedImage); } appData._spMovingImage = loadedImage; appData._loadedDimensions = loadedDimensions; }; void ::map::apps::matchR::loadTargetImage(::map::apps::matchR::ApplicationData& appData) { if (!(appData._targetFileName.empty())) { map::io::GenericImageReader::GenericOutputImageType::Pointer loadedImage; unsigned int loadedDimensions; map::io::GenericImageReader::LoadedPixelType loadedPixelType; map::io::GenericImageReader::LoadedComponentType loadedComponentType; map::io::GenericImageReader::MetaDataDictionaryArrayType loadedMetaDataDictArray; map::io::GenericImageReader::Pointer spReader = map::io::GenericImageReader::New(); spReader->setSeriesReadStyle(appData._seriesReadStyle); spReader->setFileName(appData._targetFileName); spReader->setUpperSeriesLimit(appData._upperSeriesLimit); std::cout << std::endl << "Read target file... "; loadedImage = spReader->GetOutput(loadedDimensions, loadedPixelType, loadedComponentType); loadedMetaDataDictArray = spReader->getMetaDictionaryArray(); if (loadedImage.IsNotNull()) { std::cout << "done." << std::endl; if (appData._detailedOutput) { std::cout << "Target image info:" << std::endl; loadedImage->Print(std::cout); std::cout << std::endl; } } else { mapDefaultExceptionStaticMacro(<< " Unable to load target image. File is not existing or has an unsupported format."); } if (loadedDimensions != appData._loadedDimensions) { mapDefaultExceptionStaticMacro(<< " Unsupported target image. target image dimensions does not match moving image."); } if (loadedComponentType == 2) { handleGenericImageCast<2>(loadedComponentType, loadedImage, loadedImage); } else { handleGenericImageCast<3>(loadedComponentType, loadedImage, loadedImage); } appData._spTargetImage = loadedImage; } }; ::itk::DataObject::Pointer loadGenericPointSet(const ::map::core::String& filename, unsigned int dim) { ::itk::DataObject::Pointer result; if (!(filename.empty())) { if (dim == 2) { - typedef ::map::core::continuous::Elements<2>::InternalPointSetType PointSetType; + using PointSetType = ::map::core::continuous::Elements<2>::InternalPointSetType; result = ::map::utilities::loadLandMarksFromFile(filename).GetPointer(); } else { - typedef ::map::core::continuous::Elements<2>::InternalPointSetType PointSetType; + using PointSetType = ::map::core::continuous::Elements<2>::InternalPointSetType; result = ::map::utilities::loadLandMarksFromFile(filename).GetPointer(); } } return result; }; void ::map::apps::matchR::loadTargetPointSet(::map::apps::matchR::ApplicationData& appData) { if (!(appData._targetPointSetFileName.empty())) { std::cout << std::endl << "Read target point set file... "; appData._genericTargetPointSet = loadGenericPointSet(appData._targetPointSetFileName, appData._loadedDimensions); if (appData._genericTargetPointSet.IsNotNull()) { std::cout << "done." << std::endl; } else { mapDefaultExceptionStaticMacro(<< " Unable to load target point set. File is not existing or has an unsupported format."); } } }; void ::map::apps::matchR::loadMovingPointSet(::map::apps::matchR::ApplicationData& appData) { if (!(appData._movingPointSetFileName.empty())) { std::cout << std::endl << "Read moving point set file... "; appData._genericMovingPointSet = loadGenericPointSet(appData._movingPointSetFileName, appData._loadedDimensions); if (appData._genericMovingPointSet.IsNotNull()) { std::cout << "done." << std::endl; } else { mapDefaultExceptionStaticMacro(<< " Unable to load moving point set. File is not existing or has an unsupported format."); } } }; template void handleMaskConvert(const ::map::io::GenericImageReader::GenericOutputImageType* inputImage, typename ::itk::ImageMaskSpatialObject::Pointer& mask) { typedef ::itk::Image InputImageType; typedef ::itk::Image::PixelType, IDimension> MaskImageType; typedef ::itk::CastImageFilter FilterType; - typedef ::itk::ImageMaskSpatialObject SpatialType; + using SpatialType = ::itk::ImageMaskSpatialObject; - const InputImageType* input = dynamic_cast(inputImage); + const auto* input = dynamic_cast(inputImage); typename FilterType::Pointer caster = FilterType::New(); caster->SetInput(input); caster->Update(); typename SpatialType::Pointer spatial = SpatialType::New(); spatial->SetImage(caster->GetOutput()); mask = spatial; } template void handleGenericMaskConvert(map::io::GenericImageReader::LoadedComponentType loadedComponentType, const ::map::io::GenericImageReader::GenericOutputImageType* inputImage, typename ::itk::ImageMaskSpatialObject::Pointer& mask) { switch (loadedComponentType) { case ::itk::ImageIOBase::UCHAR: { handleMaskConvert(inputImage, mask); break; } case ::itk::ImageIOBase::CHAR: { handleMaskConvert(inputImage, mask); break; } case ::itk::ImageIOBase::USHORT: { handleMaskConvert(inputImage, mask); break; } case ::itk::ImageIOBase::SHORT: { handleMaskConvert(inputImage, mask); break; } case ::itk::ImageIOBase::UINT: { handleMaskConvert(inputImage, mask); break; } case ::itk::ImageIOBase::INT: { handleMaskConvert(inputImage, mask); break; } case ::itk::ImageIOBase::ULONG: { handleMaskConvert(inputImage, mask); break; } case ::itk::ImageIOBase::LONG: { handleMaskConvert(inputImage, mask); break; } case ::itk::ImageIOBase::FLOAT: { handleMaskConvert(inputImage, mask); break; } case ::itk::ImageIOBase::DOUBLE: { handleMaskConvert(inputImage, mask); break; } default: { mapDefaultExceptionStaticMacro(<< "The file uses a pixel component type that is not supported in this application."); } } } ::itk::DataObject::Pointer loadGenericMask(const ::map::core::String& filename, const ::map::io::ImageSeriesReadStyle::Type& readStyle, unsigned int dim) { ::itk::DataObject::Pointer result; if (!(filename.empty())) { map::io::GenericImageReader::GenericOutputImageType::Pointer loadedImage; unsigned int loadedDimensions; map::io::GenericImageReader::LoadedPixelType loadedPixelType; map::io::GenericImageReader::LoadedComponentType loadedComponentType; map::io::GenericImageReader::Pointer spReader = map::io::GenericImageReader::New(); spReader->setSeriesReadStyle(readStyle); spReader->setFileName(filename); loadedImage = spReader->GetOutput(loadedDimensions, loadedPixelType, loadedComponentType); if (loadedImage.IsNotNull()) { if (loadedDimensions != dim) { mapDefaultExceptionStaticMacro(<< " Unable to load mask. Mask dimension differs from input images."); } if (loadedDimensions == 2) { ::itk::ImageMaskSpatialObject<2>::Pointer mask; handleGenericMaskConvert<2>(loadedComponentType, loadedImage, mask); result = mask.GetPointer(); } else { ::itk::ImageMaskSpatialObject<3>::Pointer mask; handleGenericMaskConvert<3>(loadedComponentType, loadedImage, mask); result = mask.GetPointer(); } } else { mapDefaultExceptionStaticMacro(<< " Unable to load mask. File is not existing or has an unsupported format."); } } return result; }; void ::map::apps::matchR::loadTargetMask(::map::apps::matchR::ApplicationData& appData) { if (!(appData._targetMaskFileName.empty())) { std::cout << std::endl << "Read target mask file... "; appData._genericTargetMask = loadGenericMask(appData._targetMaskFileName, appData._seriesReadStyle, appData._loadedDimensions); if (appData._genericTargetMask.IsNotNull()) { std::cout << "done." << std::endl; } else { mapDefaultExceptionStaticMacro(<< " Unable to load target mask. File is not existing or has an unsupported format."); } } }; void ::map::apps::matchR::loadMovingMask(::map::apps::matchR::ApplicationData& appData) { if (!(appData._movingMaskFileName.empty())) { std::cout << std::endl << "Read moving mask file... "; appData._genericMovingMask = loadGenericMask(appData._movingMaskFileName, appData._seriesReadStyle, appData._loadedDimensions); if (appData._genericMovingMask.IsNotNull()) { std::cout << "done." << std::endl; } else { mapDefaultExceptionStaticMacro(<< " Unable to load moving mask. File is not existing or has an unsupported format."); } } }; void ::map::apps::matchR::loadParameterMap(::map::apps::matchR::ApplicationData& appData) { for (const auto& iter : appData._parameterStrs) { auto pos = iter.find_first_of("="); ::map::core::String name = iter.substr(0, pos); ::map::core::String value; if (pos != ::map::core::String::npos) { value = iter.substr(pos + 1); } appData._parameterMap.insert(std::make_pair(name, value)); } }; /**Helper function that converts, if possible */ template bool checkNConvert(const ::map::core::String& valueStr, TElement& value) { try { value = map::core::convert::toValueGeneric(valueStr); return true; } catch (...) { } return false; }; /**Template specification for helper of itk::Array*/ template <> bool checkNConvert(const ::map::core::String& valueStr, ::itk::Array& value) { try { std::vector valueStrVector; split(valueStr, ' ', std::back_inserter(valueStrVector)); value.SetSize(valueStrVector.size()); unsigned int pos = 0; for (const auto& aValue : valueStrVector) { value[pos++] = map::core::convert::toValueGeneric(aValue); } return true; } catch (...) { } return false; }; template map::core::MetaPropertyBase::Pointer checkCastAndSetProp(const ::map::core::String& valueStr) { bool result = false; TValueType value; map::core::MetaPropertyBase::Pointer prop; if (checkNConvert(valueStr, value)) { prop = map::core::MetaProperty::New(value).GetPointer(); } return prop; }; ::map::core::MetaPropertyBase::Pointer map::apps::matchR::wrapMetaProperty(const ::map::algorithm::MetaPropertyInfo* pInfo, const ::map::core::String& valueStr) { map::core::MetaPropertyBase::Pointer metaProp; - if (!pInfo) + if (pInfo == nullptr) { return metaProp; } - if (pInfo->getTypeInfo() == typeid(int)) metaProp = checkCastAndSetProp(valueStr); - else if (pInfo->getTypeInfo() == typeid(unsigned int)) metaProp = checkCastAndSetProp(valueStr); - else if (pInfo->getTypeInfo() == typeid(long)) metaProp = checkCastAndSetProp(valueStr); - else if (pInfo->getTypeInfo() == typeid(unsigned long)) metaProp = checkCastAndSetProp(valueStr); - else if (pInfo->getTypeInfo() == typeid(float)) metaProp = checkCastAndSetProp(valueStr); - else if (pInfo->getTypeInfo() == typeid(double)) metaProp = checkCastAndSetProp(valueStr); - else if (pInfo->getTypeInfo() == typeid(::itk::Array)) metaProp = checkCastAndSetProp< ::itk::Array >(valueStr); - else if (pInfo->getTypeInfo() == typeid(::map::core::String)) + if (pInfo->getTypeInfo() == typeid(int)) { metaProp = checkCastAndSetProp(valueStr); + } else if (pInfo->getTypeInfo() == typeid(unsigned int)) { metaProp = checkCastAndSetProp(valueStr); + } else if (pInfo->getTypeInfo() == typeid(long)) { metaProp = checkCastAndSetProp(valueStr); + } else if (pInfo->getTypeInfo() == typeid(unsigned long)) { metaProp = checkCastAndSetProp(valueStr); + } else if (pInfo->getTypeInfo() == typeid(float)) { metaProp = checkCastAndSetProp(valueStr); + } else if (pInfo->getTypeInfo() == typeid(double)) { metaProp = checkCastAndSetProp(valueStr); + } else if (pInfo->getTypeInfo() == typeid(::itk::Array)) { metaProp = checkCastAndSetProp< ::itk::Array >(valueStr); + } else if (pInfo->getTypeInfo() == typeid(::map::core::String)) { metaProp = map::core::MetaProperty::New(valueStr).GetPointer(); } return metaProp; }; diff --git a/Code/Algorithms/Common/boxed/mapDummyRegistrationAlgorithm.h b/Code/Algorithms/Common/boxed/mapDummyRegistrationAlgorithm.h index cf481a6..458b90f 100644 --- a/Code/Algorithms/Common/boxed/mapDummyRegistrationAlgorithm.h +++ b/Code/Algorithms/Common/boxed/mapDummyRegistrationAlgorithm.h @@ -1,134 +1,134 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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: 797 $ (last changed revision) // @date $Date: 2014-10-10 11:42:05 +0200 (Fr, 10 Okt 2014) $ (last change date) // @author $Author: floca $ (last changed by) // Subversion HeadURL: $HeadURL: https://svn/sbr/Sources/SBR-Projects/MatchPoint/trunk/Code/Algorithms/Common/boxed/mapDummyRegistrationAlgorithm.h $ */ #ifndef __DUMMY_REGISTRATION_ALGORITHM_H #define __DUMMY_REGISTRATION_ALGORITHM_H #include "mapContinuous.h" #include "mapAnalyticAlgorithmInterface.h" #include "mapRegistrationAlgorithm.h" /*! @namespace map The namespace map is used throughout the MatchPoint project to mark code as components of this project */ namespace map { namespace algorithm { namespace boxed { mapGenerateAlgorithmUIDPolicyMacro(DummyRegIDPolicy, "de.dkfz.matchpoint", "Identity", "1.0.0", ""); } /*! @class DummyRegistrationAlgorithm @brief This is a simple registration algorithm that does nothing (and does not even have data input slots). The algorithm determines a registration that has an identity transform. You may see this algorithm as a generation functor for identity registrations. This class can be used for testing purposes. @ingroup Boxed */ template < unsigned int VDimension, class TIdentificationPolicy = boxed::DummyRegIDPolicy > class DummyRegistrationAlgorithm : public facet::AnalyticAlgorithmInterface, public RegistrationAlgorithm, public TIdentificationPolicy { public: typedef DummyRegistrationAlgorithm Self; typedef RegistrationAlgorithm Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(DummyRegistrationAlgorithm, RegistrationAlgorithm); mapNewAlgorithmMacro(Self); - typedef TIdentificationPolicy IdentificationPolicyType; - typedef typename Superclass::FieldRepRequirement FieldRepRequirement; - typedef typename Superclass::UIDPointer UIDPointer; - typedef typename Superclass::AlgorithmType AlgorithmType; - typedef typename Superclass::RegistrationType RegistrationType; - typedef typename Superclass::RegistrationPointer RegistrationPointer; + using IdentificationPolicyType = TIdentificationPolicy; + using FieldRepRequirement = typename Superclass::FieldRepRequirement; + using UIDPointer = typename Superclass::UIDPointer; + using AlgorithmType = typename Superclass::AlgorithmType; + using RegistrationType = typename Superclass::RegistrationType; + using RegistrationPointer = typename Superclass::RegistrationPointer; mapDefineAlgorithmIdentificationByPolicyMacro; /*! @brief Returns the algorithm type for this registration algorithm @eguarantee strong @return The algorithm type */ - virtual AlgorithmType getAlgorithmType() const; + AlgorithmType getAlgorithmType() const override; - virtual typename FieldRepRequirement::Type isMovingRepresentationRequired() const; + typename FieldRepRequirement::Type isMovingRepresentationRequired() const override; - virtual typename FieldRepRequirement::Type isTargetRepresentationRequired() const; + typename FieldRepRequirement::Type isTargetRepresentationRequired() const override; - virtual bool isReusable() const; + bool isReusable() const override; protected: DummyRegistrationAlgorithm(); - virtual ~DummyRegistrationAlgorithm(); + ~DummyRegistrationAlgorithm() override; - virtual void configureAlgorithm(); + void configureAlgorithm() override; /*! @brief starts the computation of the registration @eguarantee strong @return Indicates if the registration was successfully determined (e.g. could be false if an iterative algorithm was stopped prematurely by the user). */ - virtual bool doDetermineRegistration(); + bool doDetermineRegistration() override; /*! * Returns the final registration @eguarantee strong */ - virtual RegistrationPointer doGetRegistration() const; + RegistrationPointer doGetRegistration() const override; /*! Returns if the registration should be computed. The registration is outdated if doGetRegistration returns null * or the modification times of at least one policy is newer then the modification time of the registration. @eguarantee strong @return true if the registration should be (re)computed. False if the registration is uptodate. */ - virtual bool registrationIsOutdated() const; + bool registrationIsOutdated() const override; /*! Methods invoked by derived classes. */ - virtual void PrintSelf(std::ostream& os, ::itk::Indent indent) const; + void PrintSelf(std::ostream& os, ::itk::Indent indent) const override; private: RegistrationPointer _spFinalizedRegistration; - DummyRegistrationAlgorithm(const Self& source); - void operator=(const Self&); //purposely not implemented + DummyRegistrationAlgorithm(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; - } -} + } // namespace algorithm +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapDummyRegistrationAlgorithm.tpp" #endif #endif diff --git a/Code/Algorithms/Common/boxed/mapDummyRegistrationAlgorithm.tpp b/Code/Algorithms/Common/boxed/mapDummyRegistrationAlgorithm.tpp index 00142f3..2d427ea 100644 --- a/Code/Algorithms/Common/boxed/mapDummyRegistrationAlgorithm.tpp +++ b/Code/Algorithms/Common/boxed/mapDummyRegistrationAlgorithm.tpp @@ -1,160 +1,157 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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: 901 $ (last changed revision) // @date $Date: 2015-03-04 17:45:27 +0100 (Mi, 04 Mrz 2015) $ (last change date) // @author $Author: floca $ (last changed by) // Subversion HeadURL: $HeadURL: https://svn/sbr/Sources/SBR-Projects/MatchPoint/trunk/Code/Algorithms/Common/boxed/mapDummyRegistrationAlgorithm.tpp $ */ #ifndef __DUMMY_IMAGE_REGISTRATION_ALGORITHM_TPP #define __DUMMY_IMAGE_REGISTRATION_ALGORITHM_TPP #include #include "mapAlgorithmException.h" #include "mapPreCachedRegistrationKernel.h" #include "mapRegistrationManipulator.h" namespace map { namespace algorithm { template typename DummyRegistrationAlgorithm::FieldRepRequirement::Type DummyRegistrationAlgorithm:: isMovingRepresentationRequired() const { return FieldRepRequirement::No; }; template typename DummyRegistrationAlgorithm::FieldRepRequirement::Type DummyRegistrationAlgorithm:: isTargetRepresentationRequired() const { return FieldRepRequirement::No; }; template typename DummyRegistrationAlgorithm::AlgorithmType DummyRegistrationAlgorithm:: getAlgorithmType() const { return Superclass::ATAnalytic; }; template DummyRegistrationAlgorithm:: DummyRegistrationAlgorithm() - { - - }; + = default; template DummyRegistrationAlgorithm:: ~DummyRegistrationAlgorithm() - { - }; + = default; template bool DummyRegistrationAlgorithm:: isReusable() const { return true; }; template void DummyRegistrationAlgorithm:: configureAlgorithm() { }; template typename DummyRegistrationAlgorithm::RegistrationPointer DummyRegistrationAlgorithm:: doGetRegistration() const { return _spFinalizedRegistration; }; template bool DummyRegistrationAlgorithm:: doDetermineRegistration() { - RegistrationPointer spResult = NULL; + RegistrationPointer spResult = nullptr; typedef ::itk::AffineTransform< ::map::core::continuous::ScalarType, VDimension> TransformModelType; typename TransformModelType::Pointer spFinalTransformModel = TransformModelType::New(); spFinalTransformModel->SetIdentity(); //now build the inverse kernel (main kernel of a image based registration algorithm) typedef core::PreCachedRegistrationKernel InverseKernelType; typedef core::PreCachedRegistrationKernel DirectKernelType; typename InverseKernelType::Pointer spIKernel = InverseKernelType::New(); spIKernel->setTransformModel(spFinalTransformModel); typename DirectKernelType::Pointer spDKernel = DirectKernelType::New(); spDKernel->setTransformModel(spFinalTransformModel); //now create the registration an set the kernels spResult = RegistrationType::New(); ::map::core::RegistrationManipulator manipulator(spResult); manipulator.setDirectMapping(spDKernel); manipulator.setInverseMapping(spIKernel); manipulator.getTagValues()[tags::AlgorithmUID] = this->getUID()->toStr(); _spFinalizedRegistration = spResult; return true; }; template bool DummyRegistrationAlgorithm:: registrationIsOutdated() const { bool outdated = _spFinalizedRegistration.IsNull(); return outdated; }; template void DummyRegistrationAlgorithm:: PrintSelf(std::ostream& os, ::itk::Indent indent) const { Superclass::PrintSelf(os, indent); }; } // end namespace algorithm } // end namespace map #endif diff --git a/Code/Algorithms/Common/include/mapAlgorithmEvents.h b/Code/Algorithms/Common/include/mapAlgorithmEvents.h index 13605b2..c710974 100644 --- a/Code/Algorithms/Common/include/mapAlgorithmEvents.h +++ b/Code/Algorithms/Common/include/mapAlgorithmEvents.h @@ -1,132 +1,132 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_ALGORITHM_EVENTS_H #define __MAP_ALGORITHM_EVENTS_H #include "mapEvents.h" #include "mapMAPAlgorithmsExports.h" namespace map { namespace events { /*! @def mapEventMacro * Helper macro that creates events objects for map. */ #define mapAlgorithmEventMacro( classname , super ) \ /*! @ingroup Events */ \ class MAPAlgorithms_EXPORT classname : public super { \ public: \ typedef classname Self; \ typedef super Superclass; \ classname(void* pData = NULL, const std::string& comment = ""): Superclass(pData, comment) {}\ virtual ~classname() {} \ virtual const char * GetEventName() const { return #classname; } \ virtual bool CheckEvent(const ::itk::EventObject* e) const \ { return dynamic_cast(e); } \ virtual ::itk::EventObject* MakeObject() const \ { return new Self(*this); } \ classname(const Self& s) : Superclass(s) {}; \ private: \ void operator=(const Self&); \ } /*!@class AlgorithmEvent * @brief General/base event concering an algorithm or its processing. * @ingroup Events */ mapAlgorithmEventMacro(AlgorithmEvent, AnyMatchPointEvent); /*!@class AlgorithmIterationEvent * @brief Event is invoked when an algorithm iterates * @ingroup Events */ mapAlgorithmEventMacro(AlgorithmIterationEvent, AlgorithmEvent); /*!@class AlgorithmResolutionLevelEvent * @brief Event is invoked when an algorithm starts a new resolution level * @ingroup Events */ mapAlgorithmEventMacro(AlgorithmResolutionLevelEvent, AlgorithmEvent); /*!@class InitializingAlgorithmEvent * @brief Event is invoked when an algorithm initializes * @ingroup Events */ mapAlgorithmEventMacro(InitializingAlgorithmEvent, AlgorithmEvent); /*!@class StartingAlgorithmEvent * @brief Event is invoked when an algorithm starting to determin its results (e.g. finding a proper registration) * @ingroup Events */ mapAlgorithmEventMacro(StartingAlgorithmEvent, AlgorithmEvent); /*!@class StoppingAlgorithmEvent * @brief Event is invoked when an algorithm is about to being stopped (e.g. by user interaction) * @ingroup Events */ mapAlgorithmEventMacro(StoppingAlgorithmEvent, AlgorithmEvent); /*!@class StoppedAlgorithmEvent * @brief Event is invoked when an algorithm is stopped but has no final results * @ingroup Events */ mapAlgorithmEventMacro(StoppedAlgorithmEvent, AlgorithmEvent); /*!@class FinalizingAlgorithmEvent * @brief Event is invoked when an algorithm finalizes its results (e.g. calculating the transformatino field) * @ingroup Events */ mapAlgorithmEventMacro(FinalizingAlgorithmEvent, AlgorithmEvent); /*!@class FinalizedAlgorithmEvent * @brief Event is invoked when an algorithm is finalized and has results * @ingroup Events */ mapAlgorithmEventMacro(FinalizedAlgorithmEvent, AlgorithmEvent); /*!@class RegisterAlgorithmComponentEvent * @brief Event is invoked by algorithms policy, if the policy registers a new component * (e.g. ArbitraryTransformPolicy sets a new transform model, then the policy will invoke this event * to inform the class that uses the policy about the now model.) * @remark this event is normaly used internally and is not propergated outside of an algorithm. * @ingroup InternalEvents */ mapAlgorithmEventMacro(RegisterAlgorithmComponentEvent, AlgorithmEvent); /*!@class UnregisterAlgorithmComponentEvent * @brief Event is invoked by algorithms policy, if the policy unregisters the its current component * (e.g. ArbitraryTransformPolicy sets a new transform model, then the policy will invoke this event * to inform the class, that uses the policy about, that the current component will be outdated.) * @remark this event is normaly used internally and is not propergated outside of an algorithm. * @ingroup InternalEvents */ mapAlgorithmEventMacro(UnregisterAlgorithmComponentEvent, AlgorithmEvent); - } -} + } // namespace events +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapAlgorithmException.h b/Code/Algorithms/Common/include/mapAlgorithmException.h index 4bc981a..ca416df 100644 --- a/Code/Algorithms/Common/include/mapAlgorithmException.h +++ b/Code/Algorithms/Common/include/mapAlgorithmException.h @@ -1,80 +1,80 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_ALGORITHM_EXCEPTION_H #define __MAP_ALGORITHM_EXCEPTION_H #include "mapExceptionObject.h" #include "mapMAPAlgorithmsExports.h" namespace map { namespace algorithm { /*! @class AlgorithmException * @brief Base exception class for algorithmic exceptions used within MatchPoint. * * This is the base class for any exception that is caused by MatchPoint's own code. * @ingroup Exception */ class MAPAlgorithms_EXPORT AlgorithmException : public core::ExceptionObject { public: - typedef core::ExceptionObject Superclass; - typedef core::ExceptionObject BaseExceptionType; + using Superclass = core::ExceptionObject; + using BaseExceptionType = core::ExceptionObject; /*! Default constructor. Needed to ensure the exception object can be * copied. */ AlgorithmException(); /*! Constructor. Needed to ensure the exception object can be copied. */ AlgorithmException(const char* file, unsigned int lineNumber); /*! Constructor. Needed to ensure the exception object can be copied. */ AlgorithmException(const std::string& file, unsigned int lineNumber); /*! Constructor. Needed to ensure the exception object can be copied. */ AlgorithmException(const std::string& file, unsigned int lineNumber, const std::string& desc, const std::string& loc); /*! Virtual destructor needed for subclasses. Has to have empty throw(). */ - virtual ~AlgorithmException() throw(); + ~AlgorithmException() noexcept override; - virtual const char* GetNameOfClass() const; + const char* GetNameOfClass() const override; /*! Clones the exception object and returns a pointer to a copy of the exception object. * The cloned object is created on the heap and should function caller has to take care about * proper destruction (e.g. using auto pointer or tr1::shared_pointer). * @remark Used a plain pointer as return value in this case to ensure the no throw guarantee. * This feature is needed by some classes like MappingTaskBatch to ensure the feature of * processing tasks in multiple threads and to deal with any exception after joining the threads * and every task is processed (or failed through an exception). * @return Pointer to the cloned exception. If the cloning fails for any reason the return is NULL. * @eguarantee no throw*/ - virtual BaseExceptionType* clone() const throw(); + BaseExceptionType* clone() const noexcept override; }; } // end namespace algorithm } // end namespace map #endif diff --git a/Code/Algorithms/Common/include/mapAlgorithmIdentificationInterface.h b/Code/Algorithms/Common/include/mapAlgorithmIdentificationInterface.h index 8cf4460..d87a5f7 100644 --- a/Code/Algorithms/Common/include/mapAlgorithmIdentificationInterface.h +++ b/Code/Algorithms/Common/include/mapAlgorithmIdentificationInterface.h @@ -1,146 +1,146 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ALGORITHM_IDENTIFICATION_INTERFACE_H #define __ALGORITHM_IDENTIFICATION_INTERFACE_H #include "mapUID.h" #include "mapAlgorithmProfileHelper.h" #include "mapExceptionObject.h" namespace map { namespace algorithm { namespace facet { /*! @class AlgorithmIdentificationInterface @brief This is the identification interface for any MatchPoint algorithm. A algorithm implementing this interface offers a possibility to request its unique identifier (UID).\n\n The member function getUID() can be implemented via the marcro mapDefineAlgorithmUIDMacro() or mapDefineAlgorithmUIDWithAutmaticBuildNRMacro(). Algorithms that are implemented with reboxing possibilities in mind are using UIDPolicies via templates generated by mapGenerateAlgorithmUIDPolicyMacro(). @sa mapDefineAlgorithmUIDMacro @sa mapDefineAlgorithmUIDWithAutmaticBuildNRMacro @sa mapGenerateAlgorithmUIDPolicyMacro @ingroup AlgorithmFacets UID */ class AlgorithmIdentificationInterface { public: - typedef AlgorithmIdentificationInterface Self; + using Self = AlgorithmIdentificationInterface; - typedef algorithm::UID UIDType; - typedef UIDType::Pointer UIDPointer; + using UIDType = algorithm::UID; + using UIDPointer = UIDType::Pointer; /*! Returns the unique ID (UID) of the algorithm. @remark The same information may also be defined in the profile string (getAlgorithmProfile()). But this is a convinient access to this information. @eguarantee strong @return returns SmartPointer to the UID object. */ virtual UIDPointer getUID() const = 0; /*! Returns the profile string of the algorithm. The string contains within a xml structure all general given informations (e.g. supported dimensions, description, used transform model, ...). Use AlgorithmProfileHelper to parse the profile string. @eguarantee strong */ virtual ::map::core::String getAlgorithmProfile() const = 0; /*! Returns the description string of the algorithm. @remark The same information may also be defined in the profile string (getAlgorithmProfile()). But this is a convinient access to this information. @eguarantee strong */ virtual ::map::core::String getAlgorithmDescription() const = 0; protected: - AlgorithmIdentificationInterface() {}; - virtual ~AlgorithmIdentificationInterface() {}; + AlgorithmIdentificationInterface() = default; + virtual ~AlgorithmIdentificationInterface() = default; private: //No copy constructor allowed - AlgorithmIdentificationInterface(const Self& source); //purposely not implemented - void operator=(const Self&); //purposely not implemented + AlgorithmIdentificationInterface(const Self& source) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map /*! Helper macro that implements the abstract functions of a AlgorithmIdentificationInterface. The macro assumes that the algorithm class is a Policy class (like the ones generated by mapGenerateAlgorithmUIDPolicyMacro) as an ancestor class.*/ #define mapDefineAlgorithmIdentificationByPolicyMacro \ virtual ::map::algorithm::UID::Pointer getUID() const \ { \ return this->UID();\ }\ virtual ::map::core::String getAlgorithmProfile() const\ { \ return this->AlgorithmProfile();\ }\ virtual ::map::core::String getAlgorithmDescription() const\ {\ return this->AlgorithmDescription();\ } /*! Helper macro that generates a policy struct used by algorithm templates (e.g. ITKImageRegistrationAlgorithm) * to specify the algorithm UID, profile and description. * Algorithms, that are specified by using the CMake macro (MAP_DEFINE_DEPLOYED_ALGORITHM) provided by MatchPoint, * generate fitting UIDPolicies automatically (see all deployed algorithms in the MatchPoint release). * For any other algorithms this macro can be used to generate a suitable policy. * @param policyName Name of the policy structure that should be generated. * @param ns Namespace of the algorithm (part of the algorithm UID; should be a string) * @param name Name of the algorithm (part of the algorithm UID; should be a string) * @param version Version of the algorithm (part of the algorithm UID; should be a string) * @param profileStr Profile string of the algorithm (xml encoded profile). */ #define mapGenerateAlgorithmUIDPolicyMacro(policyName, ns, name, version, profileStr) \ struct policyName\ {\ public:\ static ::map::algorithm::UID::Pointer UID()\ {\ ::map::core::OStringStream stream;\ stream << __DATE__ << " " << __TIME__ << "; MAP "< ValueListType; + using ValueListType = std::vector< ::map::core::String>; /** Helper function that takes an algorithm profile string and converts it into structuredData * elements. * @return Pointer to the root element of the profile (Tag: Profile). If an invalid or empty string is passed, * the result will be a NULL pointer.*/ MAPAlgorithms_EXPORT structuredData::Element::Pointer parseProfileString( const core::String& profileStr); /** Helper function that extracts the description from a profile. * @param profileRoot Pointer to the root element of the profile (e.g. generated by parseProfileString). * @return Description string, may be empty if profileRoot is invalid or does not contain a description.*/ - MAPAlgorithms_EXPORT const ::map::core::String getDescription(const structuredData::Element* + MAPAlgorithms_EXPORT ::map::core::String getDescription(const structuredData::Element* profileRoot); /** Helper function that extracts the description from a profile. * @overload Convenience version where you can directly insert the profileStr. * @return Description string, may be empty if profileStr does not contain a description.*/ - MAPAlgorithms_EXPORT const ::map::core::String getDescription(const core::String& profileStr); + MAPAlgorithms_EXPORT ::map::core::String getDescription(const core::String& profileStr); /** Helper function that extracts the contact(s) from a profile. * @param profileRoot Pointer to the root element of the profile (e.g. generated by parseProfileString). * @return List may be empty if profileRoot is invalid or does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getContact(const structuredData::Element* profileRoot); /** Helper function that extracts the contact(s) from a profile. * @overload Convenience version where you can directly insert the profileStr. * @return List may be empty if profileStr does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getContact(const core::String& profileStr); /** Helper function that extracts the terms from a profile. * @param profileRoot Pointer to the root element of the profile (e.g. generated by parseProfileString). * @param terms String containing the information. * @return Indicates if terms where found in the profile.*/ MAPAlgorithms_EXPORT bool getTerms(const structuredData::Element* profileRoot, ::map::core::String& terms); /** Helper function that extracts the terms from a profile. * @overload Convenience version where you can directly insert the profileStr. * @param terms String containing the information. * @return Indicates if terms where found in the profile.*/ MAPAlgorithms_EXPORT bool getTerms(const core::String& profileStr, ::map::core::String& terms); /** Helper function that extracts the citation(s) from a profile. * @param profileRoot Pointer to the root element of the profile (e.g. generated by parseProfileString). * @return List may be empty if profileRoot is invalid or does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getCitation(const structuredData::Element* profileRoot); /** Helper function that extracts the citation(s) from a profile. * @overload Convenience version where you can directly insert the profileStr. * @return List may be empty if profileStr does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getCitation(const core::String& profileStr); /** Helper function that extracts the supported data type(s) from a profile. * @param profileRoot Pointer to the root element of the profile (e.g. generated by parseProfileString). * @return List may be empty if profileRoot is invalid or does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getDataType(const structuredData::Element* profileRoot); /** Helper function that extracts the supported data type(s) from a profile. * @overload Convenience version where you can directly insert the profileStr. * @return List may be empty if profileStr does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getDataType(const core::String& profileStr); /** Helper function that extracts the computation style from a profile. * @param profileRoot Pointer to the root element of the profile (e.g. generated by parseProfileString). * @return List may be empty if profileRoot is invalid or does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getComputationStyle(const structuredData::Element* profileRoot); /** Helper function that extracts the computation style from a profile. * @overload Convenience version where you can directly insert the profileStr. * @return List may be empty if profileStr does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getComputationStyle(const core::String& profileStr); /** Helper function that extracts the (multi) resolution style/approach from a profile. * @param profileRoot Pointer to the root element of the profile (e.g. generated by parseProfileString). * @return List may be empty if profileRoot is invalid or does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getResolutionStyle(const structuredData::Element* profileRoot); /** Helper function that extracts the (multi) resolution style/approach from a profile. * @overload Convenience version where you can directly insert the profileStr. * @return List may be empty if profileStr does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getResolutionStyle(const core::String& profileStr); /** Helper function that extracts the algorithm's moving dimensions from a profile. * @param profileRoot Pointer to the root element of the profile (e.g. generated by parseProfileString). * @param dims parameter containing the information. * @return Indicates if terms where found in the profile.*/ MAPAlgorithms_EXPORT bool getMovingDimensions(const structuredData::Element* profileRoot, unsigned int& dims); /** Helper function that extracts the algorithm's moving dimensions from a profile. * @overload Convenience version where you can directly insert the profileStr. * @param dims parameter containing the information. * @return Indicates if terms where found in the profile.*/ MAPAlgorithms_EXPORT bool getMovingDimensions(const core::String& profileStr, unsigned int& dims); /** Helper function that extracts the moving modality/modalities from a profile. * @param profileRoot Pointer to the root element of the profile (e.g. generated by parseProfileString). * @return List may be empty if profileRoot is invalid or does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getMovingModality(const structuredData::Element* profileRoot); /** Helper function that extracts the moving modality/modalities from a profile. * @overload Convenience version where you can directly insert the profileStr. * @return List may be empty if profileStr does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getMovingModality(const core::String& profileStr); /** Helper function that extracts the algorithm's moving dimensions from a profile. * @param profileRoot Pointer to the root element of the profile (e.g. generated by parseProfileString). * @param dims parameter containing the information. * @return Indicates if terms where found in the profile.*/ MAPAlgorithms_EXPORT bool getTargetDimensions(const structuredData::Element* profileRoot, unsigned int& dims); /** Helper function that extracts the algorithm's target dimensions from a profile. * @overload Convenience version where you can directly insert the profileStr. * @param dims parameter containing the information. * @return Indicates if terms where found in the profile.*/ MAPAlgorithms_EXPORT bool getTargetDimensions(const core::String& profileStr, unsigned int& dims); /** Helper function that extracts the target modality/modalities from a profile. * @param profileRoot Pointer to the root element of the profile (e.g. generated by parseProfileString). * @return List may be empty if profileRoot is invalid or does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getTargetModality(const structuredData::Element* profileRoot); /** Helper function that extracts the target modality/modalities from a profile. * @overload Convenience version where you can directly insert the profileStr. * @return List may be empty if profileStr does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getTargetModality(const core::String& profileStr); /** Helper function that extracts the algorithm's object(s) (e.g. lung) from a profile. * @param profileRoot Pointer to the root element of the profile (e.g. generated by parseProfileString). * @return List may be empty if profileRoot is invalid or does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getObject(const structuredData::Element* profileRoot); /** Helper function that extracts the algorithm's object(s) (e.g. lung) from a profile. * @overload Convenience version where you can directly insert the profileStr. * @return List may be empty if profileStr does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getObject(const core::String& profileStr); /** Helper function that extracts the algorithm's subject(s) (e.g. intra personal) from a profile. * @param profileRoot Pointer to the root element of the profile (e.g. generated by parseProfileString). * @return List may be empty if profileRoot is invalid or does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getSubject(const structuredData::Element* profileRoot); /** Helper function that extracts the algorithm's subject(s) (e.g. intra personal) from a profile. * @overload Convenience version where you can directly insert the profileStr. * @return List may be empty if profileStr does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getSubject(const core::String& profileStr); /** Helper function that extracts the algorithm's transform models(s) from a profile. * @param profileRoot Pointer to the root element of the profile (e.g. generated by parseProfileString). * @return List may be empty if profileRoot is invalid or does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getTransformModel(const structuredData::Element* profileRoot); /** Helper function that extracts the algorithm's transform models(s) from a profile. * @overload Convenience version where you can directly insert the profileStr. * @return List may be empty if profileStr does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getTransformModel(const core::String& profileStr); /** Helper function that extracts the algorithm's transform domain (e.g. global; in different stages) from a profile. * @param profileRoot Pointer to the root element of the profile (e.g. generated by parseProfileString). * @return List may be empty if profileRoot is invalid or does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getTransformDomain(const structuredData::Element* profileRoot); /** Helper function that extracts the algorithm's transform domain (e.g. global; in different stages) from a profile. * @overload Convenience version where you can directly insert the profileStr. * @return List may be empty if profileStr does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getTransformDomain(const core::String& profileStr); /** Helper function that extracts the algorithm's metrics(s) from a profile. * @param profileRoot Pointer to the root element of the profile (e.g. generated by parseProfileString). * @return List may be empty if profileRoot is invalid or does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getMetric(const structuredData::Element* profileRoot); /** Helper function that extracts the algorithm's metrics(s) from a profile. * @overload Convenience version where you can directly insert the profileStr. * @return List may be empty if profileStr does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getMetric(const core::String& profileStr); /** Helper function that extracts the algorithm's optimization(s) from a profile. * @param profileRoot Pointer to the root element of the profile (e.g. generated by parseProfileString). * @return List may be empty if profileRoot is invalid or does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getOptimization(const structuredData::Element* profileRoot); /** Helper function that extracts the algorithm's optimization(s) from a profile. * @overload Convenience version where you can directly insert the profileStr. * @return List may be empty if profileStr does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getOptimization(const core::String& profileStr); /** Helper function that extracts the algorithm's keyword(s) from a profile. * @param profileRoot Pointer to the root element of the profile (e.g. generated by parseProfileString). * @return List may be empty if profileRoot is invalid or does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getKeywords(const structuredData::Element* profileRoot); /** Helper function that extracts the algorithm's keyword(s) from a profile. * @overload Convenience version where you can directly insert the profileStr. * @return List may be empty if profileStr does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getKeywords(const core::String& profileStr); /** Helper function that extracts the algorithm's interaction schema/schemes from a profile. * @param profileRoot Pointer to the root element of the profile (e.g. generated by parseProfileString). * @return List may be empty if profileRoot is invalid or does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getInteraction(const structuredData::Element* profileRoot); /** Helper function that extracts the algorithm's interaction schema/schemes from a profile. * @overload Convenience version where you can directly insert the profileStr. * @return List may be empty if profileStr does not contain any information.*/ MAPAlgorithms_EXPORT ValueListType getInteraction(const core::String& profileStr); /** Helper function that extracts if the algorithm is deterministic from a profile. * @param profileRoot Pointer to the root element of the profile (e.g. generated by parseProfileString).*/ MAPAlgorithms_EXPORT bool isDeterministic(const structuredData::Element* profileRoot); /** Helper function that extracts if the algorithm is deterministic from a profile. * @overload Convenience version where you can directly insert the profileStr.*/ MAPAlgorithms_EXPORT bool isDeterministic(const core::String& profileStr); - } - } -} + } // namespace profile + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapAlgorithmStateChangeEvent.h b/Code/Algorithms/Common/include/mapAlgorithmStateChangeEvent.h index d03f0be..1dde2f3 100644 --- a/Code/Algorithms/Common/include/mapAlgorithmStateChangeEvent.h +++ b/Code/Algorithms/Common/include/mapAlgorithmStateChangeEvent.h @@ -1,72 +1,72 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_ALGORITHM_STATE_CHANGE_EVENTS_H #define __MAP_ALGORITHM_STATE_CHANGE_EVENTS_H #include "mapAlgorithmEvents.h" #include "mapRegistrationAlgorithmBase.h" #include "mapMAPAlgorithmsExports.h" namespace map { namespace events { /*! @class AlgorithmStateChangeEvent * @ingroup Events*/ class MAPAlgorithms_EXPORT AlgorithmStateChangeEvent : public AlgorithmEvent { public: - typedef AlgorithmStateChangeEvent Self; - typedef AlgorithmEvent Superclass; - typedef algorithm::RegistrationAlgorithmBase::AlgorithmState::Type AlgorithmStateType; + using Self = AlgorithmStateChangeEvent; + using Superclass = AlgorithmEvent; + using AlgorithmStateType = algorithm::RegistrationAlgorithmBase::AlgorithmState::Type; AlgorithmStateChangeEvent(const AlgorithmStateType& oldState = algorithm::RegistrationAlgorithmBase::AlgorithmState::Pending, const AlgorithmStateType& newState = algorithm::RegistrationAlgorithmBase::AlgorithmState::Pending); - virtual ~AlgorithmStateChangeEvent(); + ~AlgorithmStateChangeEvent() override; - virtual const char* GetEventName() const; + const char* GetEventName() const override; - virtual bool CheckEvent(const ::itk::EventObject* e) const; + bool CheckEvent(const ::itk::EventObject* e) const override; - virtual ::itk::EventObject* MakeObject() const; + ::itk::EventObject* MakeObject() const override; AlgorithmStateChangeEvent(const Self& s); AlgorithmStateType getOldState() const; AlgorithmStateType getNewState() const; - virtual void Print(std::ostream& os) const; + void Print(std::ostream& os) const override; private: AlgorithmStateType _oldState; AlgorithmStateType _newState; - void operator=(const Self&); + void operator=(const Self&) = delete; }; - } -} + } // namespace events +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapAlgorithmWrapperEvent.h b/Code/Algorithms/Common/include/mapAlgorithmWrapperEvent.h index bdc232a..ce11e76 100644 --- a/Code/Algorithms/Common/include/mapAlgorithmWrapperEvent.h +++ b/Code/Algorithms/Common/include/mapAlgorithmWrapperEvent.h @@ -1,73 +1,73 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_ALGORITHM_WRAPPER_EVENT_H #define __MAP_ALGORITHM_WRAPPER_EVENT_H #include "mapAlgorithmEvents.h" #include "itkObject.h" namespace map { namespace events { /*! @class AlgorithmWrapperEvent * @ingroup Events*/ class MAPAlgorithms_EXPORT AlgorithmWrapperEvent : public AlgorithmEvent { public: - typedef AlgorithmWrapperEvent Self; - typedef AlgorithmEvent Superclass; + using Self = AlgorithmWrapperEvent; + using Superclass = AlgorithmEvent; - AlgorithmWrapperEvent(const ::itk::EventObject& wrappedEvent, ::itk::Object* wrappedCaller = NULL, + AlgorithmWrapperEvent(const ::itk::EventObject& wrappedEvent, ::itk::Object* wrappedCaller = nullptr, const std::string& comment = ""); - virtual ~AlgorithmWrapperEvent(); + ~AlgorithmWrapperEvent() override; - virtual const char* GetEventName() const; + const char* GetEventName() const override; - virtual bool CheckEvent(const ::itk::EventObject* e) const; + bool CheckEvent(const ::itk::EventObject* e) const override; - virtual ::itk::EventObject* MakeObject() const; + ::itk::EventObject* MakeObject() const override; AlgorithmWrapperEvent(const Self& s); ::itk::EventObject& getWrappedEvent() const; ::itk::Object* getWrappedCaller() const; - virtual void Print(std::ostream& os) const; + void Print(std::ostream& os) const override; private: ::itk::Object* _pWrappedCaller; ::itk::EventObject* _pWrappedEvent; std::string _cachedEventName; - void operator=(const Self&); + void operator=(const Self&) = delete; }; - } -} + } // namespace events +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapAnalyticAlgorithmInterface.h b/Code/Algorithms/Common/include/mapAnalyticAlgorithmInterface.h index b13af8c..850349a 100644 --- a/Code/Algorithms/Common/include/mapAnalyticAlgorithmInterface.h +++ b/Code/Algorithms/Common/include/mapAnalyticAlgorithmInterface.h @@ -1,63 +1,63 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ANALYTIC_ALGORITHM_INTERFACE_H #define __ANALYTIC_ALGORITHM_INTERFACE_H /*! @namespace map The namespace map is used throughout the MatchPoint project to mark code as components of this project */ namespace map { namespace algorithm { namespace facet { /*! @class AnalyticAlgorithmInterface @brief This is the interface for analytic algorithms (not iterative) @ingroup AlgorithmFacets */ class AnalyticAlgorithmInterface { public: - typedef AnalyticAlgorithmInterface Self; + using Self = AnalyticAlgorithmInterface; protected: - AnalyticAlgorithmInterface() {}; - virtual ~AnalyticAlgorithmInterface() {}; + AnalyticAlgorithmInterface() = default; + virtual ~AnalyticAlgorithmInterface() = default; private: //No copy constructor allowed - AnalyticAlgorithmInterface(const Self& source); - void operator=(const Self&); //purposely not implemented + AnalyticAlgorithmInterface(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapArbitraryImagePyramidesPolicy.h b/Code/Algorithms/Common/include/mapArbitraryImagePyramidesPolicy.h index 4713595..f900e54 100644 --- a/Code/Algorithms/Common/include/mapArbitraryImagePyramidesPolicy.h +++ b/Code/Algorithms/Common/include/mapArbitraryImagePyramidesPolicy.h @@ -1,185 +1,185 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ARBITRARY_IMAGE_PYRAMIDE_POLICY_H #define __ARBITRARY_IMAGE_PYRAMIDE_POLICY_H #include "mapContinuous.h" #include "mapImagePyramidesSetterInterface.h" #include "mapImagePyramidesGetterInterface.h" #include "mapModificationTimeValidator.h" #include "itkCommand.h" namespace map { namespace algorithm { /*! @class ArbitraryImagePyramidesPolicy @brief class for ArbitraryImagePyramidesPolicy. This class is a ArbitraryImagePyramidesPolicy. It is used if an algorithm implements a MultiResImageRegistrationAlgorithmBase and you want to allow that the pyramide can be set and get arbitrarily by the user (in contrary to FixedImagePyramidePolicy). @sa FixedImagePyramidePolicy @ingroup ITKPolicies */ template class ArbitraryImagePyramidesPolicy : public facet::ImagePyramidesSetterInterface, public facet::ImagePyramidesGetterInterface { public: typedef ArbitraryImagePyramidesPolicy Self; typedef facet::ImagePyramidesSetterInterface Superclass; - typedef TMovingImage MovingImageType; - typedef TTargetImage TargetImageType; + using MovingImageType = TMovingImage; + using TargetImageType = TTargetImage; itkTypeMacroNoParent(ArbitraryImagePyramidesPolicy); /** Type of the image multiresolution pyramids. */ - typedef typename Superclass::TargetImagePyramideBaseType TargetImagePyramideBaseType; - typedef typename Superclass::TargetImagePyramideBasePointer TargetImagePyramideBasePointer; - typedef typename Superclass::MovingImagePyramideBaseType MovingImagePyramideBaseType; - typedef typename Superclass::MovingImagePyramideBasePointer MovingImagePyramideBasePointer; + using TargetImagePyramideBaseType = typename Superclass::TargetImagePyramideBaseType; + using TargetImagePyramideBasePointer = typename Superclass::TargetImagePyramideBasePointer; + using MovingImagePyramideBaseType = typename Superclass::MovingImagePyramideBaseType; + using MovingImagePyramideBasePointer = typename Superclass::MovingImagePyramideBasePointer; /*! @brief sets the moving image pyramide @eguarantee strong @param pMovingMask a pointer to the moving image pyramide */ virtual void setMovingImagePyramide(MovingImagePyramideBaseType* pMovingPyramide); /*! @brief sets the target image pyramide @eguarantee strong @param pTargetMask a pointer to the moving image pyramide */ virtual void setTargetImagePyramide(TargetImagePyramideBaseType* pTargetPyramide); /*! @brief gets a pointer to the moving image pyramide @eguarantee strong @return a pointer to the moving image pyramide */ virtual MovingImagePyramideBaseType* getMovingImagePyramide(); /*! @brief gets a const pointer to the moving image pyramide @eguarantee strong @return a const pointer to the moving image pyramide */ virtual const MovingImagePyramideBaseType* getMovingImagePyramide() const; /*! @brief gets a pointer to the target image pyramide @eguarantee strong @return a pointer to the target image pyramide */ virtual TargetImagePyramideBaseType* getTargetImagePyramide(); /*! @brief gets a const pointer to the target image pyramide @eguarantee strong @return a const pointer to the target image pyramide */ virtual const TargetImagePyramideBaseType* getTargetImagePyramide() const; protected: ArbitraryImagePyramidesPolicy(); ~ArbitraryImagePyramidesPolicy(); /*! This is a command slot that can be used by any class derivering from this policy * to get informed if the moving pyramide instances is changed. \n * Two events will be invoked with this command: \n * - UnregisterAlgorithmComponentEvent * - RegisterAlgorithmComponentEvent * . * The first one is used when the current pyramide is going to be replaced (by setMovingImagePyramide). The event data in this case * is a void pointer to the current (soon outdated) object. The second event will be called when the new image pyramide was set * (by setMovingImagePyramide). In this case the event data is a pointer to the new pyramide.*/ ::itk::Command::Pointer _spOnChangeMoving; /*! This is a command slot that can be used by any class derivering from this policy * to get informed if the target pyramide instances is changed. \n * Two events will be invoked with this command: \n * - UnregisterAlgorithmComponentEvent * - RegisterAlgorithmComponentEvent * . * The first one is used when the current pyramide is going to be replaced (by setTargetImagePyramide). The event data in this case * is a void pointer to the current (soon outdated) object. The second event will be called when the new image pyramide was set * (by setTargetImagePyramide). In this case the event data is a pointer to the new pyramide.*/ ::itk::Command::Pointer _spOnChangeTarget; /*! gets the internal pyramides @eguarantee strong @return a pointer to an pyramide type */ virtual MovingImagePyramideBaseType* getMovingPyramideInternal(); virtual const MovingImagePyramideBaseType* getMovingPyramideInternal() const; virtual TargetImagePyramideBaseType* getTargetPyramideInternal(); virtual const TargetImagePyramideBaseType* getTargetPyramideInternal() const; /*! initializes the pyramides @eguarantee strong */ void preparePyramides(); /*! initializes the pyramides * after it was integrated in a controlling structur (e.g. registration algorithm) @eguarantee strong */ void preparePyramidesAfterAssembly(); /** Return this modified time of the target pyramide. */ unsigned long getTargetPyramideMTime() const; /** Return this modified time of the moving pyramide. */ unsigned long getMovingPyramideMTime() const; private: ::map::core::ModificationTimeValidator _movingPyramideMTime; ::map::core::ModificationTimeValidator _targetPyramideMTime; /*! The time stamp is used to signal changes of the policy that may effect the controlling structur (e.g. registration algorithm) * because the controlled object has changed.*/ MovingImagePyramideBasePointer _spMovingPyramide; /*! The time stamp is used to signal changes of the policy that may effect the controlling structur (e.g. registration algorithm) * because the controlled object has changed.*/ TargetImagePyramideBasePointer _spTargetPyramide; //No copy constructor allowed ArbitraryImagePyramidesPolicy(const Self& source); void operator=(const Self&); //purposely not implemented }; - } -} + } // namespace algorithm +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapArbitraryImagePyramidesPolicy.tpp" #endif #endif diff --git a/Code/Algorithms/Common/include/mapArbitraryImagePyramidesPolicy.tpp b/Code/Algorithms/Common/include/mapArbitraryImagePyramidesPolicy.tpp index e0dfd5a..254526f 100644 --- a/Code/Algorithms/Common/include/mapArbitraryImagePyramidesPolicy.tpp +++ b/Code/Algorithms/Common/include/mapArbitraryImagePyramidesPolicy.tpp @@ -1,205 +1,205 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapAlgorithmEvents.h" #ifndef __ARBITRARY_IMAGE_PYRAMIDE_POLICY_TPP #define __ARBITRARY_IMAGE_PYRAMIDE_POLICY_TPP namespace map { namespace algorithm { template unsigned long ArbitraryImagePyramidesPolicy:: getTargetPyramideMTime() const { unsigned long mt = _targetPyramideMTime.getMTime(); return mt; }; template unsigned long ArbitraryImagePyramidesPolicy:: getMovingPyramideMTime() const { unsigned long mt = _movingPyramideMTime.getMTime(); return mt; }; template ArbitraryImagePyramidesPolicy :: ArbitraryImagePyramidesPolicy() { } template ArbitraryImagePyramidesPolicy :: ~ArbitraryImagePyramidesPolicy() { } template typename ArbitraryImagePyramidesPolicy ::MovingImagePyramideBaseType* ArbitraryImagePyramidesPolicy :: getMovingPyramideInternal() { return _spMovingPyramide; } template const typename ArbitraryImagePyramidesPolicy ::MovingImagePyramideBaseType* ArbitraryImagePyramidesPolicy :: getMovingPyramideInternal() const { return _spMovingPyramide; } template typename ArbitraryImagePyramidesPolicy ::TargetImagePyramideBaseType* ArbitraryImagePyramidesPolicy :: getTargetPyramideInternal() { return _spTargetPyramide; } template const typename ArbitraryImagePyramidesPolicy ::TargetImagePyramideBaseType* ArbitraryImagePyramidesPolicy :: getTargetPyramideInternal() const { return _spTargetPyramide; } template typename ArbitraryImagePyramidesPolicy ::MovingImagePyramideBaseType* ArbitraryImagePyramidesPolicy :: getMovingImagePyramide() { return _spMovingPyramide; } template const typename ArbitraryImagePyramidesPolicy ::MovingImagePyramideBaseType* ArbitraryImagePyramidesPolicy :: getMovingImagePyramide() const { return _spMovingPyramide; } template typename ArbitraryImagePyramidesPolicy ::TargetImagePyramideBaseType* ArbitraryImagePyramidesPolicy :: getTargetImagePyramide() { return _spTargetPyramide; } template const typename ArbitraryImagePyramidesPolicy ::TargetImagePyramideBaseType* ArbitraryImagePyramidesPolicy :: getTargetImagePyramide() const { return _spTargetPyramide; } template void ArbitraryImagePyramidesPolicy :: setMovingImagePyramide(MovingImagePyramideBaseType* pMovingPyramide) { if (pMovingPyramide != _spMovingPyramide.GetPointer()) { //there is really the need to change if (this->_spOnChangeMoving.IsNotNull()) { ::map::events::UnregisterAlgorithmComponentEvent unRegEvent(_spMovingPyramide.GetPointer(), "Unregister current moving image pyramide"); this->_spOnChangeMoving->Execute((::itk::Object*)NULL, unRegEvent); } _movingPyramideMTime.setWatchedObject(pMovingPyramide); _spMovingPyramide = pMovingPyramide; if (this->_spOnChangeMoving.IsNotNull()) { ::map::events::RegisterAlgorithmComponentEvent regEvent(_spMovingPyramide.GetPointer(), "Register new moving image pyramide"); this->_spOnChangeMoving->Execute((::itk::Object*)NULL, regEvent); } } } template void ArbitraryImagePyramidesPolicy :: setTargetImagePyramide(TargetImagePyramideBaseType* pTargetPyramide) { if (pTargetPyramide != _spTargetPyramide.GetPointer()) { //there is really the need to change if (this->_spOnChangeTarget.IsNotNull()) { ::map::events::UnregisterAlgorithmComponentEvent unRegEvent(_spTargetPyramide.GetPointer(), "Unregister current target image pyramide"); this->_spOnChangeTarget->Execute((::itk::Object*)NULL, unRegEvent); } _targetPyramideMTime.setWatchedObject(pTargetPyramide); _spTargetPyramide = pTargetPyramide; if (this->_spOnChangeTarget.IsNotNull()) { ::map::events::RegisterAlgorithmComponentEvent regEvent(_spTargetPyramide.GetPointer(), "Register new target image pyramide"); this->_spOnChangeTarget->Execute((::itk::Object*)NULL, regEvent); } } } template void ArbitraryImagePyramidesPolicy :: preparePyramides() { //default implementation does nothing; } template void ArbitraryImagePyramidesPolicy :: preparePyramidesAfterAssembly() { //default implementation does nothing; } - } -} + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapImagePyramidesGetterInterface.h b/Code/Algorithms/Common/include/mapImagePyramidesGetterInterface.h index 0ba35ef..0078c64 100644 --- a/Code/Algorithms/Common/include/mapImagePyramidesGetterInterface.h +++ b/Code/Algorithms/Common/include/mapImagePyramidesGetterInterface.h @@ -1,103 +1,103 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __IMAGE_PYRAMIDES_GETTER_INTERFACE_H #define __IMAGE_PYRAMIDES_GETTER_INTERFACE_H #include "itkMultiResolutionPyramidImageFilter.h" namespace map { namespace algorithm { namespace facet { /*! @class ImagePyramidesGetterInterface * Interface inherited by every algorithm that is able to get image pyramides @ingroup AlgorithmFacets */ template class ImagePyramidesGetterInterface { public: typedef ImagePyramidesGetterInterface Self; - typedef TMovingImage MovingImageType; - typedef TTargetImage TargetImageType; + using MovingImageType = TMovingImage; + using TargetImageType = TTargetImage; /** Type of the Fixed image multiresolution pyramid. */ typedef ::itk::MultiResolutionPyramidImageFilter < TargetImageType, TargetImageType > TargetImagePyramideBaseType; - typedef typename TargetImagePyramideBaseType::Pointer TargetImagePyramideBasePointer; + using TargetImagePyramideBasePointer = typename TargetImagePyramideBaseType::Pointer; /** Type of the moving image multiresolution pyramid. */ typedef ::itk::MultiResolutionPyramidImageFilter < MovingImageType, MovingImageType > MovingImagePyramideBaseType; - typedef typename MovingImagePyramideBaseType::Pointer MovingImagePyramideBasePointer; + using MovingImagePyramideBasePointer = typename MovingImagePyramideBaseType::Pointer; /*! @brief gets a pointer to the moving image pyramide @eguarantee strong @return a pointer to the moving image pyramide */ virtual MovingImagePyramideBaseType* getMovingImagePyramide() = 0; /*! @brief gets a const pointer to the moving image pyramide @eguarantee strong @return a const pointer to the moving image pyramide */ virtual const MovingImagePyramideBaseType* getMovingImagePyramide() const = 0; /*! @brief gets a pointer to the target image pyramide @eguarantee strong @return a pointer to the target image pyramide */ virtual TargetImagePyramideBaseType* getTargetImagePyramide() = 0; /*! @brief gets a const pointer to the target image pyramide @eguarantee strong @return a const pointer to the target image pyramide */ virtual const TargetImagePyramideBaseType* getTargetImagePyramide() const = 0; protected: ImagePyramidesGetterInterface() {}; virtual ~ImagePyramidesGetterInterface() {}; private: //No copy constructor allowed ImagePyramidesGetterInterface(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapImagePyramidesSetterInterface.h b/Code/Algorithms/Common/include/mapImagePyramidesSetterInterface.h index 2c93e43..c8c0896 100644 --- a/Code/Algorithms/Common/include/mapImagePyramidesSetterInterface.h +++ b/Code/Algorithms/Common/include/mapImagePyramidesSetterInterface.h @@ -1,90 +1,90 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __IMAGE_PYRAMIDES_SETTER_INTERFACE_H #define __IMAGE_PYRAMIDES_SETTER_INTERFACE_H #include "itkMultiResolutionPyramidImageFilter.h" namespace map { namespace algorithm { namespace facet { /*! @class ImagePyramidesSetterInterface * Interface inherited by every algorithm that is able to set and change (by none const getter) image pyramides @ingroup AlgorithmFacets */ template class ImagePyramidesSetterInterface { public: typedef ImagePyramidesSetterInterface Self; - typedef TMovingImage MovingImageType; - typedef TTargetImage TargetImageType; + using MovingImageType = TMovingImage; + using TargetImageType = TTargetImage; /** Type of the Fixed image multiresolution pyramid. */ typedef ::itk::MultiResolutionPyramidImageFilter < TargetImageType, TargetImageType > TargetImagePyramideBaseType; - typedef typename TargetImagePyramideBaseType::Pointer TargetImagePyramideBasePointer; - typedef typename TargetImagePyramideBaseType::ConstPointer TargetImagePyramidConstPointer; + using TargetImagePyramideBasePointer = typename TargetImagePyramideBaseType::Pointer; + using TargetImagePyramidConstPointer = typename TargetImagePyramideBaseType::ConstPointer; /** Type of the moving image multiresolution pyramid. */ typedef ::itk::MultiResolutionPyramidImageFilter< MovingImageType, MovingImageType > MovingImagePyramideBaseType; - typedef typename MovingImagePyramideBaseType::Pointer MovingImagePyramideBasePointer; - typedef typename MovingImagePyramideBaseType::ConstPointer MovingImagePyramidConstPointer; + using MovingImagePyramideBasePointer = typename MovingImagePyramideBaseType::Pointer; + using MovingImagePyramidConstPointer = typename MovingImagePyramideBaseType::ConstPointer; /*! @brief sets the moving image pyramide @eguarantee strong @param pMovingMask a pointer to the moving image pyramide */ virtual void setMovingImagePyramide(MovingImagePyramideBaseType* pMovingPyramide) = 0; /*! @brief sets the target image pyramide @eguarantee strong @param pTargetMask a pointer to the moving image pyramide */ virtual void setTargetImagePyramide(TargetImagePyramideBaseType* pTargetPyramide) = 0; protected: ImagePyramidesSetterInterface() {}; virtual ~ImagePyramidesSetterInterface() {}; private: //No copy constructor allowed ImagePyramidesSetterInterface(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapImageRegistrationAlgorithmBase.h b/Code/Algorithms/Common/include/mapImageRegistrationAlgorithmBase.h index ab58a5b..06fc1f3 100644 --- a/Code/Algorithms/Common/include/mapImageRegistrationAlgorithmBase.h +++ b/Code/Algorithms/Common/include/mapImageRegistrationAlgorithmBase.h @@ -1,121 +1,121 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __IMAGE_REGISTRATION_ALGORITHM_BASE_H #define __IMAGE_REGISTRATION_ALGORITHM_BASE_H #include "itkIndent.h" #include "itkTimeStamp.h" #include "mapImageRegistrationAlgorithmInterface.h" namespace map { namespace algorithm { /*! @class ImageRegistrationAlgorithmBase @brief This is the interface for image registration algorithms @ingroup AlgorithmFacets @template TMovingImage Type of the moving image @template TTargetImage Type of the target image */ template class ImageRegistrationAlgorithmBase : public facet::ImageRegistrationAlgorithmInterface { public: typedef ImageRegistrationAlgorithmBase Self; - typedef TMovingImage MovingImageType; - typedef TTargetImage TargetImageType; + using MovingImageType = TMovingImage; + using TargetImageType = TTargetImage; - typedef typename MovingImageType::ConstPointer MovingImageConstPointer; - typedef typename TargetImageType::ConstPointer TargetImageConstPointer; + using MovingImageConstPointer = typename MovingImageType::ConstPointer; + using TargetImageConstPointer = typename TargetImageType::ConstPointer; /*! @brief gets a const pointer to the moving image @eguarantee strong @return a const pointer to the moving image */ MovingImageConstPointer getMovingImage() const; /*! @brief gets a const pointer to the target image @eguarantee strong @return a const pointer to the target image */ TargetImageConstPointer getTargetImage() const; /*! @brief sets the moving image @eguarantee strong @param pMovingImage a pointer to the moving image */ void setMovingImage(const MovingImageType* pMovingImage); /*! @brief sets the target image @eguarantee strong @param pTargetImage a pointer to the moving image */ void setTargetImage(const TargetImageType* pTargetImage); protected: /*! @brief virtual destructor */ virtual ~ImageRegistrationAlgorithmBase(); ImageRegistrationAlgorithmBase(); /*! Methods invoked by derivated classes. */ virtual void PrintSelf(std::ostream& os, ::itk::Indent indent) const; /** Return this modified time of the target image. */ unsigned long getTargetImageMTime() const; /** Return this modified time of the moving image. */ unsigned long getMovingImageMTime() const; private: MovingImageConstPointer _spMovingImage; ::itk::TimeStamp _movingImageMTime; TargetImageConstPointer _spTargetImage; ::itk::TimeStamp _targetImageMTime; //No copy constructor allowed ImageRegistrationAlgorithmBase(const Self& source); void operator=(const Self&); //purposely not implemented }; - } -} + } // namespace algorithm +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapImageRegistrationAlgorithmBase.tpp" #endif #endif diff --git a/Code/Algorithms/Common/include/mapImageRegistrationAlgorithmBase.tpp b/Code/Algorithms/Common/include/mapImageRegistrationAlgorithmBase.tpp index 4f42c5e..fe9b90c 100644 --- a/Code/Algorithms/Common/include/mapImageRegistrationAlgorithmBase.tpp +++ b/Code/Algorithms/Common/include/mapImageRegistrationAlgorithmBase.tpp @@ -1,110 +1,110 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __IMAGE_REGISTRATION_ALGORITHM_INTERFACE_TPP #define __IMAGE_REGISTRATION_ALGORITHM_INTERFACE_TPP namespace map { namespace algorithm { template typename ImageRegistrationAlgorithmBase::MovingImageConstPointer ImageRegistrationAlgorithmBase:: getMovingImage() const { return _spMovingImage; } template typename ImageRegistrationAlgorithmBase::TargetImageConstPointer ImageRegistrationAlgorithmBase:: getTargetImage() const { return _spTargetImage; } template void ImageRegistrationAlgorithmBase:: setMovingImage(const MovingImageType* pMovingImage) { if (this->_spMovingImage != pMovingImage) { this->_spMovingImage = pMovingImage; this->_movingImageMTime.Modified(); } } template void ImageRegistrationAlgorithmBase:: setTargetImage(const TargetImageType* pTargetImage) { if (this->_spTargetImage != pTargetImage) { this->_spTargetImage = pTargetImage; this->_targetImageMTime.Modified(); } } template ImageRegistrationAlgorithmBase:: ~ImageRegistrationAlgorithmBase() {} template ImageRegistrationAlgorithmBase:: ImageRegistrationAlgorithmBase() {} template void ImageRegistrationAlgorithmBase:: PrintSelf(std::ostream& os, ::itk::Indent indent) const { os << indent << "Moving image: " << _spMovingImage.GetPointer() << std::endl; os << indent << "Target image: " << _spTargetImage.GetPointer() << std::endl; } template unsigned long ImageRegistrationAlgorithmBase:: getTargetImageMTime() const { return _targetImageMTime.GetMTime(); }; template unsigned long ImageRegistrationAlgorithmBase:: getMovingImageMTime() const { return _movingImageMTime.GetMTime(); }; - } // end namespace algorithms + } // namespace algorithm } // end namespace map #endif diff --git a/Code/Algorithms/Common/include/mapImageRegistrationAlgorithmInterface.h b/Code/Algorithms/Common/include/mapImageRegistrationAlgorithmInterface.h index 7f2117d..c4e91c0 100644 --- a/Code/Algorithms/Common/include/mapImageRegistrationAlgorithmInterface.h +++ b/Code/Algorithms/Common/include/mapImageRegistrationAlgorithmInterface.h @@ -1,100 +1,100 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __IMAGE_REGISTRATION_ALGORITHM_INTERFACE_H #define __IMAGE_REGISTRATION_ALGORITHM_INTERFACE_H #include "itkIndent.h" /*! @namespace */ namespace map { namespace algorithm { namespace facet { /*! @class ImageRegistrationAlgorithmInterface @brief This is the interface for image registration algorithms @ingroup AlgorithmFacets @template TMovingImage Type of the moving image @template TTargetImage Type of the target image */ template class ImageRegistrationAlgorithmInterface { public: typedef ImageRegistrationAlgorithmInterface Self; - typedef TMovingImage MovingImageType; - typedef TTargetImage TargetImageType; + using MovingImageType = TMovingImage; + using TargetImageType = TTargetImage; - typedef typename MovingImageType::ConstPointer MovingImageConstPointer; - typedef typename TargetImageType::ConstPointer TargetImageConstPointer; + using MovingImageConstPointer = typename MovingImageType::ConstPointer; + using TargetImageConstPointer = typename TargetImageType::ConstPointer; /*! @brief gets a const pointer to the moving image @eguarantee strong @return a const pointer to the moving image */ virtual MovingImageConstPointer getMovingImage() const = 0; /*! @brief gets a const pointer to the target image @eguarantee strong @return a const pointer to the target image */ virtual TargetImageConstPointer getTargetImage() const = 0; /*! @brief sets the moving image @eguarantee strong @param pMovingImage a pointer to the moving image */ virtual void setMovingImage(const MovingImageType* pMovingImage) = 0; /*! @brief sets the target image @eguarantee strong @param pTargetImage a pointer to the moving image */ virtual void setTargetImage(const TargetImageType* pTargetImage) = 0; protected: /*! @brief virtual destructor */ virtual ~ImageRegistrationAlgorithmInterface() {}; ImageRegistrationAlgorithmInterface() {}; private: //No copy constructor allowed ImageRegistrationAlgorithmInterface(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapInterimRegistrationResultAccessInterface.h b/Code/Algorithms/Common/include/mapInterimRegistrationResultAccessInterface.h index 7a94b70..4f395b4 100644 --- a/Code/Algorithms/Common/include/mapInterimRegistrationResultAccessInterface.h +++ b/Code/Algorithms/Common/include/mapInterimRegistrationResultAccessInterface.h @@ -1,106 +1,106 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __INTERIM_REGISTRATION_RESULT_ACCESS_INTERFACE_H #define __INTERIM_REGISTRATION_RESULT_ACCESS_INTERFACE_H #include "mapFieldRepresentationDescriptor.h" #include "mapRegistration.h" #include "mapOptimizerControlInterface.h" /*! @namespace map The namespace map is used throughout the MatchPoint project to mark code as components of this project */ namespace map { namespace algorithm { namespace facet { /*! @class InterimRegistrationResultAccessInterface @brief This is the interface that allows to access the interim results of an registration algorithm @ingroup AlgorithmFacets */ template class InterimRegistrationResultAccessInterface { public: typedef InterimRegistrationResultAccessInterface Self; typedef core::Registration InterimRegistrationType; - typedef typename InterimRegistrationType::Pointer InterimRegistrationPointer; + using InterimRegistrationPointer = typename InterimRegistrationType::Pointer; - typedef core::FieldRepresentationDescriptor MovingRepresentationDescriptorType; - typedef core::FieldRepresentationDescriptor TargetRepresentationDescriptorType; + using MovingRepresentationDescriptorType = core::FieldRepresentationDescriptor; + using TargetRepresentationDescriptorType = core::FieldRepresentationDescriptor; - typedef OptimizerControlInterface::OptimizerMeasureType OptimizerMeasureType; + using OptimizerMeasureType = OptimizerControlInterface::OptimizerMeasureType; /*! @brief gets the registration result that has been computed in the last iteration. This interim registration may have other representation descriptors, passed as function arguments. Calls determineInterimRegistration to generate the registration. @param [in] pMovingRepresentation Pointer to the interim moving space representation descriptor. If pointer is NULL the default descriptor of the algorithm will be used. @param [in] pTargetRepresentation Pointer to the interim target space representation descriptor. If pointer is NULL the default descriptor of the algorithm will be used. @eguarantee strong @return the interim registration result as smart pointer. If the algorithm is not able to determine an interim registration, the smart pointer will point to NULL. @retval a Registration object @sa Registration */ virtual InterimRegistrationPointer getInterimRegistration(const MovingRepresentationDescriptorType* pMovingRepresentation = NULL, const TargetRepresentationDescriptorType* pTargetRepresentation = NULL) const = 0; /*! This function indicates of the optimizer of the iterative registration algorithm is * able to return its current metric/optimizer value(s)? @eguarantee no fail @return Indicates if the algorithm can determin its curent value. */ virtual bool hasCurrentOptimizerValue() const = 0; /*! @brief gets the current value/cost of the optimizer iteration of the registration algorithm @eguarantee strong @return returns the optimizers current value/cost */ virtual OptimizerMeasureType getCurrentOptimizerValue() const = 0; protected: InterimRegistrationResultAccessInterface() {}; virtual ~InterimRegistrationResultAccessInterface() {}; private: //No copy constructor allowed InterimRegistrationResultAccessInterface(const Self& source); //purposely not implemented void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapIterativeAlgorithmBase.h b/Code/Algorithms/Common/include/mapIterativeAlgorithmBase.h index bbc0b31..7ea26fa 100644 --- a/Code/Algorithms/Common/include/mapIterativeAlgorithmBase.h +++ b/Code/Algorithms/Common/include/mapIterativeAlgorithmBase.h @@ -1,95 +1,95 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITERATIVE_ALGORITHM_BASE_H #define __ITERATIVE_ALGORITHM_BASE_H #include "mapIterativeAlgorithmInterface.h" #include "mapMAPAlgorithmsExports.h" /*! @namespace map The namespace map is used throughout the MatchPoint project to mark code as components of this project */ namespace map { namespace algorithm { /*! @class IterativeAlgorithmBase @brief This default implementation for the IterativeAlgorithmInterface @ingroup Algorithms @remark Algorithms that want to support iteration events and implement this interface should use the AlgorithmIterationEvent to indicate the beginning of the next iteration @see map::events::AlgorithmIterationEvent */ class MAPAlgorithms_EXPORT IterativeAlgorithmBase : public facet::IterativeAlgorithmInterface { public: - typedef IterativeAlgorithmBase Self; + using Self = IterativeAlgorithmBase; /*! @brief gets the number of the algorithm's current iteration @eguarantee strong @return returns the algorithm's current iteration. If the optimizer has no iteration count (hasIterationCount()==false), return is always 0. @retval an IterationCountType specifying the current iteration @sa IterationCountType */ - IterationCountType getCurrentIteration() const; + IterationCountType getCurrentIteration() const override; /*! @brief gets the maximum number of the algorithm's iterations @eguarantee strong @return returns the algorithm's maximum iterations count. If the optimizer has no iteration count (hasMaxIterationCount()==false), return is always 0. */ - IterationCountType getMaxIterations() const; + IterationCountType getMaxIterations() const override; protected: IterativeAlgorithmBase(); - virtual ~IterativeAlgorithmBase(); + ~IterativeAlgorithmBase() override; /*! return the current number of iterations. Will be called by getCurrentIteration() if hasIterationCount() returns true. @eguarantee strong @return Iteration count */ virtual IterationCountType doGetCurrentIteration() const = 0; /*! return the maximum number of iterations. Will be called by getMaxIterations() if hasMaxIterationCount() returns true. @eguarantee strong @return Maximum iteration count */ virtual IterationCountType doGetMaxIterations() const = 0; private: //No copy constructor allowed - IterativeAlgorithmBase(const Self& source); //purposely not implemented - void operator=(const Self&); //purposely not implemented + IterativeAlgorithmBase(const Self& source) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; - } -} + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapIterativeAlgorithmInterface.h b/Code/Algorithms/Common/include/mapIterativeAlgorithmInterface.h index 06cd5a0..af87547 100644 --- a/Code/Algorithms/Common/include/mapIterativeAlgorithmInterface.h +++ b/Code/Algorithms/Common/include/mapIterativeAlgorithmInterface.h @@ -1,99 +1,99 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITERATIVE_ALGORITHM_INTERFACE_H #define __ITERATIVE_ALGORITHM_INTERFACE_H #include "itkSimpleFastMutexLock.h" #include "itkMutexLockHolder.h" #include "mapMacros.h" #include "mapMAPAlgorithmsExports.h" /*! @namespace map The namespace map is used throughout the MatchPoint project to mark code as components of this project */ namespace map { namespace algorithm { namespace facet { /*! @class IterativeAlgorithmInterface @brief This is the interface for iterative algorithms @ingroup AlgorithmFacets @remark Algorithms that want to support iteration events and implement this interface should use the AlgorithmIterationEvent to indicate the begining of the next iteration @see map::events::AlgorithmIterationEvent */ class MAPAlgorithms_EXPORT IterativeAlgorithmInterface { public: - typedef IterativeAlgorithmInterface Self; + using Self = IterativeAlgorithmInterface; - typedef unsigned long IterationCountType; + using IterationCountType = unsigned long; /*! has the optimizer an iteration count? @eguarantee no fail @return Indicates if the algorithm can determin its current iteration count */ virtual bool hasIterationCount() const = 0; /*! @brief gets the number of the algorithm's current iteration @eguarantee strong @return returns the algorithm's current iteration. If the optimizer has no iteration count (hasIterationCount()==false), return is always 0. @retval an IterationCountType specifying the current iteration @sa IterationCountType */ virtual IterationCountType getCurrentIteration() const = 0; /*! has the optimizer an maximum iteration count for the current level/stage? @eguarantee no fail @return Indicates if the algorithm can determin its maximum iteration count */ virtual bool hasMaxIterationCount() const = 0; /*! @brief gets the maximum number of the algorithm's iterations in the current resolution level/stage @eguarantee strong @return returns the algorithm's maximum iterations count. If the optimizer has no iteration count (hasMaxIterationCount()==false), return is always 0. */ virtual IterationCountType getMaxIterations() const = 0; protected: - IterativeAlgorithmInterface() {}; - virtual ~IterativeAlgorithmInterface() {}; + IterativeAlgorithmInterface() = default; + virtual ~IterativeAlgorithmInterface() = default; private: //No copy constructor allowed - IterativeAlgorithmInterface(const Self& source); //purposely not implemented - void operator=(const Self&); //purposely not implemented + IterativeAlgorithmInterface(const Self& source) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapIterativeRegistrationAlgorithm.h b/Code/Algorithms/Common/include/mapIterativeRegistrationAlgorithm.h index cd93b85..35b6fc6 100644 --- a/Code/Algorithms/Common/include/mapIterativeRegistrationAlgorithm.h +++ b/Code/Algorithms/Common/include/mapIterativeRegistrationAlgorithm.h @@ -1,189 +1,187 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITERATIVE_REGISTRATION_ALGORITHM_H #define __ITERATIVE_REGISTRATION_ALGORITHM_H #include "mapIterativeAlgorithmBase.h" #include "mapRegistrationAlgorithm.h" #include "mapFieldRepresentationDescriptor.h" #include "mapInterimRegistrationResultAccessInterface.h" #include "mapStoppableAlgorithmInterface.h" /*! @namespace map The namespace map is used throughout the MatchPoint project to mark code as components of this project */ namespace map { namespace algorithm { /*! @class IterativeRegistrationAlgorithm @brief This is the default implementation for iterative and (potentially) stoppable registration algorithms @ingroup Algorithms */ template class IterativeRegistrationAlgorithm: public RegistrationAlgorithm, public IterativeAlgorithmBase, public facet::InterimRegistrationResultAccessInterface, public facet::StoppableAlgorithmInterface { public: typedef IterativeRegistrationAlgorithm Self; typedef RegistrationAlgorithm Superclass; typedef facet::InterimRegistrationResultAccessInterface InterimInterfaceType; - typedef typename InterimInterfaceType::InterimRegistrationType InterimRegistrationType; - typedef typename InterimRegistrationType::Pointer InterimRegistrationPointer; + using InterimRegistrationType = typename InterimInterfaceType::InterimRegistrationType; + using InterimRegistrationPointer = typename InterimRegistrationType::Pointer; - typedef typename InterimInterfaceType::MovingRepresentationDescriptorType - MovingRepresentationDescriptorType; - typedef typename InterimInterfaceType::TargetRepresentationDescriptorType - TargetRepresentationDescriptorType; + using MovingRepresentationDescriptorType = typename InterimInterfaceType::MovingRepresentationDescriptorType; + using TargetRepresentationDescriptorType = typename InterimInterfaceType::TargetRepresentationDescriptorType; - typedef typename InterimInterfaceType::OptimizerMeasureType OptimizerMeasureType; - typedef typename RegistrationAlgorithmBase::AlgorithmType AlgorithmType; + using OptimizerMeasureType = typename InterimInterfaceType::OptimizerMeasureType; + using AlgorithmType = typename RegistrationAlgorithmBase::AlgorithmType; /*! @brief gets the registration result that has been computed in the last iteration. This interim registration may have other representation descriptors, passed as function arguments. Calls determineInterimRegistration to generate the registration. @param [in] pMovingRepresentation Pointer to the interim moving space representation descriptor. If pointer is NULL the default descriptor of the algorithm will be used. @param [in] pTargetRepresentation Pointer to the interim target space representation descriptor. If pointer is NULL the default descriptor of the algorithm will be used. @eguarantee strong @return the interim registration result as smart pointer. If the algorithm is not able to determine an interim registration, the smart pointer will point to NULL. @retval a Registration object @sa Registration */ virtual InterimRegistrationPointer getInterimRegistration(const MovingRepresentationDescriptorType* pMovingRepresentation = NULL, const TargetRepresentationDescriptorType* pTargetRepresentation = NULL) const; /*! @brief gets the current value/cost of the optimizer iteration of the registration algorithm @eguarantee strong @return returns the optimizers current value/cost */ virtual OptimizerMeasureType getCurrentOptimizerValue() const; virtual AlgorithmType getAlgorithmType() const; - virtual bool stopAlgorithm(); + bool stopAlgorithm() override; protected: /*! @brief gets the registration result that has been computed in the last iteration. This result is limited by a region @pre pMovingRepresentation and pTargetRepresentation must not be null. @param [in] pMovingRepresentation Pointer to @eguarantee strong @return the interim registration result as smart pointer @retval a Registration object @sa Registration */ virtual InterimRegistrationPointer determineInterimRegistration(const MovingRepresentationDescriptorType* pMovingRepresentation, const TargetRepresentationDescriptorType* pTargetRepresentation) const = 0; /*! Performes the computation of the registration. * First prepareAlgorithm() will be called, then the algorithm state will be changed to AlgorithmState::Running and runAlgorithm() * will be called. After runAlgorithm() is finished the state will be changed to AlgorithmState::Stopped and onAlgorithmStopped() will * be called. * @return Indicates of the registration was successfully determined (e.g. could be * false if an iterative algorithm was stopped prematurely by the user). * @remark To change the algorithmic behaviour you should overwrite prepareAlgorithm() or runAlgorithm(). * This method should only be changed if you also want to change the state management of algorithms based on this class. * @eguarantee strong */ virtual bool doDetermineRegistration(); /*! This method should do all preperation tasks right before the algorithms execution. At the and of this method * the algorithm should be set up and ready to use. * @remark If you want to change the execution style, then overwrite runAlgorithm(). @eguarantee strong */ virtual void prepareAlgorithm() = 0; /*! This method should just execute the algorithm/iteration loop. * @remark If you want to change the initialization or the finalization, then overwrite prepareAlgorithm() or finalizeAlgorithm(). * @return Indicates of the registration was successfully determined (e.g. could be * false if an iterative algorithm was stopped prematurely by the user). * @eguarantee strong */ virtual bool runAlgorithm() = 0; /*! This method should do all the finalization work (e.g. generating the registration based on the iteration results). * @remark If you want to change the initialization or the iteration, then overwrite prepareAlgorithm() or runAlgorithm(). @eguarantee strong */ virtual void finalizeAlgorithm() = 0; /*! return the optimizer value(s) of the current iteration step. Will be called by getCurrentOptimizerValue() if hasCurrentValue() returns true. @eguarantee strong @return current measure */ virtual OptimizerMeasureType doGetCurrentOptimizerValue() const = 0; /*! Stops the algorithm. This is used by the default implementation of stopAlgorithm and should be implemented by derivating classes. @eguarantee strong @return returns the success of stopping @retval true if algorithm has been successfully stopped @retval false otherwise */ virtual bool doStopAlgorithm() = 0; IterativeRegistrationAlgorithm(); - virtual ~IterativeRegistrationAlgorithm(); + ~IterativeRegistrationAlgorithm() override; /*! Description of the reason/condition that lead to the last stopping of the algorithm. * it is used by this class to fill the comment of the StopAlgorithmEvent. Derived classes * my use this variable to specify the reason.\n * An empty string indicates that either no run has terminated yet or that the reason was not * specified. * @remark This value should have only informative character and should not control or influence algorithmic or program * behavior*/ ::map::core::String _stopConditionDescription; private: //No copy constructor allowed IterativeRegistrationAlgorithm(const Self& source); void operator=(const Self&); //purposely not implemented }; - } + } // namespace algorithm -} +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapIterativeRegistrationAlgorithm.tpp" #endif #endif diff --git a/Code/Algorithms/Common/include/mapMaskBoundingBoxHelper.h b/Code/Algorithms/Common/include/mapMaskBoundingBoxHelper.h index 8349a0f..c919034 100644 --- a/Code/Algorithms/Common/include/mapMaskBoundingBoxHelper.h +++ b/Code/Algorithms/Common/include/mapMaskBoundingBoxHelper.h @@ -1,140 +1,140 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MASK_BOUNDING_BOX_HELPER_H #define __MASK_BOUNDING_BOX_HELPER_H #include "itkIndent.h" #include "itkSpatialObject.h" #include "itkImageBase.h" #include "mapExceptionObjectMacros.h" namespace map { namespace algorithm { template class MaskBoundingBoxHelper { public: - typedef MaskBoundingBoxHelper Self; + using Self = MaskBoundingBoxHelper; - typedef ::itk::SpatialObject MaskBaseType; - typedef ::itk::ImageBase ImageBaseType; - typedef typename ImageBaseType::RegionType ImageRegionType; - typedef typename ImageBaseType::PointType PointType; + using MaskBaseType = ::itk::SpatialObject; + using ImageBaseType = ::itk::ImageBase; + using ImageRegionType = typename ImageBaseType::RegionType; + using PointType = typename ImageBaseType::PointType; public: /*! @brief computes the image region for an given image (geometry) which guarantees to cover the bounding box of the passed mask. It is not guaranteed that the returned bounding box is within the largest possible or buffered region of the image. Thus using the returning region you can be sure that any inside point of the mask is within the region (and has a pixel correspondence, if it is also covered by the largest possible region). @pre mask must be a valid pointer @pre refImage must be a valid pointer @eguarante strong @param [in] mask Pointer to the mask object. @param [in] refImage Pointer to the image on which geomtry the bounding region should be computed @oaram [out] boundingRegion The computed bounding image region. @return Indicates if boundingRegion has a valid value. */ static bool computeBoundingImageRegion(const MaskBaseType* mask, const ImageBaseType* refImage, ImageRegionType& boundingRegion) { ImageRegionType resultRegion; bool result = false; if (!mask) { mapDefaultExceptionStaticMacro( << "Cannot compute bounding box. Mask pointer is Null."); } if (!refImage) { mapDefaultExceptionStaticMacro( << "Cannot compute bounding box. Reference image pointer is Null."); } if (mask->ComputeBoundingBox()) { //there is really a bounding box typename MaskBaseType::BoundingBoxType::Pointer spBBox = mask->GetBoundingBox(); const typename MaskBaseType::BoundingBoxType::PointsContainer* cornerPoints = spBBox->GetCorners(); typename ImageBaseType::IndexType minIndex; minIndex.Fill(::itk::NumericTraits::max()); typename ImageBaseType::IndexType maxIndex; maxIndex.Fill( ::itk::NumericTraits::NonpositiveMin()); for (typename MaskBaseType::BoundingBoxType::PointsContainer::ConstIterator pos = cornerPoints->Begin(); pos != cornerPoints->End(); ++pos) { typename ImageBaseType::IndexType index; typename ImageBaseType::PointType point = pos.Value(); refImage->TransformPhysicalPointToIndex(point, index); for (unsigned int i = 0; i < ImageBaseType::GetImageDimension(); ++i) { if (index[i] < minIndex[i]) { minIndex[i] = index[i]; }; if (index[i] > maxIndex[i]) { maxIndex[i] = index[i]; }; } } resultRegion.SetIndex(minIndex); resultRegion.SetUpperIndex(maxIndex); boundingRegion = resultRegion; result = true; } return result; }; protected: /*! @brief virtual destructor */ virtual ~MaskBoundingBoxHelper() {}; MaskBoundingBoxHelper() {}; private: //No copy constructor allowed MaskBoundingBoxHelper(const Self& source); void operator=(const Self&); //purposely not implemented }; - } -} + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapMaskedRegistrationAlgorithmBase.h b/Code/Algorithms/Common/include/mapMaskedRegistrationAlgorithmBase.h index e669ac1..9235a72 100644 --- a/Code/Algorithms/Common/include/mapMaskedRegistrationAlgorithmBase.h +++ b/Code/Algorithms/Common/include/mapMaskedRegistrationAlgorithmBase.h @@ -1,133 +1,133 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MASKED_REGISTRATION_ALGORITHM_BASE_H #define __MASKED_REGISTRATION_ALGORITHM_BASE_H #include "mapModificationTimeValidator.h" #include "mapMaskedRegistrationAlgorithmInterface.h" #include "itkIndent.h" #include "itkSpatialObject.h" /*! @namespace */ namespace map { namespace algorithm { /*! @class MaskedRegistrationAlgorithmBase *@brief This is the default implementation for the MaskedRegistrationAlgorithmInterface for registration algorithms that support *the definition of masks. * * The masks are composed via itk:SpatialObjects (e.g. images or geometric * primitives). The masks define which part of the moving and target space/image will be regarded * for the registration purpose. * This interface requires/assumes that the axis of the masks (top level spatial object) are aligned * with the according information space (e.g. in a image registration algorithm the axis of the target image * should be aligned with the axis of the target mask). * *@ingroup AlgorithmFacets *@template VMovingDimension Dimension of the moving space *@template VTargetDimension Dimension of the target space */ template class MaskedRegistrationAlgorithmBase : public facet::MaskedRegistrationAlgorithmInterface { public: typedef MaskedRegistrationAlgorithmBase Self; - typedef ::itk::SpatialObject MovingMaskBaseType; - typedef ::itk::SpatialObject TargetMaskBaseType; + using MovingMaskBaseType = ::itk::SpatialObject; + using TargetMaskBaseType = ::itk::SpatialObject; - typedef typename MovingMaskBaseType::ConstPointer MovingMaskBaseConstPointer; - typedef typename TargetMaskBaseType::ConstPointer TargetMaskBaseConstPointer; + using MovingMaskBaseConstPointer = typename MovingMaskBaseType::ConstPointer; + using TargetMaskBaseConstPointer = typename TargetMaskBaseType::ConstPointer; /*! @brief gets a const pointer to the moving mask @eguarantee strong @return a const pointer to the moving mask */ virtual MovingMaskBaseConstPointer getMovingMask() const; /*! @brief gets a const pointer to the target mask @eguarantee strong @return a const pointer to the target mask */ virtual TargetMaskBaseConstPointer getTargetMask() const; /*! @brief sets the moving mask @eguarantee strong @param pMovingMask a pointer to the moving mask */ virtual void setMovingMask(const MovingMaskBaseType* pMovingMask); /*! @brief sets the target mask @eguarantee strong @param pTargetMask a pointer to the moving mask */ virtual void setTargetMask(const TargetMaskBaseType* pTargetMask); protected: /*! @brief virtual destructor */ virtual ~MaskedRegistrationAlgorithmBase(); MaskedRegistrationAlgorithmBase(); /*! Methods invoked by derivated classes. */ virtual void PrintSelf(std::ostream& os, ::itk::Indent indent) const; /** Return this modified time of the target mask. */ unsigned long getTargetMaskMTime() const; /** Return this modified time of the moving mask. */ unsigned long getMovingMaskMTime() const; private: ::map::core::ModificationTimeValidator _movingMaskMTime; ::map::core::ModificationTimeValidator _targetMaskMTime; MovingMaskBaseConstPointer _spMovingMask; TargetMaskBaseConstPointer _spTargetMask; //No copy constructor allowed MaskedRegistrationAlgorithmBase(const Self& source); void operator=(const Self&); //purposely not implemented }; - } -} + } // namespace algorithm +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapMaskedRegistrationAlgorithmBase.tpp" #endif #endif diff --git a/Code/Algorithms/Common/include/mapMaskedRegistrationAlgorithmBase.tpp b/Code/Algorithms/Common/include/mapMaskedRegistrationAlgorithmBase.tpp index beb3708..e6b427e 100644 --- a/Code/Algorithms/Common/include/mapMaskedRegistrationAlgorithmBase.tpp +++ b/Code/Algorithms/Common/include/mapMaskedRegistrationAlgorithmBase.tpp @@ -1,111 +1,111 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MASKED_REGISTRATION_ALGORITHM_BASE_TPP #define __MASKED_REGISTRATION_ALGORITHM_BASE_TPP namespace map { namespace algorithm { // **** public methods **** // ************************ template typename MaskedRegistrationAlgorithmBase::MovingMaskBaseConstPointer MaskedRegistrationAlgorithmBase:: getMovingMask() const { return _spMovingMask; } template typename MaskedRegistrationAlgorithmBase::TargetMaskBaseConstPointer MaskedRegistrationAlgorithmBase:: getTargetMask() const { return _spTargetMask; } template void MaskedRegistrationAlgorithmBase:: setMovingMask(const MovingMaskBaseType* pMovingMask) { _spMovingMask = pMovingMask; _movingMaskMTime.setWatchedObject(pMovingMask); } template void MaskedRegistrationAlgorithmBase:: setTargetMask(const TargetMaskBaseType* pTargetMask) { _spTargetMask = pTargetMask; _targetMaskMTime.setWatchedObject(pTargetMask); } // **** protected methods **** // *************************** template MaskedRegistrationAlgorithmBase:: ~MaskedRegistrationAlgorithmBase() {} template MaskedRegistrationAlgorithmBase:: MaskedRegistrationAlgorithmBase() { } template void MaskedRegistrationAlgorithmBase:: PrintSelf(std::ostream& os, ::itk::Indent indent) const { os << indent << "Moving mask: " << _spMovingMask.GetPointer() << std::endl; os << indent << "Target mask: " << _spTargetMask.GetPointer() << std::endl; } template unsigned long MaskedRegistrationAlgorithmBase:: getTargetMaskMTime() const { return _targetMaskMTime.getMTime(); }; template unsigned long MaskedRegistrationAlgorithmBase:: getMovingMaskMTime() const { return _movingMaskMTime.getMTime(); }; - } // end namespace algorithms + } // namespace algorithm } // end namespace map #endif diff --git a/Code/Algorithms/Common/include/mapMaskedRegistrationAlgorithmInterface.h b/Code/Algorithms/Common/include/mapMaskedRegistrationAlgorithmInterface.h index 198dd94..52a74ac 100644 --- a/Code/Algorithms/Common/include/mapMaskedRegistrationAlgorithmInterface.h +++ b/Code/Algorithms/Common/include/mapMaskedRegistrationAlgorithmInterface.h @@ -1,109 +1,109 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MASKED_REGISTRATION_ALGORITHM_INTERFACE_H #define __MASKED_REGISTRATION_ALGORITHM_INTERFACE_H #include "mapModificationTimeValidator.h" #include "itkIndent.h" #include "itkSpatialObject.h" /*! @namespace */ namespace map { namespace algorithm { namespace facet { /*! @class MaskedRegistrationAlgorithmInterface *@brief This is the interface for registration algorithms that support *the definition of masks. * * The masks are composed via itk:SpatialObjects (e.g. images or geometric * primitives). The masks define which part of the moving and target space/image will be regarded * for the registration purpose. * This interface requires/assumes that the axis of the masks (top level spatial object) are aligned * with the according information space (e.g. in a image registration algorithm the axis of the target image * should be aligned with the axis of the target mask). * *@ingroup AlgorithmFacets *@template VMovingDimension Dimension of the moving space *@template VTargetDimension Dimension of the target space */ template class MaskedRegistrationAlgorithmInterface { public: typedef MaskedRegistrationAlgorithmInterface Self; - typedef ::itk::SpatialObject MovingMaskBaseType; - typedef ::itk::SpatialObject TargetMaskBaseType; + using MovingMaskBaseType = ::itk::SpatialObject; + using TargetMaskBaseType = ::itk::SpatialObject; - typedef typename MovingMaskBaseType::ConstPointer MovingMaskBaseConstPointer; - typedef typename TargetMaskBaseType::ConstPointer TargetMaskBaseConstPointer; + using MovingMaskBaseConstPointer = typename MovingMaskBaseType::ConstPointer; + using TargetMaskBaseConstPointer = typename TargetMaskBaseType::ConstPointer; /*! @brief gets a const pointer to the moving mask @eguarantee strong @return a const pointer to the moving mask */ virtual MovingMaskBaseConstPointer getMovingMask() const = 0; /*! @brief gets a const pointer to the target mask @eguarantee strong @return a const pointer to the target mask */ virtual TargetMaskBaseConstPointer getTargetMask() const = 0; /*! @brief sets the moving mask @eguarantee strong @param pMovingMask a pointer to the moving mask */ virtual void setMovingMask(const MovingMaskBaseType* pMovingMask) = 0; /*! @brief sets the target mask @eguarantee strong @param pTargetMask a pointer to the moving mask */ virtual void setTargetMask(const TargetMaskBaseType* pTargetMask) = 0; protected: /*! @brief virtual destructor */ virtual ~MaskedRegistrationAlgorithmInterface() {}; MaskedRegistrationAlgorithmInterface() {}; private: //No copy constructor allowed MaskedRegistrationAlgorithmInterface(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapMetaPropertyAlgorithmBase.h b/Code/Algorithms/Common/include/mapMetaPropertyAlgorithmBase.h index 00b1cab..f2b0c94 100644 --- a/Code/Algorithms/Common/include/mapMetaPropertyAlgorithmBase.h +++ b/Code/Algorithms/Common/include/mapMetaPropertyAlgorithmBase.h @@ -1,211 +1,211 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __META_PROPERTY_ALGORITHM_BASE_H #define __META_PROPERTY_ALGORITHM_BASE_H #include "mapMetaPropertyAlgorithmInterface.h" namespace map { namespace algorithm { /*! @class MetaPropertyAlgorithmBase @brief This is the default implementation of the MetaPropertyAlgorithmInterface for algorithms that are able to grant an generic access to their properties. A algorithm implementing this interface offers a possibility to set or get values of selected properties of the algorithm. This feature is very useful to establish generic handling interfaces between a host application and algorithms.\n\n This implementation uses a meta property cache to store all properties that are set by the user. The Properties will be transfered to the internal algorithm by calling the member\n\n If you want to support the feature of sealed algorithms, its important to regard the remark on how to compile the property information (see compileInfos()). @ingroup AlgorithmFacets */ class MAPAlgorithms_EXPORT MetaPropertyAlgorithmBase : public facet::MetaPropertyAlgorithmInterface { public: - typedef MetaPropertyAlgorithmBase Self; + using Self = MetaPropertyAlgorithmBase; - typedef facet::MetaPropertyAlgorithmInterface::MetaPropertyVectorType MetaPropertyVectorType; - typedef facet::MetaPropertyAlgorithmInterface::MetaPropertyType MetaPropertyType; - typedef facet::MetaPropertyAlgorithmInterface::MetaPropertyPointer MetaPropertyPointer; - typedef facet::MetaPropertyAlgorithmInterface::MetaPropertyNameType MetaPropertyNameType; + using MetaPropertyVectorType = facet::MetaPropertyAlgorithmInterface::MetaPropertyVectorType; + using MetaPropertyType = facet::MetaPropertyAlgorithmInterface::MetaPropertyType; + using MetaPropertyPointer = facet::MetaPropertyAlgorithmInterface::MetaPropertyPointer; + using MetaPropertyNameType = facet::MetaPropertyAlgorithmInterface::MetaPropertyNameType; /*! Returns the MetaPropertyInfo for the property identified by the passed name @eguarantee strong @return returns SmartPointer to the MetaPropertyInfo. SmartPointer may be null, if the passed property name is unkown. @retval NULL-pointer Property is unknown */ - virtual MetaPropertyInfo::Pointer getPropertyInfo(const MetaPropertyNameType& name) const; + MetaPropertyInfo::Pointer getPropertyInfo(const MetaPropertyNameType& name) const override; /*! Returns a vector with smart pointer to MetaPropertyInfos for all known and therefor supported * properties. * @remark this method calls the protectes virtual methods compilePublicInfos() and compileProtectedInfos() * to generate the list. * @eguarantee strong * @return returns vector of smart pointer to the MetaPropertyInfos. */ - virtual MetaPropertyVectorType getPropertyInfos() const; + MetaPropertyVectorType getPropertyInfos() const override; /*! Returns a smart pointer to the MetaProperty identified by the passed name. * This default implementation is:\n * 1. Check if getting MetaProperty is legal\n * 2. Check the cache. Return cached value if existing.\n * 3. Call doGetProperty().\n * @remark Implement doGetProperty() to realize the handling and forwarding of properties * @eguarantee strong * @return Returns a smart pointer to the requested MetaProperty. If the property is * unknown, not readable or not supported the returned smart pointer will point to NULL. * @param name Name that identifies the wanted property. */ - virtual MetaPropertyPointer getProperty(const MetaPropertyNameType& name) const; + MetaPropertyPointer getProperty(const MetaPropertyNameType& name) const override; /*! Returns a smart pointer to the MetaProperty identified by the passed name. * This default implementation is:\n * 1. Check if getting MetaProperty is legal\n * 2. Check the cache. Return cached value if existing.\n * 3. Call doGetProperty().\n * @remark Implement doGetProperty() to realize the handling and forwarding of properties * @eguarantee strong * @param pInfo Pointer to the MetaPropertyInfo that specifies the wanted property (by name). * Method will throw an exception if passed Pointer is NULL. * @return Returns a smart pointer to the requested MetaProperty. If the property is * unknown, not readable or not supported the returned smart pointer will point to NULL. * @pre The type defined in the pInfo must equal the type of the MetaProperty; otherwise an exception * will be raised. * @exception ::map::core::ExceptionObject Thrown if the precondition is not satisfied (pInfo is NULL or has wrong type). * @overload */ - virtual MetaPropertyPointer getProperty(const MetaPropertyInfo* pInfo) const; + MetaPropertyPointer getProperty(const MetaPropertyInfo* pInfo) const override; /*! Allows the transferring and setting of instance properties via this generic interface. * This base implementation will store the property in the cache (overwrites an already cached instance * of the property if necessary). The internal algorithm will be configured with the MetaProperties by * calling configureAlgorithmByMetaProperties(). * @param name Name that identifies the property that should be set. * @param pProperty Pointer to the MetaProperty that contains the value that should be set. * Method will throw an exception if passed Pointer is NULL. * @return Indicates if the property was known and writable (true) or is not supported/writable (false). * @remark The function may raise exceptions. It depends on the implementation of the class setters * that will be used to finally integrate the passed and unwrapped property value into the instance. * @pre pProperty must point to a valid instance. * @exception ::map::core::ExceptionObject Thrown if a precondition is not satisfied * (pProperty is not valid). */ - virtual bool setProperty(const MetaPropertyNameType& name, const MetaPropertyType* pProperty); + bool setProperty(const MetaPropertyNameType& name, const MetaPropertyType* pProperty) override; /*! Allows the transferring and setting of instance properties via this generic interface. * This base implementation will store the property in the cache (overwrites an already cached instance * of the property if necessary). The internal algorithm will be configured with the MetaProperties by * calling configureAlgorithmByMetaProperties(). * @param pInfo Pointer to the MetaPropertyInfo that specifies the wanted property (by name). * Method will throw an exception if passed Pointer is NULL. * @param pProperty Pointer to the MetaProperty that contains the value that should be set. * Method will throw an exception if passed Pointer is NULL. * @return Indicates if the property was known and writable (true) or is not supported/writable (false). * @remark The function may raise exceptions. It depends on the implementation of the class setters * that will be used to finally integrate the passed and unwrapped property value into the instance. * @pre pProperty must point to a valid instance. * @pre The type defined in the pInfo must equal the type of pProperty; otherwise an exception * will be raised. * @exception ::map::core::ExceptionObject Thrown if a precondition is not satisfied * (pInfo is NULL or has wrong type; pProperty is not valid). * @overload */ - virtual bool setProperty(const MetaPropertyInfo* pInfo, const MetaPropertyType* pProperty); + bool setProperty(const MetaPropertyInfo* pInfo, const MetaPropertyType* pProperty) override; protected: MetaPropertyAlgorithmBase(); - virtual ~MetaPropertyAlgorithmBase(); + ~MetaPropertyAlgorithmBase() override; /*! This method should be implemented to define how to compile MetaProperties * and add it to the passed info vector.\n\n * IMPORTANT REMINDER: You must ensure that in cases of sealed algorithms * only properties are added to the infos vector that may be accessed. Otherwise * you may have access to internals of sealed algorithms. The best way to take * care about this is to use a include guard "#ifndef MAP_SEAL_ALGORITHMS" * on the properties that should not be available for sealed algorithms * @eguarantee strong * @param infos Vector of MetaPropertyInfoPointer. The public MetaPropertyInfos * will be added to this vector by the method. */ virtual void compileInfos(MetaPropertyVectorType& infos) const = 0; /*! This method configures the algorithm with the cached MetaProperties. * The default implementation does this by calling * doSetProperty() for each MetaProperty stored in the cache. * @remark Implement doSetProperty() to realize the handling of passed new property values. * @eguarantee basic. */ virtual void configureAlgorithmByMetaProperties(); /*! Implement this Method to realize the getting of a property specified by name. @remark This method only is called by getProperty if getPropertyInfo has a valid return for the passed name and the property is identified as readable. @eguarantee strong @return Returns a smart pointer to the requested MetaProperty. @param name Name that identifies the wanted property. */ virtual MetaPropertyPointer doGetProperty(const MetaPropertyNameType& name) const = 0; /*! Implement this Method to realize the setting of a property specified by name. @remark This method only is called by setProperty if getPropertyInfo has a valid return for the passed name and the property is identified as writable. @param name Name that identifies the wanted property. @param pProperty Pointer to the MetaProperty that contains the value that should be set. @pre Passed pointer pProperty is not NULL. */ virtual void doSetProperty(const MetaPropertyNameType& name, const MetaPropertyType* pProperty) = 0; void resetMetaPropertyCache(); unsigned long GetMTime() const; private: typedef std::map MetaPropertyCacheType; /*! Cache for meta properties. The default implementation of GetProperty/SetProperty will use the cache in order to store user changes. See documentation of these members. The cache will be transfered to internal algorithm via configureAlgorithmByMetaProperties(). @sa GetProperty @sa SetProperty */ MetaPropertyCacheType _metaPropertyCache; ::itk::TimeStamp _cacheMTime; //No copy constructor allowed - MetaPropertyAlgorithmBase(const Self& source); //purposely not implemented - void operator=(const Self&); //purposely not implemented + MetaPropertyAlgorithmBase(const Self& source) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; - } -} + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapMetaPropertyAlgorithmInterface.h b/Code/Algorithms/Common/include/mapMetaPropertyAlgorithmInterface.h index 8b2dba0..e14ec7a 100644 --- a/Code/Algorithms/Common/include/mapMetaPropertyAlgorithmInterface.h +++ b/Code/Algorithms/Common/include/mapMetaPropertyAlgorithmInterface.h @@ -1,143 +1,143 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __META_PROPERTY_ALGORITHM_INTERFACE_H #define __META_PROPERTY_ALGORITHM_INTERFACE_H #include #include "mapMetaPropertyInfo.h" #include "mapMetaPropertyBase.h" #include "mapExceptionObject.h" #include "mapMAPAlgorithmsExports.h" namespace map { namespace algorithm { namespace facet { /*! @class MetaPropertyAlgorithmInterface @brief This is the interface for algorithms that are able to grant an generic access to their properties. A algorithm implementing this interface offers a possibility to set or get values of selected properties of the algorithm. This feature is very usefull to establish generic handling interfaces between a host application and algorithms.\n\n If you want to support the feature of sealed algorithms, its important to regard the remark on how to compile the property information (see compileInfos()). @ingroup AlgorithmFacets */ class MAPAlgorithms_EXPORT MetaPropertyAlgorithmInterface { public: - typedef MetaPropertyAlgorithmInterface Self; + using Self = MetaPropertyAlgorithmInterface; - typedef std::vector MetaPropertyVectorType; - typedef core::MetaPropertyBase MetaPropertyType; - typedef MetaPropertyType::Pointer MetaPropertyPointer; - typedef core::String MetaPropertyNameType; + using MetaPropertyVectorType = std::vector; + using MetaPropertyType = core::MetaPropertyBase; + using MetaPropertyPointer = MetaPropertyType::Pointer; + using MetaPropertyNameType = core::String; /*! Returns the MetaPropertyInfo for the property identified by the passed name @eguarantee strong @return returns SmartPointer to the MetaPropertyInfo. SmartPointer may be null, if the passed property name is unkown. @retval NULL-pointer Property is unknown */ virtual MetaPropertyInfo::Pointer getPropertyInfo(const MetaPropertyNameType& name) const = 0; /*! Returns a vector with smart pointer to MetaPropertyInfos for all known and therefor supported * properties. * @remark this method calls the protectes virtual methods compilePublicInfos() and compileProtectedInfos() * to generate the list. * @eguarantee strong * @return returns vector of smart pointer to the MetaPropertyInfos. */ virtual MetaPropertyVectorType getPropertyInfos() const = 0; /*! Returns a smart pointer to the MetaProperty identified by the passed name. * @remark Implement doGetProperty() to realize the handling and forwarding of properties * @eguarantee strong * @return Returns a smart pointer to the requested MetaProperty. If the property is * unkown, not readable or not supported the returned smart pointer will point to NULL. * @param name Name that identifies the wanted property. */ virtual MetaPropertyPointer getProperty(const MetaPropertyNameType& name) const = 0; /*! Returns a smart pointer to the MetaProperty identified by the passed name. * @remark Implement doGetProperty() to realize the handling and forwarding of properties * @eguarantee strong * @param pInfo Pointer to the MetaPropertyInfo that specifies the wanted property (by name). * Method will throw an exception if passed Pointer is NULL. * @return Returns a smart pointer to the requested MetaProperty. If the property is * unkown, not readable or not supported the returned smart pointer will point to NULL. * @pre The type defined in the pInfo must equal the type of the MetaProperty; otherwise an exception * will be raised. * @overload */ virtual MetaPropertyPointer getProperty(const MetaPropertyInfo* pInfo) const = 0; /*! Allows the transfering and setting of instance properties via this generic interface. * @remark Implement doSetProperty() to realize the handling of passed new property values. * @param name Name that identifies the property that should be set. * @param pProperty Pointer to the MetaProperty that containes the value that should be set. * Method will throw an exception if passed Pointer is NULL. * @return Indicates if the property was known and writable (true) or is not supported/writable (false). * @remark The function may raise exceptions. It depends on the implementation of the class setters * that will be used to finally integrate the passed and unwrapped property value into the instance. */ virtual bool setProperty(const MetaPropertyNameType& name, const MetaPropertyType* pProperty) = 0; /*! Allows the transfering and setting of instance properties via this generic interface. * @remark Implement doSetProperty() to realize the handling of passed new property values. * @param pInfo Pointer to the MetaPropertyInfo that specifies the wanted property (by name). * Method will throw an exception if passed Pointer is NULL. * @param pProperty Pointer to the MetaProperty that containes the value that should be set. * Method will throw an exception if passed Pointer is NULL. * @return Indicates if the property was known and writable (true) or is not supported/writable (false). * @remark The function may raise exceptions. It depends on the implementation of the class setters * that will be used to finally integrate the passed and unwrapped property value into the instance. * @pre The type defined in the pInfo must equal the type of pProperty; otherwise an exception * will be raised. * @overload */ virtual bool setProperty(const MetaPropertyInfo* pInfo, const MetaPropertyType* pProperty) = 0; protected: - MetaPropertyAlgorithmInterface() {}; - virtual ~MetaPropertyAlgorithmInterface() {}; + MetaPropertyAlgorithmInterface() = default; + virtual ~MetaPropertyAlgorithmInterface() = default; private: //No copy constructor allowed - MetaPropertyAlgorithmInterface(const Self& source); //purposely not implemented - void operator=(const Self&); //purposely not implemented + MetaPropertyAlgorithmInterface(const Self& source) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapMetaPropertyInfo.h b/Code/Algorithms/Common/include/mapMetaPropertyInfo.h index 8c36a87..22c633d 100644 --- a/Code/Algorithms/Common/include/mapMetaPropertyInfo.h +++ b/Code/Algorithms/Common/include/mapMetaPropertyInfo.h @@ -1,144 +1,144 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __META_PROPERTY_INFO_H #define __META_PROPERTY_INFO_H #include #include "itkLightObject.h" #include "mapMacros.h" #include "mapString.h" #include "mapMAPAlgorithmsExports.h" namespace map { namespace algorithm { /*! @class MetaPropertyInfo @brief This class is used to bundle basic information of a MetaProperty. It is used by the MetaPropertyInterface to provide these information for all properties an algorithm supports. @sa MetaPropertyInterface @ingroup Algorithms */ class MAPAlgorithms_EXPORT MetaPropertyInfo : public ::itk::LightObject { public: /** Smart pointer typedef support. */ - typedef MetaPropertyInfo Self; - typedef ::itk::LightObject Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = MetaPropertyInfo; + using Superclass = ::itk::LightObject; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; /** Run-time type information (and related methods). */ itkTypeMacro(MetaPropertyInfo, LightObject); /** * @brief Creates a MetaProperty instance, initializes it and returns it via smartpointer. * @return A pointer to the MetaProperty. * @param name The name of the associated MetaProperty * @param type_info The type info of the value type used for the MetaProperty * @param isReadable Indicates if the property is readable * @param isWritable Indicates if the property is writable * @eguarantee strong */ static Pointer New(const core::String& name, const std::type_info& type_info, bool isReadable = true, bool isWritable = false); /** * @brief Dublicates a MetaProperty instance. The value of the property is copied. * @return A pointer to the MetaProperty clone. * @eguarantee strong */ - virtual ::itk::LightObject::Pointer CreateAnother(void) const; + ::itk::LightObject::Pointer CreateAnother() const override; /** * @brief Returns the unique type name of the value type that stores the associated property. * @return A pointer to a const char array containing the unique type name. * @eguarantee strong */ const char* getTypeName() const; /** * @brief Returns the type_id of the value type that stores the associated property. * @eguarantee strong * @return A constant reference to a std::type_info object */ const std::type_info& getTypeInfo() const; /** * @brief Returns the identifying name of the associated property. * @eguarantee strong * @return A constant reference to a String that is the name */ const core::String& getName() const; /** * @brief Returns if the property is supposed to be accessed. This is * used by the MetaPropertyInterface to indicate if an reading attempt of * this property will fail and is supported respectively. * @eguarantee strong * @return Indication if property is readable (True). */ bool isReadable() const; /** * @brief Returns if the property is supposed to be changed. This is * used by the MetaPropertyInterface to indicate if an writting attempt of * this property will fail and is supported respectively. * @eguarantee strong * @return Indication if property is writable (True). */ bool isWritable() const; protected: ::map::core::String _name; const std::type_info& _type_info; bool _isReadable; bool _isWritable; /** * Defines the default behavior for printing out this element * @eguarantee strong * @param os An output stream */ - virtual void PrintSelf(std::ostream& os, ::itk::Indent indent) const; + void PrintSelf(std::ostream& os, ::itk::Indent indent) const override; - ~MetaPropertyInfo(); - MetaPropertyInfo(const core::String& name, const std::type_info& type_info, bool isReadable = true, + ~MetaPropertyInfo() override; + MetaPropertyInfo(core::String name, const std::type_info& type_info, bool isReadable = true, bool isWritable = false); private: - MetaPropertyInfo(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented + MetaPropertyInfo(const Self&) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; - } -} + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapModifiableMultiResImageRegistrationAlgorithmBase.h b/Code/Algorithms/Common/include/mapModifiableMultiResImageRegistrationAlgorithmBase.h index 0cb514e..44ece7e 100644 --- a/Code/Algorithms/Common/include/mapModifiableMultiResImageRegistrationAlgorithmBase.h +++ b/Code/Algorithms/Common/include/mapModifiableMultiResImageRegistrationAlgorithmBase.h @@ -1,136 +1,136 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MODIFIABLE_MULTI_RES_IMAGE_REGISTRATION_ALGORITHM_INTERFACE_H #define __MODIFIABLE_MULTI_RES_IMAGE_REGISTRATION_ALGORITHM_INTERFACE_H #include "itkIndent.h" #include "itkMultiResolutionPyramidImageFilter.h" #include "itkConceptChecking.h" #include "mapMultiResImageRegistrationAlgorithmBase.h" #include "mapMultiResRegistrationAlgorithmSetterInterface.h" #include "mapMultiResScheduleSetterInterface.h" /*! @namespace */ namespace map { namespace algorithm { /*! @class ModifiableMultiResImageRegistrationAlgorithmBase *@brief Extension of MultiResImageRegistrationAlgorithmBase that implements public * facets for setting resolution level and schedule. * * Use this base class, if you want to allow the changing of resolution levels or * schedules from the outside. If you need a "read only" implementation, please * use MultiResImageRegistrationAlgorithmBase. * This base class allows depending on the used pyramide policy to set the pyramide types. (see ImagePyramideSetterInterface and ImagePyramideSetterInterface * added by TPyramidesPolicy; e.g. ArbitraryImagePyramidePolicy) * *@ingroup AlgorithmFacets *@template TMovingImage the type of the moving image *@template TTargetImage the type of the target image *@template TPyramidesPolicy Policy that defines how the image pyramides can be changed an what interfaces are offered by the base class. */ template class ModifiableMultiResImageRegistrationAlgorithmBase: public MultiResImageRegistrationAlgorithmBase, public facet::MultiResScheduleSetterInterface, public facet::MultiResRegistrationAlgorithmSetterInterface { public: - typedef TMovingImage MovingImageType; - typedef TTargetImage TargetImageType; - typedef TPyramidesPolicy PyramidesPolicyType; + using MovingImageType = TMovingImage; + using TargetImageType = TTargetImage; + using PyramidesPolicyType = TPyramidesPolicy; typedef ModifiableMultiResImageRegistrationAlgorithmBase Self; typedef MultiResImageRegistrationAlgorithmBase Superclass; /** Type of pyramid schedule type */ - typedef typename Superclass::ResolutionLevelCountType ResolutionLevelCountType; - typedef typename Superclass::ScheduleType ScheduleType; + using ResolutionLevelCountType = typename Superclass::ResolutionLevelCountType; + using ScheduleType = typename Superclass::ScheduleType; - typedef typename PyramidesPolicyType::TargetImagePyramideBaseType TargetImagePyramideBaseType; - typedef typename PyramidesPolicyType::TargetImagePyramideBasePointer TargetImagePyramideBasePointer; - typedef typename PyramidesPolicyType::MovingImagePyramideBaseType MovingImagePyramideBaseType; - typedef typename PyramidesPolicyType::MovingImagePyramideBasePointer MovingImagePyramideBasePointer; + using TargetImagePyramideBaseType = typename PyramidesPolicyType::TargetImagePyramideBaseType; + using TargetImagePyramideBasePointer = typename PyramidesPolicyType::TargetImagePyramideBasePointer; + using MovingImagePyramideBaseType = typename PyramidesPolicyType::MovingImagePyramideBaseType; + using MovingImagePyramideBasePointer = typename PyramidesPolicyType::MovingImagePyramideBasePointer; /*! @brief sets the moving and the target schedule as copies of the passed schedule. Before the new schedule is set onScheduleChange will be called. @pre the 2nd Dimension of the passed schedule must equal the resolution dimension of moving and target information space. @pre the 1st Dimension of the schedule must be >=1 (hence it must have at least one resolution level). @eguarantee strong */ virtual void setSchedule(const ScheduleType& schedule); /*! resets the both schedules to the passed level count. The sub sampling rate of a level is 2^(levels - n). n is the current level (starting with 1).\n Passing 4 will therefore generate 8, 4, 2, 1. @pre "levels" must be >0. */ virtual void setResolutionLevels(ResolutionLevelCountType levels); /*! @brief sets the moving and the target schedule as copies of the passed schedules. Before the new schedule is set onScheduleChange will be called. @pre the 2nd Dimension of the passed schedules must equal the resolution dimension of their information spaces. @pre the 1st Dimension of the passed schedules must be equal @pre the 1st Dimension of the schedule must be >1 (hence it must have at least one resolution level). @eguarantee strong */ virtual void setSchedule(const ScheduleType& movingSchedule, const ScheduleType& targetSchedule); protected: /*! @brief virtual destructor */ - virtual ~ModifiableMultiResImageRegistrationAlgorithmBase(); + ~ModifiableMultiResImageRegistrationAlgorithmBase() override; ModifiableMultiResImageRegistrationAlgorithmBase(); private: //No copy constructor allowed ModifiableMultiResImageRegistrationAlgorithmBase(const Self& source); void operator=(const Self&); //purposely not implemented }; - } -} + } // namespace algorithm +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapModifiableMultiResImageRegistrationAlgorithmBase.tpp" #endif #endif diff --git a/Code/Algorithms/Common/include/mapModifiableMultiResImageRegistrationAlgorithmBase.tpp b/Code/Algorithms/Common/include/mapModifiableMultiResImageRegistrationAlgorithmBase.tpp index 4502f65..776dde8 100644 --- a/Code/Algorithms/Common/include/mapModifiableMultiResImageRegistrationAlgorithmBase.tpp +++ b/Code/Algorithms/Common/include/mapModifiableMultiResImageRegistrationAlgorithmBase.tpp @@ -1,76 +1,76 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MODIFIABLE_MULTI_RES_IMAGE_REGISTRATION_ALGORITHM_INTERFACE_TPP #define __MODIFIABLE_MULTI_RES_IMAGE_REGISTRATION_ALGORITHM_INTERFACE_TPP namespace map { namespace algorithm { // **** public methods **** // ************************ template void ModifiableMultiResImageRegistrationAlgorithmBase:: setSchedule(const ScheduleType& schedule) { setSchedule(schedule, schedule); }; template void ModifiableMultiResImageRegistrationAlgorithmBase:: setResolutionLevels(ResolutionLevelCountType levels) { Superclass::setResolutionLevels(levels); }; template void ModifiableMultiResImageRegistrationAlgorithmBase:: setSchedule(const ScheduleType& movingSchedule, const ScheduleType& targetSchedule) { Superclass::setSchedule(movingSchedule, targetSchedule); }; // **** protected methods **** // *************************** template ModifiableMultiResImageRegistrationAlgorithmBase:: ~ModifiableMultiResImageRegistrationAlgorithmBase() {} template ModifiableMultiResImageRegistrationAlgorithmBase:: ModifiableMultiResImageRegistrationAlgorithmBase() { } - } // end namespace algorithms + } // namespace algorithm } // end namespace map #endif diff --git a/Code/Algorithms/Common/include/mapMultiResImageRegistrationAlgorithmBase.h b/Code/Algorithms/Common/include/mapMultiResImageRegistrationAlgorithmBase.h index 22d1c60..bb6bf1b 100644 --- a/Code/Algorithms/Common/include/mapMultiResImageRegistrationAlgorithmBase.h +++ b/Code/Algorithms/Common/include/mapMultiResImageRegistrationAlgorithmBase.h @@ -1,149 +1,149 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MULTI_RES_IMAGE_REGISTRATION_ALGORITHM_INTERFACE_H #define __MULTI_RES_IMAGE_REGISTRATION_ALGORITHM_INTERFACE_H #include "itkIndent.h" #include "itkMultiResolutionPyramidImageFilter.h" #include "itkConceptChecking.h" #include "mapMultiResRegistrationAlgorithmBase.h" /*! @namespace */ namespace map { namespace algorithm { /*! @class MultiResImageRegistrationAlgorithmBase *@brief This is the default implementation/extension of the MultiResRegistrationAlgorithmBase * for image based algorithms. * * You can use this base class when you want to implement a image based algorithm that supports * multiple resolutions / scales. The resolution number and scaling is defined by schedules. * This implementation is read only and offers no public interfaces to set resolution levels or * schedule. If you need this feature, please see ModifiableMultiResImageRegistrationAlgorithmBase. * This base class allows depending on the used pyramide policy to set the pyramide types. (see ImagePyramideSetterInterface and ImagePyramideSetterInterface * added by TPyramidesPolicy; e.g. ArbitraryImagePyramidePolicy) * *@ingroup AlgorithmFacets *@template TMovingImage the type of the moving image *@template TTargetImage the type of the target image *@template TPyramidesPolicy Policy that defines how the image pyramides can be changed an what interfaces are offered by the base class. */ template class MultiResImageRegistrationAlgorithmBase: public MultiResRegistrationAlgorithmBase, public TPyramidesPolicy { public: - typedef TMovingImage MovingImageType; - typedef TTargetImage TargetImageType; - typedef TPyramidesPolicy PyramidesPolicyType; + using MovingImageType = TMovingImage; + using TargetImageType = TTargetImage; + using PyramidesPolicyType = TPyramidesPolicy; typedef MultiResImageRegistrationAlgorithmBase Self; - typedef MultiResRegistrationAlgorithmBase Superclass; + using Superclass = MultiResRegistrationAlgorithmBase; /** Type of pyramid schedule type */ - typedef typename Superclass::ScheduleType ScheduleType; + using ScheduleType = typename Superclass::ScheduleType; - typedef typename PyramidesPolicyType::TargetImagePyramideBaseType TargetImagePyramideBaseType; - typedef typename PyramidesPolicyType::TargetImagePyramideBasePointer TargetImagePyramideBasePointer; - typedef typename PyramidesPolicyType::MovingImagePyramideBaseType MovingImagePyramideBaseType; - typedef typename PyramidesPolicyType::MovingImagePyramideBasePointer MovingImagePyramideBasePointer; + using TargetImagePyramideBaseType = typename PyramidesPolicyType::TargetImagePyramideBaseType; + using TargetImagePyramideBasePointer = typename PyramidesPolicyType::TargetImagePyramideBasePointer; + using MovingImagePyramideBaseType = typename PyramidesPolicyType::MovingImagePyramideBaseType; + using MovingImagePyramideBasePointer = typename PyramidesPolicyType::MovingImagePyramideBasePointer; - typedef typename Superclass::DimensionCountType DimensionCountType; + using DimensionCountType = typename Superclass::DimensionCountType; #ifdef ITK_USE_CONCEPT_CHECKING /** Begin concept checking */ itkConceptMacro(MovingImageFitsPyramideCheck, (::itk::Concept::SameType)); itkConceptMacro(TargetImageFitsPyramideCheck, (::itk::Concept::SameType)); /** End concept checking */ #endif /*! @brief Returns the number of dimensions for the moving information space. @eguarantee strong */ - DimensionCountType getMovingResolutionDimensions() const; + DimensionCountType getMovingResolutionDimensions() const override; /*! @brief Returns the number of dimensions for the target information space. @eguarantee strong */ - DimensionCountType getTargetResolutionDimensions() const; + DimensionCountType getTargetResolutionDimensions() const override; protected: /*! @brief virtual destructor */ - virtual ~MultiResImageRegistrationAlgorithmBase(); + ~MultiResImageRegistrationAlgorithmBase() override; MultiResImageRegistrationAlgorithmBase(); /*! Methods invoked by derivated classes. */ virtual void PrintSelf(std::ostream& os, ::itk::Indent indent) const; /*! This member function is called by the interface if the moving image pyramide instance changes. * Two events will be invoked with this command: \n * - UnregisterAlgorithmComponentEvent * - RegisterAlgorithmComponentEvent * . * The first one is used when the current pyramide is going to be replaced. The event data in this case * is a void pointer to the current (soon outdated) object. The second event will be called when the new * image pyramide was set. In this case the event data is a pointer to the new pyramide.*/ virtual void onMovingImagePyramideChange(const ::itk::EventObject& eventObject) = 0; void onMovingImagePyramideChangeHelper(const ::itk::EventObject& eventObject); /*! This member function is called by the interface if the target image pyramide instance changes. * Two events will be invoked with this command: \n * - UnregisterAlgorithmComponentEvent * - RegisterAlgorithmComponentEvent * . * The first one is used when the current pyramide is going to be replaced. The event data in this case * is a void pointer to the current (soon outdated) object. The second event will be called when the new * image pyramide was set. In this case the event data is a pointer to the new pyramide.*/ virtual void onTargetImagePyramideChange(const ::itk::EventObject& eventObject) = 0; void onTargetImagePyramideChangeHelper(const ::itk::EventObject& eventObject); private: //No copy constructor allowed MultiResImageRegistrationAlgorithmBase(const Self& source); void operator=(const Self&); //purposely not implemented }; - } -} + } // namespace algorithm +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapMultiResImageRegistrationAlgorithmBase.tpp" #endif #endif diff --git a/Code/Algorithms/Common/include/mapMultiResImageRegistrationAlgorithmBase.tpp b/Code/Algorithms/Common/include/mapMultiResImageRegistrationAlgorithmBase.tpp index b94fb2e..8a82300 100644 --- a/Code/Algorithms/Common/include/mapMultiResImageRegistrationAlgorithmBase.tpp +++ b/Code/Algorithms/Common/include/mapMultiResImageRegistrationAlgorithmBase.tpp @@ -1,109 +1,109 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MULTI_RES_IMAGE_REGISTRATION_ALGORITHM_INTERFACE_TPP #define __MULTI_RES_IMAGE_REGISTRATION_ALGORITHM_INTERFACE_TPP namespace map { namespace algorithm { // **** public methods **** // ************************ /*! @brief Returns the number of dimensions for the moving information space. @eguarantee strong */ template typename MultiResImageRegistrationAlgorithmBase::DimensionCountType MultiResImageRegistrationAlgorithmBase:: getMovingResolutionDimensions() const { return TMovingImage::ImageDimension; }; /*! @brief Returns the number of dimensions for the target information space. @eguarantee strong */ template typename MultiResImageRegistrationAlgorithmBase::DimensionCountType MultiResImageRegistrationAlgorithmBase:: getTargetResolutionDimensions() const { return TTargetImage::ImageDimension; }; // **** protected methods **** // *************************** template MultiResImageRegistrationAlgorithmBase:: ~MultiResImageRegistrationAlgorithmBase() {} template MultiResImageRegistrationAlgorithmBase:: MultiResImageRegistrationAlgorithmBase() { //now set the policy event slots typedef ::itk::ReceptorMemberCommand AlgorithmCommandType; typename AlgorithmCommandType::Pointer spMovingPyramideCmd = AlgorithmCommandType::New(); spMovingPyramideCmd->SetCallbackFunction(this, &Self::onMovingImagePyramideChangeHelper); PyramidesPolicyType::_spOnChangeMoving = spMovingPyramideCmd; typename AlgorithmCommandType::Pointer spTargetPyramideCmd = AlgorithmCommandType::New(); spTargetPyramideCmd->SetCallbackFunction(this, &Self::onTargetImagePyramideChangeHelper); PyramidesPolicyType::_spOnChangeTarget = spTargetPyramideCmd; } template void MultiResImageRegistrationAlgorithmBase:: PrintSelf(std::ostream& os, ::itk::Indent indent) const { os << indent << "Moving pyramide: " << this->getMovingPyramideInternal() << std::endl; os << indent << "Target pyramide: " << this->getTargetPyramideInternal() << std::endl; } template void MultiResImageRegistrationAlgorithmBase:: onMovingImagePyramideChangeHelper(const ::itk::EventObject& eventObject) { onMovingImagePyramideChange(eventObject); } template void MultiResImageRegistrationAlgorithmBase:: onTargetImagePyramideChangeHelper(const ::itk::EventObject& eventObject) { onTargetImagePyramideChange(eventObject); } - } // end namespace algorithms + } // namespace algorithm } // end namespace map #endif diff --git a/Code/Algorithms/Common/include/mapMultiResRegistrationAlgorithmBase.h b/Code/Algorithms/Common/include/mapMultiResRegistrationAlgorithmBase.h index 01b7f91..294cb7f 100644 --- a/Code/Algorithms/Common/include/mapMultiResRegistrationAlgorithmBase.h +++ b/Code/Algorithms/Common/include/mapMultiResRegistrationAlgorithmBase.h @@ -1,140 +1,139 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MULTI_RES_REGISTRATION_ALGORITHM_BASE_H #define __MULTI_RES_REGISTRATION_ALGORITHM_BASE_H #include "mapMultiResRegistrationAlgorithmInterface.h" #include "mapMacros.h" #include "mapMAPAlgorithmsExports.h" /*! @namespace map The namespace map is used throughout the MatchPoint project to mark code as components of this project */ namespace map { namespace algorithm { /*! @class MultiResRegistrationAlgorithmBase This is the default implementation of the interface for multi resolution / multi scale algorithms. @ingroup AlgorithmFacets @remark This base class only implements setter as protected methods. It gives developers the freedom to decide wether a algorithm supports the setting resolution levels / schedules or not, by implementing the "setter" facets (facet::MultiResRegistrationAlgorithmSetterInterface or facet::MultiResScheduleSetterInterface)and calling the prepared protected implementations. @remark Algorithms that want to support resolution events and implement this interface should use the ResolutionChangedEventt to indicate the beginning of the next resolution level usage @see map::events::AlgorithmIterationEvent */ class MAPAlgorithms_EXPORT MultiResRegistrationAlgorithmBase : public facet::MultiResRegistrationAlgorithmInterface { public: - typedef MultiResRegistrationAlgorithmBase Self; + using Self = MultiResRegistrationAlgorithmBase; - typedef facet::MultiResRegistrationAlgorithmInterface::DimensionCountType DimensionCountType; - typedef facet::MultiResRegistrationAlgorithmInterface::ScalingType ScalingType; - typedef facet::MultiResRegistrationAlgorithmInterface::ResolutionLevelCountType - ResolutionLevelCountType; - typedef facet::MultiResRegistrationAlgorithmInterface::ScheduleType ScheduleType; + using DimensionCountType = facet::MultiResRegistrationAlgorithmInterface::DimensionCountType; + using ScalingType = facet::MultiResRegistrationAlgorithmInterface::ScalingType; + using ResolutionLevelCountType = facet::MultiResRegistrationAlgorithmInterface::ResolutionLevelCountType; + using ScheduleType = facet::MultiResRegistrationAlgorithmInterface::ScheduleType; /*! returns the current schedule for the moving information space @eguarantee strong*/ - virtual const ScheduleType& getMovingSchedule() const; + const ScheduleType& getMovingSchedule() const override; /*! returns the current schedule for the target information space @eguarantee strong*/ - virtual const ScheduleType& getTargetSchedule() const; + const ScheduleType& getTargetSchedule() const override; /*! returns the the resolution level count @eguarantee strong*/ - virtual ResolutionLevelCountType getResolutionLevels() const; + ResolutionLevelCountType getResolutionLevels() const override; /*! @brief gets the number of the algorithm's current resolution level iteration @eguarantee strong @return returns the algorithm's current level. If the algorithm is not able to deduce (hasLevelCount()==false) this information, 0 will be returned. @retval an IterationCountType specifying the current iteration @eguarantee strong */ - virtual ResolutionLevelCountType getCurrentLevel() const; + ResolutionLevelCountType getCurrentLevel() const override; protected: MultiResRegistrationAlgorithmBase(); - virtual ~MultiResRegistrationAlgorithmBase(); + ~MultiResRegistrationAlgorithmBase() override; /*! resets the both schedules to the passed level count. The sub sampling rate of a level is 2^(levels - n). n is the current level (starting with 1).\n Passing 4 will therefore generate 8, 4, 2, 1. @pre "levels" must be >0. */ virtual void setResolutionLevels(ResolutionLevelCountType levels); /*! @brief sets the moving and the target schedule as copies of the passed schedules. Before the new schedule is set onScheduleChange will be called. @pre the 2nd Dimension of the passed schedules must equal the resolution dimension of their information spaces. @pre the 1st Dimension of the passed schedules must be equal @pre the 1st Dimension of the schedule must be >1 (hence it must have at least one resolution level). @eguarantee strong */ virtual void setSchedule(const ScheduleType& movingSchedule, const ScheduleType& targetSchedule); /*! Method is called when the schedules are going to be changed. Overwrite this method to create special algorithmic behaviour. @post new moving and target schedule must be have still valid dimensions. 1st dimension must be equal vor both schedules 2nd dimesion must be euqal to the dimension count of the according information space. @eguarantee strong */ virtual void onScheduleChange(const ScheduleType& oldMovingSchedule, ScheduleType& newMovingSchedule, const ScheduleType& oldTargetSchedule, ScheduleType& newTargetMovingSchedule) const; /*! return the current resolution level number. Will be called by getCurrentLevel() if hasLevelCount() returns true. @eguarantee strong @return level count */ virtual ResolutionLevelCountType doGetCurrentLevel() const = 0; ScheduleType _movingResSchedule; ScheduleType _targetResSchedule; private: //No copy constructor allowed - MultiResRegistrationAlgorithmBase(const Self& source); //purposely not implemented - void operator=(const Self&); //purposely not implemented + MultiResRegistrationAlgorithmBase(const Self& source) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; - } -} + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapMultiResRegistrationAlgorithmInterface.h b/Code/Algorithms/Common/include/mapMultiResRegistrationAlgorithmInterface.h index e537fd5..ffe1581 100644 --- a/Code/Algorithms/Common/include/mapMultiResRegistrationAlgorithmInterface.h +++ b/Code/Algorithms/Common/include/mapMultiResRegistrationAlgorithmInterface.h @@ -1,112 +1,112 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MULTI_RES_REGISTRATION_ALGORITHM_INTERFACE_H #define __MULTI_RES_REGISTRATION_ALGORITHM_INTERFACE_H #include "itkArray2D.h" /*! @namespace map The namespace map is used throughout the MatchPoint project to mark code as components of this project */ namespace map { namespace algorithm { namespace facet { /*! @class MultiResRegistrationAlgorithmInterface This is the interface that should be implemented for algorithm that support multi resolution/ multi scale approaches. @ingroup AlgorithmFacets @remark Algorithms that want to support resolution events and implement this interface should use the ResolutionChangedEventt to indicate the beginning of the next resolution level usage @see map::events::AlgorithmIterationEvent @see map::algorithm::facet::MultiResRegistrationAlgorithmSetterInterface */ class MultiResRegistrationAlgorithmInterface { public: - typedef MultiResRegistrationAlgorithmInterface Self; + using Self = MultiResRegistrationAlgorithmInterface; - typedef unsigned int DimensionCountType; - typedef unsigned int ScalingType; - typedef unsigned int ResolutionLevelCountType; - typedef ::itk::Array2D ScheduleType; + using DimensionCountType = unsigned int; + using ScalingType = unsigned int; + using ResolutionLevelCountType = unsigned int; + using ScheduleType = ::itk::Array2D; /*! @brief Returns the number of dimensions for the moving information space. Must be implemented by the algorithm that realizes the interface. @eguarantee strong */ virtual DimensionCountType getMovingResolutionDimensions() const = 0; /*! @brief Returns the number of dimensions for the target information space. Must be implemented by the algorithm that realizes the interface. @eguarantee strong */ virtual DimensionCountType getTargetResolutionDimensions() const = 0; /*! returns the current schedule for the moving information space @eguarantee strong*/ virtual const ScheduleType& getMovingSchedule() const = 0; /*! returns the current schedule for the target information space @eguarantee strong*/ virtual const ScheduleType& getTargetSchedule() const = 0; /*! returns the the resolution level count @eguarantee strong*/ virtual ResolutionLevelCountType getResolutionLevels() const = 0; /*! Indicates if the current processed level can be deduced @eguarantee no fail */ virtual bool hasLevelCount() const = 0; /*! @brief gets the number of the algorithm's current resolution level @eguarantee strong @return returns the algorithm's current level. If the algorithm is not able to deduce (hasLevelCount()==false) this information, 0 will be returned. @retval an IterationCountType specifying the current iteration @eguarantee strong */ virtual ResolutionLevelCountType getCurrentLevel() const = 0; protected: - MultiResRegistrationAlgorithmInterface() {}; - virtual ~MultiResRegistrationAlgorithmInterface() {}; + MultiResRegistrationAlgorithmInterface() = default; + virtual ~MultiResRegistrationAlgorithmInterface() = default; private: //No copy constructor allowed - MultiResRegistrationAlgorithmInterface(const Self& source); //purposely not implemented - void operator=(const Self&); //purposely not implemented + MultiResRegistrationAlgorithmInterface(const Self& source) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapMultiResRegistrationAlgorithmSetterInterface.h b/Code/Algorithms/Common/include/mapMultiResRegistrationAlgorithmSetterInterface.h index 83bf72e..5cbcac3 100644 --- a/Code/Algorithms/Common/include/mapMultiResRegistrationAlgorithmSetterInterface.h +++ b/Code/Algorithms/Common/include/mapMultiResRegistrationAlgorithmSetterInterface.h @@ -1,74 +1,74 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MULTI_RES_REGISTRATION_ALGORITHM_SETTER_INTERFACE_H #define __MULTI_RES_REGISTRATION_ALGORITHM_SETTER_INTERFACE_H #include "mapMultiResRegistrationAlgorithmInterface.h" /*! @namespace map The namespace map is used throughout the MatchPoint project to mark code as components of this project */ namespace map { namespace algorithm { namespace facet { /*! @class MultiResRegistrationAlgorithmSetterInterface This is the interface for multi resolution/ multi scale algorithms that allow the setting of there resolution schedule. @ingroup AlgorithmFacets @see map::algorithm::facet::MultiResRegistrationAlgorithmInterface */ class MultiResRegistrationAlgorithmSetterInterface { public: - typedef MultiResRegistrationAlgorithmSetterInterface Self; + using Self = MultiResRegistrationAlgorithmSetterInterface; - typedef MultiResRegistrationAlgorithmInterface::ResolutionLevelCountType ResolutionLevelCountType; + using ResolutionLevelCountType = MultiResRegistrationAlgorithmInterface::ResolutionLevelCountType; /*! resets the both schedules to the passed level count. The sub sampling rate of a level is 2^(levels - n). n is the current level (starting with 1).\n Passing 4 will therefore generate 8, 4, 2, 1. @pre "levels" must be >0. */ virtual void setResolutionLevels(ResolutionLevelCountType levels) = 0; protected: - MultiResRegistrationAlgorithmSetterInterface() {}; - virtual ~MultiResRegistrationAlgorithmSetterInterface() {}; + MultiResRegistrationAlgorithmSetterInterface() = default; + virtual ~MultiResRegistrationAlgorithmSetterInterface() = default; private: //No copy constructor allowed - MultiResRegistrationAlgorithmSetterInterface(const Self& source); //purposely not implemented - void operator=(const Self&); //purposely not implemented + MultiResRegistrationAlgorithmSetterInterface(const Self& source) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapMultiResScheduleSetterInterface.h b/Code/Algorithms/Common/include/mapMultiResScheduleSetterInterface.h index 513c9d6..4b25e2a 100644 --- a/Code/Algorithms/Common/include/mapMultiResScheduleSetterInterface.h +++ b/Code/Algorithms/Common/include/mapMultiResScheduleSetterInterface.h @@ -1,88 +1,88 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MULTI_RES_SCHEDULE_SETTER_INTERFACE_H #define __MULTI_RES_SCHEDULE_SETTER_INTERFACE_H #include "mapMultiResRegistrationAlgorithmInterface.h" /*! @namespace map The namespace map is used throughout the MatchPoint project to mark code as components of this project */ namespace map { namespace algorithm { namespace facet { /*! @class MultiResRegistrationAlgorithmSetterInterface This is the interface for multi resolution/ multi scale algorithms that allow the setting of their resolution schedule. @ingroup AlgorithmFacets @see map::algorithm::facet::MultiResRegistrationAlgorithmInterface */ class MultiResScheduleSetterInterface { public: - typedef MultiResScheduleSetterInterface Self; + using Self = MultiResScheduleSetterInterface; - typedef MultiResRegistrationAlgorithmInterface::ScheduleType ScheduleType; + using ScheduleType = MultiResRegistrationAlgorithmInterface::ScheduleType; /*! @brief sets the moving and the target schedule as copies of the passed schedule. @pre the 2nd Dimension of the passed schedule must equal the resolution dimension of moving and target information space. @pre the 1st Dimension of the schedule must be >1 (hence it must have at least one resolution level). @eguarantee strong */ virtual void setSchedule(const ScheduleType& schedule) = 0; /*! @brief sets the moving and the target schedule as copies of the passed schedules. @pre the 2nd Dimension of the passed schedules must equal the resolution dimension of their information spaces. @pre the 1st Dimension of the passed schedules must be equal @pre the 1st Dimension of the schedule must be >1 (hence it must have at least one resolution level). @eguarantee strong */ virtual void setSchedule(const ScheduleType& movingSchedule, const ScheduleType& targetSchedule) = 0; protected: - MultiResScheduleSetterInterface() {}; - virtual ~MultiResScheduleSetterInterface() {}; + MultiResScheduleSetterInterface() = default; + virtual ~MultiResScheduleSetterInterface() = default; private: //No copy constructor allowed - MultiResScheduleSetterInterface(const Self& source); //purposely not implemented - void operator=(const Self&); //purposely not implemented + MultiResScheduleSetterInterface(const Self& source) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapNoComponentInitializationPolicy.h b/Code/Algorithms/Common/include/mapNoComponentInitializationPolicy.h index 9007236..5fe9ce8 100644 --- a/Code/Algorithms/Common/include/mapNoComponentInitializationPolicy.h +++ b/Code/Algorithms/Common/include/mapNoComponentInitializationPolicy.h @@ -1,63 +1,63 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __NO_COMPONENT_INITIALIZATION_POLICY_H #define __NO_COMPONENT_INITIALIZATION_POLICY_H namespace map { namespace algorithm { namespace itk { /*! @struct NoComponentInitializationPolicy * @brief Policy that defines the initialization of a component. * * In this case it doesn't initialize the * passed component at all. This policy is for example used in conjunction * with FixedPolicy and SealedPolicy to define the default values of a * component used in an registration algorithm. * @ingroup ITKPolicies */ struct NoComponentInitializationPolicy { public: /*! @remark Elipsis are normaly considered bad practice, but in this case * the use is adequat in order to ease the use of the no component policy. * By using the elipsis the interface requirements for component initialisation * policies are met for any component, thus we can use one NoComponentInitializationPolicy. * for any component. Disadvantages of elipsis like loss of type information * don't matter in this case because the method is a dummy function and has no * real implementation. Normal initialization policies should have a reference to * the component as parameter. */ static void initialize(...) {}; }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapOptimizerControlInterface.h b/Code/Algorithms/Common/include/mapOptimizerControlInterface.h index 200f5c3..b85f783 100644 --- a/Code/Algorithms/Common/include/mapOptimizerControlInterface.h +++ b/Code/Algorithms/Common/include/mapOptimizerControlInterface.h @@ -1,225 +1,225 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __OPTIMIZER_CONTROL_INTERFACE_H #define __OPTIMIZER_CONTROL_INTERFACE_H #include #include "itkArray.h" #include "mapMacros.h" #include "mapString.h" #include "mapMAPAlgorithmsExports.h" namespace map { namespace algorithm { /*! @class OptimizerControlInterface @brief Interface for controller classes that form a virtual wrapper around optimizers that are used in iterative registration algorithms. This wrapper is used to offer abstract and general access to basic information and methods independent from the concrete optimizer implementation. */ class MAPAlgorithms_EXPORT OptimizerControlInterface { public: - typedef OptimizerControlInterface Self; + using Self = OptimizerControlInterface; - typedef unsigned long IterationCountType; + using IterationCountType = unsigned long; - typedef ::std::vector OptimizerMeasureType; - typedef ::itk::Array OptimizerPositionType; - typedef ::itk::Array OptimizerScalesType; + using OptimizerMeasureType = ::std::vector; + using OptimizerPositionType = ::itk::Array; + using OptimizerScalesType = ::itk::Array; /*! is this optimizer stoppable? @eguarantee no fail @return stoppability as a boolean value */ virtual bool isStoppable() const = 0; /*! stop the optimizer @eguarantee strong @return success of operation. If optimizer cannot be stopped by the user, return is always false */ bool stop(); /*! has the optimizer an iteration count? @eguarantee no fail @return Indicates if the optimizer can determin its current iteration count */ virtual bool hasIterationCount() const = 0; /*! return the current number of iterations. @eguarantee strong @return Iteration count. If the optimizer has no iteration count, return is always 0 */ IterationCountType getCurrentIteration() const; /*! has the optimizer an maximum iteration count? @eguarantee no fail @return Indicates if the algorithm can determin its maximum iteration count */ virtual bool hasMaxIterationCount() const = 0; /*! @brief gets the maximum number of the optimizers's iterations @eguarantee strong @return returns the optimizers's maximum iterations count */ virtual IterationCountType getMaxIterations() const; /*! @brief Indicates if the optimizer is able to minimize a cost function @eguarantee strong */ virtual bool canMinimize() const = 0; /*! @brief Indicates if the optimizer is able to maximize a cost function @eguarantee strong */ virtual bool canMaximize() const = 0; /*! @brief Indicates if the optimizer is currently in minimization mode. @eguarantee strong */ virtual bool getMinimize() const = 0; /*! @brief Indicates if the optimizer is currently in maximization mode. @eguarantee strong */ virtual bool getMaximize() const = 0; /*! @brief Changes the optimizer into minimization mode. May raise exception if this isn't possible. To avoid the exception check with canMinimize()/canMaximize() before hand. @eguarantee strong */ virtual void setMinimize(bool minimize) = 0; /*! @brief Changes the optimizer into maximization mode. May raise exception if this isn't possible. To avoid the exception check with canMinimize()/canMaximize() before hand. @eguarantee strong */ virtual void setMaximize(bool maximize) = 0; /*! This function indicates of the optimizer of the iterative registration algorithm is * able to return its current metric/optimizer value(s)? @eguarantee no fail @return Indicates if the algorithm can determin its curent value. */ virtual bool hasCurrentValue() const = 0; /*! @brief gets the current value/cost of the optimizer iteration of the registration algorithm @eguarantee strong @return returns the optimizers current value/cost if optimizer cannot return current values (hasCurrentValue == false) an empty vector will be returned. */ OptimizerMeasureType getCurrentValue() const; /*! This function indicates of the optimizer of the iterative registration algorithm is * able to return its current optimizer position in search space. @eguarantee no fail @return Indicates if the algorithm can determin its current position. */ virtual bool hasCurrentPosition() const = 0; /*! @brief gets the current position of the optimizer iteration of the registration algorithm @eguarantee strong @return returns the optimizers current position if optimizer cannot return current values (hasCurrentValue == false) an empty vector will be returned. */ OptimizerPositionType getCurrentPosition() const; /*! This function indicates of the optimizer of the iterative registration algorithm uses * parameter scaling to normalize different dynamic ranges of its search space. @eguarantee no fail @return Indicates if the algorithm can determin its current position. */ virtual bool hasScales() const = 0; /*! @brief gets the scaling of the search parameters of the optimizer of the registration algorithm @eguarantee strong @return returns the scaling of parameters of optimizer. An empty array will be returned. */ OptimizerScalesType getScales() const; /** Get the reason for last termination of the optimizer. * If the return value is an empty string the optimizer hasn't terminated yet or * does not support this method to indicate the termination reason.*/ virtual const core::String getStopConditionDescription() const = 0; protected: /*! stop the optimizer Will be called by stop() if isStopable() returns true. @eguarantee strong @return success of operation. If optimizer cannot be stopped by the user, return is always false */ virtual bool doStop() = 0; /*! return the current number of iterations. Will be called by getCurrentIteration() if hasIterationCount() returns true. @eguarantee strong @return Iteration count */ virtual IterationCountType doGetCurrentIteration() const = 0; /*! return the maximum number of iterations. Will be called by getMaxIterations() if hasMaxIterationCount() returns true. @eguarantee strong @return Maximum iteration count */ virtual IterationCountType doGetMaxIterations() const = 0; /*! Will be called to get the current value/cost of the optimizer iteration @eguarantee strong @return returns the optimizers current value/cost */ virtual OptimizerMeasureType doGetCurrentValue() const = 0; /*! Will be called to get the current position of the optimizer iteration @eguarantee strong @return returns the optimizers current position */ virtual OptimizerPositionType doGetCurrentPosition() const = 0; /*! Will be called to get the scales of the optimizer @eguarantee strong @return returns the scales */ virtual OptimizerScalesType doGetScales() const = 0; OptimizerControlInterface(); virtual ~OptimizerControlInterface(); private: //No copy constructor allowed - OptimizerControlInterface(const Self& source); - void operator=(const Self&); //purposely not implemented + OptimizerControlInterface(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; - } -} + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapOptimizerGetterInterface.h b/Code/Algorithms/Common/include/mapOptimizerGetterInterface.h index fa63c50..bc31d12 100644 --- a/Code/Algorithms/Common/include/mapOptimizerGetterInterface.h +++ b/Code/Algorithms/Common/include/mapOptimizerGetterInterface.h @@ -1,74 +1,74 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __OPTIMIZER_GETTER_INTERFACE_H #define __OPTIMIZER_GETTER_INTERFACE_H #include "mapOptimizerControlInterface.h" namespace map { namespace algorithm { namespace facet { /*! @class OptimizerGetterInterface * Interface inherited by every algorithm that is able to get an optimizer and/or change its members (none const getter) @ingroup AlgorithmFacets */ class MAPAlgorithms_EXPORT OptimizerGetterInterface { public: - typedef OptimizerGetterInterface Self; + using Self = OptimizerGetterInterface; - typedef OptimizerControlInterface OptimizerControlType; + using OptimizerControlType = OptimizerControlInterface; /*! @brief gets the optimizer control @eguarantee no fail @return pointer to an OptimizerControlType object */ virtual OptimizerControlType* getOptimizerControl() = 0; /*! @brief gets the optimizer control @eguarantee no fail @return pointer to an OptimizerControlType object */ virtual const OptimizerControlType* getOptimizerControl() const = 0; protected: OptimizerGetterInterface(); virtual ~OptimizerGetterInterface(); private: //No copy constructor allowed - OptimizerGetterInterface(const Self& source); - void operator=(const Self&); //purposely not implemented + OptimizerGetterInterface(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapPointSetRegistrationAlgorithmInterface.h b/Code/Algorithms/Common/include/mapPointSetRegistrationAlgorithmInterface.h index 2ef2a1b..268f0d6 100644 --- a/Code/Algorithms/Common/include/mapPointSetRegistrationAlgorithmInterface.h +++ b/Code/Algorithms/Common/include/mapPointSetRegistrationAlgorithmInterface.h @@ -1,109 +1,109 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __POINT_SET_REGISTRATION_ALGORITHM_INTERFACE_H #define __POINT_SET_REGISTRATION_ALGORITHM_INTERFACE_H #include "mapModificationTimeValidator.h" #include "itkIndent.h" /*! @namespace */ namespace map { namespace algorithm { namespace facet { /*! @class PointSetRegistrationAlgorithmInterface @brief This is the interface for point set based registration algorithms @ingroup AlgorithmFacets @template TMovingPointSet Type of the moving point set @template TTargetPointSet Type of the target point set */ template class PointSetRegistrationAlgorithmInterface { public: typedef PointSetRegistrationAlgorithmInterface Self; - typedef TMovingPointSet MovingPointSetType; - typedef TTargetPointSet TargetPointSetType; + using MovingPointSetType = TMovingPointSet; + using TargetPointSetType = TTargetPointSet; - typedef typename MovingPointSetType::ConstPointer MovingPointSetConstPointer; - typedef typename TargetPointSetType::ConstPointer TargetPointSetConstPointer; + using MovingPointSetConstPointer = typename MovingPointSetType::ConstPointer; + using TargetPointSetConstPointer = typename TargetPointSetType::ConstPointer; /*! @brief gets a const pointer to the moving point set @eguarantee strong @return a const pointer to the moving point set */ virtual MovingPointSetConstPointer getMovingPointSet() const = 0; /*! @brief gets a const pointer to the target point set @eguarantee strong @return a const pointer to the target point set */ virtual TargetPointSetConstPointer getTargetPointSet() const = 0; /*! @brief sets the moving point set @eguarantee strong @param pMovingPointSet a pointer to the moving point set */ virtual void setMovingPointSet(const MovingPointSetType* pMovingPointSet) = 0; /*! @brief sets the target point set @eguarantee strong @param pTargetPointSet a pointer to the moving point set */ virtual void setTargetPointSet(const TargetPointSetType* pTargetPointSet) = 0; /*! returns the modification time of the target point set. */ virtual unsigned long getTargetPointSetMTime() const = 0; /*! returns the modification time of the moving point set. */ virtual unsigned long getMovingPointSetMTime() const = 0; protected: /*! @brief virtual destructor */ virtual ~PointSetRegistrationAlgorithmInterface() {}; PointSetRegistrationAlgorithmInterface() {}; private: //No copy constructor allowed PointSetRegistrationAlgorithmInterface(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapPointSetRegistrationAlgorithmInterfaceV2.h b/Code/Algorithms/Common/include/mapPointSetRegistrationAlgorithmInterfaceV2.h index 35585b3..0816c16 100644 --- a/Code/Algorithms/Common/include/mapPointSetRegistrationAlgorithmInterfaceV2.h +++ b/Code/Algorithms/Common/include/mapPointSetRegistrationAlgorithmInterfaceV2.h @@ -1,218 +1,218 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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: 797 $ (last changed revision) // @date $Date: 2014-10-10 11:42:05 +0200 (Fr, 10 Okt 2014) $ (last change date) // @author $Author: floca $ (last changed by) // Subversion HeadURL: $HeadURL: https://svn.inet.dkfz-heidelberg.de/sbr/Sources/SBR-Projects/MatchPoint/trunk/Code/Algorithms/Common/include/mapPointSetRegistrationAlgorithmInterface.h $ */ #ifndef __POINT_SET_REGISTRATION_ALGORITHM_INTERFACE_V2_H #define __POINT_SET_REGISTRATION_ALGORITHM_INTERFACE_V2_H #include "mapPointSetRegistrationAlgorithmInterface.h" /*! @namespace */ namespace map { namespace algorithm { namespace facet { /*! @class PointSetRegistrationAlgorithmInterfaceV2 @brief This is the interface for point set based registration algorithms (Version 2) This version extents the first version by: 1. Allow define multiple inputs for the roles (moving / target) 2. posibility to query if the input slots are mandatory or just optional. The inputs are indexed (like itk filters) and the interface implies that all mandatory input slots of a role have lower indeces then optional slots of the same role. So e.g. given 4 mandatory moving input slots, by definition they will have the indeces 0..3. Optional slots will start with 4. An additional assumption is that PointSetRegistrationAlgorithmInterface accesses the first slots (slot index 0). According to this assumptions the methods of PointSetRegistrationAlgorithmInterface have a default implementation. @sa PointSetRegistrationAlgorithmInterface @ingroup AlgorithmFacets @template TMovingPointSet Type of the moving point set @template TTargetPointSet Type of the target point set */ template class PointSetRegistrationAlgorithmInterfaceV2 : public PointSetRegistrationAlgorithmInterface { public: typedef PointSetRegistrationAlgorithmInterfaceV2 Self; typedef PointSetRegistrationAlgorithmInterface Superclass; - typedef typename Superclass::MovingPointSetType MovingPointSetType; - typedef typename Superclass::TargetPointSetType TargetPointSetType; + using MovingPointSetType = typename Superclass::MovingPointSetType; + using TargetPointSetType = typename Superclass::TargetPointSetType; - typedef typename Superclass::MovingPointSetConstPointer MovingPointSetConstPointer; - typedef typename Superclass::TargetPointSetConstPointer TargetPointSetConstPointer; - typedef unsigned int SlotIndexType; + using MovingPointSetConstPointer = typename Superclass::MovingPointSetConstPointer; + using TargetPointSetConstPointer = typename Superclass::TargetPointSetConstPointer; + using SlotIndexType = unsigned int; itkTypeMacroNoParent(PointSetRegistrationAlgorithmInterfaceV2); /*! @brief gets a const pointer to the moving point set for the specified index @eguarantee strong @param index Index of the requested slot. @return a const pointer to the moving point set @pre If index is out of bound an exception will be thrown. */ MovingPointSetConstPointer getNthMovingPointSet(SlotIndexType index) const { if (index >= this->getMovingPointSetCount()) { mapDefaultExceptionMacro(<< "Error. Index of requested moving point set is out of bounds. Requested index: " << index << "; number of point sets: " << getMovingPointSetCount()); } return doGetNthMovingPointSet(index); }; /*! @brief gets a const pointer to the target point set for the specified index @eguarantee strong @param index Index of the requested slot. @return a const pointer to the target point set. If no data has been set for the index null ptr will be returned. @pre If index is out of bound an exception will be thrown. */ TargetPointSetConstPointer getNthTargetPointSet(SlotIndexType index) const { if (index >= this->getTargetPointSetCount()) { mapDefaultExceptionMacro(<< "Error. Index of requested target point set is out of bounds. Requested index: " << index << "; number of point sets: " << getTargetPointSetCount()); } return doGetNthTargetPointSet(index); }; /*! @brief sets the moving point set for a specified slot index @eguarantee strong @param pMovingPointSet a pointer to the moving point set @param index Index of the slot. @pre If index is out of bound an exception will be thrown. */ void setNthMovingPointSet(SlotIndexType index, const MovingPointSetType* pMovingPointSet) { if (index >= this->getMovingPointSetCount()) { mapDefaultExceptionMacro(<< "Error. Setter index of moving point set is out of bounds. Specified index: " << index << "; number of point set slots: " << getMovingPointSetCount()); } return doSetNthMovingPointSet(index, pMovingPointSet); }; /*! @brief sets the target point set for a specified slot index @eguarantee strong @param pTargetPointSet a pointer to the moving point set @param index Index of the slot. @pre If index is out of bound an exception will be thrown. */ void setNthTargetPointSet(SlotIndexType index, const TargetPointSetType* pTargetPointSet) { if (index >= this->getTargetPointSetCount()) { mapDefaultExceptionMacro(<< "Error. Setter index of target point set is out of bounds. Specified index: " << index << "; number of point set slots: " << getTargetPointSetCount()); } return doSetNthTargetPointSet(index, pTargetPointSet); }; /*! Indicates if the target and input data of one index are coupled or not. Coupled means that if the index for one role (target or moving) is set, the other role at this index must also be set. @return True if coupled. False if not. @eguarantee strong*/ virtual bool hasCoupledPointSetInputs() const { return true; }; /*! Indicates if the passed index indicates a mandatory (false) or an optional (true) input.*/ virtual bool isOptionalTargetPointSet(SlotIndexType index) const { return false; }; /*! Indicates if the passed index indicates a mandatory (false) or an optional (true) input.*/ virtual bool isOptionalMovingPointSet(SlotIndexType index) const { return false; }; /*! Gets the number of target inputs (in total: onlyMandatory == false) @eguarantee strong */ virtual SlotIndexType getTargetPointSetCount(bool onlyMandatory = false) const { return 1; }; /*! Gets the number of moving inputs (in total: onlyMandatory == false) @eguarantee strong */ virtual SlotIndexType getMovingPointSetCount(bool onlyMandatory = false) const { return 1; }; /*! returns the modification time of the target point set. */ virtual unsigned long getNthTargetPointSetMTime(SlotIndexType index) const = 0; /*! returns the modification time of the moving point set. */ virtual unsigned long getNthMovingPointSetMTime(SlotIndexType index) const = 0; - virtual MovingPointSetConstPointer getMovingPointSet() const override + MovingPointSetConstPointer getMovingPointSet() const override { return getNthMovingPointSet(0); }; - virtual TargetPointSetConstPointer getTargetPointSet() const override + TargetPointSetConstPointer getTargetPointSet() const override { return getNthTargetPointSet(0); } - virtual void setMovingPointSet(const MovingPointSetType* pMovingPointSet) override + void setMovingPointSet(const MovingPointSetType* pMovingPointSet) override { setNthMovingPointSet(0, pMovingPointSet); }; - virtual void setTargetPointSet(const TargetPointSetType* pTargetPointSet) override + void setTargetPointSet(const TargetPointSetType* pTargetPointSet) override { setNthTargetPointSet(0, pTargetPointSet); }; - virtual unsigned long getTargetPointSetMTime() const override + unsigned long getTargetPointSetMTime() const override { return getNthTargetPointSetMTime(0); }; - virtual unsigned long getMovingPointSetMTime() const override + unsigned long getMovingPointSetMTime() const override { return getNthMovingPointSetMTime(0); }; protected: /*! @brief virtual destructor */ - virtual ~PointSetRegistrationAlgorithmInterfaceV2() {}; + ~PointSetRegistrationAlgorithmInterfaceV2() override {}; PointSetRegistrationAlgorithmInterfaceV2() {}; virtual MovingPointSetConstPointer doGetNthMovingPointSet(SlotIndexType index) const = 0; virtual TargetPointSetConstPointer doGetNthTargetPointSet(SlotIndexType index) const = 0; virtual void doSetNthMovingPointSet(SlotIndexType index, const MovingPointSetType* pMovingPointSet) = 0; virtual void doSetNthTargetPointSet(SlotIndexType index, const TargetPointSetType* pTargetPointSet) = 0; private: //No copy constructor allowed PointSetRegistrationAlgorithmInterfaceV2(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapRegistrationAlgorithm.h b/Code/Algorithms/Common/include/mapRegistrationAlgorithm.h index 4b45e63..1f727e4 100644 --- a/Code/Algorithms/Common/include/mapRegistrationAlgorithm.h +++ b/Code/Algorithms/Common/include/mapRegistrationAlgorithm.h @@ -1,176 +1,175 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __REGISTRATION_ALGORITHM_H #define __REGISTRATION_ALGORITHM_H #include "mapRegistrationAlgorithmBase.h" #include "mapRegistrationAlgorithmInterface.h" #include "itkSimpleFastMutexLock.h" namespace map { namespace algorithm { /*! @class RegistrationAlgorithm @brief Template class for registration algorithms. Has input and output dimensions. This class is the abstract class for generating registration algorithms, inherited from RegistrationAlgorithmBase and extended with InputDimensions and OutputDimensions. The different concrete RegistrationAlgorithm implementations inherit from this. @ingroup Algorithms */ template class RegistrationAlgorithm: public RegistrationAlgorithmBase, public facet::RegistrationAlgorithmInterface { public: typedef RegistrationAlgorithm Self; - typedef RegistrationAlgorithmBase Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Superclass = RegistrationAlgorithmBase; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(RegistrationAlgorithm, RegistrationAlgorithmBase); /** Dimension of the algorithm */ itkStaticConstMacro(MovingDimensions, unsigned int, VMovingDimensions); itkStaticConstMacro(TargetDimensions, unsigned int, VTargetDimensions); typedef facet::RegistrationAlgorithmInterface RegistrationAlgorithmInterfaceType; - typedef typename RegistrationAlgorithmInterfaceType::RegistrationType RegistrationType; - typedef typename RegistrationAlgorithmInterfaceType::RegistrationPointer RegistrationPointer; - typedef typename RegistrationAlgorithmInterfaceType::ConstRegistrationPointer - ConstRegistrationPointer; + using RegistrationType = typename RegistrationAlgorithmInterfaceType::RegistrationType; + using RegistrationPointer = typename RegistrationAlgorithmInterfaceType::RegistrationPointer; + using ConstRegistrationPointer = typename RegistrationAlgorithmInterfaceType::ConstRegistrationPointer; /*! @brief Gets the number of moving dimensions for this registration algorithm @eguarantee strong @return The number of moving dimensions @sa getTargetDimensions() */ - unsigned int getMovingDimensions() const; + unsigned int getMovingDimensions() const override; /*! @brief Gets the number of target dimensions for this registration algorithm @eguarantee strong @return The number of target dimensions @sa getMovingDimensions() */ - unsigned int getTargetDimensions() const; + unsigned int getTargetDimensions() const override; /*! Checks if the registration is uptodate. If not the registration becomes (re)computed * the valid registration will be returned. @eguarantee strong @return Smart pointer to the registration instance. May be null if no registration could be computed (determineRegistration returned false). @retval an ITK smart pointer on a specific RegistrationType object */ - RegistrationPointer getRegistration(); + RegistrationPointer getRegistration() override; - typedef core::FieldRepresentationDescriptor MovingRepresentationDescriptorType; - typedef core::FieldRepresentationDescriptor TargetRepresentationDescriptorType; + using MovingRepresentationDescriptorType = core::FieldRepresentationDescriptor; + using TargetRepresentationDescriptorType = core::FieldRepresentationDescriptor; - const MovingRepresentationDescriptorType* getMovingRepresentation() const; - void setMovingRepresentation(const MovingRepresentationDescriptorType* pDescriptor); + const MovingRepresentationDescriptorType* getMovingRepresentation() const override; + void setMovingRepresentation(const MovingRepresentationDescriptorType* pDescriptor) override; - const TargetRepresentationDescriptorType* getTargetRepresentation() const; - void setTargetRepresentation(const TargetRepresentationDescriptorType* pDescriptor); + const TargetRepresentationDescriptorType* getTargetRepresentation() const override; + void setTargetRepresentation(const TargetRepresentationDescriptorType* pDescriptor) override; protected: /*! @brief returns if the registration should be computed. This default implementation returns true * if the doGetRegistration() returns a null pointer. @eguarantee strong @return true if the registration should be (re)computed. False if the registration is uptodate. */ virtual bool registrationIsOutdated() const; /*! @brief internal virtual method that gets the precomputed registration @remark This method does not compute a registration, the computation is done by doDetermineRegistration() @eguarantee strong @return the registration @retval an ITK smart pointer on a specific RegistrationType object */ virtual RegistrationPointer doGetRegistration() const = 0; /*! Indicates the support region in the moving space required by the algorithm user. Thus, every object covered by the representation descriptor should be mapable by the direct kernel. If set to null, the support region should not be limited.*/ typename MovingRepresentationDescriptorType::ConstPointer _spMovingRepresentation; /*! Indicates the support region in the target space required by the algorithm user. Thus, every object covered by the representation descriptor should be mapable by the inverse kernel. If set to null, the support region should not be limited.*/ typename TargetRepresentationDescriptorType::ConstPointer _spTargetRepresentation; /*! This method is called by setMovingRepresentation() before the new representation is set. * This default implementation does nothing. * @param [in] pMovingRepresentation Pointer to the new representation.*/ virtual void doBeforeSetMovingRepresentation(const MovingRepresentationDescriptorType* pMovingRepresentation); /*! This method is called by setMovingRepresentation() after the new representation is set. * This default implementation does nothing.*/ virtual void doAfterSetMovingRepresentation(); /*! This method is called by setTargetRepresentation() before the new representation is set. * This default implementation does nothing. * @param [in] pTargetRepresentation Pointer to the new representation.*/ virtual void doBeforeSetTargetRepresentation(const TargetRepresentationDescriptorType* pTargetRepresentation); /*! This method is called by setTargetRepresentation() after the new representation is set. * This default implementation does nothing.*/ virtual void doAfterSetTargetRepresentation(); /*! This method is called by getMovingRepresentation() before the representation is returned. * This default implementation does nothing.*/ virtual void doBeforeGetMovingRepresentation() const; /*! This method is called by getTargetRepresentation() after the representation is returned. * This default implementation does nothing.*/ virtual void doBeforeGetTargetRepresentation() const; /*! The lock is used to manage the access to determination of a registration * and write acces to all members that are relevant for determination of a registration */ mutable ::itk::SimpleFastMutexLock _determinationLock; RegistrationAlgorithm(); - virtual ~RegistrationAlgorithm(); + ~RegistrationAlgorithm() override; private: - RegistrationAlgorithm(const Self& source); //purposely not implemented - void operator=(const Self&); //purposely not implemented + RegistrationAlgorithm(const Self& source) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; - } -} + } // namespace algorithm +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapRegistrationAlgorithm.tpp" #endif #endif diff --git a/Code/Algorithms/Common/include/mapRegistrationAlgorithm.tpp b/Code/Algorithms/Common/include/mapRegistrationAlgorithm.tpp index f92fead..09c7deb 100644 --- a/Code/Algorithms/Common/include/mapRegistrationAlgorithm.tpp +++ b/Code/Algorithms/Common/include/mapRegistrationAlgorithm.tpp @@ -1,209 +1,209 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __REGISTRATION_ALGORITHM_TPP #define __REGISTRATION_ALGORITHM_TPP #include "mapRegistrationAlgorithm.h" #include "mapAlgorithmEvents.h" #include "mapLogbookMacros.h" #include "itkMutexLockHolder.h" namespace map { namespace algorithm { // **** public methods **** // ************************ template unsigned int RegistrationAlgorithm:: getMovingDimensions() const { return VMovingDimensions; } template unsigned int RegistrationAlgorithm:: getTargetDimensions() const { return VTargetDimensions; } template typename RegistrationAlgorithm::RegistrationPointer RegistrationAlgorithm:: getRegistration() { this->_determinationLock.Lock(); try { if (registrationIsOutdated()) { mapLogInfoMacro( << "Registration is outdated. Redetermine registration."); this->InvokeEvent(::map::events::AlgorithmEvent(this, "Registration is outdated. Redetermine registration.")); doDetermineRegistration(); } } catch (...) { this->_determinationLock.Unlock(); throw; } this->_determinationLock.Unlock(); return doGetRegistration(); }; template const typename RegistrationAlgorithm::MovingRepresentationDescriptorType* RegistrationAlgorithm:: getMovingRepresentation() const { this->doBeforeGetMovingRepresentation(); return _spMovingRepresentation; }; template void RegistrationAlgorithm:: setMovingRepresentation(const MovingRepresentationDescriptorType* pDescriptor) { if (_spMovingRepresentation.GetPointer() != pDescriptor) { this->doBeforeSetMovingRepresentation(pDescriptor); this->Modified(); this->_spMovingRepresentation = pDescriptor; this->doAfterSetMovingRepresentation(); } }; template const typename RegistrationAlgorithm::TargetRepresentationDescriptorType* RegistrationAlgorithm:: getTargetRepresentation() const { this->doBeforeGetTargetRepresentation(); return _spTargetRepresentation; }; template void RegistrationAlgorithm:: setTargetRepresentation(const TargetRepresentationDescriptorType* pDescriptor) { if (_spTargetRepresentation.GetPointer() != pDescriptor) { this->doBeforeSetTargetRepresentation(pDescriptor); this->Modified(); this->_spTargetRepresentation = pDescriptor; this->doAfterSetTargetRepresentation(); } }; // **** protected methods **** // *************************** template bool RegistrationAlgorithm:: registrationIsOutdated() const { bool result = doGetRegistration().IsNull(); return result; }; template RegistrationAlgorithm:: RegistrationAlgorithm() { - _spMovingRepresentation = NULL; - _spTargetRepresentation = NULL; + _spMovingRepresentation = nullptr; + _spTargetRepresentation = nullptr; }; template RegistrationAlgorithm:: - ~RegistrationAlgorithm() {}; + ~RegistrationAlgorithm() = default; template void RegistrationAlgorithm:: doBeforeSetMovingRepresentation(const MovingRepresentationDescriptorType* pMovingRepresentation) { //default implementation does nothing }; template void RegistrationAlgorithm:: doAfterSetMovingRepresentation() { //default implementation does nothing }; template void RegistrationAlgorithm:: doBeforeSetTargetRepresentation(const TargetRepresentationDescriptorType* pTargetRepresentation) { //default implementation does nothing }; template void RegistrationAlgorithm:: doAfterSetTargetRepresentation() { //default implementation does nothing }; template void RegistrationAlgorithm:: doBeforeGetMovingRepresentation() const { //default implementation does nothing }; template void RegistrationAlgorithm:: doBeforeGetTargetRepresentation() const { //default implementation does nothing }; } // end namespace algorithm } // end namespace map #endif diff --git a/Code/Algorithms/Common/include/mapRegistrationAlgorithmBase.h b/Code/Algorithms/Common/include/mapRegistrationAlgorithmBase.h index e606e19..27a82e2 100644 --- a/Code/Algorithms/Common/include/mapRegistrationAlgorithmBase.h +++ b/Code/Algorithms/Common/include/mapRegistrationAlgorithmBase.h @@ -1,217 +1,217 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __REGISTRATION_ALGORITHM_BASE_H #define __REGISTRATION_ALGORITHM_BASE_H #include "itkObject.h" #include "itkSimpleFastMutexLock.h" #include "itkMutexLockHolder.h" #include "mapAlgorithmIdentificationInterface.h" #include "mapMacros.h" #include "mapMAPAlgorithmsExports.h" #define mapNewAlgorithmMacro(classname) \ static Pointer New() \ { \ Pointer smartPtr = new classname (); \ smartPtr->UnRegister(); \ smartPtr->configureAlgorithm();\ smartPtr->doneFirstConfiguration();\ return smartPtr; \ } namespace map { namespace algorithm { /*! @class RegistrationAlgorithmBase @brief Base class for registration algorithms. Does not have input and output dimensions. This class is the base class for generating registration algorithms. Only RegistrationAlgorithm inherits from this. @ingroup Algorithms */ class MAPAlgorithms_EXPORT RegistrationAlgorithmBase: public ::itk::Object, public facet::AlgorithmIdentificationInterface { public: - typedef RegistrationAlgorithmBase Self; - typedef ::itk::Object Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = RegistrationAlgorithmBase; + using Superclass = ::itk::Object; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(RegistrationAlgorithmBase, ::itk::Object); /*! @brief There are two algorithm types, analytic and iterative ones, which differ from the approach of obtaining the registration. */ enum AlgorithmType { ATAnalytic /*!< analytic algorithm type */, ATIterative /*!< iterative algorithm type */ }; /*! @brief Defines the state the algorithm is in */ struct AlgorithmState { enum Type { Pending /*!< the algorithm has been instanziated and is waiting. */, Initializing /*!< the algorithm is about to be initialized, but not yet started*/, Running /*!< the algorithm has been started and is running */, Stopping /*!< the algorithm is ordered to stop */, Stopped /*!< the algorithm has been stopped or is done with its processing */, Finalizing /*!< the algorithm has been is done with its processing and and about to generate the results*/, Finalized /*!< the algorithm has been is done with its processing and has a result*/, }; }; /*! @brief gets the algorithm's current state @eguarantee no fail @return returns the state of the algorithm */ virtual AlgorithmState::Type getCurrentState() const; /*! @brief Gets the number of moving dimensions for this registration algorithm @eguarantee no fail @return The number of moving dimensions @sa getTargetDimensions() */ virtual unsigned int getMovingDimensions() const = 0; /*! @brief Gets the number of target dimensions for this registration algorithm @eguarantee no fail @return The number of target dimensions @sa getMovingDimensions() */ virtual unsigned int getTargetDimensions() const = 0; /*! @brief Returns the algorithm type for this registration algorithm @eguarantee no fail @return The algorithm type @sa AlgorithmType */ virtual AlgorithmType getAlgorithmType() const = 0; /*! @brief Enforces the (re)computation of the registration and starts it. @return Indicates of the registration was successfully determined (e.g. could be false if an iterative algorithm was stopped prematurely by the user). @eguarantee strong @post If algorithm is indicated as reusable he is configured identically to its state before this function is called. */ bool determineRegistration(); /*! @brief Indicates if the algorithm is designed to be reused. Thus if * it is possible to use one instance to determine several registrations * with the same settings. @eguarantee no fail @retval true An instance can be used several times to determine registrations with the same algorithmic settings. @retval false The algorithm does not guarentee that in the case of several executions the algorithm is correctly initialized for later executions except the first. In this case it is normally necessary to generate an algorithm instance per registration task. Or reset the settings of the algorithm manually.*/ virtual bool isReusable() const = 0; protected: /*! @brief sets the algorithm's current state and calls onStateChange before; @eguarantee strong */ virtual void setCurrentState(const AlgorithmState::Type& state); /*! Method is called when state is going to be changed via setAlgorithmState(). Overwrite this method to create special algorithmic behavior. The default implementation does nothing. @eguarantee strong @return returns the success of stopping @retval true if algorithm has been successfully stopped @retval false otherwise */ virtual void onStateChange(AlgorithmState::Type oldState, AlgorithmState::Type newState) const; /*! @brief starts the computation of the registration @eguarantee strong @return Indicates of the registration was successfully determined (e.g. could be false if an iterative algorithm was stopped prematurely by the user). */ virtual bool doDetermineRegistration() = 0; /*! This member is used to implement the basic setup of the algorithm or * of its. properties (e.g. step size, resolution schedule). * @remark this function is called by mapNewAlgorithmMacro() to configure the * basic settings of an algorithm after instance creation. * @remark If an implemented algorithm is specified as reusable, this function * should also ensure the reusability of an algorithm. Thus it is called after algorithm * usage to ensure reasonable settings (default or set by user) for the next execution. * @eguarantee strong * @post Algorithm is configured with default settings or the user settings, if provided (and * he is reusable). * @sa mapNewAlgorithmMacro*/ virtual void configureAlgorithm() = 0; /*! Method returns the current value of _firstConfiguration. It is true within the call of mapNewAlgorithmMacro.*/ bool isFirstConfiguration() const; /*! Internal helper function (used by mapNewAlgorithmMacro) to set _firstConfiguration to false.*/ void doneFirstConfiguration(); RegistrationAlgorithmBase(); - virtual ~RegistrationAlgorithmBase(); + ~RegistrationAlgorithmBase() override; /*! Methods invoked by ::itk::LightObject::Print(). */ - virtual void PrintSelf(std::ostream& os, ::itk::Indent indent) const; + void PrintSelf(std::ostream& os, ::itk::Indent indent) const override; /*! mutex used to secure all state changes. */ ::itk::SimpleFastMutexLock _stateLock; - typedef ::itk::MutexLockHolder< ::itk::SimpleFastMutexLock > StateLockHolderType; + using StateLockHolderType = ::itk::MutexLockHolder< ::itk::SimpleFastMutexLock>; private: /*! the current state of the algorithm (initialized, pausing, ...) */ - AlgorithmState::Type _currentState; + AlgorithmState::Type _currentState{AlgorithmState::Pending}; /*! This member is used to indicate if a algorithm instance is configured the first time. * it is set by mapNewAlgorithmMacro()*/ - bool _firstConfiguration; + bool _firstConfiguration{true}; //No copy constructor allowed - RegistrationAlgorithmBase(const Self& source); - void operator=(const Self&); //purposely not implemented + RegistrationAlgorithmBase(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; - } -} + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapRegistrationAlgorithmInterface.h b/Code/Algorithms/Common/include/mapRegistrationAlgorithmInterface.h index b67bc3b..918b546 100644 --- a/Code/Algorithms/Common/include/mapRegistrationAlgorithmInterface.h +++ b/Code/Algorithms/Common/include/mapRegistrationAlgorithmInterface.h @@ -1,138 +1,138 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __REGISTRATION_ALGORITHM_INTERFACE_H #define __REGISTRATION_ALGORITHM_INTERFACE_H #include "mapRegistration.h" #include "mapFieldRepresentationDescriptor.h" namespace map { namespace algorithm { namespace facet { /*! @class RegistrationAlgorithmInterface @brief Basic interface for registration algorithms. It has input and output dimensions. @ingroup AlgorithmFacets */ template class RegistrationAlgorithmInterface { public: typedef RegistrationAlgorithmInterface Self; /** Dimension of the algorithm */ itkStaticConstMacro(MovingDimensions, unsigned int, VMovingDimensions); itkStaticConstMacro(TargetDimensions, unsigned int, VTargetDimensions); typedef ::map::core::Registration RegistrationType; - typedef typename RegistrationType::Pointer RegistrationPointer; - typedef typename RegistrationType::ConstPointer ConstRegistrationPointer; + using RegistrationPointer = typename RegistrationType::Pointer; + using ConstRegistrationPointer = typename RegistrationType::ConstPointer; /*! Checks if the registration is uptodate. If not the registration becomes (re)computed * the valid registration will be returned. @eguarantee strong @return Smart pointer to the registration instance. May be null if no registration could be computed (determineRegistration returned false). @retval an ITK smart pointer on a specific RegistrationType object */ virtual RegistrationPointer getRegistration() = 0; - typedef core::FieldRepresentationDescriptor MovingRepresentationDescriptorType; - typedef core::FieldRepresentationDescriptor TargetRepresentationDescriptorType; + using MovingRepresentationDescriptorType = core::FieldRepresentationDescriptor; + using TargetRepresentationDescriptorType = core::FieldRepresentationDescriptor; /*! @brief Defines the state the algorithm is in */ struct FieldRepRequirement { enum Type { No = 0 /*!< the field representation is not required by the algorithm. */, Unkown = 1 /*!< it is not known or can not be determined if a field representation is required. Should, if not sure, be treated like "Yes".*/, Yes = 2 /*!< the field representation is required by the algorithm. */, }; }; virtual const MovingRepresentationDescriptorType* getMovingRepresentation() const = 0; virtual void setMovingRepresentation(const MovingRepresentationDescriptorType* pDescriptor) = 0; /*! The field representation indicates the support region in the moving space required by the algorithm user. In addition some algorithm need this information to determine valid registrations (e.g. if a field kernel must be generated for point registrations.) This method allows to deduce if the algorithm needs the representation for the moving space to be defined by the user.*/ virtual typename FieldRepRequirement::Type isMovingRepresentationRequired() const = 0; virtual const TargetRepresentationDescriptorType* getTargetRepresentation() const = 0; virtual void setTargetRepresentation(const TargetRepresentationDescriptorType* pDescriptor) = 0; /*! The field representation indicates the support region in the moving space required by the algorithm user. In addition some algorithm need this information to determine valid registrations (e.g. if a field kernel must be generated for point registrations.) This method allows to deduce if the algorithm needs the representation for the target space to be defined by the user.*/ virtual typename FieldRepRequirement::Type isTargetRepresentationRequired() const = 0; ///*! @brief Returns if the algorithm is supports the probeAlgorithmResult() //* method. //@eguarantee strong //@retval true if the algorithm allows to probe the nature of the registration result. //@retval false if the algorithm does not support the probing of the nature of the registration result. //*/ //virtual bool isAbleToProbeAlgorithmResult() const = 0; ///*! @brief Returns a representative result (in terms of used type and configuration). //* This method returns an instance of a registration object, whose configuration and used kernel types //* are representative with the result that will be produced by the registration algorithm if //* you call getRegistration(). //* @remark The result of this method is not supposed to be used for any (!) mapping and it does not guarantee //* sensible results. Its purpose is to offer the possibility to depict the nature of the produced results //* before the determination process is started. E.g. for the usage in host application that //* change there GUI according to the type of result (matrix or vector field). //@eguarantee strong //@return Pointer to an instance that is representative for the type of result the algorithms produces. It may be null, if the algorithm //* does not support this method. //*/ //virtual RegistrationPointer probeAlgorithmResult() const = 0; protected: - RegistrationAlgorithmInterface() {}; - virtual ~RegistrationAlgorithmInterface() {}; + RegistrationAlgorithmInterface() = default; + virtual ~RegistrationAlgorithmInterface() = default; private: - RegistrationAlgorithmInterface(const Self& source); //purposely not implemented - void operator=(const Self&); //purposely not implemented + RegistrationAlgorithmInterface(const Self& source) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapSealedImagePyramidesPolicy.h b/Code/Algorithms/Common/include/mapSealedImagePyramidesPolicy.h index 3430ad0..ef479b1 100644 --- a/Code/Algorithms/Common/include/mapSealedImagePyramidesPolicy.h +++ b/Code/Algorithms/Common/include/mapSealedImagePyramidesPolicy.h @@ -1,189 +1,189 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __SEALED_IMAGE_PYRAMIDES_POLICY_H #define __SEALED_IMAGE_PYRAMIDES_POLICY_H #include "itkMultiResolutionPyramidImageFilter.h" #include "itkCommand.h" #include "mapNoComponentInitializationPolicy.h" #include "mapModificationTimeValidator.h" namespace map { namespace algorithm { /*! @class SealedImagePyramidesPolicy @brief class for SealedImagePyramidesPolicy. This class is a SealedImagePyramidesPolicy. It is used if an ITKImageRegistrationAlgorithm should have one specific pyramide type. With this policy the pyramide is never to be changed and sealed, so that the instance and its setting aren't public. @sa FixedImagePyramidesPolicy @sa ArbitraryImagePyramidesPolicy @ingroup ITKPolicies */ template class SealedImagePyramidesPolicy { public: typedef SealedImagePyramidesPolicy Self; - typedef TConcreteMovingImagePyramide ConcreteMovingImagePyramideType; - typedef typename ConcreteMovingImagePyramideType::Pointer ConcreteMovingImagePyramidePointer; + using ConcreteMovingImagePyramideType = TConcreteMovingImagePyramide; + using ConcreteMovingImagePyramidePointer = typename ConcreteMovingImagePyramideType::Pointer; typedef ::itk::MultiResolutionPyramidImageFilter MovingImagePyramideBaseType; - typedef TConcreteTargetImagePyramide ConcreteTargetImagePyramideType; - typedef typename ConcreteTargetImagePyramideType::Pointer ConcreteTargetImagePyramidePointer; + using ConcreteTargetImagePyramideType = TConcreteTargetImagePyramide; + using ConcreteTargetImagePyramidePointer = typename ConcreteTargetImagePyramideType::Pointer; typedef ::itk::MultiResolutionPyramidImageFilter TargetImagePyramideBaseType; - typedef typename TargetImagePyramideBaseType::Pointer TargetImagePyramideBasePointer; - typedef typename TargetImagePyramideBaseType::ConstPointer TargetImagePyramidConstPointer; - typedef typename MovingImagePyramideBaseType::Pointer MovingImagePyramideBasePointer; - typedef typename MovingImagePyramideBaseType::ConstPointer MovingImagePyramidConstPointer; + using TargetImagePyramideBasePointer = typename TargetImagePyramideBaseType::Pointer; + using TargetImagePyramidConstPointer = typename TargetImagePyramideBaseType::ConstPointer; + using MovingImagePyramideBasePointer = typename MovingImagePyramideBaseType::Pointer; + using MovingImagePyramidConstPointer = typename MovingImagePyramideBaseType::ConstPointer; - typedef typename TConcreteMovingImagePyramide::InputImageType MovingImageType; - typedef typename TConcreteTargetImagePyramide::InputImageType TargetImageType; + using MovingImageType = typename TConcreteMovingImagePyramide::InputImageType; + using TargetImageType = typename TConcreteTargetImagePyramide::InputImageType; - typedef TInitializationPolicy InitializationPolicy; + using InitializationPolicy = TInitializationPolicy; protected: SealedImagePyramidesPolicy(); ~SealedImagePyramidesPolicy(); /*! Returns the modification time of the policy (and its controlled component). * In this case the modification time is a pass through of the internal component. @eguarantee strong @return the modification time */ virtual unsigned long getMovingPyramideMTime() const; /*! Returns the modification time of the policy (and its controlled component). * In this case the modification time is a pass through of the internal component. @eguarantee strong @return the modification time */ virtual unsigned long getTargetPyramideMTime() const; /*! This is a command slot that can be used by any class derivering from this policy * to get informed if the moving pyramide instances is changed. \n * Two events will be invoked with this command: \n * - UnregisterAlgorithmComponentEvent * - RegisterAlgorithmComponentEvent * . * The first one is used when the current pyramide is going to be replaced (by setMovingImagePyramide). The event data in this case * is a void pointer to the current (soon outdated) object. The second event will be called when the new image pyramide was set * (by setMovingImagePyramide). In this case the event data is a pointer to the new pyramide.*/ ::itk::Command::Pointer _spOnChangeMoving; /*! This is a command slot that can be used by any class derivering from this policy * to get informed if the target pyramide instances is changed. \n * Two events will be invoked with this command: \n * - UnregisterAlgorithmComponentEvent * - RegisterAlgorithmComponentEvent * . * The first one is used when the current pyramide is going to be replaced (by setTargetImagePyramide). The event data in this case * is a void pointer to the current (soon outdated) object. The second event will be called when the new image pyramide was set * (by setTargetImagePyramide). In this case the event data is a pointer to the new pyramide.*/ ::itk::Command::Pointer _spOnChangeTarget; /*! gets the internal pyramides @eguarantee strong @return a pointer to an pyramide type */ MovingImagePyramideBaseType* getMovingPyramideInternal(); const MovingImagePyramideBaseType* getMovingPyramideInternal() const; TargetImagePyramideBaseType* getTargetPyramideInternal(); const TargetImagePyramideBaseType* getTargetPyramideInternal() const; /*! gets the concrete moving pyramide @eguarantee strong @return a pointer to a ConcreteMovingImagePyramideType object */ const ConcreteMovingImagePyramideType* getConcreteMovingPyramide() const; /*! gets the concrete target pyramide @eguarantee strong @return a pointer to a ConcreteTargetImagePyramideType object */ const ConcreteTargetImagePyramideType* getConcreteTargetPyramide() const; /*! gets the concrete moving pyramide @eguarantee strong @return a pointer to a ConcreteMovingImagePyramideType object */ ConcreteMovingImagePyramideType* getConcreteMovingPyramide(); /*! gets the concrete target pyramide @eguarantee strong @return a pointer to a ConcreteTargetImagePyramideType object */ ConcreteTargetImagePyramideType* getConcreteTargetPyramide(); /*! initializes the pyramides @eguarantee strong */ virtual void preparePyramides(); /*! initializes the pyramides * after it was integrated in a controlling structur (e.g. registration algorithm) @eguarantee strong */ virtual void preparePyramidesAfterAssembly(); private: ::map::core::ModificationTimeValidator _movingPyramideMTime; ::map::core::ModificationTimeValidator _targetPyramideMTime; /*! The time stamp is used to signal changes of the policy that may effect the controlling structur (e.g. registration algorithm) * because the controlled object has changed.*/ ConcreteMovingImagePyramidePointer _spMovingPyramide; /*! The time stamp is used to signal changes of the policy that may effect the controlling structur (e.g. registration algorithm) * because the controlled object has changed.*/ ConcreteMovingImagePyramidePointer _spTargetPyramide; //No copy constructor allowed SealedImagePyramidesPolicy(const Self& source); void operator=(const Self&); //purposely not implemented }; - } -} + } // namespace algorithm +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapSealedImagePyramidesPolicy.tpp" #endif #endif diff --git a/Code/Algorithms/Common/include/mapStoppableAlgorithmInterface.h b/Code/Algorithms/Common/include/mapStoppableAlgorithmInterface.h index ef3f960..599b20c 100644 --- a/Code/Algorithms/Common/include/mapStoppableAlgorithmInterface.h +++ b/Code/Algorithms/Common/include/mapStoppableAlgorithmInterface.h @@ -1,90 +1,90 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __STOPPABLE_ALGORITHM_INTERFACE_H #define __STOPPABLE_ALGORITHM_INTERFACE_H #include "mapMacros.h" #include "mapMAPAlgorithmsExports.h" /*! @namespace map The namespace map is used throughout the MatchPoint project to mark code as components of this project */ namespace map { namespace algorithm { namespace facet { /*! @class StoppableAlgorithmInterface @brief This is the interface for algorithms that can be stopped/aborted while they are determining the registration @ingroup AlgorithmFacets @remark Algorithms that allow to stop an ongoing registration process and implement this interface should use/emit StoppedAlgorithmEvent via the RegistrationAlgorithmBase to indicate when the algorithm really has stopped. @see map::events::StoppingAlgorithmEvent @see map::events::StoppedAlgorithmEvent */ class MAPAlgorithms_EXPORT StoppableAlgorithmInterface { public: - typedef StoppableAlgorithmInterface Self; + using Self = StoppableAlgorithmInterface; /*! @brief stops the algorithm if it is stoppable. @remark A successful return of this function does not guarantee that the algorithm has already stopped. It only ensures that the algorithm will stop the current run as soon as possible. To be sure that the algorithm has stopped the current state should be checked via RegistrationAlgorithmBase or you should wait for the map::events::StoppedAlgorithmEvent. @eguarantee strong @retval true if the algorithm was successfully ordered to stop. This does not guarantee that the algorithm has already stopped when the function returns. But it ensures that the algorithm will be stopped as soon as possible. The algorithm should be observed for map::events::StoppedAlgorithmEvent. @retval false if the algorithm was not successfully ordered to stop. */ virtual bool stopAlgorithm() = 0; /*! @brief Returns if the algorithm is stoppable or not. @remark this function is needed because it is possible that algorithms are generally able to stop and therefore implement the interface, but the actual ability to stop depends on their current configuration. @eguarantee strong @retval true if the algorithm is stoppable @retval false if the algorithm is not stoppable */ virtual bool isStoppable() const = 0; protected: StoppableAlgorithmInterface(); virtual ~StoppableAlgorithmInterface(); private: //No copy constructor allowed - StoppableAlgorithmInterface(const Self& source); //purposely not implemented - void operator=(const Self&); //purposely not implemented + StoppableAlgorithmInterface(const Self& source) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/include/mapUID.h b/Code/Algorithms/Common/include/mapUID.h index 11fa566..b59231a 100644 --- a/Code/Algorithms/Common/include/mapUID.h +++ b/Code/Algorithms/Common/include/mapUID.h @@ -1,179 +1,179 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_UID_H #define __MAP_UID_H #include #include "itkLightObject.h" #include "mapMacros.h" #include "mapString.h" #include "mapMAPAlgorithmsExports.h" namespace map { namespace algorithm { /*! @class UID @brief This class is used to represent unique identification for algorithms. The UID of a MatchPoint algorithm consists of 4 parts:\n - Namespace: Namespace (e.g. organisation, work group) of the algorithm - Name: The Name of an algorithm. It also implicitly identifies the intended use and problem statements inteded to be solved respectivly. If the intended use of an algorithm diverges, a new algorithm UID with an other name should be used. - Version: Indicates a change in an algorithm (without touching its intended use). E.g. if Parameters are tweaked, computations are refined or new properties are added without changing the tackled problem statement, this would be a version change. - Build number: Just indicates when the binary of an algorithm was build. The changing of the build number is no indication for a changing of algorithm or its intended use. . @sa AlgorithmIdentificationInterface @ingroup UID */ class MAPAlgorithms_EXPORT UID : public ::itk::LightObject { public: /** Smart pointer typedef support. */ - typedef UID Self; - typedef ::itk::LightObject Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = UID; + using Superclass = ::itk::LightObject; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; /** Run-time type information (and related methods). */ itkTypeMacro(UID, LightObject); - typedef core::String NamespaceType; - typedef core::String NameType; - typedef core::String VersionType; - typedef core::String BuildTagType; + using NamespaceType = core::String; + using NameType = core::String; + using VersionType = core::String; + using BuildTagType = core::String; /** * @brief Creates a MetaProperty instance, initializes it and returns it via smartpointer. * @return A pointer to the MetaProperty. * @param name The name of the associated MetaProperty * @param type_info The type info of the value type used for the MetaProperty * @param isReadable Indicates if the property is readable * @param isWritable Indicates if the property is writable * @eguarantee strong */ static Pointer New(const NamespaceType& ns, const NameType& name, const VersionType& version, const BuildTagType& buildTag); /** * @brief Returns the namespace of the algorithm. * @eguarantee strong * @return A constant reference to the namespace */ const NamespaceType& getNamespace() const; /** * @brief Returns the name of the algorithm. * @eguarantee strong * @return A constant reference to the name */ const NameType& getName() const; /** * @brief Returns the version of the algorithm. * @eguarantee strong * @return A constant reference to the version */ const VersionType& getVersion() const; /** * @brief Returns the build number of the algorithm. * @eguarantee strong * @return A constant reference to the build number */ const BuildTagType& getBuildTag() const; /** * @brief Converts the UID into a display string containing all informations. * @eguarantee strong * @return A constant string representing the whole UID. */ - const core::String toStr() const; + core::String toStr() const; protected: NamespaceType _namespace; NameType _name; VersionType _version; BuildTagType _buildTag; /** * Defines the default behavior for printing out this element * @eguarantee strong * @param os An output stream */ - virtual void PrintSelf(std::ostream& os, ::itk::Indent indent) const; + void PrintSelf(std::ostream& os, ::itk::Indent indent) const override; - ~UID(); - UID(const NamespaceType& ns, const NameType& name, const VersionType& version, - const BuildTagType& buildTag); + ~UID() override; + UID(NamespaceType ns, NameType name, VersionType version, + BuildTagType buildTag); private: - UID(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented + UID(const Self&) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; /** Helper function that allows to compare uids directly or with wild cards, * thus ignoring parts of the uid. * @remark If at least one of the uids points to NULL * the result is always false; * @param [in] uid1 The first uid. * @param [in] uid2 The second uid. * @param [in] wcNamespace Indicates if the namespace is wild carded. (True: ignore). * @param [in] wcName Indicates if the name is wild carded. (True: ignore). * @param [in] wcVersion Indicates if the version is wild carded. (True: ignore). * @param [in] wcBuild Indicates if the build is wild carded. (True: ignore). * @return True, if the uids match (regarding the wildcard settings). * @eguarantee strong * @TODO add to unit test*/ MAPAlgorithms_EXPORT bool compareUIDs(const UID* uid1, const UID* uid2, bool wcNamespace = false, bool wcName = false, bool wcVersion = false, bool wcBuild = false); /** Helper function that allows to compare uids directly or with wild cards, * thus ignoring parts of the uid. * @param [in] uid1 The first uid. * @param [in] uid2 The second uid. * @param [in] wcNamespace Indicates if the namespace is wild carded. (True: ignore). * @param [in] wcName Indicates if the name is wild carded. (True: ignore). * @param [in] wcVersion Indicates if the version is wild carded. (True: ignore). * @param [in] wcBuild Indicates if the build is wild carded. (True: ignore). * @return True, if the uids match (regarding the wildcard settings). * @eguarantee strong * @TODO add to unit test*/ MAPAlgorithms_EXPORT bool compareUIDs(const UID& uid1, const UID& uid2, bool wcNamespace = false, bool wcName = false, bool wcVersion = false, bool wcBuild = false); - } -} + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Common/source/mapAlgorithmException.cpp b/Code/Algorithms/Common/source/mapAlgorithmException.cpp index 88360d2..c10a657 100644 --- a/Code/Algorithms/Common/source/mapAlgorithmException.cpp +++ b/Code/Algorithms/Common/source/mapAlgorithmException.cpp @@ -1,81 +1,81 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapAlgorithmException.h" namespace map { namespace algorithm { AlgorithmException::BaseExceptionType* AlgorithmException:: - clone() const throw() + clone() const noexcept { - BaseExceptionType* pResult = 0; + BaseExceptionType* pResult = nullptr; try { pResult = new AlgorithmException(this->GetFile() , this->GetLine() , this->GetDescription() , this->GetLocation()); } catch (...) { //no throw guarantee } return pResult; }; AlgorithmException:: - AlgorithmException() : Superclass() + AlgorithmException() {}; AlgorithmException:: AlgorithmException(const char* file, unsigned int lineNumber) : Superclass(file, lineNumber) {}; AlgorithmException:: AlgorithmException(const std::string& file, unsigned int lineNumber) : Superclass(file, lineNumber) {}; AlgorithmException:: AlgorithmException(const std::string& file, unsigned int lineNumber, const std::string& desc, const std::string& loc) : Superclass(file, lineNumber, desc, loc) {}; AlgorithmException:: - ~AlgorithmException() throw() - {}; + ~AlgorithmException() noexcept + = default; const char* AlgorithmException:: GetNameOfClass() const { return "map::AlgorithmException"; }; } // end namespace algorithm } // end namespace map \ No newline at end of file diff --git a/Code/Algorithms/Common/source/mapAlgorithmProfileHelper.cpp b/Code/Algorithms/Common/source/mapAlgorithmProfileHelper.cpp index a514dc7..a1da32d 100644 --- a/Code/Algorithms/Common/source/mapAlgorithmProfileHelper.cpp +++ b/Code/Algorithms/Common/source/mapAlgorithmProfileHelper.cpp @@ -1,442 +1,442 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapSDXMLStrReader.h" #include "mapAlgorithmProfileHelper.h" #include "mapLogbookMacros.h" #include "mapConvert.h" namespace map { namespace algorithm { namespace profile { MAPAlgorithms_EXPORT structuredData::Element::Pointer parseProfileString( const core::String& profileStr) { - ::map::structuredData::Element::Pointer result = NULL; + ::map::structuredData::Element::Pointer result = nullptr; try { ::map::structuredData::XMLStrReader::Pointer reader = ::map::structuredData::XMLStrReader::New(); ::map::structuredData::Element::Pointer spRoot = reader->read(profileStr); ::map::structuredData::Element::ConstSubElementIteratorType profilePos = ::map::structuredData::findNextSubElement(spRoot->getSubElementBegin(), spRoot->getSubElementEnd(), tags::AlgorithmProfile); if (profilePos != spRoot->getSubElementEnd()) { result = *profilePos; } } catch (...) { mapLogDebugStaticMacro( << "Exception while parsing algorithm profile: Profile string: " << profileStr); } return result; } - const structuredData::Element::Pointer extractCharacteristicsFromProfile( + structuredData::Element::Pointer extractCharacteristicsFromProfile( const structuredData::Element* profileRoot) { structuredData::Element::Pointer result; - if (profileRoot) + if (profileRoot != nullptr) { - ::map::structuredData::Element::ConstSubElementIteratorType pos = + auto pos = ::map::structuredData::findNextSubElement(profileRoot->getSubElementBegin(), profileRoot->getSubElementEnd(), tags::AlgorithmCharacteristics); if (pos != profileRoot->getSubElementEnd()) { result = *pos; } } return result; } ValueListType getValues(const structuredData::Element* node, const map::core::String& tag) { ValueListType result; - if (node) + if (node != nullptr) { - ::map::structuredData::Element::ConstSubElementIteratorType pos = + auto pos = ::map::structuredData::findNextSubElement(node->getSubElementBegin(), node->getSubElementEnd(), tag); while (pos != node->getSubElementEnd()) { result.push_back((*pos)->getValue()); pos = ::map::structuredData::findNextSubElement(++pos, node->getSubElementEnd(), tag); } } return result; } - MAPAlgorithms_EXPORT const ::map::core::String getDescription(const structuredData::Element* + MAPAlgorithms_EXPORT ::map::core::String getDescription(const structuredData::Element* profileRoot) { - ::map::core::String result = ""; + ::map::core::String result; - if (profileRoot) + if (profileRoot != nullptr) { - ::map::structuredData::Element::ConstSubElementIteratorType descPos = + auto descPos = ::map::structuredData::findNextSubElement(profileRoot->getSubElementBegin(), profileRoot->getSubElementEnd(), tags::AlgorithmDescription); if (descPos != profileRoot->getSubElementEnd()) { result = (*descPos)->getValue(); } } return result; } - MAPAlgorithms_EXPORT const ::map::core::String getDescription(const core::String& profileStr) + MAPAlgorithms_EXPORT ::map::core::String getDescription(const core::String& profileStr) { structuredData::Element::Pointer profile = parseProfileString(profileStr); return getDescription(profile); } MAPAlgorithms_EXPORT ValueListType getContact(const structuredData::Element* profileRoot) { ValueListType result = getValues(profileRoot, tags::AlgorithmContact); return result; } MAPAlgorithms_EXPORT ValueListType getContact(const core::String& profileStr) { structuredData::Element::Pointer profile = parseProfileString(profileStr); return getContact(profile); } MAPAlgorithms_EXPORT bool getTerms(const structuredData::Element* profileRoot, map::core::String& terms) { bool result = false; - if (profileRoot) + if (profileRoot != nullptr) { - ::map::structuredData::Element::ConstSubElementIteratorType pos = + auto pos = ::map::structuredData::findNextSubElement(profileRoot->getSubElementBegin(), profileRoot->getSubElementEnd(), tags::AlgorithmTerms); if (pos != profileRoot->getSubElementEnd()) { terms = (*pos)->getValue(); result = true; } } return result; } MAPAlgorithms_EXPORT bool getTerms(const core::String& profileStr, map::core::String& terms) { structuredData::Element::Pointer profile = parseProfileString(profileStr); return getTerms(profile, terms); } MAPAlgorithms_EXPORT ValueListType getCitation(const structuredData::Element* profileRoot) { ValueListType result = getValues(profileRoot, tags::AlgorithmCitation); return result; } MAPAlgorithms_EXPORT ValueListType getCitation(const core::String& profileStr) { structuredData::Element::Pointer profile = parseProfileString(profileStr); return getCitation(profile); } MAPAlgorithms_EXPORT ValueListType getDataType(const structuredData::Element* profileRoot) { structuredData::Element::Pointer chars = extractCharacteristicsFromProfile(profileRoot); ValueListType result = getValues(chars, tags::AlgorithmDataType); return result; } MAPAlgorithms_EXPORT ValueListType getDataType(const core::String& profileStr) { structuredData::Element::Pointer profile = parseProfileString(profileStr); return getDataType(profile); } MAPAlgorithms_EXPORT ValueListType getResolutionStyle(const structuredData::Element* profileRoot) { structuredData::Element::Pointer chars = extractCharacteristicsFromProfile(profileRoot); ValueListType result = getValues(chars, tags::AlgorithmResolutionStyle); return result; } MAPAlgorithms_EXPORT ValueListType getResolutionStyle(const core::String& profileStr) { structuredData::Element::Pointer profile = parseProfileString(profileStr); return getResolutionStyle(profile); } MAPAlgorithms_EXPORT ValueListType getComputationStyle(const structuredData::Element* profileRoot) { structuredData::Element::Pointer chars = extractCharacteristicsFromProfile(profileRoot); ValueListType result = getValues(chars, tags::AlgorithmComputationStyle); return result; } MAPAlgorithms_EXPORT ValueListType getComputationStyle(const core::String& profileStr) { structuredData::Element::Pointer profile = parseProfileString(profileStr); return getComputationStyle(profile); } MAPAlgorithms_EXPORT bool getMovingDimensions(const structuredData::Element* profileRoot, unsigned int& dims) { bool result = false; structuredData::Element::Pointer chars = extractCharacteristicsFromProfile(profileRoot); - if (chars) + if (chars != nullptr) { ::map::structuredData::Element::ConstSubElementIteratorType pos = ::map::structuredData::findNextSubElement(chars->getSubElementBegin(), chars->getSubElementEnd(), tags::AlgorithmDimMoving); if (pos != chars->getSubElementEnd()) { dims = map::core::convert::toUInt((*pos)->getValue()); result = true; } } return result; } MAPAlgorithms_EXPORT bool getMovingDimensions(const core::String& profileStr, unsigned int& dims) { structuredData::Element::Pointer profile = parseProfileString(profileStr); return getMovingDimensions(profile, dims); } MAPAlgorithms_EXPORT ValueListType getMovingModality(const structuredData::Element* profileRoot) { structuredData::Element::Pointer chars = extractCharacteristicsFromProfile(profileRoot); ValueListType result = getValues(chars, tags::AlgorithmModalityMoving); return result; } MAPAlgorithms_EXPORT ValueListType getMovingModality(const core::String& profileStr) { structuredData::Element::Pointer profile = parseProfileString(profileStr); return getMovingModality(profile); } MAPAlgorithms_EXPORT bool getTargetDimensions(const structuredData::Element* profileRoot, unsigned int& dims) { bool result = false; structuredData::Element::Pointer chars = extractCharacteristicsFromProfile(profileRoot); - if (chars) + if (chars != nullptr) { ::map::structuredData::Element::ConstSubElementIteratorType pos = ::map::structuredData::findNextSubElement(chars->getSubElementBegin(), chars->getSubElementEnd(), tags::AlgorithmDimTarget); if (pos != chars->getSubElementEnd()) { dims = map::core::convert::toUInt((*pos)->getValue()); result = true; } } return result; } MAPAlgorithms_EXPORT bool getTargetDimensions(const core::String& profileStr, unsigned int& dims) { structuredData::Element::Pointer profile = parseProfileString(profileStr); return getTargetDimensions(profile, dims); } MAPAlgorithms_EXPORT ValueListType getTargetModality(const structuredData::Element* profileRoot) { structuredData::Element::Pointer chars = extractCharacteristicsFromProfile(profileRoot); ValueListType result = getValues(chars, tags::AlgorithmModalityTarget); return result; } MAPAlgorithms_EXPORT ValueListType getTargetModality(const core::String& profileStr) { structuredData::Element::Pointer profile = parseProfileString(profileStr); return getTargetModality(profile); } MAPAlgorithms_EXPORT ValueListType getObject(const structuredData::Element* profileRoot) { structuredData::Element::Pointer chars = extractCharacteristicsFromProfile(profileRoot); ValueListType result = getValues(chars, tags::AlgorithmObject); return result; } MAPAlgorithms_EXPORT ValueListType getObject(const core::String& profileStr) { structuredData::Element::Pointer profile = parseProfileString(profileStr); return getObject(profile); } MAPAlgorithms_EXPORT ValueListType getSubject(const structuredData::Element* profileRoot) { structuredData::Element::Pointer chars = extractCharacteristicsFromProfile(profileRoot); ValueListType result = getValues(chars, tags::AlgorithmSubject); return result; } MAPAlgorithms_EXPORT ValueListType getSubject(const core::String& profileStr) { structuredData::Element::Pointer profile = parseProfileString(profileStr); return getSubject(profile); } MAPAlgorithms_EXPORT ValueListType getTransformModel(const structuredData::Element* profileRoot) { structuredData::Element::Pointer chars = extractCharacteristicsFromProfile(profileRoot); ValueListType result = getValues(chars, tags::AlgorithmTransformModel); return result; } MAPAlgorithms_EXPORT ValueListType getTransformModel(const core::String& profileStr) { structuredData::Element::Pointer profile = parseProfileString(profileStr); return getTransformModel(profile); } MAPAlgorithms_EXPORT ValueListType getTransformDomain(const structuredData::Element* profileRoot) { structuredData::Element::Pointer chars = extractCharacteristicsFromProfile(profileRoot); ValueListType result = getValues(chars, tags::AlgorithmTransformDomain); return result; } MAPAlgorithms_EXPORT ValueListType getTransformDomain(const core::String& profileStr) { structuredData::Element::Pointer profile = parseProfileString(profileStr); return getTransformDomain(profile); } MAPAlgorithms_EXPORT ValueListType getMetric(const structuredData::Element* profileRoot) { structuredData::Element::Pointer chars = extractCharacteristicsFromProfile(profileRoot); ValueListType result = getValues(chars, tags::AlgorithmMetric); return result; } MAPAlgorithms_EXPORT ValueListType getMetric(const core::String& profileStr) { structuredData::Element::Pointer profile = parseProfileString(profileStr); return getMetric(profile); } MAPAlgorithms_EXPORT ValueListType getOptimization(const structuredData::Element* profileRoot) { structuredData::Element::Pointer chars = extractCharacteristicsFromProfile(profileRoot); ValueListType result = getValues(chars, tags::AlgorithmOptimization); return result; } MAPAlgorithms_EXPORT ValueListType getOptimization(const core::String& profileStr) { structuredData::Element::Pointer profile = parseProfileString(profileStr); return getOptimization(profile); } MAPAlgorithms_EXPORT ValueListType getInteraction(const structuredData::Element* profileRoot) { structuredData::Element::Pointer chars = extractCharacteristicsFromProfile(profileRoot); ValueListType result = getValues(chars, tags::AlgorithmInteraction); return result; } MAPAlgorithms_EXPORT ValueListType getInteraction(const core::String& profileStr) { structuredData::Element::Pointer profile = parseProfileString(profileStr); return getInteraction(profile); } MAPAlgorithms_EXPORT ValueListType getKeywords(const structuredData::Element* profileRoot) { structuredData::Element::Pointer keywords; - if (profileRoot) + if (profileRoot != nullptr) { - ::map::structuredData::Element::ConstSubElementIteratorType pos = + auto pos = ::map::structuredData::findNextSubElement(profileRoot->getSubElementBegin(), profileRoot->getSubElementEnd(), tags::AlgorithmKeywords); if (pos != profileRoot->getSubElementEnd()) { keywords = *pos; } } ValueListType result = getValues(keywords, tags::AlgorithmKeyword); return result; } MAPAlgorithms_EXPORT ValueListType getKeywords(const core::String& profileStr) { structuredData::Element::Pointer profile = parseProfileString(profileStr); return getKeywords(profile); } MAPAlgorithms_EXPORT bool isDeterministic(const structuredData::Element* profileRoot) { structuredData::Element::Pointer chars = extractCharacteristicsFromProfile(profileRoot); bool result = false; - if (chars) + if (chars != nullptr) { ::map::structuredData::Element::ConstSubElementIteratorType pos = ::map::structuredData::findNextSubElement(chars->getSubElementBegin(), chars->getSubElementEnd(), tags::AlgorithmDeterministic); result = pos != chars->getSubElementEnd(); } return result; } MAPAlgorithms_EXPORT bool isDeterministic(const core::String& profileStr) { structuredData::Element::Pointer profile = parseProfileString(profileStr); return isDeterministic(profile); } - } - } -} + } // namespace profile + } // namespace algorithm +} // namespace map diff --git a/Code/Algorithms/Common/source/mapAlgorithmStateChangeEvent.cpp b/Code/Algorithms/Common/source/mapAlgorithmStateChangeEvent.cpp index ac25df3..34b53e6 100644 --- a/Code/Algorithms/Common/source/mapAlgorithmStateChangeEvent.cpp +++ b/Code/Algorithms/Common/source/mapAlgorithmStateChangeEvent.cpp @@ -1,91 +1,90 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapAlgorithmStateChangeEvent.h" namespace map { namespace events { AlgorithmStateChangeEvent:: AlgorithmStateChangeEvent(const AlgorithmStateType& oldState, const AlgorithmStateType& newState): _oldState(oldState), _newState(newState) {}; AlgorithmStateChangeEvent:: ~AlgorithmStateChangeEvent() - {}; + = default; const char* AlgorithmStateChangeEvent:: GetEventName() const { return "AlgorithmStateChangeEvent"; }; AlgorithmStateChangeEvent::AlgorithmStateType AlgorithmStateChangeEvent:: getOldState() const { return _oldState; }; AlgorithmStateChangeEvent::AlgorithmStateType AlgorithmStateChangeEvent:: getNewState() const { return _newState; }; bool AlgorithmStateChangeEvent:: CheckEvent(const ::itk::EventObject* e) const { - return dynamic_cast(e); + return dynamic_cast(e) != nullptr; }; ::itk::EventObject* AlgorithmStateChangeEvent:: MakeObject() const { return new Self(*this); }; AlgorithmStateChangeEvent:: - AlgorithmStateChangeEvent(const Self& s) : Superclass(s), _oldState(s._oldState), - _newState(s._newState) - { - }; + AlgorithmStateChangeEvent(const Self& s) + + = default; void AlgorithmStateChangeEvent:: Print(std::ostream& os) const { Superclass::Print(os); os << "Old state: " << _oldState << std::endl; os << "New state: " << _newState << std::endl; }; - } -} + } // namespace events +} // namespace map diff --git a/Code/Algorithms/Common/source/mapAlgorithmWrapperEvent.cpp b/Code/Algorithms/Common/source/mapAlgorithmWrapperEvent.cpp index 135f2d3..cc80fcd 100644 --- a/Code/Algorithms/Common/source/mapAlgorithmWrapperEvent.cpp +++ b/Code/Algorithms/Common/source/mapAlgorithmWrapperEvent.cpp @@ -1,110 +1,110 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapAlgorithmWrapperEvent.h" #include "mapString.h" namespace map { namespace events { AlgorithmWrapperEvent:: AlgorithmWrapperEvent(const ::itk::EventObject& wrappedEvent, ::itk::Object* wrappedCaller, - const std::string& comment) : Superclass(NULL, comment) + const std::string& comment) : Superclass(nullptr, comment) { _pWrappedCaller = wrappedCaller; _pWrappedEvent = wrappedEvent.MakeObject(); ::map::core::OStringStream os; os << "AlgorithmWrapperEvent<" << _pWrappedEvent->GetEventName() << ">"; _cachedEventName = os.str(); }; AlgorithmWrapperEvent:: ~AlgorithmWrapperEvent() { delete _pWrappedEvent; }; const char* AlgorithmWrapperEvent:: GetEventName() const { return _cachedEventName.c_str(); }; bool AlgorithmWrapperEvent:: CheckEvent(const ::itk::EventObject* e) const { bool result = false; const Self* pEvent = dynamic_cast(e); - if (pEvent) + if (pEvent != nullptr) { result = _pWrappedEvent->CheckEvent(&(pEvent->getWrappedEvent())); } return result; }; ::itk::EventObject* AlgorithmWrapperEvent:: MakeObject() const { return new Self(*this); }; AlgorithmWrapperEvent:: - AlgorithmWrapperEvent(const Self& s) : Superclass(NULL, s.getComment()), + AlgorithmWrapperEvent(const Self& s) : Superclass(nullptr, s.getComment()), _pWrappedCaller(s._pWrappedCaller), _pWrappedEvent(s._pWrappedEvent->MakeObject()) { }; ::itk::EventObject& AlgorithmWrapperEvent:: getWrappedEvent() const { return *_pWrappedEvent; }; ::itk::Object* AlgorithmWrapperEvent:: getWrappedCaller() const { return _pWrappedCaller; }; void AlgorithmWrapperEvent:: Print(std::ostream& os) const { Superclass::Print(os); os << "wrapped caller: " << _pWrappedCaller << std::endl; os << "wrapped event: " << *_pWrappedEvent << std::endl; }; - } -} + } // namespace events +} // namespace map diff --git a/Code/Algorithms/Common/source/mapIterativeAlgorithmBase.cpp b/Code/Algorithms/Common/source/mapIterativeAlgorithmBase.cpp index 5e95958..9e404d2 100644 --- a/Code/Algorithms/Common/source/mapIterativeAlgorithmBase.cpp +++ b/Code/Algorithms/Common/source/mapIterativeAlgorithmBase.cpp @@ -1,73 +1,71 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapIterativeAlgorithmBase.h" namespace map { namespace algorithm { IterativeAlgorithmBase:: IterativeAlgorithmBase() - { - }; + = default; IterativeAlgorithmBase:: ~IterativeAlgorithmBase() - { - }; + = default; IterativeAlgorithmBase::IterationCountType IterativeAlgorithmBase:: getCurrentIteration() const { IterationCountType result = 0; if (this->hasIterationCount()) { result = this->doGetCurrentIteration(); } return result; }; IterativeAlgorithmBase::IterationCountType IterativeAlgorithmBase:: getMaxIterations() const { IterationCountType result = 0; if (this->hasMaxIterationCount()) { result = this->doGetMaxIterations(); } return result; }; - } -} + } // namespace algorithm +} // namespace map diff --git a/Code/Algorithms/Common/source/mapMetaPropertyAlgorithmBase.cpp b/Code/Algorithms/Common/source/mapMetaPropertyAlgorithmBase.cpp index 4df5534..f16bd04 100644 --- a/Code/Algorithms/Common/source/mapMetaPropertyAlgorithmBase.cpp +++ b/Code/Algorithms/Common/source/mapMetaPropertyAlgorithmBase.cpp @@ -1,231 +1,229 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapMetaPropertyAlgorithmBase.h" namespace map { namespace algorithm { MetaPropertyInfo::Pointer MetaPropertyAlgorithmBase:: getPropertyInfo(const MetaPropertyNameType& name) const { MetaPropertyVectorType infos = getPropertyInfos(); - MetaPropertyVectorType::iterator pos = infos.begin(); + auto pos = infos.begin(); - MetaPropertyInfo::Pointer spResult = NULL; + MetaPropertyInfo::Pointer spResult = nullptr; for (pos = infos.begin(); pos != infos.end(); ++pos) { if ((*pos)->getName() == name) { spResult = *pos; break; } } return spResult; }; MetaPropertyAlgorithmBase::MetaPropertyVectorType MetaPropertyAlgorithmBase:: getPropertyInfos() const { MetaPropertyVectorType infos; compileInfos(infos); return infos; }; MetaPropertyAlgorithmBase::MetaPropertyPointer MetaPropertyAlgorithmBase:: getProperty(const MetaPropertyNameType& name) const { - MetaPropertyPointer spResult = NULL; + MetaPropertyPointer spResult = nullptr; MetaPropertyInfo::Pointer spInfo = getPropertyInfo(name); if (spInfo.IsNotNull()) { if (spInfo->isReadable()) { //check cache - MetaPropertyCacheType::const_iterator pos = _metaPropertyCache.find(name); + auto pos = _metaPropertyCache.find(name); if (pos != _metaPropertyCache.end()) { //get from cache mapLogDebugObjMacro("Get property from cache. Property: " << pos->first); spResult = pos->second; } else { //retrieve directly mapLogDebugObjMacro("Get property from internal instance. Property: " << name); spResult = doGetProperty(name); } } } return spResult; }; MetaPropertyAlgorithmBase::MetaPropertyPointer MetaPropertyAlgorithmBase:: getProperty(const MetaPropertyInfo* pInfo) const { - MetaPropertyPointer spResult = NULL; + MetaPropertyPointer spResult = nullptr; - if (!pInfo) + if (pInfo == nullptr) { mapDefaultExceptionStaticMacro( << "Error while getting property. Passed property info is NULL."); } spResult = getProperty(pInfo->getName()); if (spResult.IsNotNull()) { if (!(spResult->getMetaPropertyTypeInfo() == pInfo->getTypeInfo())) { mapDefaultExceptionStaticMacro( << "Error while getting property. Property value type differs from specified type in the property info. value type: " << spResult->getMetaPropertyTypeInfo().name() << "; info type: " << pInfo->getTypeInfo().name()); } } return spResult; }; bool MetaPropertyAlgorithmBase:: setProperty(const MetaPropertyNameType& name, const MetaPropertyType* pProperty) { bool result = false; - if (!pProperty) + if (pProperty == nullptr) { mapDefaultExceptionStaticMacro( << "Error while setting property. Passed property pointer is NULL. Property name: " << name); } MetaPropertyInfo::Pointer spInfo = getPropertyInfo(name); if (spInfo.IsNotNull()) { if (!(pProperty->getMetaPropertyTypeInfo() == spInfo->getTypeInfo())) { mapDefaultExceptionStaticMacro("Error while setting property. Property value type differs from type specified by the algorithm. value type: " << pProperty->getMetaPropertyTypeInfo().name() << "; internal type: " << spInfo->getTypeInfo().name()); } if (spInfo->isWritable()) { result = true; _metaPropertyCache[name] = pProperty->Clone(); _cacheMTime.Modified(); } } return result; }; bool MetaPropertyAlgorithmBase:: setProperty(const MetaPropertyInfo* pInfo, const MetaPropertyType* pProperty) { bool result = false; - if (!pInfo) + if (pInfo == nullptr) { mapDefaultExceptionStaticMacro( << "Error while setting property. Passed property info is NULL."); } - if (!pProperty) + if (pProperty == nullptr) { mapDefaultExceptionStaticMacro( << "Error while setting property. Passed property pointer is NULL. Property name: " << pInfo->getName()); } if (!(pProperty->getMetaPropertyTypeInfo() == pInfo->getTypeInfo())) { mapDefaultExceptionStaticMacro("Error while setting property. Property value type differs from specified type in the property info. value type: " << pProperty->getMetaPropertyTypeInfo().name() << "; info type: " << pInfo->getTypeInfo().name()); } result = setProperty(pInfo->getName(), pProperty); return result; }; void MetaPropertyAlgorithmBase:: configureAlgorithmByMetaProperties() { - for (MetaPropertyCacheType::iterator pos = _metaPropertyCache.begin(); + for (auto pos = _metaPropertyCache.begin(); pos != _metaPropertyCache.end(); ++pos) { mapLogDebugObjMacro("Set property: " << pos->first); doSetProperty(pos->first, pos->second); } }; void MetaPropertyAlgorithmBase:: resetMetaPropertyCache() { _metaPropertyCache.clear(); _cacheMTime.Modified(); }; unsigned long MetaPropertyAlgorithmBase:: GetMTime() const { return _cacheMTime.GetMTime(); }; MetaPropertyAlgorithmBase:: MetaPropertyAlgorithmBase() - { - }; + = default; MetaPropertyAlgorithmBase:: ~MetaPropertyAlgorithmBase() - { - }; + = default; - } -} + } // namespace algorithm +} // namespace map diff --git a/Code/Algorithms/Common/source/mapMetaPropertyInfo.cpp b/Code/Algorithms/Common/source/mapMetaPropertyInfo.cpp index 846da30..52b825e 100644 --- a/Code/Algorithms/Common/source/mapMetaPropertyInfo.cpp +++ b/Code/Algorithms/Common/source/mapMetaPropertyInfo.cpp @@ -1,114 +1,115 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapMetaPropertyInfo.h" +#include + namespace map { namespace algorithm { MetaPropertyInfo::Pointer MetaPropertyInfo:: New(const core::String& name, const std::type_info& type_info, bool isReadable, bool isWritable) { Pointer smartPtr; Self* rawPtr = new Self(name, type_info, isReadable, isWritable); smartPtr = rawPtr; rawPtr->UnRegister(); return smartPtr; }; ::itk::LightObject::Pointer MetaPropertyInfo:: - CreateAnother(void) const + CreateAnother() const { ::itk::LightObject::Pointer smartPtr; smartPtr = Self::New(this->_name, this->_type_info, this->_isReadable, this->_isWritable).GetPointer(); return smartPtr; }; const char* MetaPropertyInfo:: getTypeName() const { return this->_type_info.name(); }; const std::type_info& MetaPropertyInfo:: getTypeInfo() const { return this->_type_info; }; const core::String& MetaPropertyInfo:: getName() const { return this->_name; }; bool MetaPropertyInfo:: isReadable() const { return this->_isReadable; }; bool MetaPropertyInfo:: isWritable() const { return this->_isWritable; }; void MetaPropertyInfo:: PrintSelf(std::ostream& os, ::itk::Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "Name: " << this->_name << std::endl; os << indent << "Type: " << this->_type_info.name() << std::endl; os << indent << "Readable: " << this->_isReadable << std::endl; os << indent << "Writable: " << this->_isWritable << std::endl; }; MetaPropertyInfo:: ~MetaPropertyInfo() - { - }; + = default; MetaPropertyInfo:: - MetaPropertyInfo(const core::String& name, const std::type_info& type_info, bool isReadable, + MetaPropertyInfo(core::String name, const std::type_info& type_info, bool isReadable, bool isWritable) : - _name(name), _type_info(type_info), _isReadable(isReadable), _isWritable(isWritable) + _name(std::move(name)), _type_info(type_info), _isReadable(isReadable), _isWritable(isWritable) {}; - } -} + } // namespace algorithm +} // namespace map diff --git a/Code/Algorithms/Common/source/mapMultiResRegistrationAlgorithmBase.cpp b/Code/Algorithms/Common/source/mapMultiResRegistrationAlgorithmBase.cpp index 4644890..fe52e81 100644 --- a/Code/Algorithms/Common/source/mapMultiResRegistrationAlgorithmBase.cpp +++ b/Code/Algorithms/Common/source/mapMultiResRegistrationAlgorithmBase.cpp @@ -1,148 +1,146 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapMultiResRegistrationAlgorithmBase.h" #include "mapExceptionObjectMacros.h" namespace map { namespace algorithm { MultiResRegistrationAlgorithmBase:: MultiResRegistrationAlgorithmBase() - { - }; + = default; MultiResRegistrationAlgorithmBase:: ~MultiResRegistrationAlgorithmBase() - { - }; + = default; void MultiResRegistrationAlgorithmBase:: setSchedule(const ScheduleType& movingSchedule, const ScheduleType& targetSchedule) { if (movingSchedule.columns() != this->getMovingResolutionDimensions()) { mapDefaultExceptionStaticMacro( << "Error. Schedule of moving information space has wrong dimension (column count). Dimension: " << this->getMovingResolutionDimensions() << "; columns: " << movingSchedule.columns()); } if (targetSchedule.columns() != this->getTargetResolutionDimensions()) { mapDefaultExceptionStaticMacro( << "Error. Schedule of target information space has wrong dimension (column count). Dimension: " << this->getTargetResolutionDimensions() << "; columns: " << targetSchedule.columns()); } if (targetSchedule.rows() != movingSchedule.rows()) { mapDefaultExceptionStaticMacro( << "Error. Schedules have different level count (rows). moving: " << movingSchedule.rows() << "; " << targetSchedule.rows()); } ScheduleType tempMovingSchedule = movingSchedule; ScheduleType tempTargetSchedule = targetSchedule; this->onScheduleChange(this->_movingResSchedule, tempMovingSchedule, this->_targetResSchedule, tempTargetSchedule); this->_movingResSchedule = tempMovingSchedule; this->_targetResSchedule = tempTargetSchedule; }; const MultiResRegistrationAlgorithmBase::ScheduleType& MultiResRegistrationAlgorithmBase:: getMovingSchedule() const { return this->_movingResSchedule; }; const MultiResRegistrationAlgorithmBase::ScheduleType& MultiResRegistrationAlgorithmBase:: getTargetSchedule() const { return this->_targetResSchedule; }; MultiResRegistrationAlgorithmBase::ResolutionLevelCountType MultiResRegistrationAlgorithmBase:: getResolutionLevels() const { return _movingResSchedule.rows(); //both schedules must have the same number of rows. }; void MultiResRegistrationAlgorithmBase:: setResolutionLevels(ResolutionLevelCountType levels) { if (!(levels > 0)) { mapDefaultExceptionStaticMacro( << "Error. Cannot set resolution level; passed level is 0."); } ScheduleType newMSched(levels, this->getMovingResolutionDimensions()); ScheduleType newTSched(levels, this->getTargetResolutionDimensions()); ScalingType s = 1; for (ResolutionLevelCountType i = 1; i <= levels; ++i, s = s * 2) { newMSched.set_row(levels - i, s); newTSched.set_row(levels - i, s); } this->setSchedule(newMSched, newTSched); }; MultiResRegistrationAlgorithmBase::ResolutionLevelCountType MultiResRegistrationAlgorithmBase:: getCurrentLevel() const { ResolutionLevelCountType result = 0; if (this->hasLevelCount()) { result = this->doGetCurrentLevel(); } return result; }; void MultiResRegistrationAlgorithmBase:: onScheduleChange(const ScheduleType& oldMovingSchedule, ScheduleType& newMovingSchedule, const ScheduleType& oldTargetSchedule, ScheduleType& newTargetMovingSchedule) const { //default implementation does nothing. //reimplement if you want to react on level changes //or want to modify the new schedules before they are set }; - } -} + } // namespace algorithm +} // namespace map diff --git a/Code/Algorithms/Common/source/mapOptimizerControlInterface.cpp b/Code/Algorithms/Common/source/mapOptimizerControlInterface.cpp index a85952d..e3fc29d 100644 --- a/Code/Algorithms/Common/source/mapOptimizerControlInterface.cpp +++ b/Code/Algorithms/Common/source/mapOptimizerControlInterface.cpp @@ -1,127 +1,125 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapOptimizerControlInterface.h" namespace map { namespace algorithm { bool OptimizerControlInterface:: stop() { bool result = false; if (this->isStoppable()) { result = this->doStop(); } return result; }; OptimizerControlInterface::IterationCountType OptimizerControlInterface:: getCurrentIteration() const { IterationCountType result = 0; if (this->hasIterationCount()) { result = this->doGetCurrentIteration(); } return result; }; OptimizerControlInterface::IterationCountType OptimizerControlInterface:: getMaxIterations() const { IterationCountType result = 0; if (this->hasMaxIterationCount()) { result = this->doGetMaxIterations(); } return result; }; OptimizerControlInterface::OptimizerMeasureType OptimizerControlInterface:: getCurrentValue() const { OptimizerMeasureType result; if (this->hasCurrentValue()) { result = this->doGetCurrentValue(); } return result; }; OptimizerControlInterface::OptimizerPositionType OptimizerControlInterface:: getCurrentPosition() const { OptimizerPositionType result; if (this->hasCurrentPosition()) { result = this->doGetCurrentPosition(); } return result; }; OptimizerControlInterface::OptimizerScalesType OptimizerControlInterface:: getScales() const { OptimizerScalesType result; if (this->hasScales()) { result = this->doGetScales(); } return result; }; OptimizerControlInterface:: OptimizerControlInterface() - { - }; + = default; OptimizerControlInterface:: ~OptimizerControlInterface() - { - }; + = default; - } -} + } // namespace algorithm +} // namespace map diff --git a/Code/Algorithms/Common/source/mapOptimizerGetterInterface.cpp b/Code/Algorithms/Common/source/mapOptimizerGetterInterface.cpp index 0254361..bf72f22 100644 --- a/Code/Algorithms/Common/source/mapOptimizerGetterInterface.cpp +++ b/Code/Algorithms/Common/source/mapOptimizerGetterInterface.cpp @@ -1,47 +1,43 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapOptimizerGetterInterface.h" namespace map { namespace algorithm { namespace facet { OptimizerGetterInterface::OptimizerGetterInterface() - { - - }; + = default; OptimizerGetterInterface::~OptimizerGetterInterface() - { - - }; + = default; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map diff --git a/Code/Algorithms/Common/source/mapRegistrationAlgorithmBase.cpp b/Code/Algorithms/Common/source/mapRegistrationAlgorithmBase.cpp index 014f425..a9711b8 100644 --- a/Code/Algorithms/Common/source/mapRegistrationAlgorithmBase.cpp +++ b/Code/Algorithms/Common/source/mapRegistrationAlgorithmBase.cpp @@ -1,106 +1,105 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include #include "mapAlgorithmStateChangeEvent.h" /*! @namespace map The namespace map is used throughout the MatchPoint project to mark code as components of this project */ namespace map { namespace algorithm { bool RegistrationAlgorithmBase:: determineRegistration() { return doDetermineRegistration(); }; RegistrationAlgorithmBase:: - RegistrationAlgorithmBase() : _currentState(AlgorithmState::Pending), _firstConfiguration(true) + RegistrationAlgorithmBase() { }; RegistrationAlgorithmBase:: ~RegistrationAlgorithmBase() - { - }; + = default; bool RegistrationAlgorithmBase:: isFirstConfiguration() const { return _firstConfiguration; }; void RegistrationAlgorithmBase:: doneFirstConfiguration() { _firstConfiguration = false; }; /*! Methods invoked by itk::LightObject::Print(). */ void RegistrationAlgorithmBase:: PrintSelf(std::ostream& os, ::itk::Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "Algorithm type: " << this->getAlgorithmType() << std::endl; os << indent << "Algorithm state: " << _currentState << std::endl; os << indent << "Moving dimensions: " << this->getMovingDimensions() << std::endl; os << indent << "Target dimensions: " << this->getTargetDimensions() << std::endl; }; RegistrationAlgorithmBase::AlgorithmState::Type RegistrationAlgorithmBase:: getCurrentState() const { return _currentState; }; void RegistrationAlgorithmBase:: setCurrentState(const AlgorithmState::Type& state) { StateLockHolderType holder(_stateLock); this->onStateChange(_currentState, state); this->InvokeEvent(::map::events::AlgorithmStateChangeEvent(_currentState, state)); _currentState = state; }; void RegistrationAlgorithmBase:: onStateChange(AlgorithmState::Type oldState, AlgorithmState::Type newState) const { //default implementation does nothing }; - } -} + } // namespace algorithm +} // namespace map diff --git a/Code/Algorithms/Common/source/mapStoppableAlgorithmInterface.cpp b/Code/Algorithms/Common/source/mapStoppableAlgorithmInterface.cpp index 470e6af..c30c598 100644 --- a/Code/Algorithms/Common/source/mapStoppableAlgorithmInterface.cpp +++ b/Code/Algorithms/Common/source/mapStoppableAlgorithmInterface.cpp @@ -1,39 +1,39 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapStoppableAlgorithmInterface.h" namespace map { namespace algorithm { namespace facet { - StoppableAlgorithmInterface::StoppableAlgorithmInterface() {}; - StoppableAlgorithmInterface::~StoppableAlgorithmInterface() {}; + StoppableAlgorithmInterface::StoppableAlgorithmInterface() = default; + StoppableAlgorithmInterface::~StoppableAlgorithmInterface() = default; } } -} +} // namespace map diff --git a/Code/Algorithms/Common/source/mapUID.cpp b/Code/Algorithms/Common/source/mapUID.cpp index 39a6838..3d6674e 100644 --- a/Code/Algorithms/Common/source/mapUID.cpp +++ b/Code/Algorithms/Common/source/mapUID.cpp @@ -1,149 +1,150 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapUID.h" +#include + namespace map { namespace algorithm { UID::Pointer UID:: New(const NamespaceType& ns, const NameType& name, const VersionType& version, const BuildTagType& buildTag) { Pointer smartPtr; Self* rawPtr = new Self(ns, name, version, buildTag); smartPtr = rawPtr; rawPtr->UnRegister(); return smartPtr; }; const UID::NamespaceType& UID:: getNamespace() const { return this->_namespace; }; const UID::NameType& UID:: getName() const { return this->_name; }; const UID::VersionType& UID:: getVersion() const { return this->_version; }; const UID::BuildTagType& UID:: getBuildTag() const { return this->_buildTag; }; - const core::String + core::String UID:: toStr() const { ::map::core::OStringStream stream; stream << this->_namespace << "::" << this->_name << "::" << this->_version << "::" << this->_buildTag; ::map::core::String result = stream.str(); return result; }; void UID:: PrintSelf(std::ostream& os, ::itk::Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "Namespace: " << this->_namespace << std::endl; os << indent << "Name: " << this->_name << std::endl; os << indent << "Version: " << this->_version << std::endl; os << indent << "Build number: " << this->_buildTag << std::endl; }; UID:: ~UID() - { - }; + = default; UID:: - UID(const NamespaceType& ns, const NameType& name, const VersionType& version, - const BuildTagType& buildTag) : - _namespace(ns), _name(name), _version(version), _buildTag(buildTag) + UID(NamespaceType ns, NameType name, VersionType version, + BuildTagType buildTag) : + _namespace(std::move(ns)), _name(std::move(name)), _version(std::move(version)), _buildTag(std::move(buildTag)) {}; bool compareUIDs(const UID& uid1, const UID& uid2, bool wcNamespace, bool wcName, bool wcVersion, bool wcBuild) { if ((uid1.getNamespace() != uid2.getNamespace()) && (! wcNamespace)) { return false; } if ((uid1.getName() != uid2.getName()) && (! wcName)) { return false; } if ((uid1.getVersion() != uid2.getVersion()) && (! wcVersion)) { return false; } if ((uid1.getBuildTag() != uid2.getBuildTag()) && (! wcBuild)) { return false; } return true; }; bool compareUIDs(const UID* uid1, const UID* uid2, bool wcNamespace, bool wcName, bool wcVersion, bool wcBuild) { - if (!uid1 || !uid2) + if ((uid1 == nullptr) || (uid2 == nullptr)) { return false; } return compareUIDs(*uid1, *uid2, wcNamespace, wcName, wcVersion, wcBuild); }; - } -} + } // namespace algorithm +} // namespace map diff --git a/Code/Algorithms/Elastix/include/mapElxAlgorithmHelper.h b/Code/Algorithms/Elastix/include/mapElxAlgorithmHelper.h index d8b74ce..7018fa3 100644 --- a/Code/Algorithms/Elastix/include/mapElxAlgorithmHelper.h +++ b/Code/Algorithms/Elastix/include/mapElxAlgorithmHelper.h @@ -1,77 +1,77 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_ELX_ALGORITHM_HELPER_H #define __MAP_ELX_ALGORITHM_HELPER_H //MatchPoint #include "mapContinuous.h" #include "mapString.h" #include "mapConvert.h" #include "mapMAPAlgorithmsElastixExports.h" namespace map { namespace algorithm { namespace elastix { using ParameterValuesType = std::vector< std::string >; using ParameterMapType = std::map< std::string, ParameterValuesType >; /**! Helper function that stores the passed parameter map to the given file path. If the file already exists it is overwritten. The parameter map is stored in the elastix format: ( [ [...]]).*/ MAPAlgorithmsElastix_EXPORT void saveParameterMapToFile(const ParameterMapType& parameterMap, - const map::core::String& fileName); + const map::core::String& filePath); /**! Helper function that loads a given parameter file and returns a parameter map.*/ MAPAlgorithmsElastix_EXPORT ParameterMapType readParameterMapFromFile(const map::core::String& fileName); class MAPAlgorithmsElastix_EXPORT ParamGenerator { public: ParamGenerator(); ~ParamGenerator(); ParamGenerator& addStr(const core::String& value); template ParamGenerator& add(const TElement& value) { this->_values.push_back(core::convert::toStrGeneric(value)); return *this; }; operator ParameterValuesType(); protected: ParameterValuesType _values; }; - } - } -} + } // namespace elastix + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Elastix/source/ParameterFileParser/itkParameterFileParser.cxx b/Code/Algorithms/Elastix/source/ParameterFileParser/itkParameterFileParser.cxx index e427fef..737e509 100644 --- a/Code/Algorithms/Elastix/source/ParameterFileParser/itkParameterFileParser.cxx +++ b/Code/Algorithms/Elastix/source/ParameterFileParser/itkParameterFileParser.cxx @@ -1,477 +1,477 @@ /*========================================================================= * * Copyright UMC Utrecht and contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *=========================================================================*/ #ifndef __itkParameterFileParser_cxx #define __itkParameterFileParser_cxx #include "itkParameterFileParser.h" #include #include namespace itk { /** * **************** Constructor *************** */ ParameterFileParser ::ParameterFileParser() { this->m_ParameterFileName = ""; this->m_ParameterMap.clear(); } // end Constructor() /** * **************** Destructor *************** */ ParameterFileParser ::~ParameterFileParser() { if( this->m_ParameterFile.is_open() ) { this->m_ParameterFile.close(); } } // end Destructor() /** * **************** GetParameterMap *************** */ const ParameterFileParser::ParameterMapType & ParameterFileParser -::GetParameterMap( void ) const +::GetParameterMap( ) const { return this->m_ParameterMap; } // end GetParameterMap() /** * **************** ReadParameterFile *************** */ void ParameterFileParser -::ReadParameterFile( void ) +::ReadParameterFile( ) { /** Perform some basic checks. */ this->BasicFileChecking(); /** Open the parameter file for reading. */ if( this->m_ParameterFile.is_open() ) { this->m_ParameterFile.clear(); this->m_ParameterFile.close(); } this->m_ParameterFile.open( this->m_ParameterFileName.c_str(), std::fstream::in ); /** Check if it opened. */ if( !this->m_ParameterFile.is_open() ) { itkExceptionMacro( << "ERROR: could not open " << this->m_ParameterFileName << " for reading." ); } /** Clear the map. */ this->m_ParameterMap.clear(); /** Loop over the parameter file, line by line. */ - std::string lineIn = ""; - std::string lineOut = ""; + std::string lineIn; + std::string lineOut; while( this->m_ParameterFile.good() ) { /** Extract a line. */ itksys::SystemTools::GetLineFromStream( this->m_ParameterFile, lineIn ); /** Check this line. */ bool validLine = this->CheckLine( lineIn, lineOut ); if( validLine ) { /** Get the parameter name from this line and store it. */ this->GetParameterFromLine( lineIn, lineOut ); } // Otherwise, we simply ignore this line } /** Close the parameter file. */ this->m_ParameterFile.clear(); this->m_ParameterFile.close(); } // end ReadParameterFile() /** * **************** BasicFileChecking *************** */ void ParameterFileParser -::BasicFileChecking( void ) const +::BasicFileChecking( ) const { /** Check if the file name is given. */ - if( this->m_ParameterFileName == "" ) + if( this->m_ParameterFileName.empty() ) { itkExceptionMacro( << "ERROR: FileName has not been set." ); } /** Basic error checking: existence. */ bool exists = itksys::SystemTools::FileExists( this->m_ParameterFileName.c_str() ); if( !exists ) { itkExceptionMacro( << "ERROR: the file " << this->m_ParameterFileName << " does not exist." ); } /** Basic error checking: file or directory. */ bool isDir = itksys::SystemTools::FileIsDirectory( - this->m_ParameterFileName.c_str() ); + this->m_ParameterFileName ); if( isDir ) { itkExceptionMacro( << "ERROR: the file " << this->m_ParameterFileName << " is a directory." ); } /** Check the extension. */ std::string ext = itksys::SystemTools::GetFilenameLastExtension( this->m_ParameterFileName ); if( ext != ".txt" ) { itkExceptionMacro( << "ERROR: the file " << this->m_ParameterFileName << " should be a text file (*.txt)." ); } } // end BasicFileChecking() /** * **************** CheckLine *************** */ bool ParameterFileParser ::CheckLine( const std::string & lineIn, std::string & lineOut ) const { /** Preprocessing of lineIn: * 1) Replace tabs with spaces * 2) Remove everything after comment sign // * 3) Remove leading spaces * 4) Remove trailing spaces */ lineOut = lineIn; itksys::SystemTools::ReplaceString( lineOut, "\t", " " ); itksys::RegularExpression commentPart( "//" ); if( commentPart.find( lineOut ) ) { lineOut = lineOut.substr( 0, commentPart.start() ); } itksys::RegularExpression leadingSpaces( "^[ ]*(.*)" ); leadingSpaces.find( lineOut ); lineOut = leadingSpaces.match( 1 ); itksys::RegularExpression trailingSpaces( "[ \t]+$" ); if( trailingSpaces.find( lineOut ) ) { lineOut = lineOut.substr( 0, trailingSpaces.start() ); } /** * Checks: * 1. Empty line -> false * 2. Comment (line starts with "//") -> false * 3. Line is not between brackets (...) -> exception * 4. Line contains less than two words -> exception * * Otherwise return true. */ /** 1. Check for non-empty lines. */ itksys::RegularExpression reNonEmptyLine( "[^ ]+" ); bool match1 = reNonEmptyLine.find( lineOut ); if( !match1 ) { return false; } /** 2. Check for comments. */ itksys::RegularExpression reComment( "^//" ); bool match2 = reComment.find( lineOut ); if( match2 ) { return false; } /** 3. Check if line is between brackets. */ if( !itksys::SystemTools::StringStartsWith( lineOut.c_str(), "(" ) || !itksys::SystemTools::StringEndsWith( lineOut.c_str(), ")" ) ) { std::string hint = "Line is not between brackets: \"(...)\"."; this->ThrowException( lineIn, hint ); } /** Remove brackets. */ lineOut = lineOut.substr( 1, lineOut.size() - 2 ); /** 4. Check: the line should contain at least two words. */ itksys::RegularExpression reTwoWords( "([ ]+)([^ ]+)" ); bool match4 = reTwoWords.find( lineOut ); if( !match4 ) { std::string hint = "Line does not contain a parameter name and value."; this->ThrowException( lineIn, hint ); } /** At this point we know its at least a line containing a parameter. * However, this line can still be invalid, for example: * (string &^%^*) * This will be checked later. */ return true; } // end CheckLine() /** * **************** GetParameterFromLine *************** */ void ParameterFileParser ::GetParameterFromLine( const std::string & fullLine, const std::string & line ) { /** A line has a parameter name followed by one or more parameters. * They are all separated by one or more spaces (all tabs have been * removed previously) or by quotes in case of strings. So, * 1) we split the line at the spaces or quotes * 2) the first one is the parameter name * 3) the other strings that are not a series of spaces, are parameter values */ /** 1) Split the line. */ std::vector< std::string > splittedLine; this->SplitLine( fullLine, line, splittedLine ); /** 2) Get the parameter name. */ std::string parameterName = splittedLine[ 0 ]; itksys::SystemTools::ReplaceString( parameterName, " ", "" ); splittedLine.erase( splittedLine.begin() ); /** 3) Get the parameter values. */ std::vector< std::string > parameterValues; for( unsigned int i = 0; i < splittedLine.size(); ++i ) { - if( splittedLine[ i ] != "" ) + if( !splittedLine[ i ].empty() ) { parameterValues.push_back( splittedLine[ i ] ); } } /** 4) Perform some checks on the parameter name. */ itksys::RegularExpression reInvalidCharacters1( "[.,:;!@#$%^&-+|<>?]" ); bool match = reInvalidCharacters1.find( parameterName ); if( match ) { std::string hint = "The parameter \"" + parameterName + "\" contains invalid characters (.,:;!@#$%^&-+|<>?)."; this->ThrowException( fullLine, hint ); } /** 5) Perform checks on the parameter values. */ itksys::RegularExpression reInvalidCharacters2( "[,;!@#$%&|<>?]" ); - for( unsigned int i = 0; i < parameterValues.size(); ++i ) + for(const auto & parameterValue : parameterValues) { /** For all entries some characters are not allowed. */ - if( reInvalidCharacters2.find( parameterValues[ i ] ) ) + if( reInvalidCharacters2.find( parameterValue ) ) { std::string hint = "The parameter value \"" - + parameterValues[ i ] + + parameterValue + "\" contains invalid characters (,;!@#$%&|<>?)."; this->ThrowException( fullLine, hint ); } } /** 6) Insert this combination in the parameter map. */ - if( this->m_ParameterMap.count( parameterName ) ) + if( this->m_ParameterMap.count( parameterName ) != 0u ) { std::string hint = "The parameter \"" + parameterName + "\" is specified more than once."; this->ThrowException( fullLine, hint ); } else { this->m_ParameterMap.insert( make_pair( parameterName, parameterValues ) ); } } // end GetParameterFromLine() /** * **************** SplitLine *************** */ void ParameterFileParser ::SplitLine( const std::string & fullLine, const std::string & line, std::vector< std::string > & splittedLine ) const { splittedLine.clear(); splittedLine.resize( 1 ); std::vector< itksys::String > splittedLine1; /** Count the number of quotes in the line. If it is an odd value, the * line contains an error; strings should start and end with a quote, so * the total number of quotes is even. */ std::size_t numQuotes = itksys::SystemTools::CountChar( line.c_str(), '"' ); if( numQuotes % 2 == 1 ) { /** An invalid parameter line. */ std::string hint = "This line has an odd number of quotes (\")."; this->ThrowException( fullLine, hint ); } /** Loop over the line. */ std::string::const_iterator it; unsigned int index = 0; numQuotes = 0; for( it = line.begin(); it < line.end(); ++it ) { if( *it == '"' ) { /** Start a new element. */ - splittedLine.push_back( "" ); + splittedLine.emplace_back("" ); index++; numQuotes++; } else if( *it == ' ' ) { /** Only start a new element if it is not a quote, otherwise just add * the space to the string. */ if( numQuotes % 2 == 0 ) { - splittedLine.push_back( "" ); + splittedLine.emplace_back("" ); index++; } else { splittedLine[ index ].push_back( *it ); } } else { /** Add this character to the element. */ splittedLine[ index ].push_back( *it ); } } } // end SplitLine() /** * **************** ThrowException *************** */ void ParameterFileParser ::ThrowException( const std::string & line, const std::string & hint ) const { /** Construct an error message. */ std::string errorMessage = "ERROR: the following line in your parameter file is invalid: \n\"" + line + "\"\n" + hint + "\nPlease correct you parameter file!"; /** Throw exception. */ itkExceptionMacro( << errorMessage.c_str() ); } // end ThrowException() /** * **************** ReturnParameterFileAsString *************** */ std::string ParameterFileParser -::ReturnParameterFileAsString( void ) +::ReturnParameterFileAsString( ) { /** Perform some basic checks. */ this->BasicFileChecking(); /** Open the parameter file for reading. */ if( this->m_ParameterFile.is_open() ) { this->m_ParameterFile.clear(); this->m_ParameterFile.close(); } this->m_ParameterFile.open( this->m_ParameterFileName.c_str(), std::fstream::in ); /** Check if it opened. */ if( !this->m_ParameterFile.is_open() ) { itkExceptionMacro( << "ERROR: could not open " << this->m_ParameterFileName << " for reading." ); } /** Loop over the parameter file, line by line. */ - std::string line = ""; + std::string line; std::string output; while( this->m_ParameterFile.good() ) { /** Extract a line. */ itksys::SystemTools::GetLineFromStream( this->m_ParameterFile, line ); // \todo: returns bool output += line + "\n"; } /** Close the parameter file. */ this->m_ParameterFile.clear(); this->m_ParameterFile.close(); /** Return the string. */ return output; } // end ReturnParameterFileAsString() } // end namespace itk #endif // end __itkParameterFileParser_cxx diff --git a/Code/Algorithms/Elastix/source/ParameterFileParser/itkParameterFileParser.h b/Code/Algorithms/Elastix/source/ParameterFileParser/itkParameterFileParser.h index e2e19d5..3b6e608 100644 --- a/Code/Algorithms/Elastix/source/ParameterFileParser/itkParameterFileParser.h +++ b/Code/Algorithms/Elastix/source/ParameterFileParser/itkParameterFileParser.h @@ -1,163 +1,163 @@ /*========================================================================= * * Copyright UMC Utrecht and contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *=========================================================================*/ #ifndef __itkParameterFileParser_h #define __itkParameterFileParser_h #include "itkObject.h" #include "itkObjectFactory.h" #include "itkMacro.h" #include #include #include #include namespace itk { /** \class ParameterFileParser * * \brief Implements functionality to read a parameter file. * * A parameter file is a text file that contains parameters and their values. * Parameters should be specified obeying certain rules.\n * 1) A single parameter should be on a single line\n * 2) A parameter should be specified between brackets: (...)\n * 3) Parameters are specified by a single name, followed by one or more * values, all separated by spaces\n * 4) Values that are strings should be quoted using "\n * 5) Values that are numbers should be unquoted\n * * For example: \n * (ParameterName1 "string1" "string2")\n * (ParameterName2 3 5.8)\n * (ParameterName3 "true" "false" "true")\n * * The parameter file is read, and parameter name-value combinations are * stored in an std::map< std::string, std::vector >, where the * string is the parameter name, and the vector of strings are the values. * Exceptions are raised in case:\n * - the parameter text file cannot be opened,\n * - rule 2 or 3 is not satisfied,\n * - the parameter name or value contains invalid characters.\n * * Here is an example on how to use this class:\n * * itk::ParameterFileParser::Pointer parser = itk::ParameterFileParser::New(); * parser->SetParameterFileName( parameterFileName ); * try * { * parser->Initialize(); * } * catch ( itk::ExceptionObject & e ) * { * ... * } * * The resulting map can be accessed via:\n * * parser->GetParameterMap(); * * \sa itk::ParameterMapInterface */ class ParameterFileParser : public Object { public: /** Standard ITK typedefs. */ - typedef ParameterFileParser Self; - typedef Object Superclass; - typedef SmartPointer< Self > Pointer; - typedef SmartPointer< const Self > ConstPointer; + using Self = ParameterFileParser; + using Superclass = Object; + using Pointer = SmartPointer; + using ConstPointer = SmartPointer; /** Method for creation through the object factory. */ itkNewMacro( Self ); /** Run-time type information (and related methods). */ itkTypeMacro( ParameterFileParser, Object ); /** Typedefs. */ - typedef std::vector< std::string > ParameterValuesType; + using ParameterValuesType = std::vector; typedef std::map< std::string, ParameterValuesType > ParameterMapType; /** Set the name of the file containing the parameters. */ itkSetStringMacro( ParameterFileName ); itkGetStringMacro( ParameterFileName ); /** Return the parameter map. */ - virtual const ParameterMapType & GetParameterMap( void ) const; + virtual const ParameterMapType & GetParameterMap( ) const; /** Read the parameters in the parameter map. */ - void ReadParameterFile( void ); + void ReadParameterFile( ); /** Read the parameter file and return the content as a string. * Useful for printing the content. */ - std::string ReturnParameterFileAsString( void ); + std::string ReturnParameterFileAsString( ); protected: ParameterFileParser(); - virtual ~ParameterFileParser(); + ~ParameterFileParser() override; private: - ParameterFileParser( const Self & ); // purposely not implemented - void operator=( const Self & ); // purposely not implemented + ParameterFileParser( const Self & ) = delete; // purposely not implemented + void operator=( const Self & ) = delete; // purposely not implemented /** Performs the following checks: * - Is a filename is given * - Does the file exist * - Is a text file, i.e. does it end with .txt * If one of these conditions fail, an exception is thrown. */ - void BasicFileChecking( void ) const; + void BasicFileChecking( ) const; /** Checks a line. * - Returns true if it is a valid line: containing a parameter. * - Returns false if it is a valid line: empty or comment. * - Throws an exception if it is not a valid line. */ bool CheckLine( const std::string & line, std::string & lineOut ) const; /** Fills m_ParameterMap with valid entries. */ void GetParameterFromLine( const std::string & fullLine, const std::string & line ); /** Splits a line in parameter name and values. */ void SplitLine( const std::string & fullLine, const std::string & line, std::vector< std::string > & splittedLine ) const; /** Uniform way to throw exceptions when the parameter file appears to be * invalid. */ void ThrowException( const std::string & line, const std::string & hint ) const; /** Member variables. */ std::string m_ParameterFileName; std::ifstream m_ParameterFile; ParameterMapType m_ParameterMap; }; } // end of namespace itk #endif // end __itkParameterFileParser_h diff --git a/Code/Algorithms/Elastix/source/mapElxAlgorithmHelper.cpp b/Code/Algorithms/Elastix/source/mapElxAlgorithmHelper.cpp index f0cda40..2256563 100644 --- a/Code/Algorithms/Elastix/source/mapElxAlgorithmHelper.cpp +++ b/Code/Algorithms/Elastix/source/mapElxAlgorithmHelper.cpp @@ -1,101 +1,99 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ //Elastix #include "ParameterFileParser\itkParameterFileParser.h" //MatchPoint #include "mapElxAlgorithmHelper.h" #include "mapString.h" #include "mapExceptionObjectMacros.h" namespace map { namespace algorithm { namespace elastix { void saveParameterMapToFile(const ParameterMapType& parameterMap, const map::core::String& filePath) { std::ofstream file; std::ios_base::openmode iOpenFlag = std::ios_base::out | std::ios_base::trunc; file.open(filePath.c_str(), iOpenFlag); if (!file.is_open()) { mapDefaultExceptionStaticMacro( << "Cannot open or create parameter map file to save. File path: " << filePath); } - for (ParameterMapType::const_iterator pos = parameterMap.begin(); pos != parameterMap.end(); ++pos) + for (const auto & pos : parameterMap) { - file << "(" << pos->first; + file << "(" << pos.first; - for (ParameterValuesType::const_iterator valPos = pos->second.begin(); valPos != pos->second.end(); + for (auto valPos = pos.second.begin(); valPos != pos.second.end(); ++valPos) { file << " " << *valPos; } file << ")\n"; } file.close(); }; ParameterMapType readParameterMapFromFile(const map::core::String& fileName) { itk::ParameterFileParser::Pointer spParser = itk::ParameterFileParser::New(); spParser->SetParameterFileName(fileName); spParser->ReadParameterFile(); return spParser->GetParameterMap(); }; ParamGenerator::ParamGenerator() - { - } + = default; ParamGenerator::~ParamGenerator() - { - } + = default; ParamGenerator& ParamGenerator:: addStr(const core::String& value) { this->_values.push_back("\"" + value + "\""); return *this; } ParamGenerator:: operator ParameterValuesType() { return this->_values; } - } - } -} + } // namespace elastix + } // namespace algorithm +} // namespace map diff --git a/Code/Algorithms/ITK/boxed/mapITKInitializedMultiResImageRegistrationAlgorithm.h b/Code/Algorithms/ITK/boxed/mapITKInitializedMultiResImageRegistrationAlgorithm.h index 81d9443..b369884 100644 --- a/Code/Algorithms/ITK/boxed/mapITKInitializedMultiResImageRegistrationAlgorithm.h +++ b/Code/Algorithms/ITK/boxed/mapITKInitializedMultiResImageRegistrationAlgorithm.h @@ -1,114 +1,114 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_ITK_INITIALIZING_MULTI_RES_IMAGE_REGISTRATION_ALGORITHM_H #define __MAP_ITK_INITIALIZING_MULTI_RES_IMAGE_REGISTRATION_ALGORITHM_H #include "mapITKMultiResImageRegistrationAlgorithm.h" namespace map { namespace algorithm { namespace boxed { mapGenerateAlgorithmUIDPolicyMacro(DefaultITKInitializingMultiResImageRegistrationUIDPolicy, "MatchPoint.ITK", "ITKInitializedMultiResImageRegistrationAlgorithm.default", "1.0.0", ""); template < class TMovingImage, class TTargetImage, class TUIDPolicy = DefaultITKInitializingMultiResImageRegistrationUIDPolicy, class TInterpolatorPolicy = itk::ArbitraryInterpolatorPolicy, class TMetricPolicy = itk::ArbitraryImageToImageMetricPolicy, class TOptimizerPolicy = itk::ArbitrarySVNLOptimizerPolicy, class TTransformPolicy = itk::ArbitraryTransformPolicy< ::map::core::continuous::ScalarType, TMovingImage::ImageDimension, TTargetImage::ImageDimension>, class TPyramidesPolicy = ArbitraryImagePyramidesPolicy > class ITKInitializedMultiResImageRegistrationAlgorithm : public algorithm::itk::ITKMultiResImageRegistrationAlgorithm < TMovingImage, TTargetImage, TUIDPolicy, TInterpolatorPolicy, TMetricPolicy, TOptimizerPolicy, TTransformPolicy, TPyramidesPolicy > { public: typedef ITKInitializedMultiResImageRegistrationAlgorithm < TMovingImage, TTargetImage, TUIDPolicy, TInterpolatorPolicy, TMetricPolicy, TOptimizerPolicy, TTransformPolicy, TPyramidesPolicy > Self; typedef typename algorithm::itk::ITKMultiResImageRegistrationAlgorithm < TMovingImage, TTargetImage, TUIDPolicy, TInterpolatorPolicy, TMetricPolicy, TOptimizerPolicy, TTransformPolicy, TPyramidesPolicy > Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(ITKInitializedMultiResImageRegistrationAlgorithm, ITKMultiResImageRegistrationAlgorithm); mapNewAlgorithmMacro(Self); - typedef ::itk::Array ParametersType; + using ParametersType = ::itk::Array; - typedef typename Superclass::MetaPropertyType MetaPropertyType; - typedef typename Superclass::MetaPropertyPointer MetaPropertyPointer; - typedef typename Superclass::MetaPropertyNameType MetaPropertyNameType; - typedef typename Superclass::MetaPropertyVectorType MetaPropertyVectorType; + using MetaPropertyType = typename Superclass::MetaPropertyType; + using MetaPropertyPointer = typename Superclass::MetaPropertyPointer; + using MetaPropertyNameType = typename Superclass::MetaPropertyNameType; + using MetaPropertyVectorType = typename Superclass::MetaPropertyVectorType; protected: ITKInitializedMultiResImageRegistrationAlgorithm(); virtual ~ITKInitializedMultiResImageRegistrationAlgorithm(); virtual void configureAlgorithm(); virtual void compileInfos(MetaPropertyVectorType& infos) const; virtual MetaPropertyPointer doGetProperty(const MetaPropertyNameType& name) const; virtual void doSetProperty(const MetaPropertyNameType& name, const MetaPropertyType* pProperty); /*! Calls the super class version. Afterwards it preinitializes the transform of * the algorithm as setup (no init, init by geometry or init by center of gravity). @eguarantee strong */ virtual void prepInitializeTransformation(); /*! Indicates if the transform should be pre initialized */ bool _preInitialize; /*! Indicates if for a pre initialization the center of gravity (true) or the image geometry center (false) * should be used.*/ bool _useCenterOfGravity; private: ITKInitializedMultiResImageRegistrationAlgorithm(const Self& source); //purposely not implemented void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace boxed + } // namespace algorithm +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapITKInitializedMultiResImageRegistrationAlgorithm.tpp" #endif #endif diff --git a/Code/Algorithms/ITK/boxed/mapITKInitializedMultiResImageRegistrationAlgorithm.tpp b/Code/Algorithms/ITK/boxed/mapITKInitializedMultiResImageRegistrationAlgorithm.tpp index 767f6b8..4e8eda9 100644 --- a/Code/Algorithms/ITK/boxed/mapITKInitializedMultiResImageRegistrationAlgorithm.tpp +++ b/Code/Algorithms/ITK/boxed/mapITKInitializedMultiResImageRegistrationAlgorithm.tpp @@ -1,260 +1,260 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_ITK_INITIALIZING_MULTI_RES_IMAGE_REGISTRATION_ALGORITHM_TPP #define __MAP_ITK_INITIALIZING_MULTI_RES_IMAGE_REGISTRATION_ALGORITHM_TPP #include "mapITKInitializedMultiResImageRegistrationAlgorithm.h" #include "mapMetaProperty.h" #include "mapMetaPropertyAccessor.h" #include "itkCenteredTransformInitializer.h" -#include +#include namespace map { namespace algorithm { namespace boxed { template < class TMovingImage, class TTargetImage, typename TUIDPolicy, class TInterpolatorPolicy, class TPyramideInitializationPolicy, class TMetricInitializationPolicy, class TOptimizerInitializationPolicy, class TTransformInitializationPolicy > ITKInitializedMultiResImageRegistrationAlgorithm < TMovingImage, TTargetImage, TUIDPolicy, TInterpolatorPolicy, TPyramideInitializationPolicy, TMetricInitializationPolicy, TOptimizerInitializationPolicy, TTransformInitializationPolicy >:: ITKInitializedMultiResImageRegistrationAlgorithm() { }; template < class TMovingImage, class TTargetImage, typename TUIDPolicy, class TInterpolatorPolicy, class TPyramideInitializationPolicy, class TMetricInitializationPolicy, class TOptimizerInitializationPolicy, class TTransformInitializationPolicy > ITKInitializedMultiResImageRegistrationAlgorithm < TMovingImage, TTargetImage, TUIDPolicy, TInterpolatorPolicy, TPyramideInitializationPolicy, TMetricInitializationPolicy, TOptimizerInitializationPolicy, TTransformInitializationPolicy >:: ~ITKInitializedMultiResImageRegistrationAlgorithm() { }; template < class TMovingImage, class TTargetImage, typename TUIDPolicy, class TInterpolatorPolicy, class TPyramideInitializationPolicy, class TMetricInitializationPolicy, class TOptimizerInitializationPolicy, class TTransformInitializationPolicy > void ITKInitializedMultiResImageRegistrationAlgorithm < TMovingImage, TTargetImage, TUIDPolicy, TInterpolatorPolicy, TPyramideInitializationPolicy, TMetricInitializationPolicy, TOptimizerInitializationPolicy, TTransformInitializationPolicy >:: configureAlgorithm() { _preInitialize = false; _useCenterOfGravity = false; }; template < class TMovingImage, class TTargetImage, typename TUIDPolicy, class TInterpolatorPolicy, class TPyramideInitializationPolicy, class TMetricInitializationPolicy, class TOptimizerInitializationPolicy, class TTransformInitializationPolicy > void ITKInitializedMultiResImageRegistrationAlgorithm < TMovingImage, TTargetImage, TUIDPolicy, TInterpolatorPolicy, TPyramideInitializationPolicy, TMetricInitializationPolicy, TOptimizerInitializationPolicy, TTransformInitializationPolicy >:: compileInfos(MetaPropertyVectorType& infos) const { Superclass::compileInfos(infos); #ifndef MAP_SEAL_ALGORITHMS infos.push_back(map::algorithm::MetaPropertyInfo::New("PreinitTransform", typeid(bool), true, true)); infos.push_back(map::algorithm::MetaPropertyInfo::New("PreinitByCenterOfGravity", typeid(bool), true, true)); #endif }; template < class TMovingImage, class TTargetImage, typename TUIDPolicy, class TInterpolatorPolicy, class TPyramideInitializationPolicy, class TMetricInitializationPolicy, class TOptimizerInitializationPolicy, class TTransformInitializationPolicy > typename ITKInitializedMultiResImageRegistrationAlgorithm < TMovingImage, TTargetImage, TUIDPolicy, TInterpolatorPolicy, TPyramideInitializationPolicy, TMetricInitializationPolicy, TOptimizerInitializationPolicy, TTransformInitializationPolicy >::MetaPropertyPointer ITKInitializedMultiResImageRegistrationAlgorithm < TMovingImage, TTargetImage, TUIDPolicy, TInterpolatorPolicy, TPyramideInitializationPolicy, TMetricInitializationPolicy, TOptimizerInitializationPolicy, TTransformInitializationPolicy >:: doGetProperty(const MetaPropertyNameType& name) const { MetaPropertyPointer spResult; if (name == "PreinitTransform") { spResult = map::core::MetaProperty::New(this->_preInitialize); } else if (name == "PreinitByCenterOfGravity") { spResult = map::core::MetaProperty::New(this->_useCenterOfGravity); } else { spResult = Superclass::doGetProperty(name); } assert(spResult.IsNotNull()); //any other property name should have been excluded by the calling function. return spResult; }; template < class TMovingImage, class TTargetImage, typename TUIDPolicy, class TInterpolatorPolicy, class TPyramideInitializationPolicy, class TMetricInitializationPolicy, class TOptimizerInitializationPolicy, class TTransformInitializationPolicy > void ITKInitializedMultiResImageRegistrationAlgorithm < TMovingImage, TTargetImage, TUIDPolicy, TInterpolatorPolicy, TPyramideInitializationPolicy, TMetricInitializationPolicy, TOptimizerInitializationPolicy, TTransformInitializationPolicy >:: doSetProperty(const MetaPropertyNameType& name, const MetaPropertyType* pProperty) { if (name == "PreinitTransform") { bool init; map::core::unwrapMetaProperty(pProperty, init); this->_preInitialize = init; } else if (name == "PreinitByCenterOfGravity") { bool init; map::core::unwrapMetaProperty(pProperty, init); this->_useCenterOfGravity = init; } else { Superclass::doSetProperty(name, pProperty); } }; template < class TMovingImage, class TTargetImage, typename TUIDPolicy, class TInterpolatorPolicy, class TPyramideInitializationPolicy, class TMetricInitializationPolicy, class TOptimizerInitializationPolicy, class TTransformInitializationPolicy > void ITKInitializedMultiResImageRegistrationAlgorithm < TMovingImage, TTargetImage, TUIDPolicy, TInterpolatorPolicy, TPyramideInitializationPolicy, TMetricInitializationPolicy, TOptimizerInitializationPolicy, TTransformInitializationPolicy >:: prepInitializeTransformation() { Superclass::prepInitializeTransformation(); if (this->_preInitialize) { this->InvokeEvent(::map::events::AlgorithmEvent(this, "Preinitialize transform.")); typedef ::itk::CenteredTransformInitializer InitializerType; typename InitializerType::Pointer spInitializer = InitializerType::New(); spInitializer->SetMovingImage(this->getInternalMovingImage()); spInitializer->SetFixedImage(this->getInternalTargetImage()); spInitializer->SetTransform(this->getConcreteTransformModel()); if (this->_useCenterOfGravity) { this->InvokeEvent(::map::events::AlgorithmEvent(this, "Preinitialize by moments.")); spInitializer->MomentsOn(); } else { this->InvokeEvent(::map::events::AlgorithmEvent(this, "Preinitialize by image geometry.")); spInitializer->GeometryOn(); } spInitializer->InitializeTransform(); } ::map::core::OStringStream os; os << "Preinitialized transform to: " << this->getConcreteTransformModel()->GetParameters(); //set the parameter of the transform model to the current transform parameters of the algorithm this->setCurrentTransformParameters(this->getConcreteTransformModel()->GetParameters()); this->getInternalRegistrationMethod().SetInitialTransformParameters(this->getConcreteTransformModel()->GetParameters()); this->InvokeEvent(::map::events::AlgorithmEvent(this, os.str())); }; - } - } -} + } // namespace boxed + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/boxed/mapITKTransMattesMIMultiResRegistrationAlgorithm.h b/Code/Algorithms/ITK/boxed/mapITKTransMattesMIMultiResRegistrationAlgorithm.h index 328d1ae..d27aaa2 100644 --- a/Code/Algorithms/ITK/boxed/mapITKTransMattesMIMultiResRegistrationAlgorithm.h +++ b/Code/Algorithms/ITK/boxed/mapITKTransMattesMIMultiResRegistrationAlgorithm.h @@ -1,123 +1,123 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_ITK_TRANS_MATTES_MI_MULTI_RES_REGISTRATION_ALGORITHM_H #define __MAP_ITK_TRANS_MATTES_MI_MULTI_RES_REGISTRATION_ALGORITHM_H #include "mapITKInitializedMultiResImageRegistrationAlgorithm.h" #include "mapITKRegularStepGradientDescentOptimizer.h" #include "mapITKMattesMutualInformationImageToImageMetric.h" #include "itkMatrixOffsetBasedTranslationTransform.h" #include "mapITKLinearInterpolateImageFunction.h" #include "mapFixedImageToImageMetricPolicy.h" #include "mapFixedInterpolatorPolicy.h" #include "mapFixedSVNLOptimizerPolicy.h" #include "mapFixedTransformPolicy.h" #include "mapSealedImagePyramidesPolicy.h" #include "mapNoComponentInitializationPolicy.h" namespace map { namespace algorithm { namespace boxed { mapGenerateAlgorithmUIDPolicyMacro(DefaultTransMattesMultiResRegistrationAlgorithmUIDPolicy, "de.dkfz.matchpoint", "TransMattesMIMultiResRegistrationAlgorithm.default", "1.0.0", ""); template < class TMovingImage, class TTargetImage = TMovingImage, typename TUIDPolicy = DefaultTransMattesMultiResRegistrationAlgorithmUIDPolicy, class TInterpolatorPolicy = SealedFixedInterpolatorPolicyMacro< ::itk::LinearInterpolateImageFunction >, class TPyramideInitializationPolicy = algorithm::itk::NoComponentInitializationPolicy > class ITKTransMattesMIMultiResRegistrationAlgorithm : public algorithm::boxed::ITKInitializedMultiResImageRegistrationAlgorithm < TMovingImage, TTargetImage, TUIDPolicy, TInterpolatorPolicy, SealedFixedImageToImageMetricPolicyMacro< ::itk::MattesMutualInformationImageToImageMetric >, SealedFixedSVNLOptimizerPolicyMacro< ::itk::RegularStepGradientDescentOptimizer>, SealedFixedTransformPolicyMacro< ::itk::MatrixOffsetBasedTranslationTransform >, SealedImagePyramidesPolicy< ::itk::MultiResolutionPyramidImageFilter, ::itk::MultiResolutionPyramidImageFilter, TPyramideInitializationPolicy > > { public: typedef ITKTransMattesMIMultiResRegistrationAlgorithm < TMovingImage, TTargetImage, TUIDPolicy, TInterpolatorPolicy, TPyramideInitializationPolicy > Self; typedef typename algorithm::boxed::ITKInitializedMultiResImageRegistrationAlgorithm < TMovingImage, TTargetImage, TUIDPolicy, TInterpolatorPolicy, SealedFixedImageToImageMetricPolicyMacro< ::itk::MattesMutualInformationImageToImageMetric >, SealedFixedSVNLOptimizerPolicyMacro< ::itk::RegularStepGradientDescentOptimizer >, SealedFixedTransformPolicyMacro< ::itk::MatrixOffsetBasedTranslationTransform >, SealedImagePyramidesPolicy< ::itk::MultiResolutionPyramidImageFilter, ::itk::MultiResolutionPyramidImageFilter, TPyramideInitializationPolicy > > Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(ITKTransMattesMIMultiResRegistrationAlgorithm, ITKMultiResImageRegistrationAlgorithm); mapNewAlgorithmMacro(Self); - typedef ::itk::Array ParametersType; + using ParametersType = ::itk::Array; - typedef typename Superclass::MetaPropertyType MetaPropertyType; - typedef typename Superclass::MetaPropertyPointer MetaPropertyPointer; - typedef typename Superclass::MetaPropertyNameType MetaPropertyNameType; - typedef typename Superclass::MetaPropertyVectorType MetaPropertyVectorType; + using MetaPropertyType = typename Superclass::MetaPropertyType; + using MetaPropertyPointer = typename Superclass::MetaPropertyPointer; + using MetaPropertyNameType = typename Superclass::MetaPropertyNameType; + using MetaPropertyVectorType = typename Superclass::MetaPropertyVectorType; protected: ITKTransMattesMIMultiResRegistrationAlgorithm(); virtual ~ITKTransMattesMIMultiResRegistrationAlgorithm(); virtual void configureAlgorithm(); virtual void compileInfos(MetaPropertyVectorType& infos) const; virtual MetaPropertyPointer doGetProperty(const MetaPropertyNameType& name) const; virtual void doSetProperty(const MetaPropertyNameType& name, const MetaPropertyType* pProperty); virtual void doInterLevelSetup(); private: ITKTransMattesMIMultiResRegistrationAlgorithm(const Self& source); //purposely not implemented void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace boxed + } // namespace algorithm +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapITKTransMattesMIMultiResRegistrationAlgorithm.tpp" #endif #endif diff --git a/Code/Algorithms/ITK/boxed/mapITKTransMattesMIMultiResRegistrationAlgorithm.tpp b/Code/Algorithms/ITK/boxed/mapITKTransMattesMIMultiResRegistrationAlgorithm.tpp index 55709c8..5944a21 100644 --- a/Code/Algorithms/ITK/boxed/mapITKTransMattesMIMultiResRegistrationAlgorithm.tpp +++ b/Code/Algorithms/ITK/boxed/mapITKTransMattesMIMultiResRegistrationAlgorithm.tpp @@ -1,323 +1,323 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_ITK_TRANS_MATTES_MI_MULTI_RES_REGISTRATION_ALGORITHM_TPP #define __MAP_ITK_TRANS_MATTES_MI_MULTI_RES_REGISTRATION_ALGORITHM_TPP #include "mapITKTransMattesMIMultiResRegistrationAlgorithm.h" #include "mapMetaProperty.h" #include "mapMetaPropertyAccessor.h" #include "itkCenteredTransformInitializer.h" -#include +#include namespace map { namespace algorithm { namespace boxed { template < class TMovingImage, class TTargetImage, typename TUIDPolicy, class TInterpolatorPolicy, class TPyramideInitializationPolicy > ITKTransMattesMIMultiResRegistrationAlgorithm < TMovingImage, TTargetImage, TUIDPolicy, TInterpolatorPolicy, TPyramideInitializationPolicy >:: ITKTransMattesMIMultiResRegistrationAlgorithm() { }; template < class TMovingImage, class TTargetImage, typename TUIDPolicy, class TInterpolatorPolicy, class TPyramideInitializationPolicy > ITKTransMattesMIMultiResRegistrationAlgorithm < TMovingImage, TTargetImage, TUIDPolicy, TInterpolatorPolicy, TPyramideInitializationPolicy >:: ~ITKTransMattesMIMultiResRegistrationAlgorithm() { }; template < class TMovingImage, class TTargetImage, typename TUIDPolicy, class TInterpolatorPolicy, class TPyramideInitializationPolicy > void ITKTransMattesMIMultiResRegistrationAlgorithm < TMovingImage, TTargetImage, TUIDPolicy, TInterpolatorPolicy, TPyramideInitializationPolicy >:: configureAlgorithm() { Superclass::configureAlgorithm(); this->setResolutionLevels(3); typename Superclass::ConcreteOptimizerType::ScalesType scales(TMovingImage::ImageDimension); scales.Fill(1.0); this->getConcreteTransformModel()->SetIdentity(); this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetScales(scales); this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetMaximumStepLength(4.00); this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetMinimumStepLength(0.01); this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetNumberOfIterations(200); this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetRelaxationFactor(0.5); this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetGradientMagnitudeTolerance(1e-4); this->getConcreteMetricControl()->getConcreteMetric()->SetNumberOfHistogramBins(20); this->getConcreteMetricControl()->getConcreteMetric()->SetNumberOfSpatialSamples(20000); this->getConcreteMetricControl()->getConcreteMetric()->ReinitializeSeed(); this->getConcreteMetricControl()->getConcreteMetric()->UseExplicitPDFDerivativesOn(); }; template < class TMovingImage, class TTargetImage, typename TUIDPolicy, class TInterpolatorPolicy, class TPyramideInitializationPolicy > void ITKTransMattesMIMultiResRegistrationAlgorithm < TMovingImage, TTargetImage, TUIDPolicy, TInterpolatorPolicy, TPyramideInitializationPolicy >:: compileInfos(MetaPropertyVectorType& infos) const { Superclass::compileInfos(infos); typedef typename Superclass::OptimizerBaseType::OptimizerBaseType::ScalesType ScalesType; typedef typename Superclass::TransformBaseType::ParametersType ParametersType; #ifndef MAP_SEAL_ALGORITHMS infos.push_back(map::algorithm::MetaPropertyInfo::New("TransformParameters", typeid(ParametersType), true, true)); infos.push_back(map::algorithm::MetaPropertyInfo::New("Scales", typeid(ScalesType), true, true)); infos.push_back(map::algorithm::MetaPropertyInfo::New("MaximumStepLength", typeid(double), true, true)); infos.push_back(map::algorithm::MetaPropertyInfo::New("MinimumStepLength", typeid(double), true, true)); infos.push_back(map::algorithm::MetaPropertyInfo::New("RelaxationFactor", typeid(double), true, true)); infos.push_back(map::algorithm::MetaPropertyInfo::New("NumberOfIterations", typeid(unsigned long), true, true)); infos.push_back(map::algorithm::MetaPropertyInfo::New("GradientMagnitudeTolerance", typeid(double), true, true)); infos.push_back(map::algorithm::MetaPropertyInfo::New("NumberOfHistogramBins", typeid(unsigned long), true, true)); infos.push_back(map::algorithm::MetaPropertyInfo::New("NumberOfSpatialSamples", typeid(unsigned long), true, true)); infos.push_back(map::algorithm::MetaPropertyInfo::New("UseAllPixels", typeid(bool), true, true)); infos.push_back(map::algorithm::MetaPropertyInfo::New("ResolutionLevels", typeid(typename Superclass::ResolutionLevelCountType), true, true)); #endif }; template < class TMovingImage, class TTargetImage, typename TUIDPolicy, class TInterpolatorPolicy, class TPyramideInitializationPolicy > typename ITKTransMattesMIMultiResRegistrationAlgorithm < TMovingImage, TTargetImage, TUIDPolicy, TInterpolatorPolicy, TPyramideInitializationPolicy >::MetaPropertyPointer ITKTransMattesMIMultiResRegistrationAlgorithm < TMovingImage, TTargetImage, TUIDPolicy, TInterpolatorPolicy, TPyramideInitializationPolicy >:: doGetProperty(const MetaPropertyNameType& name) const { MetaPropertyPointer spResult; typedef typename Superclass::OptimizerBaseType::OptimizerBaseType::ScalesType ScalesType; typedef typename Superclass::TransformBaseType::ParametersType ParametersType; if (name == "TransformParameters") { spResult = map::core::MetaProperty::New( this->getTransformInternal()->GetParameters()); } else if (name == "Scales") { spResult = map::core::MetaProperty::New(this->getConcreteITKOptimizer()->GetScales()); } else if (name == "MaximumStepLength") { spResult = map::core::MetaProperty::New( this->getConcreteITKOptimizer()->GetMaximumStepLength()); } else if (name == "MinimumStepLength") { spResult = map::core::MetaProperty::New( this->getConcreteITKOptimizer()->GetMinimumStepLength()); } else if (name == "RelaxationFactor") { spResult = map::core::MetaProperty::New( this->getConcreteITKOptimizer()->GetRelaxationFactor()); } else if (name == "NumberOfIterations") { spResult = map::core::MetaProperty::New( this->getConcreteITKOptimizer()->GetNumberOfIterations()); } else if (name == "GradientMagnitudeTolerance") { spResult = map::core::MetaProperty::New( this->getConcreteITKOptimizer()->GetGradientMagnitudeTolerance()); } else if (name == "NumberOfHistogramBins") { spResult = map::core::MetaProperty::New( this->getConcreteMetricControl()->getConcreteMetric()->GetNumberOfHistogramBins()); } else if (name == "NumberOfSpatialSamples") { spResult = map::core::MetaProperty::New( this->getConcreteMetricControl()->getConcreteMetric()->GetNumberOfFixedImageSamples()); } else if (name == "UseAllPixels") { spResult = map::core::MetaProperty::New( this->getConcreteMetricControl()->getConcreteMetric()->GetUseAllPixels()); } else if (name == "ResolutionLevels") { spResult = map::core::MetaProperty::New( this->getResolutionLevels()); } else { spResult = Superclass::doGetProperty(name); } return spResult; }; template < class TMovingImage, class TTargetImage, typename TUIDPolicy, class TInterpolatorPolicy, class TPyramideInitializationPolicy > void ITKTransMattesMIMultiResRegistrationAlgorithm < TMovingImage, TTargetImage, TUIDPolicy, TInterpolatorPolicy, TPyramideInitializationPolicy >:: doSetProperty(const MetaPropertyNameType& name, const MetaPropertyType* pProperty) { typedef typename Superclass::OptimizerBaseType::OptimizerBaseType::ScalesType ScalesType; typedef typename Superclass::TransformBaseType::ParametersType ParametersType; if (name == "TransformParameters") { ParametersType params; map::core::unwrapMetaProperty(pProperty, params); this->getTransformInternal()->SetParameters(params); } else if (name == "Scales") { ScalesType scales; map::core::unwrapMetaProperty(pProperty, scales); this->getConcreteITKOptimizer()->SetScales(scales); } else if (name == "MaximumStepLength") { double length; map::core::unwrapMetaProperty(pProperty, length); this->getConcreteITKOptimizer()->SetMaximumStepLength(length); } else if (name == "MinimumStepLength") { double length; map::core::unwrapMetaProperty(pProperty, length); this->getConcreteITKOptimizer()->SetMinimumStepLength(length); } else if (name == "RelaxationFactor") { double factor; map::core::unwrapMetaProperty(pProperty, factor); this->getConcreteITKOptimizer()->SetRelaxationFactor(factor); } else if (name == "NumberOfIterations") { unsigned long iterations; map::core::unwrapMetaProperty(pProperty, iterations); this->getConcreteITKOptimizer()->SetNumberOfIterations(iterations); } else if (name == "GradientMagnitudeTolerance") { double tolerance; map::core::unwrapMetaProperty(pProperty, tolerance); this->getConcreteITKOptimizer()->SetGradientMagnitudeTolerance(tolerance); } else if (name == "NumberOfHistogramBins") { unsigned long nr; map::core::unwrapMetaProperty(pProperty, nr); this->getConcreteMetricControl()->getConcreteMetric()->SetNumberOfHistogramBins(nr); } else if (name == "NumberOfSpatialSamples") { unsigned long nr; map::core::unwrapMetaProperty(pProperty, nr); this->getConcreteMetricControl()->getConcreteMetric()->SetNumberOfSpatialSamples(nr); } else if (name == "UseAllPixels") { bool useAll; map::core::unwrapMetaProperty(pProperty, useAll); this->getConcreteMetricControl()->getConcreteMetric()->SetUseAllPixels(useAll); } else if (name == "ResolutionLevels") { typename Superclass::ResolutionLevelCountType lvls; map::core::unwrapMetaProperty(pProperty, lvls); this->setResolutionLevels(lvls); } else { Superclass::doSetProperty(name, pProperty); } }; template < class TMovingImage, class TTargetImage, typename TUIDPolicy, class TInterpolatorPolicy, class TPyramideInitializationPolic > void ITKTransMattesMIMultiResRegistrationAlgorithm < TMovingImage, TTargetImage, TUIDPolicy, TInterpolatorPolicy, TPyramideInitializationPolic >:: doInterLevelSetup() { if (this->getCurrentLevel() > 0) { this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetMaximumStepLength( this->getConcreteOptimizerControl()->getConcreteOptimizer()->GetCurrentStepLength() * 2.0); this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetMinimumStepLength( this->getConcreteOptimizerControl()->getConcreteOptimizer()->GetMinimumStepLength() / 10.0); } }; - } - } -} + } // namespace boxed + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapArbitraryImageToImageMetricPolicy.h b/Code/Algorithms/ITK/include/mapArbitraryImageToImageMetricPolicy.h index d1d2194..f9d0780 100644 --- a/Code/Algorithms/ITK/include/mapArbitraryImageToImageMetricPolicy.h +++ b/Code/Algorithms/ITK/include/mapArbitraryImageToImageMetricPolicy.h @@ -1,138 +1,138 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ARBITRARY_IMAGE_TO_IMAGE_METRIC_POLICY_H #define __ARBITRARY_IMAGE_TO_IMAGE_METRIC_POLICY_H #include "mapITKImageToImageMetricSetterInterface.h" #include "mapITKImageToImageMetricGetterInterface.h" #include "mapITKImageToImageMetricControlInterface.h" #include "mapModificationTimeValidator.h" #include "itkCommand.h" namespace map { namespace algorithm { namespace itk { /*! @class ArbitraryImageToImageMetricPolicy @brief class for ArbitraryImageToImageMetricPolicy. This class is a ArbitraryImageToImageMetricPolicy. It is used if an ITKImageRegistrationAlgorithm should use an arbitrary metric that is to be set by the user (in contrary to FixedImageToImageMetricPolicy). @sa FixedImageToImageMetricPolicy @ingroup ITKPolicies */ template class ArbitraryImageToImageMetricPolicy : public facet::ITKImageToImageMetricSetterInterface, public facet::ITKImageToImageMetricGetterInterface { public: typedef ArbitraryImageToImageMetricPolicy Self; typedef facet::ITKImageToImageMetricSetterInterface Superclass; itkTypeMacroNoParent(ArbitraryImageToImageMetricPolicy); typedef ITKImageToImageMetricControlInterface MetricControlType; /*! gets the metric controll @eguarantee strong @param pMetric the metric instance */ virtual const MetricControlType* getMetricControl() const; virtual MetricControlType* getMetricControl(); /*! sets the metric @eguarantee strong @param pMetric the metric instance */ virtual void setMetricControl(MetricControlType* pMetric); /*! Returns the modification time of the policy (and its controlled component). * In this case the modification time is a pass through of the internal component. @eguarantee strong @return the modification time */ virtual unsigned long GetMTime() const; protected: ArbitraryImageToImageMetricPolicy(); ~ArbitraryImageToImageMetricPolicy(); /*! This is a command slot that can be used by any class derivering from this policy * to get informed if the component instances is changed. \n * Two events will be invoked with this command: \n * - UnregisterAlgorithmComponentEvent * - RegisterAlgorithmComponentEvent * . * The first one is used when the current metric is going to be replaced (by setMetricControl). The event data in this case * is a void pointer to the current (soon outdated) object. The second event will be called when the new metric was set * (by setMetricControl). In this case the event data is a pointer to the new metric.*/ ::itk::Command::Pointer _spOnChange; /*! gets the internal metric @eguarantee strong @return a pointer to a metric type */ virtual MetricControlType* getMetricInternal(); virtual const MetricControlType* getMetricInternal() const; /*! initializes the metric @eguarantee strong */ void prepareMetric(); /*! initializes the metric * after it was integrated in a controlling structur (e.g. registration algorithm) @eguarantee strong */ void prepareMetricAfterAssembly(); private: typename MetricControlType::Pointer _spMetric; /*! The time stamp is used to signal changes of the policy that may effect the controlling structur (e.g. registration algorithm) * because the controlled object has changed.*/ mutable core::ModificationTimeValidator _mTime; //No copy constructor allowed ArbitraryImageToImageMetricPolicy(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapArbitraryImageToImageMetricPolicy.tpp" #endif #endif diff --git a/Code/Algorithms/ITK/include/mapArbitraryImageToImageMetricPolicy.tpp b/Code/Algorithms/ITK/include/mapArbitraryImageToImageMetricPolicy.tpp index e9b4c0f..1c551f7 100644 --- a/Code/Algorithms/ITK/include/mapArbitraryImageToImageMetricPolicy.tpp +++ b/Code/Algorithms/ITK/include/mapArbitraryImageToImageMetricPolicy.tpp @@ -1,136 +1,136 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ARBITRARY_IMAGE_TO_IMAGE_METRIC_POLICY_TPP #define __ARBITRARY_IMAGE_TO_IMAGE_METRIC_POLICY_TPP #include "mapAlgorithmEvents.h" namespace map { namespace algorithm { namespace itk { template unsigned long ArbitraryImageToImageMetricPolicy:: GetMTime() const { unsigned long mt = _mTime.getMTime(); return mt; }; template void ArbitraryImageToImageMetricPolicy:: setMetricControl(MetricControlType* pMetric) { if (pMetric != _spMetric.GetPointer()) { //there is really the need to change if (this->_spOnChange.IsNotNull()) { ::map::events::UnregisterAlgorithmComponentEvent unRegEvent(_spMetric.GetPointer(), "Unregister current metric"); this->_spOnChange->Execute((::itk::Object*)NULL, unRegEvent); } _mTime.setWatchedObject(pMetric); _spMetric = pMetric; if (this->_spOnChange.IsNotNull()) { ::map::events::RegisterAlgorithmComponentEvent regEvent(_spMetric.GetPointer(), "Register new metric"); this->_spOnChange->Execute((::itk::Object*)NULL, regEvent); } } }; template ArbitraryImageToImageMetricPolicy:: ArbitraryImageToImageMetricPolicy() { }; template ArbitraryImageToImageMetricPolicy:: ~ArbitraryImageToImageMetricPolicy() { }; template typename ArbitraryImageToImageMetricPolicy::MetricControlType* ArbitraryImageToImageMetricPolicy:: getMetricInternal() { return _spMetric; }; template const typename ArbitraryImageToImageMetricPolicy::MetricControlType* ArbitraryImageToImageMetricPolicy:: getMetricInternal() const { return _spMetric; }; template typename ArbitraryImageToImageMetricPolicy::MetricControlType* ArbitraryImageToImageMetricPolicy:: getMetricControl() { return _spMetric; }; template const typename ArbitraryImageToImageMetricPolicy::MetricControlType* ArbitraryImageToImageMetricPolicy:: getMetricControl() const { return _spMetric; }; template void ArbitraryImageToImageMetricPolicy:: prepareMetric() { //default implementation does nothing; }; template void ArbitraryImageToImageMetricPolicy:: prepareMetricAfterAssembly() { //default implementation does nothing; }; - } + } // namespace itk } // end namespace algorithm } // end namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapArbitraryInterpolatorPolicy.h b/Code/Algorithms/ITK/include/mapArbitraryInterpolatorPolicy.h index ffac811..5001796 100644 --- a/Code/Algorithms/ITK/include/mapArbitraryInterpolatorPolicy.h +++ b/Code/Algorithms/ITK/include/mapArbitraryInterpolatorPolicy.h @@ -1,139 +1,139 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ARBITRARY_INTERPOLATOR_POLICY_H #define __ARBITRARY_INTERPOLATOR_POLICY_H #include "mapContinuous.h" #include "mapITKInterpolatorSetterInterface.h" #include "mapITKInterpolatorGetterInterface.h" #include "mapModificationTimeValidator.h" #include "itkCommand.h" namespace map { namespace algorithm { namespace itk { /*! @class ArbitraryInterpolatorPolicy @brief class for ArbitraryInterpolatorPolicy. This class is a ArbitraryInterpolatorPolicy. It is used if an ITKImageRegistrationAlgorithm should use an arbitrary interpolator that is to be set by the user (in contrary to FixedInterpolatorPolicy). @sa FixedInterpolatorPolicy @ingroup ITKPolicies */ template class ArbitraryInterpolatorPolicy : public facet::ITKInterpolatorSetterInterface, public facet::ITKInterpolatorGetterInterface { public: typedef ArbitraryInterpolatorPolicy Self; typedef facet::ITKInterpolatorSetterInterface Superclass; itkTypeMacroNoParent(ArbitraryInterpolatorPolicy); typedef ::itk::InterpolateImageFunction InterpolatorType; - typedef TCoordRep CoordRepType; + using CoordRepType = TCoordRep; /*! sets the interpolator @eguarantee strong @param pInterpolator the interpolator */ virtual void setInterpolator(InterpolatorType* pInterpolator); /*! gets the interpolator @eguarantee strong @return a pointer to the interpolator */ virtual InterpolatorType* getInterpolator(); virtual const InterpolatorType* getInterpolator() const; /*! Returns the modification time of the policy (and its controlled component). * In this case the modification time is a pass through of the internal component. @eguarantee strong @return the modification time */ virtual unsigned long GetMTime() const; protected: ArbitraryInterpolatorPolicy(); ~ArbitraryInterpolatorPolicy(); /*! This is a command slot that can be used by any class derivering from this policy * to get informed if the component instances is changed. \n * Two events will be invoked with this command: \n * - UnregisterAlgorithmComponentEvent * - RegisterAlgorithmComponentEvent * . * The first one is used when the current interpolator is going to be replaced (by setInterpolator). The event data in this case * is a void pointer to the current (soon outdated) object. The second event will be called when the new interpolator was set * (by setInterpolator). In this case the event data is a pointer to the new interpolator.*/ ::itk::Command::Pointer _spOnChange; /*! gets the internal interpolator @eguarantee strong @return a pointer to an interpolator type */ virtual InterpolatorType* getInterpolatorInternal(); virtual const InterpolatorType* getInterpolatorInternal() const; /*! initializes the interpolator @eguarantee strong */ void prepareInterpolator(); /*! initializes the interpolator * after it was integrated in a controlling structur (e.g. registration algorithm) @eguarantee strong */ void prepareInterpolatorAfterAssembly(); private: typename InterpolatorType::Pointer _spInterpolator; /*! The time stamp is used to signal changes of the policy that may effect the controlling structur (e.g. registration algorithm) * because the controlled object has changed.*/ mutable core::ModificationTimeValidator _mTime; //No copy constructor allowed ArbitraryInterpolatorPolicy(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapArbitraryInterpolatorPolicy.tpp" #endif #endif diff --git a/Code/Algorithms/ITK/include/mapArbitraryInterpolatorPolicy.tpp b/Code/Algorithms/ITK/include/mapArbitraryInterpolatorPolicy.tpp index fc294eb..f7dea71 100644 --- a/Code/Algorithms/ITK/include/mapArbitraryInterpolatorPolicy.tpp +++ b/Code/Algorithms/ITK/include/mapArbitraryInterpolatorPolicy.tpp @@ -1,137 +1,137 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapAlgorithmEvents.h" #ifndef __ARBITRARY_INTERPOLATOR_POLICY_TPP #define __ARBITRARY_INTERPOLATOR_POLICY_TPP namespace map { namespace algorithm { namespace itk { template unsigned long ArbitraryInterpolatorPolicy:: GetMTime() const { unsigned long mt = _mTime.getMTime(); return mt; }; template ArbitraryInterpolatorPolicy:: ArbitraryInterpolatorPolicy() { } template ArbitraryInterpolatorPolicy:: ~ArbitraryInterpolatorPolicy() { } template typename ArbitraryInterpolatorPolicy::InterpolatorType* ArbitraryInterpolatorPolicy:: getInterpolatorInternal() { return _spInterpolator; } template const typename ArbitraryInterpolatorPolicy::InterpolatorType* ArbitraryInterpolatorPolicy:: getInterpolatorInternal() const { return _spInterpolator; } template typename ArbitraryInterpolatorPolicy::InterpolatorType* ArbitraryInterpolatorPolicy:: getInterpolator() { return _spInterpolator; } template const typename ArbitraryInterpolatorPolicy::InterpolatorType* ArbitraryInterpolatorPolicy:: getInterpolator() const { return _spInterpolator; } template void ArbitraryInterpolatorPolicy:: setInterpolator(InterpolatorType* pInterpolator) { if (pInterpolator != _spInterpolator.GetPointer()) { //there is really the need to change if (this->_spOnChange.IsNotNull()) { ::map::events::UnregisterAlgorithmComponentEvent unRegEvent(_spInterpolator.GetPointer(), "Unregister current interpolator"); this->_spOnChange->Execute((::itk::Object*)NULL, unRegEvent); } _spInterpolator = pInterpolator; _mTime.setWatchedObject(pInterpolator); if (this->_spOnChange.IsNotNull()) { ::map::events::RegisterAlgorithmComponentEvent regEvent(_spInterpolator.GetPointer(), "Register new interpolator"); this->_spOnChange->Execute((::itk::Object*)NULL, regEvent); } } } template void ArbitraryInterpolatorPolicy:: prepareInterpolator() { //default implementation does nothing; } template void ArbitraryInterpolatorPolicy:: prepareInterpolatorAfterAssembly() { //default implementation does nothing; } - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapArbitraryMVNLOptimizerPolicy.h b/Code/Algorithms/ITK/include/mapArbitraryMVNLOptimizerPolicy.h index ea47f69..76d076a 100644 --- a/Code/Algorithms/ITK/include/mapArbitraryMVNLOptimizerPolicy.h +++ b/Code/Algorithms/ITK/include/mapArbitraryMVNLOptimizerPolicy.h @@ -1,145 +1,145 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ARBITRARY_MVNL_OPTIMIZER_POLICY_H #define __ARBITRARY_MVNL_OPTIMIZER_POLICY_H #include "itkCommand.h" #include "mapITKMVNLOptimizerSetterInterface.h" #include "mapITKMVNLOptimizerGetterInterface.h" #include "mapOptimizerGetterInterface.h" #include "mapModificationTimeValidator.h" #include "mapMAPAlgorithmsITKExports.h" #include namespace map { namespace algorithm { namespace itk { /*! @class ArbitraryMVNLOptimizerPolicy @brief class for ArbitraryMVNLOptimizerPolicy. This class is a ArbitraryMVNLOptimizerPolicy. It is used if an ITKImageRegistrationAlgorithm should use an arbitrary multiple valued non linear optimizer (based on itk::MultipleValueNonLinearOptimzer)that is to be set by the user (in contrary to FixedMVNLOptimizerPolicy). By default the policy will determin the right optimization direction. You can deactivate this feature by setting AutomaticOptimizationDirection to false. @sa FixedMVNLOptimizerPolicy @ingroup ITKPolicies */ class MAPAlgorithmsITK_EXPORT ArbitraryMVNLOptimizerPolicy: public facet::ITKMVNLOptimizerSetterInterface, public facet::ITKMVNLOptimizerGetterInterface, public facet::OptimizerGetterInterface { public: - typedef ArbitraryMVNLOptimizerPolicy Self; - typedef facet::ITKMVNLOptimizerSetterInterface Superclass; + using Self = ArbitraryMVNLOptimizerPolicy; + using Superclass = facet::ITKMVNLOptimizerSetterInterface; itkTypeMacroNoParent(ArbitraryMVNLOptimizerPolicy); - typedef facet::OptimizerGetterInterface::OptimizerControlType OptimizerControlType; - typedef Superclass::ITKOptimizerControlType ITKOptimizerControlType; + using OptimizerControlType = facet::OptimizerGetterInterface::OptimizerControlType; + using ITKOptimizerControlType = Superclass::ITKOptimizerControlType; /*! gets an optimizer control object @eguarantee strong @return a pointer to an ITKMVNLOptimizerControlInterface object */ - OptimizerControlType* getOptimizerControl(); - const OptimizerControlType* getOptimizerControl() const; + OptimizerControlType* getOptimizerControl() override; + const OptimizerControlType* getOptimizerControl() const override; - ITKOptimizerControlType* getITKOptimizerControl(); - const ITKOptimizerControlType* getITKOptimizerControl() const; + ITKOptimizerControlType* getITKOptimizerControl() override; + const ITKOptimizerControlType* getITKOptimizerControl() const override; - virtual void setITKOptimizerControl(ITKOptimizerControlType* pOptimizer); + void setITKOptimizerControl(ITKOptimizerControlType* pOptimizer) override; void setAutomaticOptimizationDirection(bool automatic); bool getAutomaticOptimizationDirection() const; /*! Returns the modification time of the policy (and its controlled component). * In this case the modification time is a pass through of the internal component. @eguarantee strong @return the modification time */ virtual unsigned long GetMTime() const; protected: ArbitraryMVNLOptimizerPolicy(); - virtual ~ArbitraryMVNLOptimizerPolicy(); + ~ArbitraryMVNLOptimizerPolicy() override; /*! This is a command slot that can be used by any class derivering from this policy * to get informed if the component instances is changed. \n * Two events will be invoked with this command: \n * - UnregisterAlgorithmComponentEvent * - RegisterAlgorithmComponentEvent * . * The first one is used when the current optimizer is going to be replaced (by setOptimizer). The event data in this case * is a void pointer to the current (soon outdated) object. The second event will be called when the new optimizer was set * (by setOptimizer). In this case the event data is a pointer to the new optimizer.*/ ::itk::Command::Pointer _spOnChange; /*! gets the internal optimizer @eguarantee no fail @return a pointer to an OptimizerControlType object */ virtual ITKOptimizerControlType* getOptimizerInternal(); virtual const ITKOptimizerControlType* getOptimizerInternal() const; /*! initializes the optimizer @eguarantee strong */ void prepareOptimizer(); /*! initializes the optimizer * after it was integrated in a controlling structur (e.g. registration algorithm) @eguarantee strong */ void prepareOptimizerAfterAssembly(bool minimizeToOptimize); private: ITKOptimizerControlType::Pointer _spOptimizerControl; /*! The time stamp validator is used to signal changes of the policy that may effect the controlling structur (e.g. registration algorithm) * because the controlled object has changed.*/ mutable core::ModificationTimeValidator _mTime; /*! Controlles if the policy sets the optimization automaticaly or * if its up to the user to specifiy the direction. Automatic direction * detaction will be performed by prepareOptimizerAfterAssembly().*/ - bool _automaticOptimizationDirection; + bool _automaticOptimizationDirection{true}; //No copy constructor allowed - ArbitraryMVNLOptimizerPolicy(const Self& source); - void operator=(const Self&); //purposely not implemented + ArbitraryMVNLOptimizerPolicy(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapArbitrarySVNLOptimizerPolicy.h b/Code/Algorithms/ITK/include/mapArbitrarySVNLOptimizerPolicy.h index 18141e1..d2fb269 100644 --- a/Code/Algorithms/ITK/include/mapArbitrarySVNLOptimizerPolicy.h +++ b/Code/Algorithms/ITK/include/mapArbitrarySVNLOptimizerPolicy.h @@ -1,150 +1,150 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ARBITRARY_SVNL_OPTIMIZER_POLICY_H #define __ARBITRARY_SVNL_OPTIMIZER_POLICY_H #include "itkCommand.h" #include "mapITKSVNLOptimizerSetterInterface.h" #include "mapITKSVNLOptimizerGetterInterface.h" #include "mapOptimizerGetterInterface.h" #include "mapModificationTimeValidator.h" #include "mapMAPAlgorithmsITKExports.h" #include namespace map { namespace algorithm { namespace itk { /*! @class ArbitrarySVNLOptimizerPolicy @brief class for ArbitrarySVNLOptimizerPolicy. This class is a ArbitrarySVNLOptimizerPolicy. It is used if an ITKImageRegistrationAlgorithm should use an arbitrary singel value non linear optimizer (based on itk::SingleValueNonLinearOptimzer)that is to be set by the user (in contrary to FixedSVNLOptimizerPolicy). By default the policy will determin the right optimization direction. You can deactivate this feature by setting AutomaticOptimizationDirection to false. @sa FixedSVNLOptimizerPolicy @ingroup ITKPolicies */ class MAPAlgorithmsITK_EXPORT ArbitrarySVNLOptimizerPolicy: public facet::ITKSVNLOptimizerSetterInterface, public facet::ITKSVNLOptimizerGetterInterface, public facet::OptimizerGetterInterface { public: - typedef ArbitrarySVNLOptimizerPolicy Self; - typedef facet::ITKSVNLOptimizerSetterInterface Superclass; + using Self = ArbitrarySVNLOptimizerPolicy; + using Superclass = facet::ITKSVNLOptimizerSetterInterface; itkTypeMacroNoParent(ArbitrarySVNLOptimizerPolicy); - typedef Superclass::ITKOptimizerControlType ITKOptimizerControlType; - typedef facet::OptimizerGetterInterface::OptimizerControlType OptimizerControlType; + using ITKOptimizerControlType = Superclass::ITKOptimizerControlType; + using OptimizerControlType = facet::OptimizerGetterInterface::OptimizerControlType; /*! gets an optimizer control object @eguarantee strong @return a pointer to an ITKSVNLOptimizerControlInterface object */ - ITKOptimizerControlType* getITKOptimizerControl(); - const ITKOptimizerControlType* getITKOptimizerControl() const; + ITKOptimizerControlType* getITKOptimizerControl() override; + const ITKOptimizerControlType* getITKOptimizerControl() const override; /*! gets an optimizer control object @eguarantee strong @return a pointer to an ITKSVNLOptimizerControlInterface object */ - OptimizerControlType* getOptimizerControl(); - const OptimizerControlType* getOptimizerControl() const; + OptimizerControlType* getOptimizerControl() override; + const OptimizerControlType* getOptimizerControl() const override; - virtual void setITKOptimizerControl(ITKOptimizerControlType* pOptimizer); + void setITKOptimizerControl(ITKOptimizerControlType* pOptimizer) override; void setAutomaticOptimizationDirection(bool automatic); bool getAutomaticOptimizationDirection() const; /*! Returns the modification time of the policy (and its controlled component). * In this case the modification time is a pass through of the internal component. @eguarantee strong @return the modification time */ virtual unsigned long GetMTime() const; protected: ArbitrarySVNLOptimizerPolicy(); - virtual ~ArbitrarySVNLOptimizerPolicy(); + ~ArbitrarySVNLOptimizerPolicy() override; /*! This is a command slot that can be used by any class derivering from this policy * to get informed if the component instances is changed. \n * Two events will be invoked with this command: \n * - UnregisterAlgorithmComponentEvent * - RegisterAlgorithmComponentEvent * . * The first one is used when the current optimizer is going to be replaced (by setOptimizer). The event data in this case * is a void pointer to the current (soon outdated) object. The second event will be called when the new optimizer was set * (by setOptimizer). In this case the event data is a pointer to the new optimizer.*/ ::itk::Command::Pointer _spOnChange; /*! gets the internal optimizer @eguarantee no fail @return a pointer to an ITKOptimizerControlType object */ virtual ITKOptimizerControlType* getOptimizerInternal(); virtual const ITKOptimizerControlType* getOptimizerInternal() const; /*! initializes the optimizer @eguarantee strong */ void prepareOptimizer(); /*! initializes the optimizer * after it was integrated in a controlling structur (e.g. registration algorithm) @eguarantee strong */ void prepareOptimizerAfterAssembly(bool minimizeToOptimize); private: ITKOptimizerControlType::Pointer _spOptimizerControl; /*! The time stamp validator is used to signal changes of the policy that may effect the controlling structur (e.g. registration algorithm) * because the controlled object has changed.*/ mutable core::ModificationTimeValidator _mTime; /*! Controlles if the policy sets the optimization automaticaly or * if its up to the user to specifiy the direction. Automatic direction * detaction will be performed by prepareOptimizerAfterAssembly().*/ - bool _automaticOptimizationDirection; + bool _automaticOptimizationDirection{true}; //No copy constructor allowed - ArbitrarySVNLOptimizerPolicy(const Self& source); - void operator=(const Self&); //purposely not implemented + ArbitrarySVNLOptimizerPolicy(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapArbitraryTransformPolicy.h b/Code/Algorithms/ITK/include/mapArbitraryTransformPolicy.h index ebc8754..9217fff 100644 --- a/Code/Algorithms/ITK/include/mapArbitraryTransformPolicy.h +++ b/Code/Algorithms/ITK/include/mapArbitraryTransformPolicy.h @@ -1,139 +1,139 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ARBITRARY_TRANSFORM_POLICY_H #define __ARBITRARY_TRANSFORM_POLICY_H #include "mapITKTransformSetterInterface.h" #include "mapITKTransformGetterInterface.h" #include "mapModificationTimeValidator.h" #include "itkCommand.h" namespace map { namespace algorithm { namespace itk { /*! @class ArbitraryTransformPolicy @brief class for ArbitraryTransformPolicy. This class is a ArbitraryTransformPolicy. It is used if an ITKImageRegistrationAlgorithm should use an arbitrary transform model that is to be set by the user (in contrary to FixedTransformPolicy). @sa FixedTransformPolicy @ingroup ITKPolicies */ template class ArbitraryTransformPolicy: public facet::ITKTransformSetterInterface, public facet::ITKTransformGetterInterface { public: typedef ArbitraryTransformPolicy Self; typedef facet::ITKTransformSetterInterface Superclass; itkTypeMacroNoParent(ArbitraryTransformPolicy); - typedef typename Superclass::TransformType TransformType; - typedef TScalar TransformScalarType; + using TransformType = typename Superclass::TransformType; + using TransformScalarType = TScalar; /*! sets the transfrom model @eguarantee strong @param pTransform the tranform model */ virtual void setTransformModel(TransformType* pTransform); /*! gets the transformation @eguarantee strong @return a pointer to the transform */ virtual TransformType* getTransformModel(); virtual const TransformType* getTransformModel() const; /*! Returns the modification time of the policy (and its controlled component). * In this case the modification time is a pass through of the internal component. @eguarantee strong @return the modification time */ virtual unsigned long GetMTime() const; protected: ArbitraryTransformPolicy(); ~ArbitraryTransformPolicy(); /*! This is a command slot that can be used by any class derivering from this policy * to get informed if the component instances is changed. \n * Two events will be invoked with this command: \n * - UnregisterAlgorithmComponentEvent * - RegisterAlgorithmComponentEvent * . * The first one is used when the current transform is going to be replaced (by setTransformModel). The event data in this case * is a void pointer to the current (soon outdated) object. The second event will be called when the new transform was set * (by setTransformModel). In this case the event data is a pointer to the new transform.*/ ::itk::Command::Pointer _spOnChange; /*! gets the internal transformation @eguarantee strong @return a pointer to a transform type */ virtual TransformType* getTransformInternal(); virtual const TransformType* getTransformInternal() const; /*! initializes the transform @eguarantee strong */ void prepareTransform(); /*! initializes the transform * after it was integrated in a controlling structur (e.g. registration algorithm) @eguarantee strong */ void prepareTransformAfterAssembly(); private: typename TransformType::Pointer _spTransformModel; /*! The time stamp is used to signal changes of the policy that may effect the controlling structur (e.g. registration algorithm) * because the controlled object has changed.*/ mutable core::ModificationTimeValidator _mTime; //No copy constructor allowed ArbitraryTransformPolicy(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapArbitraryTransformPolicy.tpp" #endif #endif diff --git a/Code/Algorithms/ITK/include/mapArbitraryTransformPolicy.tpp b/Code/Algorithms/ITK/include/mapArbitraryTransformPolicy.tpp index d84b456..b137355 100644 --- a/Code/Algorithms/ITK/include/mapArbitraryTransformPolicy.tpp +++ b/Code/Algorithms/ITK/include/mapArbitraryTransformPolicy.tpp @@ -1,139 +1,139 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ARBITRARY_TRANSFORM_POLICY_TPP #define __ARBITRARY_TRANSFORM_POLICY_TPP #include "mapAlgorithmEvents.h" namespace map { namespace algorithm { namespace itk { template unsigned long ArbitraryTransformPolicy:: GetMTime() const { unsigned long mt = _mTime.getMTime(); return mt; }; template void ArbitraryTransformPolicy:: setTransformModel(TransformType* pTransform) { if (pTransform != _spTransformModel.GetPointer()) { //there is really the need to change if (this->_spOnChange.IsNotNull()) { ::map::events::UnregisterAlgorithmComponentEvent unRegEvent(_spTransformModel.GetPointer(), "Unregister current transform model"); this->_spOnChange->Execute((::itk::Object*)NULL, unRegEvent); } _spTransformModel = pTransform; _mTime.setWatchedObject(pTransform); if (this->_spOnChange.IsNotNull()) { ::map::events::RegisterAlgorithmComponentEvent regEvent(_spTransformModel.GetPointer(), "Register new transform model"); this->_spOnChange->Execute((::itk::Object*)NULL, regEvent); } } }; template ArbitraryTransformPolicy:: ArbitraryTransformPolicy() { }; template ArbitraryTransformPolicy:: ~ArbitraryTransformPolicy() { }; template typename ArbitraryTransformPolicy::TransformType* ArbitraryTransformPolicy:: getTransformInternal() { return _spTransformModel; }; template const typename ArbitraryTransformPolicy::TransformType* ArbitraryTransformPolicy:: getTransformInternal() const { return _spTransformModel; }; template typename ArbitraryTransformPolicy::TransformType* ArbitraryTransformPolicy:: getTransformModel() { return _spTransformModel; }; template const typename ArbitraryTransformPolicy::TransformType* ArbitraryTransformPolicy:: getTransformModel() const { return _spTransformModel; }; template void ArbitraryTransformPolicy:: prepareTransform() { //default implementation does nothing; }; template void ArbitraryTransformPolicy:: prepareTransformAfterAssembly() { //default implementation does nothing; }; - } + } // namespace itk } // end namespace algorithm } // end namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapFixedImageToImageMetricPolicy.h b/Code/Algorithms/ITK/include/mapFixedImageToImageMetricPolicy.h index cb76819..d8dd6ed 100644 --- a/Code/Algorithms/ITK/include/mapFixedImageToImageMetricPolicy.h +++ b/Code/Algorithms/ITK/include/mapFixedImageToImageMetricPolicy.h @@ -1,99 +1,99 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __FIXED_IMAGE_TO_IMAGE_METRIC_POLICY_H #define __FIXED_IMAGE_TO_IMAGE_METRIC_POLICY_H #include "mapSealedImageToImageMetricPolicy.h" #include "mapITKImageToImageMetricGetterInterface.h" namespace map { namespace algorithm { namespace itk { /*! @class FixedImageToImageMetricPolicy @brief class for FixedImageToImageMetricPolicy. This class is a FixedImageToImageMetricPolicy. It is used if an ITKImageRegistrationAlgorithm should have one specific metric type and it is never to be changed. @sa SealedImageToImageMetricPolicy @sa ArbitraryImageToImageMetricPolicy @ingroup ITKPolicies */ template class FixedImageToImageMetricPolicy : public SealedImageToImageMetricPolicy, public facet::ITKImageToImageMetricGetterInterface < typename TConcreteMetric::MovingImageType, typename TConcreteMetric::FixedImageType > { public: - typedef FixedImageToImageMetricPolicy Self; - typedef SealedImageToImageMetricPolicy Superclass; + using Self = FixedImageToImageMetricPolicy; + using Superclass = SealedImageToImageMetricPolicy; - typedef typename Superclass::ConcreteMetricType ConcreteMetricType; - typedef typename Superclass::ConcreteMetricControlType ConcreteMetricControlType; - typedef typename Superclass::ConcreteMetricControlPointer ConcreteMetricControlPointer; - typedef typename Superclass::MetricControlType MetricControlType; + using ConcreteMetricType = typename Superclass::ConcreteMetricType; + using ConcreteMetricControlType = typename Superclass::ConcreteMetricControlType; + using ConcreteMetricControlPointer = typename Superclass::ConcreteMetricControlPointer; + using MetricControlType = typename Superclass::MetricControlType; /*! gets the metric controll @eguarantee strong @param pMetric the metric instance */ virtual const MetricControlType* getMetricControl() const; virtual MetricControlType* getMetricControl(); using Superclass::getConcreteMetricControl; protected: FixedImageToImageMetricPolicy(); ~FixedImageToImageMetricPolicy(); private: //No copy constructor allowed FixedImageToImageMetricPolicy(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #ifdef MAP_SEAL_ALGORITHMS #define SealedFixedImageToImageMetricPolicyMacro ::map::algorithm::itk::SealedImageToImageMetricPolicy #else #define SealedFixedImageToImageMetricPolicyMacro ::map::algorithm::itk::FixedImageToImageMetricPolicy #endif #ifndef MatchPoint_MANUAL_TPP #include "mapFixedImageToImageMetricPolicy.tpp" #endif #endif diff --git a/Code/Algorithms/ITK/include/mapFixedImageToImageMetricPolicy.tpp b/Code/Algorithms/ITK/include/mapFixedImageToImageMetricPolicy.tpp index 25d39ea..2d4b997 100644 --- a/Code/Algorithms/ITK/include/mapFixedImageToImageMetricPolicy.tpp +++ b/Code/Algorithms/ITK/include/mapFixedImageToImageMetricPolicy.tpp @@ -1,66 +1,66 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __FIXED_METRIC_POLICY_TPP #define __FIXED_METRIC_POLICY_TPP namespace map { namespace algorithm { namespace itk { template FixedImageToImageMetricPolicy:: FixedImageToImageMetricPolicy() { } template FixedImageToImageMetricPolicy:: ~FixedImageToImageMetricPolicy() { } template typename FixedImageToImageMetricPolicy::MetricControlType* FixedImageToImageMetricPolicy:: getMetricControl() { return Superclass::getConcreteMetricControl(); }; template const typename FixedImageToImageMetricPolicy::MetricControlType* FixedImageToImageMetricPolicy:: getMetricControl() const { return Superclass::getConcreteMetricControl(); }; - } + } // namespace itk } // end namespace algorithm } // end namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapFixedInterpolatorPolicy.h b/Code/Algorithms/ITK/include/mapFixedInterpolatorPolicy.h index 0fedfae..289aa2e 100644 --- a/Code/Algorithms/ITK/include/mapFixedInterpolatorPolicy.h +++ b/Code/Algorithms/ITK/include/mapFixedInterpolatorPolicy.h @@ -1,96 +1,96 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __FIXED_INTERPOLATOR_POLICY_H #define __FIXED_INTERPOLATOR_POLICY_H #include "mapSealedInterpolatorPolicy.h" #include "mapITKInterpolatorGetterInterface.h" namespace map { namespace algorithm { namespace itk { /*! @class FixedInterpolatorPolicy @brief class for FixedInterpolatorPolicy. This class is a FixedInterpolatorPolicy. It is used if an ITKImageRegistrationAlgorithm should have one specific interpolator type and it is never to be changed. @sa SealedInterpolatorPolicy @sa ArbitraryInterpolatorPolicy @ingroup ITKPolicies */ template class FixedInterpolatorPolicy : public SealedInterpolatorPolicy, public facet::ITKInterpolatorGetterInterface < typename TConcreteInterpolator::InputImageType, typename TConcreteInterpolator::CoordRepType > { public: - typedef FixedInterpolatorPolicy Self; - typedef SealedInterpolatorPolicy Superclass; + using Self = FixedInterpolatorPolicy; + using Superclass = SealedInterpolatorPolicy; - typedef typename Superclass::ConcreteInterpolatorType ConcreteInterpolatorType; - typedef typename Superclass::ConcreteInterpolatorPointer ConcreteInterpolatorPointer; - typedef typename Superclass::InterpolatorType InterpolatorType; - typedef typename Superclass::CoordRepType CoordRepType; + using ConcreteInterpolatorType = typename Superclass::ConcreteInterpolatorType; + using ConcreteInterpolatorPointer = typename Superclass::ConcreteInterpolatorPointer; + using InterpolatorType = typename Superclass::InterpolatorType; + using CoordRepType = typename Superclass::CoordRepType; using Superclass::getConcreteInterpolator; virtual const InterpolatorType* getInterpolator() const; virtual InterpolatorType* getInterpolator(); protected: FixedInterpolatorPolicy(); ~FixedInterpolatorPolicy(); private: //No copy constructor allowed FixedInterpolatorPolicy(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #ifdef MAP_SEAL_ALGORITHMS #define SealedFixedInterpolatorPolicyMacro ::map::algorithm::itk::SealedInterpolatorPolicy #else #define SealedFixedInterpolatorPolicyMacro ::map::algorithm::itk::FixedInterpolatorPolicy #endif #ifndef MatchPoint_MANUAL_TPP #include "mapFixedInterpolatorPolicy.tpp" #endif #endif diff --git a/Code/Algorithms/ITK/include/mapFixedInterpolatorPolicy.tpp b/Code/Algorithms/ITK/include/mapFixedInterpolatorPolicy.tpp index eb600cb..ab07331 100644 --- a/Code/Algorithms/ITK/include/mapFixedInterpolatorPolicy.tpp +++ b/Code/Algorithms/ITK/include/mapFixedInterpolatorPolicy.tpp @@ -1,68 +1,68 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __FIXED_INTERPOLATOR_POLICY_TPP #define __FIXED_INTERPOLATOR_POLICY_TPP namespace map { namespace algorithm { namespace itk { template const typename FixedInterpolatorPolicy::InterpolatorType* FixedInterpolatorPolicy:: getInterpolator() const { return Superclass::getConcreteInterpolator(); }; template typename FixedInterpolatorPolicy::InterpolatorType* FixedInterpolatorPolicy:: getInterpolator() { return Superclass::getConcreteInterpolator(); }; template FixedInterpolatorPolicy:: FixedInterpolatorPolicy() { }; template FixedInterpolatorPolicy:: ~FixedInterpolatorPolicy() { }; - } + } // namespace itk } // end namespace algorithm } // end namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapFixedSVNLOptimizerPolicy.h b/Code/Algorithms/ITK/include/mapFixedSVNLOptimizerPolicy.h index 38f8591..99295db 100644 --- a/Code/Algorithms/ITK/include/mapFixedSVNLOptimizerPolicy.h +++ b/Code/Algorithms/ITK/include/mapFixedSVNLOptimizerPolicy.h @@ -1,114 +1,114 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __FIXED_SVNL_OPTIMIZER_POLICY_H #define __FIXED_SVNL_OPTIMIZER_POLICY_H #include "mapSealedOptimizerPolicy.h" #include "mapITKSVNLOptimizerGetterInterface.h" #include "mapOptimizerGetterInterface.h" namespace map { namespace algorithm { namespace itk { /*! @class FixedSVNLOptimizerPolicy @brief class for FixedSVNLOptimizerPolicy. This class is a FixedSVNLOptimizerPolicy. It is used if an ITKImageRegistrationAlgorithm should have one specific optimizer type and this optimizer is never to be changed. @sa SealedSVNLOptimizerPolicy @sa ArbitrarySVNLOptimizerPolicy @ingroup ITKPolicies */ template class FixedSVNLOptimizerPolicy : public SealedOptimizerPolicy, public facet::ITKSVNLOptimizerGetterInterface, public facet::OptimizerGetterInterface { public: - typedef FixedSVNLOptimizerPolicy Self; - typedef SealedOptimizerPolicy Superclass; + using Self = FixedSVNLOptimizerPolicy; + using Superclass = SealedOptimizerPolicy; - typedef typename Superclass::ConcreteOptimizerType ConcreteOptimizerType; - typedef typename Superclass::ConcreteOptimizerPointer ConcreteOptimizerPointer; - typedef typename Superclass::ConcreteOptimizerControlType ConcreteOptimizerControlType; - typedef typename Superclass::ConcreteOptimizerControlPointer ConcreteOptimizerControlPointer; - typedef typename Superclass::OptimizerType OptimizerType; - typedef typename Superclass::InternalOptimizerControlType ITKOptimizerControlType; - typedef typename facet::OptimizerGetterInterface::OptimizerControlType OptimizerControlType; + using ConcreteOptimizerType = typename Superclass::ConcreteOptimizerType; + using ConcreteOptimizerPointer = typename Superclass::ConcreteOptimizerPointer; + using ConcreteOptimizerControlType = typename Superclass::ConcreteOptimizerControlType; + using ConcreteOptimizerControlPointer = typename Superclass::ConcreteOptimizerControlPointer; + using OptimizerType = typename Superclass::OptimizerType; + using ITKOptimizerControlType = typename Superclass::InternalOptimizerControlType; + using OptimizerControlType = typename facet::OptimizerGetterInterface::OptimizerControlType; /*! @brief gets the optimizer @eguarantee no fail @return pointer to an OptimizerControlType object */ - virtual ITKOptimizerControlType* getITKOptimizerControl(); + ITKOptimizerControlType* getITKOptimizerControl() override; /*! @brief gets the optimizer @eguarantee no fail @return pointer to an OptimizerControlType object */ - virtual const ITKOptimizerControlType* getITKOptimizerControl() const; + const ITKOptimizerControlType* getITKOptimizerControl() const override; /*! @brief gets the optimizer @eguarantee no fail @return pointer to an OptimizerControlType object */ - virtual OptimizerControlType* getOptimizerControl(); + OptimizerControlType* getOptimizerControl() override; /*! @brief gets the optimizer @eguarantee no fail @return pointer to an OptimizerControlType object */ - virtual const OptimizerControlType* getOptimizerControl() const; + const OptimizerControlType* getOptimizerControl() const override; using Superclass::getConcreteITKOptimizer; using Superclass::getConcreteOptimizerControl; protected: FixedSVNLOptimizerPolicy(); - ~FixedSVNLOptimizerPolicy(); + ~FixedSVNLOptimizerPolicy() override; private: //No copy constructor allowed FixedSVNLOptimizerPolicy(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #ifdef MAP_SEAL_ALGORITHMS #define SealedFixedSVNLOptimizerPolicyMacro ::map::algorithm::itk::SealedOptimizerPolicy #else #define SealedFixedSVNLOptimizerPolicyMacro ::map::algorithm::itk::FixedSVNLOptimizerPolicy #endif #ifndef MatchPoint_MANUAL_TPP #include "mapFixedSVNLOptimizerPolicy.tpp" #endif #endif diff --git a/Code/Algorithms/ITK/include/mapFixedTransformPolicy.h b/Code/Algorithms/ITK/include/mapFixedTransformPolicy.h index 5ee4ac4..56a7a9d 100644 --- a/Code/Algorithms/ITK/include/mapFixedTransformPolicy.h +++ b/Code/Algorithms/ITK/include/mapFixedTransformPolicy.h @@ -1,101 +1,101 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __FIXED_TRANSFORM_POLICY_H #define __FIXED_TRANSFORM_POLICY_H #include "mapSealedTransformPolicy.h" #include "mapITKTransformGetterInterface.h" namespace map { namespace algorithm { namespace itk { /*! @class FixedTransformPolicy @brief class for FixedTransformPolicy. This class is a FixedTransformPolicy. It is used if an ITKImageRegistrationAlgorithm should have one specific transform model type and it is never to be changed. @sa ArbitraryTransformPolicy @sa SealedTransformPolicy @ingroup ITKPolicies */ template class FixedTransformPolicy : public SealedTransformPolicy, public facet::ITKTransformGetterInterface < typename TConcreteITKTransform::ScalarType, TConcreteITKTransform::InputSpaceDimension, TConcreteITKTransform::OutputSpaceDimension > { public: - typedef FixedTransformPolicy Self; - typedef SealedTransformPolicy Superclass; + using Self = FixedTransformPolicy; + using Superclass = SealedTransformPolicy; - typedef typename Superclass::ConcreteTransformType ConcreteTransformType; - typedef typename Superclass::ConcreteTransformPointer ConcreteTransformPointer; - typedef typename Superclass::TransformType TransformType; - typedef typename Superclass::TransformScalarType TransformScalarType; + using ConcreteTransformType = typename Superclass::ConcreteTransformType; + using ConcreteTransformPointer = typename Superclass::ConcreteTransformPointer; + using TransformType = typename Superclass::TransformType; + using TransformScalarType = typename Superclass::TransformScalarType; /*! gets the transformation @eguarantee strong @return a pointer to the transform */ virtual TransformType* getTransformModel(); virtual const TransformType* getTransformModel() const; using Superclass::getConcreteTransformModel; protected: FixedTransformPolicy(); ~FixedTransformPolicy(); private: //No copy constructor allowed FixedTransformPolicy(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #ifdef MAP_SEAL_ALGORITHMS #define SealedFixedTransformPolicyMacro ::map::algorithm::itk::SealedTransformPolicy #else #define SealedFixedTransformPolicyMacro ::map::algorithm::itk::FixedTransformPolicy #endif #ifndef MatchPoint_MANUAL_TPP #include "mapFixedTransformPolicy.tpp" #endif #endif diff --git a/Code/Algorithms/ITK/include/mapITKAmoebaOptimizer.h b/Code/Algorithms/ITK/include/mapITKAmoebaOptimizer.h index 2cb9916..cad8c7e 100644 --- a/Code/Algorithms/ITK/include/mapITKAmoebaOptimizer.h +++ b/Code/Algorithms/ITK/include/mapITKAmoebaOptimizer.h @@ -1,170 +1,170 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_AMOEBA_OPTIMIZER_H #define __ITK_AMOEBA_OPTIMIZER_H #include "mapITKOptimizerControl.h" #include "mapITKSVNLOptimizerControlBase.h" #include "itkAmoebaOptimizer.h" namespace map { namespace algorithm { namespace itk { /*! This class is the template specialization for the itk::AmoebaOptimizer. @ingroup ITK @ingroup OptimizerControl */ template<> class ITKOptimizerControl< ::itk::AmoebaOptimizer> : public ITKSVNLOptimizerControlBase< ::itk::AmoebaOptimizer> { public: typedef ITKOptimizerControl< ::itk::AmoebaOptimizer> Self; typedef ITKSVNLOptimizerControlBase< ::itk::AmoebaOptimizer> Superclass; typedef ::itk::SmartPointer Pointer; typedef ::itk::SmartPointer ConstPointer; itkTypeMacro(ITKOptimizerControl, ITKSVNLOptimizerControlBase); itkNewMacro(Self); typedef Superclass::ConcreteOptimizerType ConcreteOptimizerType; typedef ConcreteOptimizerType::Pointer ConcreteOptimizerPointer; protected: virtual ~ITKOptimizerControl() {}; ITKOptimizerControl() {}; private: //No copy constructor allowed ITKOptimizerControl(const Self& source); void operator=(const Self&); //purposely not implemented public: virtual bool isStoppable() const { return false; }; virtual bool hasIterationCount() const { return false; }; virtual bool hasMaxIterationCount() const { return true; }; virtual bool canMinimize() const { return true; }; virtual bool canMaximize() const { return true; }; virtual bool getMinimize() const { return _spOptimizer->GetMinimize(); }; virtual bool getMaximize() const { return _spOptimizer->GetMaximize(); }; virtual void setMinimize(bool minimize) { _spOptimizer->SetMinimize(minimize); }; virtual void setMaximize(bool maximize) { _spOptimizer->SetMaximize(maximize); }; virtual bool hasCurrentValue() const { return true; }; protected: virtual bool doStop() { return false;/*optimizer cannot be stopped*/ }; virtual IterationCountType doGetCurrentIteration() const { return 0; /*optimizer cannot return*/ - };; + }; virtual IterationCountType doGetMaxIterations() const { return _spOptimizer->GetMaximumNumberOfIterations(); }; virtual SVNLMeasureType doGetCurrentMeasure() const { return _spOptimizer->GetCachedValue(); }; virtual void copyProperties(const ConcreteOptimizerType* source, ConcreteOptimizerType* destination) const { Superclass::copyProperties(source, destination); destination->SetMaximize(source->GetMaximize()); destination->SetMaximumNumberOfIterations(source->GetMaximumNumberOfIterations()); destination->SetAutomaticInitialSimplex(source->GetAutomaticInitialSimplex()); destination->SetOptimizeWithRestarts(source->GetOptimizeWithRestarts()); destination->SetInitialSimplexDelta(source->GetInitialSimplexDelta()); destination->SetParametersConvergenceTolerance(source->GetParametersConvergenceTolerance()); destination->SetFunctionConvergenceTolerance(source->GetFunctionConvergenceTolerance()); }; virtual Superclass::Pointer doCloneControl() const { Pointer spClone = Self::New(); Superclass::Pointer spResult = spClone.GetPointer(); return spResult; }; }; typedef ITKOptimizerControl< ::itk::AmoebaOptimizer> AmoebaOptimizerControl; } } } #endif diff --git a/Code/Algorithms/ITK/include/mapITKImageRegistrationAlgorithm.h b/Code/Algorithms/ITK/include/mapITKImageRegistrationAlgorithm.h index 72f704e..e586391 100644 --- a/Code/Algorithms/ITK/include/mapITKImageRegistrationAlgorithm.h +++ b/Code/Algorithms/ITK/include/mapITKImageRegistrationAlgorithm.h @@ -1,438 +1,436 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_ITK_IMAGE_REGISTRATION_ALGORITHM_H #define __MAP_ITK_IMAGE_REGISTRATION_ALGORITHM_H #include "mapContinuous.h" #include "mapClassMacros.h" #include "mapArbitraryTransformPolicy.h" #include "mapIterativeRegistrationAlgorithm.h" #include "mapImageRegistrationAlgorithmBase.h" #include "mapMetaPropertyAlgorithmBase.h" #include "mapMaskedRegistrationAlgorithmBase.h" #include "mapITKImageRegistrationAlgorithmInterface.h" #include "mapArbitraryInterpolatorPolicy.h" #include "mapArbitraryImageToImageMetricPolicy.h" #include "mapArbitrarySVNLOptimizerPolicy.h" #include "mapArbitraryTransformPolicy.h" #include "mapObserverSentinel.h" #include "mapModificationTimeValidator.h" #include "itkImageRegistrationMethod.h" #include "itkSimpleFastMutexLock.h" /*! @namespace map The namespace map is used throughout the MatchPoint project to mark code as components of this project */ namespace map { namespace algorithm { namespace itk { /*! @class ITKImageRegistrationAlgorithm @brief The class for an image registration algorithm based on ITK @ingroup Algorithms @ingroup ITK */ template < class TMovingImage, class TTargetImage, class TIdentificationPolicy, class TInterpolatorPolicy = ArbitraryInterpolatorPolicy, class TMetricPolicy = ArbitraryImageToImageMetricPolicy, class TOptimizerPolicy = ArbitrarySVNLOptimizerPolicy, class TTransformPolicy = ArbitraryTransformPolicy< ::map::core::continuous::ScalarType, TMovingImage::ImageDimension, TTargetImage::ImageDimension>, class TInternalRegistrationMethod = ::itk::ImageRegistrationMethod > class ITKImageRegistrationAlgorithm : public IterativeRegistrationAlgorithm, public ImageRegistrationAlgorithmBase, public MaskedRegistrationAlgorithmBase, public MetaPropertyAlgorithmBase, public ITKImageRegistrationAlgorithmInterface, public TIdentificationPolicy, public TInterpolatorPolicy, public TMetricPolicy, public TOptimizerPolicy, public TTransformPolicy { public: typedef ITKImageRegistrationAlgorithm < TMovingImage, TTargetImage, TIdentificationPolicy, TInterpolatorPolicy, TMetricPolicy, TOptimizerPolicy, TTransformPolicy, TInternalRegistrationMethod > Self; typedef IterativeRegistrationAlgorithm Superclass; typedef ITKImageRegistrationAlgorithmInterface ITKRegistrationType; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(ITKImageRegistrationAlgorithm, IterativeRegistrationAlgorithm); mapNewAlgorithmMacro(Self); - typedef typename Superclass::UIDType UIDType; - typedef typename Superclass::UIDPointer UIDPointer; + using UIDType = typename Superclass::UIDType; + using UIDPointer = typename Superclass::UIDPointer; - typedef TInterpolatorPolicy InterpolatorPolicyType; - typedef TMetricPolicy MetricPolicyType; - typedef TOptimizerPolicy OptimizerPolicyType; - typedef TTransformPolicy TransformPolicyType; - typedef TIdentificationPolicy IdentificationPolicyType; + using InterpolatorPolicyType = TInterpolatorPolicy; + using MetricPolicyType = TMetricPolicy; + using OptimizerPolicyType = TOptimizerPolicy; + using TransformPolicyType = TTransformPolicy; + using IdentificationPolicyType = TIdentificationPolicy; - typedef typename ITKRegistrationType::OptimizerBaseType OptimizerBaseType; - typedef typename ITKRegistrationType::MetricBaseType MetricBaseType; - typedef typename ITKRegistrationType::TransformBaseType TransformBaseType; - typedef typename ITKRegistrationType::InterpolatorBaseType InterpolatorBaseType; + using OptimizerBaseType = typename ITKRegistrationType::OptimizerBaseType; + using MetricBaseType = typename ITKRegistrationType::MetricBaseType; + using TransformBaseType = typename ITKRegistrationType::TransformBaseType; + using InterpolatorBaseType = typename ITKRegistrationType::InterpolatorBaseType; typedef typename IterativeRegistrationAlgorithm::OptimizerMeasureType OptimizerMeasureType; typedef ImageRegistrationAlgorithmBase ImageRegistrationAlgorithmBaseType; - typedef typename ImageRegistrationAlgorithmBaseType::TargetImageType TargetImageType; - typedef typename ImageRegistrationAlgorithmBaseType::MovingImageType MovingImageType; - typedef typename ImageRegistrationAlgorithmBaseType::MovingImageConstPointer - MovingImageConstPointer; - typedef typename ImageRegistrationAlgorithmBaseType::TargetImageConstPointer - TargetImageConstPointer; + using TargetImageType = typename ImageRegistrationAlgorithmBaseType::TargetImageType; + using MovingImageType = typename ImageRegistrationAlgorithmBaseType::MovingImageType; + using MovingImageConstPointer = typename ImageRegistrationAlgorithmBaseType::MovingImageConstPointer; + using TargetImageConstPointer = typename ImageRegistrationAlgorithmBaseType::TargetImageConstPointer; - typedef typename Superclass::MovingRepresentationDescriptorType MovingRepresentationDescriptorType; - typedef typename Superclass::TargetRepresentationDescriptorType TargetRepresentationDescriptorType; + using MovingRepresentationDescriptorType = typename Superclass::MovingRepresentationDescriptorType; + using TargetRepresentationDescriptorType = typename Superclass::TargetRepresentationDescriptorType; - typedef typename Superclass::RegistrationPointer RegistrationPointer; - typedef typename Superclass::RegistrationType RegistrationType; - typedef typename Superclass::FieldRepRequirement FieldRepRequirement; - typedef typename Superclass::IterationCountType IterationCountType; + using RegistrationPointer = typename Superclass::RegistrationPointer; + using RegistrationType = typename Superclass::RegistrationType; + using FieldRepRequirement = typename Superclass::FieldRepRequirement; + using IterationCountType = typename Superclass::IterationCountType; - typedef typename MetaPropertyAlgorithmBase::MetaPropertyPointer MetaPropertyPointer; - typedef typename MetaPropertyAlgorithmBase::MetaPropertyNameType MetaPropertyNameType; - typedef typename MetaPropertyAlgorithmBase::MetaPropertyVectorType MetaPropertyVectorType; + using MetaPropertyPointer = typename MetaPropertyAlgorithmBase::MetaPropertyPointer; + using MetaPropertyNameType = typename MetaPropertyAlgorithmBase::MetaPropertyNameType; + using MetaPropertyVectorType = typename MetaPropertyAlgorithmBase::MetaPropertyVectorType; // IterativeRegistrationAlgorithm /*! @eguarantee strong*/ virtual bool isStoppable() const; /*! has the algorithm an iteration count? @eguarantee no fail @return Indicates if the algorithm can determin its current iteration count */ virtual bool hasIterationCount() const; /*! has the algorithm an maximum iteration count? @eguarantee no fail @return Indicates if the algorithm can determin its maximum iteration count */ virtual bool hasMaxIterationCount() const; /*! This function indicates of the optimizer of the iterative registration algorithm is * able to return its current metric/optimizer value(s)? @eguarantee no fail @return Indicates if the algorithm can determin its curent value. */ virtual bool hasCurrentOptimizerValue() const; mapDefineAlgorithmIdentificationByPolicyMacro; virtual typename FieldRepRequirement::Type isMovingRepresentationRequired() const; virtual typename FieldRepRequirement::Type isTargetRepresentationRequired() const; virtual bool isReusable() const; mapSetMacro(CropInputImagesByMask, bool); mapGetMacro(CropInputImagesByMask, bool); protected: ITKImageRegistrationAlgorithm(); - virtual ~ITKImageRegistrationAlgorithm(); + ~ITKImageRegistrationAlgorithm() override; - typedef TInternalRegistrationMethod InternalRegistrationMethodType; - typedef typename Superclass::InterimRegistrationType InterimRegistrationType; - typedef typename Superclass::InterimRegistrationPointer InterimRegistrationPointer; + using InternalRegistrationMethodType = TInternalRegistrationMethod; + using InterimRegistrationType = typename Superclass::InterimRegistrationType; + using InterimRegistrationPointer = typename Superclass::InterimRegistrationPointer; /*! @overwrite * This default implementation does nothing.*/ virtual void configureAlgorithm(); // MetaPropertyAlgorithmBase /*! @reimplemented*/ - virtual void compileInfos(MetaPropertyVectorType& infos) const; + void compileInfos(MetaPropertyVectorType& infos) const override; /*! @reimplemented*/ - virtual MetaPropertyPointer doGetProperty(const MetaPropertyNameType& name) const; + MetaPropertyPointer doGetProperty(const MetaPropertyNameType& name) const override; /*! @reimplemented*/ - virtual void doSetProperty(const MetaPropertyNameType& name, const MetaPropertyType* pProperty); + void doSetProperty(const MetaPropertyNameType& name, const MetaPropertyType* pProperty) override; // IterativeRegistrationAlgorithmInterface /*! @brief gets the registration result that has been computed in the last iteration. This result is limited by a region @pre pMovingRepresentation and pTargetRepresentation must not be null. @param [in] pMovingRepresentation Pointer to @eguarantee strong @return the interim registration result as smart pointer @retval a Registration object @sa Registration */ virtual InterimRegistrationPointer determineInterimRegistration(const MovingRepresentationDescriptorType* pMovingRepresentation, const TargetRepresentationDescriptorType* pTargetRepresentation) const; /*! * Returns the final registration @eguarantee strong */ virtual RegistrationPointer doGetRegistration() const; /*! Returns if the registration should be computed. The registration is outdated if doGetRegistration returns null * or the modification times of at least one policy is newer then the modification time of the registration. @eguarantee strong @return true if the registration should be (re)computed. False if the registration is uptodate. */ virtual bool registrationIsOutdated() const; virtual bool doStopAlgorithm(); /*! This method should do all preparation tasks right before the algorithms execution. At the and of this method * the algorithm should be set up and ready to use.\n * The method delegates the main work of initialization to several sub methods. This sub methods serves as slots * that can be rewritten by a algorithm developer to alter certain aspects and keep the rest untouched.\n * The sequence of slot calls is: \n * - prepCheckValidity * - prepPrepareSubComponents * - prepAssembleSubComponents * - prepPerpareInternalInputData * - prepSetInternalInputData * - prepInitializeTransformation * - prepFinalizePreparation * @remark If you want to change the execution style, then overwrite runAlgorithm(). @remark If you want to alter settings of optimzer, metric or interpolator depending on the resolution level use the method doInterLevelSetup() @remark configureAlgorithmByMetaProperties is called after preCheckValidity and before prepPerpareSubComponent. @eguarantee strong */ virtual void prepareAlgorithm(); /*! This method is the slot to check if all internal components and input data are properly set. * @remark The default implementation checks transform, interpolator, optimizer, metric, pyramides, moving and target image. * overload this method to alter the validity check. * @remark It is assumed that the implementation of this method throws an exception if the algorithm is not be configured * correctly.*/ virtual void prepCheckValidity(); /*! This method is the slot where sub components can be configured before(!) they are set to the * internal registration method. * @remark The default implementation just calls the preparation methods of the component policies.*/ virtual void prepPrepareSubComponents(); /*! This method is the slot where sub components are set to the internal registration method. * @remark The default implementation just calls the preparation methods of the component policies.*/ virtual void prepAssembleSubComponents(); /*! This method is the slot for internal preprocessing of input data. This method should * be reimplemented if you want to prepare the input data before they go into the internal * registration method. E.g. blurring or normalizing the moving and target image before registration. * @remark The default implementation does nothing. Thus the public input data will be the data used by the * internal algorithm. * @remark Implementations of this method should work with getInternalTargetImage()/getInternalMovingImage() and * set there results via setInternalTargetImage()/setInternalMovingImage() to allow the correct handling. @eguarantee strong */ virtual void prepPerpareInternalInputData(); /*! This method is the slot for passing relevant input data to the internal algorithm or its components. * @remark The default implementation passes getInternalTargetImage and getInternalMovingImage, sets the schedules, the fixed image region of the registration and the metric masks. * @remark If you need to access the images use getInternalTargetImage()/getInternalMovingImage(). @eguarantee strong */ virtual void prepSetInternalInputData(); /*! This method is a slot that is used for the initialization of the transformation model used * by the internal registration algorithm. * @remark By default it just sets the initial transformation parameter for the internal registration methods to the current values of the transform. * @remark If you need to access the images use getInternalTargetImage()/getInternalMovingImage(). @eguarantee strong */ virtual void prepInitializeTransformation(); /*! This method is the slot for final steps in the preparation process * @remark The default implementation calls the prepareAfterAssembly methods of the sub component policies. * @remark If you need to access the images use getInternalTargetImage()/getInternalMovingImage(). @eguarantee strong */ virtual void prepFinalizePreparation(); /*! This method should just execute the iteration loop. * @remark If you want to change the initialization or the finalization, then overwrite prepareAlgorithm() or finalizeAlgorithm(). * @return Indicates of the registration was successfully determined (e.g. could be * false if an iterative algorithm was stopped prematurely by the user). * @eguarantee strong */ virtual bool runAlgorithm(); /*! This method should do all the finalization work (e.g. generating the registration based on the iteration results). * @remark If you want to change the initialization or the iteration, then overwrite prepareAlgorithm() or runAlgorithm(). @eguarantee strong */ virtual void finalizeAlgorithm(); - typedef typename TransformPolicyType::TransformType::ParametersType TransformParametersType; + using TransformParametersType = typename TransformPolicyType::TransformType::ParametersType; /*! Gets the member variable _currentTransformParameters secured via _currentIterationLock. @return Copy of the current transform parameters. */ TransformParametersType getCurrentTransformParameters() const; /*! Sets the member variable _currentTransformParameters secured via _currentIterationLock. @param [in] Reference to the new current parameters. */ void setCurrentTransformParameters(const TransformParametersType& param); /*! return the optimizer value(s) of the current iteration step. Will be called by getCurrentOptimizerValue() if hasCurrentValue() returns true. @eguarantee strong @return current measure */ virtual OptimizerMeasureType doGetCurrentOptimizerValue() const; /*! Methods invoked by derivated classes. */ virtual void PrintSelf(std::ostream& os, ::itk::Indent indent) const; /*! @eguarantee strong*/ virtual IterationCountType doGetCurrentIteration() const; /*! @brief gets the maximum number of the algorithm's iterations @eguarantee strong @return returns the algorithm's maximum iterations count */ virtual IterationCountType doGetMaxIterations() const; /*! Offers access to the internal registration method */ InternalRegistrationMethodType& getInternalRegistrationMethod(); /*! The count if the iterations, since starting the registration algorithm the last time. * 0 indicates that no iteration has been processed yet.*/ IterationCountType _currentIterationCount; /*! The lock is used to manage the access to the member variable _currentIterationCount.*/ mutable ::itk::SimpleFastMutexLock _currentIterationLock; /*! The current parameters of the registration transform. Will be set in every iteration step*/ TransformParametersType _currentTransformParameters; /*! The parameters of the registration transform of the last successfull registration determiniation. Will be set by finalizeAlgorithm()*/ TransformParametersType _finalizedTransformParameters; /*! Smartpointer to the finalized registration. Will be set by finalizeAlgorithm()*/ typename RegistrationType::Pointer _spFinalizedRegistration; /*! Method returns pointer to the moving image used by the algorithm internally. This is used to allow the algorithm * or its derived classes to modify the moving image with out changing the public moving image pointer. * It returns _spMovingImage if setInternalMovingImage was never called (thus no special internal image was defined). * Otherwise it will return _spInternalMovingImage. * (e.g.: An algorithm always normalizes an image before registration. Then the algorithm can use the prepPerpareInternalInputData() * function to manipulate the internal moving image before it is used by prepareAlgorithm() to set the internal algorithm)*/ MovingImageConstPointer getInternalMovingImage() const; /*! Method returns pointer to the target image used by the algorithm internally. This is used to allow the algorithm * or its derived classes to modify the target image with out changing the public target image pointer. * It returns _spTargetImage if setInternalTargetImage was never called (thus no special internal image was defined). * Otherwise it will return _spInternalTargetImage. * (e.g.: An algorithm always normalizes an image before registration. Then the algorithm can use the prepPerpareInternalInputData() * function to manipulate the internal target image before it is used by prepareAlgorithm() to set the internal algorithm)*/ TargetImageConstPointer getInternalTargetImage() const; /*!Method sets _spInternalMovingImage to the passed image and therefore overrides the target which is internally used by the algorithm.*/ void setInternalMovingImage(MovingImageType* image); /*!Method sets _spInternalTargetImage to the passed image and therefore overrides the target which is internally used by the algorithm.*/ void setInternalTargetImage(TargetImageType* image); private: typename InternalRegistrationMethodType::Pointer _internalRegistrationMethod; /*!Pointer to the moving image used by the algorithm internally if it was changed by setInternalMovingImage(). * This is used to allow the algorithm or its derived classes to modify the moving image with out changing the public moving image pointer. * (e.g.: An algorithm always normalizes an image before registration. Then the algorithm can use the prepPerpareInternalInputData() * function to manipulate _spInternalMovingImage before it is used by prepareAlgorithm() to set the internal algorithm)*/ typename MovingImageType::Pointer _spInternalMovingImage; /*!Pointer to the target image used by the algorithm internally if it was changed by setInternalTargetImage(). * This is used to allow the algorithm or its derived classes to modify the target image with out changing the public target image pointer. * (e.g.: An algorithm always normalizes an image before registration. Then the algorithm can use the prepPerpareInternalInputData() * function to manipulate _spInternalTargetImage before it is used by prepareAlgorithm() to set the internal algorithm)*/ typename TargetImageType::Pointer _spInternalTargetImage; bool _CropInputImagesByMask; mutable core::ObserverSentinel::Pointer _onIterationObserver; mutable core::ObserverSentinel::Pointer _onGeneralOptimizerObserver; mutable core::ObserverSentinel::Pointer _onGeneralMetricObserver; mutable core::ObserverSentinel::Pointer _onGeneralInterpolatorObserver; mutable core::ObserverSentinel::Pointer _onGeneralTransformObserver; /*! This member function is called by the observer of the optimizer, when ever a IterationEvent is invoked.*/ void onIterationEvent(::itk::Object* caller, const ::itk::EventObject& eventObject); /*! This member function is called by the observer of the optimizer for all kind of events. It serves as a pass through.*/ void onGeneralOptimizerEvent(::itk::Object* caller, const ::itk::EventObject& eventObject); /*! This member function is called by the observer of the metric for all kind of events. It serves as a pass through.*/ void onGeneralMetricEvent(::itk::Object* caller, const ::itk::EventObject& eventObject); /*! This member function is called by the observer of the interpolator for all kind of events. It serves as a pass through.*/ void onGeneralInterpolatorEvent(::itk::Object* caller, const ::itk::EventObject& eventObject); /*! This member function is called by the observer of the transform for all kind of events. It serves as a pass through.*/ void onGeneralTransformEvent(::itk::Object* caller, const ::itk::EventObject& eventObject); /*! This member function is called by the observer of the transform for all kind of events. It serves as a pass through.*/ void onGeneralRegistrationMethodEvent(::itk::Object* caller, const ::itk::EventObject& eventObject); /*! This member function is called by the optimizer policy if the optimizer instance changes.*/ void onOptimizerChange(const ::itk::EventObject& eventObject); /*! This member function is called by the metric policy if the metric instance changes.*/ void onMetricChange(const ::itk::EventObject& eventObject); /*! This member function is called by the interpolator policy if the interpolator instance changes.*/ void onInterpolatorChange(const ::itk::EventObject& eventObject); /*! This member function is called by the transform policy if the transform model instance changes.*/ void onTransformChange(const ::itk::EventObject& eventObject); ITKImageRegistrationAlgorithm(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapITKImageRegistrationAlgorithm.tpp" #endif #endif diff --git a/Code/Algorithms/ITK/include/mapITKImageRegistrationAlgorithmInterface.h b/Code/Algorithms/ITK/include/mapITKImageRegistrationAlgorithmInterface.h index 3c13be5..8663b5d 100644 --- a/Code/Algorithms/ITK/include/mapITKImageRegistrationAlgorithmInterface.h +++ b/Code/Algorithms/ITK/include/mapITKImageRegistrationAlgorithmInterface.h @@ -1,105 +1,105 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_IMAGE_REGISTRATION_ALGORITHM_INTERFACE_H #define __ITK_IMAGE_REGISTRATION_ALGORITHM_INTERFACE_H #include #include #include "mapITKSVNLOptimizerControlInterface.h" #include "mapITKImageToImageMetricControlInterface.h" #include "mapITKSVNLOptimizerSetterInterface.h" #include "mapITKSVNLOptimizerGetterInterface.h" #include "mapITKTransformSetterInterface.h" #include "mapITKTransformGetterInterface.h" #include "mapITKInterpolatorSetterInterface.h" #include "mapITKInterpolatorGetterInterface.h" #include "mapITKImageToImageMetricSetterInterface.h" #include "mapITKImageToImageMetricGetterInterface.h" /*! @namespace map The namespace map is used throughout the MatchPoint project to mark code as components of this project */ namespace map { namespace algorithm { namespace itk { /*! @class ITKImageRegistrationAlgorithmInterface @brief This is the interface for image registration algorithms from ITK @ingroup AlgorithmFacets */ template class ITKImageRegistrationAlgorithmInterface { public: typedef ITKImageRegistrationAlgorithmInterface Self; - typedef ITKSVNLOptimizerControlInterface OptimizerBaseType; + using OptimizerBaseType = ITKSVNLOptimizerControlInterface; typedef ITKImageToImageMetricControlInterface MetricBaseType; typedef ::itk::Transform TransformBaseType; typedef ::itk::InterpolateImageFunction InterpolatorBaseType; - typedef facet::ITKSVNLOptimizerSetterInterface OptimizerSetterInterfaceType; - typedef facet::ITKSVNLOptimizerGetterInterface OptimizerGetterInterfaceType; + using OptimizerSetterInterfaceType = facet::ITKSVNLOptimizerSetterInterface; + using OptimizerGetterInterfaceType = facet::ITKSVNLOptimizerGetterInterface; typedef facet::ITKTransformSetterInterface TransformSetterInterfaceType; typedef facet::ITKTransformGetterInterface TransformGetterInterfaceType; typedef facet::ITKInterpolatorSetterInterface InterpolatorSetterInterfaceType; typedef facet::ITKInterpolatorGetterInterface InterpolatorGetterInterfaceType; typedef facet::ITKImageToImageMetricSetterInterface MetricSetterInterfaceType; typedef facet::ITKImageToImageMetricGetterInterface MetricGetterInterfaceType; protected: ITKImageRegistrationAlgorithmInterface(); virtual ~ITKImageRegistrationAlgorithmInterface(); private: //No copy constructor allowed ITKImageRegistrationAlgorithmInterface(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapITKImageRegistrationAlgorithmInterface.tpp" #endif #endif diff --git a/Code/Algorithms/ITK/include/mapITKImageRegistrationAlgorithmInterface.tpp b/Code/Algorithms/ITK/include/mapITKImageRegistrationAlgorithmInterface.tpp index 716473c..fbc13c8 100644 --- a/Code/Algorithms/ITK/include/mapITKImageRegistrationAlgorithmInterface.tpp +++ b/Code/Algorithms/ITK/include/mapITKImageRegistrationAlgorithmInterface.tpp @@ -1,52 +1,52 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_IMAGE_REGISTRATION_ALGORITHM_INTERFACE_TPP #define __ITK_IMAGE_REGISTRATION_ALGORITHM_INTERFACE_TPP namespace map { namespace algorithm { namespace itk { // **** protected methods **** // *************************** template ITKImageRegistrationAlgorithmInterface:: ITKImageRegistrationAlgorithmInterface() { }; template ITKImageRegistrationAlgorithmInterface:: ~ITKImageRegistrationAlgorithmInterface() { }; - } + } // namespace itk } // end namespace algorithm } // end namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapITKImageToImageMetricControlBase.h b/Code/Algorithms/ITK/include/mapITKImageToImageMetricControlBase.h index 400cada..67e8986 100644 --- a/Code/Algorithms/ITK/include/mapITKImageToImageMetricControlBase.h +++ b/Code/Algorithms/ITK/include/mapITKImageToImageMetricControlBase.h @@ -1,111 +1,111 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_IMAGE_TO_IMAGE_METRIC_CONTROL_BASE_H #define __ITK_IMAGE_TO_IMAGE_METRIC_CONTROL_BASE_H #include "mapITKImageToImageMetricControlInterface.h" namespace map { namespace algorithm { namespace itk { /*! @class ITKImageToImageMetricControlBase This class serves as base class for all template specialization of itk::ImageToImageMetrics. It realizes some basic metric handling, to reduce the code in the control classes @remark ITKImageToImageMetricControlBase instantiates a concrete metric when constructed. You can set a new one, but ITKImageToImageMetricControlBase has always an optimizer under control. @template TConcreteMetric type of the concrete metric controlled by the class @ingroup ITK @ingroup MetricControl */ template class ITKImageToImageMetricControlBase : public ITKImageToImageMetricControlInterface { public: - typedef ITKImageToImageMetricControlBase Self; + using Self = ITKImageToImageMetricControlBase; typedef ITKImageToImageMetricControlInterface Superclass; - typedef typename TConcreteMetric::MovingImageType MovingImageType; - typedef typename TConcreteMetric::FixedImageType TargetImageType; + using MovingImageType = typename TConcreteMetric::MovingImageType; + using TargetImageType = typename TConcreteMetric::FixedImageType; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(ITKImageToImageMetricControlBase, ITKImageToImageMetricControlInterface); - typedef TConcreteMetric ConcreteMetricType; - typedef typename ConcreteMetricType::Pointer ConcreteMetricPointer; - typedef typename Superclass::MetricBaseType MetricBaseType; - typedef typename Superclass::SVMetricBaseType SVMetricBaseType; - typedef typename Superclass::ImageToImageMetricBaseType ImageToImageMetricBaseType; + using ConcreteMetricType = TConcreteMetric; + using ConcreteMetricPointer = typename ConcreteMetricType::Pointer; + using MetricBaseType = typename Superclass::MetricBaseType; + using SVMetricBaseType = typename Superclass::SVMetricBaseType; + using ImageToImageMetricBaseType = typename Superclass::ImageToImageMetricBaseType; /*! setter for the optimizer @eguarantee no fail @param pMetric the ConcreteMetricType object that has to be set. Must not be NULL (otherwise an exception will be thrown). */ virtual void setMetric(ConcreteMetricType* pMetric); virtual MetricBaseType* getMetric(); virtual const MetricBaseType* getMetric() const; virtual SVMetricBaseType* getSVMetric(); virtual const SVMetricBaseType* getSVMetric() const; virtual ImageToImageMetricBaseType* getImageToImageMetric(); virtual const ImageToImageMetricBaseType* getImageToImageMetric() const; virtual ConcreteMetricType* getConcreteMetric(); virtual const ConcreteMetricType* getConcreteMetric() const; /*! The modification time (MT) of an metric controler is the the maximum of his MT * and the MT of the controlled metric. */ virtual unsigned long GetMTime() const; protected: virtual ~ITKImageToImageMetricControlBase(); ITKImageToImageMetricControlBase(); ConcreteMetricPointer _spMetric; private: //No copy constructor allowed ITKImageToImageMetricControlBase(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapITKImageToImageMetricControlBase.tpp" #endif #endif diff --git a/Code/Algorithms/ITK/include/mapITKImageToImageMetricControlInterface.h b/Code/Algorithms/ITK/include/mapITKImageToImageMetricControlInterface.h index a50591d..7db2913 100644 --- a/Code/Algorithms/ITK/include/mapITKImageToImageMetricControlInterface.h +++ b/Code/Algorithms/ITK/include/mapITKImageToImageMetricControlInterface.h @@ -1,75 +1,75 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_IMAGE_TO_IMAGE_METRIC_CONTROL_INTERFACE_H #define __ITK_IMAGE_TO_IMAGE_METRIC_CONTROL_INTERFACE_H #include "mapITKSVMetricControlInterface.h" #include "itkImageToImageMetric.h" namespace map { namespace algorithm { namespace itk { /*! @class ITKImageToImageMetricControlInterface @brief Interface for controller classes that form a virtual wrapper around itk::SingleValuedCostFunctions @ingroup ITK */ template class ITKImageToImageMetricControlInterface : public ITKSVMetricControlInterface { public: typedef ITKImageToImageMetricControlInterface Self; - typedef ITKSVMetricControlInterface Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Superclass = ITKSVMetricControlInterface; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(ITKImageToImageMetricControlInterface, ITKSVMetricControlInterface); typedef ::itk::ImageToImageMetric ImageToImageMetricBaseType; virtual ImageToImageMetricBaseType* getImageToImageMetric() = 0; virtual const ImageToImageMetricBaseType* getImageToImageMetric() const = 0; protected: ITKImageToImageMetricControlInterface() {}; - virtual ~ITKImageToImageMetricControlInterface() {}; + ~ITKImageToImageMetricControlInterface() override {}; private: //No copy constructor allowed ITKImageToImageMetricControlInterface(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapITKImageToImageMetricGetterInterface.h b/Code/Algorithms/ITK/include/mapITKImageToImageMetricGetterInterface.h index e4a4aae..c18af7f 100644 --- a/Code/Algorithms/ITK/include/mapITKImageToImageMetricGetterInterface.h +++ b/Code/Algorithms/ITK/include/mapITKImageToImageMetricGetterInterface.h @@ -1,77 +1,77 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_ITK_IMAGE_TO_IMAGE_METRIC_GETTER_INTERFACE_H #define __MAP_ITK_IMAGE_TO_IMAGE_METRIC_GETTER_INTERFACE_H #include "mapITKImageToImageMetricControlInterface.h" namespace map { namespace algorithm { namespace facet { /*! @class ITKImageToImageMetricGetterInterface * Interface inherited by every algorithm that is able to get and change (by none const getter) an ImageToImageMetric @ingroup AlgorithmFacets */ template class ITKImageToImageMetricGetterInterface { public: typedef ITKImageToImageMetricGetterInterface Self; typedef itk::ITKImageToImageMetricControlInterface MetricType; /*! @brief gets the metric @eguarantee no fail @return pointer to a MetricBaseType object */ virtual MetricType* getMetricControl() = 0; /*! @brief gets the metric @eguarantee no fail @return pointer to a MetricBaseType object */ virtual const MetricType* getMetricControl() const = 0; protected: ITKImageToImageMetricGetterInterface() {}; virtual ~ITKImageToImageMetricGetterInterface() {}; private: //No copy constructor allowed ITKImageToImageMetricGetterInterface(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapITKImageToImageMetricSetterInterface.h b/Code/Algorithms/ITK/include/mapITKImageToImageMetricSetterInterface.h index c354c69..64dea9f 100644 --- a/Code/Algorithms/ITK/include/mapITKImageToImageMetricSetterInterface.h +++ b/Code/Algorithms/ITK/include/mapITKImageToImageMetricSetterInterface.h @@ -1,72 +1,72 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_ITK_IMAGE_TO_IMAGE_METRIC_SETTER_INTERFACE_H #define __MAP_ITK_IMAGE_TO_IMAGE_METRIC_SETTER_INTERFACE_H #include "mapITKImageToImageMetricControlInterface.h" namespace map { namespace algorithm { namespace facet { /*! @class ITKImageToImageMetricSetterInterface * Interface inherited by every algorithm that is able to set and change (by none const getter) an ImageToImageMetric @ingroup AlgorithmFacets */ template class ITKImageToImageMetricSetterInterface { public: typedef ITKImageToImageMetricSetterInterface Self; typedef algorithm::itk::ITKImageToImageMetricControlInterface MetricControlType; /*! sets the metric @eguarantee strong @param metric the metric */ virtual void setMetricControl(MetricControlType* metric) = 0; protected: ITKImageToImageMetricSetterInterface() {}; virtual ~ITKImageToImageMetricSetterInterface() {}; private: //No copy constructor allowed ITKImageToImageMetricSetterInterface(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapITKInterpolatorGetterInterface.h b/Code/Algorithms/ITK/include/mapITKInterpolatorGetterInterface.h index ade86e6..2374f99 100644 --- a/Code/Algorithms/ITK/include/mapITKInterpolatorGetterInterface.h +++ b/Code/Algorithms/ITK/include/mapITKInterpolatorGetterInterface.h @@ -1,78 +1,78 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_INTERPOLATOR_GETTER_INTERFACE_H #define __ITK_INTERPOLATOR_GETTER_INTERFACE_H #include "itkInterpolateImageFunction.h" namespace map { namespace algorithm { namespace facet { /*! @class ITKInterpolatorGetterInterface * Interface inherited by every algorithm that is able to get and change (by none const getter) an interpolator @ingroup AlgorithmFacets */ template class ITKInterpolatorGetterInterface { public: typedef ITKInterpolatorGetterInterface Self; typedef ::itk::InterpolateImageFunction InterpolatorType; - typedef TCoordRep CoordRepType; + using CoordRepType = TCoordRep; /*! gets the interpolator @eguarantee strong @return a pointer to a InterpolatorType object */ virtual const InterpolatorType* getInterpolator() const = 0; /*! gets the interpolator * @eguarantee strong * @return a pointer to a InterpolatorType object */ virtual InterpolatorType* getInterpolator() = 0; protected: ITKInterpolatorGetterInterface() {}; virtual ~ITKInterpolatorGetterInterface() {}; private: //No copy constructor allowed ITKInterpolatorGetterInterface(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapITKInterpolatorSetterInterface.h b/Code/Algorithms/ITK/include/mapITKInterpolatorSetterInterface.h index b02c518..fd10ed8 100644 --- a/Code/Algorithms/ITK/include/mapITKInterpolatorSetterInterface.h +++ b/Code/Algorithms/ITK/include/mapITKInterpolatorSetterInterface.h @@ -1,72 +1,72 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_INTERPOLATOR_SETTER_INTERFACE_H #define __ITK_INTERPOLATOR_SETTER_INTERFACE_H #include "itkInterpolateImageFunction.h" namespace map { namespace algorithm { namespace facet { /*! @class ITKInterpolatorSetterInterface * Interface inherited by every algorithm that is able to set and change (by none const getter) an interpolator @ingroup AlgorithmFacets */ template class ITKInterpolatorSetterInterface { public: typedef ITKInterpolatorSetterInterface Self; typedef ::itk::InterpolateImageFunction InterpolatorType; - typedef TCoordRep CoordRepType; + using CoordRepType = TCoordRep; /*! sets the interpolator @eguarantee strong @param pInterpolator the interpolator */ virtual void setInterpolator(InterpolatorType* pInterpolator) = 0; protected: ITKInterpolatorSetterInterface() {}; virtual ~ITKInterpolatorSetterInterface() {}; private: //No copy constructor allowed ITKInterpolatorSetterInterface(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapITKMVMetricControlInterface.h b/Code/Algorithms/ITK/include/mapITKMVMetricControlInterface.h index af75cde..4eea2cb 100644 --- a/Code/Algorithms/ITK/include/mapITKMVMetricControlInterface.h +++ b/Code/Algorithms/ITK/include/mapITKMVMetricControlInterface.h @@ -1,74 +1,74 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_MV_METRIC_CONTROL_INTERFACE_H #define __ITK_MV_METRIC_CONTROL_INTERFACE_H #include "itkMultipleValuedCostFunction.h" #include "mapITKMetricControlInterface.h" #include "mapMAPAlgorithmsITKExports.h" namespace map { namespace algorithm { namespace itk { /*! @class ITKMVMetricControlInterface @brief Interface for controller classes that form a virtual wrapper around itk::MultipleValuedCostFunctions @ingroup ITK */ class MAPAlgorithmsITK_EXPORT ITKMVMetricControlInterface : public ITKMetricControlInterface { public: - typedef ITKMVMetricControlInterface Self; - typedef ITKMetricControlInterface Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = ITKMVMetricControlInterface; + using Superclass = ITKMetricControlInterface; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(ITKMVMetricControlInterface, ITKMetricControlInterface); - typedef ::itk::MultipleValuedCostFunction MVMetricBaseType; + using MVMetricBaseType = ::itk::MultipleValuedCostFunction; virtual MVMetricBaseType* getMVMetric() = 0; virtual const MVMetricBaseType* getMVMetric() const = 0; protected: ITKMVMetricControlInterface(); - virtual ~ITKMVMetricControlInterface(); + ~ITKMVMetricControlInterface() override; private: //No copy constructor allowed - ITKMVMetricControlInterface(const Self& source); - void operator=(const Self&); //purposely not implemented + ITKMVMetricControlInterface(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapITKMVNLOptimizerControlInterface.h b/Code/Algorithms/ITK/include/mapITKMVNLOptimizerControlInterface.h index a88a5e6..49fb79a 100644 --- a/Code/Algorithms/ITK/include/mapITKMVNLOptimizerControlInterface.h +++ b/Code/Algorithms/ITK/include/mapITKMVNLOptimizerControlInterface.h @@ -1,100 +1,100 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_MVNL_OPTIMIZER_CONTROL_INTERFACE_H #define __ITK_MVNL_OPTIMIZER_CONTROL_INTERFACE_H #include "itkMultipleValuedNonLinearOptimizer.h" #include "mapITKOptimizerControlInterface.h" namespace map { namespace algorithm { namespace itk { /*! @class ITKMVNLOptimizerControlInterface @brief Interface for controller classes that form a virtual wrapper around itk multiple valued non linear optimizers. This wrapper is used because stopping the optimizer is not covered by the polymorphic class design of itk::optimizer. Therefor there is no native and general way to stop an itk::optimizer or at least check if it can be stopped. @ingroup ITK */ class MAPAlgorithmsITK_EXPORT ITKMVNLOptimizerControlInterface : public ITKOptimizerControlInterface { public: - typedef ITKMVNLOptimizerControlInterface Self; - typedef ITKOptimizerControlInterface Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = ITKMVNLOptimizerControlInterface; + using Superclass = ITKOptimizerControlInterface; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(ITKMVNLOptimizerControlInterface, ITKOptimizerControlInterface); - typedef ::itk::MultipleValuedNonLinearOptimizer MVNLOptimizerBaseType; - typedef MVNLOptimizerBaseType::MeasureType MVNLMeasureType; - typedef OptimizerControlInterface::OptimizerMeasureType OptimizerMeasureType; + using MVNLOptimizerBaseType = ::itk::MultipleValuedNonLinearOptimizer; + using MVNLMeasureType = MVNLOptimizerBaseType::MeasureType; + using OptimizerMeasureType = OptimizerControlInterface::OptimizerMeasureType; virtual MVNLOptimizerBaseType* getMVNLOptimizer() = 0; virtual const MVNLOptimizerBaseType* getMVNLOptimizer() const = 0; /*! @brief gets the current value/cost of the optimizer iteration @eguarantee strong @return returns the optimizers current value/cost */ virtual MVNLMeasureType getCurrentMeasure() const; protected: ITKMVNLOptimizerControlInterface(); - virtual ~ITKMVNLOptimizerControlInterface(); + ~ITKMVNLOptimizerControlInterface() override; /*! return the cost of the current iteration step. Will be called by getCurrentMeasure() if hasCurrentValue() returns true. @eguarantee strong @return current measure */ virtual MVNLMeasureType doGetCurrentMeasure() const = 0; /*! Will be called to get the current value/cost of the optimizer iteration * calls doGetCurrentMeasure() and converts the result into the more general * OptimizerMeasureType. @eguarantee strong @return returns the optimizers current value/cost */ - virtual OptimizerMeasureType doGetCurrentValue() const; + OptimizerMeasureType doGetCurrentValue() const override; private: //No copy constructor allowed - ITKMVNLOptimizerControlInterface(const Self& source); - void operator=(const Self&); //purposely not implemented + ITKMVNLOptimizerControlInterface(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapITKMVNLOptimizerGetterInterface.h b/Code/Algorithms/ITK/include/mapITKMVNLOptimizerGetterInterface.h index 2676936..d223a41 100644 --- a/Code/Algorithms/ITK/include/mapITKMVNLOptimizerGetterInterface.h +++ b/Code/Algorithms/ITK/include/mapITKMVNLOptimizerGetterInterface.h @@ -1,77 +1,77 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_MVNL_OPTIMIZER_GETTER_INTERFACE_H #define __ITK_MVNL_OPTIMIZER_GETTER_INTERFACE_H #include "itkOptimizer.h" #include "mapITKMVNLOptimizerControlInterface.h" namespace map { namespace algorithm { namespace facet { /*! @class ITKMVNLOptimizerGetterInterface * Interface inherited by every algorithm that is able to get or change (none const getter) a multiple valued non linear optimizer @ingroup AlgorithmFacets */ class MAPAlgorithmsITK_EXPORT ITKMVNLOptimizerGetterInterface { public: - typedef ITKMVNLOptimizerGetterInterface Self; + using Self = ITKMVNLOptimizerGetterInterface; - typedef algorithm::itk::ITKMVNLOptimizerControlInterface ITKOptimizerControlType; + using ITKOptimizerControlType = algorithm::itk::ITKMVNLOptimizerControlInterface; /*! @brief gets the optimizer @eguarantee no fail @return pointer to an OptimizerControlType object */ virtual ITKOptimizerControlType* getITKOptimizerControl() = 0; /*! @brief gets the optimizer @eguarantee no fail @return pointer to an OptimizerControlType object */ virtual const ITKOptimizerControlType* getITKOptimizerControl() const = 0; protected: - ITKMVNLOptimizerGetterInterface() {}; - virtual ~ITKMVNLOptimizerGetterInterface() {}; + ITKMVNLOptimizerGetterInterface() = default; + virtual ~ITKMVNLOptimizerGetterInterface() = default; private: //No copy constructor allowed - ITKMVNLOptimizerGetterInterface(const Self& source); - void operator=(const Self&); //purposely not implemented + ITKMVNLOptimizerGetterInterface(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapITKMVNLOptimizerSetterInterface.h b/Code/Algorithms/ITK/include/mapITKMVNLOptimizerSetterInterface.h index 8d1ddf5..055f903 100644 --- a/Code/Algorithms/ITK/include/mapITKMVNLOptimizerSetterInterface.h +++ b/Code/Algorithms/ITK/include/mapITKMVNLOptimizerSetterInterface.h @@ -1,72 +1,72 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_MVNL_OPTIMIZER_SETTER_INTERFACE_H #define __ITK_MVNL_OPTIMIZER_SETTER_INTERFACE_H #include "mapITKMVNLOptimizerControlInterface.h" #include "itkOptimizer.h" namespace map { namespace algorithm { namespace facet { /*! @class ITKMVNLOptimizerSetterInterface * Interface inherited by every algorithm that is able to set or change (none const getter) a multiple valued non linear optimizer @ingroup AlgorithmFacets */ class MAPAlgorithmsITK_EXPORT ITKMVNLOptimizerSetterInterface { public: - typedef ITKMVNLOptimizerSetterInterface Self; + using Self = ITKMVNLOptimizerSetterInterface; - typedef algorithm::itk::ITKMVNLOptimizerControlInterface ITKOptimizerControlType; + using ITKOptimizerControlType = algorithm::itk::ITKMVNLOptimizerControlInterface; /*! sets the optimizer @eguarantee strong @param optimizer the optimizer */ virtual void setITKOptimizerControl(ITKOptimizerControlType* pOptimizer) = 0; protected: - ITKMVNLOptimizerSetterInterface() {}; - virtual ~ITKMVNLOptimizerSetterInterface() {}; + ITKMVNLOptimizerSetterInterface() = default; + virtual ~ITKMVNLOptimizerSetterInterface() = default; private: //No copy constructor allowed - ITKMVNLOptimizerSetterInterface(const Self& source); - void operator=(const Self&); //purposely not implemented + ITKMVNLOptimizerSetterInterface(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapITKMattesMutualInformationImageToImageMetric.h b/Code/Algorithms/ITK/include/mapITKMattesMutualInformationImageToImageMetric.h index 99a334a..6631f40 100644 --- a/Code/Algorithms/ITK/include/mapITKMattesMutualInformationImageToImageMetric.h +++ b/Code/Algorithms/ITK/include/mapITKMattesMutualInformationImageToImageMetric.h @@ -1,87 +1,87 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_ITK_MATTES_MUTUAL_INFORMATION_IMAGE_TO_IMAGE_METRIC_H #define __MAP_ITK_MATTES_MUTUAL_INFORMATION_IMAGE_TO_IMAGE_METRIC_H #include "mapITKMetricControl.h" #include "mapITKImageToImageMetricControlBase.h" #include "itkMattesMutualInformationImageToImageMetric.h" namespace map { namespace algorithm { namespace itk { /*! This class is the template specialization for the itk::MattesMutualInformationImageToImageMetric. @ingroup ITK @ingroup MetricControl */ template class ITKMetricControl< ::itk::MattesMutualInformationImageToImageMetric > : public ITKImageToImageMetricControlBase< ::itk::MattesMutualInformationImageToImageMetric > { public: typedef ITKMetricControl< ::itk::MattesMutualInformationImageToImageMetric > Self; typedef ITKImageToImageMetricControlBase< ::itk::MattesMutualInformationImageToImageMetric > Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(ITKMetricControl, ITKImageToImageMetricControlBase); itkNewMacro(Self); virtual bool getMinimizeToOptimize() const { return true; }; virtual bool getMaximizeToOptimize() const { return false; }; protected: virtual ~ITKMetricControl() { Superclass::_spMetric->ReinitializeSeed(); }; ITKMetricControl() {}; private: //No copy constructor allowed ITKMetricControl(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapITKMetricControl.h b/Code/Algorithms/ITK/include/mapITKMetricControl.h index 8dc7569..4356a08 100644 --- a/Code/Algorithms/ITK/include/mapITKMetricControl.h +++ b/Code/Algorithms/ITK/include/mapITKMetricControl.h @@ -1,57 +1,57 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_METRIC_CONTROL_H #define __ITK_METRIC_CONTROL_H #include "mapITKMetricControlInterface.h" namespace map { namespace algorithm { namespace itk { /*! @class ITKMetricControl This class is the master copy for the template specialization. It is a dummy and not for practical use. For every metric there must be a proper specialization of this class (using the right interfaces and implementing the abstract functions. To define a controller for a special metric use template specialization (template<> class ITKMetricControl) and reimplement the class interface. See e.g. ITKMetricControl as an specialized example. @remark ITKMetricControl should always instantiates a concrete optimizer when constructed. @template TConcreteMetric type of the concrete metric controlled by the class @ingroup ITK @ingroup MetricControl */ template class ITKMetricControl; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapITKMetricControlInterface.h b/Code/Algorithms/ITK/include/mapITKMetricControlInterface.h index 7f88b7a..49e73e4 100644 --- a/Code/Algorithms/ITK/include/mapITKMetricControlInterface.h +++ b/Code/Algorithms/ITK/include/mapITKMetricControlInterface.h @@ -1,90 +1,90 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_METRIC_CONTROL_INTERFACE_H #define __ITK_METRIC_CONTROL_INTERFACE_H #include "mapMacros.h" #include "itkObject.h" #include "itkCostFunction.h" #include "mapMAPAlgorithmsITKExports.h" namespace map { namespace algorithm { namespace itk { /*! @class ITKMetricControlInterface @brief Interface for controller classes that form a virtual wrapper around itk cost functions. This wrapper is used because some metric trait information (e.g. optimization direction are not covered by the polymorphic class design of itk::CostFunction. @ingroup ITK */ class MAPAlgorithmsITK_EXPORT ITKMetricControlInterface : public ::itk::Object { public: - typedef ITKMetricControlInterface Self; - typedef ::itk::Object Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = ITKMetricControlInterface; + using Superclass = ::itk::Object; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(ITKMetricControlInterface, itk::Object); - typedef ::itk::CostFunction MetricBaseType; + using MetricBaseType = ::itk::CostFunction; /*! Should an optimizer minimize the metric to optimize it? @eguarantee no fail */ virtual bool getMinimizeToOptimize() const = 0; /*! Should an optimizer maximize the metric to optimize it? @eguarantee no fail */ virtual bool getMaximizeToOptimize() const = 0; virtual MetricBaseType* getMetric() = 0; virtual const MetricBaseType* getMetric() const = 0; protected: ITKMetricControlInterface(); - virtual ~ITKMetricControlInterface(); + ~ITKMetricControlInterface() override; private: //No copy constructor allowed - ITKMetricControlInterface(const Self& source); - void operator=(const Self&); //purposely not implemented + ITKMetricControlInterface(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapITKMultiResImageRegistrationAlgorithm.h b/Code/Algorithms/ITK/include/mapITKMultiResImageRegistrationAlgorithm.h index 0f57e5d..fcb0645 100644 --- a/Code/Algorithms/ITK/include/mapITKMultiResImageRegistrationAlgorithm.h +++ b/Code/Algorithms/ITK/include/mapITKMultiResImageRegistrationAlgorithm.h @@ -1,258 +1,251 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_MULTI_RES_IMAGE_REGISTRATION_ALGORITHM_H #define __ITK_MULTI_RES_IMAGE_REGISTRATION_ALGORITHM_H #include "mapContinuous.h" #include "mapITKImageRegistrationAlgorithm.h" #include "mapArbitraryImagePyramidesPolicy.h" #include "mapModifiableMultiResImageRegistrationAlgorithmBase.h" #include "itkMultiResolutionImageRegistrationMethod.h" #include "itkSimpleFastMutexLock.h" namespace map { namespace algorithm { namespace itk { /*! @class ITKMultiResImageRegistrationAlgorithm @brief The class is used for image registration algorithm based on ITK and using a multi resolution approach. If you need to react on level changes (e.g. to adapt certain algorithm parameters) you can observe the object for AlgorithmResolutionLevelEvent. If you derive from this class you may also reimplement the method doInterLevelSetup to directly react on level changes within the class implementation. @ingroup Algorithms */ template < class TMovingImage, class TTargetImage, class TIdentificationPolicy, class TInterpolatorPolicy = ArbitraryInterpolatorPolicy, class TMetricPolicy = ArbitraryImageToImageMetricPolicy, class TOptimizerPolicy = ArbitrarySVNLOptimizerPolicy, class TTransformPolicy = ArbitraryTransformPolicy< ::map::core::continuous::ScalarType, TMovingImage::ImageDimension, TTargetImage::ImageDimension>, class TPyramidesPolicy = ArbitraryImagePyramidesPolicy, class TInternalRegistrationMethod = ::itk::MultiResolutionImageRegistrationMethod > class ITKMultiResImageRegistrationAlgorithm : public ITKImageRegistrationAlgorithm, public ModifiableMultiResImageRegistrationAlgorithmBase { public: typedef ITKMultiResImageRegistrationAlgorithm < TMovingImage, TTargetImage, TIdentificationPolicy, TInterpolatorPolicy, TMetricPolicy, TOptimizerPolicy, TTransformPolicy, TPyramidesPolicy, TInternalRegistrationMethod > Self; typedef ITKImageRegistrationAlgorithm Superclass; typedef ITKImageRegistrationAlgorithmInterface ITKRegistrationType; typedef ModifiableMultiResImageRegistrationAlgorithmBase MultiResRegistrationAlgorithmType; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(ITKMultiResImageRegistrationAlgorithm, ITKImageRegistrationAlgorithm); mapNewAlgorithmMacro(Self); - typedef typename Superclass::UIDType UIDType; - typedef typename Superclass::UIDPointer UIDPointer; - - typedef TMovingImage MovingImageType; - typedef TTargetImage TargetImageType; - typedef TInterpolatorPolicy InterpolatorPolicyType; - typedef TMetricPolicy MetricPolicyType; - typedef TOptimizerPolicy OptimizerPolicyType; - typedef TTransformPolicy TransformPolicyType; - typedef TIdentificationPolicy IdentificationPolicyType; - typedef TPyramidesPolicy PyramidesPolicyType; - - typedef typename ITKRegistrationType::OptimizerBaseType OptimizerBaseType; - typedef typename ITKRegistrationType::MetricBaseType MetricBaseType; - typedef typename ITKRegistrationType::TransformBaseType TransformBaseType; - typedef typename ITKRegistrationType::InterpolatorBaseType InterpolatorBaseType; - typedef typename MultiResRegistrationAlgorithmType::ScheduleType ScheduleType; - typedef typename MultiResRegistrationAlgorithmType::ResolutionLevelCountType - ResolutionLevelCountType; - typedef typename MultiResRegistrationAlgorithmType::TargetImagePyramideBaseType - TargetImagePyramideBaseType; - typedef typename MultiResRegistrationAlgorithmType::MovingImagePyramideBaseType - MovingImagePyramideBaseType; - typedef typename MultiResRegistrationAlgorithmType::TargetImagePyramideBasePointer - TargetImagePyramideBasePointer; - typedef typename MultiResRegistrationAlgorithmType::MovingImagePyramideBasePointer - MovingImagePyramideBasePointer; + using UIDType = typename Superclass::UIDType; + using UIDPointer = typename Superclass::UIDPointer; + + using MovingImageType = TMovingImage; + using TargetImageType = TTargetImage; + using InterpolatorPolicyType = TInterpolatorPolicy; + using MetricPolicyType = TMetricPolicy; + using OptimizerPolicyType = TOptimizerPolicy; + using TransformPolicyType = TTransformPolicy; + using IdentificationPolicyType = TIdentificationPolicy; + using PyramidesPolicyType = TPyramidesPolicy; + + using OptimizerBaseType = typename ITKRegistrationType::OptimizerBaseType; + using MetricBaseType = typename ITKRegistrationType::MetricBaseType; + using TransformBaseType = typename ITKRegistrationType::TransformBaseType; + using InterpolatorBaseType = typename ITKRegistrationType::InterpolatorBaseType; + using ScheduleType = typename MultiResRegistrationAlgorithmType::ScheduleType; + using ResolutionLevelCountType = typename MultiResRegistrationAlgorithmType::ResolutionLevelCountType; + using TargetImagePyramideBaseType = typename MultiResRegistrationAlgorithmType::TargetImagePyramideBaseType; + using MovingImagePyramideBaseType = typename MultiResRegistrationAlgorithmType::MovingImagePyramideBaseType; + using TargetImagePyramideBasePointer = typename MultiResRegistrationAlgorithmType::TargetImagePyramideBasePointer; + using MovingImagePyramideBasePointer = typename MultiResRegistrationAlgorithmType::MovingImagePyramideBasePointer; typedef typename IterativeRegistrationAlgorithm::OptimizerMeasureType OptimizerMeasureType; typedef ImageRegistrationAlgorithmBase ImageRegistrationAlgorithmBaseType; - typedef typename Superclass::MovingRepresentationDescriptorType MovingRepresentationDescriptorType; - typedef typename Superclass::TargetRepresentationDescriptorType TargetRepresentationDescriptorType; - typedef typename Superclass::RegistrationPointer RegistrationPointer; - typedef typename Superclass::RegistrationType RegistrationType; - typedef typename Superclass::IterationCountType IterationCountType; - typedef typename Superclass::FieldRepRequirement FieldRepRequirement; + using MovingRepresentationDescriptorType = typename Superclass::MovingRepresentationDescriptorType; + using TargetRepresentationDescriptorType = typename Superclass::TargetRepresentationDescriptorType; + using RegistrationPointer = typename Superclass::RegistrationPointer; + using RegistrationType = typename Superclass::RegistrationType; + using IterationCountType = typename Superclass::IterationCountType; + using FieldRepRequirement = typename Superclass::FieldRepRequirement; - typedef typename ImageRegistrationAlgorithmBaseType::MovingImageConstPointer - MovingImageConstPointer; - typedef typename ImageRegistrationAlgorithmBaseType::TargetImageConstPointer - TargetImageConstPointer; + using MovingImageConstPointer = typename ImageRegistrationAlgorithmBaseType::MovingImageConstPointer; + using TargetImageConstPointer = typename ImageRegistrationAlgorithmBaseType::TargetImageConstPointer; /*! Indicates if the current processed level can be deduced @eguarantee no fail */ virtual bool hasLevelCount() const; protected: ITKMultiResImageRegistrationAlgorithm(); virtual ~ITKMultiResImageRegistrationAlgorithm(); - typedef typename Superclass::InternalRegistrationMethodType InternalRegistrationMethodType; - typedef typename Superclass::InterimRegistrationType InterimRegistrationType; - typedef typename Superclass::InterimRegistrationPointer InterimRegistrationPointer; + using InternalRegistrationMethodType = typename Superclass::InternalRegistrationMethodType; + using InterimRegistrationType = typename Superclass::InterimRegistrationType; + using InterimRegistrationPointer = typename Superclass::InterimRegistrationPointer; /*! Returns if the registration should be computed. The registration is outdated if doGetRegistration returns null * or the modification times of at least one policy is newer then the modification time of the registration. @eguarantee strong @return true if the registration should be (re)computed. False if the registration is uptodate. */ virtual bool registrationIsOutdated() const; /*! This method should do all preparation tasks right before the algorithms execution. At the and of this method * the algorithm should be set up and ready to use.\n * The method delegates the main work of initialization to several sub methods. This sub methods serves as slots * that can be rewritten by a algorithm developer to alter certain aspects and keep the rest untouched.\n * The sequence of slot calls is: \n * - prepCheckValidity * - prepPrepareSubComponents * - prepAssembleSubComponents * - prepPerpareInternalInputData * - prepSetInternalInputData * - prepInitializeTransformation * - prepFinalizePreparation * @remark If you want to change the execution style, then overwrite runAlgorithm(). @remark If you want to alter settings of optimzer, metric or interpolator depending on the resolution level use the method doInterLevelSetup() @eguarantee strong */ virtual void prepareAlgorithm(); /*! This method is the slot to check if all internal components and input data are properly set. * @remark The default implementation checks transform, interpolator, optimizer, metric, pyramides, moving and target image. * overload this method to alter the validity check. * @remark It is assumed that the implementation of this method throws an exception if the algorithm is not be configured * correctly.*/ virtual void prepCheckValidity(); /*! This method is the slot where sub components can be configured before(!) they are set to the * internal registration method. * @remark The default implementation just calls the preparation methods of the component policies.*/ virtual void prepPrepareSubComponents(); /*! This method is the slot where sub components are set to the internal registration method. * @remark The default implementation just calls the preparation methods of the component policies.*/ virtual void prepAssembleSubComponents(); /*! This method is the slot for passing relevant input data to the internal algorithm or its components. * @remark The default implementation passes _spInternalMoving and _spInternalTargetImage, sets the schedules, the fixed image region of the registration and the metric masks. @eguarantee strong */ virtual void prepSetInternalInputData(); /*! This method is the slot for final steps in the preperation process * @remark The default implementation calls the prepareAfterAssembly methods of the sub component policies. @eguarantee strong */ virtual void prepFinalizePreparation(); - typedef typename TransformPolicyType::TransformType::ParametersType TransformParametersType; + using TransformParametersType = typename TransformPolicyType::TransformType::ParametersType; /*! return the current resolution level number. Will be called by getCurrentLevel() if hasLevelCount() returns true. @eguarantee strong @return level count */ virtual ResolutionLevelCountType doGetCurrentLevel() const; /*! This member is called by onLevelEvent() after the envent is invoked. The default implementation does nothing. It can be used in derivated classes to directly implement any initialization or setup strategies between level changes (e.g. adjusting the stepsize of the optimizer. */ virtual void doInterLevelSetup(); /*! Overloaded member that also stops on the registration method * level */ virtual bool doStopAlgorithm(); /*! Methods invoked by derivated classes. */ virtual void PrintSelf(std::ostream& os, ::itk::Indent indent) const; private: /*! The count of the levels, since starting the registration algorithm the last time. * 0 indicates that no level has been processed yet.*/ ResolutionLevelCountType _currentLevelCount; /*!Indicates if there was any level event before*/ bool _firstLevelEvent; /*! The lock is used to manage the access to the member variable _currentLevelCount.*/ mutable ::itk::SimpleFastMutexLock _currentLevelLock; mutable core::ObserverSentinel::Pointer _onLevelObserver; mutable core::ObserverSentinel::Pointer _onGeneralTargePyramideObserver; mutable core::ObserverSentinel::Pointer _onGeneralMovingPyramideObserver; /*! This member function is called by the observer of the optimizer, when ever a LevelEvent is invoked.*/ void onLevelEvent(::itk::Object* caller, const ::itk::EventObject& eventObject); /*! This member function is called by the transform policy if the transform model instance changes.*/ void onTargetImagePyramideChange(const ::itk::EventObject& eventObject); /*! This member function is called by the transform policy if the transform model instance changes.*/ void onMovingImagePyramideChange(const ::itk::EventObject& eventObject); ITKMultiResImageRegistrationAlgorithm(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapITKMultiResImageRegistrationAlgorithm.tpp" #endif #endif diff --git a/Code/Algorithms/ITK/include/mapITKOptimizerControl.h b/Code/Algorithms/ITK/include/mapITKOptimizerControl.h index 63e9d31..40bfa81 100644 --- a/Code/Algorithms/ITK/include/mapITKOptimizerControl.h +++ b/Code/Algorithms/ITK/include/mapITKOptimizerControl.h @@ -1,58 +1,58 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_OPTIMIZER_CONTROL_H #define __ITK_OPTIMIZER_CONTROL_H namespace map { namespace algorithm { namespace itk { /*! @class ITKOptimizerControl This class is the master definition for the template specialization. It is a dummy and not for practical use. For every optimizer there must be a proper specialization of this class (using the right interfaces and implementing the abstract functions). To define a controller for a special optimizer use template specialization (template<> class ITKOptimizerControl) and reimplement the class interface. See e.g. ITKOptimizerControl as an specialized example. @remark specialized ITKOptimizerControl should instantiates a concrete optimizer when constructed. You can set a new one, but ITKOptimizerControl has always an optimizer under control. @template TConcreteOptimizer type of the concrete optimizer controlled by the class @ingroup ITK @ingroup OptimizerControl */ template class ITKOptimizerControl; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapITKOptimizerControlInterface.h b/Code/Algorithms/ITK/include/mapITKOptimizerControlInterface.h index 21806a2..e7b645b 100644 --- a/Code/Algorithms/ITK/include/mapITKOptimizerControlInterface.h +++ b/Code/Algorithms/ITK/include/mapITKOptimizerControlInterface.h @@ -1,92 +1,92 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_OPTIMIZER_CONTROL_INTERFACE_H #define __ITK_OPTIMIZER_CONTROL_INTERFACE_H #include "itkObject.h" #include "itkOptimizer.h" #include "mapOptimizerControlInterface.h" #include "mapMAPAlgorithmsITKExports.h" namespace map { namespace algorithm { namespace itk { /*! @class ITKOptimizerControlInterface @brief Interface for controller classes that form a virtual wrapper around itk optimizers. This wrapper is used because stopping the optimizer is not covered by the polymorphic class design of itk::optimizer. Therefor there is no native and general way to stop an itk::optimizer or at least check if it can be stopped. @ingroup ITK */ class MAPAlgorithmsITK_EXPORT ITKOptimizerControlInterface : public ::itk::Object, public OptimizerControlInterface { public: - typedef ITKOptimizerControlInterface Self; - typedef ::itk::Object Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = ITKOptimizerControlInterface; + using Superclass = ::itk::Object; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(ITKOptimizerControlInterface, itk::Object); - typedef ::itk::Optimizer OptimizerBaseType; + using OptimizerBaseType = ::itk::Optimizer; virtual OptimizerBaseType* getOptimizer() = 0; virtual const OptimizerBaseType* getOptimizer() const = 0; /*! clones the optimizer control and the controlled optimizer. * @remark: The function guarantees that all settings of controlled optimizer * are cloned, but its optimization state must not be cloned as well. Thus the function * guarantees the same like instancing the same class again and transferring all properties * of the source instance to the destination instance via setter and getter. * @remark: It is a "deep" copy,so the controlled optimizer is a new instance as well. * @eguarantee strong * @remark Implement the function for special optimizer control classes. * @return Smartpointer to the cloned optimizer control.*/ virtual Pointer clone() const = 0; - virtual const core::String getStopConditionDescription() const; + const core::String getStopConditionDescription() const override; protected: ITKOptimizerControlInterface(); - virtual ~ITKOptimizerControlInterface(); + ~ITKOptimizerControlInterface() override; private: //No copy constructor allowed - ITKOptimizerControlInterface(const Self& source); - void operator=(const Self&); //purposely not implemented + ITKOptimizerControlInterface(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapITKRegularStepGradientDescentOptimizer.h b/Code/Algorithms/ITK/include/mapITKRegularStepGradientDescentOptimizer.h index 3ec5839..5554059 100644 --- a/Code/Algorithms/ITK/include/mapITKRegularStepGradientDescentOptimizer.h +++ b/Code/Algorithms/ITK/include/mapITKRegularStepGradientDescentOptimizer.h @@ -1,171 +1,170 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_REGULAR_STEP_GRADIENT_DESCENT_OPTIMIZER_CONTROL_H #define __ITK_REGULAR_STEP_GRADIENT_DESCENT_OPTIMIZER_CONTROL_H #include "mapITKOptimizerControl.h" #include "mapITKSVNLOptimizerControlBase.h" #include "itkRegularStepGradientDescentOptimizer.h" namespace map { namespace algorithm { namespace itk { /*! This class is the template specialization for the itk::PowellOptimizer. @ingroup ITK @ingroup OptimizerControl */ template<> class ITKOptimizerControl< ::itk::RegularStepGradientDescentOptimizer> : public ITKSVNLOptimizerControlBase< ::itk::RegularStepGradientDescentOptimizer> { public: - typedef ITKOptimizerControl< ::itk::RegularStepGradientDescentOptimizer> Self; - typedef ITKSVNLOptimizerControlBase< ::itk::RegularStepGradientDescentOptimizer> Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = ITKOptimizerControl< ::itk::RegularStepGradientDescentOptimizer>; + using Superclass = ITKSVNLOptimizerControlBase< ::itk::RegularStepGradientDescentOptimizer>; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(ITKOptimizerControl, ITKSVNLOptimizerControlBase); itkNewMacro(Self); - typedef Superclass::ConcreteOptimizerType ConcreteOptimizerType; - typedef ConcreteOptimizerType::Pointer ConcreteOptimizerPointer; + using ConcreteOptimizerType = Superclass::ConcreteOptimizerType; + using ConcreteOptimizerPointer = ConcreteOptimizerType::Pointer; protected: - virtual ~ITKOptimizerControl() {}; - ITKOptimizerControl() {}; + ~ITKOptimizerControl() override = default; + ITKOptimizerControl() = default; private: //No copy constructor allowed - ITKOptimizerControl(const Self& source); - void operator=(const Self&); //purposely not implemented + ITKOptimizerControl(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented public: - virtual bool isStoppable() const + bool isStoppable() const override { return true; }; - virtual bool hasIterationCount() const + bool hasIterationCount() const override { return true; }; - virtual bool hasMaxIterationCount() const + bool hasMaxIterationCount() const override { return true; }; - virtual bool hasCurrentValue() const + bool hasCurrentValue() const override { return true; }; - virtual bool canMinimize() const + bool canMinimize() const override { return true; }; - virtual bool canMaximize() const + bool canMaximize() const override { return true; }; - virtual bool getMinimize() const + bool getMinimize() const override { return _spOptimizer->GetMinimize(); }; - virtual bool getMaximize() const + bool getMaximize() const override { return _spOptimizer->GetMaximize(); }; - virtual void setMinimize(bool minimize) + void setMinimize(bool minimize) override { _spOptimizer->SetMinimize(minimize); }; - virtual void setMaximize(bool maximize) + void setMaximize(bool maximize) override { _spOptimizer->SetMaximize(maximize); }; protected: - virtual bool doStop() + bool doStop() override { _spOptimizer->StopOptimization(); return true; }; - virtual IterationCountType doGetCurrentIteration() const + IterationCountType doGetCurrentIteration() const override { return _spOptimizer->GetCurrentIteration(); }; - virtual IterationCountType doGetMaxIterations() const + IterationCountType doGetMaxIterations() const override { return _spOptimizer->GetNumberOfIterations(); }; - virtual SVNLMeasureType doGetCurrentMeasure() const + SVNLMeasureType doGetCurrentMeasure() const override { return _spOptimizer->GetValue(); }; - virtual void copyProperties(const ConcreteOptimizerType* source, - ConcreteOptimizerType* destination) const + void copyProperties(const ConcreteOptimizerType* source, + ConcreteOptimizerType* destination) const override { Superclass::copyProperties(source, destination); destination->SetMaximize(source->GetMaximize()); destination->SetMaximumStepLength(source->GetMaximumStepLength()); destination->SetMinimumStepLength(source->GetMinimumStepLength()); destination->SetRelaxationFactor(source->GetRelaxationFactor()); destination->SetNumberOfIterations(source->GetNumberOfIterations()); destination->SetGradientMagnitudeTolerance(source->GetGradientMagnitudeTolerance()); }; - virtual Superclass::Pointer doCloneControl() const + Superclass::Pointer doCloneControl() const override { Pointer spClone = Self::New(); Superclass::Pointer spResult = spClone.GetPointer(); return spResult; }; }; - typedef ITKOptimizerControl< ::itk::RegularStepGradientDescentOptimizer> - RegularStepGradientDescentOptimizerControl; - } - } -} + using RegularStepGradientDescentOptimizerControl = ITKOptimizerControl< ::itk::RegularStepGradientDescentOptimizer>; + } // namespace itk + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapITKSVMetricControlInterface.h b/Code/Algorithms/ITK/include/mapITKSVMetricControlInterface.h index 66f708c..993339a 100644 --- a/Code/Algorithms/ITK/include/mapITKSVMetricControlInterface.h +++ b/Code/Algorithms/ITK/include/mapITKSVMetricControlInterface.h @@ -1,74 +1,74 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_SV_METRIC_CONTROL_INTERFACE_H #define __ITK_SV_METRIC_CONTROL_INTERFACE_H #include "mapITKMetricControlInterface.h" #include "itkSingleValuedCostFunction.h" namespace map { namespace algorithm { namespace itk { /*! @class ITKSVMetricControlInterface @brief Interface for controller classes that form a virtual wrapper around itk::SingleValuedCostFunctions @ingroup ITK */ class MAPAlgorithmsITK_EXPORT ITKSVMetricControlInterface : public ITKMetricControlInterface { public: - typedef ITKSVMetricControlInterface Self; - typedef ITKMetricControlInterface Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = ITKSVMetricControlInterface; + using Superclass = ITKMetricControlInterface; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(ITKSVMetricControlInterface, ITKMetricControlInterface); - typedef ::itk::SingleValuedCostFunction SVMetricBaseType; + using SVMetricBaseType = ::itk::SingleValuedCostFunction; virtual SVMetricBaseType* getSVMetric() = 0; virtual const SVMetricBaseType* getSVMetric() const = 0; protected: ITKSVMetricControlInterface(); - virtual ~ITKSVMetricControlInterface(); + ~ITKSVMetricControlInterface() override; private: //No copy constructor allowed - ITKSVMetricControlInterface(const Self& source); - void operator=(const Self&); //purposely not implemented + ITKSVMetricControlInterface(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapITKSVNLOptimizerControlBase.h b/Code/Algorithms/ITK/include/mapITKSVNLOptimizerControlBase.h index 09a17bf..967496b 100644 --- a/Code/Algorithms/ITK/include/mapITKSVNLOptimizerControlBase.h +++ b/Code/Algorithms/ITK/include/mapITKSVNLOptimizerControlBase.h @@ -1,133 +1,133 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_SVNL_OPTIMIZER_CONTROL_BASE_H #define __ITK_SVNL_OPTIMIZER_CONTROL_BASE_H #include "mapITKSVNLOptimizerControlInterface.h" namespace map { namespace algorithm { namespace itk { /*! @class ITKSVNLOptimizerControlBase This class serves as base class for all template specialization of itk optimizers that are single valued non linear optimizers. It realizes some basic optimizer handling, to reduce the code in the control classes @remark ITKOptimizerControl instantiates a concrete optimizer when constructed. You can set a new one, but ITKSVNLOptimizerControlBase has always an optimizer under control. @template TConcreteOptimizer type of the concrete optimizer controlled by the class @ingroup ITK @ingroup OptimizerControl */ template class ITKSVNLOptimizerControlBase : public ITKSVNLOptimizerControlInterface { public: - typedef ITKSVNLOptimizerControlBase Self; - typedef ITKSVNLOptimizerControlInterface Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = ITKSVNLOptimizerControlBase; + using Superclass = ITKSVNLOptimizerControlInterface; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(ITKSVNLOptimizerControlBase, ITKSVNLOptimizerControlInterface); - typedef TConcreteOptimizer ConcreteOptimizerType; - typedef typename ConcreteOptimizerType::Pointer ConcreteOptimizerPointer; - typedef ITKSVNLOptimizerControlInterface BaseInterfaceType; + using ConcreteOptimizerType = TConcreteOptimizer; + using ConcreteOptimizerPointer = typename ConcreteOptimizerType::Pointer; + using BaseInterfaceType = ITKSVNLOptimizerControlInterface; /*! setter for the optimizer @eguarantee no fail @param pOptimizer the OptimizerType object that has to be set. Must not be NULL (otherwise an exception will be thrown). */ virtual void setOptimizer(ConcreteOptimizerType* pOptimizer); - virtual OptimizerBaseType* getOptimizer(); - virtual const OptimizerBaseType* getOptimizer() const; + OptimizerBaseType* getOptimizer() override; + const OptimizerBaseType* getOptimizer() const override; - virtual SVNLOptimizerBaseType* getSVNLOptimizer(); - virtual const SVNLOptimizerBaseType* getSVNLOptimizer() const; + SVNLOptimizerBaseType* getSVNLOptimizer() override; + const SVNLOptimizerBaseType* getSVNLOptimizer() const override; virtual ConcreteOptimizerType* getConcreteOptimizer(); virtual const ConcreteOptimizerType* getConcreteOptimizer() const; /*! The modification time (MT) of an optimizer controler is the the maximum of his MT * and the MT of the controlled optimizer. */ - virtual unsigned long GetMTime() const; + unsigned long GetMTime() const override; - virtual bool hasCurrentPosition() const; + bool hasCurrentPosition() const override; - virtual bool hasScales() const; + bool hasScales() const override; /*! clones the optimizer control and the controlled optimizer. * This implementation generates an instance of ConcreteOptimizerType and uses * copyProperties() to transfer the settings. Reimplement copyProperties() to * realize special settings transfer. * @remark: The function guarantees that all settings of controlled optimizer * are cloned, but its optimization state must not be cloned as well. Thus the function * guarantees the same like instancing the same class again and transferring all properties * of the source instance to the destination instance via setter and getter. * @remark: It is a "deep" copy,so the controlled optimizer is a new instance as well. * @eguarantee strong * @remark Implement the function for special optimizer control classes. * @return Smartpointer to the cloned optimizer control.*/ - virtual ITKOptimizerControlInterface::Pointer clone() const; + ITKOptimizerControlInterface::Pointer clone() const override; protected: /*! Method is called by clone() to transfer the properties between the cloned * optimizer and the source. * @remark this base implementation copies the scales and the initial position.*/ virtual void copyProperties(const ConcreteOptimizerType* source, ConcreteOptimizerType* destination) const; /*! Method is called by clone() to clone the concrete control type derivated from this class. */ virtual Pointer doCloneControl() const = 0; - virtual OptimizerPositionType doGetCurrentPosition() const; + OptimizerPositionType doGetCurrentPosition() const override; - virtual OptimizerScalesType doGetScales() const; + OptimizerScalesType doGetScales() const override; - virtual ~ITKSVNLOptimizerControlBase(); + ~ITKSVNLOptimizerControlBase() override; ITKSVNLOptimizerControlBase(); ConcreteOptimizerPointer _spOptimizer; private: //No copy constructor allowed ITKSVNLOptimizerControlBase(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapITKSVNLOptimizerControlBase.tpp" #endif #endif diff --git a/Code/Algorithms/ITK/include/mapITKSVNLOptimizerControlBase.tpp b/Code/Algorithms/ITK/include/mapITKSVNLOptimizerControlBase.tpp index 374d519..f4670bb 100644 --- a/Code/Algorithms/ITK/include/mapITKSVNLOptimizerControlBase.tpp +++ b/Code/Algorithms/ITK/include/mapITKSVNLOptimizerControlBase.tpp @@ -1,187 +1,186 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_SVNL_OPTIMIZER_CONTROL_BASE_TPP #define __ITK_SVNL_OPTIMIZER_CONTROL_BASE_TPP #include "mapExceptionObjectMacros.h" namespace map { namespace algorithm { namespace itk { template void ITKSVNLOptimizerControlBase:: setOptimizer(ConcreteOptimizerType* pOptimizer) { if (!pOptimizer) { mapDefaultExceptionMacro( << "Cannot set optimizer. Passe pointer to optimizer is NULL"); } _spOptimizer = pOptimizer; this->Modified(); } template unsigned long ITKSVNLOptimizerControlBase:: GetMTime() const { unsigned long mt = Superclass::GetMTime(); if (mt < _spOptimizer->GetMTime()) { mt = _spOptimizer->GetMTime(); } return mt; }; template typename ITKSVNLOptimizerControlBase::SVNLOptimizerBaseType* ITKSVNLOptimizerControlBase:: getSVNLOptimizer() { return _spOptimizer.GetPointer(); }; template const typename ITKSVNLOptimizerControlBase::SVNLOptimizerBaseType* ITKSVNLOptimizerControlBase:: getSVNLOptimizer() const { return _spOptimizer.GetPointer(); }; template typename ITKSVNLOptimizerControlBase::OptimizerBaseType* ITKSVNLOptimizerControlBase:: getOptimizer() { return _spOptimizer.GetPointer(); }; template const typename ITKSVNLOptimizerControlBase::OptimizerBaseType* ITKSVNLOptimizerControlBase:: getOptimizer() const { return _spOptimizer.GetPointer(); }; template typename ITKSVNLOptimizerControlBase::ConcreteOptimizerType* ITKSVNLOptimizerControlBase:: getConcreteOptimizer() { return _spOptimizer.GetPointer(); }; template const typename ITKSVNLOptimizerControlBase::ConcreteOptimizerType* ITKSVNLOptimizerControlBase:: getConcreteOptimizer() const { return _spOptimizer.GetPointer(); }; template bool ITKSVNLOptimizerControlBase:: hasCurrentPosition() const { return true; }; template typename ITKSVNLOptimizerControlBase::OptimizerPositionType ITKSVNLOptimizerControlBase:: doGetCurrentPosition() const { OptimizerPositionType result = _spOptimizer->GetCurrentPosition(); return result; }; template bool ITKSVNLOptimizerControlBase:: hasScales() const { return true; }; template ITKOptimizerControlInterface::Pointer ITKSVNLOptimizerControlBase:: clone() const { Pointer spClone = this->doCloneControl(); this->copyProperties(_spOptimizer, spClone->getConcreteOptimizer()); ITKOptimizerControlInterface::Pointer spResult = spClone.GetPointer(); return spResult; }; template void ITKSVNLOptimizerControlBase:: copyProperties(const ConcreteOptimizerType* source, ConcreteOptimizerType* destination) const { destination->SetInitialPosition(source->GetInitialPosition()); destination->SetScales(source->GetScales()); }; template typename ITKSVNLOptimizerControlBase::OptimizerScalesType ITKSVNLOptimizerControlBase:: doGetScales() const { OptimizerScalesType result = _spOptimizer->GetScales(); return result; }; template ITKSVNLOptimizerControlBase:: ~ITKSVNLOptimizerControlBase() - { - } + = default; template ITKSVNLOptimizerControlBase:: ITKSVNLOptimizerControlBase() { _spOptimizer = ConcreteOptimizerType::New(); } } // end namespace itk } // end namespace algorithm } // end namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapITKSVNLOptimizerControlInterface.h b/Code/Algorithms/ITK/include/mapITKSVNLOptimizerControlInterface.h index 3e9de30..70438d5 100644 --- a/Code/Algorithms/ITK/include/mapITKSVNLOptimizerControlInterface.h +++ b/Code/Algorithms/ITK/include/mapITKSVNLOptimizerControlInterface.h @@ -1,100 +1,100 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_SVNL_OPTIMIZER_CONTROL_INTERFACE_H #define __ITK_SVNL_OPTIMIZER_CONTROL_INTERFACE_H #include "itkSingleValuedNonLinearOptimizer.h" #include "mapITKOptimizerControlInterface.h" namespace map { namespace algorithm { namespace itk { /*! @class ITKSVNLOptimizerControlInterface @brief Interface for controller classes that form a virtual wrapper around itk single valued non linear optimizers. This wrapper is used because stopping the optimizer is not covered by the polymorphic class design of itk::optimizer. Therefor there is no native and general way to stop an itk::optimizer or at least check if it can be stopped. @ingroup ITK */ class MAPAlgorithmsITK_EXPORT ITKSVNLOptimizerControlInterface : public ITKOptimizerControlInterface { public: - typedef ITKSVNLOptimizerControlInterface Self; - typedef ITKOptimizerControlInterface Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = ITKSVNLOptimizerControlInterface; + using Superclass = ITKOptimizerControlInterface; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(ITKSVNLOptimizerControlInterface, ITKOptimizerControlInterface); - typedef ::itk::SingleValuedNonLinearOptimizer SVNLOptimizerBaseType; - typedef SVNLOptimizerBaseType::MeasureType SVNLMeasureType; - typedef OptimizerControlInterface::OptimizerMeasureType OptimizerMeasureType; + using SVNLOptimizerBaseType = ::itk::SingleValuedNonLinearOptimizer; + using SVNLMeasureType = SVNLOptimizerBaseType::MeasureType; + using OptimizerMeasureType = OptimizerControlInterface::OptimizerMeasureType; virtual SVNLOptimizerBaseType* getSVNLOptimizer() = 0; virtual const SVNLOptimizerBaseType* getSVNLOptimizer() const = 0; /*! @brief gets the current value/cost of the optimizer iteration @eguarantee strong @return returns the optimizers current value/cost */ virtual SVNLMeasureType getCurrentMeasure() const; protected: ITKSVNLOptimizerControlInterface(); - virtual ~ITKSVNLOptimizerControlInterface(); + ~ITKSVNLOptimizerControlInterface() override; /*! return the cost of the current iteration step. Will be called by getCurrentValue() if hasCurrentValue() returns true. @eguarantee strong @return current measure */ virtual SVNLMeasureType doGetCurrentMeasure() const = 0; /*! Will be called to get the current value/cost of the optimizer iteration * calls doGetCurrentMeasure() and converts the result into the more general * OptimizerMeasureType. @eguarantee strong @return returns the optimizers current value/cost */ - virtual OptimizerMeasureType doGetCurrentValue() const; + OptimizerMeasureType doGetCurrentValue() const override; private: //No copy constructor allowed - ITKSVNLOptimizerControlInterface(const Self& source); - void operator=(const Self&); //purposely not implemented + ITKSVNLOptimizerControlInterface(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapITKSVNLOptimizerGetterInterface.h b/Code/Algorithms/ITK/include/mapITKSVNLOptimizerGetterInterface.h index 492bac4..96c3436 100644 --- a/Code/Algorithms/ITK/include/mapITKSVNLOptimizerGetterInterface.h +++ b/Code/Algorithms/ITK/include/mapITKSVNLOptimizerGetterInterface.h @@ -1,77 +1,77 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_SVNL_OPTIMIZER_GETTER_INTERFACE_H #define __ITK_SVNL_OPTIMIZER_GETTER_INTERFACE_H #include "itkOptimizer.h" #include "mapITKSVNLOptimizerControlInterface.h" namespace map { namespace algorithm { namespace facet { /*! @class ITKSVNLOptimizerGetterInterface * Interface inherited by every algorithm that is able to get or change (none const getter) an optimizer @ingroup AlgorithmFacets */ class MAPAlgorithmsITK_EXPORT ITKSVNLOptimizerGetterInterface { public: - typedef ITKSVNLOptimizerGetterInterface Self; + using Self = ITKSVNLOptimizerGetterInterface; - typedef algorithm::itk::ITKSVNLOptimizerControlInterface ITKOptimizerControlType; + using ITKOptimizerControlType = algorithm::itk::ITKSVNLOptimizerControlInterface; /*! @brief gets the optimizer @eguarantee no fail @return pointer to an OptimizerControlType object */ virtual ITKOptimizerControlType* getITKOptimizerControl() = 0; /*! @brief gets the optimizer @eguarantee no fail @return pointer to an OptimizerControlType object */ virtual const ITKOptimizerControlType* getITKOptimizerControl() const = 0; protected: - ITKSVNLOptimizerGetterInterface() {}; - virtual ~ITKSVNLOptimizerGetterInterface() {}; + ITKSVNLOptimizerGetterInterface() = default; + virtual ~ITKSVNLOptimizerGetterInterface() = default; private: //No copy constructor allowed - ITKSVNLOptimizerGetterInterface(const Self& source); - void operator=(const Self&); //purposely not implemented + ITKSVNLOptimizerGetterInterface(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapITKSVNLOptimizerSetterInterface.h b/Code/Algorithms/ITK/include/mapITKSVNLOptimizerSetterInterface.h index fdf0e1b..fcdf946 100644 --- a/Code/Algorithms/ITK/include/mapITKSVNLOptimizerSetterInterface.h +++ b/Code/Algorithms/ITK/include/mapITKSVNLOptimizerSetterInterface.h @@ -1,72 +1,72 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_OPTIMIZER_SETTER_INTERFACE_H #define __ITK_OPTIMIZER_SETTER_INTERFACE_H #include "itkOptimizer.h" #include "mapITKSVNLOptimizerControlInterface.h" namespace map { namespace algorithm { namespace facet { /*! @class ITKSVNLOptimizerSetterInterface * Interface inherited by every algorithm that is able to set or change (none const getter) an optimizer @ingroup AlgorithmFacets */ class MAPAlgorithmsITK_EXPORT ITKSVNLOptimizerSetterInterface { public: - typedef ITKSVNLOptimizerSetterInterface Self; + using Self = ITKSVNLOptimizerSetterInterface; - typedef algorithm::itk::ITKSVNLOptimizerControlInterface ITKOptimizerControlType; + using ITKOptimizerControlType = algorithm::itk::ITKSVNLOptimizerControlInterface; /*! sets the optimizer @eguarantee strong @param optimizer the optimizer */ virtual void setITKOptimizerControl(ITKOptimizerControlType* pOptimizer) = 0; protected: - ITKSVNLOptimizerSetterInterface() {}; - virtual ~ITKSVNLOptimizerSetterInterface() {}; + ITKSVNLOptimizerSetterInterface() = default; + virtual ~ITKSVNLOptimizerSetterInterface() = default; private: //No copy constructor allowed - ITKSVNLOptimizerSetterInterface(const Self& source); - void operator=(const Self&); //purposely not implemented + ITKSVNLOptimizerSetterInterface(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapITKTransformGetterInterface.h b/Code/Algorithms/ITK/include/mapITKTransformGetterInterface.h index f605758..5b4a8d1 100644 --- a/Code/Algorithms/ITK/include/mapITKTransformGetterInterface.h +++ b/Code/Algorithms/ITK/include/mapITKTransformGetterInterface.h @@ -1,77 +1,77 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_TRANSFORM_GETTER_INTERFACE_H #define __ITK_TRANSFORM_GETTER_INTERFACE_H #include "itkTransform.h" namespace map { namespace algorithm { namespace facet { /*! @class ITKTransformGetterInterface * Interface inherited by every algorithm that is able to get and change (by none const getter) an transform model @ingroup AlgorithmFacets */ template class ITKTransformGetterInterface { public: typedef ITKTransformGetterInterface Self; typedef ::itk::Transform TransformType; /*! @brief gets the transform @eguarantee no fail @return pointer to a TransformBaseType object */ virtual TransformType* getTransformModel() = 0; /*! @brief gets the transform @eguarantee no fail @return pointer to a TransformBaseType object */ virtual const TransformType* getTransformModel() const = 0; protected: ITKTransformGetterInterface() {}; virtual ~ITKTransformGetterInterface() {}; private: //No copy constructor allowed ITKTransformGetterInterface(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapITKTransformSetterInterface.h b/Code/Algorithms/ITK/include/mapITKTransformSetterInterface.h index d3b8f9b..6f70057 100644 --- a/Code/Algorithms/ITK/include/mapITKTransformSetterInterface.h +++ b/Code/Algorithms/ITK/include/mapITKTransformSetterInterface.h @@ -1,71 +1,71 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __ITK_TRANSFORM_SETTER_INTERFACE_H #define __ITK_TRANSFORM_SETTER_INTERFACE_H #include "itkTransform.h" namespace map { namespace algorithm { namespace facet { /*! @class ITKTransformSetterInterface * Interface inherited by every algorithm that is able to set and change (by none const getter) an transform model @ingroup AlgorithmFacets */ template class ITKTransformSetterInterface { public: typedef ITKTransformSetterInterface Self; typedef ::itk::Transform TransformType; /*! sets the transform @eguarantee strong @param pTransform the pTransform */ virtual void setTransformModel(TransformType* pTransform) = 0; protected: ITKTransformSetterInterface() {}; virtual ~ITKTransformSetterInterface() {}; private: //No copy constructor allowed ITKTransformSetterInterface(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace facet + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapSealedImageToImageMetricPolicy.h b/Code/Algorithms/ITK/include/mapSealedImageToImageMetricPolicy.h index 327335a..168347b 100644 --- a/Code/Algorithms/ITK/include/mapSealedImageToImageMetricPolicy.h +++ b/Code/Algorithms/ITK/include/mapSealedImageToImageMetricPolicy.h @@ -1,139 +1,139 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __SEALED_IMAGE_TO_IMAGE_METRIC_POLICY_H #define __SEALED_IMAGE_TO_IMAGE_METRIC_POLICY_H #include "mapITKMetricControl.h" #include "mapITKImageToImageMetricControlInterface.h" #include "itkCommand.h" namespace map { namespace algorithm { namespace itk { /*! @class SealedImageToImageMetricPolicy @brief class for SealedImageToImageMetricPolicy. This class is a SealedImageToImageMetricPolicy. It is used if an ITKImageRegistrationAlgorithm should have one specific metric type. With this policy the interpolator is never to be changed and sealed, so that the instance and its setting aren't public. @sa FixedImageToImageMetricPolicy @sa ArbitraryImageToImageMetricPolicy @ingroup ITKPolicies */ template class SealedImageToImageMetricPolicy { public: - typedef SealedImageToImageMetricPolicy Self; + using Self = SealedImageToImageMetricPolicy; - typedef TConcreteMetric ConcreteMetricType; - typedef ITKMetricControl ConcreteMetricControlType; - typedef typename ConcreteMetricControlType::Pointer ConcreteMetricControlPointer; + using ConcreteMetricType = TConcreteMetric; + using ConcreteMetricControlType = ITKMetricControl; + using ConcreteMetricControlPointer = typename ConcreteMetricControlType::Pointer; typedef ITKImageToImageMetricControlInterface MetricControlType; protected: SealedImageToImageMetricPolicy(); ~SealedImageToImageMetricPolicy(); /*! This is a command slot that can be used by any class derivering from this policy * to get informed if the component instances is changed. * @remark In the case of fixed policy (they don't allow the change of the instance, like this policy) * the command will invoke no event. The command is present because it is part of a general policy API that * allows policy using classes to interact in the same way with fixed and arbitrary policies. */ ::itk::Command::Pointer _spOnChange; /*! gets the internal metric @eguarantee strong @return a pointer to a metric type */ MetricControlType* getMetricInternal(); const MetricControlType* getMetricInternal() const; /*! gets the concrete interpolator @eguarantee strong @return a pointer to a ConcreteInterpolatorType object */ virtual const ConcreteMetricControlType* getConcreteMetricControl() const; /*! gets the concrete metric * @eguarantee strong * @return a pointer to a ConcreteMetricControlType object */ virtual ConcreteMetricControlType* getConcreteMetricControl(); /*! initializes the metric @eguarantee strong */ virtual void prepareMetric(); /*! initializes the metric * after it was integrated in a controlling structur (e.g. registration algorithm) @eguarantee strong */ virtual void prepareMetricAfterAssembly(); /*! Returns the modification time of the policy (and its controlled component). * In this case the modification time is a pass through of the internal component. @eguarantee strong @return the modification time */ virtual unsigned long GetMTime() const; /*! This method can be used to indicate modification of the policy. */ void indicateModification() const; private: ConcreteMetricControlPointer _spMetric; /*! The time stamp is used to signal changes of the policy that may effect the controlling structur (e.g. registration algorithm) * because the initialization is going to change the intern object (e.g. prepareMetric() will change the settings of the metric)*/ mutable ::itk::TimeStamp _mTime; //No copy constructor allowed SealedImageToImageMetricPolicy(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapSealedImageToImageMetricPolicy.tpp" #endif #endif diff --git a/Code/Algorithms/ITK/include/mapSealedImageToImageMetricPolicy.tpp b/Code/Algorithms/ITK/include/mapSealedImageToImageMetricPolicy.tpp index 5c807e4..c75ebc4 100644 --- a/Code/Algorithms/ITK/include/mapSealedImageToImageMetricPolicy.tpp +++ b/Code/Algorithms/ITK/include/mapSealedImageToImageMetricPolicy.tpp @@ -1,121 +1,121 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __SEALED_IMAGE_TO_IMAGE_METRIC_POLICY_TPP #define __SEALED_IMAGE_TO_IMAGE_METRIC_POLICY_TPP namespace map { namespace algorithm { namespace itk { template typename SealedImageToImageMetricPolicy::ConcreteMetricControlType* SealedImageToImageMetricPolicy:: getConcreteMetricControl() { return _spMetric; } template const typename SealedImageToImageMetricPolicy::ConcreteMetricControlType* SealedImageToImageMetricPolicy:: getConcreteMetricControl() const { return _spMetric; } template SealedImageToImageMetricPolicy:: SealedImageToImageMetricPolicy() { _spMetric = ConcreteMetricControlType::New(); } template SealedImageToImageMetricPolicy:: ~SealedImageToImageMetricPolicy() { } template typename SealedImageToImageMetricPolicy::MetricControlType* SealedImageToImageMetricPolicy:: getMetricInternal() { return _spMetric; } template const typename SealedImageToImageMetricPolicy::MetricControlType* SealedImageToImageMetricPolicy:: getMetricInternal() const { return _spMetric; } template void SealedImageToImageMetricPolicy:: prepareMetric() { //default implementation does nothing; } template void SealedImageToImageMetricPolicy:: prepareMetricAfterAssembly() { //default implementation does nothing; } template unsigned long SealedImageToImageMetricPolicy:: GetMTime() const { unsigned long mt = _mTime.GetMTime(); if (mt < _spMetric->GetMTime()) { mt = _spMetric->GetMTime(); } return mt; }; template void SealedImageToImageMetricPolicy:: indicateModification() const { _mTime.Modified(); }; - } + } // namespace itk } // end namespace algorithm } // end namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapSealedInterpolatorPolicy.h b/Code/Algorithms/ITK/include/mapSealedInterpolatorPolicy.h index d44a5a0..ffb6899 100644 --- a/Code/Algorithms/ITK/include/mapSealedInterpolatorPolicy.h +++ b/Code/Algorithms/ITK/include/mapSealedInterpolatorPolicy.h @@ -1,140 +1,140 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __SEALED_INTERPOLATOR_POLICY_H #define __SEALED_INTERPOLATOR_POLICY_H #include "itkInterpolateImageFunction.h" #include "itkCommand.h" namespace map { namespace algorithm { namespace itk { /*! @class SealedInterpolatorPolicy @brief class for SealedInterpolatorPolicy. This class is a SealedInterpolatorPolicy. It is used if an ITKImageRegistrationAlgorithm should have one specific interpolator type. With this policy the metric is never to be changed and sealed, so that the instance and its setting aren't public. @sa FixedInterpolatorPolicy @sa ArbitraryInterpolatorPolicy @ingroup ITKPolicies */ template class SealedInterpolatorPolicy { public: - typedef SealedInterpolatorPolicy Self; + using Self = SealedInterpolatorPolicy; - typedef TConcreteInterpolator ConcreteInterpolatorType; - typedef typename ConcreteInterpolatorType::Pointer ConcreteInterpolatorPointer; + using ConcreteInterpolatorType = TConcreteInterpolator; + using ConcreteInterpolatorPointer = typename ConcreteInterpolatorType::Pointer; typedef ::itk::InterpolateImageFunction InterpolatorType; - typedef typename ConcreteInterpolatorType::CoordRepType CoordRepType; + using CoordRepType = typename ConcreteInterpolatorType::CoordRepType; protected: SealedInterpolatorPolicy(); ~SealedInterpolatorPolicy(); /*! Returns the modification time of the policy (and its controlled component). * In this case the modification time is a pass through of the internal component. @eguarantee strong @return the modification time */ virtual unsigned long GetMTime() const; /*! This method can be used to indicate modification of the policy (calls _mTime.Modify()). */ void indicateModification() const; /*! This is a command slot that can be used by any class derivering from this policy * to get informed if the component instances is changed. * @remark In the case of fixed policy (they don't allow the change of the instance, like this policy) * the command will invoke no event. The command is present because it is part of a general policy API that * allows policy using classes to interact in the same way with fixed and arbitrary policies. */ ::itk::Command::Pointer _spOnChange; /*! gets the internal interpolator @eguarantee strong @return a pointer to an interpolator type */ InterpolatorType* getInterpolatorInternal(); const InterpolatorType* getInterpolatorInternal() const; /*! gets the concrete interpolator @eguarantee strong @return a pointer to a ConcreteInterpolatorType object */ const ConcreteInterpolatorType* getConcreteInterpolator() const; /*! gets the concrete interpolator * @eguarantee strong * @return a pointer to a ConcreteInterpolatorType object */ ConcreteInterpolatorType* getConcreteInterpolator(); /*! initializes the interpolator @eguarantee strong */ virtual void prepareInterpolator(); /*! initializes the interpolator * after it was integrated in a controlling structur (e.g. registration algorithm) @eguarantee strong */ virtual void prepareInterpolatorAfterAssembly(); private: /*! The time stamp is used to signal changes of the policy that may effect the controlling structur (e.g. registration algorithm) * because the initialization is going to change the intern object (e.g. prepareMetric() will change the settings of the metric)*/ mutable ::itk::TimeStamp _mTime; ConcreteInterpolatorPointer _spInterpolator; //No copy constructor allowed SealedInterpolatorPolicy(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapSealedInterpolatorPolicy.tpp" #endif #endif diff --git a/Code/Algorithms/ITK/include/mapSealedInterpolatorPolicy.tpp b/Code/Algorithms/ITK/include/mapSealedInterpolatorPolicy.tpp index 8d68ac6..42aa0ad 100644 --- a/Code/Algorithms/ITK/include/mapSealedInterpolatorPolicy.tpp +++ b/Code/Algorithms/ITK/include/mapSealedInterpolatorPolicy.tpp @@ -1,126 +1,126 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __SEALED_INTERPOLATOR_POLICY_TPP #define __SEALED_INTERPOLATOR_POLICY_TPP namespace map { namespace algorithm { namespace itk { template typename SealedInterpolatorPolicy::ConcreteInterpolatorType* SealedInterpolatorPolicy:: getConcreteInterpolator() { return _spInterpolator; }; template const typename SealedInterpolatorPolicy::ConcreteInterpolatorType* SealedInterpolatorPolicy:: getConcreteInterpolator() const { return _spInterpolator; }; template SealedInterpolatorPolicy:: SealedInterpolatorPolicy() { _spInterpolator = ConcreteInterpolatorType::New(); }; template SealedInterpolatorPolicy:: ~SealedInterpolatorPolicy() { }; template typename SealedInterpolatorPolicy::InterpolatorType* SealedInterpolatorPolicy:: getInterpolatorInternal() { return _spInterpolator; }; template const typename SealedInterpolatorPolicy::InterpolatorType* SealedInterpolatorPolicy:: getInterpolatorInternal() const { return _spInterpolator; }; template void SealedInterpolatorPolicy:: prepareInterpolator() { //default implementation does nothing; }; template void SealedInterpolatorPolicy:: prepareInterpolatorAfterAssembly() { //default implementation does nothing; }; template unsigned long SealedInterpolatorPolicy:: GetMTime() const { unsigned long mt = _mTime.GetMTime(); if (mt < _spInterpolator->GetMTime()) { mt = _spInterpolator->GetMTime(); } return mt; }; template void SealedInterpolatorPolicy:: indicateModification() const { _mTime.Modified(); }; - } + } // namespace itk } // end namespace algorithm } // end namespace map #endif diff --git a/Code/Algorithms/ITK/include/mapSealedOptimizerPolicy.h b/Code/Algorithms/ITK/include/mapSealedOptimizerPolicy.h index 921bf4f..8b69a9e 100644 --- a/Code/Algorithms/ITK/include/mapSealedOptimizerPolicy.h +++ b/Code/Algorithms/ITK/include/mapSealedOptimizerPolicy.h @@ -1,150 +1,150 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __SEALED_OPTIMIZER_POLICY_H #define __SEALED_OPTIMIZER_POLICY_H #include "mapITKOptimizerControl.h" #include "itkOptimizer.h" #include "itkCommand.h" namespace map { namespace algorithm { namespace itk { /*! @class SealedOptimizerPolicy @brief class for SealedOptimizerPolicy. This class is a SealedOptimizerPolicy. It is used if an ITKImageRegistrationAlgorithm should have one specific optimizer type. With this policy the optimizer is never to be changed and sealed, so that the instance and its setting aren't public. @sa FixedSVNLOptimizerPolicy @sa ArbitrarySVNLOptimizerPolicy @sa FixedMVNLOptimizerPolicy @sa ArbitraryMVNLOptimizerPolicy @ingroup ITKPolicies */ template class SealedOptimizerPolicy { public: - typedef SealedOptimizerPolicy Self; + using Self = SealedOptimizerPolicy; - typedef TConcreteOptimizer ConcreteOptimizerType; - typedef typename ConcreteOptimizerType::Pointer ConcreteOptimizerPointer; - typedef ::itk::Optimizer OptimizerType; - typedef ITKOptimizerControl ConcreteOptimizerControlType; - typedef typename ConcreteOptimizerControlType::Pointer ConcreteOptimizerControlPointer; - typedef typename ConcreteOptimizerControlType::BaseInterfaceType InternalOptimizerControlType; + using ConcreteOptimizerType = TConcreteOptimizer; + using ConcreteOptimizerPointer = typename ConcreteOptimizerType::Pointer; + using OptimizerType = ::itk::Optimizer; + using ConcreteOptimizerControlType = ITKOptimizerControl; + using ConcreteOptimizerControlPointer = typename ConcreteOptimizerControlType::Pointer; + using InternalOptimizerControlType = typename ConcreteOptimizerControlType::BaseInterfaceType; protected: SealedOptimizerPolicy(); ~SealedOptimizerPolicy(); /*! This is a command slot that can be used by any class deriving from this policy * to get informed if the component instances is changed. * @remark In the case of fixed policy (they don't allow the change of the instance, like this policy) * the command will invoke no event. The command is present because it is part of a general policy API that * allows policy using classes to interact in the same way with fixed and arbitrary policies. */ ::itk::Command::Pointer _spOnChange; /*! gets the internal optimizer @eguarantee strong @return a pointer to an OptimizerType object */ InternalOptimizerControlType* getOptimizerInternal(); const InternalOptimizerControlType* getOptimizerInternal() const; /*! gets the concrete optimizer control * @eguarantee strong * @return a pointer to a ConcreteOptimizerControlType object */ ConcreteOptimizerControlType* getConcreteOptimizerControl(); /*! gets the concrete optimizer control * @eguarantee strong * @return a pointer to a ConcreteOptimizerControlType object */ const ConcreteOptimizerControlType* getConcreteOptimizerControl() const; /*! gets the concrete wrapped optimizer * @eguarantee strong * @return a pointer to a ConcreteOptimizerType object */ ConcreteOptimizerType* getConcreteITKOptimizer(); /*! gets a concrete optimizer @eguarantee strong @return a pointer to a ConcreteOptimizerType object */ const ConcreteOptimizerType* getConcreteITKOptimizer() const; /*! initializes the optimizer Reimplement if you want to change the initialization of the optimizer in an algorithm. The default implementation does nothing. @eguarantee strong */ virtual void prepareOptimizer(); /*! initializes the optimizer * after it was integrated in a controlling structure (e.g. registration algorithm) @eguarantee strong */ virtual void prepareOptimizerAfterAssembly(bool minimizeToOptimize); /*! Returns the modification time of the policy (and its controlled component). * In this case the modification time is a pass through of the internal component. @eguarantee strong @return the modification time */ virtual unsigned long GetMTime() const; /*! This method can be used to indicate modification of the policy. */ void indicateModification() const; private: /*! The time stamp is used to signal changes of the policy that may effect the controlling structur (e.g. registration algorithm) * because the initialization is going to change the intern object (e.g. prepareOptimizer() will change the settings of the optimizer)*/ mutable ::itk::TimeStamp _mTime; ConcreteOptimizerControlPointer _spOptimizerControl; //No copy constructor allowed SealedOptimizerPolicy(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapSealedOptimizerPolicy.tpp" #endif #endif diff --git a/Code/Algorithms/ITK/include/mapSealedTransformPolicy.h b/Code/Algorithms/ITK/include/mapSealedTransformPolicy.h index 08e7f6e..2033d1b 100644 --- a/Code/Algorithms/ITK/include/mapSealedTransformPolicy.h +++ b/Code/Algorithms/ITK/include/mapSealedTransformPolicy.h @@ -1,139 +1,139 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __SEALED_TRANSFORM_POLICY_H #define __SEALED_TRANSFORM_POLICY_H #include "itkCommand.h" #include "itkTransform.h" namespace map { namespace algorithm { namespace itk { /*! @class SealedTransformPolicy @brief class for SealedTransformPolicy. This class is a SealedTransformPolicy. It is used if an ITKImageRegistrationAlgorithm should have one specific transform model type. With this policy the transform model is never to be changed and sealed, so that the instance and its setting aren't public. @sa ArbitraryTransformPolicy @sa FixedTransformPolicy @ingroup ITKPolicies */ template class SealedTransformPolicy { public: - typedef SealedTransformPolicy Self; + using Self = SealedTransformPolicy; - typedef TConcreteITKTransform ConcreteTransformType; - typedef typename ConcreteTransformType::Pointer ConcreteTransformPointer; + using ConcreteTransformType = TConcreteITKTransform; + using ConcreteTransformPointer = typename ConcreteTransformType::Pointer; typedef ::itk::Transform TransformType; - typedef typename TransformType::ScalarType TransformScalarType; + using TransformScalarType = typename TransformType::ScalarType; protected: SealedTransformPolicy(); ~SealedTransformPolicy(); /*! This is a command slot that can be used by any class derivering from this policy * to get informed if the component instances is changed. * @remark In the case of fixed policy (they don't allow the change of the instance, like this policy) * the command will invoke no event. The command is present because it is part of a general policy API that * allows policy using classes to interact in the same way with fixed and arbitrary policies. */ ::itk::Command::Pointer _spOnChange; /*! gets the internal transform @eguarantee strong @return a pointer to an transform type */ TransformType* getTransformInternal(); const TransformType* getTransformInternal() const; /*! gets the concrete transform * @eguarantee strong * @return a pointer to a ConcreteTransformType object */ ConcreteTransformType* getConcreteTransformModel(); /*! gets the concrete transform @eguarantee strong @return a pointer to a ConcreteTransformType object */ const ConcreteTransformType* getConcreteTransformModel() const; /*! initializes the transform @eguarantee strong */ virtual void prepareTransform(); /*! initializes the transform * after it was integrated in a controlling structur (e.g. registration algorithm) @eguarantee strong */ virtual void prepareTransformAfterAssembly(); /*! Returns the modification time of the policy (and its controlled component). * In this case the modification time is a pass through of the internal component. @eguarantee strong @return the modification time */ virtual unsigned long GetMTime() const; /*! This method can be used to indicate modification of the policy. */ void indicateModification() const; private: /*! The time stamp is used to signal changes of the policy that may effect the controlling structur (e.g. registration algorithm) * because the controlled object has changed.*/ mutable ::itk::TimeStamp _mTime; ConcreteTransformPointer _spTransformModel; //No copy constructor allowed SealedTransformPolicy(const Self& source); void operator=(const Self&); //purposely not implemented }; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapSealedTransformPolicy.tpp" #endif #endif diff --git a/Code/Algorithms/ITK/source/mapArbitraryMVNLOptimizerPolicy.cpp b/Code/Algorithms/ITK/source/mapArbitraryMVNLOptimizerPolicy.cpp index 18d6e3f..e95fbb6 100644 --- a/Code/Algorithms/ITK/source/mapArbitraryMVNLOptimizerPolicy.cpp +++ b/Code/Algorithms/ITK/source/mapArbitraryMVNLOptimizerPolicy.cpp @@ -1,155 +1,154 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapArbitraryMVNLOptimizerPolicy.h" #include "mapAlgorithmEvents.h" namespace map { namespace algorithm { namespace itk { unsigned long ArbitraryMVNLOptimizerPolicy:: GetMTime() const { unsigned long mt = _mTime.getMTime(); return mt; }; void ArbitraryMVNLOptimizerPolicy:: setAutomaticOptimizationDirection(bool automatic) { _automaticOptimizationDirection = automatic; }; bool ArbitraryMVNLOptimizerPolicy:: getAutomaticOptimizationDirection() const { return _automaticOptimizationDirection; }; void ArbitraryMVNLOptimizerPolicy:: setITKOptimizerControl(ITKOptimizerControlType* pOptimizer) { if (pOptimizer != _spOptimizerControl.GetPointer()) { //there is really the need to change the optimizer if (this->_spOnChange.IsNotNull()) { ::map::events::UnregisterAlgorithmComponentEvent unRegEvent(_spOptimizerControl.GetPointer(), "Unregister current optimizer"); - this->_spOnChange->Execute((::itk::Object*)NULL, unRegEvent); + this->_spOnChange->Execute((::itk::Object*)nullptr, unRegEvent); } _mTime.setWatchedObject(pOptimizer); _spOptimizerControl = pOptimizer; if (this->_spOnChange.IsNotNull()) { ::map::events::RegisterAlgorithmComponentEvent regEvent(_spOptimizerControl.GetPointer(), "Register new optimizer"); - this->_spOnChange->Execute((::itk::Object*)NULL, regEvent); + this->_spOnChange->Execute((::itk::Object*)nullptr, regEvent); } } }; ArbitraryMVNLOptimizerPolicy:: - ArbitraryMVNLOptimizerPolicy() : _automaticOptimizationDirection(true) + ArbitraryMVNLOptimizerPolicy() { }; ArbitraryMVNLOptimizerPolicy:: ~ArbitraryMVNLOptimizerPolicy() - { - }; + = default; ArbitraryMVNLOptimizerPolicy::ITKOptimizerControlType* ArbitraryMVNLOptimizerPolicy:: getOptimizerInternal() { return _spOptimizerControl; } const ArbitraryMVNLOptimizerPolicy::ITKOptimizerControlType* ArbitraryMVNLOptimizerPolicy:: getOptimizerInternal() const { return _spOptimizerControl; } ArbitraryMVNLOptimizerPolicy::ITKOptimizerControlType* ArbitraryMVNLOptimizerPolicy:: getITKOptimizerControl() { return _spOptimizerControl; } const ArbitraryMVNLOptimizerPolicy::ITKOptimizerControlType* ArbitraryMVNLOptimizerPolicy:: getITKOptimizerControl() const { return _spOptimizerControl; } ArbitraryMVNLOptimizerPolicy::OptimizerControlType* ArbitraryMVNLOptimizerPolicy:: getOptimizerControl() { return _spOptimizerControl; } const ArbitraryMVNLOptimizerPolicy::OptimizerControlType* ArbitraryMVNLOptimizerPolicy:: getOptimizerControl() const { return _spOptimizerControl; } void ArbitraryMVNLOptimizerPolicy:: prepareOptimizer() { //default implementation does nothing; }; void ArbitraryMVNLOptimizerPolicy:: prepareOptimizerAfterAssembly(bool minimizeToOptimize) { if (_automaticOptimizationDirection) { _spOptimizerControl->setMinimize(minimizeToOptimize); } }; - } - } -} \ No newline at end of file + } // namespace itk + } // namespace algorithm +} // namespace map \ No newline at end of file diff --git a/Code/Algorithms/ITK/source/mapArbitrarySVNLOptimizerPolicy.cpp b/Code/Algorithms/ITK/source/mapArbitrarySVNLOptimizerPolicy.cpp index b442be6..90a1cb9 100644 --- a/Code/Algorithms/ITK/source/mapArbitrarySVNLOptimizerPolicy.cpp +++ b/Code/Algorithms/ITK/source/mapArbitrarySVNLOptimizerPolicy.cpp @@ -1,155 +1,154 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapArbitrarySVNLOptimizerPolicy.h" #include "mapAlgorithmEvents.h" namespace map { namespace algorithm { namespace itk { unsigned long ArbitrarySVNLOptimizerPolicy:: GetMTime() const { unsigned long mt = _mTime.getMTime(); return mt; }; void ArbitrarySVNLOptimizerPolicy:: setAutomaticOptimizationDirection(bool automatic) { _automaticOptimizationDirection = automatic; }; bool ArbitrarySVNLOptimizerPolicy:: getAutomaticOptimizationDirection() const { return _automaticOptimizationDirection; }; void ArbitrarySVNLOptimizerPolicy:: setITKOptimizerControl(ITKOptimizerControlType* pOptimizer) { if (pOptimizer != _spOptimizerControl.GetPointer()) { //there is really the need to change the optimizer if (this->_spOnChange.IsNotNull()) { ::map::events::UnregisterAlgorithmComponentEvent unRegEvent(_spOptimizerControl.GetPointer(), "Unregister current optimizer"); - this->_spOnChange->Execute((::itk::Object*)NULL, unRegEvent); + this->_spOnChange->Execute((::itk::Object*)nullptr, unRegEvent); } _mTime.setWatchedObject(pOptimizer); _spOptimizerControl = pOptimizer; if (this->_spOnChange.IsNotNull()) { ::map::events::RegisterAlgorithmComponentEvent regEvent(_spOptimizerControl.GetPointer(), "Register new optimizer"); - this->_spOnChange->Execute((::itk::Object*)NULL, regEvent); + this->_spOnChange->Execute((::itk::Object*)nullptr, regEvent); } } }; ArbitrarySVNLOptimizerPolicy:: - ArbitrarySVNLOptimizerPolicy() : _automaticOptimizationDirection(true) + ArbitrarySVNLOptimizerPolicy() { }; ArbitrarySVNLOptimizerPolicy:: ~ArbitrarySVNLOptimizerPolicy() - { - }; + = default; ArbitrarySVNLOptimizerPolicy::ITKOptimizerControlType* ArbitrarySVNLOptimizerPolicy:: getOptimizerInternal() { return _spOptimizerControl; } const ArbitrarySVNLOptimizerPolicy::ITKOptimizerControlType* ArbitrarySVNLOptimizerPolicy:: getOptimizerInternal() const { return _spOptimizerControl; } ArbitrarySVNLOptimizerPolicy::ITKOptimizerControlType* ArbitrarySVNLOptimizerPolicy:: getITKOptimizerControl() { return _spOptimizerControl; } const ArbitrarySVNLOptimizerPolicy::ITKOptimizerControlType* ArbitrarySVNLOptimizerPolicy:: getITKOptimizerControl() const { return _spOptimizerControl; } ArbitrarySVNLOptimizerPolicy::OptimizerControlType* ArbitrarySVNLOptimizerPolicy:: getOptimizerControl() { return _spOptimizerControl; } const ArbitrarySVNLOptimizerPolicy::OptimizerControlType* ArbitrarySVNLOptimizerPolicy:: getOptimizerControl() const { return _spOptimizerControl; } void ArbitrarySVNLOptimizerPolicy:: prepareOptimizer() { //default implementation does nothing; }; void ArbitrarySVNLOptimizerPolicy:: prepareOptimizerAfterAssembly(bool minimizeToOptimize) { if (_automaticOptimizationDirection) { _spOptimizerControl->setMinimize(minimizeToOptimize); } }; - } - } -} \ No newline at end of file + } // namespace itk + } // namespace algorithm +} // namespace map \ No newline at end of file diff --git a/Code/Algorithms/ITK/source/mapITKMVMetricControlInterface.cpp b/Code/Algorithms/ITK/source/mapITKMVMetricControlInterface.cpp index f7dd216..44e9063 100644 --- a/Code/Algorithms/ITK/source/mapITKMVMetricControlInterface.cpp +++ b/Code/Algorithms/ITK/source/mapITKMVMetricControlInterface.cpp @@ -1,47 +1,45 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapITKMVMetricControlInterface.h" namespace map { namespace algorithm { namespace itk { ITKMVMetricControlInterface:: ITKMVMetricControlInterface() - { - }; + = default; ITKMVMetricControlInterface:: ~ITKMVMetricControlInterface() - { - }; + = default; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map diff --git a/Code/Algorithms/ITK/source/mapITKMVNLOptimizerControlInterface.cpp b/Code/Algorithms/ITK/source/mapITKMVNLOptimizerControlInterface.cpp index 7c6525a..b112232 100644 --- a/Code/Algorithms/ITK/source/mapITKMVNLOptimizerControlInterface.cpp +++ b/Code/Algorithms/ITK/source/mapITKMVNLOptimizerControlInterface.cpp @@ -1,77 +1,75 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapITKMVNLOptimizerControlInterface.h" namespace map { namespace algorithm { namespace itk { ITKMVNLOptimizerControlInterface::MVNLMeasureType ITKMVNLOptimizerControlInterface:: getCurrentMeasure() const { MVNLMeasureType result; if (this->hasCurrentValue()) { result = this->doGetCurrentMeasure(); } return result; }; ITKMVNLOptimizerControlInterface::OptimizerMeasureType ITKMVNLOptimizerControlInterface:: doGetCurrentValue() const { OptimizerMeasureType result; MVNLMeasureType measure = this->doGetCurrentMeasure(); - for (MVNLMeasureType::iterator pos = measure.begin(); pos != measure.end(); ++pos) + for (double & pos : measure) { - result.push_back(*pos); + result.push_back(pos); } return result; }; ITKMVNLOptimizerControlInterface:: ITKMVNLOptimizerControlInterface() - { - }; + = default; ITKMVNLOptimizerControlInterface:: ~ITKMVNLOptimizerControlInterface() - { - }; + = default; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map diff --git a/Code/Algorithms/ITK/source/mapITKMetricControlInterface.cpp b/Code/Algorithms/ITK/source/mapITKMetricControlInterface.cpp index 13ccca3..459fedc 100644 --- a/Code/Algorithms/ITK/source/mapITKMetricControlInterface.cpp +++ b/Code/Algorithms/ITK/source/mapITKMetricControlInterface.cpp @@ -1,46 +1,44 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapITKMetricControlInterface.h" namespace map { namespace algorithm { namespace itk { ITKMetricControlInterface:: ITKMetricControlInterface() - { - }; + = default; ITKMetricControlInterface:: ~ITKMetricControlInterface() - { - }; + = default; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map diff --git a/Code/Algorithms/ITK/source/mapITKOptimizerControlInterface.cpp b/Code/Algorithms/ITK/source/mapITKOptimizerControlInterface.cpp index cccf951..a3ef41e 100644 --- a/Code/Algorithms/ITK/source/mapITKOptimizerControlInterface.cpp +++ b/Code/Algorithms/ITK/source/mapITKOptimizerControlInterface.cpp @@ -1,54 +1,52 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapITKOptimizerControlInterface.h" namespace map { namespace algorithm { namespace itk { - const core::String + const core::String ITKOptimizerControlInterface:: getStopConditionDescription() const { return this->getOptimizer()->GetStopConditionDescription(); }; ITKOptimizerControlInterface:: ITKOptimizerControlInterface() - { - }; + = default; ITKOptimizerControlInterface:: ~ITKOptimizerControlInterface() - { - }; + = default; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map diff --git a/Code/Algorithms/ITK/source/mapITKSVMetricControlInterface.cpp b/Code/Algorithms/ITK/source/mapITKSVMetricControlInterface.cpp index 057c356..dd92536 100644 --- a/Code/Algorithms/ITK/source/mapITKSVMetricControlInterface.cpp +++ b/Code/Algorithms/ITK/source/mapITKSVMetricControlInterface.cpp @@ -1,47 +1,45 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapITKSVMetricControlInterface.h" namespace map { namespace algorithm { namespace itk { ITKSVMetricControlInterface:: ITKSVMetricControlInterface() - { - }; + = default; ITKSVMetricControlInterface:: ~ITKSVMetricControlInterface() - { - }; + = default; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map diff --git a/Code/Algorithms/ITK/source/mapITKSVNLOptimizerControlInterface.cpp b/Code/Algorithms/ITK/source/mapITKSVNLOptimizerControlInterface.cpp index 154f9a3..510769b 100644 --- a/Code/Algorithms/ITK/source/mapITKSVNLOptimizerControlInterface.cpp +++ b/Code/Algorithms/ITK/source/mapITKSVNLOptimizerControlInterface.cpp @@ -1,74 +1,72 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapITKSVNLOptimizerControlInterface.h" namespace map { namespace algorithm { namespace itk { ITKSVNLOptimizerControlInterface::SVNLMeasureType ITKSVNLOptimizerControlInterface:: getCurrentMeasure() const { SVNLMeasureType result; if (this->hasCurrentValue()) { result = this->doGetCurrentMeasure(); } return result; }; ITKSVNLOptimizerControlInterface::OptimizerMeasureType ITKSVNLOptimizerControlInterface:: doGetCurrentValue() const { OptimizerMeasureType result; SVNLMeasureType measure = this->doGetCurrentMeasure(); result.push_back(measure); return result; }; ITKSVNLOptimizerControlInterface:: ITKSVNLOptimizerControlInterface() - { - }; + = default; ITKSVNLOptimizerControlInterface:: ~ITKSVNLOptimizerControlInterface() - { - }; + = default; - } - } -} + } // namespace itk + } // namespace algorithm +} // namespace map diff --git a/Code/Algorithms/Plastimatch/include/mapPlmAlgorithmHelper.h b/Code/Algorithms/Plastimatch/include/mapPlmAlgorithmHelper.h index c925159..83f9e39 100644 --- a/Code/Algorithms/Plastimatch/include/mapPlmAlgorithmHelper.h +++ b/Code/Algorithms/Plastimatch/include/mapPlmAlgorithmHelper.h @@ -1,85 +1,85 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_PLM_ALGORITHM_HELPER_H #define __MAP_PLM_ALGORITHM_HELPER_H //MatchPoint #include "mapContinuous.h" #include "mapString.h" #include "mapConvert.h" #include "mapMAPAlgorithmsPlastimatchExports.h" namespace map { namespace algorithm { namespace plastimatch { - typedef core::String ParameterValueType; - typedef core::String ParameterNameType; - typedef std::vector ParameterValuesType; + using ParameterValueType = core::String; + using ParameterNameType = core::String; + using ParameterValuesType = std::vector; typedef std::map ParameterStageType; - typedef std::vector ConfigurationType; + using ConfigurationType = std::vector; /**! Helper function that stores the passed configuration to the given file path. If the file already exists it is overwritten. The configuration is stored in the plastimatch format: "= [ [...]]).\n It is assumed that the first element of the configuration is the global configuration. All other elements are the stages settings. @pre param config must have at least to elements (global and stage 1).*/ MAPAlgorithmsPlastimatch_EXPORT void saveConfigurationToFile(const ConfigurationType& config, const map::core::String& fileName); /**! Helper function that loads a configuration from a given file path.*/ MAPAlgorithmsPlastimatch_EXPORT ConfigurationType loadConfigurationFromFile( const map::core::String& fileName); class MAPAlgorithmsPlastimatch_EXPORT ParamGenerator { public: ParamGenerator(); ~ParamGenerator(); template ParamGenerator& add(const TElement& value) { this->_values.push_back(::map::core::convert::toStrGeneric(value)); return *this; }; operator ParameterValuesType(); protected: ParameterValuesType _values; }; - } - } -} + } // namespace plastimatch + } // namespace algorithm +} // namespace map #endif diff --git a/Code/Algorithms/Plastimatch/include/mapPlmCLIRegistrationAlgorithmBase.h b/Code/Algorithms/Plastimatch/include/mapPlmCLIRegistrationAlgorithmBase.h index a60c628..a048b43 100644 --- a/Code/Algorithms/Plastimatch/include/mapPlmCLIRegistrationAlgorithmBase.h +++ b/Code/Algorithms/Plastimatch/include/mapPlmCLIRegistrationAlgorithmBase.h @@ -1,425 +1,425 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_PLM_CLI_REGISTRATION_ALGORITHM_BASE_H #define __MAP_PLM_CLI_REGISTRATION_ALGORITHM_BASE_H //MatchPoint #include "mapContinuous.h" #include "mapIterativeRegistrationAlgorithm.h" #include "mapImageRegistrationAlgorithmBase.h" #include "mapClassMacros.h" #include "mapPlmAlgorithmHelper.h" #include "mapMetaPropertyAlgorithmBase.h" #include "mapMaskedRegistrationAlgorithmBase.h" #include "mapPointSetRegistrationAlgorithmInterfaceV2.h" #include "mapGenericVectorFieldTransform.h" namespace map { namespace algorithm { namespace plastimatch { /*! @class CLIRegistrationAlgorithmBase @brief This is the base class for algorithms that serve as a wrapper for the registration tool "plastimatch". The algorithm is a very simple wrapper using a command line interface to facilitate plastimatch. For a registration task a temporary working directory is generated, where the algorithm stores the given moving and target image. Then the algorithms calls 'plastimatch' with appropriated command line arguments to trigger the registration as an external process and to produce a deformation field as output. This field will be loaded, converted into a MatchPoint registration object and returned. After the registration job is done, the temporary directory will be deleted by the algorithm. @remark @ingroup Algorithms @ingroup Plastimatch */ template class CLIRegistrationAlgorithmBase : public IterativeRegistrationAlgorithm, public ImageRegistrationAlgorithmBase, public MetaPropertyAlgorithmBase, public MaskedRegistrationAlgorithmBase, public facet::PointSetRegistrationAlgorithmInterfaceV2, public TIdentificationPolicy { public: typedef CLIRegistrationAlgorithmBase Self; typedef IterativeRegistrationAlgorithm Superclass; typedef ::itk::SmartPointer Pointer; typedef ::itk::SmartPointer ConstPointer; itkTypeMacro(CLIRegistrationAlgorithmBase, IterativeRegistrationAlgorithm); typedef typename Superclass::UIDType UIDType; typedef typename Superclass::UIDPointer UIDPointer; typedef typename IterativeRegistrationAlgorithm::OptimizerMeasureType OptimizerMeasureType; typedef ImageRegistrationAlgorithmBase ImageRegistrationAlgorithmBaseType; typedef typename ImageRegistrationAlgorithmBaseType::TargetImageType TargetImageType; typedef typename ImageRegistrationAlgorithmBaseType::MovingImageType MovingImageType; typedef typename Superclass::MovingRepresentationDescriptorType MovingRepresentationDescriptorType; typedef typename Superclass::TargetRepresentationDescriptorType TargetRepresentationDescriptorType; typedef typename Superclass::RegistrationPointer RegistrationPointer; typedef typename Superclass::RegistrationType RegistrationType; typedef typename Superclass::FieldRepRequirement FieldRepRequirement; typedef facet::PointSetRegistrationAlgorithmInterfaceV2 PointSetInterfaceType; typedef typename PointSetInterfaceType::MovingPointSetConstPointer MovingPointSetConstPointer; typedef typename PointSetInterfaceType::TargetPointSetConstPointer TargetPointSetConstPointer; typedef typename PointSetInterfaceType::SlotIndexType SlotIndexType; typedef typename PointSetInterfaceType::MovingPointSetType MovingPointSetType; typedef typename PointSetInterfaceType::TargetPointSetType TargetPointSetType; typedef typename MetaPropertyAlgorithmBase::MetaPropertyType MetaPropertyType; typedef typename MetaPropertyAlgorithmBase::MetaPropertyPointer MetaPropertyPointer; typedef typename MetaPropertyAlgorithmBase::MetaPropertyNameType MetaPropertyNameType; mapDefineAlgorithmIdentificationByPolicyMacro; // IterativeRegistrationAlgorithm /*! @eguarantee strong*/ virtual bool isStoppable() const; /*! has the algorithm an iteration count? @eguarantee no fail @return Indicates if the algorithm can determin its current iteration count */ virtual bool hasIterationCount() const; /*! has the algorithm an maximum iteration count? @eguarantee no fail @return Indicates if the algorithm can determin its maximum iteration count */ virtual bool hasMaxIterationCount() const; /*! This function indicates if the optimizer of the iterative registration algorithm is * able to return its current metric/optimizer value(s)? @eguarantee no fail @return Indicates if the algorithm can determin its curent value. */ virtual bool hasCurrentOptimizerValue() const; virtual typename FieldRepRequirement::Type isMovingRepresentationRequired() const; virtual typename FieldRepRequirement::Type isTargetRepresentationRequired() const; /*! @reimplemented */ virtual bool isReusable() const; mapGetMetaMacro(WorkingDirectory, core::String); mapSetMetaMacro(WorkingDirectory, core::String); mapGetMetaMacro(PlastimatchDirectory, core::String); mapSetMetaMacro(PlastimatchDirectory, core::String); mapGetMetaMacro(DeleteTempDirectory, bool); mapSetMetaMacro(DeleteTempDirectory, bool); virtual bool hasCoupledPointSetInputs() const override { return true; }; virtual bool isOptionalTargetPointSet(SlotIndexType index) const override { return true; }; virtual bool isOptionalMovingPointSet(SlotIndexType index) const override { return true; }; virtual SlotIndexType getTargetPointSetCount(bool onlyMandatory = false) const override { if (onlyMandatory) return 0; return 1; }; virtual SlotIndexType getMovingPointSetCount(bool onlyMandatory = false) const override { if (onlyMandatory) return 0; return 1; }; virtual unsigned long getNthTargetPointSetMTime(SlotIndexType index) const override; virtual unsigned long getNthMovingPointSetMTime(SlotIndexType index) const override; protected: CLIRegistrationAlgorithmBase(); virtual ~CLIRegistrationAlgorithmBase(); typedef typename Superclass::InterimRegistrationType InterimRegistrationType; typedef typename Superclass::InterimRegistrationPointer InterimRegistrationPointer; typedef typename Superclass::IterationCountType IterationCountType; typedef typename ImageRegistrationAlgorithmBaseType::MovingImageConstPointer MovingImageConstPointer; typedef typename ImageRegistrationAlgorithmBaseType::TargetImageConstPointer TargetImageConstPointer; typedef ::itk::GenericVectorFieldTransform< ::map::core::continuous::ScalarType, TTargetImage::ImageDimension, TTargetImage::ImageDimension> FieldTransformType; typedef typename map::core::RegistrationTopology::InverseFieldType FinalFieldType; typedef typename FinalFieldType::Pointer FinalFieldPointer; /* @reimplemented*/ virtual void configureAlgorithm(); // MetaPropertyAlgorithmBase /*! @reimplemented*/ virtual void compileInfos(MetaPropertyVectorType& infos) const; /*! @reimplemented*/ virtual MetaPropertyPointer doGetProperty(const MetaPropertyNameType& name) const; /*! @reimplemented*/ virtual void doSetProperty(const MetaPropertyNameType& name, const MetaPropertyType* pProperty); // IterativeRegistrationAlgorithmInterface /*! @brief gets the registration result that has been computed in the last iteration. This result is limited by the passed region descriptors (pMovingRepresentation, pTargetRepresentation). @pre pMovingRepresentation and pTargetRepresentation must not be null. @param [in] pMovingRepresentation Pointer to @eguarantee strong @return the interim registration result as smart pointer @retval a Registration object @sa Registration */ virtual InterimRegistrationPointer determineInterimRegistration(const MovingRepresentationDescriptorType* pMovingRepresentation, const TargetRepresentationDescriptorType* pTargetRepresentation) const; /*! * Returns the final registration @eguarantee strong */ virtual RegistrationPointer doGetRegistration() const; /*! Returns if the registration should be computed. The registration is outdated if doGetRegistration returns null * or the modification time of at least one sub component is newer then the modification time of the registration. @eguarantee strong @return true if the registration should be (re)computed. False if the registration is uptodate. */ virtual bool registrationIsOutdated() const; virtual bool doStopAlgorithm(); /*! This method should do all preparation tasks right before the algorithm is executed. At the end of this method the algorithm should be set up and ready to use.\n The method delegates the main work of initialization to several sub methods. These sub methods serve as slots that can be rewritten by an algorithm developer to alter certain aspects and keep the rest untouched.\n The sequence of slot calls is: \n - prepCheckValidity - prepPerpareInternalInputData - prepSavePlastimatchInputData - prepParameterMaps - prepFinalizePreparation @remark If you want to change the execution style, then overwrite runAlgorithm(). @eguarantee strong*/ virtual void prepareAlgorithm(); /*! This method is the slot to check if all internal components and input data are properly set. @remark The default implementation checks the moving and target image. Overload this method to alter the validity check. @remark It is assumed that the implementation of this method throws an exception if the algorithm is not configured correctly.*/ virtual void prepCheckValidity(); /*! This method is the slot for internal preprocessing of input data. This method should be reimplemented if you want to prepare the input data before they go into the internal registration method. E.g. blurring or normalizing the moving and target image before registration. @remark The default implementation does nothing. Thus the public input data will be the data used by the internal algorithm. @remark Implementations of this method should work on _spInternalMoving and _spInternalTargetImage. In the default implementation of prepSetInternalInputData() these member will be passed to the internal algorithm. @eguarantee strong*/ virtual void prepPerpareInternalInputData(); /*! This method is the slot for storing the relevant input data to the working directory of plastimatch. * @remark The default implementation stores _spInternalMoving and _spInternalTargetImage and the masks if set. @eguarantee strong */ virtual void prepSavePlastimatchInputData(); /*! This method is the slot for the generation of the configuration that should be passed to plastimatch. The base class assumes that after calling this methods the member _configurationPLM contains all parameters for all stages. @eguarantee strong */ virtual void prepConfigurationPLM() = 0; /*! This method is used after preConfifurationPLM() to ensure that parameters for input images, masks and resulting vector field are correctly set. If the parameters are already set, they will be overwritten. In addition the function removes all settings for the output of result images or xform (they are deactivated). @eguarantee strong */ void ensureCorrectGlobalConfigSettings(); /*! This method should just execute the iteration loop. * @remark If you want to change the initialization or the finalization, then overwrite prepareIteration() or finalizeAlgorithm(). * @return Indicates if the registration was successfully determined (e.g. could be * false if an iterative algorithm was stopped prematurely by the user). * @eguarantee strong */ virtual bool runAlgorithm(); /*! This method should do all the finalization work (e.g. generating the registration based on the iteration results). * @remark If you want to change the initialization or the iteration, then overwrite prepareIteration() or iterateAlgorithm(). @eguarantee strong */ virtual void finalizeAlgorithm(); /*! return the optimizer value(s) of the current iteration step. Will be called by getCurrentOptimizerValue() if hasCurrentValue() returns true. @eguarantee strong @return current measure */ virtual OptimizerMeasureType doGetCurrentOptimizerValue() const; /*! Methods invoked by derivated classes. */ virtual void PrintSelf(std::ostream& os, ::itk::Indent indent) const; /*! Feature is not supported by this wrapper. Therefore the methods returns only a dummy value (0). * @eguarantee strong*/ virtual IterationCountType doGetCurrentIteration() const; /*! Feature is not supported by this wrapper. Therefore the methods returns only a dummy value (0). @eguarantee strong */ virtual IterationCountType doGetMaxIterations() const; /*! This method generates a unique and random subdirectory contained by _workingDir. * The path to this directory is stored in _currentTempDir. * @eguarantee strong */ void initializeCurrentTempDir(); /*! Helper function that loads the deformation file generated by plastimatch. The generated file is loaded and returned by the function.*/ FinalFieldPointer generateField() const; /*! Helper function that generates the file path to the parameter file.*/ ::map::core::String getParameterFilePath() const; /*! Helper function that generates the file path to the result parameters for the final(last stage) transform. @pre Algorithm must have at least one stage.*/ ::map::core::String getFinalTransformFilePath() const; /*!Pointer to the moving image used by the algorithm internally. This is used to allow the algorithm * or its derived classes to modify the moving image without changing the public moving image pointer. * The variable is set by prepareIteration() to _spMovingImage before calling prepareInternalInputData(). * (e.g.: An algorithm always normalizes an image before registration. Then the algorithm can use the prepareInternalInputData() * function to manipulate _spInternalMovingImage before it is used by prepareIteration() to set the internal algorithm)*/ MovingImageConstPointer _spInternalMovingImage; /*!Pointer to the target image used by the algorithm internally. This is used to allow the algorithm * or its derived classes to modify the target image with out changing the public target image pointer. * The variable is set by prepareIteration() to _spTargetImage before calling prepareInternalInputData(). * (e.g.: An algorithm always normalizes an image before registration. Then the algorithm can use the prepareInternalInputData() * function to manipulate _spInternalTargetImage before it is used by prepareIteration() to set the internal algorithm)*/ TargetImageConstPointer _spInternalTargetImage; /*!Directory that can be used to store temporary data. Process must have write access to this directory*/ ::map::core::String _workingDir; /*!Directory where the plastimatch tool 'plastimatch' is located.*/ ::map::core::String _plastimatchDir; /*!Directory that is used to store temporary data on the current run*/ ::map::core::String _currentTempDir; /*!Vector with plastimatch parameter maps, each element of the vector is the parameter map for one registration stage of plastimatch*/ ConfigurationType _configurationPLM; ::map::core::String _movingImageTempPath; ::map::core::String _targetImageTempPath; ::map::core::String _finalFieldTempPath; ::map::core::String _movingMaskTempPath; ::map::core::String _targetMaskTempPath; ::map::core::String _movingPointSetTempPath; ::map::core::String _targetPointSetTempPath; bool _deleteTempDirectory; /*! This member function is called by the process executer, whenever Plastimatch generates an output on stdout.*/ void onPlmOutputEvent(::itk::Object* caller, const ::itk::EventObject& eventObject); /*! Helper method that removes the current temp dir (if it exists and _deleteTempDirectory is true). * @eguarantee no throw*/ void cleanTempDir() const; ::map::core::String _parameterFilePath; virtual MovingPointSetConstPointer doGetNthMovingPointSet(SlotIndexType index) const override; - virtual TargetPointSetConstPointer doGetNthTargetPointSet(SlotIndexType index) const override;; + virtual TargetPointSetConstPointer doGetNthTargetPointSet(SlotIndexType index) const override; - virtual void doSetNthMovingPointSet(SlotIndexType index, const MovingPointSetType* pMovingPointSet) override;; + virtual void doSetNthMovingPointSet(SlotIndexType index, const MovingPointSetType* pMovingPointSet) override; - virtual void doSetNthTargetPointSet(SlotIndexType index, const TargetPointSetType* pTargetPointSet) override;; + virtual void doSetNthTargetPointSet(SlotIndexType index, const TargetPointSetType* pTargetPointSet) override; ::map::core::ModificationTimeValidator _targetPSMTime; ::map::core::ModificationTimeValidator _movingPSMTime; MovingPointSetConstPointer _spMovingPointSet; TargetPointSetConstPointer _spTargetPointSet; private: /*! The parameters of the registration field generated by plastimatch.*/ FinalFieldPointer _spFinalizedField; /*! Smartpointer to the finalized registration. Will be set by finalizeAlgorithm()*/ typename RegistrationType::Pointer _spFinalizedRegistration; /*! The lock is used to manage the access to the member variable _currentIterationCount.*/ mutable ::itk::SimpleFastMutexLock _currentIterationLock; CLIRegistrationAlgorithmBase(const Self& source); void operator=(const Self&); //purposely not implemented }; } } } #ifndef MatchPoint_MANUAL_TPP #include "mapPlmCLIRegistrationAlgorithmBase.tpp" #endif #endif diff --git a/Code/Algorithms/Plastimatch/source/mapPlmAlgorithmHelper.cpp b/Code/Algorithms/Plastimatch/source/mapPlmAlgorithmHelper.cpp index f4dd654..2af34a2 100644 --- a/Code/Algorithms/Plastimatch/source/mapPlmAlgorithmHelper.cpp +++ b/Code/Algorithms/Plastimatch/source/mapPlmAlgorithmHelper.cpp @@ -1,173 +1,171 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include //MatchPoint #include "mapPlmAlgorithmHelper.h" #include "mapString.h" #include "mapExceptionObjectMacros.h" namespace map { namespace algorithm { namespace plastimatch { void saveConfigurationToFile(const ConfigurationType& config, const map::core::String& fileName) { if (config.size() < 2) { mapDefaultExceptionStaticMacro( << "Cannot save configuration. Config seems to be invalid, containing less then two parts (GLOBAL and one STAGE is mandatory). File path: " << fileName); } std::ofstream file; std::ios_base::openmode iOpenFlag = std::ios_base::out | std::ios_base::trunc; file.open(fileName.c_str(), iOpenFlag); if (!file.is_open()) { mapDefaultExceptionStaticMacro( << "Cannot open or create parameter map file to save. File path: " << fileName); } - for (ConfigurationType::const_iterator stagePos = config.begin(); stagePos != config.end(); + for (auto stagePos = config.begin(); stagePos != config.end(); ++stagePos) { if (stagePos == config.begin()) { file << "[GLOBAL]" << std::endl; } else { file << "[STAGE]" << std::endl; } - for (ParameterStageType::const_iterator pos = stagePos->begin(); pos != stagePos->end(); ++pos) + for (const auto & pos : *stagePos) { - file << pos->first << "="; + file << pos.first << "="; - for (ParameterValuesType::const_iterator posValues = pos->second.begin(); - posValues != pos->second.end(); ++posValues) + for (auto posValues = pos.second.begin(); + posValues != pos.second.end(); ++posValues) { - if (posValues != pos->second.begin()) + if (posValues != pos.second.begin()) { file << " "; } file << *posValues; } file << std::endl; } } file.close(); }; ConfigurationType loadConfigurationFromFile(const map::core::String& fileName) { ConfigurationType result; ParameterStageType stage; std::ifstream parameterFile; parameterFile.open(fileName.c_str(), std::fstream::in); if (!parameterFile.is_open()) { mapDefaultExceptionStaticMacro( << "ERROR: could not open " << fileName << " for reading."); } - ::map::core::String line = ""; + ::map::core::String line; while (parameterFile.good()) { /** Extract a line. */ if (itksys::SystemTools::GetLineFromStream(parameterFile, line)) { if (line.find("[STAGE]") != core::String::npos) { //change the stage result.push_back(stage); stage.clear(); } else { - std::vector valueTemp = itksys::SystemTools::SplitString(line.c_str(), '='); + std::vector valueTemp = itksys::SystemTools::SplitString(line, '='); if (valueTemp.size() > 1) { // ok we have a parameter line, so don't ignore. Everything else would/should be an empty line, comment or [GLOBAL] if (valueTemp.size() != 2) { // there only should be two lines, everything else means more then one '=' thus is strange mapDefaultExceptionStaticMacro( << "ERROR: invalid configuration file. Seems to be more then one '=' per line. Invalid line" << line); } ParameterNameType name = valueTemp[0]; valueTemp = itksys::SystemTools::SplitString(valueTemp[1].c_str(), ' '); ParameterValuesType values; - for (std::vector::iterator pos = valueTemp.begin(); pos != valueTemp.end(); ++pos) + for (auto & pos : valueTemp) { - values.push_back(*pos); + values.push_back(pos); } stage.insert(std::make_pair(name, values)); } } } } result.push_back(stage); //add the last active stage parameterFile.close(); return result; }; ParamGenerator::ParamGenerator() - { - } + = default; ParamGenerator::~ParamGenerator() - { - } + = default; ParamGenerator:: operator ParameterValuesType() { return this->_values; } - } - } -} + } // namespace plastimatch + } // namespace algorithm +} // namespace map diff --git a/Code/Core/include/mapAffineMatrixOffsetDecompositionPolicy.h b/Code/Core/include/mapAffineMatrixOffsetDecompositionPolicy.h index 77dc5eb..f3b7017 100644 --- a/Code/Core/include/mapAffineMatrixOffsetDecompositionPolicy.h +++ b/Code/Core/include/mapAffineMatrixOffsetDecompositionPolicy.h @@ -1,189 +1,189 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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: 797 $ (last changed revision) // @date $Date: 2014-10-10 11:42:05 +0200 (Fr, 10 Okt 2014) $ (last change date) // @author $Author: floca $ (last changed by) // Subversion HeadURL: $HeadURL: https://svn/sbr/Sources/SBR-Projects/MatchPoint/trunk/Code/Core/include/mapAffineMatrixOffsetDecompositionPolicy.h $ */ #ifndef __MAP_AFFINE_MATRIX_DECOMPOSITION_POLICY_H #define __MAP_AFFINE_MATRIX_DECOMPOSITION_POLICY_H #include "mapFieldRepresentationDescriptor.h" #include "mapRegistrationTopology.h" #include #include #include namespace map { namespace core { /*! @class AffineMatrixOffsetDecompositionPolicy * @brief Class defines the rule for decomposing an itk::transforms of any dimensionality into an affine matrix and offset (if that is possible). * * This helper class is used by MatchPoint for decomposition purposes of arbitrary dimensionality. * It can be seen like a trait pattern, because not all combinations of dimension allow all decomposition strategies. * * @ingroup Registration * @tparam VInDimensions Dimension count of the input type. * @tparam VOutDimensions Dimension count of the output type. */ template class AffineMatrixOffsetDecompositionPolicy { public: typedef ::itk::Transform TransformType; - typedef typename continuous::Elements::PointType OutputPointType; - typedef typename continuous::Elements::VectorType OutputVectorType; + using OutputPointType = typename continuous::Elements::PointType; + using OutputVectorType = typename continuous::Elements::VectorType; typedef itk::Matrix MatrixType; /*! Tries to decompose the transform model into an affine matrix and an offset. It is indicated by the return value if * the actual model can be decomposed.\n * Usage of the return values: Point_trans = Matrix*Point + Offset * * @eguarantee strong * @remark Implement the function for special transform model classes. * @param [in] Pointer to the transfrom that should be decomposed * @param [out] matrix Reference to the matrix that define the affine non-translation part (e.g. rotation and scaling). * @param [out] offset Reference to a vector that defines the translation offset. * @return Indicates if the transform model can be decomposed in a affine transformation matrix plus offset. If it returns false, it cannot be decomposed * and the referenced output parameters are invalid. If the passed transform is invalid, it will also return false.*/ static bool getAffineMatrixDecomposition(const TransformType* transform, MatrixType& matrix, OutputVectorType& offset) { if (!transform) { return false; } typedef ::itk::TranslationTransform TranslationTransformType; typedef ::itk::IdentityTransform IdentityTransformType; bool result = false; const TranslationTransformType* translationModel = dynamic_cast(transform); const IdentityTransformType* identityModel = dynamic_cast(transform); if (translationModel) { matrix.SetIdentity(); offset = translationModel->GetOffset(); result = true; } else if (identityModel) { matrix.SetIdentity(); offset.Fill(0); result = true; } return result; }; private: typedef AffineMatrixOffsetDecompositionPolicy Self; AffineMatrixOffsetDecompositionPolicy(); //purposely not implemented virtual ~AffineMatrixOffsetDecompositionPolicy(); //purposely not implemented AffineMatrixOffsetDecompositionPolicy(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; /*! @class AffineMatrixOffsetDecompositionPolicy * @brief Template specialization for the case that input and output are of the same dimensionality. * * @ingroup Registration * @tparam VDimensions Dimensionality of the operands. */ template class AffineMatrixOffsetDecompositionPolicy { public: typedef ::itk::Transform TransformType; - typedef typename continuous::Elements::PointType OutputPointType; - typedef typename continuous::Elements::VectorType OutputVectorType; + using OutputPointType = typename continuous::Elements::PointType; + using OutputVectorType = typename continuous::Elements::VectorType; typedef itk::Matrix MatrixType; /*! Tries to decompose the transform model into an affine matrix and an offset. It is indicated by the return value if * the actual model can be decomposed.\n * Usage of the return values: Point_trans = Matrix*Point + Offset * * @eguarantee strong * @remark Implement the function for special transform model classes. * @param [in] Pointer to the transform that should be decomposed * @param [out] matrix Reference to the matrix that define the affine non-translation part (e.g. rotation and scaling). * @param [out] offset Reference to a vector that defines the translation offset. * @return Indicates if the transform model can be decomposed in a affine transformation matrix plus offset. If it returns false, it cannot be decomposed * and the referenced output parameters are invalid. If the passed transform is invalid, it will also return false.*/ static bool getAffineMatrixDecomposition(const TransformType* transform, MatrixType& matrix, OutputVectorType& offset) { if (!transform) { return false; } typedef ::itk::MatrixOffsetTransformBase MatrixOffsetTransformType; typedef ::itk::TranslationTransform TranslationTransformType; typedef ::itk::IdentityTransform IdentityTransformType; bool result = false; const MatrixOffsetTransformType* matrixBasedModel = dynamic_cast(transform); const TranslationTransformType* translationModel = dynamic_cast(transform); const IdentityTransformType* identityModel = dynamic_cast(transform); if (matrixBasedModel) { matrix = matrixBasedModel->GetMatrix(); offset = matrixBasedModel->GetOffset(); result = true; } else if (translationModel) { matrix.SetIdentity(); offset = translationModel->GetOffset(); result = true; } else if (identityModel) { matrix.SetIdentity(); offset.Fill(0); result = true; } return result; }; private: typedef AffineMatrixOffsetDecompositionPolicy Self; AffineMatrixOffsetDecompositionPolicy(); //purposely not implemented virtual ~AffineMatrixOffsetDecompositionPolicy(); //purposely not implemented AffineMatrixOffsetDecompositionPolicy(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapCombinationFunctorInterface.h b/Code/Core/include/mapCombinationFunctorInterface.h index a088a91..d913373 100644 --- a/Code/Core/include/mapCombinationFunctorInterface.h +++ b/Code/Core/include/mapCombinationFunctorInterface.h @@ -1,110 +1,110 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_COMBINATION_FUNCTOR_INTERFACE_H #define __MAP_COMBINATION_FUNCTOR_INTERFACE_H #include "mapRegistrationTopology.h" #include "mapRegistrationKernelBase.h" #include "itkObject.h" namespace map { namespace core { namespace functors { /*! @class CombinationFunctorInterface * @brief Interface class for combination functors that gernerate vector fields * by kernel combination * * @ingroup RegFunctors * @tparam VInputDimensions Dimensions of the input space the field should map from. * @tparam VInterimDimensions Dimensions of the interim space into which the transformation maps. * @tparam VOutputDimensions Dimensions of the output space the field should map into. */ template class CombinationFunctorInterface { public: /*! Standard class typedefs. */ typedef CombinationFunctorInterface Self; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkStaticConstMacro(InputDimensions, unsigned int, VInputDimensions); itkStaticConstMacro(InterimDimensions, unsigned int, VInterimDimensions); itkStaticConstMacro(OutputDimensions, unsigned int, VOutputDimensions); virtual const char* GetNameOfClass() const { return "FieldGenerationFunctor"; }; typedef typename RegistrationTopology::DirectMappingVectorType PaddingVectorType; typedef RegistrationKernelBase SourceKernel1BaseType; typedef RegistrationKernelBase SourceKernel2BaseType; /*! Returns a const pointer to the first source kernel base that will be used in order * to generate the field. * @eguarantee no fail * @return Pointer to the source field kernel. * @post Return value is guaranteed not to be NULL. */ - virtual const SourceKernel1BaseType* get1stSourceKernelBase(void) const = 0; + virtual const SourceKernel1BaseType* get1stSourceKernelBase() const = 0; /*! Returns a const pointer to the second source kernel base that will be used in order * to generate the field. * @eguarantee no fail * @return Pointer to the source field kernel. * @post Return value is guaranteed not to be NULL. */ - virtual const SourceKernel2BaseType* get2ndSourceKernelBase(void) const = 0; + virtual const SourceKernel2BaseType* get2ndSourceKernelBase() const = 0; protected: CombinationFunctorInterface(); virtual ~CombinationFunctorInterface(); /*! Methods invoked by itk::LightObject::Print(). */ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; private: CombinationFunctorInterface(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace functors } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapCombinationFunctorInterface.tpp" #endif #endif diff --git a/Code/Core/include/mapCombinedRegistrationKernel.h b/Code/Core/include/mapCombinedRegistrationKernel.h index e09ecb0..5ead70e 100644 --- a/Code/Core/include/mapCombinedRegistrationKernel.h +++ b/Code/Core/include/mapCombinedRegistrationKernel.h @@ -1,110 +1,109 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __COMBINED_REGISTRATION_KERNEL_H #define __COMBINED_REGISTRATION_KERNEL_H #include "mapLazyRegistrationKernel.h" #include "mapCombinationFunctorInterface.h" /*! @namespace map The namespace map::core is for the library of MatchPoint */ namespace map { namespace core { /*!@brief CombinedRegistrationKernel is a special implementation of a lazy registration kernel. * This implementation uses a combination functor to generate its field. In contrast to the normal lazy kernel * implementation, this kernel maps points directly by using its functor given source kernels. Thus no field will generated * just for mapping points. The field must be generated explicitly by calling gernerateField(). * @ingroup RegKernel */ template class CombinedRegistrationKernel : public LazyRegistrationKernel < VInputDimensions, VOutputDimensions > { public: typedef CombinedRegistrationKernel < VInputDimensions, VInterimDimensions, VOutputDimensions > Self; typedef LazyRegistrationKernel Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(CombinedRegistrationKernel, LazyRegistrationKernel); itkNewMacro(Self); - typedef typename Superclass::RepresentationDescriptorType RepresentationDescriptorType; - typedef typename Superclass::RepresentationDescriptorPointer RepresentationDescriptorPointer; - typedef typename Superclass::RepresentationDescriptorConstPointer - RepresentationDescriptorConstPointer; - typedef typename Superclass::TransformGenerationFunctorType TransformGenerationFunctorType; - typedef typename Superclass::InputPointType InputPointType; - typedef typename Superclass::OutputPointType OutputPointType; + using RepresentationDescriptorType = typename Superclass::RepresentationDescriptorType; + using RepresentationDescriptorPointer = typename Superclass::RepresentationDescriptorPointer; + using RepresentationDescriptorConstPointer = typename Superclass::RepresentationDescriptorConstPointer; + using TransformGenerationFunctorType = typename Superclass::TransformGenerationFunctorType; + using InputPointType = typename Superclass::InputPointType; + using OutputPointType = typename Superclass::OutputPointType; /*! sets the field's functor @eguarantee no fail @param functor Pointer to the functor that is responsible for generating the field @pre functor must point to a valid instance. */ - virtual void setTransformFunctor(const TransformGenerationFunctorType* functor) override; + void setTransformFunctor(const TransformGenerationFunctorType* functor) override; protected: typedef functors::CombinationFunctorInterface < VInputDimensions, VInterimDimensions, VOutputDimensions > CombinationFunctorInterfaceType; - typedef typename CombinationFunctorInterfaceType::SourceKernel1BaseType SourceKernel1BaseType; - typedef typename CombinationFunctorInterfaceType::SourceKernel2BaseType SourceKernel2BaseType; + using SourceKernel1BaseType = typename CombinationFunctorInterfaceType::SourceKernel1BaseType; + using SourceKernel2BaseType = typename CombinationFunctorInterfaceType::SourceKernel2BaseType; const CombinationFunctorInterfaceType* _pCombinationInterface; /*! maps a given point by using both source kernel. In contrast to other LazyRegistrationKernel classes, * calling this methos will not trigger the generation of the kernel field. @eguarantee no fail @param functor Reference to the functor that is responsible for generating the field @pre Functor must have implemented CombinationFunctorInterface */ virtual bool doMapPoint(const InputPointType& inPoint, OutputPointType& outPoint) const; CombinedRegistrationKernel(); virtual ~CombinedRegistrationKernel(); /*! Methods invoked by itk::LightObject::Print(). */ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; private: //No copy constructor allowed CombinedRegistrationKernel(const Self& source); void operator=(const Self&); //purposely not implemented }; - } -} + } // namespace core +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapCombinedRegistrationKernel.tpp" #endif #endif diff --git a/Code/Core/include/mapContinuous.h b/Code/Core/include/mapContinuous.h index 4f31cbd..4bc44e4 100644 --- a/Code/Core/include/mapContinuous.h +++ b/Code/Core/include/mapContinuous.h @@ -1,41 +1,41 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAPCONTINUOUS_H #define __MAPCONTINUOUS_H namespace map { namespace core { namespace continuous { //! Default scalar type used in MatchPoint - typedef double ScalarType; + using ScalarType = double; } // end namespace continuous } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapContinuousElements.h b/Code/Core/include/mapContinuousElements.h index cecdd0f..fd12c03 100644 --- a/Code/Core/include/mapContinuousElements.h +++ b/Code/Core/include/mapContinuousElements.h @@ -1,57 +1,57 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_CONTINUOUS_ELEMENTS_H #define __MAP_CONTINUOUS_ELEMENTS_H #include "mapContinuous.h" #include "mapVolumeSize.h" #include "itkPoint.h" #include "itkVector.h" #include "itkPointSet.h" #include "itkDefaultStaticMeshTraits.h" namespace map { namespace core { namespace continuous { template struct Elements { public: typedef itk::Point PointType; typedef itk::Vector VectorType; typedef itk::Vector SpacingType; - typedef VolumeSize VolumeSizeType; + using VolumeSizeType = VolumeSize; typedef itk::PointSet > InternalPointSetType; }; } // end namespace continuous } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapConvert.h b/Code/Core/include/mapConvert.h index 2de85a5..ce86ad2 100644 --- a/Code/Core/include/mapConvert.h +++ b/Code/Core/include/mapConvert.h @@ -1,132 +1,132 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_CONVERT_H #define __MAP_CONVERT_H #include #include "mapString.h" #include "mapMacros.h" #include "mapMAPCoreExports.h" namespace map { namespace core { namespace convert { - MAPCore_EXPORT String toStr(const double& value, const int precision = 10); - MAPCore_EXPORT String toStr(const float& value, const int precision = 10); + MAPCore_EXPORT String toStr(const double& value, int precision = 10); + MAPCore_EXPORT String toStr(const float& value, int precision = 10); MAPCore_EXPORT String toStr(const bool& value); MAPCore_EXPORT String toStr(const int& value); MAPCore_EXPORT String toStr(const unsigned int& value); MAPCore_EXPORT String toStr(const long& value); MAPCore_EXPORT String toStr(const unsigned long& value); /** This function only passes the sting through. Nothing will be changed. * It is needed by some template classes to handle the strings like every other * simple type*/ - MAPCore_EXPORT String toStr(const String& value); + MAPCore_EXPORT String toStr(const String& str); /**Helper function for types that should be converted and do not need special * conversion handling or are unkown when writing the code e.g. std::size_type*/ template String toStrGeneric(const TElement& value) { String sResult; OStringStream stream; stream << value; sResult = stream.str(); return sResult; }; MAPCore_EXPORT double toDouble(const String& value); MAPCore_EXPORT bool isADouble(const String& value); MAPCore_EXPORT float toFloat(const String& value); MAPCore_EXPORT int toInt(const String& value); MAPCore_EXPORT bool isAInt(const String& value); MAPCore_EXPORT unsigned int toUInt(const String& value); MAPCore_EXPORT long toLong(const String& value); MAPCore_EXPORT bool isALong(const String& value); MAPCore_EXPORT unsigned long toULong(const String& value); MAPCore_EXPORT bool toBool(const String& value); /**Helper function for types that should be converted into and do not need special * conversion handling or are unkown when writing the code e.g. std::size_type*/ template TElement toValueGeneric(const String& value) { TElement result; IStringStream strstrm(value); strstrm >> result; return result; }; /** Converts a std::vector in any type based on itk::Array * @param v Reference to the data source (vector) * @return Array containing the values*/ template< class TArray, typename TValue> static TArray vectorToArray(const ::std::vector& v) { TArray newArray(v.size()); for (typename ::std::vector::size_type i = 0; i < v.size(); i++) { newArray[i] = v[i]; } return newArray; }; /** Converts any type based on itk::Array in a std::vector * @param v Reference to the data source (vector) * @return Array containing the values*/ template< class TArray, typename TValue> static ::std::vector vectorToArray(const TArray& a) { ::std::vector newV; for (unsigned int i = 0; i < a.GetSize(); ++i) { newV[i] = a[i]; } return newV; }; /** Loads the specified file and streams its content into a string. * If the file does not exists or cannot be read, an empty string * will be returned.*/ MAPCore_EXPORT String fileContentToStr(const String& filePath); - } - } + } // namespace convert + } // namespace core } //end of namespace map #endif diff --git a/Code/Core/include/mapDefaultKernelInverter.h b/Code/Core/include/mapDefaultKernelInverter.h index 540eda6..2958460 100644 --- a/Code/Core/include/mapDefaultKernelInverter.h +++ b/Code/Core/include/mapDefaultKernelInverter.h @@ -1,156 +1,156 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_DEFAULT_KERNEL_INVERTER_H #define __MAP_DEFAULT_KERNEL_INVERTER_H #include "mapRegistrationKernelInverterBase.h" #include "mapRegistrationKernel.h" namespace map { namespace core { /*! @class DefaultKernelInverter * @brief Provider that is able to invert a RegistrationKernel. * * If the tranformation model of the given kernel can be inverted analyticaly * the inverter will create PreCachedRegistrationKernel based on the model inversion. * If the inversion is not possible the inverter will create a InvertingRegistrationKernel * an populates it with a parametrized inversion functor. * * @sa FieldByModelInversionFunctor * @sa FieldByFieldInversionFunctor * @sa InvertingRegistrationKernel * @sa PreCachedRegistrationKernel * @ingroup RegOperation * @tparam VInputDimensions Dimensions of the input space of the kernel that should be inverted. * @tparam VOutputDimensions Dimensions of the output space of the kernel that should be inverted. */ template class DefaultKernelInverter : public RegistrationKernelInverterBase { public: /*! Standard class typedefs. */ typedef DefaultKernelInverter Self; typedef RegistrationKernelInverterBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(DefaultKernelInverter, RegistrationKernelInverterBase); itkNewMacro(Self); - typedef typename Superclass::KernelBaseType KernelBaseType; - typedef typename Superclass::KernelBasePointer KernelBasePointer; - typedef typename Superclass::InverseKernelBaseType InverseKernelBaseType; - typedef typename Superclass::InverseKernelBasePointer InverseKernelBasePointer; - typedef typename Superclass::FieldRepresentationType FieldRepresentationType; - typedef typename Superclass::InverseFieldRepresentationType InverseFieldRepresentationType; - typedef typename Superclass::RequestType RequestType; + using KernelBaseType = typename Superclass::KernelBaseType; + using KernelBasePointer = typename Superclass::KernelBasePointer; + using InverseKernelBaseType = typename Superclass::InverseKernelBaseType; + using InverseKernelBasePointer = typename Superclass::InverseKernelBasePointer; + using FieldRepresentationType = typename Superclass::FieldRepresentationType; + using InverseFieldRepresentationType = typename Superclass::InverseFieldRepresentationType; + using RequestType = typename Superclass::RequestType; typedef RegistrationKernel KernelType; - typedef typename Superclass::NullPointType NullPointType; + using NullPointType = typename Superclass::NullPointType; /*! gets the number of iterations that has been set for the numeric inversion * @return the number of iterations * @eguarantee no fail */ unsigned long getFunctorNumberOfIterations() const; /*! Sets the number of iterations for the numeric inversion * @param [in] nrOfIterations the number of iterations * @eguarantee no fail */ void setFunctorNumberOfIterations(unsigned long nrOfIterations); /*! gets the stop value (exactness delta) that has been set for the numeric inversion * @return the stop value * @eguarantee no fail */ double getFunctorStopValue() const; /*! Sets the stop value for the numeric inversion (exactness) * @param [in] nrOfIterations the number of iterations * @eguarantee no fail */ void setFunctorStopValue(double stopValue); /*! Uses the passed request data to check if the provider is able to provide the service for * this request. * @return Indicates if the provider offers the right solution. * @retval true Provider can handle the request. * @retval false Provider is not able to handle the request.*/ virtual bool canHandleRequest(const RequestType& request) const; /*! Returns an ID of the provider as string. Calls getStaticProviderName(). * @return Service provider ID.*/ virtual String getProviderName() const; /*! Returns an ID of the provider as string. * @return Service provider ID.*/ static String getStaticProviderName(); /*! Returns an ID of the provider as string. May be equal to GetClassName(), but it may differ. * @return Service provider ID. * @remark It is a return by value, becaus it might be possible that the description is generated on line * when calling this method.*/ virtual String getDescription() const; /*! Generates the inverse kernel. * Returns a smpart pointer to an inverted version of the kernel. * @eguarantee strong * @param [in] request Referenz to the kernel that should be inverted * @param [in] pFieldRepresentation Pointer to the field representation of the kernel, * may be null if no representation is defined. * @param [in] pInverseFieldRepresentation Pointer to the field representation of the inverse kernel, * may not be NULL, if the transform model cannot be inverted analyticaly. * @return Smart pointer to the inverse kernel. * @pre The inverter service provider may require the inverse field representation * @post If the method returns with no exception, there is always an inverse kernel (smart pointer is not NULL) * @remark This function might cause an exception/assertion if the responsible service provider needs * pInverseFieldRepresentation not to be NULL but it is. */ - virtual InverseKernelBasePointer invertKernel(const KernelBaseType& kernel, + InverseKernelBasePointer invertKernel(const KernelBaseType& kernel, const FieldRepresentationType* pFieldRepresentation, const InverseFieldRepresentationType* pInverseFieldRepresentation, bool useNullPoint = false, NullPointType nullPoint = NullPointType(itk::NumericTraits< ::map::core::continuous::ScalarType>::NonpositiveMin())) const override; protected: /*!Cached properties that should be used on the FieldByModelInversionFunctor*/ unsigned long _functorNrOfIterations; /*!Cached properties that should be used on the FieldByModelInversionFunctor*/ double _functorStopValue; DefaultKernelInverter(); virtual ~DefaultKernelInverter() {}; private: DefaultKernelInverter(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapDefaultKernelInverter.tpp" #endif #endif diff --git a/Code/Core/include/mapDefaultRegistrationTopologyPolicy.h b/Code/Core/include/mapDefaultRegistrationTopologyPolicy.h index 201d5c6..cb19b88 100644 --- a/Code/Core/include/mapDefaultRegistrationTopologyPolicy.h +++ b/Code/Core/include/mapDefaultRegistrationTopologyPolicy.h @@ -1,75 +1,75 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __DEFAULT_REGISTRATION_TOPOLOGY_POLICY_H #define __DEFAULT_REGISTRATION_TOPOLOGY_POLICY_H #include "mapRegistrationTopology.h" #include "mapRegistrationKernelBase.h" namespace map { namespace core { /*! @class DefaultRegistrationTopologyPolicy This is a Policy that defines the type of registration fields images and their pixels. It can be used to exchange the vector field style that represents a registration in a discrete way. */ template struct DefaultRegistrationTopologyPolicy { public: typedef DefaultRegistrationTopologyPolicy Self; typedef RegistrationTopology RegistrationTopologyType; //direct mapping itkStaticConstMacro(DirectInputDimensions, unsigned int, VMovingDimensions); itkStaticConstMacro(DirectOutputDimensions, unsigned int, VTargetDimensions); - typedef typename RegistrationTopologyType::DirectMappingVectorType DirectMappingVectorType; - typedef typename RegistrationTopologyType::DirectFieldType DirectFieldType; - typedef typename RegistrationTopologyType::DirectFieldPointer DirectFieldPointer; - typedef typename RegistrationTopologyType::DirectFieldRegionType DirectFieldRegionType; + using DirectMappingVectorType = typename RegistrationTopologyType::DirectMappingVectorType; + using DirectFieldType = typename RegistrationTopologyType::DirectFieldType; + using DirectFieldPointer = typename RegistrationTopologyType::DirectFieldPointer; + using DirectFieldRegionType = typename RegistrationTopologyType::DirectFieldRegionType; //inverse mapping itkStaticConstMacro(InverseInputDimensions, unsigned int, VTargetDimensions); itkStaticConstMacro(InverseOutputDimensions, unsigned int, VMovingDimensions); - typedef typename RegistrationTopologyType::InverseMappingVectorType InverseMappingVectorType; - typedef typename RegistrationTopologyType::InverseFieldType InverseFieldType; - typedef typename RegistrationTopologyType::InverseFieldPointer InverseFieldPointer; - typedef typename RegistrationTopologyType::InverseFieldRegionType InverseFieldRegionType; + using InverseMappingVectorType = typename RegistrationTopologyType::InverseMappingVectorType; + using InverseFieldType = typename RegistrationTopologyType::InverseFieldType; + using InverseFieldPointer = typename RegistrationTopologyType::InverseFieldPointer; + using InverseFieldRegionType = typename RegistrationTopologyType::InverseFieldRegionType; typedef RegistrationKernelBase DirectMappingType; typedef RegistrationKernelBase InverseMappingType; //general - typedef typename RegistrationTopologyType::MovingPointType MovingPointType; - typedef typename RegistrationTopologyType::TargetPointType TargetPointType; + using MovingPointType = typename RegistrationTopologyType::MovingPointType; + using TargetPointType = typename RegistrationTopologyType::TargetPointType; }; - } -} + } // namespace core +} // namespace map #endif diff --git a/Code/Core/include/mapDefaultSLStaticPolicy.h b/Code/Core/include/mapDefaultSLStaticPolicy.h index 2ac7ce9..a3ad1ba 100644 --- a/Code/Core/include/mapDefaultSLStaticPolicy.h +++ b/Code/Core/include/mapDefaultSLStaticPolicy.h @@ -1,80 +1,80 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_DEFAULT_SL_STATIC_POLICY_H #define __MAP_DEFAULT_SL_STATIC_POLICY_H namespace map { namespace core { namespace services { /*! @class NoneStaticLoadPolicy * @brief Default loading policy for static service stacks. * * This policy does nothing, therefore a repository using this policy has no static loading operations. * * @ingroup LoadPolicies * @tparam TConcreteServiceStack The service stack class that is wrapped by the policy owner. */ template class DefaultSLStaticPolicy { protected: /*! Standard class typedefs. */ - typedef TConcreteServiceStack ConcreteServiceStackType; + using ConcreteServiceStackType = TConcreteServiceStack; /*! Will be called after registering the concrete stack to allow the policy to do final operations on * the concrete stack. * @eguarantee basic * @param [in] pStack Pointer to the stack. Pointer must point to a valid stack instance. */ static void finalizeStaticLoading(ConcreteServiceStackType* pStack); /*! Registers the concrete stack that should be handled by the policy. Function will be called directly after the * stack was created. * @eguarantee strong * @param [in] pStack Pointer to the stack. Pointer must point to a valid stack instance. * @pre pStack must not be NULL */ static void registerConcreteStack(ConcreteServiceStackType* pStack); DefaultSLStaticPolicy(); ~DefaultSLStaticPolicy(); private: - typedef DefaultSLStaticPolicy Self; + using Self = DefaultSLStaticPolicy; DefaultSLStaticPolicy(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace services } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapDefaultSLStaticPolicy.tpp" #endif #endif diff --git a/Code/Core/include/mapDimensionlessRegistrationKernelBase.h b/Code/Core/include/mapDimensionlessRegistrationKernelBase.h index d7a9f03..8151852 100644 --- a/Code/Core/include/mapDimensionlessRegistrationKernelBase.h +++ b/Code/Core/include/mapDimensionlessRegistrationKernelBase.h @@ -1,96 +1,96 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __DIMENSIONLESS_REGISTRATION_KERNEL_INTERFACE_H #define __DIMENSIONLESS_REGISTRATION_KERNEL_INTERFACE_H #include "itkObject.h" #include "mapMAPCoreExports.h" #include "mapString.h" namespace map { namespace core { /*! @class DimensionlessRegistrationKernelBase This class is the dimensionless (thus abstract) base class for registration kernels. @ingroup RegKernel */ class MAPCore_EXPORT DimensionlessRegistrationKernelBase : public itk::Object { public: - typedef DimensionlessRegistrationKernelBase Self; - typedef itk::Object Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Self = DimensionlessRegistrationKernelBase; + using Superclass = itk::Object; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(DimensionlessRegistrationKernelBase, itk::Object); /*! @brief determines if there is a limit in the data representation of the kernel @eguarantee strong @return if the registration kernel has limited representation @retval true if the data representation is limited @retval false if the data representation is not limited */ virtual bool hasLimitedRepresentation() const = 0; /*! @brief forces kernel to precompute, even if it is a LazyFieldKernel @eguarantee strong */ virtual void precomputeKernel() const = 0; /*! @brief Gets the number of input dimensions @eguarantee no fail */ virtual unsigned int getInputDimensions() const = 0; /*! @brief Gets the number of output dimensions @eguarantee no fail */ virtual unsigned int getOutputDimensions() const = 0; protected: /*! Methods invoked by itk::LightObject::Print(). */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; DimensionlessRegistrationKernelBase(); - virtual ~DimensionlessRegistrationKernelBase(); + ~DimensionlessRegistrationKernelBase() override; private: //No copy constructor allowed - DimensionlessRegistrationKernelBase(const Self& source); - void operator=(const Self&); //purposely not implemented + DimensionlessRegistrationKernelBase(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; std::ostream& operator<< (std::ostream& os, const DimensionlessRegistrationKernelBase& p); - } -} + } // namespace core +} // namespace map #endif diff --git a/Code/Core/include/mapDiscrete.h b/Code/Core/include/mapDiscrete.h index 1161fdc..af0039f 100644 --- a/Code/Core/include/mapDiscrete.h +++ b/Code/Core/include/mapDiscrete.h @@ -1,40 +1,40 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_DISCRETE_H #define __MAP_DISCRETE_H namespace map { namespace core { namespace discrete { //! Default internal pixel type used in MatchPoint - typedef float InternalPixelType; + using InternalPixelType = float; } // end namespace discrete } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapDiscreteElements.h b/Code/Core/include/mapDiscreteElements.h index 153e60f..e56199b 100644 --- a/Code/Core/include/mapDiscreteElements.h +++ b/Code/Core/include/mapDiscreteElements.h @@ -1,54 +1,54 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_DISCRETE_ELEMENTS_H #define __MAP_DISCRETE_ELEMENTS_H #include "mapContinuousElements.h" #include "mapDiscrete.h" #include "itkImage.h" #include "itkSize.h" namespace map { namespace core { namespace discrete { template struct Elements { public: typedef itk::Image InternalImageType; - typedef typename InternalImageType::RegionType ImageRegionType; + using ImageRegionType = typename InternalImageType::RegionType; typedef itk::Image< typename ::map::core::continuous::Elements::VectorType, VDimensions> VectorFieldType; - typedef itk::Size SizeType; + using SizeType = itk::Size; }; - } // end namespace continuous + } // namespace discrete } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapEvents.h b/Code/Core/include/mapEvents.h index e17662a..baa2919 100644 --- a/Code/Core/include/mapEvents.h +++ b/Code/Core/include/mapEvents.h @@ -1,134 +1,134 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_EVENTS_H #define __MAP_EVENTS_H #include "itkEventObject.h" #include "mapConfigure.h" #include "mapMacros.h" #include "mapMAPCoreExports.h" namespace map { namespace core { /** @class EventObject * @brief Base object for all MatchPoint events * @ingroup Events * */ class MAPCore_EXPORT EventObject : public itk::AnyEvent { public: - typedef EventObject Self; - typedef itk::AnyEvent Superclass; - EventObject(void* pData = NULL, const std::string& comment = ""); + using Self = EventObject; + using Superclass = itk::AnyEvent; + EventObject(void* pData = nullptr, std::string comment = ""); - virtual ~EventObject(); + ~EventObject() override; void* getData() const; const std::string& getComment() const; - virtual const char* GetEventName() const; + const char* GetEventName() const override; - virtual bool CheckEvent(const ::itk::EventObject* e) const; + bool CheckEvent(const ::itk::EventObject* e) const override; - virtual ::itk::EventObject* MakeObject() const; + ::itk::EventObject* MakeObject() const override; EventObject(const Self& s); - virtual void Print(std::ostream& os) const; + void Print(std::ostream& os) const override; private: void* _pData; std::string _comment; - void operator=(const Self&); + void operator=(const Self&) = delete; }; /*! @def mapEventMacro * Helper macro that creates events objects for map. */ #define mapEventMacro( classname , super, export_tag ) \ /*! @ingroup Events */ \ class export_tag classname : public super { \ public: \ typedef classname Self; \ typedef super Superclass; \ classname(void* pData = NULL, const std::string& comment = ""): Superclass(pData, comment) {}\ virtual ~classname() {} \ virtual const char * GetEventName() const { return #classname; } \ virtual bool CheckEvent(const ::itk::EventObject* e) const \ { return dynamic_cast(e); } \ virtual ::itk::EventObject* MakeObject() const \ { return new Self(*this); } \ classname(const Self& s) : Superclass(s) {}; \ private: \ void operator=(const Self&); \ } - } + } // namespace core namespace events { /*!@class AnyMatchPointEvent * @brief General event that can be used if you want to observe any event defined by MatchPoint. * @ingroup Events */ - typedef core::EventObject AnyMatchPointEvent; + using AnyMatchPointEvent = core::EventObject; /*!@class ServiceEvent * @brief General/base event concering a service strukture (e.g. ServiceStacks) or its processing. * @ingroup Events */ mapEventMacro(ServiceEvent, AnyMatchPointEvent, MAPCore_EXPORT); /*!@class KernelEvent * @brief General/base event concering a registration kernel. * @ingroup Events */ mapEventMacro(KernelEvent, AnyMatchPointEvent, MAPCore_EXPORT); /*!@class KernelFieldComputationEvent * @brief Event concering the processing of a registration kernel. * @ingroup Events */ mapEventMacro(KernelFieldComputationEvent, KernelEvent, MAPCore_EXPORT); /*!@class RegistrationEvent * @brief Event concering the registration of data. * @ingroup Events */ mapEventMacro(RegistrationEvent, AnyMatchPointEvent, MAPCore_EXPORT); /*!@class TaskBatchEvent * @brief General/base event concering a task batch (e.g. MappingTaskBatch) or its processing. * @ingroup Events */ mapEventMacro(TaskBatchEvent, AnyMatchPointEvent, MAPCore_EXPORT); - } -} + } // namespace events +} // namespace map #endif diff --git a/Code/Core/include/mapExceptionObject.h b/Code/Core/include/mapExceptionObject.h index da9b51b..066bf3e 100644 --- a/Code/Core/include/mapExceptionObject.h +++ b/Code/Core/include/mapExceptionObject.h @@ -1,88 +1,88 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_EXCEPTION_OBJECT_H #define __MAP_EXCEPTION_OBJECT_H #include "itkMacro.h" #include "mapMacros.h" #include "mapString.h" #include "mapMAPCoreExports.h" namespace map { namespace core { /*! @class ExceptionObject * @brief Base exception class used within MatchPoint. * * This is the base class for any exception that is caused by MatchPoint's own code. * @ingroup Exception */ class MAPCore_EXPORT ExceptionObject : public itk::ExceptionObject { public: - typedef itk::ExceptionObject Superclass; - typedef ExceptionObject BaseExceptionType; + using Superclass = itk::ExceptionObject; + using BaseExceptionType = ExceptionObject; /*! Default constructor. Needed to ensure the exception object can be * copied. */ ExceptionObject(); /*! Constructor. Needed to ensure the exception object can be copied. */ ExceptionObject(const char* file, unsigned int lineNumber); /*! Constructor. Needed to ensure the exception object can be copied. */ ExceptionObject(const std::string& file, unsigned int lineNumber); /*! Constructor. Needed to ensure the exception object can be copied. */ ExceptionObject(const std::string& file, unsigned int lineNumber, const std::string& desc, const std::string& loc); /*! Virtual destructor needed for subclasses. Has to have empty throw(). */ - virtual ~ExceptionObject() throw(); + ~ExceptionObject() noexcept override; - virtual const char* GetNameOfClass() const; + const char* GetNameOfClass() const override; /*! Clones the exception object and returns a pointer to a copy of the exception object. * The cloned object is created on the heap and should function caller has to take care about * proper destruction (e.g. using auto pointer or tr1::shared_pointer). * @remark Used a plain pointer as return value in this case to ensure the no throw guarantee. * This feature is needed by some classes like MappingTaskBatch to ensure the feature of * processing tasks in multiple threads and to deal with any exception after joining the threads * and every task is processed (or failed through an exception). * @return Pointer to the cloned exception. If the cloning fails for any reason the return is NULL. * @eguarantee no throw*/ - virtual BaseExceptionType* clone() const throw(); + virtual BaseExceptionType* clone() const noexcept; }; MAPCore_EXPORT std::ostream& operator<<(std::ostream& os, const ExceptionObject& e); } // end namespace core } // end namespace map #include "mapExceptionObjectMacros.h" #endif diff --git a/Code/Core/include/mapFastLockedThreadingPolicy.h b/Code/Core/include/mapFastLockedThreadingPolicy.h index 592e8e6..2e581b0 100644 --- a/Code/Core/include/mapFastLockedThreadingPolicy.h +++ b/Code/Core/include/mapFastLockedThreadingPolicy.h @@ -1,78 +1,78 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_FAST_LOCKED_THREADING_POLICY_H #define __MAP_FAST_LOCKED_THREADING_POLICY_H #include "itkSimpleFastMutexLock.h" #include "mapFastMutexLockSentinel.h" #include "mapMAPCoreExports.h" namespace map { namespace core { namespace services { /*! @class FastLockedThreadingPolicy * @brief Policy is used to handle critical code via a mutex lock. * * @ingroup ThreadingPolicies */ class MAPCore_EXPORT FastLockedThreadingPolicy { protected: - typedef itk::SimpleFastMutexLock MutexType; - typedef FastMutexLockSentinel SentinelType; + using MutexType = itk::SimpleFastMutexLock; + using SentinelType = FastMutexLockSentinel; /*! Initialize a sentinel and implicitly lock the mutex. * @eguarantee strong */ void activateSentinel(SentinelType& sentinel) const; /*! Used by the policy owner to lock part of its code. * @eguarantee strong */ void lock() const; /*! Used by the policy owner to unlock critical code. * @eguarantee strong */ void unlock() const; FastLockedThreadingPolicy(); ~FastLockedThreadingPolicy(); private: /*! This policy uses this mutex to lock critical code by the policy user.*/ mutable MutexType _mutex; - FastLockedThreadingPolicy(const FastLockedThreadingPolicy&); //purposely not implemented - void operator=(const FastLockedThreadingPolicy&); //purposely not implemented + FastLockedThreadingPolicy(const FastLockedThreadingPolicy&) = delete; //purposely not implemented + void operator=(const FastLockedThreadingPolicy&) = delete; //purposely not implemented }; } // end namespace services } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapFastLockedThreadingStaticPolicy.h b/Code/Core/include/mapFastLockedThreadingStaticPolicy.h index b2987ec..07e870f 100644 --- a/Code/Core/include/mapFastLockedThreadingStaticPolicy.h +++ b/Code/Core/include/mapFastLockedThreadingStaticPolicy.h @@ -1,81 +1,81 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_FAST_LOCKED_THREADING_STATIC_POLICY_H #define __MAP_FAST_LOCKED_THREADING_STATIC_POLICY_H #include "itkSimpleFastMutexLock.h" #include "mapFastMutexLockSentinel.h" #include "mapMAPCoreExports.h" namespace map { namespace core { namespace services { /*! @class FastLockedThreadingStaticPolicy * @brief Policy is used to handle critical code via a mutex lock. * * It is used as normally used by StaticServiceStack * @ingroup ThreadingPolicies */ class MAPCore_EXPORT FastLockedThreadingStaticPolicy { protected: - typedef itk::SimpleFastMutexLock MutexType; - typedef FastMutexLockSentinel SentinelType; + using MutexType = itk::SimpleFastMutexLock; + using SentinelType = FastMutexLockSentinel; /*! Initialize a sentinel and implicitly lock the mutex. * @eguarantee strong */ static void activateSentinel(SentinelType& sentinel); /*! Used by the policy owner to lock part of its code. * @eguarantee strong */ static void lock(); /*! Used by the policy owner to unlock critical code. * @eguarantee strong */ static void unlock(); FastLockedThreadingStaticPolicy(); ~FastLockedThreadingStaticPolicy(); private: /*! This policy uses this mutex to lock critical code by the policy user.*/ static MutexType _mutex; FastLockedThreadingStaticPolicy(const - FastLockedThreadingStaticPolicy&); //purposely not implemented - void operator=(const FastLockedThreadingStaticPolicy&); //purposely not implemented + FastLockedThreadingStaticPolicy&) = delete; //purposely not implemented + void operator=(const FastLockedThreadingStaticPolicy&) = delete; //purposely not implemented }; } // end namespace services } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapFastMutexLockSentinel.h b/Code/Core/include/mapFastMutexLockSentinel.h index daafd1d..ed27195 100644 --- a/Code/Core/include/mapFastMutexLockSentinel.h +++ b/Code/Core/include/mapFastMutexLockSentinel.h @@ -1,68 +1,68 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_FAST_MUTEX_LOCK_SENTINEL_H #define __MAP_FAST_MUTEX_LOCK_SENTINEL_H #include "itkSimpleFastMutexLock.h" #include "mapMacros.h" #include "mapMAPCoreExports.h" namespace map { namespace core { namespace services { /*! @class FastMutexLockSentinel * @brief Helper class for fast locked threadding policies. * Used as their sentinel class. Locks the mutex when calling InitializeSentinel() * unlocks the mutex when the destructor of the sentinel is called. * * @ingroup ThreadingPolicies */ class MAPCore_EXPORT FastMutexLockSentinel { public: - typedef itk::SimpleFastMutexLock MutexType; + using MutexType = itk::SimpleFastMutexLock; void initializeSentinel(MutexType* pMutex); FastMutexLockSentinel(); ~FastMutexLockSentinel(); private: /*! This policy uses this mutex to lock critical code by the policy user.*/ - MutexType* _pMutex; + MutexType* _pMutex{nullptr}; - FastMutexLockSentinel(const FastMutexLockSentinel&); //purposely not implemented - void operator=(const FastMutexLockSentinel&); //purposely not implemented + FastMutexLockSentinel(const FastMutexLockSentinel&) = delete; //purposely not implemented + void operator=(const FastMutexLockSentinel&) = delete; //purposely not implemented }; } // end namespace services } // end namespace core } // end namespace map #endif \ No newline at end of file diff --git a/Code/Core/include/mapFieldByFieldInversionFunctor.h b/Code/Core/include/mapFieldByFieldInversionFunctor.h index ff17e29..b68401f 100644 --- a/Code/Core/include/mapFieldByFieldInversionFunctor.h +++ b/Code/Core/include/mapFieldByFieldInversionFunctor.h @@ -1,171 +1,171 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_FIELD_BY_FIELD_INVERSION_FUNCTOR_H #define __MAP_FIELD_BY_FIELD_INVERSION_FUNCTOR_H #include "mapTransformGenerationFunctor.h" #include "mapRegistrationKernel.h" #include "mapRegistrationTopology.h" namespace map { namespace core { namespace functors { /*! @class FieldByFieldInversionFunctor * @brief Functors generates a field by inverting an other field nummerically * * This field functors generates a field by inverting an other field. For the inversion the * itk::IterativeInverseDisplacementFieldImageFilter will be used by the functor.\n * This functor needs the input field representation to be set, other wise it wouldn't * be clear how to generate the field (size, spacing). * The output field representation is not used by this functor. * * @todo Im moment benutzt der itk filter defacto die OutputRepresentation, da er die geometry des Ausgabebildes * an dem Eingabefeld orientiert -> entweder die itk:komponente muss modifiziert werden, so dass man die outputgeometrie mitgeben kann, * oder man porbiert doch auch mal den itk::InverseDisplacementFieldImageFilter aus, der hat das feature schon. * @ingroup RegFunctors * @tparam VInputDimensions Dimensions of the input space the field should map from. * @tparam VOutputDimensions Dimensions of the output space the field should map into. */ template class FieldByFieldInversionFunctor : public TransformGenerationFunctor < VInputDimensions, VOutputDimensions > { public: /*! Standard class typedefs. */ typedef FieldByFieldInversionFunctor Self; typedef TransformGenerationFunctor Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkStaticConstMacro(InputDimensions, unsigned int, VInputDimensions); itkStaticConstMacro(OutputDimensions, unsigned int, VOutputDimensions); - typedef typename Superclass::InFieldRepresentationType InFieldRepresentationType; - typedef typename Superclass::InFieldRepresentationConstPointer InFieldRepresentationConstPointer; - typedef typename Superclass::OutFieldRepresentationType OutFieldRepresentationType; - typedef typename Superclass::OutFieldRepresentationConstPointer OutFieldRepresentationConstPointer; + using InFieldRepresentationType = typename Superclass::InFieldRepresentationType; + using InFieldRepresentationConstPointer = typename Superclass::InFieldRepresentationConstPointer; + using OutFieldRepresentationType = typename Superclass::OutFieldRepresentationType; + using OutFieldRepresentationConstPointer = typename Superclass::OutFieldRepresentationConstPointer; typedef typename RegistrationTopology < VInputDimensions, VOutputDimensions >::DirectFieldType FieldType; - typedef typename Superclass::TransformType TransformType; - typedef typename Superclass::TransformPointer TransformPointer; + using TransformType = typename Superclass::TransformType; + using TransformPointer = typename Superclass::TransformPointer; typedef RegistrationKernel < VOutputDimensions, VInputDimensions > SourceFieldKernelType; typedef typename RegistrationTopology < VInputDimensions, VOutputDimensions >::InverseFieldType SourceFieldType; - typedef typename SourceFieldType::ConstPointer SourceFieldConstPointer; - typedef typename SourceFieldKernelType::ConstPointer SourceFieldKernelConstPointer; + using SourceFieldConstPointer = typename SourceFieldType::ConstPointer; + using SourceFieldKernelConstPointer = typename SourceFieldKernelType::ConstPointer; itkTypeMacro(FieldByFieldInversionFunctor, TransformGenerationFunctor); /*! Generates the field an returns the result as a smart pointer. * @eguarantee should be strong * @return Smart pointer to the generated field. */ - virtual TransformPointer generateTransform() const override; + TransformPointer generateTransform() const override; /*! Returns a const pointer to the source field that will be inverted in order * to generate the field. * @eguarantee no fail * @return Pointer to the source field. * @post Return value is guaranteed not to be NULL. */ - const SourceFieldKernelType* getSourceFieldKernel(void) const; + const SourceFieldKernelType* getSourceFieldKernel() const; /*! Static methods that creates the functor. * Thus it is a specialized version of the itkNewMacro() * @eguarantee strong * @param [in] sourceFieldKernel Reference to the field kernel offering the field that should be used as inversion source. * @param [in] pInFieldRepresentation Pointer to the field representation in the input space, * may not be null for this functor. * @return Smart pointer to the new functor * @pre sourceFieldKernel musst be set, may not be NULL * @pre pInFieldRepresentation musst be set, may not be NULL*/ static Pointer New(const SourceFieldKernelType* sourceFieldKernel, const InFieldRepresentationType* pInFieldRepresentation); /*! Creates a functor via New and returns it as a itk::LightObject smart pointer. * @eguarantee strong * @return Smart pointer to the new functor as itk::LightObject*/ - virtual ::itk::LightObject::Pointer CreateAnother(void) const; + virtual ::itk::LightObject::Pointer CreateAnother() const; /*! gets the number of iterations that has been set for the numeric inversion * @return the number of iterations * @eguarantee no fail */ unsigned long getNumberOfIterations() const; /*! Sets the number of iterations for the numeric inversion * @param [in] nrOfIterations the number of iterations * @eguarantee no fail */ void setNumberOfIterations(unsigned long nrOfIterations); /*! gets the stop value (exactness delta) that has been set for the numeric inversion * @return the stop value * @eguarantee no fail */ double getStopValue() const; /*! Sets the stop value for the numeric inversion (exactness) * @param [in] nrOfIterations the number of iterations * @eguarantee no fail */ void setStopValue(double stopValue); protected: /*! Protected constructor used by New. * @eguarantee strong * @param [in] sourceFieldKernel Reference to the field kernel offering the field that should be used as inversion source. * @param [in] pInFieldRepresentation Pointer to the field representation in the input space, * may not be null for this functor. * @pre sourceFieldKernel musst be set, may not be NULL * @pre pInFieldRepresentation musst be set, may not be NULL*/ FieldByFieldInversionFunctor(const SourceFieldKernelType* sourceFieldKernel, const InFieldRepresentationType* pInFieldRepresentation); virtual ~FieldByFieldInversionFunctor(); /*! The source field. Its inversion will be used to generate the result field.*/ SourceFieldKernelConstPointer _spSourceFieldKernel; /*! Methods invoked by itk::LightObject::Print(). */ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; unsigned long _nrOfIterations; double _stopValue; private: FieldByFieldInversionFunctor(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace functors } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapFieldByFieldInversionFunctor.tpp" #endif #endif diff --git a/Code/Core/include/mapFieldByFieldInversionFunctor.tpp b/Code/Core/include/mapFieldByFieldInversionFunctor.tpp index fdf5f62..14e3d88 100644 --- a/Code/Core/include/mapFieldByFieldInversionFunctor.tpp +++ b/Code/Core/include/mapFieldByFieldInversionFunctor.tpp @@ -1,241 +1,241 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_FIELD_BY_FIELD_INVERSION_FUNCTOR_TPP #define __MAP_FIELD_BY_FIELD_INVERSION_FUNCTOR_TPP #include "mapFieldByFieldInversionFunctor.h" #include "mapLogbookMacros.h" #include "itkIterativeInverseDisplacementFieldImageFilter.h" #include "mapGenericVectorFieldTransform.h" namespace map { namespace core { namespace functors { /*! Helper class for a workaround. * right now we only support symmetric inversion. Must be implemented later on. * Template specialization allows the compiling of the code even in unsupported * cases. * @todo: Implement suitable solutions for unsymmetric cases (like VectorCombinationPolicy) */ template class FieldByFieldInversionFunctorHelper { public: typedef typename FieldByFieldInversionFunctor::FieldType FieldType; typedef typename FieldByFieldInversionFunctor::SourceFieldKernelType SourceFieldKernelType; typedef typename FieldByFieldInversionFunctor::InFieldRepresentationType InFieldRepresentationType; typedef typename ::itk::GenericVectorFieldTransform< ::map::core::continuous::ScalarType, VInputDimensions, VOutputDimensions> FieldTransformType; - typedef typename FieldTransformType::Pointer FieldTransformPointer; + using FieldTransformPointer = typename FieldTransformType::Pointer; static inline FieldTransformPointer generate(const SourceFieldKernelType* pSourceFieldKernel, const InFieldRepresentationType* pInFieldRepresentation, double stopValue, unsigned int nrOfIterations) { mapExceptionStaticMacro(ExceptionObject, << "Error unsymmetric field inversion not implemented yet."); return NULL; } }; template class FieldByFieldInversionFunctorHelper < VDimensions, VDimensions > { public: typedef typename FieldByFieldInversionFunctor::FieldType FieldType; typedef typename FieldByFieldInversionFunctor::SourceFieldType SourceFieldType; typedef typename FieldByFieldInversionFunctor::SourceFieldKernelType SourceFieldKernelType; typedef typename FieldByFieldInversionFunctor::InFieldRepresentationType InFieldRepresentationType; typedef typename ::itk::GenericVectorFieldTransform< ::map::core::continuous::ScalarType, VDimensions, VDimensions> FieldTransformType; - typedef typename FieldTransformType::Pointer FieldTransformPointer; + using FieldTransformPointer = typename FieldTransformType::Pointer; static inline FieldTransformPointer generate(const SourceFieldKernelType* pSourceFieldKernel, const InFieldRepresentationType* pInFieldRepresentation, double stopValue, unsigned int nrOfIterations) { const FieldTransformType* pFieldTransformModel = dynamic_cast(pSourceFieldKernel->getTransformModel()); if (!pFieldTransformModel) { mapDefaultExceptionStaticMacro(<< "Error. Cannot generate inverted field. Passed source kernel has no DisplacementFieldTransform instance as transform model."); } typedef itk::IterativeInverseDisplacementFieldImageFilter < SourceFieldType, FieldType > FieldInverterType; mapLogInfoStaticMacro(<< "Generate field by field inversion"); typename FieldInverterType::Pointer spFieldInverter = FieldInverterType::New(); spFieldInverter->SetInput(pFieldTransformModel->GetDisplacementField()); spFieldInverter->SetNumberOfIterations(nrOfIterations); spFieldInverter->SetStopValue(stopValue); typename FieldType::Pointer spField = spFieldInverter->GetOutput(); spFieldInverter->Update(); typename FieldTransformType::Pointer spResult = FieldTransformType::New(); spResult->SetDisplacementField(spField); return spResult.GetPointer(); } }; template typename FieldByFieldInversionFunctor::TransformPointer FieldByFieldInversionFunctor:: generateTransform() const { typedef typename ::itk::GenericVectorFieldTransform< ::map::core::continuous::ScalarType, VInputDimensions, VOutputDimensions> FieldTransformType; typename FieldTransformType::Pointer spResult = FieldByFieldInversionFunctorHelper::generate( _spSourceFieldKernel, Superclass::_spInFieldRepresentation, _stopValue, _nrOfIterations); typedef typename ::itk::map::NULLVectorAwareLinearInterpolateImageFunction < typename FieldTransformType::GenericVectorFieldType, typename FieldTransformType::ScalarType> InterpolatorType; typename InterpolatorType::Pointer interpolator = InterpolatorType::New(); interpolator->SetNullVectorUsage(this->_useNullPoint); typename InterpolatorType::OutputType nullVector; typedef typename InterpolatorType::OutputType::Superclass VectorSuperclassType; nullVector.VectorSuperclassType::operator = (this->_nullPoint); interpolator->SetNullVector(nullVector); spResult->SetInterpolator(interpolator); spResult->SetUseNullPoint(this->_useNullPoint); spResult->SetNullPoint(this->_nullPoint); return spResult.GetPointer(); } template const typename FieldByFieldInversionFunctor::SourceFieldKernelType* FieldByFieldInversionFunctor:: - getSourceFieldKernel(void) const + getSourceFieldKernel() const { return _spSourceFieldKernel; } template typename FieldByFieldInversionFunctor::Pointer FieldByFieldInversionFunctor:: New(const SourceFieldKernelType* sourceFieldKernel, const InFieldRepresentationType* pInFieldRepresentation) { assert(sourceFieldKernel); assert(pInFieldRepresentation); Pointer spFieldByFieldInversionFunctor = new Self(sourceFieldKernel, pInFieldRepresentation); spFieldByFieldInversionFunctor->UnRegister(); return spFieldByFieldInversionFunctor; } template typename ::itk::LightObject::Pointer FieldByFieldInversionFunctor:: - CreateAnother(void) const + CreateAnother() const { ::itk::LightObject::Pointer smartPtr; Pointer spNew = Self::New(_spSourceFieldKernel, Superclass::_spInFieldRepresentation).GetPointer(); smartPtr = spNew; spNew->setNumberOfIterations(this->getNumberOfIterations()); spNew->setStopValue(this->getStopValue()); return smartPtr; } template FieldByFieldInversionFunctor:: FieldByFieldInversionFunctor(const SourceFieldKernelType* sourceFieldKernel, const InFieldRepresentationType* pInFieldRepresentation) : Superclass(pInFieldRepresentation), _spSourceFieldKernel(sourceFieldKernel), _nrOfIterations(20), _stopValue(0.0) { assert(sourceFieldKernel); assert(pInFieldRepresentation); } template FieldByFieldInversionFunctor:: ~FieldByFieldInversionFunctor() {} template void FieldByFieldInversionFunctor:: PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "Number of iterations: " << _nrOfIterations << std::endl; os << indent << "Stop value: " << _stopValue << std::endl; os << indent << "Source field kernel: " << _spSourceFieldKernel << std::endl; } template unsigned long FieldByFieldInversionFunctor:: getNumberOfIterations() const { return _nrOfIterations; } template void FieldByFieldInversionFunctor:: setNumberOfIterations(unsigned long nrOfIterations) { _nrOfIterations = nrOfIterations; } template double FieldByFieldInversionFunctor:: getStopValue() const { return _stopValue; } template void FieldByFieldInversionFunctor:: setStopValue(double stopValue) { _stopValue = stopValue; } } // end namespace functors } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapFieldByFileLoadFunctor.h b/Code/Core/include/mapFieldByFileLoadFunctor.h index ebcdd24..3aa7a46 100644 --- a/Code/Core/include/mapFieldByFileLoadFunctor.h +++ b/Code/Core/include/mapFieldByFileLoadFunctor.h @@ -1,144 +1,144 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_FIELD_BY_FILE_LOAD_FUNCTOR_H #define __MAP_FIELD_BY_FILE_LOAD_FUNCTOR_H #include "mapTransformGenerationFunctor.h" #include "mapMacros.h" namespace map { namespace core { namespace functors { /*! @class FieldByFileLoadFunctor * @brief Functors generates a field by loading it from a specified file * * This field functors loads the field from a specified file when the field is * requested.\n * This functor does not need the input field repesantation to be set. If it is not set, * it will assume that the repesantation equals the size of the stored field. * If it is set and the representation is not a subset of the loaded field, an exception * will be raised. * * @ingroup RegFunctors * @tparam VInputDimensions Dimensions of the input space the field should map from. * @tparam VOutputDimensions Dimensions of the output space the field should map into. */ template class FieldByFileLoadFunctor : public TransformGenerationFunctor < VInputDimensions, VOutputDimensions > { public: /*! Standard class typedefs. */ typedef FieldByFileLoadFunctor Self; typedef TransformGenerationFunctor Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkStaticConstMacro(InputDimensions, unsigned int, VInputDimensions); itkStaticConstMacro(OutputDimensions, unsigned int, VOutputDimensions); - typedef typename Superclass::InFieldRepresentationType InFieldRepresentationType; - typedef typename Superclass::InFieldRepresentationConstPointer InFieldRepresentationConstPointer; - typedef typename Superclass::OutFieldRepresentationType OutFieldRepresentationType; - typedef typename Superclass::OutFieldRepresentationConstPointer OutFieldRepresentationConstPointer; + using InFieldRepresentationType = typename Superclass::InFieldRepresentationType; + using InFieldRepresentationConstPointer = typename Superclass::InFieldRepresentationConstPointer; + using OutFieldRepresentationType = typename Superclass::OutFieldRepresentationType; + using OutFieldRepresentationConstPointer = typename Superclass::OutFieldRepresentationConstPointer; typedef typename RegistrationTopology < VInputDimensions, VOutputDimensions >::DirectFieldType FieldType; - typedef typename Superclass::TransformType TransformType; - typedef typename Superclass::TransformPointer TransformPointer; + using TransformType = typename Superclass::TransformType; + using TransformPointer = typename Superclass::TransformPointer; itkTypeMacro(FieldByFileLoadFunctor, TransformGenerationFunctor); /*! Generates the field an returns the result as a smart pointer. * @eguarantee should be strong * @return Smart pointer to the generated field. */ - virtual TransformPointer generateTransform() const override; + TransformPointer generateTransform() const override; /*! Returns the file path from where the field will be/was loaded. * @eguarantee no fail * @return reference to the specified path. */ - const String& getFieldFilePath(void) const; + const String& getFieldFilePath() const; /*! Static methods that creates the functor. * Thus it is a specialized version of the itkNewMacro() * @eguarantee strong * @param [in] model Reference to the transform model that should be used. * @param [in] pInFieldRepresentation Pointer to the field representation in the input space, * may be null for this functor (meaning that the loaded field defines the representation). * @return Smart pointer to the new functor*/ static Pointer New(const String& filepath, const InFieldRepresentationType* pInFieldRepresentation = NULL); /*! Creates a functor via New and returns it as a itk::LightObject smart pointer. * @eguarantee strong * @return Smart pointer to the new functor as itk::LightObject*/ - virtual ::itk::LightObject::Pointer CreateAnother(void) const; + virtual ::itk::LightObject::Pointer CreateAnother() const; protected: /*! Protected constructor used by New. * @eguarantee strong * @param [in] model Reference to the transform model that should be used. * @param [in] pInFieldRepresentation Pointer to the field representation in the input space, * may be null for this functor (meaning that the loaded field defines the representation).*/ FieldByFileLoadFunctor(const String& filepath, const InFieldRepresentationType* pInFieldRepresentation); virtual ~FieldByFileLoadFunctor(); String _filePath; /*! Methods invoked by itk::LightObject::Print(). */ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; private: FieldByFileLoadFunctor(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace functors /*! creates a field representation descriptor from the meta header file of a meta image @eguarantee strong @param filePath Path to the header file of the meta image @return FieldRepresentationDescriptor that describes the meta image @pre filePath must point to a valid file @pre The meta image specified in the file must have the correct dimension. @exception DimRepresentationException Thrown if the meta image stored in the file has not the correct dimension. @exception itk::ImageFileReaderException Thrown if filePath does not exist or is an incorrect file. */ template typename FieldRepresentationDescriptor::Pointer createFieldRepresentationOfMetaImageFile(const String& filePath); } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapFieldByFileLoadFunctor.tpp" #endif #endif diff --git a/Code/Core/include/mapFieldByFileLoadFunctor.tpp b/Code/Core/include/mapFieldByFileLoadFunctor.tpp index b6a22ee..73dcef4 100644 --- a/Code/Core/include/mapFieldByFileLoadFunctor.tpp +++ b/Code/Core/include/mapFieldByFileLoadFunctor.tpp @@ -1,275 +1,275 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_FIELD_BY_FILE_LOAD_FUNCTOR_TPP #define __MAP_FIELD_BY_FILE_LOAD_FUNCTOR_TPP #include "mapFieldByFileLoadFunctor.h" #include "mapLogbookMacros.h" #include "mapRepresentationException.h" #include "mapGenericVectorFieldTransform.h" #include "itkImageFileReader.h" #include "itkImageIOFactory.h" #include "mapNULLVectorAwareLinearInterpolateImageFunction.h" namespace map { namespace core { namespace functors { /*! Helper class for a workaround. * right now we only support symmetric inversion. Must be implemented later on. * Template specialization allows the compiling of the code even in unsupported * cases. * @todo: Implement suitable solutions for unsymmetric cases (like VectorCombinationPolicy) */ template class FieldByFileLoadFunctorHelper { public: typedef typename ::itk::GenericVectorFieldTransform< ::map::core::continuous::ScalarType, VInputDimensions, VOutputDimensions> TransformType; - typedef typename TransformType::Pointer TransformPointer; + using TransformPointer = typename TransformType::Pointer; typedef typename FieldByFileLoadFunctor::InFieldRepresentationType InFieldRepresentationType; static inline TransformPointer generate(const ::map::core::String& filePath, const InFieldRepresentationType* pInFieldRepresentation) { mapExceptionStaticMacro(ExceptionObject, << "Error unsymmetric field inversion not implemented yet."); return NULL; } }; template class FieldByFileLoadFunctorHelper < VDimensions, VDimensions > { public: typedef typename FieldByFileLoadFunctor::FieldType FieldType; typedef typename ::itk::GenericVectorFieldTransform< ::map::core::continuous::ScalarType, VDimensions, VDimensions> TransformType; - typedef typename TransformType::Pointer TransformPointer; + using TransformPointer = typename TransformType::Pointer; typedef typename FieldByFileLoadFunctor::InFieldRepresentationType InFieldRepresentationType; static inline TransformPointer generate(const ::map::core::String& filePath, const InFieldRepresentationType* pInFieldRepresentation) { typedef ::itk::ImageFileReader< FieldType > FieldReaderType; typename FieldReaderType::Pointer spFieldReader = FieldReaderType::New(); typename FieldType::Pointer spField = NULL; try { spFieldReader->SetFileName(filePath.c_str()); spField = spFieldReader->GetOutput(); spFieldReader->Update(); } catch (itk::ExceptionObject& e) { e.SetDescription(String("Error in FieldByFileLoadFunctor while loading field. File name: ") + filePath + String(". Description: ") + e.GetDescription()); throw; } catch (const std::exception& e) { mapExceptionStaticMacro(ExceptionObject, << "Error in FieldByFileLoadFunctor while loading field. File name: " << filePath << ". Description: " << e.what()); } catch (...) { mapExceptionStaticMacro(ExceptionObject, << "Unknown error in FieldByFileLoadFunctor while loading field. File name: " << filePath); } /**@TODO Have to add check of the field representation (the specified one and the one set set in the functor.**/ //Superclass::_spInFieldRepresentation = createFieldRepresentation(*spField).GetPointer(); TransformPointer spResult = TransformType::New(); spResult->SetDisplacementField(spField); return spResult.GetPointer(); } }; template typename FieldByFileLoadFunctor::TransformPointer FieldByFileLoadFunctor:: generateTransform() const { mapLogInfoMacro(<< "Generate field by file loading. File name: " << _filePath); typedef typename FieldByFileLoadFunctorHelper::TransformType FieldTransformType; typename FieldTransformType::Pointer spResult = FieldByFileLoadFunctorHelper::generate(_filePath, Superclass::_spInFieldRepresentation); typedef typename ::itk::map::NULLVectorAwareLinearInterpolateImageFunction < typename FieldTransformType::GenericVectorFieldType, typename FieldTransformType::ScalarType> InterpolatorType; typename InterpolatorType::Pointer interpolator = InterpolatorType::New(); interpolator->SetNullVectorUsage(this->_useNullPoint); typename InterpolatorType::OutputType nullVector; typedef typename InterpolatorType::OutputType::Superclass VectorSuperclassType; nullVector.VectorSuperclassType::operator = (this->_nullPoint); interpolator->SetNullVector(nullVector); spResult->SetInterpolator(interpolator); spResult->SetUseNullPoint(this->_useNullPoint); spResult->SetNullPoint(this->_nullPoint); return spResult.GetPointer(); } template const String& FieldByFileLoadFunctor:: - getFieldFilePath(void) const + getFieldFilePath() const { return _filePath; } template typename FieldByFileLoadFunctor::Pointer FieldByFileLoadFunctor:: New(const String& filepath, const InFieldRepresentationType* pInFieldRepresentation) { Pointer spFieldByFileLoadFunctor = new Self(filepath, pInFieldRepresentation); spFieldByFileLoadFunctor->UnRegister(); return spFieldByFileLoadFunctor; } template typename ::itk::LightObject::Pointer FieldByFileLoadFunctor:: - CreateAnother(void) const + CreateAnother() const { ::itk::LightObject::Pointer smartPtr; smartPtr = Self::New(_filePath, Superclass::_spInFieldRepresentation).GetPointer(); return smartPtr; } template FieldByFileLoadFunctor:: FieldByFileLoadFunctor(const String& filepath, const InFieldRepresentationType* pInFieldRepresentation) : Superclass(pInFieldRepresentation), _filePath(filepath) { } template FieldByFileLoadFunctor:: ~FieldByFileLoadFunctor() {} template void FieldByFileLoadFunctor:: PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "File path: " << _filePath << std::endl; } } // end namespace functors template typename FieldRepresentationDescriptor::Pointer createFieldRepresentationOfMetaImageFile(const String& filePath) { if (filePath.empty()) { } if (!itksys::SystemTools::FileExists(filePath.c_str())) { mapExceptionStaticMacro(::itk::ImageFileReaderException, << "The file doesn't exist. Cannot create field description." << std::endl << "Filename = " << filePath); } itk::ImageIOBase::Pointer spImageIO = itk::ImageIOFactory::CreateImageIO(filePath.c_str(), itk::ImageIOFactory::ReadMode); if (spImageIO.IsNull()) { mapExceptionStaticMacro(::itk::ImageFileReaderException, << "Cannot create field description. No image io available for field file." << std::endl << "Filename = " << filePath); } spImageIO->SetFileName(filePath); spImageIO->ReadImageInformation(); const unsigned int numberOfDimensionsIO = spImageIO->GetNumberOfDimensions(); if (numberOfDimensionsIO != VDimensions) { mapExceptionStaticMacro(DimRepresentationException, << "Cannot create field description. Invalid dimensionality. Dimension of meta image: " << numberOfDimensionsIO << "; expected Dimension: " << VDimensions); } typedef FieldRepresentationDescriptor FRDType; typename FRDType::PointType origin; typename FRDType::SizeType fieldSize; typename FRDType::SpacingType fieldSpacing; typename FRDType::DirectionType direction; for (unsigned int i = 0; i < VDimensions; i++) { fieldSpacing[i] = spImageIO->GetSpacing(i); fieldSize[i] = static_cast(spImageIO->GetDimensions( i) * fieldSpacing[i]); origin[i] = spImageIO->GetOrigin(i); // Please note: direction cosines are stored as columns of the // direction matrix std::vector axis; axis = spImageIO->GetDirection(i); for (unsigned j = 0; j < VDimensions; j++) { direction[j][i] = axis[j]; } } typename FRDType::Pointer spFRD = FRDType::New(); spFRD->setSpacing(fieldSpacing); spFRD->setSize(fieldSize); spFRD->setOrigin(origin); spFRD->setDirection(direction); return spFRD; }; } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapFieldByModelFunctor.h b/Code/Core/include/mapFieldByModelFunctor.h index 1339f8f..1b08d16 100644 --- a/Code/Core/include/mapFieldByModelFunctor.h +++ b/Code/Core/include/mapFieldByModelFunctor.h @@ -1,162 +1,162 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_FIELD_BY_MODEL_FUNCTOR_H #define __MAP_FIELD_BY_MODEL_FUNCTOR_H #include #include "mapTransformGenerationFunctor.h" #include "mapRegistrationKernel.h" #include "mapRegistrationTopology.h" namespace map { namespace core { namespace functors { /*! @class FieldByModelFunctor * @brief Functors generates a field by sampling a transformation model * * This field functors generates a field by sampling a transformation which is * assumed to model the same mapping direction.\n * This functor needs the input field representation to be set, other wise it wouldn't * be clear how to generate the field (size, spacing). * The output field representation is not used by this functor. * * @ingroup RegFunctors * @tparam VInputDimensions Dimensions of the input space the field should map from. * @tparam VOutputDimensions Dimensions of the output space the field should map into. */ template class FieldByModelFunctor : public TransformGenerationFunctor < VInputDimensions, VOutputDimensions > { public: /*! Standard class typedefs. */ typedef FieldByModelFunctor Self; typedef TransformGenerationFunctor Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkStaticConstMacro(InputDimensions, unsigned int, VInputDimensions); itkStaticConstMacro(OutputDimensions, unsigned int, VOutputDimensions); - typedef typename Superclass::InFieldRepresentationType InFieldRepresentationType; - typedef typename Superclass::InFieldRepresentationConstPointer InFieldRepresentationConstPointer; - typedef typename Superclass::OutFieldRepresentationType OutFieldRepresentationType; - typedef typename Superclass::OutFieldRepresentationConstPointer OutFieldRepresentationConstPointer; + using InFieldRepresentationType = typename Superclass::InFieldRepresentationType; + using InFieldRepresentationConstPointer = typename Superclass::InFieldRepresentationConstPointer; + using OutFieldRepresentationType = typename Superclass::OutFieldRepresentationType; + using OutFieldRepresentationConstPointer = typename Superclass::OutFieldRepresentationConstPointer; typedef typename RegistrationTopology < VInputDimensions, VOutputDimensions >::DirectFieldType FieldType; - typedef typename Superclass::TransformType TransformType; - typedef typename Superclass::TransformPointer TransformPointer; + using TransformType = typename Superclass::TransformType; + using TransformPointer = typename Superclass::TransformPointer; typedef typename RegistrationTopology < VInputDimensions, VOutputDimensions >::DirectTransformType SourceTransformModelType; - typedef typename SourceTransformModelType::ConstPointer SourceTransformModelConstPointer; + using SourceTransformModelConstPointer = typename SourceTransformModelType::ConstPointer; itkTypeMacro(FieldByModelFunctor, TransformGenerationFunctor); /*! Generates the field an returns the result as a smart pointer. * @eguarantee should be strong * @return Smart pointer to the generated field. */ - virtual TransformPointer generateTransform() const override; + TransformPointer generateTransform() const override; /*! Returns a const pointer to the transform model that will be inverted in order * to generate the field. * @eguarantee no fail * @return Pointer to the transform model. * @post Return value is guaranteed not to be NULL. */ - const SourceTransformModelType* getSourceTransformModel(void) const; + const SourceTransformModelType* getSourceTransformModel() const; /*! Static methods that creates the functor. * Thus it is a specialized version of the itkNewMacro() * @eguarantee strong * @param [in] model Pointer to the transform model that should be used. * @param [in] pInFieldRepresentation Pointer to the field representation in the input space, * may not be null for this functor. * @return Smart pointer to the new functor * @pre pInFieldRepresentation musst be set, may not be NULL * @pre model musst be set, may not be NULL */ static Pointer New(const SourceTransformModelType* model, const InFieldRepresentationType* pInFieldRepresentation); /*! Creates a functor via New and returns it as a itk::LightObject smart pointer. * @eguarantee strong * @return Smart pointer to the new functor as itk::LightObject*/ - virtual ::itk::LightObject::Pointer CreateAnother(void) const; + virtual ::itk::LightObject::Pointer CreateAnother() const; protected: /*! Protected constructor used by New. * @eguarantee strong * @param [in] model Reference to the transform model that should be used. * @param [in] pInFieldRepresentation Pointer to the field representation in the input space, * may not be null for this functor. * @pre pInFieldRepresentation musst be set, may not be NULL * @pre model musst be set, may not be NULL */ FieldByModelFunctor(const SourceTransformModelType* model, const InFieldRepresentationType* pInFieldRepresentation); virtual ~FieldByModelFunctor(); SourceTransformModelConstPointer _spTransformModel; /*! Methods invoked by itk::LightObject::Print(). */ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; private: FieldByModelFunctor(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace functors /*! @brief Helper function that samples a given transform into a deformation field * * This function generates a field by sampling a transformation which is * assumed to model the same mapping direction.\n * This function needs the input field representation to be set, other wise it wouldn't * be clear how to generate the field (size, spacing). * @pre transform must be valid and not null. * @pre inDesc must be valid and not null. * @param transform Pointer to the transform that should be sampled * @param inDesc Pointer to field descriptor, specifieng the geometry of the field. * @ingroup RegFunctors * @tparam VInputDimensions Dimensions of the input space the field should map from. * @tparam VOutputDimensions Dimensions of the output space the field should map into. */ template typename RegistrationTopology < VInputDimensions, VOutputDimensions >::DirectFieldPointer generateFieldFromTransform(const typename RegistrationTopology < VInputDimensions, VOutputDimensions >::DirectTransformType* transform, const FieldRepresentationDescriptor* inDesc); } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapFieldByModelFunctor.tpp" #endif #endif diff --git a/Code/Core/include/mapFieldByModelFunctor.tpp b/Code/Core/include/mapFieldByModelFunctor.tpp index 9bee401..6381357 100644 --- a/Code/Core/include/mapFieldByModelFunctor.tpp +++ b/Code/Core/include/mapFieldByModelFunctor.tpp @@ -1,228 +1,228 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_FIELD_BY_MODEL_FUNCTOR_TPP #define __MAP_FIELD_BY_MODEL_FUNCTOR_TPP #include "mapFieldByModelFunctor.h" #include "mapLogbookMacros.h" #include "mapPointVectorCombinationPolicy.h" #include "mapGenericVectorFieldTransform.h" #include "itkImageRegionIterator.h" namespace map { namespace core { template typename RegistrationTopology < VInputDimensions, VOutputDimensions >::DirectFieldPointer generateFieldFromTransform(const typename RegistrationTopology < VInputDimensions, VOutputDimensions >::DirectTransformType* transform, const FieldRepresentationDescriptor* inDesc) { if (!transform) { mapDefaultExceptionStaticMacro(<< "Error. Cannot generate field out of transform. Passed transform is NULL.") } if (!inDesc) { mapDefaultExceptionStaticMacro(<< "Error. Cannot generate field out of transform. Passed input field representation descriptor is is NULL.") } typedef typename RegistrationTopology ::DirectFieldType FieldType; typename RegistrationTopology ::DirectFieldPointer spField = FieldType::New(); typedef itk::ImageRegionIterator< FieldType > IteratorType; typename FieldType::RegionType region = inDesc->getRepresentedLocalImageRegion(); //allocate image memory spField->SetRegions(region); spField->SetSpacing(inDesc->getSpacing()); spField->SetOrigin(inDesc->getOrigin()); spField->SetDirection(inDesc->getDirection()); spField->Allocate(); //sample the transform into a vector field IteratorType iterator(spField, spField->GetLargestPossibleRegion()); for (iterator.GoToBegin(); !(iterator.IsAtEnd()); ++iterator) { typename FieldType::IndexType index = iterator.GetIndex(); typename FieldType::PointType inPoint; spField->TransformIndexToPhysicalPoint(index, inPoint); typename RegistrationTopology < VInputDimensions, VOutputDimensions >::DirectTransformType::OutputPointType outPoint = transform->TransformPoint(inPoint); typename FieldType::ValueType value; ::map::core::PointVectorCombinationPolicy::computeVector(inPoint, outPoint, value); iterator.Set(value); } return spField; }; namespace functors { /*! Helper class for a workaround. * right now we only support symmetric inversion. Must be implemented later on. * Template specialization allows the compiling of the code even in unsupported * cases. * @todo: Implement suitable solutions for unsymmetric cases (like VectorCombinationPolicy) */ template class FieldByModelFunctorHelper { public: typedef typename ::itk::GenericVectorFieldTransform< ::map::core::continuous::ScalarType, VInputDimensions, VOutputDimensions> TransformType; - typedef typename TransformType::Pointer TransformPointer; + using TransformPointer = typename TransformType::Pointer; typedef typename FieldByModelFunctor::SourceTransformModelType SourceTransformModelType; typedef typename FieldByModelFunctor::InFieldRepresentationType InFieldRepresentationType; static inline TransformPointer generate(const SourceTransformModelType* pTransformModel, const InFieldRepresentationType* pInFieldRepresentation) { mapExceptionStaticMacro(ExceptionObject, << "Error unsymmetric field inversion not implemented yet."); return NULL; } }; template class FieldByModelFunctorHelper < VDimensions, VDimensions > { public: typedef typename FieldByModelFunctor::FieldType FieldType; typedef typename ::itk::GenericVectorFieldTransform< ::map::core::continuous::ScalarType, VDimensions, VDimensions> TransformType; - typedef typename TransformType::Pointer TransformPointer; + using TransformPointer = typename TransformType::Pointer; typedef typename FieldByModelFunctor::SourceTransformModelType SourceTransformModelType; typedef typename FieldByModelFunctor::InFieldRepresentationType InFieldRepresentationType; static inline TransformPointer generate(const SourceTransformModelType* pTransformModel, const InFieldRepresentationType* pInFieldRepresentation) { typename FieldType::Pointer spField = generateFieldFromTransform(pTransformModel, pInFieldRepresentation); TransformPointer spResult = TransformType::New(); spResult->SetDisplacementField(spField); return spResult.GetPointer(); } }; template typename FieldByModelFunctor::TransformPointer FieldByModelFunctor:: generateTransform() const { mapLogInfoMacro(<< "Generate field by model sampling"); typedef typename FieldByModelFunctorHelper::TransformType FieldTransformType; typename FieldTransformType::Pointer spResult = FieldByModelFunctorHelper::generate(_spTransformModel, Superclass::_spInFieldRepresentation); typedef ::itk::map::NULLVectorAwareLinearInterpolateImageFunction < typename FieldTransformType::GenericVectorFieldType, typename FieldTransformType::ScalarType> InterpolatorType; typename InterpolatorType::Pointer interpolator = InterpolatorType::New(); interpolator->SetNullVectorUsage(this->_useNullPoint); typename InterpolatorType::OutputType nullVector; typedef typename InterpolatorType::OutputType::Superclass VectorSuperclassType; nullVector.VectorSuperclassType::operator = (this->_nullPoint); interpolator->SetNullVector(nullVector); spResult->SetInterpolator(interpolator); spResult->SetUseNullPoint(this->_useNullPoint); spResult->SetNullPoint(this->_nullPoint); return spResult.GetPointer(); } template const typename FieldByModelFunctor::SourceTransformModelType* FieldByModelFunctor:: - getSourceTransformModel(void) const + getSourceTransformModel() const { return _spTransformModel; } template typename FieldByModelFunctor::Pointer FieldByModelFunctor:: New(const SourceTransformModelType* model, const InFieldRepresentationType* pInFieldRepresentation) { assert(pInFieldRepresentation); Pointer spFieldByModelFunctor = new Self(model, pInFieldRepresentation); spFieldByModelFunctor->UnRegister(); return spFieldByModelFunctor; } template typename ::itk::LightObject::Pointer FieldByModelFunctor:: - CreateAnother(void) const + CreateAnother() const { ::itk::LightObject::Pointer smartPtr; smartPtr = Self::New(_spTransformModel, Superclass::_spInFieldRepresentation).GetPointer(); return smartPtr; } template FieldByModelFunctor:: FieldByModelFunctor(const SourceTransformModelType* model, const InFieldRepresentationType* pInFieldRepresentation) : Superclass(pInFieldRepresentation), _spTransformModel(model) { assert(pInFieldRepresentation); } template FieldByModelFunctor:: ~FieldByModelFunctor() {} template void FieldByModelFunctor:: PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "Transform model: " << _spTransformModel << std::endl; } } // end namespace functors } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapFieldByModelInversionFunctor.h b/Code/Core/include/mapFieldByModelInversionFunctor.h index ad19b28..782c1e9 100644 --- a/Code/Core/include/mapFieldByModelInversionFunctor.h +++ b/Code/Core/include/mapFieldByModelInversionFunctor.h @@ -1,175 +1,175 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_FIELD_BY_MODEL_INVERSION_FUNCTOR_H #define __MAP_FIELD_BY_MODEL_INVERSION_FUNCTOR_H #include #include "mapTransformGenerationFunctor.h" #include "mapRegistrationKernel.h" #include "mapRegistrationTopology.h" namespace map { namespace core { namespace functors { /*! @class FieldByModelInversionFunctor * @brief Functors generates a field by sampling a transformation model after inverting it numerically * * This field functors generates a field by sampling the inversion of a transformation which is * assumed to model the inverse mapping direction. The inversion of the model will be done numerically, * thus if the model can be inverted analytically, you should invert the transform and use the inverted * one in combination with FieldByModelFunctor.\n * This functor needs the input field representation to be set, other wise it wouldn't * be clear how to generate the field (size, spacing). * The output field representation is not used by this functor. * * @todo Tatsächliche qualität der Iterative Inversion methode feststellen. in Kombination mit der * scale transform (faktor 3) gabe es bei 40x40x40 bildern starke abweicheichungen. Ist das auch * be anderen transformationen so? vielleicht auf die fixed point methode umsteigen? * @ingroup RegFunctors * @sa FieldByModelFunctor * @tparam VInputDimensions Dimensions of the input space the field should map from. * @tparam VOutputDimensions Dimensions of the output space the field should map into. */ template class FieldByModelInversionFunctor : public TransformGenerationFunctor < VInputDimensions, VOutputDimensions > { public: /*! Standard class typedefs. */ typedef FieldByModelInversionFunctor Self; typedef TransformGenerationFunctor Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkStaticConstMacro(InputDimensions, unsigned int, VInputDimensions); itkStaticConstMacro(OutputDimensions, unsigned int, VOutputDimensions); - typedef typename Superclass::InFieldRepresentationType InFieldRepresentationType; - typedef typename Superclass::InFieldRepresentationConstPointer InFieldRepresentationConstPointer; - typedef typename Superclass::OutFieldRepresentationType OutFieldRepresentationType; - typedef typename Superclass::OutFieldRepresentationConstPointer OutFieldRepresentationConstPointer; + using InFieldRepresentationType = typename Superclass::InFieldRepresentationType; + using InFieldRepresentationConstPointer = typename Superclass::InFieldRepresentationConstPointer; + using OutFieldRepresentationType = typename Superclass::OutFieldRepresentationType; + using OutFieldRepresentationConstPointer = typename Superclass::OutFieldRepresentationConstPointer; typedef typename RegistrationTopology < VInputDimensions, VOutputDimensions >::DirectFieldType FieldType; - typedef typename Superclass::TransformType TransformType; - typedef typename Superclass::TransformPointer TransformPointer; + using TransformType = typename Superclass::TransformType; + using TransformPointer = typename Superclass::TransformPointer; typedef typename RegistrationTopology < VOutputDimensions, VInputDimensions >::DirectTransformType SourceTransformModelType; - typedef typename SourceTransformModelType::ConstPointer SourceTransformModelConstPointer; + using SourceTransformModelConstPointer = typename SourceTransformModelType::ConstPointer; itkTypeMacro(FieldByModelInversionFunctor, TransformGenerationFunctor); /*! Generates the field an returns the result as a smart pointer. * @eguarantee should be strong * @return Smart pointer to the generated field. */ - virtual TransformPointer generateTransform() const override; + TransformPointer generateTransform() const override; /*! Returns a const pointer to the transform model that will be inverted in order * to generate the field. * @eguarantee no fail * @return Pointer to the transform model. * @post Return value is guaranteed not to be NULL. */ - const SourceTransformModelType* getSourceTransformModel(void) const; + const SourceTransformModelType* getSourceTransformModel() const; /*! Static methods that creates the functor. * Thus it is a specialized version of the itkNewMacro() * @eguarantee strong * @param [in] model Pointer to the transform model that should be used. * @param [in] pInFieldRepresentation Pointer to the field representation in the input space, * may not be null for this functor. * @return Smart pointer to the new functor * @pre pInFieldRepresentation musst be set, may not be NULL * @pre model musst be set, may not be NULL */ static Pointer New(const SourceTransformModelType* model, const InFieldRepresentationType* pInFieldRepresentation); /*! Creates a functor via New and returns it as a itk::LightObject smart pointer. * @eguarantee strong * @return Smart pointer to the new functor as itk::LightObject*/ - virtual ::itk::LightObject::Pointer CreateAnother(void) const; + virtual ::itk::LightObject::Pointer CreateAnother() const; /*! gets the number of iterations that has been set for the numeric inversion * @return the number of iterations * @eguarantee no fail */ unsigned long getNumberOfIterations() const; /*! Sets the number of iterations for the numeric inversion * @param [in] nrOfIterations the number of iterations * @eguarantee no fail */ void setNumberOfIterations(unsigned long nrOfIterations); /*! gets the stop value (exactness delta) that has been set for the numeric inversion * @return the stop value * @eguarantee no fail */ double getStopValue() const; /*! Sets the stop value for the numeric inversion (exactness) * @param [in] nrOfIterations the number of iterations * @eguarantee no fail */ void setStopValue(double stopValue); protected: /*! Protected constructor used by New. * @eguarantee strong * @param [in] model Pointer to the transform model that should be used. * @param [in] pInFieldRepresentation Pointer to the field representation in the input space, * may not be null for this functor. * @param [in] pOutFieldRepresentation Pointer to the field representation in the output space, * may be NULL if no representation is defined. * @pre pInFieldRepresentation musst be set, may not be NULL * @pre model musst be set, may not be NULL */ FieldByModelInversionFunctor(const SourceTransformModelType* model, const InFieldRepresentationType* pInFieldRepresentation); virtual ~FieldByModelInversionFunctor(); SourceTransformModelConstPointer _spTransformModel; unsigned long _nrOfIterations; double _stopValue; /*! Methods invoked by itk::LightObject::Print(). */ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; private: FieldByModelInversionFunctor(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace functors } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapFieldByModelInversionFunctor.tpp" #endif #endif diff --git a/Code/Core/include/mapFieldByModelInversionFunctor.tpp b/Code/Core/include/mapFieldByModelInversionFunctor.tpp index 1ce503f..4fdbe01 100644 --- a/Code/Core/include/mapFieldByModelInversionFunctor.tpp +++ b/Code/Core/include/mapFieldByModelInversionFunctor.tpp @@ -1,235 +1,235 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_FIELD_BY_MODEL_INVERSION_FUNCTOR_TPP #define __MAP_FIELD_BY_MODEL_INVERSION_FUNCTOR_TPP #include "mapFieldByModelInversionFunctor.h" #include "mapIterativeInverseTransformToDisplacementFieldSource.h" #include "mapLogbookMacros.h" #include "mapGenericVectorFieldTransform.h" namespace map { namespace core { namespace functors { /*! Helper class for a workaround. * right now we only support symmetric inversion. Must be implemented later on. * Template specialization allows the compiling of the code even in unsupported * cases. * @todo: Implement suitable solutions for unsymmetric cases (like VectorCombinationPolicy) */ template class FieldByModelInversionFunctorHelper { public: typedef typename ::itk::GenericVectorFieldTransform< ::map::core::continuous::ScalarType, VInputDimensions, VOutputDimensions> TransformType; - typedef typename TransformType::Pointer TransformPointer; + using TransformPointer = typename TransformType::Pointer; typedef typename FieldByModelInversionFunctor::SourceTransformModelType SourceTransformModelType; typedef typename FieldByModelInversionFunctor::InFieldRepresentationType InFieldRepresentationType; static inline TransformPointer generate(const SourceTransformModelType* pTransformModel, const InFieldRepresentationType* pInFieldRepresentation, double stopValue, unsigned int nrOfIterations) { mapExceptionStaticMacro(ExceptionObject, << "Error unsymmetric field inversion not implemented yet."); return NULL; } }; template class FieldByModelInversionFunctorHelper < VDimensions, VDimensions > { public: typedef typename FieldByModelInversionFunctor::FieldType FieldType; typedef typename ::itk::GenericVectorFieldTransform< ::map::core::continuous::ScalarType, VDimensions, VDimensions> TransformType; - typedef typename TransformType::Pointer TransformPointer; + using TransformPointer = typename TransformType::Pointer; typedef typename FieldByModelInversionFunctor::SourceTransformModelType SourceTransformModelType; typedef typename FieldByModelInversionFunctor::InFieldRepresentationType InFieldRepresentationType; static inline TransformPointer generate(const SourceTransformModelType* pTransformModel, const InFieldRepresentationType* pInFieldRepresentation, double stopValue, unsigned int nrOfIterations) { typedef itk::map::IterativeInverseTransformToDisplacementFieldSource < FieldType, typename SourceTransformModelType::ScalarType > FieldSourceType; typename FieldSourceType::Pointer spFieldSource = FieldSourceType::New(); spFieldSource->SetTransform(pTransformModel); spFieldSource->SetSpacing(pInFieldRepresentation->getSpacing()); spFieldSource->SetOrigin(pInFieldRepresentation->getOrigin()); spFieldSource->SetDirection(pInFieldRepresentation->getDirection()); typename InFieldRepresentationType::ImageRegionType region = pInFieldRepresentation->getRepresentedLocalImageRegion(); spFieldSource->SetSize(region.GetSize()); spFieldSource->SetNumberOfIterations(nrOfIterations); spFieldSource->SetStopValue(stopValue); typename FieldType::Pointer spField = spFieldSource->GetOutput(); spFieldSource->Update(); typename TransformType::Pointer spResult = TransformType::New(); spResult->SetDisplacementField(spField); return spResult.GetPointer(); } }; template typename FieldByModelInversionFunctor::TransformPointer FieldByModelInversionFunctor:: generateTransform() const { mapLogInfoMacro(<< "Generate field by model inversion"); typedef typename FieldByModelInversionFunctorHelper::TransformType FieldTransformType; typename FieldTransformType::Pointer spResult = FieldByModelInversionFunctorHelper::generate(_spTransformModel, Superclass::_spInFieldRepresentation, _stopValue, _nrOfIterations); typedef typename ::itk::map::NULLVectorAwareLinearInterpolateImageFunction < typename FieldTransformType::GenericVectorFieldType, typename FieldTransformType::ScalarType> InterpolatorType; typename InterpolatorType::Pointer interpolator = InterpolatorType::New(); interpolator->SetNullVectorUsage(this->_useNullPoint); typename InterpolatorType::OutputType nullVector; typedef typename InterpolatorType::OutputType::Superclass VectorSuperclassType; nullVector.VectorSuperclassType::operator = (this->_nullPoint); interpolator->SetNullVector(nullVector); spResult->SetInterpolator(interpolator); spResult->SetUseNullPoint(this->_useNullPoint); spResult->SetNullPoint(this->_nullPoint); return spResult.GetPointer(); } template const typename FieldByModelInversionFunctor::SourceTransformModelType* FieldByModelInversionFunctor:: - getSourceTransformModel(void) const + getSourceTransformModel() const { return _spTransformModel; } template typename FieldByModelInversionFunctor::Pointer FieldByModelInversionFunctor:: New(const SourceTransformModelType* model, const InFieldRepresentationType* pInFieldRepresentation) { assert(pInFieldRepresentation); assert(model); Pointer spFieldByModelInversionFunctor = new Self(model, pInFieldRepresentation); spFieldByModelInversionFunctor->UnRegister(); return spFieldByModelInversionFunctor; } template typename ::itk::LightObject::Pointer FieldByModelInversionFunctor:: - CreateAnother(void) const + CreateAnother() const { ::itk::LightObject::Pointer smartPtr; Pointer spNew = Self::New(_spTransformModel, Superclass::_spInFieldRepresentation).GetPointer(); smartPtr = spNew; spNew->setNumberOfIterations(this->getNumberOfIterations()); spNew->setStopValue(this->getStopValue()); return smartPtr; } template FieldByModelInversionFunctor:: FieldByModelInversionFunctor(const SourceTransformModelType* model, const InFieldRepresentationType* pInFieldRepresentation) : Superclass(pInFieldRepresentation), _spTransformModel(model), _nrOfIterations(20), _stopValue(0.0) { assert(model); assert(pInFieldRepresentation); } template FieldByModelInversionFunctor:: ~FieldByModelInversionFunctor() {} template void FieldByModelInversionFunctor:: PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "Number of iterations: " << _nrOfIterations << std::endl; os << indent << "Stop value: " << _stopValue << std::endl; os << indent << "Transform model: " << _spTransformModel << std::endl; } template unsigned long FieldByModelInversionFunctor:: getNumberOfIterations() const { return _nrOfIterations; } template void FieldByModelInversionFunctor:: setNumberOfIterations(unsigned long nrOfIterations) { _nrOfIterations = nrOfIterations; } template double FieldByModelInversionFunctor:: getStopValue() const { return _stopValue; } template void FieldByModelInversionFunctor:: setStopValue(double stopValue) { _stopValue = stopValue; } } // end namespace functors } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapFieldDecomposer.h b/Code/Core/include/mapFieldDecomposer.h index b9df779..9ce0f30 100644 --- a/Code/Core/include/mapFieldDecomposer.h +++ b/Code/Core/include/mapFieldDecomposer.h @@ -1,82 +1,82 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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: 1283 $ (last changed revision) // @date $Date: 2016-03-30 16:58:36 +0200 (Mi, 30 Mrz 2016) $ (last change date) // @author $Author: floca $ (last changed by) // Subversion HeadURL: $HeadURL: https://svn.inet.dkfz-heidelberg.de/sbr/Sources/SBR-Projects/MatchPoint/branches/Issue-1505/Code/Core/include/mapAffineMatrixDecomposer.h $ */ #ifndef __FIELD_DECOMPOSER_H #define __FIELD_DECOMPOSER_H #include "mapRegistrationKernelBase.h" #include "mapRegistrationTopology.h" namespace map { namespace core { /** Convinience helper to extract a vector field out of transforms/kernel * if they are basead on a field..*/ template struct FieldDecomposer { public: typedef RegistrationKernelBase KernelType; - typedef typename KernelType::TransformType TransformType; + using TransformType = typename KernelType::TransformType; typedef typename RegistrationTopology::DirectFieldType FieldType; - typedef typename FieldType::ConstPointer FieldConstPointer; - typedef typename FieldType::Pointer FieldPointer; + using FieldConstPointer = typename FieldType::ConstPointer; + using FieldPointer = typename FieldType::Pointer; /*! Convinient function that tries to get the internals of the kernel as vector field. * The function checks if the passed kernel has a transform that containes a vector field. * If thats true, it checks if it can retrieve it. * * @eguarantee strong * @pre pKernel musst point to a valid instance. * @param [in] Pointer to the kernel that should be decomposed. * @param [out] field Referenz to the smart pointer of the extracted field. * @return Indicates if a field could be extrakted. If it returns false, it cannot be decomposed * and the referenced output parameters are invalid.*/ static bool decomposeKernel(const KernelType* pKernel, FieldConstPointer& field); /*! Convinient function that tries to get the internals of the transform as vector field. * The function checks if the passed transform containes a vector field. * If thats true, it checks if it can retrieve it. * * @eguarantee strong * @pre pKernel musst point to a valid instance. * @param [in] Pointer to the transform that should be decomposed. * @param [out] field Referenz to the smart pointer of the extracted field. * @return Indicates if a field could be extrakted. If it returns false, it cannot be decomposed * and the referenced output parameters are invalid.*/ static bool decomposeTransform(const TransformType* pTransform, FieldConstPointer& field); static bool decomposeTransform(TransformType* pTransform, FieldPointer& field); }; - } -} + } // namespace core +} // namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapFieldDecomposer.tpp" #endif #endif diff --git a/Code/Core/include/mapFieldDecomposer.tpp b/Code/Core/include/mapFieldDecomposer.tpp index a6c2813..54e2172 100644 --- a/Code/Core/include/mapFieldDecomposer.tpp +++ b/Code/Core/include/mapFieldDecomposer.tpp @@ -1,196 +1,196 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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: 1287 $ (last changed revision) // @date $Date: 2016-04-01 18:02:24 +0200 (Fr, 01 Apr 2016) $ (last change date) // @author $Author: floca $ (last changed by) // Subversion HeadURL: $HeadURL: https://svn.inet.dkfz-heidelberg.de/sbr/Sources/SBR-Projects/MatchPoint/branches/Issue-1505/Code/Core/include/mapFieldDecomposer.tpp $ */ #ifndef __FIELD_DECOMPOSER_TPP #define __FIELD_DECOMPOSER_TPP #include "mapFieldDecomposer.h" #include "mapRegistrationKernel.h" #include "mapGenericVectorFieldTransform.h" #include "itkDisplacementFieldTransform.h" namespace map { namespace core { /** Convinience helper to extract a vector field out of transforms/kernel * if they are basead on a field..*/ template struct FieldDecomposerHelper { public: typedef typename FieldDecomposer::TransformType TransformType; typedef typename RegistrationTopology::DirectFieldType FieldType; - typedef typename FieldType::ConstPointer FieldConstPointer; - typedef typename FieldType::Pointer FieldPointer; + using FieldConstPointer = typename FieldType::ConstPointer; + using FieldPointer = typename FieldType::Pointer; static bool decomposeTransform(const TransformType* pTransform, FieldConstPointer& field) { bool result = false; typedef ::itk::GenericVectorFieldTransform< ::map::core::continuous::ScalarType, VInputDimensions, VOutputDimensions> GenericFieldTransformType; const GenericFieldTransformType* castedGenericFieldTransform = dynamic_cast(pTransform); if (castedGenericFieldTransform) { //try to directly use the field field = dynamic_cast(castedGenericFieldTransform->GetDisplacementField()); result = true; } return result; }; static bool decomposeTransform(TransformType* pTransform, FieldPointer& field) { bool result = false; typedef ::itk::GenericVectorFieldTransform< ::map::core::continuous::ScalarType, VInputDimensions, VOutputDimensions> GenericFieldTransformType; GenericFieldTransformType* castedGenericFieldTransform = dynamic_cast(pTransform); if (castedGenericFieldTransform) { //try to directly use the field field = dynamic_cast(castedGenericFieldTransform->GetDisplacementField()); result = true; } return result; }; }; /** Convinience helper to extract a vector field out of transforms/kernel * if they are basead on a field..*/ template struct FieldDecomposerHelper { public: typedef typename FieldDecomposer::TransformType TransformType; typedef typename RegistrationTopology::DirectFieldType FieldType; - typedef typename FieldType::ConstPointer FieldConstPointer; - typedef typename FieldType::Pointer FieldPointer; + using FieldConstPointer = typename FieldType::ConstPointer; + using FieldPointer = typename FieldType::Pointer; static bool decomposeTransform(const TransformType* pTransform, FieldConstPointer& field) { bool result = false; typedef ::itk::DisplacementFieldTransform< ::map::core::continuous::ScalarType, VDimensions> FieldTransformType; typedef ::itk::GenericVectorFieldTransform< ::map::core::continuous::ScalarType, VDimensions, VDimensions> GenericFieldTransformType; const FieldTransformType* castedFieldTransform = dynamic_cast(pTransform); const GenericFieldTransformType* castedGenericFieldTransform = dynamic_cast(pTransform); if (castedFieldTransform) { //try to directly use the field field = dynamic_cast(castedFieldTransform->GetDisplacementField()); result = true; } else if (castedGenericFieldTransform) { //try to directly use the field field = dynamic_cast(castedGenericFieldTransform->GetDisplacementField()); result = true; } return result; }; static bool decomposeTransform(TransformType* pTransform, FieldPointer& field) { bool result = false; typedef ::itk::DisplacementFieldTransform< ::map::core::continuous::ScalarType, VDimensions> FieldTransformType; typedef ::itk::GenericVectorFieldTransform< ::map::core::continuous::ScalarType, VDimensions, VDimensions> GenericFieldTransformType; FieldTransformType* castedFieldTransform = dynamic_cast(pTransform); GenericFieldTransformType* castedGenericFieldTransform = dynamic_cast(pTransform); if (castedFieldTransform) { //try to directly use the field field = dynamic_cast(castedFieldTransform->GetDisplacementField()); result = true; } else if (castedGenericFieldTransform) { //try to directly use the field field = dynamic_cast(castedGenericFieldTransform->GetDisplacementField()); result = true; } return result; }; }; template bool FieldDecomposer:: decomposeTransform(const TransformType* pTransform, FieldConstPointer& field) { if (!pTransform) { mapDefaultExceptionStaticMacro(<< "Error decomposing field of transform. Passed kernel pointer is NULL."); }; bool result = FieldDecomposerHelper::decomposeTransform(pTransform, field); return result; }; template bool FieldDecomposer:: decomposeTransform(TransformType* pTransform, FieldPointer& field) { if (!pTransform) { mapDefaultExceptionStaticMacro(<< "Error decomposing field of transform. Passed kernel pointer is NULL."); }; FieldConstPointer constField; bool result = FieldDecomposerHelper::decomposeTransform(pTransform, constField); if (result) { field = const_cast(constField.GetPointer()); } return result; }; template bool FieldDecomposer:: decomposeKernel(const KernelType* pKernel, FieldConstPointer& field) { bool result = false; if (!pKernel) { mapDefaultExceptionStaticMacro(<< "Error decomposing field of kernel. Passed kernel pointer is NULL."); }; const RegistrationKernel* castedKernel = dynamic_cast*>(pKernel); if (castedKernel) { result = decomposeTransform(castedKernel->getTransformModel(),field); } return result; }; - } -} + } // namespace core +} // namespace map #endif diff --git a/Code/Core/include/mapFieldRepresentationDescriptor.h b/Code/Core/include/mapFieldRepresentationDescriptor.h index 4c087f3..ff3287f 100644 --- a/Code/Core/include/mapFieldRepresentationDescriptor.h +++ b/Code/Core/include/mapFieldRepresentationDescriptor.h @@ -1,291 +1,291 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __FIELD_REPRESENTATION_DESCRIPTOR_H #define __FIELD_REPRESENTATION_DESCRIPTOR_H #include "itkLightObject.h" #include "itkImageRegion.h" #include "itkMatrix.h" #include "mapContinuousElements.h" #include "mapVolume.h" #include "mapDiscreteElements.h" #include "mapSDStreamingInterface.h" /*! @namespace map The namespace map::core is for the library of MatchPoint */ namespace map { namespace core { /*! @class FieldRepresentationDescriptor @brief class for FieldRepresentationDescriptor. This class is used as descriptor for a continuous or discrete volume of finite size. It is always used by MatchPoint if there is the need to define the field of view or of support (e.g. which area of the target space is to be supported by the registration determined by an algorithm in the case that the registration must be defined by a vector field, hence it will only have limited coverage). @ingroup Registration */ template class FieldRepresentationDescriptor : public itk::LightObject, public structuredData::StreamingInterface { public: - typedef FieldRepresentationDescriptor Self; - typedef itk::LightObject Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Self = FieldRepresentationDescriptor; + using Superclass = itk::LightObject; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(FieldRepresentationDescriptor, itk::LightObject); itkNewMacro(Self); - typedef typename discrete::Elements::ImageRegionType ImageRegionType; - typedef typename continuous::Volume VolumeType; + using ImageRegionType = typename discrete::Elements::ImageRegionType; + using VolumeType = typename continuous::Volume; /** Spacing typedef support. Spacing holds the size of a pixel. The * spacing is the geometric distance between descriptor samples. * @remark ITK only supports positive spacing value: negative values may cause * undesirable results. */ - typedef typename continuous::Elements::SpacingType SpacingType; + using SpacingType = typename continuous::Elements::SpacingType; /** Origin typedef support. The origin is the geometric coordinates * of the index (0,0). */ - typedef typename continuous::Elements::PointType PointType; + using PointType = typename continuous::Elements::PointType; /** Size typedef support. A size is used to define the bounds * of the field representation. * @remark In contrast to the itk::ImageRegion this size is the continuous * size (therefor size of the image and not the number of voxels). */ - typedef typename continuous::Elements::VolumeSizeType SizeType; + using SizeType = typename continuous::Elements::VolumeSizeType; /** Direction typedef support. The Direction is a matrix of * direction cosines that specify the direction between samples. * */ typedef itk::Matrix DirectionType; /*! gets the field size @eguarantee strong @return a const SizeType value */ - inline const SizeType getSize() const; + inline SizeType getSize() const; /*! sets the field size @eguarantee strong @param value a value for the SizeType */ void setSize(const SizeType& value); /*! gets the field origin @eguarantee strong @return a const PointType value */ - inline const PointType getOrigin() const; + inline PointType getOrigin() const; /*! sets the field origin @eguarantee strong @param value a value for the PointType */ void setOrigin(const PointType& value); /*! gets the field spacing @eguarantee strong @return a const SpacingType value */ - inline const SpacingType getSpacing() const; + inline SpacingType getSpacing() const; /*! sets the field spacing @eguarantee strong @param value a value for the SpacingType */ void setSpacing(const SpacingType& value); /*! gets the field direction @eguarantee strong @return a const DirectionType value */ - inline const DirectionType getDirection() const; + inline DirectionType getDirection() const; /*! sets the field direction * The direction cosines are vectors that point from one pixel to the next. * * One row of the matrix indicates the direction cosines of the unit vector * that is parallel to the lines of the image grid corresponding to that * dimension. For example, and image with Direction matrix * * 0.866 0.500 * -0.500 0.866 * * has an image grid were the fastest changing index (dimension[0]) walks * over a line that in Physical space is oriented parallel to the vector * (0.866,0.5). The second fastest changing index (dimension[1]) walks along * a line that in Physical space is oriented parallel to the vector * (-0.5,0.866) * * The vectors whose direction cosines are stored in the Direction matrix, * are expected to be orthogonal to each other, and they are expected to form * a right handed coordinate system, but this is not checked nor enforced here * or in the the itk::ImageBase. * * For details, please see: * * http://www.itk.org/Wiki/Proposals:Orientation#Some_notes_on_the_DICOM_convention_and_current_ITK_usage @eguarantee strong @param value a value for the SpacingType */ void setDirection(const DirectionType& value); /*! gets the represented image region in a local context of an image, thus the index of the image region is * calculated relative to the passed imageOrigin. @pre Image direction and field direction must be equal @eguarantee strong @return an ImageRegionType containing the represented region */ ImageRegionType getRepresentedLocalImageRegion(const PointType& imageOrigin, const DirectionType& imageDirection) const; /*! gets the represented image region in a local context of the field representation descriptor. Thus index is zero. * Has the same effect like calling getRepresentedLocalImageRegion(getOrigin()). @eguarantee strong @return an ImageRegionType containing the represented region */ ImageRegionType getRepresentedLocalImageRegion() const; /*! gets the represented volume @eguarantee strong @return a Volume containing the represented volume */ - inline const VolumeType getRepresentedVolume() const; + inline VolumeType getRepresentedVolume() const; bool operator == (const Self& frd) const; protected: FieldRepresentationDescriptor(); - virtual ~FieldRepresentationDescriptor(); + ~FieldRepresentationDescriptor() override; /*! Helper method that computes a matrix (direction and spacing) that can be used to convert points to index. It is equal to the concept used in itk::ImageBase to compute the index and point matrices. @eguarantee strong */ DirectionType computePhysicalPointToIndexMatrix() const; - virtual structuredData::StreamingInterface::ElementPointer streamToSDInternal() const; + structuredData::StreamingInterface::ElementPointer streamToSDInternal() const override; - virtual void streamFromSDInternal(const structuredData::Element* pElement); + void streamFromSDInternal(const structuredData::Element* pElement) override; /*! Methods invoked by itk::LightObject::Print(). */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; //using PIMPL idiom to realize strong exception guarantee SizeType* _pFieldSize; //using PIMPL idiom to realize strong exception guarantee PointType* _pFieldOrigin; //using PIMPL idiom to realize strong exception guarantee SpacingType* _pFieldSpacing; //using PIMPL idiom to realize strong exception guarantee DirectionType* _pFieldDirection; private: //No copy constructor allowed FieldRepresentationDescriptor(const Self& source); void operator=(const Self&); //purposely not implemented }; /*! creates a field representation descriptor from an image @eguarantee strong @param image a reference to an image @return a FieldRepresentationDescriptor */ template typename FieldRepresentationDescriptor::Pointer createFieldRepresentation(const TImage& image); /*! creates a field representation descriptor from an image region @remark The direction of the representation is identity. The image origin is assumed to be 0. @eguarantee strong @param region a reference to an image region @param spacing spacing that should be used to convert between discrete and continuous values. @return a FieldRepresentationDescriptor */ template typename FieldRepresentationDescriptor::Pointer createFieldRepresentation(const itk::ImageRegion& region, const typename ::map::core::continuous::Elements::SpacingType& spacing); /*! creates a field representation descriptor from an image region @eguarantee strong @param region a reference to an image region @param spacing spacing that should be used to convert between discrete and continuous values. @param imageOrigin Origin of the "image" the region is gathered from. It affects the computation of the origin of ther representation, because it is assumed that the index of the passed region is always defined relative to the image origin. @param direction Direction of the field/image region. @return a FieldRepresentationDescriptor */ template typename FieldRepresentationDescriptor::Pointer createFieldRepresentation(const itk::ImageRegion& region, const typename ::map::core::continuous::Elements::SpacingType& spacing, const typename FieldRepresentationDescriptor::PointType& imageOrigin, const typename FieldRepresentationDescriptor::DirectionType& direction); /*! creates a field representation descriptor from a volume @eguarantee strong @remark The direction of the representation is identity. @param volume a reference to a volume @param spacing spacing that should be used to convert between discrete and continuous values. @return a FieldRepresentationDescriptor */ template typename FieldRepresentationDescriptor::Pointer createFieldRepresentation(const TVolume& volume, const typename ::map::core::continuous::Elements::SpacingType& spacing); /*! creates a field representation descriptor from a volume @eguarantee strong @param volume a reference to a volume @param spacing spacing that should be used to convert between discrete and continuous values. @param direction Direction of the field/volume. @return a FieldRepresentationDescriptor */ template typename FieldRepresentationDescriptor::Pointer createFieldRepresentation(const TVolume& volume, const typename ::map::core::continuous::Elements::SpacingType& spacing, const typename FieldRepresentationDescriptor::DirectionType& direction); - } -} + } // namespace core +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapFieldRepresentationDescriptor.tpp" #endif #endif diff --git a/Code/Core/include/mapFieldRepresentationDescriptor.tpp b/Code/Core/include/mapFieldRepresentationDescriptor.tpp index 0544db2..f85e502 100644 --- a/Code/Core/include/mapFieldRepresentationDescriptor.tpp +++ b/Code/Core/include/mapFieldRepresentationDescriptor.tpp @@ -1,506 +1,506 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __FIELD_REPRESENTATION_DESCRIPTOR_TPP #define __FIELD_REPRESENTATION_DESCRIPTOR_TPP #include #include "mapFieldRepresentationDescriptor.h" #include "mapExceptionObject.h" #include "mapConvert.h" #include "mapSDITKStreamingHelper.h" namespace map { namespace core { // **** public methods **** // ************************ template - inline const typename FieldRepresentationDescriptor::SizeType + inline typename FieldRepresentationDescriptor::SizeType FieldRepresentationDescriptor:: getSize() const { return *_pFieldSize; } template void FieldRepresentationDescriptor:: setSize(const SizeType& value) { - SizeType* pNewSize = new SizeType(value); + auto* pNewSize = new SizeType(value); delete _pFieldSize; _pFieldSize = pNewSize; } template - inline const typename FieldRepresentationDescriptor::PointType + inline typename FieldRepresentationDescriptor::PointType FieldRepresentationDescriptor:: getOrigin() const { return *_pFieldOrigin; } template void FieldRepresentationDescriptor:: setOrigin(const PointType& value) { - PointType* pNewPoint = new PointType(value); + auto* pNewPoint = new PointType(value); delete _pFieldOrigin; _pFieldOrigin = pNewPoint; } template - inline const typename FieldRepresentationDescriptor::SpacingType + inline typename FieldRepresentationDescriptor::SpacingType FieldRepresentationDescriptor:: getSpacing() const { return *_pFieldSpacing; } template void FieldRepresentationDescriptor:: setSpacing(const SpacingType& value) { - SpacingType* pNewSpacing = new SpacingType(value); + auto* pNewSpacing = new SpacingType(value); delete _pFieldSpacing; _pFieldSpacing = pNewSpacing; } template - inline const typename FieldRepresentationDescriptor::DirectionType + inline typename FieldRepresentationDescriptor::DirectionType FieldRepresentationDescriptor:: getDirection() const { return *_pFieldDirection; } template void FieldRepresentationDescriptor:: setDirection(const DirectionType& value) { - DirectionType* pNewDirection = new DirectionType(value); + auto* pNewDirection = new DirectionType(value); delete _pFieldDirection; _pFieldDirection = pNewDirection; } template typename FieldRepresentationDescriptor::ImageRegionType FieldRepresentationDescriptor:: getRepresentedLocalImageRegion(const PointType& imageOrigin, const DirectionType& imageDirection) const { if (!(imageDirection == this->getDirection())) { mapDefaultExceptionMacro( << "Directions of field representation and image are not the same. Cannot determin image region. Field direction: " << this->getDirection() << "; image direction: " << imageDirection); } typename ImageRegionType::SizeType regionSize; typename ImageRegionType::IndexType regionIndex; DirectionType pointToIndexMatrix = computePhysicalPointToIndexMatrix(); ::itk::ImageTransformHelper < VDimensions, VDimensions - 1, VDimensions - 1 >::TransformPhysicalPointToIndex(pointToIndexMatrix, imageOrigin, this->getOrigin(), regionIndex); for (unsigned long i = 0; i < VDimensions; ++i) { regionSize[i] = static_cast(floor(( *_pFieldSize)[i] / (*_pFieldSpacing)[i])); } return ImageRegionType(regionIndex, regionSize); } template typename FieldRepresentationDescriptor::ImageRegionType FieldRepresentationDescriptor:: getRepresentedLocalImageRegion() const { return getRepresentedLocalImageRegion(this->getOrigin(), this->getDirection()); } template typename FieldRepresentationDescriptor::DirectionType FieldRepresentationDescriptor:: computePhysicalPointToIndexMatrix() const { DirectionType scale; DirectionType result; for (unsigned int i = 0; i < VDimensions; i++) { scale[i][i] = (*_pFieldSpacing)[i]; } if (vnl_determinant(_pFieldDirection->GetVnlMatrix()) == 0.0) { itkExceptionMacro( << "Bad direction, determinant is 0. Direction is " << *_pFieldDirection); } result = (*_pFieldDirection) * scale; result = result.GetInverse(); return result; } template - inline const typename FieldRepresentationDescriptor::VolumeType + inline typename FieldRepresentationDescriptor::VolumeType FieldRepresentationDescriptor:: getRepresentedVolume() const { return VolumeType(*_pFieldOrigin, *_pFieldSize); } template bool FieldRepresentationDescriptor:: operator == (const Self& frd) const { bool result = this->getSize() == frd.getSize(); if (result) { result = this->getOrigin() == frd.getOrigin(); } if (result) { result = this->getSpacing() == frd.getSpacing(); } if (result) { result = this->getDirection() == frd.getDirection(); } return result; }; // **** protected methods **** // *************************** template FieldRepresentationDescriptor:: FieldRepresentationDescriptor() { _pFieldSize = new SizeType(); _pFieldSize->fill(0); _pFieldOrigin = new PointType(); _pFieldOrigin->Fill(0); _pFieldSpacing = new SpacingType(); _pFieldSpacing->Fill(0); _pFieldDirection = new DirectionType(); _pFieldDirection->SetIdentity(); } template FieldRepresentationDescriptor:: ~FieldRepresentationDescriptor() { delete _pFieldSize; delete _pFieldOrigin; delete _pFieldSpacing; delete _pFieldDirection; } template void FieldRepresentationDescriptor:: PrintSelf(std::ostream& os, itk::Indent indent) const { unsigned int i = 0; Superclass::PrintSelf(os, indent); // print field size os << indent << "field size: ("; for (i = 0; i < VDimensions; i++) { os << (*_pFieldSize)[i] << " "; } os << ")\n"; // print field origin os << indent << "field origin: ("; for (i = 0; i < VDimensions; i++) { os << (*_pFieldOrigin)[i] << " "; } os << ")\n"; // print field spacing os << indent << "field spacing: ("; for (i = 0; i < VDimensions; i++) { os << (*_pFieldSpacing)[i] << " "; } os << ")\n" << std::endl; // print field direction os << indent << "field direction: ("; os << *_pFieldSpacing; os << ")\n" << std::endl; } template ::map::structuredData::StreamingInterface::ElementPointer FieldRepresentationDescriptor:: streamToSDInternal() const { structuredData::Element::Pointer spNewSD = structuredData::Element::New(); spNewSD->setTag("FieldRepresentationDescriptor"); //save attributes spNewSD->setAttribute("Dimensions", convert::toStr(VDimensions)); //save size structuredData::Element::Pointer spSizeElement = SizeType::streamToStructuredData(this->getSize()); spSizeElement->setTag("Size"); spNewSD->addSubElement(spSizeElement); structuredData::Element::Pointer spOriginElement = structuredData::streamITKFixedArrayToSD( this->getOrigin()); spOriginElement->setTag("Origin"); spNewSD->addSubElement(spOriginElement); structuredData::Element::Pointer spSpacingElement = structuredData::streamITKFixedArrayToSD( this->getSpacing()); spSpacingElement->setTag("Spacing"); spNewSD->addSubElement(spSpacingElement); structuredData::Element::Pointer spDirectionElement = structuredData::streamITKMatrixToSD( this->getDirection()); spDirectionElement->setTag("Direction"); spNewSD->addSubElement(spDirectionElement); return spNewSD; }; template void FieldRepresentationDescriptor:: streamFromSDInternal(const structuredData::Element* pElement) { SizeType newSize; PointType newOrigin; SpacingType newSpacing; DirectionType newDirection; - structuredData::Element::ConstSubElementIteratorType subPos = structuredData::findNextSubElement( + auto subPos = structuredData::findNextSubElement( pElement->getSubElementBegin(), pElement->getSubElementEnd(), "Size"); if (subPos == pElement->getSubElementEnd()) { mapDefaultExceptionMacro( << "Error: cannot stream from structured data. Reason: sub element \"Size\" is missing."); } newSize = SizeType::streamFromStructuredData(*subPos); subPos = structuredData::findNextSubElement( pElement->getSubElementBegin(), pElement->getSubElementEnd(), "Origin"); if (subPos == pElement->getSubElementEnd()) { mapDefaultExceptionMacro( << "Error: cannot stream from structured data. Reason: sub element \"Origin\" is missing."); } newOrigin = structuredData::streamSDToITKFixedArray(*subPos); subPos = structuredData::findNextSubElement( pElement->getSubElementBegin(), pElement->getSubElementEnd(), "Spacing"); if (subPos == pElement->getSubElementEnd()) { mapDefaultExceptionMacro( << "Error: cannot stream from structured data. Reason: sub element \"Spacing\" is missing."); } newSpacing = structuredData::streamSDToITKFixedArray(*subPos); subPos = structuredData::findNextSubElement( pElement->getSubElementBegin(), pElement->getSubElementEnd(), "Direction"); if (subPos == pElement->getSubElementEnd()) { mapDefaultExceptionMacro( << "Error: cannot stream from structured data. Reason: sub element \"Direction\" is missing."); } newDirection = structuredData::streamSDToITKMatrix(*subPos); this->setSize(newSize); this->setOrigin(newOrigin); this->setSpacing(newSpacing); this->setDirection(newDirection); }; // **** static methods **** // ************************ template typename FieldRepresentationDescriptor::Pointer createFieldRepresentation(const TImage& image) { - typedef FieldRepresentationDescriptor FRDType; + using FRDType = FieldRepresentationDescriptor; typename FRDType::Pointer spFRD = FRDType::New(); typename FRDType::SizeType size; typename TImage::RegionType region = image.GetLargestPossibleRegion(); typename TImage::SpacingType spacing = image.GetSpacing(); for (unsigned long i = 0; i < TImage::ImageDimension; ++i) { size[i] = static_cast(region.GetSize(i) * spacing[i]); } spFRD->setSize(size); spFRD->setSpacing(spacing); spFRD->setOrigin(image.GetOrigin()); spFRD->setDirection(image.GetDirection()); return spFRD; } template typename FieldRepresentationDescriptor::Pointer createFieldRepresentation(const itk::ImageRegion& region, const typename ::map::core::continuous::Elements::SpacingType& spacing) { typename FieldRepresentationDescriptor::DirectionType direction; typename FieldRepresentationDescriptor::PointType origin; direction.SetIdentity(); origin.Fill(0.0); return createFieldRepresentation(region, spacing, origin, direction); } template typename FieldRepresentationDescriptor::Pointer createFieldRepresentation(const itk::ImageRegion& region, const typename ::map::core::continuous::Elements::SpacingType& spacing, const typename FieldRepresentationDescriptor::PointType& imageOrigin, const typename FieldRepresentationDescriptor::DirectionType& direction) { typedef FieldRepresentationDescriptor FRDType; typename FRDType::Pointer spFRD = FRDType::New(); typename FRDType::DirectionType scale; typename FRDType::DirectionType indexToPointMatrix; typename FRDType::PointType origin; typename FRDType::SizeType size; typename FRDType::SpacingType fieldSpacing; for (unsigned long i = 0; i < VDimensions; ++i) { size[i] = static_cast(region.GetSize(i) * spacing[i]); fieldSpacing[i] = spacing[i]; scale[i][i] = spacing[i]; } indexToPointMatrix = direction * scale; ::itk::ImageTransformHelper < VDimensions, VDimensions - 1, VDimensions - 1 >::TransformIndexToPhysicalPoint(indexToPointMatrix, imageOrigin, region.GetIndex(), origin); spFRD->setSpacing(fieldSpacing); spFRD->setSize(size); spFRD->setOrigin(origin); spFRD->setDirection(direction); return spFRD; } template typename FieldRepresentationDescriptor::Pointer createFieldRepresentation(const TVolume& volume, const typename ::map::core::continuous::Elements::SpacingType& spacing, const typename FieldRepresentationDescriptor::DirectionType& direction) { typedef FieldRepresentationDescriptor FRDType; typename FRDType::Pointer spFRD = FRDType::New(); typename FRDType::PointType origin; typename FRDType::SizeType size; typename FRDType::SpacingType fieldSpacing; for (unsigned long i = 0; i < TVolume::VolumeDimension; ++i) { origin[i] = volume.getOrigin(i); size[i] = volume.getSize(i); fieldSpacing[i] = spacing[i]; } spFRD->setSpacing(fieldSpacing); spFRD->setSize(size); spFRD->setOrigin(origin); spFRD->setDirection(direction); return spFRD; } template typename FieldRepresentationDescriptor::Pointer createFieldRepresentation(const TVolume& volume, const typename ::map::core::continuous::Elements::SpacingType& spacing) { typename FieldRepresentationDescriptor::DirectionType direction; direction.SetIdentity(); return createFieldRepresentation(volume, spacing, direction); } } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapFileDispatch.h b/Code/Core/include/mapFileDispatch.h index fef2de7..067b078 100644 --- a/Code/Core/include/mapFileDispatch.h +++ b/Code/Core/include/mapFileDispatch.h @@ -1,72 +1,72 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_FILE_DISPATCH_H #define __MAP_FILE_DISPATCH_H #include "mapString.h" #include "mapMacros.h" #include "mapMAPCoreExports.h" namespace map { namespace core { class MAPCore_EXPORT FileDispatch { public: /** Returns the name of the file (without extension).*/ static String getName(const String& sFilePath); /** Returns the extansion of the file (dot included).*/ static String getExtension(const String& sFilePath); /** Returns name of the file plus extension.*/ static String getFullName(const String& sFilePath); /** Returns the directory the file is located in (without trailing slash). * @remark this function always removes the last element of the path. Thus * if you pass a path without a file, it will return the parent directory.*/ static String getPath(const String& sFilePath); /** Helper function to concat path and file into * a full path */ static String createFullPath(const char* path, const char* file); static String createFullPath(const String& path, const String& file); /** Convertes all path seperators in the seperators used in the current OS.*/ static String ensureCorrectOSPathSeparator(const String& path); String getName(); String getExtension(); String getFullName(); String getPath(); FileDispatch(const String& filePath); private: String _fileName; }; - } -} + } // namespace core +} // namespace map #endif diff --git a/Code/Core/include/mapGenericFieldGeneratingCombinationFunctor.h b/Code/Core/include/mapGenericFieldGeneratingCombinationFunctor.h index e164d7b..1415fd8 100644 --- a/Code/Core/include/mapGenericFieldGeneratingCombinationFunctor.h +++ b/Code/Core/include/mapGenericFieldGeneratingCombinationFunctor.h @@ -1,164 +1,163 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_GENERIC_FIELD_GENERATING_COMBINATION_FUNCTOR_H #define __MAP_GENERIC_FIELD_GENERATING_COMBINATION_FUNCTOR_H #include "mapTransformGenerationFunctor.h" #include "mapCombinationFunctorInterface.h" #include "mapRegistrationKernel.h" namespace map { namespace core { namespace functors { /*! @class GenericFieldGeneratingCombinationFunctor * @brief Functors generates a transform field by combining two kernels * * This functors generates a transform (displacement field) by combining two kernels. * This functor needs the input field representation to be set, other wise it wouldn't * be clear how to generate the field (size, spacing). * The functor makes a mapping for each point of the input field representation through * both kernels and computes the resulting combined transform factor in order to store * it in the displacement field. * The output field representation is not used by this functor. * * @ingroup RegFunctors * @tparam VInputDimensions Dimensions of the input space the field should map from. * @tparam VInterimDimensions Dimensions of the interim space into which the transformation maps. * @tparam VOutputDimensions Dimensions of the output space the field should map into. */ template class GenericFieldGeneratingCombinationFunctor : public TransformGenerationFunctor, public CombinationFunctorInterface < VInputDimensions, VInterimDimensions, VOutputDimensions > { public: /*! Standard class typedefs. */ typedef GenericFieldGeneratingCombinationFunctor < VInputDimensions, VInterimDimensions, VOutputDimensions > Self; typedef TransformGenerationFunctor Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; typedef CombinationFunctorInterface < VInputDimensions, VInterimDimensions, VOutputDimensions > CombinationInterface; - typedef typename Superclass::InFieldRepresentationType InFieldRepresentationType; - typedef typename Superclass::InFieldRepresentationConstPointer InFieldRepresentationConstPointer; - typedef typename Superclass::OutFieldRepresentationType OutFieldRepresentationType; - typedef typename Superclass::OutFieldRepresentationConstPointer - OutFieldRepresentationConstPointer; - typedef typename Superclass::TransformType TransformType; - typedef typename Superclass::TransformPointer TransformPointer; - typedef typename CombinationInterface::SourceKernel1BaseType SourceKernel1BaseType; - typedef typename CombinationInterface::SourceKernel2BaseType SourceKernel2BaseType; + using InFieldRepresentationType = typename Superclass::InFieldRepresentationType; + using InFieldRepresentationConstPointer = typename Superclass::InFieldRepresentationConstPointer; + using OutFieldRepresentationType = typename Superclass::OutFieldRepresentationType; + using OutFieldRepresentationConstPointer = typename Superclass::OutFieldRepresentationConstPointer; + using TransformType = typename Superclass::TransformType; + using TransformPointer = typename Superclass::TransformPointer; + using SourceKernel1BaseType = typename CombinationInterface::SourceKernel1BaseType; + using SourceKernel2BaseType = typename CombinationInterface::SourceKernel2BaseType; itkTypeMacro(GenericFieldGeneratingCombinationFunctor, TransformGenerationFunctor); /*! Generates the field an returns the result as a smart pointer. * @eguarantee should be strong * @return Smart pointer to the generated field. */ - virtual TransformPointer generateTransform() const override; + TransformPointer generateTransform() const override; /*! Returns a const pointer to the first source kernel base (source field kernel) * that will be used in order to generate the field. * @eguarantee no fail * @return Pointer to the source field kernel. * @post Return value is guaranteed not to be NULL. */ - virtual const SourceKernel1BaseType* get1stSourceKernelBase(void) const override; + const SourceKernel1BaseType* get1stSourceKernelBase() const override; /*! Returns a const pointer to the second source kernel base (source model kernel) * that will be used in order to generate the field. * @eguarantee no fail * @return Pointer to the source field kernel. * @post Return value is guaranteed not to be NULL. */ - virtual const SourceKernel2BaseType* get2ndSourceKernelBase(void) const override; + const SourceKernel2BaseType* get2ndSourceKernelBase() const override; /*! Static methods that creates the functor. * Thus it is a specialized version of the itkNewMacro() * @eguarantee strong * @param [in] kernel1 Pointer to the 1st source kernel that should be used. * @param [in] kernel2 Pointer to the 2nd source kernel that should be used. * @param [in] pInFieldRepresentation Pointer to the field representation in the input space, * may not be null for this functor. * @return Smart pointer to the new functor * @pre kernel1 must be set, may not be NULL * @pre kernel2 must be set, may not be NULL * @pre pInFieldRepresentation must be set, may not be NULL*/ static Pointer New(const SourceKernel1BaseType* kernel1, const SourceKernel2BaseType* kernel2, const InFieldRepresentationType* pInFieldRepresentation); /*! Creates a functor via New and returns it as a itk::LightObject smart pointer. * @eguarantee strong * @return Smart pointer to the new functor as itk::LightObject*/ - virtual ::itk::LightObject::Pointer CreateAnother(void) const; + virtual ::itk::LightObject::Pointer CreateAnother() const; protected: typedef typename RegistrationTopology < VInputDimensions, VOutputDimensions >::DirectFieldType FieldType; /*! Protected constructor used by New. * @eguarantee strong * @param [in] kernel1 Pointer to the 1st source kernel that should be used. * @param [in] kernel2 Pointer to the 2nd source kernel that should be used. * @param [in] pInFieldRepresentation Pointer to the field representation in the input space, * may not be null for this functor. * @return Smart pointer to the new functor * @pre kernel1 must be set, may not be NULL * @pre kernel2 must be set, may not be NULL * @pre pInFieldRepresentation must be set, may not be NULL*/ GenericFieldGeneratingCombinationFunctor(const SourceKernel1BaseType* kernel1, const SourceKernel2BaseType* kernel2, const InFieldRepresentationType* pInFieldRepresentation); virtual ~GenericFieldGeneratingCombinationFunctor(); /*! The source field kernel.*/ typename SourceKernel1BaseType::ConstPointer _spSourceKernel1; /*! The transformation model.*/ typename SourceKernel2BaseType::ConstPointer _spSourceKernel2; /*! Methods invoked by itk::LightObject::Print(). */ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; private: GenericFieldGeneratingCombinationFunctor(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace functors } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapGenericFieldGeneratingCombinationFunctor.tpp" #endif #endif diff --git a/Code/Core/include/mapGenericFieldGeneratingCombinationFunctor.tpp b/Code/Core/include/mapGenericFieldGeneratingCombinationFunctor.tpp index 6aa4016..63ff556 100644 --- a/Code/Core/include/mapGenericFieldGeneratingCombinationFunctor.tpp +++ b/Code/Core/include/mapGenericFieldGeneratingCombinationFunctor.tpp @@ -1,158 +1,158 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_GENERIC_FIELD_GENERATING_COMBINATION_FUNCTOR_TPP #define __MAP_GENERIC_FIELD_GENERATING_COMBINATION_FUNCTOR_TPP #include "mapGenericFieldGeneratingCombinationFunctor.h" #include "mapRepresentationException.h" #include "mapPointVectorCombinationPolicy.h" #include "mapRegistrationKernel.h" #include "mapGenericVectorFieldTransform.h" #include "mapNULLVectorAwareLinearInterpolateImageFunction.h" #include "mapGenericKernelCombinationFieldSource.h" namespace map { namespace core { namespace functors { template typename GenericFieldGeneratingCombinationFunctor::TransformPointer GenericFieldGeneratingCombinationFunctor:: generateTransform() const { typedef map::core::GenericKernelCombinationFieldSource FieldSourceType; typename FieldSourceType::Pointer source = FieldSourceType::New(); typedef typename SourceKernel2BaseType::MappingVectorType::Superclass VectorSuperclassType; typename SourceKernel2BaseType::MappingVectorType nullVector; nullVector.VectorSuperclassType::operator = (this->_nullPoint); source->SetSize(Superclass::_spInFieldRepresentation->getRepresentedLocalImageRegion().GetSize()); source->SetOrigin(Superclass::_spInFieldRepresentation->getOrigin()); source->SetSpacing(Superclass::_spInFieldRepresentation->getSpacing()); source->SetDirection(Superclass::_spInFieldRepresentation->getDirection()); source->SetSourceKernel1(_spSourceKernel1); source->SetSourceKernel2(_spSourceKernel2); source->SetUseNullPoint(this->_useNullPoint); source->SetNullPoint(this->_nullPoint); source->Update(); typename FieldType::Pointer spField = source->GetOutput(); typedef ::itk::GenericVectorFieldTransform< ::map::core::continuous::ScalarType, VInputDimensions, VOutputDimensions> FieldTransformType; typename FieldTransformType::Pointer spResult = FieldTransformType::New(); spResult->SetDisplacementField(spField); typedef ::itk::map::NULLVectorAwareLinearInterpolateImageFunction < typename FieldTransformType::GenericVectorFieldType, typename FieldTransformType::ScalarType> InterpolatorType; typename InterpolatorType::Pointer interpolator = InterpolatorType::New(); interpolator->SetNullVectorUsage(this->_useNullPoint); interpolator->SetNullVector(nullVector); spResult->SetInterpolator(interpolator); spResult->SetUseNullPoint(this->_useNullPoint); spResult->SetNullPoint(this->_nullPoint); return spResult.GetPointer(); } template const typename GenericFieldGeneratingCombinationFunctor::SourceKernel1BaseType* GenericFieldGeneratingCombinationFunctor:: - get1stSourceKernelBase(void) const + get1stSourceKernelBase() const { return _spSourceKernel1; } template const typename GenericFieldGeneratingCombinationFunctor::SourceKernel2BaseType* GenericFieldGeneratingCombinationFunctor:: - get2ndSourceKernelBase(void) const + get2ndSourceKernelBase() const { return _spSourceKernel2; } template typename GenericFieldGeneratingCombinationFunctor::Pointer GenericFieldGeneratingCombinationFunctor:: New(const SourceKernel1BaseType* kernel1, const SourceKernel2BaseType* kernel2, const InFieldRepresentationType* pInFieldRepresentation) { assert(pInFieldRepresentation); Pointer spGenericFieldGeneratingCombinationFunctor = new Self(kernel1, kernel2, pInFieldRepresentation); spGenericFieldGeneratingCombinationFunctor->UnRegister(); return spGenericFieldGeneratingCombinationFunctor; } template ::itk::LightObject::Pointer GenericFieldGeneratingCombinationFunctor:: - CreateAnother(void) const + CreateAnother() const { ::itk::LightObject::Pointer smartPtr; Pointer spNew = Self::New(_spSourceKernel1, _spSourceKernel2, Superclass::_spInFieldRepresentation).GetPointer(); smartPtr = spNew; return smartPtr; } template GenericFieldGeneratingCombinationFunctor:: GenericFieldGeneratingCombinationFunctor(const SourceKernel1BaseType* kernel1, const SourceKernel2BaseType* kernel2, const InFieldRepresentationType* pInFieldRepresentation) : Superclass(pInFieldRepresentation), _spSourceKernel1(kernel1), _spSourceKernel2(kernel2) { assert(pInFieldRepresentation); assert(kernel1); assert(kernel2); } template GenericFieldGeneratingCombinationFunctor:: ~GenericFieldGeneratingCombinationFunctor() { } template void GenericFieldGeneratingCombinationFunctor:: PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "Source 1st kernel: " << _spSourceKernel1 << std::endl; os << indent << "Source 2nd kernel: " << _spSourceKernel2 << std::endl; } } // end namespace functors } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapGenericKernelCombinationFieldSource.h b/Code/Core/include/mapGenericKernelCombinationFieldSource.h index 9178a3c..69c2f5b 100644 --- a/Code/Core/include/mapGenericKernelCombinationFieldSource.h +++ b/Code/Core/include/mapGenericKernelCombinationFieldSource.h @@ -1,116 +1,116 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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: 1316 $ (last changed revision) // @date $Date: 2016-04-13 14:50:09 +0200 (Mi, 13 Apr 2016) $ (last change date) // @author $Author: floca $ (last changed by) // Subversion HeadURL: $HeadURL: https://svn.inet.dkfz-heidelberg.de/sbr/Sources/SBR-Projects/MatchPoint/trunk/Code/Core/include/mapGenericFieldGeneratingCombinationFunctor.tpp $ */ #ifndef __MAP_GENERIC_KERNEL_COMBINATION_FIELD_SOURCE_H #define __MAP_GENERIC_KERNEL_COMBINATION_FIELD_SOURCE_H #include "itkGenerateImageSource.h" #include "mapRegistrationKernelBase.h" #include "mapDefaultRegistrationTopologyPolicy.h" namespace map { namespace core { /** \class GenericKernelCombinationFieldSource * \brief Generate an Vector field by combining the givin to source kernels. * * \ingroup DataSources * \ingroup ITKImageSources */ template< unsigned int VInputDimensions, unsigned int VInterimDimensions, unsigned int VOutputDimensions, typename TScalarType > class GenericKernelCombinationFieldSource : public ::itk::GenerateImageSource < typename ::map::core::RegistrationTopology::DirectFieldType > { public: typedef typename ::map::core::RegistrationTopology::DirectFieldType OutputImageType; - typedef GenericKernelCombinationFieldSource Self; - typedef ::itk::GenerateImageSource< OutputImageType > Superclass; - typedef ::itk::SmartPointer< Self > Pointer; - typedef ::itk::SmartPointer< const Self> ConstPointer; + using Self = GenericKernelCombinationFieldSource; + using Superclass = ::itk::GenerateImageSource; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; /** Output image typedefs */ - typedef typename OutputImageType::PixelType PixelType; - typedef typename OutputImageType::RegionType RegionType; - typedef typename OutputImageType::SpacingType SpacingType; - typedef typename OutputImageType::PointType PointType; - typedef typename OutputImageType::DirectionType DirectionType; + using PixelType = typename OutputImageType::PixelType; + using RegionType = typename OutputImageType::RegionType; + using SpacingType = typename OutputImageType::SpacingType; + using PointType = typename OutputImageType::PointType; + using DirectionType = typename OutputImageType::DirectionType; - typedef typename RegionType::SizeType SizeType; + using SizeType = typename RegionType::SizeType; typedef RegistrationKernelBase SourceKernel1BaseType; typedef RegistrationKernelBase SourceKernel2BaseType; typedef typename RegistrationTopology::TargetPointType NullPointType; /** Run-time type information (and related methods). */ itkTypeMacro(GenericKernelCombinationFieldSource, GenerateImageSource); /** Method for creation through the object factory. */ itkNewMacro(Self); itkSetConstObjectMacro(SourceKernel1, SourceKernel1BaseType); itkSetConstObjectMacro(SourceKernel2, SourceKernel2BaseType); itkGetConstObjectMacro(SourceKernel1, SourceKernel1BaseType); itkGetConstObjectMacro(SourceKernel2, SourceKernel2BaseType); itkSetMacro(UseNullPoint, bool); itkGetMacro(UseNullPoint, bool); itkSetMacro(NullPoint, NullPointType); itkGetMacro(NullPoint, NullPointType); protected: GenericKernelCombinationFieldSource() : m_UseNullPoint(false) { m_NullPoint.Fill(itk::NumericTraits::NonpositiveMin()); }; // virtual ~GenericKernelCombinationFieldSource() default implementation ok virtual void ThreadedGenerateData(const RegionType &outputRegionForThread, ::itk::ThreadIdType threadId); virtual void GenerateOutputInformation(); typename SourceKernel1BaseType::ConstPointer m_SourceKernel1; typename SourceKernel2BaseType::ConstPointer m_SourceKernel2; NullPointType m_NullPoint; bool m_UseNullPoint; private: GenericKernelCombinationFieldSource(const GenericKernelCombinationFieldSource &); //purposely not implemented void operator=(const GenericKernelCombinationFieldSource &); //purposely not implemented }; - } -} + } // namespace core +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapGenericKernelCombinationFieldSource.tpp" #endif #endif diff --git a/Code/Core/include/mapGenericKernelCombinationFieldSource.tpp b/Code/Core/include/mapGenericKernelCombinationFieldSource.tpp index 4349f77..a38cbd5 100644 --- a/Code/Core/include/mapGenericKernelCombinationFieldSource.tpp +++ b/Code/Core/include/mapGenericKernelCombinationFieldSource.tpp @@ -1,110 +1,110 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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: 1316 $ (last changed revision) // @date $Date: 2016-04-13 14:50:09 +0200 (Mi, 13 Apr 2016) $ (last change date) // @author $Author: floca $ (last changed by) // Subversion HeadURL: $HeadURL: https://svn.inet.dkfz-heidelberg.de/sbr/Sources/SBR-Projects/MatchPoint/trunk/Code/Core/include/mapGenericFieldGeneratingCombinationFunctor.tpp $ */ #ifndef __MAP_GENERIC_KERNEL_COMBINATION_FIELD_SOURCE_TPP #define __MAP_GENERIC_KERNEL_COMBINATION_FIELD_SOURCE_TPP #include "mapGenericKernelCombinationFieldSource.h" #include "mapRepresentationException.h" #include "mapPointVectorCombinationPolicy.h" #include "itkProgressReporter.h" #include "itkImageRegionIteratorWithIndex.h" namespace map { namespace core { template< unsigned int VInputDimensions, unsigned int VInterimDimensions, unsigned int VOutputDimensions, typename TScalarType > void GenericKernelCombinationFieldSource< VInputDimensions, VInterimDimensions, VOutputDimensions, TScalarType > ::GenerateOutputInformation() { Superclass::GenerateOutputInformation(); if (this->m_SourceKernel1.IsNull()) { mapDefaultExceptionMacro(<< "Error. Cannot generate field. Source kernel 1 is not set."); } if (this->m_SourceKernel2.IsNull()) { mapDefaultExceptionMacro(<< "Error. Cannot generate field. Source kernel 2 is not set."); } } template< unsigned int VInputDimensions, unsigned int VInterimDimensions, unsigned int VOutputDimensions, typename TScalarType > void GenericKernelCombinationFieldSource< VInputDimensions, VInterimDimensions, VOutputDimensions, TScalarType > ::ThreadedGenerateData(const RegionType &outputRegionForThread, ::itk::ThreadIdType threadId) { // Support progress methods/callbacks ::itk::ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels()); OutputImageType *image = this->GetOutput(0); ::itk::ImageRegionIteratorWithIndex< OutputImageType > it(image, outputRegionForThread); typename OutputImageType::PointType inPoint; typedef typename SourceKernel2BaseType::MappingVectorType::Superclass VectorSuperclassType; typename SourceKernel2BaseType::MappingVectorType nullVector; nullVector.VectorSuperclassType::operator = (this->m_NullPoint); for (; !it.IsAtEnd(); ++it) { image->TransformIndexToPhysicalPoint(it.GetIndex(), inPoint); typename SourceKernel1BaseType::OutputPointType interimPoint; bool valid = m_SourceKernel1->mapPoint(inPoint, interimPoint); typename SourceKernel2BaseType::OutputPointType endPoint; bool valid2 = m_SourceKernel2->mapPoint(interimPoint, endPoint); typename SourceKernel2BaseType::MappingVectorType outVector = nullVector; if (valid && valid2) { PointVectorCombinationPolicy::computeVector(inPoint, endPoint, outVector); } else { if (!this->m_UseNullPoint) { mapExceptionMacro(::map::core::RepresentationException, << "Error. Cannot generate combined kernel. At least one source kernel was not able to map points. valid source kernel 1: " << valid << "; valid source kernel 2:" << valid2); } } it.Set(outVector); progress.CompletedPixel(); } } - } -} + } // namespace core +} // namespace map #endif diff --git a/Code/Core/include/mapGenericStaticLoadPolicyBase.h b/Code/Core/include/mapGenericStaticLoadPolicyBase.h index 4e62b57..1d75a98 100644 --- a/Code/Core/include/mapGenericStaticLoadPolicyBase.h +++ b/Code/Core/include/mapGenericStaticLoadPolicyBase.h @@ -1,96 +1,96 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_GERNERIC_STATIC_LOAD_POLICY_BASE_H #define __MAP_GERNERIC_STATIC_LOAD_POLICY_BASE_H namespace map { namespace core { namespace services { //forward declaration template class ServiceRepositoryPolicyLoadInterface; /*! @class GenericStaticLoadPolicyBase * @brief Base class of a policy with default providers. * * You can design a loading policy from scratch but if you just want to load a certain number * of default providers in a special sequenze, this is the easiest way. Deriver from this class and * override doLoading(). * * @ingroup LoadPolicies * @tparam TProviderBase Base class of the service providers loaded by the policy. */ template class GenericStaticLoadPolicyBase { protected: /*! Standard class typedefs. */ - typedef ServiceRepositoryPolicyLoadInterface LoadInterfaceType; - typedef TProviderBase ProviderBaseType; - typedef typename ProviderBaseType::Pointer ProviderBasePointer; - typedef GenericStaticLoadPolicyBase Self; + using LoadInterfaceType = ServiceRepositoryPolicyLoadInterface; + using ProviderBaseType = TProviderBase; + using ProviderBasePointer = typename ProviderBaseType::Pointer; + using Self = GenericStaticLoadPolicyBase; /*! Loading of all default providers by calling doLoading. * Before this call it will be checked if the interface has been registered * @pre Loading interface must have been registered. * @eguarantee basic */ void loadStaticProviders(); /*! Registers the loading interface that should be used by the policy. * @eguarantee strong * @param [in] interface Reference to the interface that should used by the policy when * loading providers. */ void registerInterfaceForStaticLoading(LoadInterfaceType& loadInterface); /*! This method should be overwritten in derived classes to realize the loading * of default providers via the registered interface (_pLoadInterface). The interface is guaranteed to be set * when the method is called. * @pre _pLoadInterface is set to an interface instance by LoadStaticProviders*/; virtual void doLoading() = 0; /*! Pointer to the load interface*/ LoadInterfaceType* _pLoadInterface; GenericStaticLoadPolicyBase(); ~GenericStaticLoadPolicyBase(); private: GenericStaticLoadPolicyBase(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace services } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapGenericStaticLoadPolicyBase.tpp" #endif #endif diff --git a/Code/Core/include/mapGenericStaticLoadPolicyBase.tpp b/Code/Core/include/mapGenericStaticLoadPolicyBase.tpp index 1c24eaf..ff68709 100644 --- a/Code/Core/include/mapGenericStaticLoadPolicyBase.tpp +++ b/Code/Core/include/mapGenericStaticLoadPolicyBase.tpp @@ -1,82 +1,80 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_GERNERIC_STATIC_LOAD_POLICY_BASE_TPP #define __MAP_GERNERIC_STATIC_LOAD_POLICY_BASE_TPP #include "mapGenericStaticLoadPolicyBase.h" #include "mapConfigure.h" -#include +#include namespace map { namespace core { namespace services { /*! Loading of all default providers by calling doLoading. * Before this call it will be checked if the interface has been registered * @pre Loading interface must have been registered. * @eguarantee basic */ template void GenericStaticLoadPolicyBase:: loadStaticProviders() { - assert(_pLoadInterface != NULL); + assert(_pLoadInterface != nullptr); doLoading(); }; /*! Registers the loading interface that should be used by the policy. * @eguarantee strong * @param [in] interface Reference to the interface that should used by the policy when * loading providers. */ template void GenericStaticLoadPolicyBase:: registerInterfaceForStaticLoading(LoadInterfaceType& loadInterface) { _pLoadInterface = &loadInterface; }; template GenericStaticLoadPolicyBase:: GenericStaticLoadPolicyBase() - { - }; + = default; template GenericStaticLoadPolicyBase:: ~GenericStaticLoadPolicyBase() - { - }; + = default; } // end namespace services } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapGenericVectorFieldTransform.h b/Code/Core/include/mapGenericVectorFieldTransform.h index 19b488b..78f68c1 100644 --- a/Code/Core/include/mapGenericVectorFieldTransform.h +++ b/Code/Core/include/mapGenericVectorFieldTransform.h @@ -1,444 +1,440 @@ /*========================================================================= * * Copyright Insight Software Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *=========================================================================*/ #ifndef __mapGenericVectorFieldTransform_h #define __mapGenericVectorFieldTransform_h #include "itkTransform.h" #include "itkImage.h" #include "itkMatrixOffsetTransformBase.h" #include "itkImageVectorOptimizerParametersHelper.h" #include "itkVectorInterpolateImageFunction.h" namespace itk { /** \class GenericVectorFieldTransform * \brief Provides local/dense/high-dimensionaltiy transformation via a * a displacement field. * * The displacement field stores vectors of displacements, with * dimension \c NDimensions. Transformation is performed at a given * point by adding the displacement at that point to the input point. * * T(x, p), x is the position, p is the local parameter at position x. * For a 2D example: * * x = (x0, x1), p = (p0, p1) * * then T(x, p) is defined as: * * T(x, p) = (T0, T1) = (x0+p0, x1+p1) * * * The displacement field is defined using an itkImage, and must be set * before use by the user, using \c SetGenericVectorField. The image has * the same dimensionality as the input and output spaces, defined by * template parameter \c NDimensions, and is an image of vectors of * type \c OutputVectorType, with dimensionality NDimensions as well. * * An interpolator of type \c VectorInterpolateImageFunction is used with * the displacement field image. By default, * VectorLinearInterpolateImageFunction is used, and the user can override * using SetInterpolator. * * The displacement field data is stored using the common * \c OptimizerParameters type * in conjunction with the \c ImageVectorOptimizerParametersHelper class. This * allows access of the displacement field image as if it were an itkArray, * allowing transparent use with other classes. * \warning The \c SetParameters * method will copy the passed parameters, which can be costly since * displacement fields are dense and thus potentially very large. * * The \c UpdateTransformParameters method simply adds the provided * update array, applying the usual optional scaling factor. Derived * classes may provide different behavior. * * Because this is a local transform, methods that have a version that takes * a point must be used, such as \c TransformVector, * \c TransformCovariantVector, and \c TransformDiffusionTensor. Also, * \c ComputeJacobianWithRespectToParameters simply returns * an identity matrix (see method documentation), * and \c ComputeJacobianWithRespectToPosition should be used. * * The differences between this class and itk::DisplacementFieldTransform * are the following two: * - The transform allows and handles unequal input and output dimensions * - The transform allows to decide how to handle transform requests that * are outside of the field's coverage. It either uses identity (like * itk::DisplacementFieldTransform) or it will map points (if NULL point * support is activated) to a user specified * value (the null point) that indicates that the mapping is not valid. * * \ingroup ITKTransform */ template class GenericVectorFieldTransform : public Transform { public: /** Standard class typedefs. */ - typedef GenericVectorFieldTransform Self; + using Self = GenericVectorFieldTransform; typedef Transform Superclass; - typedef SmartPointer Pointer; - typedef SmartPointer ConstPointer; + using Pointer = SmartPointer; + using ConstPointer = SmartPointer; /** Run-time type information (and related methods). */ itkTypeMacro( GenericVectorFieldTransform, Transform ); /** New macro for creation of through a Smart Pointer */ itkNewMacro( Self ); - typedef typename Superclass::InverseTransformBaseType InverseTransformBaseType; - typedef typename Superclass::InverseTransformBasePointer InverseTransformBasePointer; + using InverseTransformBaseType = typename Superclass::InverseTransformBaseType; + using InverseTransformBasePointer = typename Superclass::InverseTransformBasePointer; /** Scalar type. */ - typedef typename Superclass::ScalarType ScalarType; + using ScalarType = typename Superclass::ScalarType; /** Type of the input parameters. */ - typedef typename Superclass::ParametersType ParametersType; - typedef typename Superclass::ParametersValueType ParametersValueType; + using ParametersType = typename Superclass::ParametersType; + using ParametersValueType = typename Superclass::ParametersValueType; /** Jacobian type. */ - typedef typename Superclass::JacobianType JacobianType; + using JacobianType = typename Superclass::JacobianType; /** Transform category type. */ - typedef typename Superclass::TransformCategoryType TransformCategoryType; + using TransformCategoryType = typename Superclass::TransformCategoryType; /** The number of parameters defininig this transform. */ - typedef typename Superclass::NumberOfParametersType NumberOfParametersType; + using NumberOfParametersType = typename Superclass::NumberOfParametersType; /** Standard coordinate point type for this class. */ - typedef typename Superclass::InputPointType InputPointType; - typedef typename Superclass::OutputPointType OutputPointType; + using InputPointType = typename Superclass::InputPointType; + using OutputPointType = typename Superclass::OutputPointType; /** Standard vector type for this class. */ - typedef typename Superclass::InputVectorType InputVectorType; - typedef typename Superclass::OutputVectorType OutputVectorType; + using InputVectorType = typename Superclass::InputVectorType; + using OutputVectorType = typename Superclass::OutputVectorType; - typedef typename Superclass::InputVectorPixelType InputVectorPixelType; - typedef typename Superclass::OutputVectorPixelType OutputVectorPixelType; + using InputVectorPixelType = typename Superclass::InputVectorPixelType; + using OutputVectorPixelType = typename Superclass::OutputVectorPixelType; /** Standard covariant vector type for this class */ - typedef typename Superclass::InputCovariantVectorType - InputCovariantVectorType; - typedef typename Superclass::OutputCovariantVectorType - OutputCovariantVectorType; + using InputCovariantVectorType = typename Superclass::InputCovariantVectorType; + using OutputCovariantVectorType = typename Superclass::OutputCovariantVectorType; /** Standard vnl_vector type for this class. */ - typedef typename Superclass::InputVnlVectorType InputVnlVectorType; - typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType; + using InputVnlVectorType = typename Superclass::InputVnlVectorType; + using OutputVnlVectorType = typename Superclass::OutputVnlVectorType; /** Standard diffusion tensor type for this class */ - typedef typename Superclass::InputDiffusionTensor3DType - InputDiffusionTensor3DType; - typedef typename Superclass::OutputDiffusionTensor3DType - OutputDiffusionTensor3DType; + using InputDiffusionTensor3DType = typename Superclass::InputDiffusionTensor3DType; + using OutputDiffusionTensor3DType = typename Superclass::OutputDiffusionTensor3DType; /** Standard tensor type for this class */ typedef CovariantVector InputTensorEigenVectorType; typedef CovariantVector OutputTensorEigenVectorType; /** Derivative type */ - typedef typename Superclass::DerivativeType DerivativeType; + using DerivativeType = typename Superclass::DerivativeType; /** Dimension of the domain spaces. */ itkStaticConstMacro( InDimension, unsigned int, InDimensions ); itkStaticConstMacro( OutDimension, unsigned int, OutDimensions); /** Define the displacement field type and corresponding interpolator type. */ typedef Image GenericVectorFieldType; - typedef typename GenericVectorFieldType::Pointer GenericVectorFieldPointer; - typedef typename GenericVectorFieldType::ConstPointer GenericVectorFieldConstPointer; + using GenericVectorFieldPointer = typename GenericVectorFieldType::Pointer; + using GenericVectorFieldConstPointer = typename GenericVectorFieldType::ConstPointer; typedef VectorInterpolateImageFunction InterpolatorType; /** Standard types for the displacement Field */ - typedef typename GenericVectorFieldType::IndexType IndexType; - typedef typename GenericVectorFieldType::RegionType RegionType; - typedef typename GenericVectorFieldType::SizeType SizeType; - typedef typename GenericVectorFieldType::SpacingType SpacingType; - typedef typename GenericVectorFieldType::DirectionType DirectionType; - typedef typename GenericVectorFieldType::PointType PointType; - typedef typename GenericVectorFieldType::PixelType PixelType; + using IndexType = typename GenericVectorFieldType::IndexType; + using RegionType = typename GenericVectorFieldType::RegionType; + using SizeType = typename GenericVectorFieldType::SizeType; + using SpacingType = typename GenericVectorFieldType::SpacingType; + using DirectionType = typename GenericVectorFieldType::DirectionType; + using PointType = typename GenericVectorFieldType::PointType; + using PixelType = typename GenericVectorFieldType::PixelType; /** Define the internal parameter helper used to access the field */ typedef ImageVectorOptimizerParametersHelper< ScalarType, OutputVectorType::Dimension, InDimension> OptimizerParametersHelperType; /** Get/Set the displacement field. * Set the displacement field. Create special set accessor to update * interpolator and assign displacement field to transform parameters * container. */ virtual void SetDisplacementField(GenericVectorFieldType* field); itkGetModifiableObjectMacro(DisplacementField, GenericVectorFieldType); /** Get/Set the interpolator. * Create out own set accessor that assigns the displacement field */ virtual void SetInterpolator( InterpolatorType* interpolator ); itkGetModifiableObjectMacro( Interpolator, InterpolatorType ); /** Get the modification time of displacement field */ itkGetConstReferenceMacro( DisplacementFieldSetTime, ModifiedTimeType ); /** Method to transform a point. Out-of-bounds points will * be returned with zero displacemnt. */ virtual OutputPointType TransformPoint( const InputPointType& thisPoint ) const; /** Method to transform a vector. */ using Superclass::TransformVector; - virtual OutputVectorType TransformVector(const InputVectorType &) const + virtual OutputVectorType TransformVector(const InputVectorType & /*unused*/) const { itkExceptionMacro( "TransformVector(Vector) unimplemented, use " "TransformVector(Vector,Point)" ); } - virtual OutputVectorPixelType TransformVector(const InputVectorPixelType &) + virtual OutputVectorPixelType TransformVector(const InputVectorPixelType & /*unused*/) const { itkExceptionMacro( "TransformVector(Vector) unimplemented, use " "TransformVector(Vector,Point)" ); } - virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const + virtual OutputVnlVectorType TransformVector(const InputVnlVectorType & /*unused*/) const { itkExceptionMacro( "TransformVector(Vector) unimplemented, use " "TransformVector(Vector,Point)" ); } /** Method to transform a tensor */ using Superclass::TransformDiffusionTensor3D; OutputDiffusionTensor3DType TransformDiffusionTensor( - const InputDiffusionTensor3DType & ) const + const InputDiffusionTensor3DType & /*unused*/) const { itkExceptionMacro( "TransformDiffusionTensor(Tensor) unimplemented, use " "TransformDiffusionTensor(Tensor,Point)" ); } - OutputVectorPixelType TransformDiffusionTensor(const InputVectorPixelType & ) + OutputVectorPixelType TransformDiffusionTensor(const InputVectorPixelType & /*unused*/) const { itkExceptionMacro( "TransformDiffusionTensor(Tensor) unimplemented, use " "TransformDiffusionTensor(Tensor,Point)" ); } /** Method to transform a CovariantVector. */ using Superclass::TransformCovariantVector; virtual OutputCovariantVectorType TransformCovariantVector( - const InputCovariantVectorType &) const + const InputCovariantVectorType & /*unused*/) const { itkExceptionMacro( "TransformCovariantVector(CovariantVector) " "unimplemented, use TransformCovariantVector(CovariantVector,Point)" ); } virtual OutputVectorPixelType TransformCovariantVector( - const InputVectorPixelType &) const + const InputVectorPixelType & /*unused*/) const { itkExceptionMacro( "TransformCovariantVector(CovariantVector) " "unimplemented, use TransformCovariantVector(CovariantVector,Point)" ); } /** Set the transformation parameters. This sets the displacement * field image directly. */ virtual void SetParameters(const ParametersType & params) { if( &(this->m_Parameters) != ¶ms ) { if( params.Size() != this->m_Parameters.Size() ) { itkExceptionMacro("Input parameters size (" << params.Size() << ") does not match internal size (" << this->m_Parameters.Size() << ")."); } /* copy into existing object */ this->m_Parameters = params; this->Modified(); } } /** * This method sets the fixed parameters of the transform. * For a displacement field transform, the fixed parameters are the * following: field size, field origin, field spacing, and field direction. * * Note: If a displacement field already exists, this function * creates a new one with zero displacement (identity transform). */ - virtual void SetFixedParameters( const ParametersType & ); + virtual void SetFixedParameters( const ParametersType & /*fixedParameters*/); /** * Compute the jacobian with respect to the parameters at a point. * Simply returns identity matrix, sized [NDimensions, NDimensions]. * * T(x, p), x is the position, p is the local parameter at position x. * Take a 2D example, x = (x0, x1), p = (p0, p1) and T(x, p) is defined as: * * T(x, p) = (T0, T1) = (x0+p0, x1+p1) * * Each local deformation is defined as a translation transform. * So the Jacobian w.r.t parameters are * * dT/dp = * [ dT0/dp0, dT0/dp1; * dT1/dp0, dT1/dp1 ]; * * = [1, 0; * 0, 1]; * * TODO: format the above for doxygen formula. */ - virtual void ComputeJacobianWithRespectToParameters(const InputPointType &, + virtual void ComputeJacobianWithRespectToParameters(const InputPointType & /*unused*/, JacobianType & j) const { itkExceptionMacro("ComputeJacobianWithRespectToParameters unimplemented"); } /** * Compute the jacobian with respect to the parameters at an index. * Simply returns identity matrix, sized [NDimensions, NDimensions]. * See \c ComputeJacobianWithRespectToParameters( InputPointType, ... ) * for rationale. */ - virtual void ComputeJacobianWithRespectToParameters(const IndexType &, + virtual void ComputeJacobianWithRespectToParameters(const IndexType & /*unused*/, JacobianType & j) const { itkExceptionMacro("ComputeJacobianWithRespectToParameters unimplemented"); } /** * Compute the jacobian with respect to the position, by point. * \c j will be resized as needed. */ virtual void ComputeJacobianWithRespectToPosition(const InputPointType & x, JacobianType & j ) const; /** * Compute the jacobian with respect to the position, by point. * \c j will be resized as needed. */ virtual void ComputeInverseJacobianWithRespectToPosition(const InputPointType & x, JacobianType & j ) const; /** * Compute the jacobian with respect to the position, by index. * \c j will be resized as needed. */ virtual void ComputeJacobianWithRespectToPosition(const IndexType & x, JacobianType & j ) const; /** * Compute the inverse jacobian of the forward displacement field with * respect to the position, by point. Note that this is different than * the jacobian of the inverse displacement field. This takes advantage * of the ability to compute the inverse jacobian of a displacement field * by simply reversing the sign of the forward jacobian. * However, a more accurate method for computing the inverse * jacobian is to take the inverse of the jacobian matrix. This * method is more computationally expensive and may be used by * setting \c useSVD to true */ virtual void GetInverseJacobianOfForwardFieldWithRespectToPosition(const InputPointType & point, JacobianType & jacobian, bool useSVD = false ) const; /** * Compute the inverse jacobian of the forward displacement field with * respect to the position, by index.Note that this is different than * the jacobian of the inverse displacement field. This takes advantage * of the ability to compute the inverse jacobian of a displacement field * by simply reversing the sign of the forward jacobian. * However, a more accurate method for computing the inverse * jacobian is to take the inverse of the jacobian matrix. This * method is more computationally expensive and may be used by * setting \c useSVD to true */ virtual void GetInverseJacobianOfForwardFieldWithRespectToPosition(const IndexType & index, JacobianType & jacobian, bool useSVD = false ) const; virtual void UpdateTransformParameters( const DerivativeType & update, ScalarType factor = 1.0 ); /** Return an inverse of this transform. * Note that the inverse displacement field must be set by the user. */ bool GetInverse( Self *inverse ) const; /** Return an inverse of this transform. * Note that the inverse displacement field must be set by the user. */ virtual InverseTransformBasePointer GetInverseTransform() const; /** This transform is not linear. */ virtual TransformCategoryType GetTransformCategory() const { return Self::DisplacementField; } - virtual NumberOfParametersType GetNumberOfLocalParameters(void) const + virtual NumberOfParametersType GetNumberOfLocalParameters() const { return InDimension; } itkSetMacro(NullPoint, OutputPointType); itkGetConstMacro(NullPoint, OutputPointType); itkSetMacro(UseNullPoint, bool); itkGetConstMacro(UseNullPoint, bool); itkBooleanMacro(UseNullPoint); protected: GenericVectorFieldTransform(); virtual ~GenericVectorFieldTransform(); void PrintSelf( std::ostream& os, Indent indent ) const; /** The displacement field and its inverse (if it exists). */ typename GenericVectorFieldType::Pointer m_DisplacementField; /** The interpolator. */ typename InterpolatorType::Pointer m_Interpolator; /** Track when the displacement field was last set/assigned, as * distinct from when it may have had its contents modified. */ ModifiedTimeType m_DisplacementFieldSetTime; OutputPointType m_NullPoint; bool m_UseNullPoint; private: GenericVectorFieldTransform( const Self & ); // purposely not implemented void operator=( const Self & ); // purposely not implemented /** * Convenience method which reads the information from the current * displacement field into m_FixedParameters. */ virtual void SetFixedParametersFromGenericVectorField() const; }; } // end namespace itk #ifndef ITK_MANUAL_INSTANTIATION #include "mapGenericVectorFieldTransform.tpp" #endif #endif // __itkGenericVectorFieldTransform_h diff --git a/Code/Core/include/mapGenericVectorFieldTransform.tpp b/Code/Core/include/mapGenericVectorFieldTransform.tpp index 8c86411..60c91c0 100644 --- a/Code/Core/include/mapGenericVectorFieldTransform.tpp +++ b/Code/Core/include/mapGenericVectorFieldTransform.tpp @@ -1,370 +1,370 @@ /*========================================================================= * * Copyright Insight Software Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *=========================================================================*/ #ifndef __mapGenericVectorFieldTransform_tpp #define __mapGenericVectorFieldTransform_tpp #include "mapGenericVectorFieldTransform.h" #include "itkVectorLinearInterpolateImageFunction.h" #include "itkImageRegionIteratorWithIndex.h" #include "vnl/algo/vnl_symmetric_eigensystem.h" #include "vnl/algo/vnl_matrix_inverse.h" #include "mapPointVectorCombinationPolicy.h" namespace itk { /** * Constructor */ template GenericVectorFieldTransform::GenericVectorFieldTransform() : Superclass(0) { this->m_DisplacementField = ITK_NULLPTR; this->m_FixedParameters.SetSize(InDimensions * (InDimensions + 3)); this->m_FixedParameters.Fill(0.0); // Setup and assign default interpolator typedef VectorLinearInterpolateImageFunction< GenericVectorFieldType, ScalarType> DefaultInterpolatorType; typename DefaultInterpolatorType::Pointer interpolator = DefaultInterpolatorType::New(); this->m_Interpolator = interpolator; // Setup and assign parameter helper. This will hold the displacement field // for access through the common OptimizerParameters interface. OptimizerParametersHelperType* helper = new OptimizerParametersHelperType; // After assigning this, m_Parametes will manage this, // deleting when appropriate. this->m_Parameters.SetHelper(helper); m_DisplacementFieldSetTime = 0; m_UseNullPoint = false; m_NullPoint.Fill(::itk::NumericTraits::NonpositiveMin()); } /** * Destructor */ template GenericVectorFieldTransform:: ~GenericVectorFieldTransform() { } /** * Transform point */ template typename GenericVectorFieldTransform::OutputPointType GenericVectorFieldTransform ::TransformPoint(const InputPointType& inputPoint) const { if (!this->m_DisplacementField) { itkExceptionMacro("No displacement field is specified."); } if (!this->m_Interpolator) { itkExceptionMacro("No interpolator is specified."); } typename InterpolatorType::ContinuousIndexType cidx; typename InterpolatorType::PointType point; point.CastFrom(inputPoint); OutputPointType outputPoint = m_NullPoint; if (this->m_Interpolator->IsInsideBuffer(point)) { this->m_DisplacementField->TransformPhysicalPointToContinuousIndex(point, cidx); typename InterpolatorType::OutputType displacement = this->m_Interpolator->EvaluateAtContinuousIndex(cidx); typedef typename InterpolatorType::OutputType::Superclass VectorSuperclassType; if (!displacement.VectorSuperclassType::operator == (m_NullPoint)) { //displacement does not equal nullpoint, which would indicate not supported field ::map::core::PointVectorCombinationPolicy::mapPoint(inputPoint, displacement, outputPoint); } } else { if (this->m_UseNullPoint) { outputPoint = m_NullPoint; } else { ::map::core::PointVectorCombinationPolicy::mapPoint(inputPoint, outputPoint); } } return outputPoint; } /** * return an inverse transformation */ template bool GenericVectorFieldTransform - ::GetInverse(Self *itkNotUsed(inverse)) const + ::GetInverse(Self *itkNotUsed(inverse) /*unused*/) const { return false; } // Return an inverse of this transform template typename GenericVectorFieldTransform::InverseTransformBasePointer GenericVectorFieldTransform ::GetInverseTransform() const { return ITK_NULLPTR; } /* * ComputeJacobianWithRespectToParameters methods */ template void GenericVectorFieldTransform ::ComputeJacobianWithRespectToPosition(const InputPointType & point, JacobianType & jacobian) const { itkExceptionMacro("ComputeJacobianWithRespectToPosition unimplemented"); } template void GenericVectorFieldTransform ::ComputeJacobianWithRespectToPosition(const IndexType & index, JacobianType & jacobian) const { itkExceptionMacro("ComputeJacobianWithRespectToPosition unimplemented"); } template void GenericVectorFieldTransform ::ComputeInverseJacobianWithRespectToPosition(const InputPointType & point, JacobianType & jacobian) const { itkExceptionMacro("ComputeInverseJacobianWithRespectToPosition unimplemented"); } template void GenericVectorFieldTransform ::GetInverseJacobianOfForwardFieldWithRespectToPosition( const InputPointType & point, JacobianType & jacobian, bool useSVD) const { itkExceptionMacro("GetInverseJacobianOfForwardFieldWithRespectToPosition unimplemented"); } template void GenericVectorFieldTransform ::GetInverseJacobianOfForwardFieldWithRespectToPosition( const IndexType & index, JacobianType & jacobian, bool useSVD) const { itkExceptionMacro("GetInverseJacobianOfForwardFieldWithRespectToPosition unimplemented"); } template void GenericVectorFieldTransform ::UpdateTransformParameters(const DerivativeType & update, ScalarType factor) { // This simply adds the values. - // TODO: This should be multi-threaded probably, via image add filter. + // TODO(floca): This should be multi-threaded probably, via image add filter. Superclass::UpdateTransformParameters(update, factor); } template void GenericVectorFieldTransform ::SetDisplacementField(GenericVectorFieldType* field) { itkDebugMacro("setting GenericVectorField to " << field); if (this->m_DisplacementField != field) { this->m_DisplacementField = field; this->Modified(); /* Store this separately for use in smoothing because we only want * to know when the displacement field object has changed, not just * its contents. */ this->m_DisplacementFieldSetTime = this->GetMTime(); if (!this->m_Interpolator.IsNull()) { this->m_Interpolator->SetInputImage(this->m_DisplacementField); } // Assign to parameters object this->m_Parameters.SetParametersObject(this->m_DisplacementField); } this->SetFixedParametersFromGenericVectorField(); } template void GenericVectorFieldTransform ::SetInterpolator(InterpolatorType* interpolator) { itkDebugMacro("setting Interpolator to " << interpolator); if (this->m_Interpolator != interpolator) { this->m_Interpolator = interpolator; this->Modified(); if (!this->m_DisplacementField.IsNull()) { this->m_Interpolator->SetInputImage(this->m_DisplacementField); } } } template void GenericVectorFieldTransform ::SetFixedParameters(const ParametersType & fixedParameters) { if (fixedParameters.Size() != InDimensions * (InDimensions + 3)) { itkExceptionMacro("The fixed parameters are not the right size."); } SizeType size; for (unsigned int d = 0; d < InDimensions; d++) { size[d] = static_cast(fixedParameters[d]); } PointType origin; for (unsigned int d = 0; d < InDimensions; d++) { origin[d] = fixedParameters[d + InDimensions]; } SpacingType spacing; for (unsigned int d = 0; d < InDimensions; d++) { spacing[d] = fixedParameters[d + 2 * InDimensions]; } DirectionType direction; for (unsigned int di = 0; di < InDimensions; di++) { for (unsigned int dj = 0; dj < InDimensions; dj++) { direction[di][dj] = fixedParameters[3 * InDimensions + (di * InDimensions + dj)]; } } PixelType zeroDisplacement; zeroDisplacement.Fill(0.0); typename GenericVectorFieldType::Pointer GenericVectorField = GenericVectorFieldType::New(); GenericVectorField->SetSpacing(spacing); GenericVectorField->SetOrigin(origin); GenericVectorField->SetDirection(direction); GenericVectorField->SetRegions(size); GenericVectorField->Allocate(); GenericVectorField->FillBuffer(zeroDisplacement); this->SetDisplacementField(GenericVectorField); } template void GenericVectorFieldTransform ::SetFixedParametersFromGenericVectorField() const { this->m_FixedParameters.SetSize(InDimensions * (InDimensions + 3)); const typename GenericVectorFieldType::RegionType & fieldRegion = this->m_DisplacementField->GetLargestPossibleRegion(); // Set the field size parameters SizeType fieldSize = fieldRegion.GetSize(); for (unsigned int i = 0; i < InDimensions; i++) { this->m_FixedParameters[i] = static_cast(fieldSize[i]); } // Set the origin parameters PointType fieldOrigin = this->m_DisplacementField->GetOrigin(); for (unsigned int i = 0; i < InDimensions; i++) { this->m_FixedParameters[InDimensions + i] = fieldOrigin[i]; } // Set the spacing parameters SpacingType fieldSpacing = this->m_DisplacementField->GetSpacing(); for (unsigned int i = 0; i < InDimensions; i++) { this->m_FixedParameters[2 * InDimensions + i] = static_cast(fieldSpacing[i]); } // Set the direction parameters DirectionType fieldDirection = this->m_DisplacementField->GetDirection(); for (unsigned int di = 0; di < InDimensions; di++) { for (unsigned int dj = 0; dj < InDimensions; dj++) { this->m_FixedParameters[3 * InDimensions + (di * InDimensions + dj)] = static_cast(fieldDirection[di][dj]); } } } template void GenericVectorFieldTransform ::PrintSelf(std::ostream& os, Indent indent) const { Superclass::PrintSelf(os, indent); std::cout << indent << "Interpolator: " << std::endl; std::cout << indent << indent << this->m_Interpolator << std::endl; std::cout << indent << "UseNullPoint: " << this->m_UseNullPoint << std::endl; std::cout << indent << "NullPoint: " << this->m_NullPoint << std::endl; if (this->m_DisplacementField) { std::cout << indent << "Displacement Field: " << std::endl; std::cout << indent << indent << this->m_DisplacementField << std::endl; } else { std::cout << "Displacement field not set." << std::endl; } } } // namespace itk #endif diff --git a/Code/Core/include/mapImageByModelPerformer.h b/Code/Core/include/mapImageByModelPerformer.h index 0eef371..60607ae 100644 --- a/Code/Core/include/mapImageByModelPerformer.h +++ b/Code/Core/include/mapImageByModelPerformer.h @@ -1,110 +1,110 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_IMAGE_BY_MODEL_PERFORMER_H #define __MAP_IMAGE_BY_MODEL_PERFORMER_H #include "mapImageMappingPerformerBase.h" #include "mapRegistrationKernelBase.h" namespace map { namespace core { /*! @class ImageByModelPerformer * @brief Performer class that maps image data by using inverse mapping and a transformation model kernel. * * @ingroup MappingTask * @tparam TRegistration the registration class, that should be used to perform the task. * @tparam TInputData Type of the data in the input space. * @tparam TResultData Type of the data in the target space. */ template class ImageByModelPerformer : public ImageMappingPerformerBase { public: /*! Standard class typedefs. */ typedef ImageByModelPerformer Self; typedef ImageMappingPerformerBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(ImageByModelPerformer, ImageMappingPerformerBase); itkNewMacro(Self); - typedef typename Superclass::RegistrationType RegistrationType; - typedef typename Superclass::RequestType RequestType; + using RegistrationType = typename Superclass::RegistrationType; + using RequestType = typename Superclass::RequestType; - typedef typename Superclass::InputDataType InputDataType; - typedef typename Superclass::InputDataConstPointer InputDataConstPointer; - typedef typename Superclass::ResultDataType ResultDataType; - typedef typename Superclass::ResultDataPointer ResultDataPointer; + using InputDataType = typename Superclass::InputDataType; + using InputDataConstPointer = typename Superclass::InputDataConstPointer; + using ResultDataType = typename Superclass::ResultDataType; + using ResultDataPointer = typename Superclass::ResultDataPointer; /*! Registers the input data and returns the result data. * @eguarantee strong * @param [in] request Referenz to the request that contains all needed information to perform the image registration * @return Smart pointer to the result image. */ - virtual ResultDataPointer performMapping(const RequestType& request) const; + ResultDataPointer performMapping(const RequestType& request) const override; /*! Uses the passed request data to check if the provider is able to provide the service for * this request. * @return Indicates if the provider offers the right solution. * @retval true Provider can handle the request. * @retval false Provider is not able to handle the request.*/ - virtual bool canHandleRequest(const RequestType& request) const; + bool canHandleRequest(const RequestType& request) const override; /*! Returns an ID of the provider as string. Calls getStaticProviderName(). * @return Service provider ID.*/ - virtual String getProviderName() const; + String getProviderName() const override; /*! Returns an ID of the provider as string. * @return Service provider ID.*/ static String getStaticProviderName(); /*! Returns an ID of the provider as string. May be equal to GetClassName(), but it may differ. * @return Service provider ID. * @remark It is a return by value, becaus it might be possible that the description is generated on line * when calling this method.*/ - virtual String getDescription() const; + String getDescription() const override; protected: - typedef typename RegistrationType::InverseMappingType InverseKernelBaseType; + using InverseKernelBaseType = typename RegistrationType::InverseMappingType; ImageByModelPerformer(); - virtual ~ImageByModelPerformer(); + ~ImageByModelPerformer() override; private: ImageByModelPerformer(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapImageByModelPerformer.tpp" #endif #endif diff --git a/Code/Core/include/mapImageByModelPerformer.tpp b/Code/Core/include/mapImageByModelPerformer.tpp index fd0d731..11f0754 100644 --- a/Code/Core/include/mapImageByModelPerformer.tpp +++ b/Code/Core/include/mapImageByModelPerformer.tpp @@ -1,225 +1,225 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_IMAGE_BY_MODEL_PERFORMER_TPP #define __MAP_IMAGE_BY_MODEL_PERFORMER_TPP #include "mapImageByModelPerformer.h" #include "mapServiceException.h" #include "mapRegistrationKernel.h" #include "itkResampleImageFilter.h" namespace map { namespace core { template class ImageByModelPerformerHelper { public: - typedef TRequest RequestType; - typedef typename RequestType::ResultDataType::Pointer ResultDataPointer; + using RequestType = TRequest; + using ResultDataPointer = typename RequestType::ResultDataType::Pointer; static ResultDataPointer performMapping(const RequestType& request) { mapExceptionStaticMacro(ServiceException, << "Error: unimplemented feature. Cannot perform unsymetric registrations right now. Request: " << request); //! @TODO unsymmetrische registrierungen müssen auch noch gehandhabt werden; Strategie ist dafür auszuarbeiten, da es dann auch Regeln für fehlende Surjektivität und Injektivität geben muss. }; protected: ImageByModelPerformerHelper(); //purposely not implemented ~ImageByModelPerformerHelper(); //purposely not implemented ImageByModelPerformerHelper(const ImageByModelPerformerHelper&); //purposely not implemented ImageByModelPerformerHelper& operator = (const ImageByModelPerformerHelper&); //purposely not implemented }; template class ImageByModelPerformerHelper { public: - typedef TRequest RequestType; - typedef typename RequestType::InputDataType InputDataType; - typedef typename RequestType::ResultDataType ResultDataType; - typedef typename RequestType::ResultDataType::Pointer ResultDataPointer; - typedef typename RequestType::RegistrationType::InverseMappingType InverseKernelBaseType; + using RequestType = TRequest; + using InputDataType = typename RequestType::InputDataType; + using ResultDataType = typename RequestType::ResultDataType; + using ResultDataPointer = typename RequestType::ResultDataType::Pointer; + using InverseKernelBaseType = typename RequestType::RegistrationType::InverseMappingType; typedef RegistrationKernel ModelKernelType; static ResultDataPointer performMapping(const RequestType& request) { const InverseKernelBaseType& inverseKernelBase = request._spRegistration->getInverseMapping(); - const ModelKernelType* pInverseKernel = dynamic_cast(&inverseKernelBase); + const auto* pInverseKernel = dynamic_cast(&inverseKernelBase); //get direct access to the transform model const typename ModelKernelType::TransformType* pTransformModel = pInverseKernel->getTransformModel(); //instantiate resampler typedef itk::ResampleImageFilter ResampleFilterType; typename ResampleFilterType::Pointer spFilter = ResampleFilterType::New(); spFilter->SetOutputSpacing(request._spResultDescriptor->getSpacing()); spFilter->SetOutputOrigin(request._spResultDescriptor->getOrigin()); spFilter->SetSize(request._spResultDescriptor->getRepresentedLocalImageRegion().GetSize()); spFilter->SetOutputDirection(request._spResultDescriptor->getDirection()); spFilter->SetTransform(pTransformModel); spFilter->SetInput(request._spInputData); spFilter->SetInterpolator(request._spInterpolateFunction); spFilter->SetDefaultPixelValue(request._paddingValue); ResultDataPointer spResultImage = spFilter->GetOutput(); spFilter->Update(); return spResultImage; }; protected: ImageByModelPerformerHelper(); //purposely not implemented ~ImageByModelPerformerHelper(); //purposely not implemented ImageByModelPerformerHelper(const ImageByModelPerformerHelper&); //purposely not implemented ImageByModelPerformerHelper& operator = (const ImageByModelPerformerHelper&); //purposely not implemented }; template typename ImageByModelPerformer::ResultDataPointer ImageByModelPerformer:: performMapping(const RequestType& request) const { typedef RegistrationKernel ModelKernelType; const InverseKernelBaseType& inverseKernelBase = request._spRegistration->getInverseMapping(); - const ModelKernelType* pInverseKernel = dynamic_cast(&inverseKernelBase); + const auto* pInverseKernel = dynamic_cast(&inverseKernelBase); - if (pInverseKernel == NULL) + if (pInverseKernel == nullptr) { mapExceptionMacro(ServiceException, << "Error: cannot map image. Reason: inverse mapping kernel of registration is not model based. Registration: " << request._spRegistration); } - if (pInverseKernel->getTransformModel() == NULL) + if (pInverseKernel->getTransformModel() == nullptr) { mapExceptionMacro(ServiceException, << "Error: cannot map image. Reason: inverse model based mapping kernel has no transform model. Check correct creation of the registration. Registration: " << request._spRegistration); } if (request._spInputData.IsNull()) { mapExceptionMacro(ServiceException, << "Error: cannot map image. Reason: no input image defined in request. Request: " << request); } if (request._spResultDescriptor.IsNull()) { mapExceptionMacro(ServiceException, << "Error: cannot map image. Reason: no result descriptor defined in request. Request: " << request); } if (request._spInterpolateFunction.IsNull()) { mapExceptionMacro(ServiceException, << "Error: cannot map image. Reason: no interpolate function defined in request. Request: " << request); } if (request._throwOnOutOfInputAreaError) { mapExceptionMacro(ServiceException, << "Error: unimplemented feature. Cannot throw exception on out of input area error. Only padding is implemented right now"); //! @todo Prüfen ob auch exception geworfen werden soll, wenn ja muss ein erweiterter resample filter gemacht werden, wenn nein, dann muss der request angepasst werden } typedef ImageByModelPerformerHelper HelperType; ResultDataPointer spResultImage = HelperType::performMapping(request); return spResultImage; } template bool ImageByModelPerformer:: canHandleRequest(const RequestType& request) const { const InverseKernelBaseType& inverseKernelBase = request._spRegistration->getInverseMapping(); typedef RegistrationKernel ModelKernelType; - const ModelKernelType* pInverseKernel = dynamic_cast(&inverseKernelBase); + const auto* pInverseKernel = dynamic_cast(&inverseKernelBase); - return (pInverseKernel != NULL) && (request._spInputData.IsNotNull()); + return (pInverseKernel != nullptr) && (request._spInputData.IsNotNull()); } template String ImageByModelPerformer:: getProviderName() const { return getStaticProviderName(); } template String ImageByModelPerformer:: getStaticProviderName() { OStringStream os; os << "ImageByModelPerformer>"; return os.str(); }; template String ImageByModelPerformer:: getDescription() const { OStringStream os; os << "ImageByModelPerformer, Registration<" << RegistrationType::MovingDimensions << "," << RegistrationType::TargetDimensions << ">"; return os.str(); } template ImageByModelPerformer:: - ImageByModelPerformer() {}; + ImageByModelPerformer() = default; template ImageByModelPerformer:: - ~ImageByModelPerformer() {}; + ~ImageByModelPerformer() = default; } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapImageMappingPerformerBase.h b/Code/Core/include/mapImageMappingPerformerBase.h index 71c37f1..af7bc2c 100644 --- a/Code/Core/include/mapImageMappingPerformerBase.h +++ b/Code/Core/include/mapImageMappingPerformerBase.h @@ -1,98 +1,98 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_IMAGE_MAPPING_PERFORMER_BASE_H #define __MAP_IMAGE_MAPPING_PERFORMER_BASE_H #include "mapMappingPerformerBase.h" #include "mapImageMappingPerformerRequest.h" namespace map { namespace core { /*! @class ImageMappingPerformerBase * @brief Base class for any instance in MatchPoint that provides the service of performing a registration on any kind of data. * * @ingroup MappingTask * @tparam TRegistration the registration class, that should be used to perform the task. * @tparam TInputData Type of the data in the input space. * @tparam TResultData Type of the data in the target space. */ template class ImageMappingPerformerBase : public MappingPerformerBase< ImageMappingPerformerRequest > { public: typedef ImageMappingPerformerRequest RequestType; /*! Standard class typedefs. */ typedef ImageMappingPerformerBase Self; - typedef MappingPerformerBase< RequestType > Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Superclass = MappingPerformerBase; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(ImageMappingPerformerBase, MappingPerformerBase); - typedef typename Superclass::RegistrationType RegistrationType; - typedef typename Superclass::InputDataType InputDataType; - typedef typename Superclass::InputDataConstPointer InputDataConstPointer; - typedef typename Superclass::ResultDataType ResultDataType; - typedef typename Superclass::ResultDataPointer ResultDataPointer; + using RegistrationType = typename Superclass::RegistrationType; + using InputDataType = typename Superclass::InputDataType; + using InputDataConstPointer = typename Superclass::InputDataConstPointer; + using ResultDataType = typename Superclass::ResultDataType; + using ResultDataPointer = typename Superclass::ResultDataPointer; - typedef typename RequestType::ResultImageDescriptorType ResultImageDescriptorType; + using ResultImageDescriptorType = typename RequestType::ResultImageDescriptorType; /*! Registers the input data and returns the result data. * @eguarantee strong * @param [in] request Referenz to the request that contains all needed information to perform the image registration * @return Smart pointer to the result image. */ - virtual ResultDataPointer performMapping(const RequestType& request) const = 0; + ResultDataPointer performMapping(const RequestType& request) const override = 0; #ifdef ITK_USE_CONCEPT_CHECKING /** Begin concept checking */ itkConceptMacro(InputDataFitsRegistrationCheck, (itk::Concept::SameDimension)); itkConceptMacro(ResultDataFitsRegistrationCheck, (itk::Concept::SameDimension)); /** End concept checking */ #endif protected: ImageMappingPerformerBase(); - virtual ~ImageMappingPerformerBase(); + ~ImageMappingPerformerBase() override; private: - ImageMappingPerformerBase(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented + ImageMappingPerformerBase(const Self&) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapImageMappingPerformerBase.tpp" #endif #endif diff --git a/Code/Core/include/mapImageMappingPerformerLoadPolicy.h b/Code/Core/include/mapImageMappingPerformerLoadPolicy.h index 785bbdb..3952a9a 100644 --- a/Code/Core/include/mapImageMappingPerformerLoadPolicy.h +++ b/Code/Core/include/mapImageMappingPerformerLoadPolicy.h @@ -1,74 +1,74 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_IMAGE_MAPPING_PERFORMER_LOAD_POLICY_H #define __MAP_IMAGE_MAPPING_PERFORMER_LOAD_POLICY_H # include "mapGenericStaticLoadPolicyBase.h" namespace map { namespace core { /*! @class ImageMappingPerformerLoadPolicy * @brief Load class used by ImageMappingTask to populate its service stack. * * It loads the following providers: * - ImageByModelPerformer * - ImageByFieldPerformer * . * * @ingroup LoadPolicies * @ingroup RegTasks * @sa ImageMappingTask * @tparam TProviderBase Base class of the service providers loaded by the policy. */ template class ImageMappingPerformerLoadPolicy : public services::GenericStaticLoadPolicyBase { protected: /*! Standard class typedefs. */ - typedef services::GenericStaticLoadPolicyBase Superclass; - typedef typename Superclass::ProviderBaseType ProviderBaseType; - typedef typename Superclass::ProviderBasePointer ProviderBasePointer; - typedef typename Superclass::LoadInterfaceType LoadInterfaceType; + using Superclass = services::GenericStaticLoadPolicyBase; + using ProviderBaseType = typename Superclass::ProviderBaseType; + using ProviderBasePointer = typename Superclass::ProviderBasePointer; + using LoadInterfaceType = typename Superclass::LoadInterfaceType; - virtual void doLoading(); + void doLoading() override; ImageMappingPerformerLoadPolicy(); ~ImageMappingPerformerLoadPolicy(); private: ImageMappingPerformerLoadPolicy(const - ImageMappingPerformerLoadPolicy&); //purposely not implemented - void operator=(const ImageMappingPerformerLoadPolicy&); //purposely not implemented + ImageMappingPerformerLoadPolicy&) = delete; //purposely not implemented + void operator=(const ImageMappingPerformerLoadPolicy&) = delete; //purposely not implemented }; } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapImageMappingPerformerLoadPolicy.tpp" #endif #endif diff --git a/Code/Core/include/mapImageMappingPerformerLoadPolicy.tpp b/Code/Core/include/mapImageMappingPerformerLoadPolicy.tpp index 7f9da49..fbd4b8b 100644 --- a/Code/Core/include/mapImageMappingPerformerLoadPolicy.tpp +++ b/Code/Core/include/mapImageMappingPerformerLoadPolicy.tpp @@ -1,71 +1,69 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_IMAGE_MAPPING_PERFORMER_LOAD_POLICY_TPP #define __MAP_IMAGE_MAPPING_PERFORMER_LOAD_POLICY_TPP #include "mapImageMappingPerformerLoadPolicy.h" #include "mapImageByModelPerformer.h" #include "mapServiceRepositoryPolicyLoadInterface.h" namespace map { namespace core { template void ImageMappingPerformerLoadPolicy:: doLoading() { typedef ImageByModelPerformer ImageByModelPerformerType; typename ImageByModelPerformerType::Pointer spModelPerformer = ImageByModelPerformerType::New(); services::ServiceRepositoryPolicyLoader loader(Superclass::_pLoadInterface); if (!loader.addProviderByPolicy(spModelPerformer)) { mapLogWarningObjMacro("ImageByModelPerformer was not added because it was already on the service stack!"); } } template ImageMappingPerformerLoadPolicy:: ImageMappingPerformerLoadPolicy() - { - } + = default; template ImageMappingPerformerLoadPolicy:: ~ImageMappingPerformerLoadPolicy() - { - } + = default; } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapImageMappingPerformerRequest.h b/Code/Core/include/mapImageMappingPerformerRequest.h index 78ed47f..1071dba 100644 --- a/Code/Core/include/mapImageMappingPerformerRequest.h +++ b/Code/Core/include/mapImageMappingPerformerRequest.h @@ -1,148 +1,148 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_IMAGE_MAPPING_PERFORMER_REQUEST_H #define __MAP_IMAGE_MAPPING_PERFORMER_REQUEST_H #include "mapMappingPerformerRequestBase.h" #include "mapFieldRepresentationDescriptor.h" #include "itkInterpolateImageFunction.h" #include namespace map { namespace core { /*! @class ImageMappingPerformerRequest * This class is used by MappingPerformer for requests dealing with pointsets. * @ingroup MappingTask * @sa MappingPerformer * @tparam TRegistration the registration class, that should be used to perform the task. * @tparam TInputData Type of the input data. * @tparam TResultData Type of the data in the target space. */ template class ImageMappingPerformerRequest: public MappingPerformerRequestBase { public: typedef MappingPerformerRequestBase Superclass; - typedef typename Superclass::ResultDataType ResultDataType; - typedef typename Superclass::RegistrationType RegistrationType; - typedef typename Superclass::InputDataType InputDataType; - typedef typename ResultDataType::PixelType ErrorValueType; - typedef typename ResultDataType::PixelType PaddingValueType; - typedef FieldRepresentationDescriptor ResultImageDescriptorType; + using ResultDataType = typename Superclass::ResultDataType; + using RegistrationType = typename Superclass::RegistrationType; + using InputDataType = typename Superclass::InputDataType; + using ErrorValueType = typename ResultDataType::PixelType; + using PaddingValueType = typename ResultDataType::PixelType; + using ResultImageDescriptorType = FieldRepresentationDescriptor; typedef itk::InterpolateImageFunction InterpolateBaseType; - typedef typename InterpolateBaseType::Pointer InterpolateBasePointer; + using InterpolateBasePointer = typename InterpolateBaseType::Pointer; ImageMappingPerformerRequest(const RegistrationType* pRegistration, const InputDataType* pInputData, const ResultImageDescriptorType* pResultDescriptor, InterpolateBaseType* pInterpolateFunction, bool throwOnMappingError, const ErrorValueType& errorValue, bool throwOnOutOfInputAreaError, PaddingValueType paddingValue); - virtual ~ImageMappingPerformerRequest(); + ~ImageMappingPerformerRequest() override; - ImageMappingPerformerRequest(const ImageMappingPerformerRequest&); - void operator=(const ImageMappingPerformerRequest&); + ImageMappingPerformerRequest(const ImageMappingPerformerRequest& /*other*/); + void operator=(const ImageMappingPerformerRequest& /*other*/); typename ResultImageDescriptorType::ConstPointer _spResultDescriptor; mutable InterpolateBasePointer _spInterpolateFunction; bool _throwOnMappingError; ErrorValueType _errorValue; bool _throwOnOutOfInputAreaError; PaddingValueType _paddingValue; }; template std::ostream& operator<<(std::ostream& os, const ImageMappingPerformerRequest& request) { if (request._spRegistration.IsNull()) { os << "NULL" << std::endl; } else { os << request._spRegistration << std::endl; }; os << "Input data: "; if (request._spInputData.IsNull()) { os << "NULL" << std::endl; } else { os << request._spInputData << std::endl; }; os << "Result descriptor: "; if (request._spResultDescriptor.IsNull()) { os << "NULL" << std::endl; } else { os << request._spResultDescriptor << std::endl; }; os << "Interpolate function: "; if (request._spInterpolateFunction.IsNull()) { os << "NULL" << std::endl; } else { os << request._spInterpolateFunction << std::endl; }; os << "ThrowOnMappingError: " << request._throwOnMappingError << std::endl; os << "Error value: " << request._errorValue << std::endl; os << "ThrowOnOutOfInputAreaError: " << request._throwOnOutOfInputAreaError << std::endl; os << "Padding value: " << request._paddingValue << std::endl; return os; }; } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapImageMappingPerformerRequest.tpp" #endif #endif diff --git a/Code/Core/include/mapImageMappingPerformerRequest.tpp b/Code/Core/include/mapImageMappingPerformerRequest.tpp index aba6cb1..56265a7 100644 --- a/Code/Core/include/mapImageMappingPerformerRequest.tpp +++ b/Code/Core/include/mapImageMappingPerformerRequest.tpp @@ -1,93 +1,93 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_IMAGE_MAPPING_PERFORMER_REQUEST_TPP #define __MAP_IMAGE_MAPPING_PERFORMER_REQUEST_TPP #include "mapImageMappingPerformerRequest.h" namespace map { namespace core { template ImageMappingPerformerRequest:: ImageMappingPerformerRequest(const RegistrationType* pRegistration, const InputDataType* pInputData, const ResultImageDescriptorType* pResultDescriptor, InterpolateBaseType* pInterpolateFunction, bool throwOnMappingError, const ErrorValueType& errorValue, bool throwOnOutOfInputAreaError, PaddingValueType paddingValue): Superclass(pRegistration, pInputData), _spResultDescriptor(pResultDescriptor), _spInterpolateFunction(pInterpolateFunction), _throwOnMappingError(throwOnMappingError), _errorValue(errorValue), _throwOnOutOfInputAreaError(throwOnOutOfInputAreaError), _paddingValue(paddingValue) { assert(pResultDescriptor); assert(pInterpolateFunction); } template ImageMappingPerformerRequest:: ~ImageMappingPerformerRequest() - {} + = default; template ImageMappingPerformerRequest:: ImageMappingPerformerRequest(const ImageMappingPerformerRequest& other): Superclass(other._spRegistration, other._spInputData), _spResultDescriptor(other._spResultDescriptor), _spInterpolateFunction(other._spInterpolateFunction), _throwOnMappingError(other._throwOnMappingError), _errorValue(other._errorValue), _throwOnOutOfInputAreaError(other._throwOnOutOfInputAreaError), _paddingValue(other._paddingValue) { assert(other._spRegistration.IsNotNull()); assert(other._spInputData.IsNotNull()); assert(other._spResultDescriptor.IsNotNull()); assert(other._spInterpolateFunction); } template void ImageMappingPerformerRequest:: operator=(const ImageMappingPerformerRequest& other) { Superclass::_spRegistration = other._spRegistration; Superclass::_spInputData = other._spInputData; _spResultDescriptor = other._spResultDescriptor; _spInterpolateFunction = other._spInterpolateFunction; _throwOnMappingError = other._throwOnMappingError; _errorValue = other._errorValue; _throwOnOutOfInputAreaError = other._throwOnOutOfInputAreaError; _paddingValue = other._paddingValue; assert(Superclass::_spRegistration.IsNotNull()); assert(Superclass::_spInputData.IsNotNull()); assert(_spResultDescriptor.IsNotNull()); assert(_spInterpolateFunction.IsNotNull()); } } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapImageMappingTask.h b/Code/Core/include/mapImageMappingTask.h index 7c6ac9e..3036196 100644 --- a/Code/Core/include/mapImageMappingTask.h +++ b/Code/Core/include/mapImageMappingTask.h @@ -1,203 +1,203 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_IMAGE_MAPPING_TASK_H #define __MAP_IMAGE_MAPPING_TASK_H #include "mapStaticServiceStack.h" #include "mapMappingTaskBase.h" #include "mapImageMappingPerformerBase.h" #include "mapImageMappingPerformerLoadPolicy.h" #include "itkObject.h" namespace map { namespace core { /*! @class ImageMappingTask * @brief Class realizes tasks, that map image data. * * You may set a descriptor for the result image (specifying spacing, image size and origin). * If no external descriptor has been defined, the task will generate one using the input image * as template. * @ingroup MappingTask * @ingroup Registration * @tparam TRegistration the registration class, that should be used to perform the task. * @tparam TInputImage Type of the image in the input space. * @tparam TResultImage Type of the image in the target space. * @tparam TLoadPolicy the load policy that should be used for the provider stack of the point set task. */ template class TLoadPolicy = ImageMappingPerformerLoadPolicy> class ImageMappingTask: public MappingTaskBase { public: /*! Standard class typedefs. */ typedef ImageMappingTask Self; - typedef MappingTaskBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Superclass = MappingTaskBase; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; - typedef typename MappingTaskBase::RegistrationType RegistrationType; - typedef TInputImage InputImageType; - typedef typename InputImageType::ConstPointer InputImageConstPointer; - typedef TResultImage ResultImageType; - typedef typename ResultImageType::Pointer ResultImagePointer; + using RegistrationType = typename MappingTaskBase::RegistrationType; + using InputImageType = TInputImage; + using InputImageConstPointer = typename InputImageType::ConstPointer; + using ResultImageType = TResultImage; + using ResultImagePointer = typename ResultImageType::Pointer; typedef ImageMappingPerformerBase TaskPerformerBaseType; - typedef typename TaskPerformerBaseType::RequestType PerformerRequestType; + using PerformerRequestType = typename TaskPerformerBaseType::RequestType; - typedef typename PerformerRequestType::ErrorValueType ErrorValueType; - typedef typename PerformerRequestType::PaddingValueType PaddingValueType; - typedef typename PerformerRequestType::ResultImageDescriptorType ResultImageDescriptorType; - typedef typename PerformerRequestType::InterpolateBaseType InterpolateBaseType; + using ErrorValueType = typename PerformerRequestType::ErrorValueType; + using PaddingValueType = typename PerformerRequestType::PaddingValueType; + using ResultImageDescriptorType = typename PerformerRequestType::ResultImageDescriptorType; + using InterpolateBaseType = typename PerformerRequestType::InterpolateBaseType; itkTypeMacro(ImageMappingTask, MappingTaskBase); itkNewMacro(Self); #ifdef ITK_USE_CONCEPT_CHECKING /** Begin concept checking */ itkConceptMacro(InputImageFitsRegistrationCheck, (itk::Concept::SameDimension)); itkConceptMacro(ResultImageFitsRegistrationCheck, (itk::Concept::SameDimension)); /** End concept checking */ #endif protected: - typedef TLoadPolicy LoadPolicyType; + using LoadPolicyType = TLoadPolicy; typedef services::ServiceStack ConcreteTaskPerformerStackType; public: - typedef services::StaticServiceStack TaskPerformerStackType; + using TaskPerformerStackType = services::StaticServiceStack; /*! Sets _spInputImage to inputPoints and sets _spResultImage to null. * @param [in] inputPoints The pointer to the input image*/ void setInputImage(const InputImageType* inputImage); const InputImageType* getInputImage() const; /*! Returns _spResultImage. If the smart pointer is null the method will call execute() to * register the input data. * @post _spResultImage is set. * @pre _spInputImage and _spRegistration are not null.*/ - ResultImagePointer getResultImage(void); + ResultImagePointer getResultImage(); /*! Sets the result image descriptor. * @param [in] pDescriptor Pointer to the descriptor. If set to NULL the task will generate one * by using the input image as template.*/ void setResultImageDescriptor(const ResultImageDescriptorType* pDescriptor); - const ResultImageDescriptorType* getResultImageDescriptor(void) const; + const ResultImageDescriptorType* getResultImageDescriptor() const; void setThrowOnMappingError(bool throwOnError); bool getThrowOnMappingError() const; void setErrorValue(const ErrorValueType& value); const ErrorValueType& getErrorValue() const; void setThrowOnPaddingError(bool throwOnError); bool getThrowOnPaddingError() const; void setPaddingValue(const PaddingValueType& value); const PaddingValueType& getPaddingValue() const; void setImageInterpolator(InterpolateBaseType* pInterpolator); const InterpolateBaseType* getImageInterpolator() const; protected: ImageMappingTask(); - virtual ~ImageMappingTask(); + ~ImageMappingTask() override; /*! Smart pointer to the input image*/ InputImageConstPointer _spInputImage; /*! Smart pointer to the result image. Only points to a result * after the task execution (till clearResults)*/ mutable ResultImagePointer _spResultImage; typedef itk::LinearInterpolateImageFunction DefaultInterpolatorType; - typedef typename PerformerRequestType::InterpolateBasePointer InterpolateBasePointer; + using InterpolateBasePointer = typename PerformerRequestType::InterpolateBasePointer; /*! Smart pointer to the interpolator instance that should be used to generate the result image*/ InterpolateBasePointer _spInterpolator; - typedef typename ResultImageDescriptorType::ConstPointer ResultImageDescriptorConstPointer; + using ResultImageDescriptorConstPointer = typename ResultImageDescriptorType::ConstPointer; /*! Smart pointer to the result image descriptor. If it points to NULL when the task is executed * a descriptor will be created by using the input image as template.*/ ResultImageDescriptorConstPointer _spResultDescriptor; /*! Indicates the error handling strategie if the kernel is not sufficient to map a pixel in the image (e.g. point is not inside * the deformation field of a field based kernel). True: an exception will be thrown; false: the pixel marked as incorrect via * setting to _errorValue.*/ bool _throwOnMappingError; /*! Value used to label pixels in the result image that could not be mapped because of an mapping error. * This is only relevant, if _throwOnMappingError is true.*/ ErrorValueType _errorValue; /*! Indicates the error handling strategie if the input image is not sufficient to generate the result image (e.g. parts of the result image * are mapped outside of the input image). True: an exception will be thrown; false: the pixels are marked as incorrect via * setting to _paddingValue.*/ bool _throwOnPaddingError; /*! Value used to label pixels in the result image that could not be set, because they were mapped outside the input image. * This is only relevant, if _throwOnPaddingError is true.*/ PaddingValueType _paddingValue; /*! Performs the mapping of the input image. * If _spResultDescriptor is NULL, it will be generated using the input image. * @eguarantee strong * @pre _inputPoints must have been set. * @post _resultPoints are set. */ - virtual void doExecution(void) const; + void doExecution() const override; /*! Sets _spResultImage to NULL. * @eguarantee strong * @post _resultPoints is NULL. */ - virtual void clearResults(void) const; + void clearResults() const override; /*! clears all input datas of the task used to execute(). * Must be defined for any concrete data performer. * @eguarantee strong */ - virtual void clearInputs(void); + void clearInputs() override; /*! Methods invoked by itk::LightObject::Print(). */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ImageMappingTask(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapImageMappingTask.tpp" #endif #endif diff --git a/Code/Core/include/mapImageMappingTask.tpp b/Code/Core/include/mapImageMappingTask.tpp index 66998ad..edceb5f 100644 --- a/Code/Core/include/mapImageMappingTask.tpp +++ b/Code/Core/include/mapImageMappingTask.tpp @@ -1,298 +1,297 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_IMAGE_MAPPING_TASK_TPP #define __MAP_IMAGE_MAPPING_TASK_TPP #include "mapImageMappingTask.h" #include "mapMissingProviderException.h" #include "itkLinearInterpolateImageFunction.h" namespace map { namespace core { template class TLoadPolicy> void ImageMappingTask:: setInputImage(const InputImageType* inputImage) { if (_spInputImage != inputImage) { _spInputImage = inputImage; clearResults(); this->Modified(); } } template class TLoadPolicy> const typename ImageMappingTask::InputImageType* ImageMappingTask:: getInputImage() const { return _spInputImage; } template class TLoadPolicy> typename ImageMappingTask::ResultImagePointer ImageMappingTask:: - getResultImage(void) + getResultImage() { if (_spResultImage.IsNull()) { this->execute(); } assert(_spResultImage.IsNotNull()); return _spResultImage; } template class TLoadPolicy> void ImageMappingTask:: setResultImageDescriptor(const ResultImageDescriptorType* pDescriptor) { if (_spResultDescriptor != pDescriptor) { _spResultDescriptor = pDescriptor; clearResults(); this->Modified(); } } template class TLoadPolicy> const typename ImageMappingTask::ResultImageDescriptorType* ImageMappingTask:: - getResultImageDescriptor(void) const + getResultImageDescriptor() const { return _spResultDescriptor; } template class TLoadPolicy> void ImageMappingTask:: setImageInterpolator(InterpolateBaseType* pInterpolator) { if (_spInterpolator != pInterpolator) { _spInterpolator = pInterpolator; clearResults(); this->Modified(); } } template class TLoadPolicy> const typename ImageMappingTask::InterpolateBaseType* ImageMappingTask:: - getImageInterpolator(void) const + getImageInterpolator() const { return _spInterpolator; } template class TLoadPolicy> void ImageMappingTask:: setThrowOnMappingError(bool throwOnError) { if (throwOnError != _throwOnMappingError) { _throwOnMappingError = throwOnError; this->Modified(); } }; template class TLoadPolicy> bool ImageMappingTask:: getThrowOnMappingError() const { return _throwOnMappingError; }; template class TLoadPolicy> void ImageMappingTask:: setErrorValue(const ErrorValueType& value) { if (value != _errorValue) { _errorValue = value; this->Modified(); } }; template class TLoadPolicy> const typename ImageMappingTask::ErrorValueType& ImageMappingTask:: getErrorValue() const { return _errorValue; }; template class TLoadPolicy> void ImageMappingTask:: setThrowOnPaddingError(bool throwOnError) { if (throwOnError != _throwOnPaddingError) { _throwOnPaddingError = throwOnError; this->Modified(); } }; template class TLoadPolicy> bool ImageMappingTask:: getThrowOnPaddingError() const { return _throwOnPaddingError; }; template class TLoadPolicy> void ImageMappingTask:: setPaddingValue(const PaddingValueType& value) { if (value != _paddingValue) { _paddingValue = value; this->Modified(); } }; template class TLoadPolicy> const typename ImageMappingTask::PaddingValueType& ImageMappingTask:: getPaddingValue() const { return _paddingValue; }; template class TLoadPolicy> ImageMappingTask:: ImageMappingTask() { _errorValue = itk::NumericTraits::Zero; _paddingValue = itk::NumericTraits::Zero; _throwOnMappingError = true; _throwOnPaddingError = false; - _spResultImage = NULL; - _spInputImage = NULL; - _spResultDescriptor = NULL; + _spResultImage = nullptr; + _spInputImage = nullptr; + _spResultDescriptor = nullptr; _spInterpolator = DefaultInterpolatorType::New(); } template class TLoadPolicy> ImageMappingTask:: ~ImageMappingTask() - { - } + = default; template class TLoadPolicy> void ImageMappingTask:: - doExecution(void) const + doExecution() const { if (_spInputImage.IsNull()) { mapExceptionMacro(ServiceException, << "Cannot register input image. Input image is null."); } if (_spInterpolator.IsNull()) { mapExceptionMacro(ServiceException, << "Cannot register input image. Interpolator is null."); } typename ResultImageDescriptorType::ConstPointer spCurrentDescriptor = _spResultDescriptor; if (spCurrentDescriptor.IsNull()) { //generate default discriptor by using input image spCurrentDescriptor = createFieldRepresentation(*_spInputImage); } PerformerRequestType request(Superclass::_spRegistration, _spInputImage, spCurrentDescriptor, _spInterpolator, _throwOnMappingError, _errorValue, _throwOnPaddingError, _paddingValue); mapLogInfoMacro( << "Register image. Request: " << request); TaskPerformerBaseType* pPerformer = TaskPerformerStackType::getProvider(request); if (!pPerformer) { mapExceptionMacro(MissingProviderException, << "No responsible registration performer available for given request. Request:" << request); } _spResultImage = pPerformer->performMapping(request); assert(_spResultImage.IsNotNull()); } template class TLoadPolicy> void ImageMappingTask:: - clearResults(void) const + clearResults() const { _spResultImage = NULL; } template class TLoadPolicy> void ImageMappingTask:: - clearInputs(void) + clearInputs() { _spInputImage = NULL; } template class TLoadPolicy> void ImageMappingTask:: PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "InputImage: " << _spInputImage.GetPointer() << std::endl; os << indent << "ResultImage: " << _spResultImage.GetPointer() << std::endl; os << indent << "ResultDescriptor: " << _spResultDescriptor.GetPointer() << std::endl; os << indent << "Interpolator: " << _spInterpolator.GetPointer() << std::endl; os << indent << "ThrowOnMappingError: " << _throwOnMappingError << std::endl; os << indent << "ErrorValue: " << _errorValue << std::endl; os << indent << "ThrowOnPaddingError: " << _throwOnPaddingError << std::endl; os << indent << "PaddingValue: " << _paddingValue << std::endl; } } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapInverseRegistrationKernelGenerator.h b/Code/Core/include/mapInverseRegistrationKernelGenerator.h index c1d6625..c233d66 100644 --- a/Code/Core/include/mapInverseRegistrationKernelGenerator.h +++ b/Code/Core/include/mapInverseRegistrationKernelGenerator.h @@ -1,145 +1,145 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_INVERSE_REGISTRATION_KERNEL_GENERATOR_H #define __MAP_INVERSE_REGISTRATION_KERNEL_GENERATOR_H #include "mapStaticServiceStack.h" #include "mapRegistrationKernelInverterBase.h" #include "mapKernelInverterLoadPolicy.h" #include "itkObject.h" namespace map { namespace core { /*! @class InverseRegistrationKernelGenerator * @brief Class generates inverse kernels for a passed registration kernel. * * This class is used by registration algorithms to establish the inverse counterpart * of the registration kernel determined by the algorithm, thus to establish a fully * functional Registration instance.\n * To invert the kernel the class uses a static service stack populated with * RegistrationKernelInverters. You can change the stack content by the static * class methods of the member typedef InverterStackType. * * @ingroup RegOperation * @tparam VInputDimensions Dimensions of the input space of the kernel that should be inverted. * @tparam VOutputDimensions Dimensions of the output space of the kernel that should be inverted. */ template class InverseRegistrationKernelGenerator: public itk::Object { public: /*! Standard class typedefs. */ typedef InverseRegistrationKernelGenerator Self; - typedef itk::Object Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Superclass = itk::Object; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(InverseRegistrationKernelGenerator, itk::Object); itkNewMacro(Self); typedef RegistrationKernelInverterBase InverterBaseType; - typedef typename InverterBaseType::KernelBaseType KernelBaseType; - typedef typename KernelBaseType::Pointer KernelBasePointer; - typedef typename InverterBaseType::InverseKernelBaseType InverseKernelBaseType; - typedef typename InverseKernelBaseType::Pointer InverseKernelBasePointer; + using KernelBaseType = typename InverterBaseType::KernelBaseType; + using KernelBasePointer = typename KernelBaseType::Pointer; + using InverseKernelBaseType = typename InverterBaseType::InverseKernelBaseType; + using InverseKernelBasePointer = typename InverseKernelBaseType::Pointer; - typedef typename InverterBaseType::FieldRepresentationType FieldRepresentationType; - typedef typename InverterBaseType::InverseFieldRepresentationType InverseFieldRepresentationType; + using FieldRepresentationType = typename InverterBaseType::FieldRepresentationType; + using InverseFieldRepresentationType = typename InverterBaseType::InverseFieldRepresentationType; - typedef typename InverseKernelBaseType::OutputPointType NullPointType; + using NullPointType = typename InverseKernelBaseType::OutputPointType; protected: typedef services::ServiceStack > ConcreteInverterStackType; public: - typedef services::StaticServiceStack InverterStackType; + using InverterStackType = services::StaticServiceStack; /*! Generates an inverse kernel by requesting a responsible service provider from InverterStackType. * Returns a smart pointer to an inverted version of the kernel. * @eguarantee strong * @param [in] request reference to the kernel that should be inverted * @param [in] pInverseFieldRepresentation Pointer to the field representation of the input space of the inverse kernel. * @return Smart pointer to the inverse kernel. * @pre The inverter service provider may require one or both field representations, depending on the kernel. * e.g. if the kernel cannot be inverted analytically the inverse field representation descriptor is * needed in order to generate a proper field for the inverse kernel. * To avoid any exceptions always provide the field representation descriptors unless you are sure they * won't be needed. * @post If the method returns with no exception, there is always an inverse kernel (smart pointer is not NULL) * @remark This function calls the protected overload version. It assumes that the largest possible representation of kernel * can be used as pFieldRepresentation.\n This function might cause an exception/assertion if the responsible service provider needs * a missing field representation descriptor. Also if no suitable provider is available an exception will be thrown. */ InverseKernelBasePointer generateInverse(const KernelBaseType& kernel, const InverseFieldRepresentationType* pInverseFieldRepresentation) const; mapSetVarMacro(NullPoint, NullPointType, _nullPoint); mapGetConstVarMacro(NullPoint, NullPointType, _nullPoint); mapSetVarMacro(NullPointUsage, bool, _useNullPoint); mapGetConstVarMacro(NullPointUsage, bool, _useNullPoint); protected: /*! Generates an inverse kernel by requesting a responsible service provider from InverterStackType. * Returns a smart pointer to an inverted version of the kernel. * @eguarantee strong * @param [in] request Reference to the kernel that should be inverted * @param [in] pFieldRepresentation Pointer to the field representation of the input space of the kernel that should be inverted. * @param [in] pInverseFieldRepresentation Pointer to the field representation of the input space of the inverse kernel. * @return Smart pointer to the inverse kernel. * @pre The inverter service provider may require one or both field representations, depending on the kernel. * e.g. if the kernel cannot be inverted analytically the inverse field representation descriptor is * needed in order to generate a proper field for the inverse kernel. * To avoid any exceptions always provide the field representation descriptors unless you are sure they * won't be needed. * @todo It should be rechecked if this version is really needed or if the explicit passing of pFieldRepresentation is * unnecessary because the kernel can offer a largest possible representation description of the same space. * @post If the method returns with no exception, there is always an inverse kernel (smart pointer is not NULL) * @remark This function might cause an exception/assertion if the responsible service provider needs * a missing field representation descriptor. Also if no suitable provider is available an exception will be thrown. */ InverseKernelBasePointer generateInverse(const KernelBaseType& kernel, const FieldRepresentationType* pFieldRepresentation, const InverseFieldRepresentationType* pInverseFieldRepresentation) const; InverseRegistrationKernelGenerator(); - virtual ~InverseRegistrationKernelGenerator(); + ~InverseRegistrationKernelGenerator() override; NullPointType _nullPoint; bool _useNullPoint; private: InverseRegistrationKernelGenerator(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapInverseRegistrationKernelGenerator.tpp" #endif #endif diff --git a/Code/Core/include/mapInvertingRegistrationKernel.h b/Code/Core/include/mapInvertingRegistrationKernel.h index 1bcae0d..5b1491d 100644 --- a/Code/Core/include/mapInvertingRegistrationKernel.h +++ b/Code/Core/include/mapInvertingRegistrationKernel.h @@ -1,92 +1,91 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __INVERTING_FIELD_BASED_REGISTRATION_KERNEL_H #define __INVERTING_FIELD_BASED_REGISTRATION_KERNEL_H #include "mapLazyRegistrationKernel.h" #include "mapClassMacros.h" namespace map { namespace core { /*!@brief InvertingRegistrationKernel is a special implementation of a lazy field based registration kernel. * This implementation is used to indicated that an other kernel is inverted and to give the posibility to check which * kernel will be inverted. It is used amongst other by the DefaultKernelInverter and optimized field kernel file I/O. * @ingroup RegKernel */ template class InvertingRegistrationKernel : public LazyRegistrationKernel { public: typedef InvertingRegistrationKernel Self; typedef LazyRegistrationKernel Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(InvertingRegistrationKernel, ConcreteFieldBasedRegistrationKernel); itkNewMacro(Self); - typedef typename Superclass::RepresentationDescriptorType RepresentationDescriptorType; - typedef typename Superclass::RepresentationDescriptorPointer RepresentationDescriptorPointer; - typedef typename Superclass::RepresentationDescriptorConstPointer - RepresentationDescriptorConstPointer; - typedef typename Superclass::InputPointType InputPointType; - typedef typename Superclass::OutputPointType OutputPointType; + using RepresentationDescriptorType = typename Superclass::RepresentationDescriptorType; + using RepresentationDescriptorPointer = typename Superclass::RepresentationDescriptorPointer; + using RepresentationDescriptorConstPointer = typename Superclass::RepresentationDescriptorConstPointer; + using InputPointType = typename Superclass::InputPointType; + using OutputPointType = typename Superclass::OutputPointType; typedef RegistrationKernelBase SourceKernelType; - typedef typename SourceKernelType::ConstPointer SourceKernelConstPointer; + using SourceKernelConstPointer = typename SourceKernelType::ConstPointer; mapSetConstObjectMacro(SourceKernel, SourceKernelType); mapGetConstObjectMacro(SourceKernel, SourceKernelType); protected: SourceKernelConstPointer _SourceKernel; InvertingRegistrationKernel(); virtual ~InvertingRegistrationKernel(); /*! Methods invoked by itk::LightObject::Print(). */ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; private: //No copy constructor allowed InvertingRegistrationKernel(const Self& source); void operator=(const Self&); //purposely not implemented }; - } -} + } // namespace core +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapInvertingRegistrationKernel.tpp" #endif #endif diff --git a/Code/Core/include/mapKernelCombinatorLoadPolicy.h b/Code/Core/include/mapKernelCombinatorLoadPolicy.h index b5dc9fa..fb24355 100644 --- a/Code/Core/include/mapKernelCombinatorLoadPolicy.h +++ b/Code/Core/include/mapKernelCombinatorLoadPolicy.h @@ -1,73 +1,73 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_KERNEL_COMBINATOR_LOAD_POLICY_H #define __MAP_KERNEL_COMBINATOR_LOAD_POLICY_H # include "mapGenericStaticLoadPolicyBase.h" namespace map { namespace core { /*! @class KernelCombinatorLoadPolicy * @brief Load class used by RegistrationCombinator to populate its service stack. * * It loads the following providers: * - LazyRegistrationKernelCombinator * - PreChachedRegistrationKernelCombinator * - NullRegistrationKernelCombinator * * @ingroup LoadPolicies * @ingroup RegOperation * @sa RegistrationCombinator * @tparam TProviderBase Base class of the service providers loaded by the policy. */ template class KernelCombinatorLoadPolicy : public services::GenericStaticLoadPolicyBase { protected: /*! Standard class typedefs. */ - typedef services::GenericStaticLoadPolicyBase Superclass; - typedef typename Superclass::ProviderBaseType ProviderBaseType; - typedef typename Superclass::ProviderBasePointer ProviderBasePointer; - typedef typename Superclass::LoadInterfaceType LoadInterfaceType; + using Superclass = services::GenericStaticLoadPolicyBase; + using ProviderBaseType = typename Superclass::ProviderBaseType; + using ProviderBasePointer = typename Superclass::ProviderBasePointer; + using LoadInterfaceType = typename Superclass::LoadInterfaceType; - virtual void doLoading(); + void doLoading() override; KernelCombinatorLoadPolicy(); ~KernelCombinatorLoadPolicy(); private: - KernelCombinatorLoadPolicy(const KernelCombinatorLoadPolicy&); //purposely not implemented - void operator=(const KernelCombinatorLoadPolicy&); //purposely not implemented + KernelCombinatorLoadPolicy(const KernelCombinatorLoadPolicy&) = delete; //purposely not implemented + void operator=(const KernelCombinatorLoadPolicy&) = delete; //purposely not implemented }; } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapKernelCombinatorLoadPolicy.tpp" #endif #endif diff --git a/Code/Core/include/mapKernelCombinatorLoadPolicy.tpp b/Code/Core/include/mapKernelCombinatorLoadPolicy.tpp index b5ad541..b7c1116 100644 --- a/Code/Core/include/mapKernelCombinatorLoadPolicy.tpp +++ b/Code/Core/include/mapKernelCombinatorLoadPolicy.tpp @@ -1,88 +1,88 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_KERNEL_COMBINATOR_LOAD_POLICY_TPP #define __MAP_KERNEL_COMBINATOR_LOAD_POLICY_TPP #include "mapKernelCombinatorLoadPolicy.h" #include "mapPreCachedKernelCombinator.h" #include "mapLazyFieldKernelCombinator.h" #include "mapNullRegistrationKernelCombinator.h" #include "mapServiceRepositoryPolicyLoadInterface.h" namespace map { namespace core { template void KernelCombinatorLoadPolicy:: doLoading() { typedef PreCachedKernelCombinator PreCachedKernelCombinatorType; typedef LazyFieldKernelCombinator LazyFieldKernelCombinatorType; typedef NullRegistrationKernelCombinator NullRegistrationKernelCombinatorType; typename PreCachedKernelCombinatorType::Pointer spPreCachedCombinator = PreCachedKernelCombinatorType::New(); typename LazyFieldKernelCombinatorType::Pointer spLazyFieldCombinator = LazyFieldKernelCombinatorType::New(); typename NullRegistrationKernelCombinatorType::Pointer spNullCombinator = NullRegistrationKernelCombinatorType::New(); services::ServiceRepositoryPolicyLoader loader(Superclass::_pLoadInterface); if (!loader.addProviderByPolicy(spLazyFieldCombinator)) { mapLogWarningObjMacro("ModelModelKernelCombinator was not added because it was already on the service stack!"); } if (!loader.addProviderByPolicy(spPreCachedCombinator)) { mapLogWarningObjMacro("FieldModelKernelCombinator was not added because it was already on the service stack!"); } if (!loader.addProviderByPolicy(spNullCombinator)) { mapLogWarningObjMacro("NullRegistationKernelCombinator was not added because it was already on the service stack!"); } } template KernelCombinatorLoadPolicy:: KernelCombinatorLoadPolicy() - { } + = default; template KernelCombinatorLoadPolicy:: ~KernelCombinatorLoadPolicy() - { } + = default; } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapKernelInverterLoadPolicy.h b/Code/Core/include/mapKernelInverterLoadPolicy.h index 4fcdd54..fd4505b 100644 --- a/Code/Core/include/mapKernelInverterLoadPolicy.h +++ b/Code/Core/include/mapKernelInverterLoadPolicy.h @@ -1,76 +1,76 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_INVERTER_LOAD_POLICY_H #define __MAP_INVERTER_LOAD_POLICY_H #include "mapGenericStaticLoadPolicyBase.h" #include "mapRegistrationKernelInverterBase.h" namespace map { namespace core { /*! @class KernelInverterLoadPolicy * @brief Load class used by InverseRegistrationKernelGenrator to populate its service stack. * * It loads the following providers: * - ModelBasedKernelInverter * - FieldBasedKernelInverter * - NullRegistrationKernelInverter * . * * @ingroup LoadPolicies * @ingroup RegOperation * @sa InverseRegistrationKernelGenrator * @tparam TProviderBase Base class of the service providers loaded by the policy. */ template class KernelInverterLoadPolicy : public services::GenericStaticLoadPolicyBase > { protected: /*! Standard class typedefs. */ typedef services::GenericStaticLoadPolicyBase< RegistrationKernelInverterBase > Superclass; - typedef typename Superclass::ProviderBaseType ProviderBaseType; - typedef typename Superclass::ProviderBasePointer ProviderBasePointer; - typedef typename Superclass::LoadInterfaceType LoadInterfaceType; + using ProviderBaseType = typename Superclass::ProviderBaseType; + using ProviderBasePointer = typename Superclass::ProviderBasePointer; + using LoadInterfaceType = typename Superclass::LoadInterfaceType; virtual void doLoading(); KernelInverterLoadPolicy(); ~KernelInverterLoadPolicy(); private: KernelInverterLoadPolicy(const KernelInverterLoadPolicy&); //purposely not implemented void operator=(const KernelInverterLoadPolicy&); //purposely not implemented }; } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapKernelInverterLoadPolicy.tpp" #endif #endif diff --git a/Code/Core/include/mapLazyFieldKernelCombinator.h b/Code/Core/include/mapLazyFieldKernelCombinator.h index 20a7bd6..c0a9ce3 100644 --- a/Code/Core/include/mapLazyFieldKernelCombinator.h +++ b/Code/Core/include/mapLazyFieldKernelCombinator.h @@ -1,134 +1,134 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_LAZY_FIELD_KERNEL_COMBINATOR_H #define __MAP_LAZY_FIELD_KERNEL_COMBINATOR_H #include "mapRegistrationKernelCombinatorBase.h" #include "mapLazyRegistrationKernel.h" namespace map { namespace core { /*! @class LazyFieldKernelCombinator * @brief Combinator class that combines two kernels (lazy or precached) to a new lazy kernel. * * @ingroup RegOperation * @tparam VInputDimensions Dimensions of the input space of the first kernel. * @tparam VInterimDimensions Dimensions of the output space of the first kernel and the input space of the second. * @tparam VOutputDimensions Dimensions of the output space of the second kernel. */ template class LazyFieldKernelCombinator : public RegistrationKernelCombinatorBase< VInputDimensions, VInterimDimensions, VOutputDimensions > { public: /*! Standard class typedefs. */ typedef LazyFieldKernelCombinator< VInputDimensions, VInterimDimensions, VOutputDimensions > Self; typedef RegistrationKernelCombinatorBase< VInputDimensions, VInterimDimensions, VOutputDimensions > Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; - typedef typename Superclass::Kernel1BaseType Kernel1BaseType; - typedef typename Superclass::Kernel1BasePointer Kernel1BasePointer; - typedef typename Superclass::Kernel2BaseType Kernel2BaseType; - typedef typename Superclass::Kernel2BasePointer Kernel2BasePointer; + using Kernel1BaseType = typename Superclass::Kernel1BaseType; + using Kernel1BasePointer = typename Superclass::Kernel1BasePointer; + using Kernel2BaseType = typename Superclass::Kernel2BaseType; + using Kernel2BasePointer = typename Superclass::Kernel2BasePointer; - typedef typename Superclass::CombinedKernelBaseType CombinedKernelBaseType; - typedef typename Superclass::CombinedKernelBasePointer CombinedKernelBasePointer; + using CombinedKernelBaseType = typename Superclass::CombinedKernelBaseType; + using CombinedKernelBasePointer = typename Superclass::CombinedKernelBasePointer; - typedef typename Superclass::RequestType RequestType; + using RequestType = typename Superclass::RequestType; - typedef typename Superclass::InputFieldRepresentationType InputFieldRepresentationType; - typedef typename Superclass::InterimFieldRepresentationType InterimFieldRepresentationType; + using InputFieldRepresentationType = typename Superclass::InputFieldRepresentationType; + using InterimFieldRepresentationType = typename Superclass::InterimFieldRepresentationType; - typedef typename Superclass::PaddingVectorType PaddingVectorType; + using PaddingVectorType = typename Superclass::PaddingVectorType; typedef RegistrationKernel Kernel1Type; - typedef typename Kernel1Type::Pointer Kernel1Pointer; + using Kernel1Pointer = typename Kernel1Type::Pointer; typedef RegistrationKernel Kernel2Type; - typedef typename Kernel2Type::Pointer Kernel2Pointer; + using Kernel2Pointer = typename Kernel2Type::Pointer; itkTypeMacro(LazyFieldKernelCombinator, RegistrationKernelCombinatorBase); itkNewMacro(Self); /*! Combines two kernel. * Returns a smpart pointer to an kernel that realizes the combination of two registration kernel. * @eguarantee strong * @param [in] request Referenz to the request that contains the both kernels that should be combined * @param [in] pInputFieldRepresentation Pointer to the field representation of the input space of the combined kernel; may not be null. * @param [in] usePadding Indicicates how the recombinator and its functor should handel points that cannot be mapped * through both kernels (e.g. a point that is mapped by the first kernel outside of the supported region of the second * registration kernel). If the _usePadding is true, _paddingVector will be used as padding value in each of the mentioned * cases. If _usePadding value is false, than the combinator will throw an RepresentationException. * @param [in] paddingVector Vector that should be used for padding, if usePadding is true. * @return Smart pointer to the inverse kernel. * @pre input representation must be coverd by the first kernel and the mapped input representation must be covered by the input * representation of the second kernel. * @pre pInputFieldRepresentation must be set and not NULL. */ - virtual CombinedKernelBasePointer combineKernels(const RequestType& request, + CombinedKernelBasePointer combineKernels(const RequestType& request, const InputFieldRepresentationType* pInputFieldRepresentation, bool usePadding = false, - const PaddingVectorType& paddingVector = PaddingVectorType(0.0)) const; + const PaddingVectorType& paddingVector = PaddingVectorType(0.0)) const override; /*! Uses the passed request data to check if the provider is able to provide the service for * this request. * @return Indicates if the provider offers the right solution. * @retval true Provider can handle the request. * @retval false Provider is not able to handle the request.*/ - virtual bool canHandleRequest(const RequestType& request) const; + bool canHandleRequest(const RequestType& request) const override; /*! Returns an ID of the provider as string. Calls getStaticProviderName(). * @return Service provider ID.*/ - virtual String getProviderName() const; + String getProviderName() const override; /*! Returns an ID of the provider as string. * @return Service provider ID.*/ static String getStaticProviderName() ; /*! Returns an ID of the provider as string. May be equal to GetClassName(), but it may differ. * @return Service provider ID. * @remark It is a return by value, becaus it might be possible that the description is generated on line * when calling this method.*/ - virtual String getDescription() const; + String getDescription() const override; protected: LazyFieldKernelCombinator() {}; - virtual ~LazyFieldKernelCombinator() {}; + ~LazyFieldKernelCombinator() override {}; private: LazyFieldKernelCombinator(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapLazyFieldKernelCombinator.tpp" #endif #endif diff --git a/Code/Core/include/mapLazyRegistrationKernel.h b/Code/Core/include/mapLazyRegistrationKernel.h index 6094a96..0e80c76 100644 --- a/Code/Core/include/mapLazyRegistrationKernel.h +++ b/Code/Core/include/mapLazyRegistrationKernel.h @@ -1,150 +1,149 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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: 1285 $ (last changed revision) // @date $Date: 2016-03-30 17:47:52 +0200 (Mi, 30 Mrz 2016) $ (last change date) // @author $Author: floca $ (last changed by) // Subversion HeadURL: $HeadURL: https://svn/sbr/Sources/SBR-Projects/MatchPoint/branches/Issue-1505/Code/Core/include/mapRegistrationKernel.h $ */ #ifndef __LAZY_REGISTRATION_KERNEL_H #define __LAZY_REGISTRATION_KERNEL_H #include "mapRegistrationKernel.h" #include "mapLazyRegistrationKernelInterface.h" #include "itkSimpleFastMutexLock.h" /*! @namespace map The namespace map::core is for the library of MatchPoint */ namespace map { namespace core { /*! This class is the implementation of a lazy kernel. The lazy kernel * establishes its internal transformation when it is needed the first time * on the fly by using its generation functor. * @ingroup RegKernel */ template class LazyRegistrationKernel : public RegistrationKernel, public LazyRegistrationKernelInterface < VInputDimensions, VOutputDimensions > { public: typedef LazyRegistrationKernel Self; typedef RegistrationKernel Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkNewMacro(Self); itkTypeMacro(LazyRegistrationKernel, RegistrationKernel); - typedef typename Superclass::TransformType TransformType; - typedef typename Superclass::RepresentationDescriptorType RepresentationDescriptorType; - typedef typename Superclass::RepresentationDescriptorPointer RepresentationDescriptorPointer; - typedef typename Superclass::RepresentationDescriptorConstPointer - RepresentationDescriptorConstPointer; - typedef typename Superclass::InputPointType InputPointType; - typedef typename Superclass::OutputPointType OutputPointType; - typedef typename Superclass::MappingVectorType MappingVectorType; + using TransformType = typename Superclass::TransformType; + using RepresentationDescriptorType = typename Superclass::RepresentationDescriptorType; + using RepresentationDescriptorPointer = typename Superclass::RepresentationDescriptorPointer; + using RepresentationDescriptorConstPointer = typename Superclass::RepresentationDescriptorConstPointer; + using InputPointType = typename Superclass::InputPointType; + using OutputPointType = typename Superclass::OutputPointType; + using MappingVectorType = typename Superclass::MappingVectorType; typedef functors::TransformGenerationFunctor < VInputDimensions, VOutputDimensions > TransformGenerationFunctorType; - typedef typename TransformGenerationFunctorType::ConstPointer TransformGenerationFunctorConstPointer; + using TransformGenerationFunctorConstPointer = typename TransformGenerationFunctorType::ConstPointer; /*! sets the field's functor @eguarantee no fail @param functor Pointer to the functor that is responsible for generating the field @pre functor must point to a valid instance. */ - virtual void setTransformFunctor(const TransformGenerationFunctorType* functor) override; + void setTransformFunctor(const TransformGenerationFunctorType* functor) override; /*! gets the field's functor @eguarantee no fail @return Pointer to the field functor that is used to generate the field on demand. */ - virtual const TransformGenerationFunctorType* getTransformFunctor() const override; + const TransformGenerationFunctorType* getTransformFunctor() const override; /*! Returns if the transform was already created (true) or if the generation still is pending / wasn't necessary (false). @eguarantee strong */ - virtual bool transformExists() const override; + bool transformExists() const override; /*! @brief gets the largest possible representation descriptor. The descriptor defines * the space the kernel guarantees to map. * @return Smart pointer to the descriptor (may be generated dynamicaly) * @retval NULL there is no descriptor. If hasLimitedRepresentation returns false, the kernel * has no mapping limitations and covers the total input space. * @eguarantee strong */ - virtual RepresentationDescriptorConstPointer getLargestPossibleRepresentation() const override; + RepresentationDescriptorConstPointer getLargestPossibleRepresentation() const override; /*! Returns pointer to the transform model used by the kernel @eguarantee strong @return const pointer to the internal tranform model */ - virtual const TransformType* getTransformModel() const override; + const TransformType* getTransformModel() const override; - virtual const OutputPointType getNullPoint() const override; + const OutputPointType getNullPoint() const override; - virtual bool usesNullPoint() const override; + bool usesNullPoint() const override; protected: LazyRegistrationKernel(); virtual ~LazyRegistrationKernel(); - typedef typename TransformType::Pointer TransformPointer; + using TransformPointer = typename TransformType::Pointer; //is mutable because it is a cache for the functor result, thus it may be changed by checkAndPrepareTransform() mutable TransformPointer _spTransform; TransformGenerationFunctorConstPointer _spGenerationFunctor; /*! checks the transform that has been set for correctness and prepares it to be used @eguarantee strong @return the success of the operation */ bool checkAndPrepareTransform() const override; /*! Methods invoked by itk::LightObject::Print(). */ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; /** @reimplementation Reimplementation of the itk::LightObject::InternalClone*/ virtual ::itk::LightObject::Pointer InternalClone() const; private: - typedef ::itk::SimpleFastMutexLock MutexType; + using MutexType = ::itk::SimpleFastMutexLock; /*!Mutex to make the checks of the policy thread safe*/ mutable MutexType _checkMutex; /*!Mutex to make the generation of the fields thread safe and to avoid paralel * generation of fields because of a racing condition of two checkAndPrepare calls*/ mutable MutexType _generateMutex; //No copy constructor allowed LazyRegistrationKernel(const Self& source); void operator=(const Self&); //purposely not implemented }; - } -} + } // namespace core +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapLazyRegistrationKernel.tpp" #endif #endif diff --git a/Code/Core/include/mapLazyRegistrationKernelInterface.h b/Code/Core/include/mapLazyRegistrationKernelInterface.h index 7d9aaa6..703282f 100644 --- a/Code/Core/include/mapLazyRegistrationKernelInterface.h +++ b/Code/Core/include/mapLazyRegistrationKernelInterface.h @@ -1,81 +1,81 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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: 1285 $ (last changed revision) // @date $Date: 2016-03-30 17:47:52 +0200 (Mi, 30 Mrz 2016) $ (last change date) // @author $Author: floca $ (last changed by) // Subversion HeadURL: $HeadURL: https://svn/sbr/Sources/SBR-Projects/MatchPoint/branches/Issue-1505/Code/Core/include/mapLazyRegistrationKernelInterface.h $ */ #ifndef __LAZY_REGISTRATION_KERNEL_INTERFACE_H #define __LAZY_REGISTRATION_KERNEL_INTERFACE_H #include "mapRegistrationTopology.h" #include "mapTransformGenerationFunctor.h" namespace map { namespace core { /*! @class LazyRegistrationKernelInterface @brief class for LazyRegistrationKernelInterface. This class is the class for the LazyRegistrationKernelInterface. */ template class LazyRegistrationKernelInterface { public: typedef typename RegistrationTopology::DirectTransformType TransformType; typedef typename RegistrationTopology::DirectMappingVectorType MappingVectorType; typedef functors::TransformGenerationFunctor TransformGenerationFunctorType; - typedef typename TransformGenerationFunctorType::ConstPointer TransformGenerationFunctorConstPointer; + using TransformGenerationFunctorConstPointer = typename TransformGenerationFunctorType::ConstPointer; /*! sets the field's functor @eguarantee no fail @param functor Pointer to the functor that is responsible for generating the field @pre functor must point to a valid instance. */ virtual void setTransformFunctor(const TransformGenerationFunctorType* functor) = 0; /*! gets the field's functor @eguarantee no fail @return Pointer to the field functor that is used to generate the field on demand. */ virtual const TransformGenerationFunctorType* getTransformFunctor() const = 0; protected: LazyRegistrationKernelInterface() {}; ~LazyRegistrationKernelInterface() {}; private: //No copy constructor allowed LazyRegistrationKernelInterface(const LazyRegistrationKernelInterface&); void operator=(const LazyRegistrationKernelInterface&); //purposely not implemented }; - } -} + } // namespace core +} // namespace map #endif diff --git a/Code/Core/include/mapLogbook.h b/Code/Core/include/mapLogbook.h index 55ec7c5..5c8e539 100644 --- a/Code/Core/include/mapLogbook.h +++ b/Code/Core/include/mapLogbook.h @@ -1,207 +1,207 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_LOGBOOK_H #define __MAP_LOGBOOK_H #include "itkLoggerBase.h" #include "itkLoggerOutput.h" #include "itkSimpleFastMutexLock.h" #include "mapXMLLogger.h" #include "mapString.h" #include "mapSyncObject.h" #include "mapMacros.h" #include "mapMAPCoreExports.h" namespace map { namespace core { //forward declarations class LogbookImplementation; /*! @class Logbook * @brief Helper class for centralized logging. * * This class offers a logger as singeltons and a centralized access to its * logging functionality. This class is used within MatchPoint for default logging purposes. By * default the logging will be saved in a xml file (matchpoint.log in the current working directory). * The file may be changed any time, also you may add additional outputs. You can also deactivate the * default file output by setting the default log output file to an empty string. * @ingroup Logging */ class MAPCore_EXPORT Logbook { public: - typedef itk::LoggerBase::OutputType OutputType; - typedef itk::LoggerBase::PriorityLevelType PriorityLevelType;; + using OutputType = itk::LoggerBase::OutputType; + using PriorityLevelType = itk::LoggerBase::PriorityLevelType; /*! Passes the content to normal and error logger. * @eguarantee strong*/ static void write(PriorityLevelType level, const String& content); /*! Helper methods: Passes the content to normal and error logger with priority level "debug". */ static void debug(const String& message) { if (_currentPriorityLevel == itk::LoggerBase::DEBUG) { //only call the function and "risk" singelton checking and managing overhead //if the message will be logged anyway. write(itk::LoggerBase::DEBUG, message); } } /*! Helper methods: Passes the content to normal and error logger with priority level "info". */ static void info(const String& message) { if (_currentPriorityLevel != itk::LoggerBase::CRITICAL) { //only call the function and "risk" singelton checking and managing overhead //if the message will be logged anyway. write(itk::LoggerBase::INFO, message); } } /*! Helper methods: Passes the content to normal and error logger with priority level "warning". */ static void warning(const String& message) { if (_currentPriorityLevel != itk::LoggerBase::CRITICAL) { //only call the function and "risk" singelton checking and managing overhead //if the message will be logged anyway. write(itk::LoggerBase::WARNING, message); } } /*! Helper methods: Passes the content to normal and error logger with priority level "critical". */ static void critical(const String& message) { write(itk::LoggerBase::CRITICAL, message); } /*! Helper methods: Passes the content to normal and error logger with priority level "critical". */ static void error(const String& message) { write(itk::LoggerBase::CRITICAL, message); } /*! Helper methods: Passes the content to normal and error logger with priority level "fatal". */ static void fatal(const String& message) { write(itk::LoggerBase::FATAL, message); } /*! Flushes both loggers. */ static void flush(); /*! opens file stream to the new file. If it succeeds the the current default file stream will be closed and exchanged. * You can deactivate the default log out put by passing an empty string. * @eguarantee strong*/ static void setDefaultLogFileName(const String& fileName); /*! adds additional log outputs to the logbook. * @eguarantee strong * @pre pOuput must not be a NULL pointer.*/ static void addAdditionalLogOutput(OutputType* pOutput); /*! Attaches the central itk output window to the MatchPoint logging, by setting the OutputWindow to * a LoggerOutput using _spLogger.*/ static void attachITKOutputWindow(); /*!@eguarantee strong*/ - static PriorityLevelType getLogbookMode(void); + static PriorityLevelType getLogbookMode(); /*! Calls sets _currentPriorityLevel and _spLogger PriorityLevel to itk::LoggerBase::DEBUG. Thus everything will be logged.*/ - static void setLogbookToDebugMode(void); + static void setLogbookToDebugMode(); /*! Calls sets _currentPriorityLevel and _spLogger PriorityLevel to itk::LoggerBase::INFO. Thus everything will be logged except of debug infos.*/ - static void setLogbookToInfoMode(void); + static void setLogbookToInfoMode(); /*! Calls sets _currentPriorityLevel and _spLogger PriorityLevel to itk::LoggerBase::CRITICAL. Thus only criticals, errors and fatals will be logged.*/ - static void setLogbookToCriticalMode(void); + static void setLogbookToCriticalMode(); /*! Calls sets _currentPriorityLevel and _spLogger PriorityLevel to the passed level. * @remark The logbook must not be in deprecated sync mode. The mode can only be changed * by the host or in standalone logbooks. * @pre The logbook must not be in deprecated sync mode.*/ static void setLogbookMode(PriorityLevelType level); /*! Returns true if there is an valid pointer to a logbook implementation. Returns false if the * logbook wasn't used yet and isn't initialized. * @eguarantee no fail*/ - static bool isInitialized(void); + static bool isInitialized(); /** This function is called to add all information to pSyncObject * that are needed to performe a synchronisation of an other instance*/ static void getSynchronization(deployment::SyncObject& pSyncObject); /** This function is called to synchronize the instance with * the information of pSyncObject.*/ static void setSynchronization(const deployment::SyncObject& pSyncObject); /** This function is called to desynchronize the instance.*/ static void deSynchronize(); protected: /*! Creates the implementation singelton if it doesn't exist.*/ - static void initializeLogger(void); + static void initializeLogger(); /*!changes the own logbook implmentation with the passed one. * The exchange is secured by the mutex. * @eguarantee strong * @pre pImpl must be a valid pointer to an implmentation. * @param [in,out] pImpl Pointer to the new implementation.*/ static void swapImplementations(LogbookImplementation* pImpl); - typedef itk::SmartPointer LogImplPointer; + using LogImplPointer = itk::SmartPointer; static LogImplPointer _spLoggerImpl; static itk::SimpleFastMutexLock _testMutex; static itk::SimpleFastMutexLock _initMutex; /*! Indicates of the logbook is on its "own" or synced with an other host * logbook */ static bool _syncedAsDedicated; static PriorityLevelType _currentPriorityLevel; static String _defaultFilename; private: - Logbook(); //purposely not implemented + Logbook() = delete; //purposely not implemented - virtual ~Logbook(); //purposely not implemented + virtual ~Logbook() = delete; //purposely not implemented - Logbook(const Logbook&); //purposely not implemented - void operator=(const Logbook&); //purposely not implemented + Logbook(const Logbook&) = delete; //purposely not implemented + void operator=(const Logbook&) = delete; //purposely not implemented }; } // end namespace core } // end namespace map #include "mapLogbookMacros.h" #endif diff --git a/Code/Core/include/mapLogbookImplementation.h b/Code/Core/include/mapLogbookImplementation.h index 80e1450..c1aaf89 100644 --- a/Code/Core/include/mapLogbookImplementation.h +++ b/Code/Core/include/mapLogbookImplementation.h @@ -1,131 +1,131 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_LOGBOOK_IMPLEMENTATION_H #define __MAP_LOGBOOK_IMPLEMENTATION_H #include "itkLoggerOutput.h" #include "itkLoggerThreadWrapper.h" #include "itkStdStreamLogOutput.h" #include "mapXMLLogger.h" #include "mapString.h" #include namespace map { namespace core { //forward declaration class SharedFileStreamBase; /*! @class LogbookImplementation * @brief Helper class realizing the internel implemntation of the logbook. * * This class is used to abstract the implmentation of the logbook (PIMPL-Idiom) and * to realize a strong exception guarantee for the logbook. * @ingroup Logging */ class MAPCore_EXPORT LogbookImplementation : public itk::LightObject { public: - typedef LogbookImplementation Self; - typedef itk::LightObject Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Self = LogbookImplementation; + using Superclass = itk::LightObject; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(LogbookImplementation, itk::LightObject); itkNewMacro(Self); - typedef itk::LoggerThreadWrapper LoggerType; - typedef LoggerType::Pointer LoggerPointer; - typedef LoggerType::OutputType OutputType; - typedef OutputType::Pointer OutputPointer; - typedef LoggerType::PriorityLevelType PriorityLevelType;; + using LoggerType = itk::LoggerThreadWrapper; + using LoggerPointer = LoggerType::Pointer; + using OutputType = LoggerType::OutputType; + using OutputPointer = OutputType::Pointer; + using PriorityLevelType = LoggerType::PriorityLevelType; /*! Returns a reference to the normal logger. @eguarantee no fail */ - LoggerType& getLogger(void); + LoggerType& getLogger(); /*! Initializing the default output by opening a stream to the specified file. * If additional outputs exist (e.g. by cloning) they will also be setup. * @eguarantee basis*/ void initializeOutputs(const String& defaultOutputFileName); /*! adds additional log outputs to the logbook. * If the output has already been added to the logbook, * the method doesn't add it once again. * @eguarantee basis * @pre pOuput must be a valid pointer to OutputType.*/ void addAdditionalLogOutput(OutputType* pOutput); /*! clones the logbook implementation. * @return Smart pointer to the cloned implementation.*/ - Pointer clone(void) const; + Pointer clone() const; /*! clones the logbook implementation and sets a new default out put. * @param [in] defaultOutputFileName Name of the new default output file, that should be opened. * @return Smart pointer to the cloned and modified implementation.*/ Pointer clone(const String& newDefaultOutputFileName) const; /*! Pointer to the itk output window != NULL if attachITKOutputWindow() was called. * needed by the logbook if the logger must be updated.*/ itk::LoggerOutput::Pointer _spItkOutputWindow; PriorityLevelType _currentPriorityLevel; protected: void initializeAdditionalOutputs(); LoggerPointer _spLogger; - typedef std::set< OutputPointer > OutputContainerType; + using OutputContainerType = std::set; OutputContainerType _additionalOutputs; - typedef itk::StdStreamLogOutput DefaultOutputType; - typedef DefaultOutputType::Pointer DefaultOutputPointer; + using DefaultOutputType = itk::StdStreamLogOutput; + using DefaultOutputPointer = DefaultOutputType::Pointer; DefaultOutputPointer _spDefaultOutput; - typedef itk::SmartPointer StreamPointer; + using StreamPointer = itk::SmartPointer; StreamPointer _spDefaultStream; LogbookImplementation(); - virtual ~LogbookImplementation(); + ~LogbookImplementation() override; private: - LogbookImplementation(const LogbookImplementation&); //purposely not implemented - void operator=(const LogbookImplementation&); //purposely not implemented + LogbookImplementation(const LogbookImplementation&) = delete; //purposely not implemented + void operator=(const LogbookImplementation&) = delete; //purposely not implemented }; } // end namespace core } // end namespace map #include "mapLogbookMacros.h" #endif diff --git a/Code/Core/include/mapMappingException.h b/Code/Core/include/mapMappingException.h index e78247f..ca8f699 100644 --- a/Code/Core/include/mapMappingException.h +++ b/Code/Core/include/mapMappingException.h @@ -1,83 +1,83 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_MAPPING_EXCEPTION_H #define __MAP_MAPPING_EXCEPTION_H #include "mapRegistrationException.h" namespace map { namespace core { /*! @class MappingException * @brief Base exception class for exception in the context of data mapping by a registration. * * This is the base class for any exception that by an illegal mapping processed by a registration performer. * @ingroup Exception */ class MAPCore_EXPORT MappingException : public RegistrationException { public: - typedef MappingException Self; - typedef RegistrationException Superclass; + using Self = MappingException; + using Superclass = RegistrationException; /*! Default constructor. Needed to ensure the exception object can be * copied. */ - MappingException() : Superclass() {} + MappingException() {} /*! Constructor. Needed to ensure the exception object can be copied. */ MappingException(const char* file, unsigned int lineNumber) : Superclass(file, lineNumber) {} /*! Constructor. Needed to ensure the exception object can be copied. */ MappingException(const String& file, unsigned int lineNumber) : Superclass(file, lineNumber) {} /*! Constructor. Needed to ensure the exception object can be copied. */ MappingException(const String& file, unsigned int lineNumber, const String& desc, const std::string& loc) : Superclass(file, lineNumber, desc, loc) {} /*! Virtual destructor needed for subclasses. Has to have empty throw(). */ - virtual ~MappingException() throw() {} + ~MappingException() noexcept override = default; - virtual const char* GetNameOfClass() const + const char* GetNameOfClass() const override { return "map::MappingException"; } /*! Clones the exception object and returns a pointer to a copy of the exception object. * The cloned object is created on the heap and should function caller has to take care about * proper destruction (e.g. using auto pointer or tr1::shared_pointer). * @remark Used a plain pointer as return value in this case to ensure the no throw guarantee. * This feature is needed by some classes like MappingTaskBatch to ensure the feature of * processing tasks in multiple threads and to deal with any exception after joining the threads * and every task is processed (or failed through an exception). * @return Pointer to the cloned exception. If the cloning fails for any reason the return is NULL. * @eguarantee no throw*/ - virtual BaseExceptionType* clone() const throw(); + BaseExceptionType* clone() const noexcept override; }; } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapMappingPerformerBase.h b/Code/Core/include/mapMappingPerformerBase.h index 6fdc519..27f213d 100644 --- a/Code/Core/include/mapMappingPerformerBase.h +++ b/Code/Core/include/mapMappingPerformerBase.h @@ -1,80 +1,80 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_MAPPING_PERFORMER_BASE_H #define __MAP_MAPPING_PERFORMER_BASE_H #include "mapServiceProvider.h" namespace map { namespace core { /*! @class MappingPerformerBase * @brief Base class for any instance in MatchPoint that provides the service of performing a registration on any kind of data. * * @ingroup MappingTask * @tparam TPerformerRequest the request class, used to perform the task. */ template class MappingPerformerBase : public services::ServiceProvider< TPerformerRequest > { public: /*! Standard class typedefs. */ - typedef MappingPerformerBase Self; - typedef services::ServiceProvider< TPerformerRequest > Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Self = MappingPerformerBase; + using Superclass = services::ServiceProvider; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(MappingPerformerBase, ServiceProvider); - typedef typename Superclass::RequestType RequestType; + using RequestType = typename Superclass::RequestType; - typedef typename RequestType::RegistrationType RegistrationType; - typedef typename RegistrationType::ConstPointer RegistrationConstPointer; - typedef typename RequestType::InputDataType InputDataType; - typedef typename InputDataType::ConstPointer InputDataConstPointer; - typedef typename RequestType::ResultDataType ResultDataType; - typedef typename ResultDataType::Pointer ResultDataPointer; + using RegistrationType = typename RequestType::RegistrationType; + using RegistrationConstPointer = typename RegistrationType::ConstPointer; + using InputDataType = typename RequestType::InputDataType; + using InputDataConstPointer = typename InputDataType::ConstPointer; + using ResultDataType = typename RequestType::ResultDataType; + using ResultDataPointer = typename ResultDataType::Pointer; /*! Registers the input data and returns the result data. * @eguarantee strong * @param [in] request Referenz to the request that contains the registration and the input data * @return Smart pointer to the result image. */ virtual ResultDataPointer performMapping(const RequestType& request) const = 0; protected: - MappingPerformerBase() {}; - virtual ~MappingPerformerBase() {}; + MappingPerformerBase() = default; + ~MappingPerformerBase() override = default; private: - MappingPerformerBase(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented + MappingPerformerBase(const Self&) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapMappingPerformerRequestBase.h b/Code/Core/include/mapMappingPerformerRequestBase.h index b19e0d2..058c5c8 100644 --- a/Code/Core/include/mapMappingPerformerRequestBase.h +++ b/Code/Core/include/mapMappingPerformerRequestBase.h @@ -1,81 +1,81 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_MAPPING_PERFORMER_REQUEST_BASE_H #define __MAP_MAPPING_PERFORMER_REQUEST_BASE_H #include "itkMacro.h" namespace map { namespace core { /*! @class MappingPerformerRequestBase * @brief Base class used by the MappingPerformerRequests. * * This class is used as request type for the provider stack of MappingPerformers * @ingroup MappingTask * @sa MappingPerformer * @tparam TRegistration the registration class, that should be used to perform the task. * @tparam TInputData Type of the input data. * @tparam TResultData Type of the data in the target space. */ template class MappingPerformerRequestBase { public: - typedef TRegistration RegistrationType; - typedef typename RegistrationType::ConstPointer RegistrationConstPointer; + using RegistrationType = TRegistration; + using RegistrationConstPointer = typename RegistrationType::ConstPointer; - typedef TInputData InputDataType; - typedef typename InputDataType::ConstPointer InputDataConstPointer; + using InputDataType = TInputData; + using InputDataConstPointer = typename InputDataType::ConstPointer; - typedef TResultData ResultDataType; - typedef typename ResultDataType::ConstPointer ResultDataConstPointer; + using ResultDataType = TResultData; + using ResultDataConstPointer = typename ResultDataType::ConstPointer; itkStaticConstMacro(MovingDimensions, unsigned int, RegistrationType::MovingDimensions); itkStaticConstMacro(TargetDimensions, unsigned int, RegistrationType::TargetDimensions); RegistrationConstPointer _spRegistration; InputDataConstPointer _spInputData; protected: MappingPerformerRequestBase(const RegistrationType& registration, const InputDataType& inputData); MappingPerformerRequestBase(const RegistrationType* pRegistration, const InputDataType* pInputData); virtual ~MappingPerformerRequestBase(); private: // purposely not implemented MappingPerformerRequestBase(const MappingPerformerRequestBase&); // purposely not implemented void operator=(const MappingPerformerRequestBase&); }; } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapMappingPerformerRequestBase.tpp" #endif #endif diff --git a/Code/Core/include/mapMappingPerformerRequestBase.tpp b/Code/Core/include/mapMappingPerformerRequestBase.tpp index 229c250..c1adbaf 100644 --- a/Code/Core/include/mapMappingPerformerRequestBase.tpp +++ b/Code/Core/include/mapMappingPerformerRequestBase.tpp @@ -1,61 +1,61 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_MAPPING_PERFORMER_REQUEST_BASE_TPP #define __MAP_MAPPING_PERFORMER_REQUEST_BASE_TPP #include "mapMappingPerformerRequestBase.h" -#include +#include namespace map { namespace core { // Diese Datei ist ein Stub und muss noch ausimplementiert werden. template MappingPerformerRequestBase:: MappingPerformerRequestBase(const RegistrationType& registration, const InputDataType& inputData): _spRegistration(®istration), _spInputData(&inputData) {} template MappingPerformerRequestBase:: MappingPerformerRequestBase(const RegistrationType* pRegistration, const InputDataType* pInputData): _spRegistration(pRegistration), _spInputData(pInputData) { assert(pRegistration); assert(pInputData); } template MappingPerformerRequestBase:: ~MappingPerformerRequestBase() - {} + = default; } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapMappingTaskBase.h b/Code/Core/include/mapMappingTaskBase.h index 9873106..8e3b32b 100644 --- a/Code/Core/include/mapMappingTaskBase.h +++ b/Code/Core/include/mapMappingTaskBase.h @@ -1,145 +1,145 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_MAPPING_TASK_BASE_H #define __MAP_MAPPING_TASK_BASE_H #include "mapRegistrationException.h" #include "itkObject.h" namespace map { namespace core { /*! @class MappingTaskBase * @brief Base class for any mapping tasks. * * This class is the base class for any mapping task meant to use a registration to map data between to * information spaces.\n * To perform the mapping the class uses a static service stack populated with * MappingPerformers.\n * * @ingroup RegTask * @tparam TRegistration the registration class, that should be used to perform the task. */ template class MappingTaskBase: public itk::Object { public: /*! Standard class typedefs. */ - typedef MappingTaskBase Self; - typedef itk::Object Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Self = MappingTaskBase; + using Superclass = itk::Object; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(MappingTaskBase, itk::Object); - typedef TRegistration RegistrationType; - typedef typename RegistrationType::Pointer RegistrationPointer; - typedef typename RegistrationType::ConstPointer RegistrationConstPointer; + using RegistrationType = TRegistration; + using RegistrationPointer = typename RegistrationType::Pointer; + using RegistrationConstPointer = typename RegistrationType::ConstPointer; itkStaticConstMacro(MovingDimensions, unsigned int, RegistrationType::MovingDimensions); itkStaticConstMacro(TargetDimensions, unsigned int, RegistrationType::TargetDimensions); /*! Performs the registration of the given data by calling doExecution(). * Checks if the registration has been set, clear results and logs the beginning of the task. * @eguarantee strong * @result Returns if the input data was successfully registered. * @retval false If _isExceptionNeutral is false, it indecates that an exception occured. The the stored exception copy * for more information (getRegistrationException). * @pre Registration must have been set. */ - bool execute(void) const; + bool execute() const; /*! Sets the pointer to the registration that should be used. Calls clearResults(). */ void setRegistration(const RegistrationType* pRegistration); - const RegistrationType* getRegistration(void) const; + const RegistrationType* getRegistration() const; /*! Returns the pointer to the exception, if any has occured while registering the data. * @result Pointer to the exception. * @retval NULL No exception has occured yet.*/ - const ExceptionObject* getRegistrationException(void) const; + const ExceptionObject* getRegistrationException() const; void setIsExceptionNeutral(bool neutral); - bool getIsExceptionNeutral(void) const; + bool getIsExceptionNeutral() const; /*! Clears the results, inputs and any stored exception. * @remark Registration pointer will not be changed.*/ - void reset(void); + void reset(); protected: /*! Performs the registration of the given data and sets/replaces the results. * Must be defined for any concrete data performer. * @eguarantee strong */ - virtual void doExecution(void) const = 0; + virtual void doExecution() const = 0; /*! clears all result values of the task computed by former execute() calls. * Must be defined for any concrete data performer. * @eguarantee strong */ - virtual void clearResults(void) const = 0; + virtual void clearResults() const = 0; /*! clears all input datas of the task used to execute(). * Must be defined for any concrete data performer. * @eguarantee strong */ - virtual void clearInputs(void) = 0; + virtual void clearInputs() = 0; /*! Sets the pointer to the exception object to NULL after deleting the old instance, if one is referenced. * @eguarantee strong */ - void clearException(void) const; + void clearException() const; RegistrationConstPointer _spRegistration; MappingTaskBase(); - virtual ~MappingTaskBase(); + ~MappingTaskBase() override; /*! Methods invoked by itk::LightObject::Print(). */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: /*! Indicates if the task should act exception-neutral (thus passing all exceptions * directly through to the task user) or just catch the exception, store a copy of the exception * for later examinations and return false as the result of excute().*/ - bool _isExceptionNeutral; + bool _isExceptionNeutral{true}; /*! Pointer to the cloned excpetion if any exception occurred.*/ - mutable ExceptionObject* _pException; + mutable ExceptionObject* _pException{nullptr}; MappingTaskBase(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapMappingTaskBase.tpp" #endif #endif diff --git a/Code/Core/include/mapMappingTaskBase.tpp b/Code/Core/include/mapMappingTaskBase.tpp index a178f45..a8db7ad 100644 --- a/Code/Core/include/mapMappingTaskBase.tpp +++ b/Code/Core/include/mapMappingTaskBase.tpp @@ -1,185 +1,185 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_MAPPING_TASK_BASE_TPP #define __MAP_MAPPING_TASK_BASE_TPP #include "mapMappingTaskBase.h" -#include +#include namespace map { namespace core { template bool MappingTaskBase:: - execute(void) const + execute() const { assert(_spRegistration.IsNotNull()); if (_spRegistration.IsNull()) { mapDefaultExceptionMacro( << "Cannot execute registration task. Registration is undefined. Pleas set registration."); } mapLogInfoMacro( << "Start registration task execution"); clearException(); bool success = false; try { doExecution(); success = true; this->Modified(); } catch (ExceptionObject& ex) { _pException = ex.clone(); if (_isExceptionNeutral) { throw; } } catch (itk::ExceptionObject& ex) { _pException = new ExceptionObject(__FILE__, __LINE__, ex.what(), MAP_FUNCTION_SIGNATURE); if (_isExceptionNeutral) { throw; } } catch (...) { _pException = new ExceptionObject(__FILE__, __LINE__, "Unknown exception while prosessing registration task.", MAP_FUNCTION_SIGNATURE); if (_isExceptionNeutral) { throw; } } return success; } template void MappingTaskBase:: setRegistration(const RegistrationType* pRegistration) { if (pRegistration != _spRegistration.GetPointer()) { _spRegistration = pRegistration; clearResults(); this->Modified(); } } template const typename MappingTaskBase::RegistrationType* MappingTaskBase:: - getRegistration(void) const + getRegistration() const { return _spRegistration; } template const ExceptionObject* MappingTaskBase:: - getRegistrationException(void) const + getRegistrationException() const { return _pException; } template void MappingTaskBase:: - clearException(void) const + clearException() const { delete _pException; - _pException = NULL; + _pException = nullptr; }; template void MappingTaskBase:: - reset(void) + reset() { clearException(); this->clearInputs(); this->clearResults(); this->Modified(); } template MappingTaskBase:: - MappingTaskBase(): _isExceptionNeutral(true), _pException(NULL) + MappingTaskBase() { } template MappingTaskBase:: ~MappingTaskBase() { clearException(); } template void MappingTaskBase:: PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "Registration: " << _spRegistration.GetPointer() << std::endl; os << indent << "IsExceptionNeutral: " << _isExceptionNeutral << std::endl; os << indent << "Cached Exception: " << _pException << std::endl; } template void MappingTaskBase:: setIsExceptionNeutral(bool neutral) { _isExceptionNeutral = neutral; this->Modified(); }; template bool MappingTaskBase:: - getIsExceptionNeutral(void) const + getIsExceptionNeutral() const { return _isExceptionNeutral; }; } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapMetaProperty.h b/Code/Core/include/mapMetaProperty.h index 38ef358..9097483 100644 --- a/Code/Core/include/mapMetaProperty.h +++ b/Code/Core/include/mapMetaProperty.h @@ -1,150 +1,150 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_META_PROPERTY_H #define __MAP_META_PROPERTY_H #include "mapMetaPropertyBase.h" #include "mapMetaPropertyAccessInterface.h" namespace map { namespace core { /*! @class MetaProperty * @brief Property class for default value types. * * A MetaProperty instance is used to encapsulat normal value types (e.g. int, bool, void*). * Following type patterns are supported: * - Type : type (e.g. int, bool) * - Type * : pointer (e.g. char*, void*) * - const Type * : pointer-to-const-type (e.g. const Obj*) * . * Following type patterns are not supported: * - const Type : const value type (e.g. const int) * - Type * const : const-pointer-to-type * - const Type * const: const-pointer-to-const-type * . * The used value type must also have a valid assignment/copy-operator and a stl streaming operator (<<). * If the value type is a pointer it has to be treated differently, therefor see MetaPropertyAccessInterface. * Normal types have a const reference as ValueSetType and ValueGetType. * In difference ValueSetType and ValueGetType of pointer types are the pointer types themself.\n\n * * For types using smart pointer please use SmartMetaProperty. * @sa SmartMetaProperty * * @ingroup Core */ template class MetaProperty : public MetaPropertyBase, public MetaPropertyAccessInterface { public: /** Smart pointer typedef support. */ - typedef MetaProperty Self; - typedef MetaPropertyBase Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; - typedef TValue ValueType; - typedef typename MetaPropertyAccessInterface::ValueSetType ValueSetType; - typedef typename MetaPropertyAccessInterface::ValueGetType ValueGetType; + using Self = MetaProperty; + using Superclass = MetaPropertyBase; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; + using ValueType = TValue; + using ValueSetType = typename MetaPropertyAccessInterface::ValueSetType; + using ValueGetType = typename MetaPropertyAccessInterface::ValueGetType; /** Run-time type information (and related methods). */ itkTypeMacro(MetaProperty, MetaPropertyBase); /** * @brief Creates a MetaProperty instance, initializes it and returns it via smartpointer. * @return A pointer to the MetaProperty. * @param initValue The value that should be used to initialize the MetaProperty * @eguarantee strong */ static Pointer New(ValueSetType initValue); /** * @brief Dublicates a MetaProperty instance. The value of the property is copied. * @return A pointer to the MetaProperty clone. * @eguarantee strong */ - virtual ::itk::LightObject::Pointer CreateAnother(void) const; + ::itk::LightObject::Pointer CreateAnother() const override; /** * @brief Returns the unique type name of the value type that stores the property. * @return A pointer to a const char array containing the unique type name. * @eguarantee strong */ - virtual const char* getMetaPropertyTypeName() const; + const char* getMetaPropertyTypeName() const override; /** * @brief Returns the type_id of the value type that stores the property. * @eguarantee strong * @return A constant reference to a std::type_info object */ - virtual const std::type_info& getMetaPropertyTypeInfo(void) const; + const std::type_info& getMetaPropertyTypeInfo() const override; /** * @brief Returns the property value * @return Property value. * @eguarantee strong */ - virtual ValueGetType getValue() const; + ValueGetType getValue() const override; /** * @brief Sets the property to the passed value * @param newValue The new value of the property. * @eguarantee strong */ - virtual void setValue(ValueSetType newValue); + void setValue(ValueSetType newValue) override; protected: /** @reimplementation Reimplementation of the itk::LightObject::InternalClone*/ - virtual ::itk::LightObject::Pointer InternalClone() const; + ::itk::LightObject::Pointer InternalClone() const override; - virtual ~MetaProperty(); + ~MetaProperty() override; MetaProperty(ValueSetType initValue); /** * Defines the default behavior for printing out this element * @eguarantee strong * @param os An output stream */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: /*! Property value.*/ ValueType _value; - MetaProperty(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented + MetaProperty(const Self&) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; - } -} + } // namespace core +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapMetaProperty.tpp" #endif #endif diff --git a/Code/Core/include/mapMetaProperty.tpp b/Code/Core/include/mapMetaProperty.tpp index 08b38bb..050e0aa 100644 --- a/Code/Core/include/mapMetaProperty.tpp +++ b/Code/Core/include/mapMetaProperty.tpp @@ -1,121 +1,120 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_META_PROPERTY_TPP #define __MAP_META_PROPERTY_TPP namespace map { namespace core { template typename MetaProperty::Pointer MetaProperty:: New(ValueSetType initValue) { Pointer smartPtr; Self* rawPtr = new Self(initValue); smartPtr = rawPtr; rawPtr->UnRegister(); return smartPtr; } template ::itk::LightObject::Pointer MetaProperty:: - CreateAnother(void) const + CreateAnother() const { ::itk::LightObject::Pointer smartPtr; smartPtr = Self::New(this->_value).GetPointer(); return smartPtr; } template ::itk::LightObject::Pointer MetaProperty:: InternalClone() const { ::itk::LightObject::Pointer smartPtr; smartPtr = Self::New(this->_value).GetPointer(); return smartPtr; } template const char* MetaProperty:: getMetaPropertyTypeName() const { return typeid(ValueType).name(); }; template const std::type_info& MetaProperty:: - getMetaPropertyTypeInfo(void) const + getMetaPropertyTypeInfo() const { return typeid(ValueType); }; template typename MetaProperty::ValueGetType MetaProperty:: getValue() const { return _value; }; template void MetaProperty:: setValue(ValueSetType newValue) { _value = newValue; }; template void MetaProperty:: PrintSelf(std::ostream& os, itk::Indent indent) const { os << indent << "MetaProperty [" << this->getMetaPropertyTypeName() << "]: " << std::endl; os << indent.GetNextIndent() << _value << std::endl; }; template MetaProperty:: ~MetaProperty() - { - }; + = default; template MetaProperty:: MetaProperty(ValueSetType initValue) { _value = initValue; }; - } -} + } // namespace core +} // namespace map #endif \ No newline at end of file diff --git a/Code/Core/include/mapMetaPropertyAccessInterface.h b/Code/Core/include/mapMetaPropertyAccessInterface.h index e738e84..56857fa 100644 --- a/Code/Core/include/mapMetaPropertyAccessInterface.h +++ b/Code/Core/include/mapMetaPropertyAccessInterface.h @@ -1,172 +1,172 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_META_PROPERTY_ACCESS_INTERFACE_H #define __MAP_META_PROPERTY_ACCESS_INTERFACE_H #include "mapMacros.h" namespace map { namespace core { /*! @class MetaPropertyLightPointerAccessInterface * @brief Interface used to access the value of a MetaProperty as itk::LightObject pointer. * * This interface should only be implemented for MetaProperties that base on a * pointer value type. It allows access to the value in an untyped manner. * It is usefull for the situation that you want a value as a down casted type * but you don't know its real type. It is used by unwrapMetaProperty_cast(). * * @ingroup Core */ class MetaPropertyLightPointerAccessInterface { public: /** Smart pointer typedef support. */ - typedef const itk::LightObject* ConstLightPointer; - typedef itk::LightObject* LightPointer; + using ConstLightPointer = const itk::LightObject *; + using LightPointer = itk::LightObject *; /** * @brief Returns the property Value as untyped pointer * @return Property value. * @eguarantee strong */ virtual bool getUntypedValue(ConstLightPointer&) const = 0; /** * @brief Returns the property Value as untyped pointer * @return Property value. * @eguarantee strong */ virtual bool getUntypedValue(LightPointer&) const = 0; protected: virtual ~MetaPropertyLightPointerAccessInterface() - {}; + = default; MetaPropertyLightPointerAccessInterface() - {}; + = default; private: MetaPropertyLightPointerAccessInterface(const - MetaPropertyLightPointerAccessInterface&); //purposely not implemented - void operator=(const MetaPropertyLightPointerAccessInterface&); //purposely not implemented + MetaPropertyLightPointerAccessInterface&) = delete; //purposely not implemented + void operator=(const MetaPropertyLightPointerAccessInterface&) = delete; //purposely not implemented }; /*! @class MetaPropertyAccessInterface * @brief Interface used to access the value of a MetaProperty. * * This template version is only uzsed if the ValueType of the MetaProperty is no * pointer type. In the case of a pointer type the template specialication * will be used. This differentiation is needed because the access interface * of non pointer types and pointer types must behave different (e.g. the * ValueSetType and ValueGetType are different and the concrete implementation * of the methods will differ). * * @ingroup Core * @template TValueType Type of the value of the property */ template class MetaPropertyAccessInterface { public: /** Smart pointer typedef support. */ - typedef TValueType ValueType; - typedef const ValueType& ValueSetType; - typedef const ValueType& ValueGetType; + using ValueType = TValueType; + using ValueSetType = const ValueType &; + using ValueGetType = const ValueType &; /** * @brief Returns the property value * @return Property value. * @eguarantee strong */ virtual ValueGetType getValue() const = 0; /** * @brief Sets the property to the passed value * @param newValue The new value of the property. * @eguarantee strong */ virtual void setValue(ValueSetType newValue) = 0; protected: virtual ~MetaPropertyAccessInterface() - {}; + = default; MetaPropertyAccessInterface() - {}; + = default; private: MetaPropertyAccessInterface(const MetaPropertyAccessInterface - &); //purposely not implemented - void operator=(const MetaPropertyAccessInterface&); //purposely not implemented + &) = delete; //purposely not implemented + void operator=(const MetaPropertyAccessInterface&) = delete; //purposely not implemented }; /* Template specialication of the MetaPropertyAccessInterface for pointer types */ template class MetaPropertyAccessInterface { public: /** Smart pointer typedef support. */ - typedef TValueType* ValueType; - typedef ValueType ValueSetType; - typedef ValueType ValueGetType; + using ValueType = TValueType *; + using ValueSetType = ValueType; + using ValueGetType = ValueType; /** * @brief Returns the property value * @return Property value. * @eguarantee strong */ virtual ValueGetType getValue() const = 0; /** * @brief Sets the property to the passed value * @param value The new value of the property. * @eguarantee strong */ virtual void setValue(ValueSetType value) = 0; protected: virtual ~MetaPropertyAccessInterface() - {}; + = default; MetaPropertyAccessInterface() - {}; + = default; private: MetaPropertyAccessInterface(const MetaPropertyAccessInterface - &); //purposely not implemented - void operator=(const MetaPropertyAccessInterface&); //purposely not implemented + &) = delete; //purposely not implemented + void operator=(const MetaPropertyAccessInterface&) = delete; //purposely not implemented }; - } -} + } // namespace core +} // namespace map #endif diff --git a/Code/Core/include/mapMetaPropertyAccessor.h b/Code/Core/include/mapMetaPropertyAccessor.h index b98f465..ea2cec3 100644 --- a/Code/Core/include/mapMetaPropertyAccessor.h +++ b/Code/Core/include/mapMetaPropertyAccessor.h @@ -1,357 +1,357 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_META_PROPERTY_ACCESSOR_H #define __MAP_META_PROPERTY_ACCESSOR_H #include "mapMetaPropertyAccessInterface.h" #include "mapMetaPropertyBase.h" namespace map { namespace core { /*! @class MetaPropertyAccessor * @brief Helper class for efficient "unboxing" of property values. * * This class (and its template specialization) is used to efficiently access the value of a property. * By template specialization it is checked if the target value type is const or not. * If the type is non const you may also cast for const access to the property if a non const access * is not possible. * * @ingroup Core */ template class MetaPropertyAccessor { public: - typedef TValue ValueType; - typedef MetaPropertyAccessInterface InterfaceType; + using ValueType = TValue; + using InterfaceType = MetaPropertyAccessInterface; /** * @brief Retrieves the value of a passed property. * @return Indication of the value was successfully unwrapped. True: value is valid; * False: value is invalid. * @param pProperty Pointer to the MetaPropertyBase instance that should be unwrapped. * @param value The value that was unwrapped. Value is only valid if return method returns true. * @eguarantee strong */ static bool unwrapPropertyValue(const MetaPropertyBase* pProperty, ValueType& value); /** * @brief Resets the value of a passed property. * @return Indication of the value was successfully wrapped. True: value is valid; * False: value is invalid. * @param pProperty Pointer to the MetaPropertyBase instance that should be set. * @param value The value that should be wrapped into the property. * @eguarantee strong */ static bool wrapPropertyValue(MetaPropertyBase* pProperty, ValueType value); private: ~MetaPropertyAccessor();//purposely not implemented MetaPropertyAccessor();//purposely not implemented MetaPropertyAccessor(const MetaPropertyAccessor&); //purposely not implemented void operator=(const MetaPropertyAccessor&); //purposely not implemented }; //specialized template version for const-type-pointer. This version also casts for InterfaceType //if the cast for ConstInterfaceType fails. template class MetaPropertyAccessor { public: - typedef const TValue* ValueType; - typedef MetaPropertyAccessInterface InterfaceType; - typedef MetaPropertyAccessInterface ConstInterfaceType; + using ValueType = const TValue *; + using InterfaceType = MetaPropertyAccessInterface; + using ConstInterfaceType = MetaPropertyAccessInterface; static bool unwrapPropertyValue(const MetaPropertyBase* pProperty, ValueType& value); static bool wrapPropertyValue(MetaPropertyBase* pProperty, ValueType value); private: ~MetaPropertyAccessor();//purposely not implemented MetaPropertyAccessor();//purposely not implemented MetaPropertyAccessor(const MetaPropertyAccessor&); //purposely not implemented void operator=(const MetaPropertyAccessor&); //purposely not implemented }; //specialized template version for smart pointer. This version takes care if the //property value should be unwrapped to a smart pointer. template class MetaPropertyAccessor< itk::SmartPointer > { public: - typedef TValue* ValueType; - typedef itk::SmartPointer SmartPointerType; - typedef MetaPropertyAccessInterface InterfaceType; + using ValueType = TValue *; + using SmartPointerType = itk::SmartPointer; + using InterfaceType = MetaPropertyAccessInterface; static bool unwrapPropertyValue(const MetaPropertyBase* pProperty, SmartPointerType& spValue); static bool wrapPropertyValue(MetaPropertyBase* pProperty, ValueType value); private: ~MetaPropertyAccessor();//purposely not implemented MetaPropertyAccessor();//purposely not implemented MetaPropertyAccessor(const MetaPropertyAccessor< itk::SmartPointer > &); //purposely not implemented void operator=(const MetaPropertyAccessor< itk::SmartPointer > &); //purposely not implemented }; //specialized template version for const smart pointer. //This version takes care if the property value should //be unwrapped to a const smart pointer. This version //also casts for InterfaceType if the cast for //ConstInterfaceType fails. template class MetaPropertyAccessor< itk::SmartPointer > { public: - typedef const TValue* ValueType; - typedef itk::SmartPointer SmartPointerType; - typedef MetaPropertyAccessInterface InterfaceType; - typedef MetaPropertyAccessInterface ConstInterfaceType; + using ValueType = const TValue *; + using SmartPointerType = itk::SmartPointer; + using InterfaceType = MetaPropertyAccessInterface; + using ConstInterfaceType = MetaPropertyAccessInterface; static bool unwrapPropertyValue(const MetaPropertyBase* pProperty, SmartPointerType& spValue); static bool wrapPropertyValue(MetaPropertyBase* pProperty, ValueType value); private: ~MetaPropertyAccessor();//purposely not implemented MetaPropertyAccessor();//purposely not implemented MetaPropertyAccessor(const MetaPropertyAccessor< itk::SmartPointer > &); //purposely not implemented void operator=(const MetaPropertyAccessor< itk::SmartPointer > &); //purposely not implemented }; /*! * Convinience function to quickly unwrap and access the value of a MetaProperty if only the pointer * to the MetaPropertyBase is given.\n * @remark The real unpacking is realized in the helper class MetaPropertyAccessor. This design/seperation of * template function and specialized helper template class was chosen to avoid problems and irritating * behaviour that could occure when using partial specialization on template functions.\n * With this design we have a clean entrance point (the template function) that stays untouched and all * the specialization and overloading is done by the template class. * * @ingroup Core */ template bool unwrapMetaProperty(const MetaPropertyBase* pProperty, TValue& value) { return MetaPropertyAccessor::unwrapPropertyValue(pProperty, value); }; /*! * Helper function that tries to cast to the content of a smart meta property via * untyped raw pointer to the passed casted pointer type. * If this works the function succfully returns. * * @ingroup Core */ template bool castRawMetaProperty(const MetaPropertyBase* pProperty, TValue& spValue) { bool result = false; - const MetaPropertyLightPointerAccessInterface* pInterface = + const auto* pInterface = dynamic_cast(pProperty); if (pInterface) { //get the untyped pointer TRawPointer pRaw; if (pInterface->getUntypedValue(pRaw)) { //we have a pointer if (pRaw) { // it is not null so try to cast - TCastedPointer pCastedContent = dynamic_cast(pRaw); + auto pCastedContent = dynamic_cast(pRaw); if (pCastedContent) { spValue = pCastedContent; result = true; } } else { result = true; - spValue = NULL; + spValue = nullptr; } } } return result; }; /*! @class MetaPropertyCaster * @brief Helper class casting pointer meta properties to a given type via untyped pointer. * Only smart pointer are currently supported. Therefor default template is just a dummy; * see template specializations. * @ingroup Core */ //dummy version for other types then smart pointer. There are not supported. template class MetaPropertyCaster { public: - static bool cast(const MetaPropertyBase*, TValue&) + static bool cast(const MetaPropertyBase* /*unused*/, TValue& /*unused*/) { return false; }; private: - ~MetaPropertyCaster();//purposely not implemented - MetaPropertyCaster();//purposely not implemented + ~MetaPropertyCaster() = delete;//purposely not implemented + MetaPropertyCaster() = delete;//purposely not implemented - MetaPropertyCaster(const MetaPropertyCaster< TValue >&); //purposely not implemented - void operator=(const MetaPropertyCaster< TValue >&); //purposely not implemented + MetaPropertyCaster(const MetaPropertyCaster< TValue >&) = delete; //purposely not implemented + void operator=(const MetaPropertyCaster< TValue >&) = delete; //purposely not implemented }; template class MetaPropertyCaster< TValue* > { public: - typedef TValue* ValueType; - typedef MetaPropertyLightPointerAccessInterface::LightPointer LightPointerType; + using ValueType = TValue *; + using LightPointerType = MetaPropertyLightPointerAccessInterface::LightPointer; static bool cast(const MetaPropertyBase* pProperty, ValueType& spValue) { return castRawMetaProperty(pProperty, spValue); }; private: ~MetaPropertyCaster();//purposely not implemented MetaPropertyCaster();//purposely not implemented MetaPropertyCaster(const MetaPropertyCaster< itk::SmartPointer > &); //purposely not implemented void operator=(const MetaPropertyCaster< itk::SmartPointer >&); //purposely not implemented }; template class MetaPropertyCaster< const TValue* > { public: - typedef const TValue* ValueType; - typedef MetaPropertyLightPointerAccessInterface::ConstLightPointer LightPointerType; + using ValueType = const TValue *; + using LightPointerType = MetaPropertyLightPointerAccessInterface::ConstLightPointer; static bool cast(const MetaPropertyBase* pProperty, ValueType& spValue) { return castRawMetaProperty(pProperty, spValue); }; private: ~MetaPropertyCaster();//purposely not implemented MetaPropertyCaster();//purposely not implemented MetaPropertyCaster(const MetaPropertyCaster< itk::SmartPointer > &); //purposely not implemented void operator=(const MetaPropertyCaster< itk::SmartPointer >&); //purposely not implemented }; template class MetaPropertyCaster< itk::SmartPointer > { public: - typedef TValue* ValueType; - typedef itk::SmartPointer SmartPointerType; - typedef MetaPropertyLightPointerAccessInterface::LightPointer LightPointerType; + using ValueType = TValue *; + using SmartPointerType = itk::SmartPointer; + using LightPointerType = MetaPropertyLightPointerAccessInterface::LightPointer; static bool cast(const MetaPropertyBase* pProperty, SmartPointerType& spValue) { return castRawMetaProperty(pProperty, spValue); }; private: - ~MetaPropertyCaster();//purposely not implemented - MetaPropertyCaster();//purposely not implemented + ~MetaPropertyCaster() = delete;//purposely not implemented + MetaPropertyCaster() = delete;//purposely not implemented MetaPropertyCaster(const MetaPropertyCaster< itk::SmartPointer > - &); //purposely not implemented - void operator=(const MetaPropertyCaster< itk::SmartPointer >&); //purposely not implemented + &) = delete; //purposely not implemented + void operator=(const MetaPropertyCaster< itk::SmartPointer >&) = delete; //purposely not implemented }; //specialized template version for const smart pointer. //This version takes care if the property value should //be converted to a const smart pointer. template class MetaPropertyCaster< itk::SmartPointer > { public: - typedef const TValue* ValueType; - typedef itk::SmartPointer SmartPointerType; - typedef MetaPropertyLightPointerAccessInterface::ConstLightPointer LightPointerType; + using ValueType = const TValue *; + using SmartPointerType = itk::SmartPointer; + using LightPointerType = MetaPropertyLightPointerAccessInterface::ConstLightPointer; static bool cast(const MetaPropertyBase* pProperty, SmartPointerType& spValue) { return castRawMetaProperty(pProperty, spValue); }; private: ~MetaPropertyCaster();//purposely not implemented MetaPropertyCaster();//purposely not implemented MetaPropertyCaster(const MetaPropertyCaster< itk::SmartPointer > &); //purposely not implemented void operator=(const MetaPropertyCaster< itk::SmartPointer > &); //purposely not implemented }; /*! * Convinience function for smart pointer objectes that enhances the convinience function unwrapMetaProperty() * by a casting feature.\n * Casting feature: if unwrapMetaProperty() doesnt work the function assumes that the TValue is not the type stored * in the MetaPropertyBase. Therefor this function will get the raw untyped pointer and tries a dynamic_cast. * If this works the function succfully returns. * * @ingroup Core */ template bool unwrapCastedMetaProperty(const MetaPropertyBase* pProperty, TValue& value) { bool result = false; result = MetaPropertyAccessor::unwrapPropertyValue(pProperty, value); if (!result) { //try the casting result = MetaPropertyCaster::cast(pProperty, value); } return result; }; - } -} + } // namespace core +} // namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapMetaPropertyAccessor.tpp" #endif #endif diff --git a/Code/Core/include/mapMetaPropertyAccessor.tpp b/Code/Core/include/mapMetaPropertyAccessor.tpp index e9ec170..d6bef69 100644 --- a/Code/Core/include/mapMetaPropertyAccessor.tpp +++ b/Code/Core/include/mapMetaPropertyAccessor.tpp @@ -1,213 +1,213 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_META_PROPERTY_ACCESSOR_TPP #define __MAP_META_PROPERTY_ACCESSOR_TPP namespace map { namespace core { template bool MetaPropertyAccessor:: unwrapPropertyValue(const MetaPropertyBase* pProperty, ValueType& value) { - const InterfaceType* pAccessInterfaces = dynamic_cast(pProperty); + const auto* pAccessInterfaces = dynamic_cast(pProperty); bool result = false; if (pAccessInterfaces) { value = pAccessInterfaces->getValue(); result = true; } return result; }; template bool MetaPropertyAccessor:: wrapPropertyValue(MetaPropertyBase* pProperty, ValueType value) { InterfaceType* pAccessInterfaces = dynamic_cast(pProperty); bool result = false; if (pAccessInterfaces) { pAccessInterfaces->setValue(value); result = true; } return result; }; ////////////////////////////////////////////////////////// // Specialiced version: const TValue * ////////////////////////////////////////////////////////// template bool MetaPropertyAccessor:: unwrapPropertyValue(const MetaPropertyBase* pProperty, ValueType& value) { const ConstInterfaceType* pConstAccessInterfaces = dynamic_cast (pProperty); bool result = false; if (pConstAccessInterfaces) { value = pConstAccessInterfaces->getValue(); result = true; } else { //we try to cast for the non const version, because it can also be used to get a const value //this is a conviniece for the case a non const proprty value should only be unwrapped as const //value const InterfaceType* pAccessInterfaces = dynamic_cast(pProperty); if (pAccessInterfaces) { value = pAccessInterfaces->getValue(); result = true; } } return result; }; template bool MetaPropertyAccessor:: wrapPropertyValue(MetaPropertyBase* pProperty, ValueType value) { ConstInterfaceType* pAccessInterfaces = dynamic_cast(pProperty); bool result = false; if (pAccessInterfaces) { pAccessInterfaces->setValue(value); result = true; } return result; }; ////////////////////////////////////////////////////////// // Specialiced version: itk::SmartPointer ////////////////////////////////////////////////////////// template bool MetaPropertyAccessor< itk::SmartPointer >:: unwrapPropertyValue(const MetaPropertyBase* pProperty, SmartPointerType& spValue) { bool result = false; - const InterfaceType* pAccessInterfaces = dynamic_cast(pProperty); + const auto* pAccessInterfaces = dynamic_cast(pProperty); if (pAccessInterfaces) { spValue = pAccessInterfaces->getValue(); result = true; } return result; }; template bool MetaPropertyAccessor< itk::SmartPointer >:: wrapPropertyValue(MetaPropertyBase* pProperty, ValueType value) { InterfaceType* pAccessInterfaces = dynamic_cast(pProperty); bool result = false; if (pAccessInterfaces) { pAccessInterfaces->setValue(value); result = true; } return result; }; ////////////////////////////////////////////////////////// // Specialiced version: itk::SmartPointer< const TValue> ////////////////////////////////////////////////////////// template bool MetaPropertyAccessor< itk::SmartPointer >:: unwrapPropertyValue(const MetaPropertyBase* pProperty, SmartPointerType& spValue) { const ConstInterfaceType* pConstAccessInterfaces = dynamic_cast (pProperty); bool result = false; if (pConstAccessInterfaces) { spValue = pConstAccessInterfaces->getValue(); result = true; } else { //we try to cast for the non const version, because it can also be used to get a const value //this is a conviniece for the case a non const proprty value should only be unwrapped as const //value const InterfaceType* pAccessInterfaces = dynamic_cast(pProperty); if (pAccessInterfaces) { spValue = pAccessInterfaces->getValue(); result = true; } } return result; }; template bool MetaPropertyAccessor< itk::SmartPointer >:: wrapPropertyValue(MetaPropertyBase* pProperty, ValueType value) { ConstInterfaceType* pAccessInterfaces = dynamic_cast(pProperty); bool result = false; if (pAccessInterfaces) { pAccessInterfaces->setValue(value); result = true; } return result; }; - } -} + } // namespace core +} // namespace map #endif \ No newline at end of file diff --git a/Code/Core/include/mapMetaPropertyBase.h b/Code/Core/include/mapMetaPropertyBase.h index a13c7c9..1ffc876 100644 --- a/Code/Core/include/mapMetaPropertyBase.h +++ b/Code/Core/include/mapMetaPropertyBase.h @@ -1,96 +1,96 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_META_PROPERTY_BASE_H #define __MAP_META_PROPERTY_BASE_H #include #include #include "itkLightObject.h" #include "mapMacros.h" #include "mapMAPCoreExports.h" namespace map { namespace core { /*! @class MetaPropertyBase * @brief Base class designed as common interface for MetaProperties. * * MetaProperties are inter alia used to realize a generic streaming of algorithm * properties like parameter settings. * * @ingroup Core */ class MAPCore_EXPORT MetaPropertyBase : public ::itk::LightObject { public: /** Smart pointer typedef support. */ - typedef MetaPropertyBase Self; - typedef ::itk::LightObject Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = MetaPropertyBase; + using Superclass = ::itk::LightObject; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; /** Run-time type information (and related methods). */ itkTypeMacro(MetaPropertyBase, LightObject); itkCloneMacro(Self); /** * @brief Returns the unique type name of the value type that stores the property. * @return A pointer to a const char array containing the unique type name. * @eguarantee strong * @ex */ virtual const char* getMetaPropertyTypeName() const = 0; /** * @brief Returns the type_id of the value type that stores the property. * @eguarantee strong * @return A constant reference to a std::type_info object */ - virtual const std::type_info& getMetaPropertyTypeInfo(void) const = 0; + virtual const std::type_info& getMetaPropertyTypeInfo() const = 0; protected: - virtual ~MetaPropertyBase(); + ~MetaPropertyBase() override; MetaPropertyBase(); /** * Defines the default behavior for printing out this element * @eguarantee strong * @param os An output stream */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: - MetaPropertyBase(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented + MetaPropertyBase(const Self&) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; - } -} + } // namespace core +} // namespace map #endif diff --git a/Code/Core/include/mapMissingProviderException.h b/Code/Core/include/mapMissingProviderException.h index 9d6c4f8..b399505 100644 --- a/Code/Core/include/mapMissingProviderException.h +++ b/Code/Core/include/mapMissingProviderException.h @@ -1,83 +1,83 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_MISSING_PROVIDER_EXCEPTION_H #define __MAP_MISSING_PROVIDER_EXCEPTION_H #include "mapServiceException.h" namespace map { namespace core { /*! @class MissingProviderException * @brief Exception class used when a provider is missing or a service request cannot be properly handled. * @ingroup Exception */ class MAPCore_EXPORT MissingProviderException : public ServiceException { public: - typedef MissingProviderException Self; - typedef ServiceException Superclass; + using Self = MissingProviderException; + using Superclass = ServiceException; /*! Default constructor. Needed to ensure the exception object can be * copied. */ - MissingProviderException() : Superclass() {} + MissingProviderException() = default; /*! Constructor. Needed to ensure the exception object can be copied. */ MissingProviderException(const char* file, unsigned int lineNumber) : Superclass(file, lineNumber) {} /*! Constructor. Needed to ensure the exception object can be copied. */ MissingProviderException(const std::string& file, unsigned int lineNumber) : Superclass(file, lineNumber) {} /*! Constructor. Needed to ensure the exception object can be copied. */ MissingProviderException(const std::string& file, unsigned int lineNumber, const std::string& desc, const std::string& loc) : Superclass(file, lineNumber, desc, loc) {} /*! Virtual destructor needed for subclasses. Has to have empty throw(). */ - virtual ~MissingProviderException() throw() {} + ~MissingProviderException() noexcept override = default; - virtual const char* GetNameOfClass() const + const char* GetNameOfClass() const override { return "map::MissingProviderException"; } /*! Clones the exception object and returns a pointer to a copy of the exception object. * The cloned object is created on the heap and should function caller has to take care about * proper destruction (e.g. using auto pointer or tr1::shared_pointer). * @remark Used a plain pointer as return value in this case to ensure the no throw guarantee. * This feature is needed by some classes like MappingTaskBatch to ensure the feature of * processing tasks in multiple threads and to deal with any exception after joining the threads * and every task is processed (or failed through an exception). * @return Pointer to the cloned exception. If the cloning fails for any reason the return is NULL. * @eguarantee no throw*/ - virtual BaseExceptionType* clone() const throw(); + BaseExceptionType* clone() const noexcept override; }; } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapModificationTimeValidator.h b/Code/Core/include/mapModificationTimeValidator.h index cfc6867..60a9497 100644 --- a/Code/Core/include/mapModificationTimeValidator.h +++ b/Code/Core/include/mapModificationTimeValidator.h @@ -1,90 +1,90 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_MODIFICATION_TIME_VALIDTOR_H #define __MAP_MODIFICATION_TIME_VALIDTOR_H #include "itkObject.h" #include "itkTimeStamp.h" #include #include #include "mapMacros.h" #include "mapMAPCoreExports.h" namespace map { namespace core { /*! @class ModificationTimeValidator * @brief Helper class that allows to handles itk modification time consistency problems when using dll deployment for algoritms. * * When using a dll deployment strategy for algorithms (at least for windows systems) * the itk modification time (MTime) becomes inconsistent between the algorithms out of a dll * and data loaded by the host. (Reason is that dlls and host have different static variables * defining the current MTime). This leads inter alia to a false up to date conclusion * in dll deployed algorithms. This class serves as work around that helps to correctly detect * changes in modification time. Basic principle is that the MTime of an watched object is taged * by a MTime of the own context. And this "Tag" is changed, when the object or its MTime changes. * This may lead to false positives in modification detection. But it will allow to detect all * real changes. */ class MAPCore_EXPORT ModificationTimeValidator { public: /*! Standard class typedefs. */ - typedef ModificationTimeValidator Self; - typedef ::itk::Object WatchedObjectType; - typedef unsigned long MTimeType; + using Self = ModificationTimeValidator; + using WatchedObjectType = ::itk::Object; + using MTimeType = unsigned long; /*! Constructor. * @eguarantee strong */ ModificationTimeValidator(const WatchedObjectType* obj); /*! Constructor. * @eguarantee strong */ ModificationTimeValidator(); /*! Destructor. * @eguarantee none throw*/ ~ModificationTimeValidator(); /*! Set the watched object and update the internal time stamp. * @eguarantee strong */ void setWatchedObject(const WatchedObjectType* obj); /*! Get the point defining the origin of the volume. * @eguarantee strong */ MTimeType getMTime() const; protected: WatchedObjectType::ConstPointer _spObj; mutable ::itk::TimeStamp _ownTimeStamp; mutable MTimeType _objTimeStamp; }; } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapNoneStaticLoadPolicy.h b/Code/Core/include/mapNoneStaticLoadPolicy.h index 47e89ad..db4fd9b 100644 --- a/Code/Core/include/mapNoneStaticLoadPolicy.h +++ b/Code/Core/include/mapNoneStaticLoadPolicy.h @@ -1,83 +1,83 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_NONE_STATIC_LOAD_POLICY_H #define __MAP_NONE_STATIC_LOAD_POLICY_H namespace map { namespace core { namespace services { //forward declaration template class ServiceRepositoryPolicyLoadInterface; /*! @class NoneStaticLoadPolicy * @brief Loading policy with no default provider. * * This policy loads nothing, therefore a repository using this policy has no default providers. * * @ingroup LoadPolicies * @tparam TProviderBase Base class of the service providers loaded by the policy. */ template class NoneStaticLoadPolicy { protected: /*! Standard class typedefs. */ - typedef ServiceRepositoryPolicyLoadInterface LoadInterfaceType; - typedef TProviderBase ProviderBaseType; - typedef typename ProviderBaseType::Pointer ProviderBasePointer; + using LoadInterfaceType = ServiceRepositoryPolicyLoadInterface; + using ProviderBaseType = TProviderBase; + using ProviderBasePointer = typename ProviderBaseType::Pointer; /*! Loading of all default providers. * @eguarantee basic */ void loadStaticProviders(); /*! Registers the loading interface that should be used by the policy. * @eguarantee strong * @param [in] interface Reference to the interface that should used by the policy when * loading providers. */ void registerInterfaceForStaticLoading(LoadInterfaceType& loadInterface); NoneStaticLoadPolicy(); ~NoneStaticLoadPolicy(); private: - typedef NoneStaticLoadPolicy Self; + using Self = NoneStaticLoadPolicy; NoneStaticLoadPolicy(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace services } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapNoneStaticLoadPolicy.tpp" #endif #endif diff --git a/Code/Core/include/mapNullRegistrationKernel.h b/Code/Core/include/mapNullRegistrationKernel.h index 9822341..afd2858 100644 --- a/Code/Core/include/mapNullRegistrationKernel.h +++ b/Code/Core/include/mapNullRegistrationKernel.h @@ -1,120 +1,119 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __NULL_REGISTRATION_KERNEL_BASE_H #define __NULL_REGISTRATION_KERNEL_BASE_H #include "mapRegistrationKernelBase.h" namespace map { namespace core { /*! @class NullRegistrationKernel This class defines null kernels. This type of kernel should be used by registration algorithms, if there is no valid registration kernel (yet) for a mapping direction. Thus it is the "official" and explicit way to define, that a mapping direction (and its kernel) is undefined and not valid. (It is analog to the meaning of NULL pointer). Any attempt to use this kernel for mapping purposes will fail. The precompution of the kernel will raise an exception. Combination of a NullRegistrationKernel with a kernel of any other type will result in NullRegistrationKernel. The inversion of a NullRegistrationKernel is a NullRegistrationKernel @ingroup RegKernel */ template class NullRegistrationKernel : public RegistrationKernelBase { public: typedef NullRegistrationKernel Self; typedef RegistrationKernelBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(NullRegistrationKernel, RegistrationKernelBase); itkNewMacro(Self); - typedef typename Superclass::InputPointType InputPointType; - typedef typename Superclass::OutputPointType OutputPointType; - typedef typename Superclass::RepresentationDescriptorConstPointer - RepresentationDescriptorConstPointer; + using InputPointType = typename Superclass::InputPointType; + using OutputPointType = typename Superclass::OutputPointType; + using RepresentationDescriptorConstPointer = typename Superclass::RepresentationDescriptorConstPointer; /*! @brief gets the largest possible representation descriptor. The descriptor defines * the space the kernel guarantees to map. * @return Smart pointer to the descriptor (may be generated dynamicaly) * @retval NULL there is no descriptor. If hasLimitedRepresentation returns false, the kernel * has no mapping limitations and covers the total input space. @eguarantee strong */ virtual RepresentationDescriptorConstPointer getLargestPossibleRepresentation() const; /*! @brief forces kernel to precompute, even if it is a LazyFieldKernel @eguarantee strong */ - virtual void precomputeKernel() const override; + void precomputeKernel() const override; protected: /*! Methods invoked by itk::LightObject::Print(). */ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; /*! Maps the point from input to output space. Is used by mapPoint() * It will always return false because a NullRegistrationKernel cannot map * any points * @eguarantee strong */ virtual bool doMapPoint(const InputPointType& inPoint, OutputPointType& outPoint) const; NullRegistrationKernel(); virtual ~NullRegistrationKernel(); /** @reimplementation Reimplementation of the itk::LightObject::InternalClone*/ virtual ::itk::LightObject::Pointer InternalClone() const; private: //No copy constructor allowed NullRegistrationKernel(const Self& source); void operator=(const Self&); //purposely not implemented }; template std::ostream& operator<< (std::ostream& os, const NullRegistrationKernel& p) { p.Print(os); return os; } - } -} + } // namespace core +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapNullRegistrationKernel.tpp" #endif #endif diff --git a/Code/Core/include/mapNullRegistrationKernelCombinator.h b/Code/Core/include/mapNullRegistrationKernelCombinator.h index 9d90058..95f4f77 100644 --- a/Code/Core/include/mapNullRegistrationKernelCombinator.h +++ b/Code/Core/include/mapNullRegistrationKernelCombinator.h @@ -1,133 +1,133 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_NULL_REGISTRATION_KERNEL_COMBINATOR_H #define __MAP_NULL_REGISTRATION_KERNEL_COMBINATOR_H #include "mapRegistrationKernelCombinatorBase.h" #include "mapNullRegistrationKernel.h" namespace map { namespace core { /*! @class NullRegistrationKernelCombinator * @brief Combinator class that combines two kernels (at least one is a Null kernel) to a new kernel. * Combinations with a Null kernel always result in a new Null kernel. * @ingroup RegOperation * @tparam VInputDimensions Dimensions of the input space of the first kernel. * @tparam VInterimDimensions Dimensions of the output space of the first kernel and the input space of the second. * @tparam VOutputDimensions Dimensions of the output space of the second kernel. */ template class NullRegistrationKernelCombinator : public RegistrationKernelCombinatorBase< VInputDimensions, VInterimDimensions, VOutputDimensions > { public: /*! Standard class typedefs. */ typedef NullRegistrationKernelCombinator< VInputDimensions, VInterimDimensions, VOutputDimensions > Self; typedef RegistrationKernelCombinatorBase< VInputDimensions, VInterimDimensions, VOutputDimensions > Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; - typedef typename Superclass::Kernel1BaseType Kernel1BaseType; - typedef typename Superclass::Kernel1BasePointer Kernel1BasePointer; - typedef typename Superclass::Kernel2BaseType Kernel2BaseType; - typedef typename Superclass::Kernel2BasePointer Kernel2BasePointer; + using Kernel1BaseType = typename Superclass::Kernel1BaseType; + using Kernel1BasePointer = typename Superclass::Kernel1BasePointer; + using Kernel2BaseType = typename Superclass::Kernel2BaseType; + using Kernel2BasePointer = typename Superclass::Kernel2BasePointer; - typedef typename Superclass::CombinedKernelBaseType CombinedKernelBaseType; - typedef typename Superclass::CombinedKernelBasePointer CombinedKernelBasePointer; + using CombinedKernelBaseType = typename Superclass::CombinedKernelBaseType; + using CombinedKernelBasePointer = typename Superclass::CombinedKernelBasePointer; - typedef typename Superclass::RequestType RequestType; + using RequestType = typename Superclass::RequestType; - typedef typename Superclass::InputFieldRepresentationType InputFieldRepresentationType; - typedef typename Superclass::InterimFieldRepresentationType InterimFieldRepresentationType; + using InputFieldRepresentationType = typename Superclass::InputFieldRepresentationType; + using InterimFieldRepresentationType = typename Superclass::InterimFieldRepresentationType; - typedef typename Superclass::PaddingVectorType PaddingVectorType; + using PaddingVectorType = typename Superclass::PaddingVectorType; typedef NullRegistrationKernel CombinedKernelType; typedef NullRegistrationKernel Kernel1Type; typedef NullRegistrationKernel Kernel2Type; itkTypeMacro(NullRegistrationKernelCombinator, RegistrationKernelCombinatorBase); itkNewMacro(Self); /*! Combines two kernel. * Returns a smpart pointer to an kernel that realizes the combination of two registration kernel. * @eguarantee strong * @param [in] request Referenz to the request that contains the both kernels that should be combined * @param [in] pInputFieldRepresentation Pointer to the field representation of the input space of the combined kernel; may be null. * @param [in] usePadding Indicicates how the recombinator and its functor should handel points that cannot be mapped * through both kernels (e.g. a point that is mapped by the first kernel outside of the supported region of the second * registration kernel). If the _usePadding is true, _paddingVector will be used as padding value in each of the mentioned * cases. If _usePadding value is false, than the combinator will throw an RepresentationException. * @param [in] paddingVector Vector that should be used for padding, if usePadding is true. * @return Smart pointer to the inverse kernel. * @pre input representation must be coverd by the first kernel and the mapped input representation must be covered by the input * representation of the second kernel. */ - virtual CombinedKernelBasePointer combineKernels(const RequestType& request, + CombinedKernelBasePointer combineKernels(const RequestType& request, const InputFieldRepresentationType* pInputFieldRepresentation, bool usePadding = false, - const PaddingVectorType& paddingVector = PaddingVectorType(0.0)) const; + const PaddingVectorType& paddingVector = PaddingVectorType(0.0)) const override; /*! Uses the passed request data to check if the provider is able to provide the service for * this request. * @return Indicates if the provider offers the right solution. * @retval true Provider can handle the request. * @retval false Provider is not able to handle the request.*/ - virtual bool canHandleRequest(const RequestType& request) const; + bool canHandleRequest(const RequestType& request) const override; /*! Returns an ID of the provider as string. Calls getStaticProviderName(). * @return Service provider ID.*/ - virtual String getProviderName() const; + String getProviderName() const override; /*! Returns an ID of the provider as string. * @return Service provider ID.*/ static String getStaticProviderName(); /*! Returns an ID of the provider as string. May be equal to GetClassName(), but it may differ. * @return Service provider ID. * @remark It is a return by value, becaus it might be possible that the description is generated on line * when calling this method.*/ - virtual String getDescription() const; + String getDescription() const override; protected: NullRegistrationKernelCombinator() {}; - virtual ~NullRegistrationKernelCombinator() {}; + ~NullRegistrationKernelCombinator() override {}; private: NullRegistrationKernelCombinator(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapNullRegistrationKernelCombinator.tpp" #endif #endif diff --git a/Code/Core/include/mapNullRegistrationKernelInverter.h b/Code/Core/include/mapNullRegistrationKernelInverter.h index ff1b3d3..450e7a9 100644 --- a/Code/Core/include/mapNullRegistrationKernelInverter.h +++ b/Code/Core/include/mapNullRegistrationKernelInverter.h @@ -1,123 +1,123 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_NULL_REGISTRATION_KERNEL_INVERTER_H #define __MAP_NULL_REGISTRATION_KERNEL_INVERTER_H #include "mapRegistrationKernelInverterBase.h" #include "mapNullRegistrationKernel.h" namespace map { namespace core { /*! @class NullRegistrationKernelInverter * @brief Provider that is able to invert a NullRegistrationKernel. * * A NullRegistrationKernel will always result in a NullRegistrationKernel if inverted. * * @ingroup RegOperation * @tparam VInputDimensions Dimensions of the input space of the kernel that should be inverted. * @tparam VOutputDimensions Dimensions of the output space of the kernel that should be inverted. */ template class NullRegistrationKernelInverter : public RegistrationKernelInverterBase { public: /*! Standard class typedefs. */ typedef NullRegistrationKernelInverter Self; typedef RegistrationKernelInverterBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(NullRegistrationKernelInverter, RegistrationKernelInverterBase); itkNewMacro(Self); - typedef typename Superclass::KernelBaseType KernelBaseType; - typedef typename Superclass::KernelBasePointer KernelBasePointer; - typedef typename Superclass::InverseKernelBaseType InverseKernelBaseType; - typedef typename Superclass::InverseKernelBasePointer InverseKernelBasePointer; - typedef typename Superclass::FieldRepresentationType FieldRepresentationType; - typedef typename Superclass::InverseFieldRepresentationType InverseFieldRepresentationType; - typedef typename Superclass::RequestType RequestType; + using KernelBaseType = typename Superclass::KernelBaseType; + using KernelBasePointer = typename Superclass::KernelBasePointer; + using InverseKernelBaseType = typename Superclass::InverseKernelBaseType; + using InverseKernelBasePointer = typename Superclass::InverseKernelBasePointer; + using FieldRepresentationType = typename Superclass::FieldRepresentationType; + using InverseFieldRepresentationType = typename Superclass::InverseFieldRepresentationType; + using RequestType = typename Superclass::RequestType; typedef NullRegistrationKernel KernelType; - typedef typename Superclass::NullPointType NullPointType; + using NullPointType = typename Superclass::NullPointType; /*! Uses the passed request data to check if the provider is able to provide the service for * this request. * @return Indicates if the provider offers the right solution. * @retval true Provider can handle the request. * @retval false Provider is not able to handle the request.*/ virtual bool canHandleRequest(const RequestType& request) const; /*! Returns an ID of the provider as string. Calls getStaticProviderName(). * @return Service provider ID.*/ virtual String getProviderName() const; /*! Returns an ID of the provider as string. * @return Service provider ID.*/ static String getStaticProviderName(); /*! Returns an ID of the provider as string. May be equal to GetClassName(), but it may differ. * @return Service provider ID. * @remark It is a return by value, becaus it might be possible that the description is generated on line * when calling this method.*/ virtual String getDescription() const; /*! Generates the inverse kernel. * Returns a smpart pointer to an inverted version of the kernel. * @eguarantee strong * @param [in] request Referenz to the kernel that should be inverted * @param [in] pFieldRepresentation Pointer to the field representation of the kernel, * may be null if no representation is defined. * @param [in] pInverseFieldRepresentation Pointer to the field representation of the inverse kernel, * may not be NULL, if the transform model cannot be inverted analyticaly. * @return Smart pointer to the inverse kernel. * @pre The inverter service provider may require the inverse field representation * @post If the method returns with no exception, there is always an inverse kernel (smart pointer is not NULL) * @remark This function might cause an exception/assertion if the responsible service provider needs * pInverseFieldRepresentation not to be NULL but it is. */ - virtual InverseKernelBasePointer invertKernel(const KernelBaseType& kernel, + InverseKernelBasePointer invertKernel(const KernelBaseType& kernel, const FieldRepresentationType* pFieldRepresentation, const InverseFieldRepresentationType* pInverseFieldRepresentation, bool useNullPoint = false, NullPointType nullPoint = NullPointType( itk::NumericTraits< ::map::core::continuous::ScalarType>::NonpositiveMin())) const override; protected: NullRegistrationKernelInverter(); virtual ~NullRegistrationKernelInverter() {}; private: NullRegistrationKernelInverter(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapNullRegistrationKernelInverter.tpp" #endif #endif diff --git a/Code/Core/include/mapObserverSentinel.h b/Code/Core/include/mapObserverSentinel.h index 8196eb4..d32652a 100644 --- a/Code/Core/include/mapObserverSentinel.h +++ b/Code/Core/include/mapObserverSentinel.h @@ -1,80 +1,80 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_OBSERVER_SENTINEL_H #define __MAP_OBSERVER_SENTINEL_H #include "itkObject.h" #include "itkCommand.h" #include "mapMacros.h" #include "mapMAPCoreExports.h" namespace map { namespace core { /*! @class ObserverSentinel @brief Adds an observer to a given object and removes the observer when the sentinel is deleted. */ class MAPCore_EXPORT ObserverSentinel : public ::itk::Object { public: - typedef ObserverSentinel Self; - typedef ::itk::Object Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = ObserverSentinel; + using Superclass = ::itk::Object; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(ObserverSentinel, ::itk::Object); static Pointer New(::itk::Object* pObserverOwner, const ::itk::EventObject& event, itk::Command* pCmd); - virtual ::itk::LightObject::Pointer CreateAnother(void) const; + ::itk::LightObject::Pointer CreateAnother() const override; - typedef unsigned long ObserverTagType; + using ObserverTagType = unsigned long; ObserverTagType getObserverTage() const; protected: /*! @pre pObserverOwner and pCmd must not be NULL.*/ ObserverSentinel(::itk::Object* pObserverOwner, const ::itk::EventObject& event, itk::Command* pCmd); - virtual ~ObserverSentinel(); + ~ObserverSentinel() override; private: ObserverTagType _tag; ::itk::Object::Pointer _spObject; //No copy constructor allowed - ObserverSentinel(const Self& source); - void operator=(const Self&); //purposely not implemented + ObserverSentinel(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; - } -} + } // namespace core +} // namespace map #endif diff --git a/Code/Core/include/mapPMVolume.h b/Code/Core/include/mapPMVolume.h index 9a01adb..282c7b7 100644 --- a/Code/Core/include/mapPMVolume.h +++ b/Code/Core/include/mapPMVolume.h @@ -1,165 +1,165 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_PM_VOLUME_H #define __MAP_PM_VOLUME_H #include #include #include "mapContinuous.h" #include "mapMacros.h" #include "mapMAPCoreExports.h" namespace map { namespace core { namespace continuous { /*! @class PMVolume * @brief Represents a continuouse volume by a bounding box. * * Serves as continuouse analogy for the discrete image region. * The difference between the class Volume and PMVolume is that * PMVolume isn't templated by the dimension number, thus it * is somehow a variant container for normal volume information * that can be treated polymorphically. Therefore the prefix * PM stands for poly morphic. * @sa Volume * @sa ImageRegion * * @ingroup Continuous */ class MAPCore_EXPORT PMVolume { public: /*! Standard class typedefs. */ - typedef PMVolume Self; + using Self = PMVolume; /*! Dimension of the volume available at run time. */ unsigned int getVolumeDimension() const; /*! Point typedef support.*/ - typedef ScalarType PointValueType; - typedef std::vector PointType; - typedef PointValueType OriginValueType; - typedef PointType OriginType; + using PointValueType = ScalarType; + using PointType = std::vector; + using OriginValueType = PointValueType; + using OriginType = PointType; /*! Size typedef support. A size is used to define volume bounds. */ - typedef ScalarType SizeValueType; - typedef std::vector SizeType; + using SizeValueType = ScalarType; + using SizeType = std::vector; /*! Constructor. PMVolume is a lightweight object that is not reference * counted, so the constructor is public. * * @eguarantee strong */ PMVolume(); /*! Destructor. PMVolume is a lightweight object that is not reference * counted and not supposed to be a base object, so the destructor is non virtual public. * @eguarantee none throw*/ ~PMVolume(); /*! Copy constructor. PMVolume is a lightweight object that is not * reference counted, so the copy constructor is public. * @eguarantee strong */ PMVolume(const Self& volume); /*! Constructor that takes an origin and size. PMVolume is a lightweight * object that is not reference counted, so this constructor is public. * @eguarantee strong * @param [in] origin Values of the volume origin. * @param [in] size Values of the volume size. * @pre Origin and size must have the same vector size.*/ PMVolume(const OriginType& origin, const SizeType& size); /*! Constructor that takes a size and assumes an origin of zero. PMVolume * is lightweight object that is not reference counted so this constructor * is public. * @eguarantee strong */ - PMVolume(const SizeType& size); + PMVolume(SizeType size); /*! operator=. PMVolume is a lightweight object that is not reference * counted, so operator= is public. * @eguarantee basic */ void operator=(const Self& volume); /*! operator==. Checks if two PMVolume instance define the same volume. * @eguarantee basic */ bool operator==(const Self& volume) const; /*! Set the origin defining the corner of the region. * @eguarantee strong */ void setOrigin(const OriginType& origin); /*! Get the point defining the origin of the volume. * @eguarantee strong */ const OriginType& getOrigin() const; /*! Set the size of the volume. This plus the origin determines the * rectangular shape, or extent, of the volume. * @eguarantee strong */ void setSize(const SizeType& size); /*! Get the size of the volume. * @eguarantee strong */ const SizeType& getSize() const; /*! Convenience methods to set the size of the particular dimension i. * @param [in] i Index of the particular dimension; must be within the range * of the volume dimensions (0..getVolumeDimension()-1). * @pre see parameters*/ void setSize(unsigned long i, SizeValueType sze); /*! Convenience methods to get the size of the particular dimension i. * @param [in] i Index of the particular dimension; must be within the range * of the volume dimensions (0..getVolumeDimension()-1). * @pre see parameters*/ SizeValueType getSize(unsigned long i) const; /*! Convenience methods to set the origin value of the particular dimension i. * @param [in] i Index of the particular dimension; must be within the range * of the volume dimensions (0..getVolumeDimension()-1). * @pre see parameters*/ void setOrigin(unsigned long i, OriginValueType sze); /*! Convenience methods to get the origin value of the particular dimension i. * @param [in] i Index of the particular dimension; must be within the range * of the volume dimensions (0..getVolumeDimension()-1). * @pre see parameters*/ OriginValueType getOrigin(unsigned long i) const; protected: OriginType _origin; SizeType _size; }; MAPCore_EXPORT std::ostream& operator<<(std::ostream& os, const PMVolume& volume); } // end namespace continuous } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapPointSetByModelPerformer.h b/Code/Core/include/mapPointSetByModelPerformer.h index b1b2030..f474642 100644 --- a/Code/Core/include/mapPointSetByModelPerformer.h +++ b/Code/Core/include/mapPointSetByModelPerformer.h @@ -1,122 +1,122 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_POINT_SET_BY_MODEL_PERFORMER_H #define __MAP_POINT_SET_BY_MODEL_PERFORMER_H #include "mapMappingPerformerBase.h" #include "mapPointSetMappingPerformerRequest.h" #include "mapRegistrationKernel.h" namespace map { namespace core { /*! @class PointSetByModelPerformer * @brief Performer class that maps point data by using a transformation model kernel. * * @ingroup MappingTask * @tparam TRegistration the registration class, that should be used to perform the task. * @tparam TInputData Type of the data in the input space. * @tparam TResultData Type of the data in the target space. */ template class PointSetByModelPerformer : public MappingPerformerBase< PointSetMappingPerformerRequest > { public: typedef PointSetMappingPerformerRequest RequestType; /*! Standard class typedefs. */ typedef PointSetByModelPerformer Self; - typedef MappingPerformerBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Superclass = MappingPerformerBase; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(PointSetByModelPerformer, MappingPerformerBase); itkNewMacro(Self); - typedef typename Superclass::RegistrationType RegistrationType; + using RegistrationType = typename Superclass::RegistrationType; - typedef typename Superclass::InputDataType InputDataType; - typedef typename Superclass::InputDataConstPointer InputDataConstPointer; - typedef typename Superclass::ResultDataType ResultDataType; - typedef typename Superclass::ResultDataPointer ResultDataPointer; + using InputDataType = typename Superclass::InputDataType; + using InputDataConstPointer = typename Superclass::InputDataConstPointer; + using ResultDataType = typename Superclass::ResultDataType; + using ResultDataPointer = typename Superclass::ResultDataPointer; /*! Registers the input data and returns the result data. * @eguarantee strong * @param [in] request Referenz to the request that contains the registration and the input data * @return Smart pointer to the result image. */ virtual ResultDataPointer performMapping(const RequestType& request) const; /*! Uses the passed request data to check if the provider is able to provide the service for * this request. * @return Indicates if the provider offers the right solution. * @retval true Provider can handle the request. * @retval false Provider is not able to handle the request.*/ virtual bool canHandleRequest(const RequestType& request) const; /*! Returns an ID of the provider as string. Calls getStaticProviderName(). * @return Service provider ID.*/ virtual String getProviderName() const; /*! Returns an ID of the provider as string. * @return Service provider ID.*/ static String getStaticProviderName(); /*! Returns an ID of the provider as string. May be equal to GetClassName(), but it may differ. * @return Service provider ID. * @remark It is a return by value, becaus it might be possible that the description is generated on line * when calling this method.*/ virtual String getDescription() const; #ifdef ITK_USE_CONCEPT_CHECKING /** Begin concept checking */ itkConceptMacro(InputDataFitsRegistrationCheck, (itk::Concept::SameDimension)); itkConceptMacro(ResultDataFitsRegistrationCheck, (itk::Concept::SameDimension)); /** End concept checking */ #endif protected: - typedef typename RegistrationType::DirectMappingType DirectKernelBaseType; + using DirectKernelBaseType = typename RegistrationType::DirectMappingType; typedef RegistrationKernel ModelKernelType; PointSetByModelPerformer(); virtual ~PointSetByModelPerformer(); private: PointSetByModelPerformer(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapPointSetByModelPerformer.tpp" #endif #endif diff --git a/Code/Core/include/mapPointSetMappingPerformerLoadPolicy.h b/Code/Core/include/mapPointSetMappingPerformerLoadPolicy.h index 233a19b..50fc01e 100644 --- a/Code/Core/include/mapPointSetMappingPerformerLoadPolicy.h +++ b/Code/Core/include/mapPointSetMappingPerformerLoadPolicy.h @@ -1,75 +1,75 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_POINT_MAPPING_PERFORMER_LOAD_POLICY_H #define __MAP_POINT_MAPPING_PERFORMER_LOAD_POLICY_H # include "mapGenericStaticLoadPolicyBase.h" namespace map { namespace core { /*! @class PointSetMappingPerformerLoadPolicy * @brief Load class used by PointMappingTask to populate its service stack. * * It loads the following providers: * - PointByModelPerformer * - PointByFieldPerformer * . * * @ingroup LoadPolicies * @ingroup RegTasks * @sa PointMappingTask * @tparam TProviderBase Base class of the service providers loaded by the policy. */ template class PointSetMappingPerformerLoadPolicy : public services::GenericStaticLoadPolicyBase { protected: /*! Standard class typedefs. */ - typedef services::GenericStaticLoadPolicyBase Superclass; - typedef typename Superclass::ProviderBaseType ProviderBaseType; - typedef typename Superclass::ProviderBasePointer ProviderBasePointer; - typedef typename Superclass::LoadInterfaceType LoadInterfaceType; + using Superclass = services::GenericStaticLoadPolicyBase; + using ProviderBaseType = typename Superclass::ProviderBaseType; + using ProviderBasePointer = typename Superclass::ProviderBasePointer; + using LoadInterfaceType = typename Superclass::LoadInterfaceType; virtual void doLoading(); PointSetMappingPerformerLoadPolicy(); ~PointSetMappingPerformerLoadPolicy(); private: PointSetMappingPerformerLoadPolicy(const PointSetMappingPerformerLoadPolicy&); //purposely not implemented void operator=(const PointSetMappingPerformerLoadPolicy&); //purposely not implemented }; } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapPointSetMappingPerformerLoadPolicy.tpp" #endif #endif diff --git a/Code/Core/include/mapPointSetMappingPerformerRequest.h b/Code/Core/include/mapPointSetMappingPerformerRequest.h index da45646..3e6d87f 100644 --- a/Code/Core/include/mapPointSetMappingPerformerRequest.h +++ b/Code/Core/include/mapPointSetMappingPerformerRequest.h @@ -1,108 +1,108 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_POINTSET_MAPPING_PERFORMER_REQUEST_H #define __MAP_POINTSET_MAPPING_PERFORMER_REQUEST_H #include "mapMappingPerformerRequestBase.h" #include namespace map { namespace core { /*! @class PointSetMappingPerformerRequest * This class is used by MappingPerformer for requests dealing with pointsets. * @ingroup MappingTask * @sa MappingPerformerBase * @sa PointMappingPerformerBase * @tparam TRegistration the registration class, that should be used to perform the task. * @tparam TInputData Type of the input data. * @tparam TResultData Type of the data in the target space. */ template class PointSetMappingPerformerRequest: public MappingPerformerRequestBase { public: typedef MappingPerformerRequestBase Superclass; - typedef typename Superclass::ResultDataType ResultDataType; - typedef typename Superclass::RegistrationType RegistrationType; - typedef typename Superclass::InputDataType InputDataType; - typedef typename ResultDataType::PixelType ErrorPointValueType; + using ResultDataType = typename Superclass::ResultDataType; + using RegistrationType = typename Superclass::RegistrationType; + using InputDataType = typename Superclass::InputDataType; + using ErrorPointValueType = typename ResultDataType::PixelType; PointSetMappingPerformerRequest(const RegistrationType* pRegistration, const InputDataType* pInputData, bool throwOnMappingError, const ErrorPointValueType& errorValue); virtual ~PointSetMappingPerformerRequest(); - PointSetMappingPerformerRequest(const PointSetMappingPerformerRequest&); + PointSetMappingPerformerRequest(const PointSetMappingPerformerRequest& /*other*/); - void operator=(const PointSetMappingPerformerRequest&); + void operator=(const PointSetMappingPerformerRequest& /*other*/); bool _throwOnMappingError; ErrorPointValueType _errorValue; }; template std::ostream& operator<<(std::ostream& os, const PointSetMappingPerformerRequest& request) { os << "Registration: "; if (request._spRegistration.IsNull()) { os << "NULL" << std::endl; } else { os << request._spRegistration << std::endl; }; os << "Input data: "; if (request._spInputData.IsNull()) { os << "NULL" << std::endl; } else { os << request._spInputData << std::endl; }; os << "ThrowOnMappingError: " << request._throwOnMappingError << std::endl; os << "Error value: " << request._errorValue << std::endl; return os; }; } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapPointSetMappingPerformerRequest.tpp" #endif #endif diff --git a/Code/Core/include/mapPointSetMappingTask.h b/Code/Core/include/mapPointSetMappingTask.h index 27ea939..23fb687 100644 --- a/Code/Core/include/mapPointSetMappingTask.h +++ b/Code/Core/include/mapPointSetMappingTask.h @@ -1,153 +1,153 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_POINT_MAPPING_TASK_H #define __MAP_POINT_MAPPING_TASK_H #include "mapStaticServiceStack.h" #include "mapMappingTaskBase.h" #include "mapMappingPerformerBase.h" #include "mapPointSetMappingPerformerLoadPolicy.h" #include "mapPointSetMappingPerformerRequest.h" #include "itkObject.h" namespace map { namespace core { /*! @class PointSetMappingTask * @brief Class realizes tasks, that map point set data. * * @ingroup MappingTask * @ingroup Registration * @tparam TRegistration the registration class, that should be used to perform the task. * @tparam TInputPointSet Type of the point set in the input space. * @tparam TResultPointSet Type of the point set in the target space. * @tparam TLoadPolicy the load policy that should be used for the provider stack of the point set task. */ template class TLoadPolicy = PointSetMappingPerformerLoadPolicy> class PointSetMappingTask: public MappingTaskBase { public: /*! Standard class typedefs. */ typedef PointSetMappingTask Self; - typedef MappingTaskBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Superclass = MappingTaskBase; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; - typedef typename MappingTaskBase::RegistrationType RegistrationType; - typedef TInputPointSet InputPointSetType; - typedef typename InputPointSetType::ConstPointer InputPointSetConstPointer; - typedef TResultPointSet ResultPointSetType; - typedef typename ResultPointSetType::Pointer ResultPointSetPointer; - typedef typename ResultPointSetType::PixelType ErrorPointValueType; + using RegistrationType = typename MappingTaskBase::RegistrationType; + using InputPointSetType = TInputPointSet; + using InputPointSetConstPointer = typename InputPointSetType::ConstPointer; + using ResultPointSetType = TResultPointSet; + using ResultPointSetPointer = typename ResultPointSetType::Pointer; + using ErrorPointValueType = typename ResultPointSetType::PixelType; typedef PointSetMappingPerformerRequest PerformerRequestType; - typedef MappingPerformerBase TaskPerformerBaseType; + using TaskPerformerBaseType = MappingPerformerBase; itkTypeMacro(PointSetMappingTask, MappingTaskBase); itkNewMacro(Self); #ifdef ITK_USE_CONCEPT_CHECKING /** Begin concept checking */ itkConceptMacro(InputPointSetFitsRegistrationCheck, (itk::Concept::SameDimension)); itkConceptMacro(ResultPointSetFitsRegistrationCheck, (itk::Concept::SameDimension)); /** End concept checking */ #endif protected: - typedef TLoadPolicy LoadPolicyType; + using LoadPolicyType = TLoadPolicy; typedef services::ServiceStack ConcreteTaskPerformerStackType; public: - typedef services::StaticServiceStack TaskPerformerStackType; + using TaskPerformerStackType = services::StaticServiceStack; /*! Sets _spInputPoints to inputPoints and sets _spResultPoints to null. * @param [in] inputPoints The pointer to the input points*/ void setInputPointSet(const InputPointSetType* inputPoints); const InputPointSetType* getInputPointSet() const; /*! Returns _spResultPoints. If the smart pointer is null the method will call execute() to * register the input data. * @post _spResultPoints is set. * @pre _spInputPoints and _spRegistration are not null.*/ - ResultPointSetPointer getResultPointSet(void); + ResultPointSetPointer getResultPointSet(); void setThrowOnMappingError(bool throwOnError); bool getThrowOnMappingError() const; void setErrorPointValue(const ErrorPointValueType& value); const ErrorPointValueType& getErrorPointValue() const; protected: PointSetMappingTask(); virtual ~PointSetMappingTask(); InputPointSetConstPointer _spInputPoints; mutable ResultPointSetPointer _spResultPoints; /*! Indicates the error handling strategie if the kernel is not sufficient to map a point in the point set (e.g. point is not inside * the deformation field of a field based kernel). True: an exception will be thrown; false: point will be copied into the result list * and marked as incorrect via _errorValue.*/ bool _throwOnMappingError; /*! Value used to label points in the result set that could not be mapped because of an mapping error. * This is only relevant, if _throwOnMappingError is true.*/ ErrorPointValueType _errorValue; /*! Performs the mapping of the input point set. * @eguarantee strong * @pre _inputPoints must have been set. * @post _resultPoints are set. */ - virtual void doExecution(void) const; + virtual void doExecution() const; - virtual void clearResults(void) const; + virtual void clearResults() const; /*! clears all input datas of the task used to execute(). * @eguarantee strong */ - virtual void clearInputs(void); + virtual void clearInputs(); /*! Methods invoked by itk::LightObject::Print(). */ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; private: PointSetMappingTask(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapPointSetMappingTask.tpp" #endif #endif diff --git a/Code/Core/include/mapPointSetMappingTask.tpp b/Code/Core/include/mapPointSetMappingTask.tpp index c6e57a1..69dde3f 100644 --- a/Code/Core/include/mapPointSetMappingTask.tpp +++ b/Code/Core/include/mapPointSetMappingTask.tpp @@ -1,191 +1,191 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_POINT_MAPPING_TASK_TPP #define __MAP_POINT_MAPPING_TASK_TPP #include "mapPointSetMappingTask.h" #include "mapMissingProviderException.h" namespace map { namespace core { template class TLoadPolicy> void PointSetMappingTask:: setInputPointSet(const InputPointSetType* inputPoints) { if (_spInputPoints != inputPoints) { _spInputPoints = inputPoints; clearResults(); this->Modified(); } } template class TLoadPolicy> const typename PointSetMappingTask::InputPointSetType* PointSetMappingTask:: getInputPointSet() const { return _spInputPoints; } template class TLoadPolicy> typename PointSetMappingTask::ResultPointSetPointer PointSetMappingTask:: - getResultPointSet(void) + getResultPointSet() { if (_spResultPoints.IsNull()) { this->execute(); } assert(_spResultPoints.IsNotNull()); return _spResultPoints; } template class TLoadPolicy> PointSetMappingTask:: PointSetMappingTask() { _errorValue = itk::NumericTraits::Zero; _throwOnMappingError = true; _spResultPoints = NULL; _spInputPoints = NULL; } template class TLoadPolicy> PointSetMappingTask:: ~PointSetMappingTask() { } template class TLoadPolicy> void PointSetMappingTask:: - doExecution(void) const + doExecution() const { if (_spInputPoints.IsNull()) { mapExceptionMacro(ServiceException, << "Cannot register point set. Input point set is null."); } PerformerRequestType request(Superclass::_spRegistration, _spInputPoints, _throwOnMappingError, _errorValue); mapLogInfoMacro( << "Register pointset. Request: " << request); TaskPerformerBaseType* pPerformer = TaskPerformerStackType::getProvider(request); if (!pPerformer) { mapExceptionMacro(MissingProviderException, << "No responsible registration performer available for given request. Request:" << request); } _spResultPoints = pPerformer->performMapping(request); assert(_spResultPoints.IsNotNull()); } template class TLoadPolicy> void PointSetMappingTask:: - clearResults(void) const + clearResults() const { _spResultPoints = NULL; } template class TLoadPolicy> void PointSetMappingTask:: - clearInputs(void) + clearInputs() { _spInputPoints = NULL; } template class TLoadPolicy> void PointSetMappingTask:: setThrowOnMappingError(bool throwOnError) { if (throwOnError != _throwOnMappingError) { _throwOnMappingError = throwOnError; this->Modified(); } }; template class TLoadPolicy> bool PointSetMappingTask:: getThrowOnMappingError() const { return _throwOnMappingError; }; template class TLoadPolicy> void PointSetMappingTask:: setErrorPointValue(const ErrorPointValueType& value) { if (value != _errorValue) { _errorValue = value; this->Modified(); } }; template class TLoadPolicy> const typename PointSetMappingTask::ErrorPointValueType& PointSetMappingTask:: getErrorPointValue() const { return _errorValue; }; template class TLoadPolicy> void PointSetMappingTask:: PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "InputPoints: " << _spInputPoints.GetPointer() << std::endl; os << indent << "ResultPoints: " << _spResultPoints.GetPointer() << std::endl; os << indent << "ThrowOnMappingError: " << _throwOnMappingError << std::endl; os << indent << "ErrorValue: " << _errorValue << std::endl; } } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapPointVectorCombinationPolicy.h b/Code/Core/include/mapPointVectorCombinationPolicy.h index a0c222c..d9dcf38 100644 --- a/Code/Core/include/mapPointVectorCombinationPolicy.h +++ b/Code/Core/include/mapPointVectorCombinationPolicy.h @@ -1,178 +1,178 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_POINT_VECTOR_COMBINATION_POLICY_H #define __MAP_POINT_VECTOR_COMBINATION_POLICY_H #include "mapFieldRepresentationDescriptor.h" #include "mapRegistrationTopology.h" #include "itkObject.h" namespace map { namespace core { /*! @class PointVectorCombinationPolicy * @brief Class defines the rule for combining points and vectors of any dimensionality. * * This helper class is used by MatchPoint for mapping purposes of arbitrary dimensionality. * It handles the mapping of points by vectors of arbitrary dimensionality. Missing dimensions * will be substituted with 0. Surplus dimensions will be skipped. Vectors and points will be * aligned at the first dimension. * * @ingroup Registration * @tparam VInDimensions Dimension count of the first operand type. * @tparam VOutDimensions Dimension count of the output type. */ template class PointVectorCombinationPolicy { public: - typedef typename continuous::Elements::PointType PointType; - typedef typename continuous::Elements::VectorType VectorType; - typedef typename continuous::Elements::PointType OutputPointType; - typedef typename continuous::Elements::VectorType OutputVectorType; + using PointType = typename continuous::Elements::PointType; + using VectorType = typename continuous::Elements::VectorType; + using OutputPointType = typename continuous::Elements::PointType; + using OutputVectorType = typename continuous::Elements::VectorType; static inline void mapPoint(const PointType& inPoint, const OutputVectorType& mappingVector, OutputPointType& outPoint) { doAdd(inPoint, mappingVector, outPoint); }; /*!mapping as an direct conversion (mapping vector is zero)*/ static inline void mapPoint(const PointType& inPoint, OutputPointType& outPoint) { OutputVectorType mappingVector; mappingVector.Fill(itk::NumericTraits::Zero); doAdd(inPoint, mappingVector, outPoint); }; static inline void combineVectors(const VectorType& vector1, const OutputVectorType& vector2, OutputVectorType& outVector) { doAdd(vector1, vector2, outVector); }; static inline void computeVector(const PointType& fromPoint, const OutputPointType& toPoint, OutputVectorType& outVector) { doSubtract(toPoint, fromPoint, outVector); }; static inline bool isDefaultImplementation() { return true; }; private: template < typename T1stOp, typename T2ndOp, typename TResultType> static inline void doAdd(const T1stOp& op1, const T2ndOp& op2, TResultType& result) { for (unsigned int i = 0; i < TResultType::Dimension; ++i) { typename T1stOp::ValueType v1 = (i < T1stOp::Dimension ? op1[i] : itk::NumericTraits::Zero); typename T2ndOp::ValueType v2 = (i < T2ndOp::Dimension ? op2[i] : itk::NumericTraits::Zero); result[i] = v1 + v2; } }; template < typename T1stOp, typename T2ndOp, typename TResultType> static inline void doSubtract(const T1stOp& op1, const T2ndOp& op2, TResultType& result) { for (unsigned int i = 0; i < TResultType::Dimension; ++i) { typename T1stOp::ValueType v1 = (i < T1stOp::Dimension ? op1[i] : itk::NumericTraits::Zero); typename T2ndOp::ValueType v2 = (i < T2ndOp::Dimension ? op2[i] : itk::NumericTraits::Zero); result[i] = v1 - v2; } }; typedef PointVectorCombinationPolicy Self; PointVectorCombinationPolicy(); //purposely not implemented virtual ~PointVectorCombinationPolicy(); //purposely not implemented PointVectorCombinationPolicy(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; /*! @class PointVectorCombinationPolicy * @brief Template specialication for the case that input point and mapping vector are of the same dimensionality. * * @ingroup Registration * @tparam VDimensions Dimensionality of the operands. */ template class PointVectorCombinationPolicy { public: - typedef typename continuous::Elements::PointType PointType; - typedef typename continuous::Elements::VectorType VectorType; - typedef typename continuous::Elements::PointType OutputPointType; - typedef typename continuous::Elements::VectorType OutputVectorType; + using PointType = typename continuous::Elements::PointType; + using VectorType = typename continuous::Elements::VectorType; + using OutputPointType = typename continuous::Elements::PointType; + using OutputVectorType = typename continuous::Elements::VectorType; static inline void mapPoint(const PointType& inPoint, const OutputVectorType& mappingVector, OutputPointType& outPoint) { outPoint = inPoint + mappingVector; }; /*!mapping as an direct conversion (mapping vector is zero)*/ static inline void mapPoint(const PointType& inPoint, OutputPointType& outPoint) { outPoint = inPoint; }; static inline void combineVectors(const VectorType& vector1, const OutputVectorType& vector2, OutputVectorType& outVector) { outVector = vector1 + vector2; }; static inline void computeVector(const PointType& fromPoint, const OutputPointType& toPoint, OutputVectorType& outVector) { outVector = toPoint - fromPoint; }; static inline bool isDefaultImplementation() { return false; }; private: typedef PointVectorCombinationPolicy Self; PointVectorCombinationPolicy(); //purposely not implemented virtual ~PointVectorCombinationPolicy(); //purposely not implemented PointVectorCombinationPolicy(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapPreCachedKernelCombinator.h b/Code/Core/include/mapPreCachedKernelCombinator.h index 0512136..4bf17ed 100644 --- a/Code/Core/include/mapPreCachedKernelCombinator.h +++ b/Code/Core/include/mapPreCachedKernelCombinator.h @@ -1,146 +1,146 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_PRE_CACHED_KERNEL_COMBINATOR_H #define __MAP_PRE_CACHED_KERNEL_COMBINATOR_H #include "mapRegistrationKernelCombinatorBase.h" #include "mapPreCachedRegistrationKernel.h" namespace map { namespace core { /*! @class PreCachedKernelCombinator * @brief Combinator class that combines two PreCached kernels to a new kernel. * If the Kernels can be decomposed to a matrix transform, the will be directly composed to * a new matrix transform. In all other cases they will be packed into a aggregating transform * wrapper. * @remark Currently it can only handle combinations of same dimensionality * @ingroup RegOperation * @tparam VInputDimensions Dimensions of the input space of the first kernel. * @tparam VInterimDimensions Dimensions of the output space of the first kernel and the input space of the second. * @tparam VOutputDimensions Dimensions of the output space of the second kernel. */ template class PreCachedKernelCombinator : public RegistrationKernelCombinatorBase< VInputDimensions, VInterimDimensions, VOutputDimensions > { public: /*! Standard class typedefs. */ typedef PreCachedKernelCombinator< VInputDimensions, VInterimDimensions, VOutputDimensions > Self; typedef RegistrationKernelCombinatorBase< VInputDimensions, VInterimDimensions, VOutputDimensions > Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; - typedef typename Superclass::Kernel1BaseType Kernel1BaseType; - typedef typename Superclass::Kernel1BasePointer Kernel1BasePointer; - typedef typename Superclass::Kernel2BaseType Kernel2BaseType; - typedef typename Superclass::Kernel2BasePointer Kernel2BasePointer; + using Kernel1BaseType = typename Superclass::Kernel1BaseType; + using Kernel1BasePointer = typename Superclass::Kernel1BasePointer; + using Kernel2BaseType = typename Superclass::Kernel2BaseType; + using Kernel2BasePointer = typename Superclass::Kernel2BasePointer; - typedef typename Superclass::CombinedKernelBaseType CombinedKernelBaseType; - typedef typename Superclass::CombinedKernelBasePointer CombinedKernelBasePointer; + using CombinedKernelBaseType = typename Superclass::CombinedKernelBaseType; + using CombinedKernelBasePointer = typename Superclass::CombinedKernelBasePointer; - typedef typename Superclass::RequestType RequestType; + using RequestType = typename Superclass::RequestType; - typedef typename Superclass::InputFieldRepresentationType InputFieldRepresentationType; - typedef typename Superclass::InterimFieldRepresentationType InterimFieldRepresentationType; + using InputFieldRepresentationType = typename Superclass::InputFieldRepresentationType; + using InterimFieldRepresentationType = typename Superclass::InterimFieldRepresentationType; - typedef typename Superclass::PaddingVectorType PaddingVectorType; + using PaddingVectorType = typename Superclass::PaddingVectorType; typedef PreCachedRegistrationKernel Kernel1Type; - typedef typename Kernel1Type::Pointer Kernel1Pointer; + using Kernel1Pointer = typename Kernel1Type::Pointer; typedef PreCachedRegistrationKernel Kernel2Type; - typedef typename Kernel2Type::Pointer Kernel2Pointer; + using Kernel2Pointer = typename Kernel2Type::Pointer; itkTypeMacro(PreCachedKernelCombinator, RegistrationKernelCombinatorBase); itkNewMacro(Self); /*! Combines two kernel. * Returns a smpart pointer to an kernel that realizes the combination of two registration kernel. * @eguarantee strong * @param [in] request Referenz to the request that contains the both kernels that should be combined * @param [in] pInputFieldRepresentation Pointer to the field representation of the input space of the combined kernel; may be null. * @param [in] usePadding Indicicates how the recombinator and its functor should handel points that cannot be mapped * through both kernels (e.g. a point that is mapped by the first kernel outside of the supported region of the second * registration kernel). If the _usePadding is true, _paddingVector will be used as padding value in each of the mentioned * cases. If _usePadding value is false, than the combinator will throw an RepresentationException. * @param [in] paddingVector Vector that should be used for padding, if usePadding is true. * @return Smart pointer to the inverse kernel. * @pre input representation must be coverd by the first kernel and the mapped input representation must be covered by the input * representation of the second kernel. * @pre in its current implementation matrix combination is only possible when input, interim and output dimension are equal. */ - virtual CombinedKernelBasePointer combineKernels(const RequestType& request, + CombinedKernelBasePointer combineKernels(const RequestType& request, const InputFieldRepresentationType* pInputFieldRepresentation, bool usePadding = false, - const PaddingVectorType& paddingVector = PaddingVectorType(0.0)) const; + const PaddingVectorType& paddingVector = PaddingVectorType(0.0)) const override; /*! Uses the passed request data to check if the provider is able to provide the service for * this request. * @return Indicates if the provider offers the right solution. * @retval true Provider can handle the request. * @retval false Provider is not able to handle the request.*/ - virtual bool canHandleRequest(const RequestType& request) const; + bool canHandleRequest(const RequestType& request) const override; /*! Returns an ID of the provider as string. Calls getStaticProviderName(). * @return Service provider ID.*/ - virtual String getProviderName() const; + String getProviderName() const override; /*! Returns an ID of the provider as string. * @return Service provider ID.*/ static String getStaticProviderName(); /*! Returns an ID of the provider as string. May be equal to GetClassName(), but it may differ. * @return Service provider ID. * @remark It is a return by value, becaus it might be possible that the description is generated on line * when calling this method.*/ - virtual String getDescription() const; + String getDescription() const override; protected: PreCachedKernelCombinator() {}; - virtual ~PreCachedKernelCombinator() {}; + ~PreCachedKernelCombinator() override {}; /* Member tries to combine the given kernels as matrices and generate a new matrix * based combined kernel. This will only be successfull if both support matrix * decomposition. * @return Null if kernels cannot be combined as matrices. Otherwise it returns the pointer to the combination result.*/ CombinedKernelBasePointer combineAsMatrixKernels(const Kernel1Type* kernel1, const Kernel2Type* kernel2) const; private: PreCachedKernelCombinator(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapPreCachedKernelCombinator.tpp" #endif #endif diff --git a/Code/Core/include/mapPreCachedRegistrationKernel.h b/Code/Core/include/mapPreCachedRegistrationKernel.h index 6d90066..721a981 100644 --- a/Code/Core/include/mapPreCachedRegistrationKernel.h +++ b/Code/Core/include/mapPreCachedRegistrationKernel.h @@ -1,128 +1,127 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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: 1285 $ (last changed revision) // @date $Date: 2016-03-30 17:47:52 +0200 (Mi, 30 Mrz 2016) $ (last change date) // @author $Author: floca $ (last changed by) // Subversion HeadURL: $HeadURL: https://svn/sbr/Sources/SBR-Projects/MatchPoint/branches/Issue-1505/Code/Core/include/mapRegistrationKernel.h $ */ #ifndef __PRE_CACHED_REGISTRATION_KERNEL_H #define __PRE_CACHED_REGISTRATION_KERNEL_H #include "mapRegistrationKernel.h" #include "mapPreCachedRegistrationKernelInterface.h" /*! @namespace map The namespace map::core is for the library of MatchPoint */ namespace map { namespace core { /*! This class is the implementation of a lazy kernel. The lazy kernel * establishes its internal transformation when it is needed the first time * on the fly by using its generation functor. * @ingroup RegKernel */ template class PreCachedRegistrationKernel : public RegistrationKernel, public PreCachedRegistrationKernelInterface < VInputDimensions, VOutputDimensions > { public: typedef PreCachedRegistrationKernel Self; typedef RegistrationKernel Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkNewMacro(Self); itkTypeMacro(PreCachedRegistrationKernel, RegistrationKernel); - typedef typename Superclass::TransformType TransformType; - typedef typename Superclass::RepresentationDescriptorType RepresentationDescriptorType; - typedef typename Superclass::RepresentationDescriptorPointer RepresentationDescriptorPointer; - typedef typename Superclass::RepresentationDescriptorConstPointer - RepresentationDescriptorConstPointer; - typedef typename Superclass::InputPointType InputPointType; - typedef typename Superclass::OutputPointType OutputPointType; - typedef typename Superclass::MappingVectorType MappingVectorType; + using TransformType = typename Superclass::TransformType; + using RepresentationDescriptorType = typename Superclass::RepresentationDescriptorType; + using RepresentationDescriptorPointer = typename Superclass::RepresentationDescriptorPointer; + using RepresentationDescriptorConstPointer = typename Superclass::RepresentationDescriptorConstPointer; + using InputPointType = typename Superclass::InputPointType; + using OutputPointType = typename Superclass::OutputPointType; + using MappingVectorType = typename Superclass::MappingVectorType; /*! sets the transform @eguarantee no fail @param transform the transform that shall be set */ - virtual void setTransformModel(TransformType* transform) override; + void setTransformModel(TransformType* transform) override; /*! Returns if the transform was already created (true) or if the generation still is pending / wasn't necessary (false). @eguarantee strong */ - virtual bool transformExists() const override; + bool transformExists() const override; /*! @brief gets the largest possible representation descriptor. The descriptor defines * the space the kernel guarantees to map. * @return Smart pointer to the descriptor (may be generated dynamicaly) * @retval NULL there is no descriptor. If hasLimitedRepresentation returns false, the kernel * has no mapping limitations and covers the total input space. * @eguarantee strong */ - virtual RepresentationDescriptorConstPointer getLargestPossibleRepresentation() const override; + RepresentationDescriptorConstPointer getLargestPossibleRepresentation() const override; /*! Returns pointer to the transform model used by the kernel @eguarantee strong @return const pointer to the internal tranform model */ - virtual const TransformType* getTransformModel() const override; + const TransformType* getTransformModel() const override; - virtual const OutputPointType getNullPoint() const override; + const OutputPointType getNullPoint() const override; - virtual bool usesNullPoint() const override; + bool usesNullPoint() const override; protected: PreCachedRegistrationKernel(); - virtual ~PreCachedRegistrationKernel(); + ~PreCachedRegistrationKernel() override; - typedef typename TransformType::Pointer TransformPointer; + using TransformPointer = typename TransformType::Pointer; TransformPointer _spTransform; /*! checks the transform that has been set for correctness and prepares it to be used @eguarantee strong @return the success of the operation */ bool checkAndPrepareTransform() const override; /*! Methods invoked by itk::LightObject::Print(). */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** @reimplementation Reimplementation of the itk::LightObject::InternalClone*/ - virtual ::itk::LightObject::Pointer InternalClone() const; + ::itk::LightObject::Pointer InternalClone() const override; private: //No copy constructor allowed PreCachedRegistrationKernel(const Self& source); void operator=(const Self&); //purposely not implemented }; - } -} + } // namespace core +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapPreCachedRegistrationKernel.tpp" #endif #endif diff --git a/Code/Core/include/mapPreCachedRegistrationKernelInterface.h b/Code/Core/include/mapPreCachedRegistrationKernelInterface.h index a3cc936..93b4798 100644 --- a/Code/Core/include/mapPreCachedRegistrationKernelInterface.h +++ b/Code/Core/include/mapPreCachedRegistrationKernelInterface.h @@ -1,68 +1,68 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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: 1285 $ (last changed revision) // @date $Date: 2016-03-30 17:47:52 +0200 (Mi, 30 Mrz 2016) $ (last change date) // @author $Author: floca $ (last changed by) // Subversion HeadURL: $HeadURL: https://svn/sbr/Sources/SBR-Projects/MatchPoint/branches/Issue-1505/Code/Core/include/mapPreCachedRegistrationKernelInterface.h $ */ #ifndef __PRE_CACHED_REGISTRATION_KERNEL_INTERFACE_H #define __PRE_CACHED_REGISTRATION_KERNEL_INTERFACE_H #include "mapRegistrationTopology.h" namespace map { namespace core { /*! @class PreCachedRegistrationKernelInterface @brief class for PreCachedRegistrationKernelInterface. This class is the class for the PreCachedRegistrationKernelInterface. @ingroup RegKernel */ template class PreCachedRegistrationKernelInterface { public: typedef typename RegistrationTopology::DirectTransformType TransformType; typedef typename RegistrationTopology::DirectMappingVectorType MappingVectorType; /*! sets the transform @eguarantee no fail @param transform the transform that shall be set */ virtual void setTransformModel(TransformType* transform) = 0; protected: PreCachedRegistrationKernelInterface() {}; ~PreCachedRegistrationKernelInterface() {}; private: //No copy constructor allowed PreCachedRegistrationKernelInterface(const PreCachedRegistrationKernelInterface&); void operator=(const PreCachedRegistrationKernelInterface&); //purposely not implemented }; - } -} + } // namespace core +} // namespace map #endif diff --git a/Code/Core/include/mapRegistration.h b/Code/Core/include/mapRegistration.h index 43cc014..1b7b3a9 100644 --- a/Code/Core/include/mapRegistration.h +++ b/Code/Core/include/mapRegistration.h @@ -1,209 +1,207 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __REGISTRATION_H #define __REGISTRATION_H #include "mapDefaultRegistrationTopologyPolicy.h" #include "mapRegistrationBase.h" namespace map { namespace core { /* forward declaration (see mapRegistrationManipulator.h)*/ template class RegistrationManipulator; /*! @class Registration @brief class for registration. @ingroup Registration This class is the class for the registration. */ template < unsigned int VMovingDimensions, unsigned int VTargetDimensions, template class TRegistrationTopologyPolicy = DefaultRegistrationTopologyPolicy > class Registration: public RegistrationBase, public TRegistrationTopologyPolicy { public: - typedef Registration Self; - typedef RegistrationBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Self = Registration; + using Superclass = RegistrationBase; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; typedef TRegistrationTopologyPolicy TopologyPolicyType; - typedef typename TopologyPolicyType::DirectMappingType DirectMappingType; - typedef typename TopologyPolicyType::InverseMappingType InverseMappingType; + using DirectMappingType = typename TopologyPolicyType::DirectMappingType; + using InverseMappingType = typename TopologyPolicyType::InverseMappingType; - typedef typename TopologyPolicyType::MovingPointType MovingPointType; - typedef typename TopologyPolicyType::TargetPointType TargetPointType; + using MovingPointType = typename TopologyPolicyType::MovingPointType; + using TargetPointType = typename TopologyPolicyType::TargetPointType; - typedef typename DirectMappingType::RepresentationDescriptorType DirectFieldRepresentationType; - typedef typename InverseMappingType::RepresentationDescriptorType InverseFieldRepresentationType; - typedef typename DirectFieldRepresentationType::ConstPointer - DirectFieldRepresentationConstPointer; - typedef typename InverseFieldRepresentationType::ConstPointer - InverseFieldRepresentationConstPointer; + using DirectFieldRepresentationType = typename DirectMappingType::RepresentationDescriptorType; + using InverseFieldRepresentationType = typename InverseMappingType::RepresentationDescriptorType; + using DirectFieldRepresentationConstPointer = typename DirectFieldRepresentationType::ConstPointer; + using InverseFieldRepresentationConstPointer = typename InverseFieldRepresentationType::ConstPointer; itkStaticConstMacro(MovingDimensions, unsigned int, VMovingDimensions); itkStaticConstMacro(TargetDimensions, unsigned int, VTargetDimensions); itkTypeMacro(Registration, RegistrationBase); itkNewMacro(Self); /*! maps a point from moving space to target space @eguarantee strong @todo der LazyFieldBasedRegistrationKernel muss dann die stong guarantee erfüllen beim erzeugen des feldes ansonsten ist die garantie dieser methode nicht erfüllbar. noch überprüfen @param inPoint pointer to a MovingPointType @param outPoint pointer to a TargetPointType @return success of operation @pre direct mapping kerne must be defined */ virtual bool mapPoint(const MovingPointType& inPoint, TargetPointType& outPoint) const; /*! maps a point from target space to moving space @eguarantee strong @todo der LazyFieldBasedRegistrationKernel muss dann die stong guarantee erfüllen beim erzeugen des feldes ansonsten ist die garantie dieser methode nicht erfüllbar. noch überprüfen @param inPoint pointer to a TargetPointType @param outPoint pointer to a MovingPointType @return success of operation */ virtual bool mapPointInverse(const TargetPointType& inPoint, MovingPointType& outPoint) const; /*! returns the InverseMappingType of this registration @eguarantee no fail @return a const InverseMappingType */ const InverseMappingType& getInverseMapping() const; /*! returns the DirectMappingType of this registration @eguarantee no fail @return a const DirectMappingType */ const DirectMappingType& getDirectMapping() const; /*! returns the direct FieldRepresentationDescriptor which defines the part of the moving space that is guaranteed to be mapped by the direct mapping kernel. @eguarantee strong @return smart pointer to a FieldRepresentationDescriptor for the supported registration space in the moving domain. May be null if the direct registration kernel is global and thus not limited. If there is a limitation, the retun value is not NULL. @retval NULL no field representation set/requested by the creating registration algorithm. */ DirectFieldRepresentationConstPointer getDirectFieldRepresentation() const; /*! returns the inverse FieldRepresentationDescriptor which defines the part of the target space that is guaranteed to be mapped by the inverse mapping kernel. @eguarantee strong @return a const FieldRepresentationDescriptor for the supported registration space in the target domain. May be null if the inverse registration kernel is global and thus not limited. If there is a limitation, the retun value is not NULL. @retval NULL no field representation set/requested by the creating registration algorithm. */ InverseFieldRepresentationConstPointer getInverseFieldRepresentation() const; /*! forces kernel to precompute, even if it is a LazyFieldKernel @eguarantee strong @todo der LazyFieldBasedRegistrationKernel muss dann die stong guarantee erfüllen beim erzeugen des feldes ansonsten ist die garantie dieser methode nicht erfüllbar. noch überprüfen */ void precomputeDirectMapping(); /*! forces kernel to precompute, even if it is a LazyFieldKernel @eguarantee strong @todo der LazyFieldBasedRegistrationKernel muss dann die stong guarantee erfüllen beim erzeugen des feldes ansonsten ist die garantie dieser methode nicht erfüllbar. noch überprüfen */ void precomputeInverseMapping(); /*! @brief Gets the number of moving dimensions @eguarantee no fail @return a SmartPointer to the ModelDescriptor */ - virtual unsigned int getMovingDimensions() const; + unsigned int getMovingDimensions() const override; /*! @brief Gets the number of target dimensions @eguarantee no fail @return a SmartPointer to the ModelDescriptor */ - virtual unsigned int getTargetDimensions() const; + unsigned int getTargetDimensions() const override; /*! @eguarantee no fail @return is the target representation limited @retval true if target representation is limited @retval false if target representation is not limited */ - virtual bool hasLimitedTargetRepresentation() const; + bool hasLimitedTargetRepresentation() const override; /*! @eguarantee no fail @return is the moving representation limited @retval true if moving representation is limited @retval false if moving representation is not limited */ - virtual bool hasLimitedMovingRepresentation() const; + bool hasLimitedMovingRepresentation() const override; friend class RegistrationManipulator; protected: Registration(); - ~Registration(); + ~Registration() override; typename DirectMappingType::Pointer _spDirectMapping; typename InverseMappingType::Pointer _spInverseMapping; virtual void setDirectMapping(DirectMappingType* pKernel); virtual void setInverseMapping(InverseMappingType* pKernel); private: //No copy constructor allowed Registration(const Self& source); void operator=(const Self&); //purposely not implemented }; template std::ostream& operator<<(std::ostream& os, const Registration& registration) { registration.Print(os); return os; }; - } -} + } // namespace core +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapRegistration.tpp" #endif #endif diff --git a/Code/Core/include/mapRegistration.tpp b/Code/Core/include/mapRegistration.tpp index 7130979..70c00b4 100644 --- a/Code/Core/include/mapRegistration.tpp +++ b/Code/Core/include/mapRegistration.tpp @@ -1,194 +1,193 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __REGISTRATION_TPP #define __REGISTRATION_TPP #include "mapRegistration.h" namespace map { namespace core { template < unsigned int VMovingDimensions, unsigned int VTargetDimensions, template class TRegistrationTopologyPolicy > bool Registration:: mapPoint(const MovingPointType& inPoint, TargetPointType& outPoint) const { assert(_spDirectMapping.IsNotNull()); return _spDirectMapping->mapPoint(inPoint, outPoint); } template < unsigned int VMovingDimensions, unsigned int VTargetDimensions, template class TRegistrationTopologyPolicy > bool Registration:: mapPointInverse(const TargetPointType& inPoint, MovingPointType& outPoint) const { assert(_spInverseMapping.IsNotNull()); return _spInverseMapping->mapPoint(inPoint, outPoint); } template < unsigned int VMovingDimensions, unsigned int VTargetDimensions, template class TRegistrationTopologyPolicy > const typename Registration::InverseMappingType& Registration:: getInverseMapping() const { assert(_spInverseMapping.IsNotNull()); return *(_spInverseMapping.GetPointer()); } template < unsigned int VMovingDimensions, unsigned int VTargetDimensions, template class TRegistrationTopologyPolicy > const typename Registration::DirectMappingType& Registration:: getDirectMapping() const { assert(_spDirectMapping.IsNotNull()); return *(_spDirectMapping.GetPointer()); } template < unsigned int VMovingDimensions, unsigned int VTargetDimensions, template class TRegistrationTopologyPolicy > typename Registration::DirectFieldRepresentationConstPointer Registration:: getDirectFieldRepresentation() const { assert(_spDirectMapping.IsNotNull()); return _spDirectMapping->getLargestPossibleRepresentation(); } template < unsigned int VMovingDimensions, unsigned int VTargetDimensions, template class TRegistrationTopologyPolicy > typename Registration::InverseFieldRepresentationConstPointer Registration:: getInverseFieldRepresentation() const { assert(_spInverseMapping.IsNotNull()); return _spInverseMapping->getLargestPossibleRepresentation(); } template < unsigned int VMovingDimensions, unsigned int VTargetDimensions, template class TRegistrationTopologyPolicy > void Registration:: precomputeDirectMapping() { assert(_spDirectMapping.IsNotNull()); return _spDirectMapping->precomputeKernel(); } template < unsigned int VMovingDimensions, unsigned int VTargetDimensions, template class TRegistrationTopologyPolicy > void Registration:: precomputeInverseMapping() { assert(_spInverseMapping.IsNotNull()); return _spInverseMapping->precomputeKernel(); } template < unsigned int VMovingDimensions, unsigned int VTargetDimensions, template class TRegistrationTopologyPolicy > Registration:: Registration() { - _spDirectMapping = NULL; - _spInverseMapping = NULL; + _spDirectMapping = nullptr; + _spInverseMapping = nullptr; } template < unsigned int VMovingDimensions, unsigned int VTargetDimensions, template class TRegistrationTopologyPolicy > Registration:: ~Registration() - { - } + = default; template < unsigned int VMovingDimensions, unsigned int VTargetDimensions, template class TRegistrationTopologyPolicy > void Registration:: setDirectMapping(DirectMappingType* pKernel) { _spDirectMapping = pKernel; this->Modified(); }; template < unsigned int VMovingDimensions, unsigned int VTargetDimensions, template class TRegistrationTopologyPolicy > void Registration:: setInverseMapping(InverseMappingType* pKernel) { _spInverseMapping = pKernel; this->Modified(); }; template < unsigned int VMovingDimensions, unsigned int VTargetDimensions, template class TRegistrationTopologyPolicy > unsigned int Registration:: getMovingDimensions() const { return VMovingDimensions; }; template < unsigned int VMovingDimensions, unsigned int VTargetDimensions, template class TRegistrationTopologyPolicy > unsigned int Registration:: getTargetDimensions() const { return VTargetDimensions; }; template < unsigned int VMovingDimensions, unsigned int VTargetDimensions, template class TRegistrationTopologyPolicy > bool Registration:: hasLimitedTargetRepresentation() const { assert(_spInverseMapping.IsNotNull()); return _spInverseMapping->hasLimitedRepresentation(); } template < unsigned int VMovingDimensions, unsigned int VTargetDimensions, template class TRegistrationTopologyPolicy > bool Registration:: hasLimitedMovingRepresentation() const { assert(_spDirectMapping.IsNotNull()); return _spDirectMapping->hasLimitedRepresentation(); } } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapRegistrationBase.h b/Code/Core/include/mapRegistrationBase.h index b34a0ca..b59ba20 100644 --- a/Code/Core/include/mapRegistrationBase.h +++ b/Code/Core/include/mapRegistrationBase.h @@ -1,156 +1,156 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __REGISTRATION_BASE_H #define __REGISTRATION_BASE_H #include "itkObject.h" #include "mapString.h" #include "mapMacros.h" #include "mapMAPCoreExports.h" /*! @namespace map The namespace map::core is for the library of MatchPoint */ namespace map { namespace core { /* forward declaration (see mapRegistrationManipulator.h)*/ class RegistrationBaseManipulator; /*! @class RegistrationBase @brief Base class for registration. Does not have input and output dimensions. This class is the base class for the registration. Only Registration inherits from this. @remark this class create an unique RegistrationID automatically and adds it to the tags. @ingroup Registration */ class MAPCore_EXPORT RegistrationBase: public itk::Object { public: - typedef RegistrationBase Self; - typedef itk::Object Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Self = RegistrationBase; + using Superclass = itk::Object; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(RegistrationBase, itk::Object); /*! @brief Gets the number of moving dimensions @eguarantee no fail */ virtual unsigned int getMovingDimensions() const = 0; /*! @brief Gets the number of target dimensions @eguarantee no fail */ virtual unsigned int getTargetDimensions() const = 0; /*! typedefs used for the TagMap */ - typedef String TagType; - typedef String ValueType; + using TagType = String; + using ValueType = String; typedef std::map TagMapType; /*! @eguarantee no fail @return is the target representation limited @retval true if target representation is limited. Thus it is not(!) guaranteed that all inverse mapping operations will succeed. Transformation(inverse kernel) covers only a part of the target space. @retval false if target representation is not limited. Thus it is guaranteed that all inverse mapping operations will succeed. */ virtual bool hasLimitedTargetRepresentation() const = 0; /*! @eguarantee no fail @return is the moving representation limited @retval true if moving representation is limited. Thus it is not(!) guaranteed that all direct mapping operations will succeed. Transformation(direct kernel) covers only a part of the moving space. @retval false if moving representation is not limited. Thus it is guaranteed that all direct mapping operations will succeed. */ virtual bool hasLimitedMovingRepresentation() const = 0; /*! @brief returns the tags associated with this registration @eguarantee no fail @return a TagMapType containing tags */ const TagMapType& getTags() const; /*! @brief returns the tag value for a specific tag @eguarantee strong @return the success of the operation */ bool getTagValue(const TagType& tag, ValueType& value) const; /*! @brief convinience function that retrieves the registration UID from the tags and returns it. @eguarantee strong @return the registration UID. */ ValueType getRegistrationUID() const; friend class RegistrationBaseManipulator; protected: RegistrationBase(); - virtual ~RegistrationBase(); + ~RegistrationBase() override; TagMapType _tags; /*! Checks the current tags and adds a registration UID if missing @eguarantee strong */ void ensureRegistrationUID(); /*! @Sets the tags of a registration by replacing the existing tag map with the passed one. * @remark If tags do not contain the tag "RegistrationUID" the old UID will automatically be added. * If it is present it stays untouched. If you define your own UID ensure that it is unique. @eguarantee strong */ virtual void setTagValues(const RegistrationBase::TagMapType& tags); virtual RegistrationBase::TagMapType& getTagValues(); /*! Methods invoked by itk::LightObject::Print(). */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: //No copy constructor allowed - RegistrationBase(const Self& source); - void operator=(const Self&); //purposely not implemented + RegistrationBase(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; - } + } // namespace core namespace tags { const char* const AlgorithmUID = "AlgorithmUID"; const char* const RegistrationUID = "RegistrationUID"; } -} +} // namespace map #endif diff --git a/Code/Core/include/mapRegistrationCombinationRequest.h b/Code/Core/include/mapRegistrationCombinationRequest.h index c05fa6b..d92020d 100644 --- a/Code/Core/include/mapRegistrationCombinationRequest.h +++ b/Code/Core/include/mapRegistrationCombinationRequest.h @@ -1,82 +1,82 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_REGISTRATION_COMBINATION_REQUEST_H #define __MAP_REGISTRATION_COMBINATION_REQUEST_H #include "mapRegistrationKernelBase.h" namespace map { namespace core { /*! @class RegistrationCombinationRequest * @brief Request class used by RegistrationCombinator. * * This class is used as request type for the provider stack of RegistrationCombinator * @ingroup RegOperation * @sa RegistrationCombinator * @tparam VInputDimensions Dimensions of the input space of the first kernel. * @tparam VInterimDimensions Dimensions of the output space of the first kernel and the input space of the second. * @tparam VOutputDimensions Dimensions of the output space of the second kernel. */ template class RegistrationCombinationRequest { public: typedef RegistrationKernelBase Kernel1BaseType; - typedef typename Kernel1BaseType::ConstPointer Kernel1BaseConstPointer; + using Kernel1BaseConstPointer = typename Kernel1BaseType::ConstPointer; typedef RegistrationKernelBase Kernel2BaseType; - typedef typename Kernel2BaseType::ConstPointer Kernel2BaseConstPointer; + using Kernel2BaseConstPointer = typename Kernel2BaseType::ConstPointer; Kernel1BaseConstPointer _spKernel1; Kernel2BaseConstPointer _spKernel2; /*! Constructor * \pre pKernel1 and pKernel2 must not be NULL*/ RegistrationCombinationRequest(const Kernel1BaseType* pKernel1, const Kernel2BaseType* pKernel2); RegistrationCombinationRequest(const Kernel1BaseType& kernel1, const Kernel2BaseType& kernel2); ~RegistrationCombinationRequest(); - RegistrationCombinationRequest(const RegistrationCombinationRequest&); - void operator=(const RegistrationCombinationRequest&); + RegistrationCombinationRequest(const RegistrationCombinationRequest& /*req*/); + void operator=(const RegistrationCombinationRequest& /*req*/); }; template std::ostream& operator<<(std::ostream& os, const RegistrationCombinationRequest& request) { os << "Kernel1: " << request._spKernel1 << std::endl; os << "Kernel2: " << request._spKernel2 << std::endl; return os; }; } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapRegistrationCombinationRequest.tpp" #endif #endif diff --git a/Code/Core/include/mapRegistrationCombinator.h b/Code/Core/include/mapRegistrationCombinator.h index c2a78cc..684bacb 100644 --- a/Code/Core/include/mapRegistrationCombinator.h +++ b/Code/Core/include/mapRegistrationCombinator.h @@ -1,217 +1,213 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_REGISTRATION_COMBINATOR_H #define __MAP_REGISTRATION_COMBINATOR_H #include "mapStaticServiceStack.h" #include "mapRegistrationKernelCombinatorBase.h" #include "mapRegistration.h" #include "mapKernelCombinatorLoadPolicy.h" #include "itkObject.h" namespace map { namespace core { /*! @class RegistrationCombinator * @brief Class combines two given registrations to a now one. * * This class is used to combine two registrations assuming that the target space of the first * given reigstration equals the moving space of the second registration. The resulting registration * maps from the movingspace of the first registration in the target space of the second registration.\n * by registration algorithms to establish the inverse counterpart * of the registration kernel determined by the algorithm, thus to establish a fully * functional Registration instance.\n * To combine the registrations the class uses a static service stack populated with * RegistrationKernelCombinators for the direct and the inverse mapping direction. * You can change the stack content by the static class methods of the member typedef KernelCombinatorStackType. * If the combination of kernels cannot be expressed analyticaly (by transformation models) a LazyFieldKernel * will be used.\n * Depending on the registrations and there field representations in these cases it could be possible, that a mapping of points * across both kernels is not possible, how the combinator (more exactly its functor) should behave can be * controlled by the padding value properties of this class.\n * Its also possible to choose which mapping direction should be directly initialized by the combinator, no lazy field generation will * be used for the specific mapping directions. * * @ingroup RegOperation * @ingroup Registration * @tparam TPreRegistration the first registration or pre registration, that should be combined. * @tparam TRegistration the second registration or main registration, that should be combined. * @tparam TLoadPolicy the load policy that should be used for the provider stack of the recombinator. */ template class TLoadPolicy = KernelCombinatorLoadPolicy > class RegistrationCombinator: public itk::Object { public: /*! Standard class typedefs. */ typedef RegistrationCombinator Self; - typedef itk::Object Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Superclass = itk::Object; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(RegistrationCombinator, itk::Object); itkNewMacro(Self); - typedef TPreRegistration PreRegistrationType; - typedef TRegistration RegistrationType; + using PreRegistrationType = TPreRegistration; + using RegistrationType = TRegistration; itkStaticConstMacro(MovingDimensions, unsigned int, PreRegistrationType::MovingDimensions); itkStaticConstMacro(InterimDimensions, unsigned int, PreRegistrationType::TargetDimensions); itkStaticConstMacro(TargetDimensions, unsigned int, RegistrationType::TargetDimensions); typedef RegistrationKernelCombinatorBase < itkGetStaticConstMacro(MovingDimensions), itkGetStaticConstMacro(InterimDimensions), itkGetStaticConstMacro(TargetDimensions) > DirectKernelCombinatorBaseType; typedef RegistrationKernelCombinatorBase < itkGetStaticConstMacro(TargetDimensions), itkGetStaticConstMacro(InterimDimensions), itkGetStaticConstMacro(MovingDimensions) > InverseKernelCombinatorBaseType; typedef Registration < itkGetStaticConstMacro(MovingDimensions), itkGetStaticConstMacro(TargetDimensions) > CombinedRegistrationType; - typedef typename CombinedRegistrationType::Pointer CombinedRegistrationPointer; + using CombinedRegistrationPointer = typename CombinedRegistrationType::Pointer; typedef typename RegistrationTopology < itkGetStaticConstMacro(MovingDimensions), itkGetStaticConstMacro(TargetDimensions) >::DirectMappingVectorType DirectMappingVectorType; typedef typename RegistrationTopology < itkGetStaticConstMacro(MovingDimensions), itkGetStaticConstMacro(TargetDimensions) >::InverseMappingVectorType InverseMappingVectorType; - typedef typename CombinedRegistrationType::DirectFieldRepresentationType - CombinedDirectFieldRepresentationType; - typedef typename CombinedRegistrationType::InverseFieldRepresentationType - CombinedInverseFieldRepresentationType; + using CombinedDirectFieldRepresentationType = typename CombinedRegistrationType::DirectFieldRepresentationType; + using CombinedInverseFieldRepresentationType = typename CombinedRegistrationType::InverseFieldRepresentationType; struct InitialisationStyle { enum Type { None = 0, DirectMapping = 1, InverseMapping = 2, CompleteRegistration = 3, }; }; - typedef typename InitialisationStyle::Type InitialisationStyleType; + using InitialisationStyleType = typename InitialisationStyle::Type; #ifdef ITK_USE_CONCEPT_CHECKING /** Begin concept checking */ itkConceptMacro(CombinableRegistrationsCheck, (itk::Concept::SameDimension)); /** End concept checking */ #endif protected: typedef services::ServiceStack > ConcreteDirectCombinatorStackType; typedef services::ServiceStack > ConcreteInverseCombinatorStackType; public: - typedef services::StaticServiceStack - DirectKernelCombinatorStackType; - typedef services::StaticServiceStack - InverseKernelCombinatorStackType; + using DirectKernelCombinatorStackType = services::StaticServiceStack; + using InverseKernelCombinatorStackType = services::StaticServiceStack; /*! Generates a combined registration using the both passed registrations. * @eguarantee strong * @param [in] preRegistration Referenz to the first registration. * @param [in] registration Referenz to the second registration. * @param [in] initStyle Defines the which mapping direction should be initialized directly by the combinator and therefor are not in "lazy mode". * @return Smart pointer to the registration combining the two given registrations. */ CombinedRegistrationPointer process(const PreRegistrationType& preRegistration, const RegistrationType& registration, InitialisationStyleType initStyle = InitialisationStyle::None) const; CombinedRegistrationPointer process(const PreRegistrationType& preRegistration, const RegistrationType& registration, const CombinedDirectFieldRepresentationType* pDirectRepresentation, const CombinedInverseFieldRepresentationType* pInverseRepresentation, InitialisationStyleType initStyle = InitialisationStyle::None) const; /*! gets _useDirectPadding */ bool getUseDirectPadding() const; /*! Sets _useDirectPadding . */ void setUseDirectPadding(bool directPadding); /*! gets _useInversePadding */ bool getUseInversePadding() const; /*! Sets _useInversePadding */ void setUseInversePadding(bool inversePadding); /*! Gets _directPaddingVector * @return vector The _directPaddingVector*/ const DirectMappingVectorType& getDirectPaddingVector() const; /*! Sets _directPaddingVector by vector and _useDirectPadding to true. * @param [in] vector The new value for _directPaddingVector*/ void setDirectPaddingVector(const DirectMappingVectorType& vector); /*! Gets _inversePaddingVector * @return vector The _directPaddingVector*/ const InverseMappingVectorType& getInversePaddingVector() const; /*! Sets _inversePaddingVector by vector and _useInversePadding to true. * @param [in] vector The new value for _inversePaddingVector*/ void setInversePaddingVector(const InverseMappingVectorType& vector); protected: RegistrationCombinator(); - virtual ~RegistrationCombinator(); + ~RegistrationCombinator() override; DirectMappingVectorType _directPaddingVector; InverseMappingVectorType _inversePaddingVector; /*! Indicicates how the recombinator and its functor should handle points that cannot be mapped through both kernels in direct direction * (e.g. a point that is mapped by the first kernel outside of the supported region of the second registration * kernel). If the _useDirectPadding is true, _directPaddingVector will be used as padding value in each of the mentioned cases. * If _useDirectPadding value is false, the vector of the pre registration kernel will be used. * By default _useDirectPadding is false. */ - bool _useDirectPadding; + bool _useDirectPadding{false}; /*! Indicicates how the recombinator and its functor should handle points that cannot be mapped through both kernels in inverse direction * (e.g. a point that is mapped by the first kernel outside of the supported region of the second registration * kernel). If the _useInversePadding is true, _inversePaddingVector will be used as padding value in each of the mentioned cases. * If _useInversePadding value is false, the vector of the pre registration kernel will be used. * By default _useInversePadding is false. */ - bool _useInversePadding; + bool _useInversePadding{false}; /*! Methods invoked by itk::LightObject::Print(). */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: RegistrationCombinator(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapRegistrationCombinator.tpp" #endif #endif diff --git a/Code/Core/include/mapRegistrationCombinator.tpp b/Code/Core/include/mapRegistrationCombinator.tpp index b58bd49..e94605e 100644 --- a/Code/Core/include/mapRegistrationCombinator.tpp +++ b/Code/Core/include/mapRegistrationCombinator.tpp @@ -1,210 +1,210 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_REGISTRATION_COMBINATOR_TPP #define __MAP_REGISTRATION_COMBINATOR_TPP #include "mapRegistrationCombinator.h" #include "mapRegistrationManipulator.h" #include "mapMissingProviderException.h" namespace map { namespace core { template class TLoadPolicy > typename RegistrationCombinator::CombinedRegistrationPointer RegistrationCombinator:: process(const PreRegistrationType& preRegistration, const RegistrationType& registration, InitialisationStyleType initStyle) const { return process(preRegistration, registration, preRegistration.getDirectFieldRepresentation().GetPointer(), registration.getInverseFieldRepresentation().GetPointer(), initStyle); } template class TLoadPolicy > typename RegistrationCombinator::CombinedRegistrationPointer RegistrationCombinator:: process(const PreRegistrationType& preRegistration, const RegistrationType& registration, const CombinedDirectFieldRepresentationType* pDirectRepresentation, const CombinedInverseFieldRepresentationType* pInverseRepresentation, InitialisationStyleType initStyle) const { typename DirectKernelCombinatorBaseType::RequestType directRequest( preRegistration.getDirectMapping(), registration.getDirectMapping()); typename InverseKernelCombinatorBaseType::RequestType inverseRequest( registration.getInverseMapping(), preRegistration.getInverseMapping()); DirectKernelCombinatorBaseType* pDirectCombinator = DirectKernelCombinatorStackType::getProvider( directRequest); InverseKernelCombinatorBaseType* pInverseCombinator = InverseKernelCombinatorStackType::getProvider( inverseRequest); mapLogInfoMacro( << "Combine registrations. Registration 1: " << preRegistration << std::endl << " Registration 2:" << registration); if (!pDirectCombinator) { mapExceptionMacro(MissingProviderException, << "No responsible combinator available for given direct request. Request:" << directRequest); } if (!pInverseCombinator) { mapExceptionMacro(MissingProviderException, << "No responsible combinator available for given inverse request. Request:" << inverseRequest); } CombinedRegistrationPointer spCombinedRegistration = CombinedRegistrationType::New(); typename CombinedRegistrationType::DirectMappingType::Pointer spDirectKernel = pDirectCombinator->combineKernels(directRequest, pDirectRepresentation, _useDirectPadding, _directPaddingVector); typename CombinedRegistrationType::InverseMappingType::Pointer spInverseKernel = pInverseCombinator->combineKernels(inverseRequest, pInverseRepresentation, _useInversePadding, _inversePaddingVector); assert(spDirectKernel.IsNotNull()); assert(spInverseKernel.IsNotNull()); RegistrationManipulator manipulator(spCombinedRegistration.GetPointer()); manipulator.setDirectMapping(spDirectKernel); manipulator.setInverseMapping(spInverseKernel); if (initStyle == InitialisationStyle::DirectMapping || initStyle == InitialisationStyle::CompleteRegistration) { mapLogInfoMacro( << "precompute direct kernel of combined registration"); spDirectKernel->precomputeKernel(); } if (initStyle == InitialisationStyle::InverseMapping || initStyle == InitialisationStyle::CompleteRegistration) { mapLogInfoMacro( << "precompute inverse kernel of combined registration"); spInverseKernel->precomputeKernel(); } return spCombinedRegistration; } template class TLoadPolicy > bool RegistrationCombinator:: getUseDirectPadding() const { return _useDirectPadding; } template class TLoadPolicy > void RegistrationCombinator:: setUseDirectPadding(bool directPadding) { _useDirectPadding = directPadding; } template class TLoadPolicy > bool RegistrationCombinator:: getUseInversePadding() const { return _useInversePadding; } template class TLoadPolicy > void RegistrationCombinator:: setUseInversePadding(bool inversePadding) { _useInversePadding = inversePadding; } template class TLoadPolicy> const typename RegistrationCombinator::DirectMappingVectorType& RegistrationCombinator:: getDirectPaddingVector() const { return _directPaddingVector; } template class TLoadPolicy> void RegistrationCombinator:: setDirectPaddingVector(const DirectMappingVectorType& vector) { _directPaddingVector = vector; } template class TLoadPolicy> const typename RegistrationCombinator::InverseMappingVectorType& RegistrationCombinator:: getInversePaddingVector() const { return _inversePaddingVector; } template class TLoadPolicy > void RegistrationCombinator:: setInversePaddingVector(const InverseMappingVectorType& vector) { _inversePaddingVector = vector; } template class TLoadPolicy > void RegistrationCombinator:: PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "Use direct padding :" << _useDirectPadding << std::endl; os << indent << "Direct padding vector :" << _directPaddingVector << std::endl; os << indent << "Use inverse padding :" << _useInversePadding << std::endl; os << indent << "Inverse padding vector :" << _inversePaddingVector << std::endl; } template class TLoadPolicy > RegistrationCombinator:: - RegistrationCombinator(): _useDirectPadding(false), _useInversePadding(false) + RegistrationCombinator() { _directPaddingVector.Fill(itk::NumericTraits::NonpositiveMin()); _inversePaddingVector.Fill(itk::NumericTraits::NonpositiveMin()); } template class TLoadPolicy > RegistrationCombinator:: ~RegistrationCombinator() - {} + = default; } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapRegistrationException.h b/Code/Core/include/mapRegistrationException.h index 7bd73e0..7d8de75 100644 --- a/Code/Core/include/mapRegistrationException.h +++ b/Code/Core/include/mapRegistrationException.h @@ -1,83 +1,83 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_REGISTRATION_EXCEPTION_H #define __MAP_REGISTRATION_EXCEPTION_H #include "mapExceptionObject.h" namespace map { namespace core { /*! @class RegistrationException * @brief Base exception class for registration excpetions used within MatchPoint. * * This is the base class for any registration exception that is caused by MatchPoint's own code. * @ingroup Exception */ class MAPCore_EXPORT RegistrationException : public ExceptionObject { public: - typedef ExceptionObject Superclass; - typedef ExceptionObject BaseExceptionType; + using Superclass = ExceptionObject; + using BaseExceptionType = ExceptionObject; /*! Default constructor. Needed to ensure the exception object can be * copied. */ - RegistrationException() : Superclass() {} + RegistrationException() = default; /*! Constructor. Needed to ensure the exception object can be copied. */ RegistrationException(const char* file, unsigned int lineNumber) : Superclass(file, lineNumber) {} /*! Constructor. Needed to ensure the exception object can be copied. */ RegistrationException(const std::string& file, unsigned int lineNumber) : Superclass(file, lineNumber) {} /*! Constructor. Needed to ensure the exception object can be copied. */ RegistrationException(const std::string& file, unsigned int lineNumber, const std::string& desc, const std::string& loc) : Superclass(file, lineNumber, desc, loc) {} /*! Virtual destructor needed for subclasses. Has to have empty throw(). */ - virtual ~RegistrationException() throw() {} + ~RegistrationException() noexcept override = default; - virtual const char* GetNameOfClass() const + const char* GetNameOfClass() const override { return "map::RegistrationException"; } /*! Clones the exception object and returns a pointer to a copy of the exception object. * The cloned object is created on the heap and should function caller has to take care about * proper destruction (e.g. using auto pointer or tr1::shared_pointer). * @remark Used a plain pointer as return value in this case to ensure the no throw guarantee. * This feature is needed by some classes like MappingTaskBatch to ensure the feature of * processing tasks in multiple threads and to deal with any exception after joining the threads * and every task is processed (or failed through an exception). * @return Pointer to the cloned exception. If the cloning fails for any reason the return is NULL. * @eguarantee no throw*/ - virtual BaseExceptionType* clone() const throw(); + BaseExceptionType* clone() const noexcept override; }; } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapRegistrationKernel.h b/Code/Core/include/mapRegistrationKernel.h index c990bb9..fa53ed3 100644 --- a/Code/Core/include/mapRegistrationKernel.h +++ b/Code/Core/include/mapRegistrationKernel.h @@ -1,134 +1,133 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __REGISTRATION_KERNEL_H #define __REGISTRATION_KERNEL_H #include "mapRegistrationKernelBase.h" /*! @namespace map The namespace map::core is for the library of MatchPoint */ namespace map { namespace core { /*! RegistrationKernel implementation. * This class is the base class for concrete implemented registration kernels, * that define the mapping via a itk transformation model. * The concrete transform management behavior will be implemented by derived classes. * @ingroup RegKernel */ template class RegistrationKernel : public RegistrationKernelBase < VInputDimensions, VOutputDimensions > { public: typedef RegistrationKernel < VInputDimensions, VOutputDimensions > Self; typedef RegistrationKernelBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(RegistrationKernel, RegistrationKernelBase); itkCloneMacro(Self); - typedef typename Superclass::TransformType TransformType; - typedef typename Superclass::RepresentationDescriptorType RepresentationDescriptorType; - typedef typename Superclass::RepresentationDescriptorPointer RepresentationDescriptorPointer; - typedef typename Superclass::RepresentationDescriptorConstPointer - RepresentationDescriptorConstPointer; - typedef typename Superclass::InputPointType InputPointType; - typedef typename Superclass::OutputPointType OutputPointType; - typedef typename Superclass::OutputVectorType OutputVectorType; + using TransformType = typename Superclass::TransformType; + using RepresentationDescriptorType = typename Superclass::RepresentationDescriptorType; + using RepresentationDescriptorPointer = typename Superclass::RepresentationDescriptorPointer; + using RepresentationDescriptorConstPointer = typename Superclass::RepresentationDescriptorConstPointer; + using InputPointType = typename Superclass::InputPointType; + using OutputPointType = typename Superclass::OutputPointType; + using OutputVectorType = typename Superclass::OutputVectorType; /*! Returns pointer to the transform model used by the kernel @eguarantee strong @return const pointer to the internal tranform model */ virtual const TransformType* getTransformModel() const = 0; /*! @brief forces kernel to precompute, even if it is a LazyFieldKernel @eguarantee strong */ - virtual void precomputeKernel() const override; + void precomputeKernel() const override; /*! Returns if the transform was already created or if the generation still is pending / wasn't necessary. @eguarantee strong */ virtual bool transformExists() const = 0; /*! gets the name of the model @eguarantee strong @return an String containing the model name */ virtual String getModelName() const; typedef itk::Matrix MatrixType; /*! Tries to decompose the transform model into an affine matrix and an offset. It is indecated by the return value if * the actual modell can be decomposed.\n * Usage of the return values: Point_trans = Matrix*Point + Offset * * @eguarantee strong * @remark Implement the function for special transform model classes. * @param [out] matrix Reference to the matrix that define the affine non-translation part (e.g. rotation and scaling). * @param [out] offset Reference to a vector that defines the translation offset. * @return Indicates if the transform model can be decomposed in a affine transformation matrix plus offset. If it returns false, it cannot be decomposed * and the referenced output parameters are invalid.*/ virtual bool getAffineMatrixDecomposition(MatrixType& matrix, OutputVectorType& offset) const; virtual const OutputPointType getNullPoint() const = 0; virtual bool usesNullPoint() const = 0; protected: RegistrationKernel(); - virtual ~RegistrationKernel(); + ~RegistrationKernel() override; - virtual bool doMapPoint(const InputPointType& inPoint, OutputPointType& outPoint) const override; + bool doMapPoint(const InputPointType& inPoint, OutputPointType& outPoint) const override; /*! checks the transform that has been set for correctness and prepares it to be used @eguarantee strong @return the success of the operation */ virtual bool checkAndPrepareTransform() const = 0; /*! Methods invoked by itk::LightObject::Print(). */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: //No copy constructor allowed RegistrationKernel(const Self& source); void operator=(const Self&); //purposely not implemented }; - } -} + } // namespace core +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapRegistrationKernel.tpp" #endif #endif diff --git a/Code/Core/include/mapRegistrationKernelBase.h b/Code/Core/include/mapRegistrationKernelBase.h index 96b28e0..d38fb6e 100644 --- a/Code/Core/include/mapRegistrationKernelBase.h +++ b/Code/Core/include/mapRegistrationKernelBase.h @@ -1,155 +1,155 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __REGISTRATION_KERNEL_BASE_H #define __REGISTRATION_KERNEL_BASE_H #include "mapFieldRepresentationDescriptor.h" #include "mapDimensionlessRegistrationKernelBase.h" #include "mapRegistrationTopology.h" #include "itkObject.h" namespace map { namespace core { /*! @class RegistrationKernelBase This class is the base class for the registration kernels. @ingroup RegKernel */ template class RegistrationKernelBase : public DimensionlessRegistrationKernelBase { public: - typedef RegistrationKernelBase Self; - typedef DimensionlessRegistrationKernelBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Self = RegistrationKernelBase; + using Superclass = DimensionlessRegistrationKernelBase; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(RegistrationKernelBase, DimensionlessRegistrationKernelBase); itkCloneMacro(Self); itkStaticConstMacro(InputDimensions, unsigned int, VInputDimensions); itkStaticConstMacro(OutputDimensions, unsigned int, VOutputDimensions); - typedef typename continuous::Elements::PointType InputPointType; - typedef typename continuous::Elements::PointType OutputPointType; + using InputPointType = typename continuous::Elements::PointType; + using OutputPointType = typename continuous::Elements::PointType; typedef typename RegistrationTopology::DirectMappingVectorType MappingVectorType; typedef typename RegistrationTopology::DirectTransformType TransformType; - typedef typename TransformType::OutputVectorType OutputVectorType; + using OutputVectorType = typename TransformType::OutputVectorType; - typedef FieldRepresentationDescriptor RepresentationDescriptorType; - typedef typename RepresentationDescriptorType::Pointer RepresentationDescriptorPointer; - typedef typename RepresentationDescriptorType::ConstPointer RepresentationDescriptorConstPointer; + using RepresentationDescriptorType = FieldRepresentationDescriptor; + using RepresentationDescriptorPointer = typename RepresentationDescriptorType::Pointer; + using RepresentationDescriptorConstPointer = typename RepresentationDescriptorType::ConstPointer; /*! maps a point as long as it is within the field representation of the kernel by calling doMapPoint() @param inPoint Point that should be mapped. @param outPoint Mapping result. If the input point cannot be mapped the return of the method will be false and outPoint will be zero. @eguarantee strong @return success of operation @retval true Point was mapped @retval false Point was not in the represented region of the kernel and thus not mapped. By default outPoint will then be zero. */ bool mapPoint(const InputPointType& inPoint, OutputPointType& outPoint) const; /*! @brief determines if there is a limit in the data representation of the kernel @eguarantee strong @return if the registration kernel has limited representation @retval true if the data representation is limited @retval false if the data representation is not limited */ - bool hasLimitedRepresentation() const; + bool hasLimitedRepresentation() const override; /*! @brief gets the largest possible representation descriptor. The descriptor defines * the space the kernel guarantees to map. * @return Smart pointer to the descriptor (may be generated dynamically) * @retval NULL there is no descriptor. If hasLimitedRepresentation returns false, the kernel * has no mapping limitations and covers the total input space. @eguarantee strong */ virtual RepresentationDescriptorConstPointer getLargestPossibleRepresentation() const = 0; /*! @brief forces kernel to precompute, even if it is a LazyFieldKernel @eguarantee strong */ - virtual void precomputeKernel() const = 0; + void precomputeKernel() const override = 0; /*! @brief Gets the number of input dimensions @eguarantee no fail */ - virtual unsigned int getInputDimensions() const + unsigned int getInputDimensions() const override { return InputDimensions; }; /*! @brief Gets the number of output dimensions @eguarantee no fail */ - virtual unsigned int getOutputDimensions() const + unsigned int getOutputDimensions() const override { return OutputDimensions; }; protected: /*! Methods invoked by itk::LightObject::Print(). */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /*! Maps the point from input to output space. Is used by mapPoint() @eguarantee strong */ virtual bool doMapPoint(const InputPointType& inPoint, OutputPointType& outPoint) const = 0; RegistrationKernelBase(); - virtual ~RegistrationKernelBase(); + ~RegistrationKernelBase() override; private: //No copy constructor allowed RegistrationKernelBase(const Self& source); void operator=(const Self&); //purposely not implemented }; template std::ostream& operator<< (std::ostream& os, const RegistrationKernelBase& p) { p.Print(os); return os; } - } -} + } // namespace core +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapRegistrationKernelBase.tpp" #endif #endif diff --git a/Code/Core/include/mapRegistrationKernelCombinatorBase.h b/Code/Core/include/mapRegistrationKernelCombinatorBase.h index 9a71e0d..e92eb1a 100644 --- a/Code/Core/include/mapRegistrationKernelCombinatorBase.h +++ b/Code/Core/include/mapRegistrationKernelCombinatorBase.h @@ -1,119 +1,119 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_REGISTRATION_KERNEL_COMBINATOR_BASE_H #define __MAP_REGISTRATION_KERNEL_COMBINATOR_BASE_H #include "mapServiceProvider.h" #include "mapRegistrationCombinationRequest.h" #include "mapRegistrationKernelBase.h" #include "mapRegistrationTopology.h" namespace map { namespace core { /*! @class RegistrationKernelCombinatorBase * @brief Base class for any instance in MatchPoint that provides the service of registration kernel combination. * * @ingroup RegOperation * @tparam VInputDimensions Dimensions of the input space of the first kernel. * @tparam VInterimDimensions Dimensions of the output space of the first kernel and the input space of the second. * @tparam VOutputDimensions Dimensions of the output space of the second kernel. */ template class RegistrationKernelCombinatorBase : public services::ServiceProvider< RegistrationCombinationRequest< VInputDimensions, VInterimDimensions, VOutputDimensions> > { public: typedef RegistrationKernelBase Kernel1BaseType; - typedef typename Kernel1BaseType::Pointer Kernel1BasePointer; + using Kernel1BasePointer = typename Kernel1BaseType::Pointer; typedef RegistrationKernelBase Kernel2BaseType; - typedef typename Kernel2BaseType::Pointer Kernel2BasePointer; + using Kernel2BasePointer = typename Kernel2BaseType::Pointer; typedef RegistrationKernelBase CombinedKernelBaseType; - typedef typename CombinedKernelBaseType::Pointer CombinedKernelBasePointer; + using CombinedKernelBasePointer = typename CombinedKernelBaseType::Pointer; typedef RegistrationCombinationRequest RequestType; - typedef FieldRepresentationDescriptor InputFieldRepresentationType; - typedef FieldRepresentationDescriptor InterimFieldRepresentationType; + using InputFieldRepresentationType = FieldRepresentationDescriptor; + using InterimFieldRepresentationType = FieldRepresentationDescriptor; typedef typename RegistrationTopology::DirectMappingVectorType PaddingVectorType; itkStaticConstMacro(InputDimensions, unsigned int, VInputDimensions); itkStaticConstMacro(InterimDimensions, unsigned int, VInterimDimensions); itkStaticConstMacro(OutputDimensions, unsigned int, VOutputDimensions); /*! Standard class typedefs. */ typedef RegistrationKernelCombinatorBase Self; - typedef services::ServiceProvider Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Superclass = services::ServiceProvider; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(RegistrationKernelCombinatorBase, ServiceProvider); /*! Combines two kernel. * Returns a smpart pointer to an kernel that realizes the combination of two registration kernel. * @eguarantee strong * @param [in] request Referenz to the request that contains the both kernels that should be combined * @param [in] pInputFieldRepresentation Pointer to the field representation of the input space of the combined kernel. * Some combinators (any handling field kernels) may need this pointer not to be null as a precondition. * @param [in] usePadding Indicicates how the recombinator and its functor should handel points that cannot be mapped * through both kernels (e.g. a point that is mapped by the first kernel outside of the supported region of the second * registration kernel). If the _usePadding is true, _paddingVector will be used as padding value in each of the mentioned * cases. If _usePadding value is false, than the combinator will throw an RepresentationException. * @param [in] paddingVector Vector that should be used for padding, if usePadding is true. * @return Smart pointer to the inverse kernel. * @pre input representation must be coverd by the first kernel and the mapped input representation must be covered by the input * representation of the second kernel. */ virtual CombinedKernelBasePointer combineKernels(const RequestType& request, const InputFieldRepresentationType* pInputFieldRepresentation, bool usePadding = false, const PaddingVectorType& paddingVector = PaddingVectorType(0)) const = 0; protected: /*! Methods invoked by itk::LightObject::Print(). */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; RegistrationKernelCombinatorBase(); - virtual ~RegistrationKernelCombinatorBase(); + ~RegistrationKernelCombinatorBase() override; private: RegistrationKernelCombinatorBase(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapRegistrationKernelCombinatorBase.tpp" #endif #endif diff --git a/Code/Core/include/mapRegistrationKernelInverterBase.h b/Code/Core/include/mapRegistrationKernelInverterBase.h index 1f20257..9aab730 100644 --- a/Code/Core/include/mapRegistrationKernelInverterBase.h +++ b/Code/Core/include/mapRegistrationKernelInverterBase.h @@ -1,104 +1,104 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_REGISTRATION_KERNEL_INVERTER_BASE_H #define __MAP_REGISTRATION_KERNEL_INVERTER_BASE_H #include "mapServiceProvider.h" #include "mapRegistrationKernelBase.h" namespace map { namespace core { /*! @class RegistrationKernelInverterBase * @brief Base class for any instance in MatchPoint that provides kernel inversion services * * @ingroup RegOperation * @tparam VInputDimensions Dimensions of the input space of the kernel that should be inverted. * @tparam VOutputDimensions Dimensions of the output space of the kernel that should be inverted. */ template class RegistrationKernelInverterBase : public services::ServiceProvider< RegistrationKernelBase > { public: typedef RegistrationKernelBase KernelBaseType; - typedef typename KernelBaseType::Pointer KernelBasePointer; + using KernelBasePointer = typename KernelBaseType::Pointer; typedef RegistrationKernelBase InverseKernelBaseType; - typedef typename InverseKernelBaseType::Pointer InverseKernelBasePointer; + using InverseKernelBasePointer = typename InverseKernelBaseType::Pointer; - typedef FieldRepresentationDescriptor FieldRepresentationType; - typedef FieldRepresentationDescriptor InverseFieldRepresentationType; + using FieldRepresentationType = FieldRepresentationDescriptor; + using InverseFieldRepresentationType = FieldRepresentationDescriptor; - typedef KernelBaseType RequestType; + using RequestType = KernelBaseType; - typedef typename InverseKernelBaseType::OutputPointType NullPointType; + using NullPointType = typename InverseKernelBaseType::OutputPointType; /*! Standard class typedefs. */ typedef RegistrationKernelInverterBase Self; - typedef services::ServiceProvider Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Superclass = services::ServiceProvider; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(RegistrationKernelInverterBase, ServiceProvider); /*! Generates the inverse kernel. * Returns a smpart pointer to an inverted version of the kernel. * @eguarantee strong * @param [in] request Referenz to the kernel that should be inverted * @param [in] pFieldRepresentation Pointer to the field representation of the kernel. * @param [in] pInverseFieldRepresentation Pointer to the field representation of the inverse kernel. * @return Smart pointer to the inverse kernel. * @pre The inverter service provider may require the field representation, depending on the kernel. * e.g. if the kernel cannot be inverted analyticaly the inverse field representation descriptor is * needed in order to generate a prober field for the inverse kernel. * To avoid any exceptions always provide the field representation descriptors unless you are sure they * won't be needed. * The kernel must be the right type for a concrete inverter. Thus only call this method for kernels for wich * canHandleRequest returned true. * @post If the method returns with no exception, there is always an inverse kernel (smart pointer is not NULL) * @remark This function might cause an exception/assertion if the responsible service provider needs * a missing field representation descriptor. Also if no suitable provider is available an exception will be thrown. */ virtual InverseKernelBasePointer invertKernel(const KernelBaseType& kernel, const FieldRepresentationType* pFieldRepresentation, const InverseFieldRepresentationType* pInverseFieldRepresentation, bool useNullPoint = false, NullPointType nullPoint = NullPointType(itk::NumericTraits< ::map::core::continuous::ScalarType>::NonpositiveMin())) const = 0; protected: RegistrationKernelInverterBase() { }; virtual ~RegistrationKernelInverterBase() {}; private: RegistrationKernelInverterBase(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapRegistrationManipulator.h b/Code/Core/include/mapRegistrationManipulator.h index ba52aee..19c61fb 100644 --- a/Code/Core/include/mapRegistrationManipulator.h +++ b/Code/Core/include/mapRegistrationManipulator.h @@ -1,126 +1,126 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __REGISTRATION_MANIPULATOR_H #define __REGISTRATION_MANIPULATOR_H #include "mapRegistration.h" #include "mapRegistrationBase.h" namespace map { namespace core { /*! @class RegistrationBaseManipulator @brief Grants public write access to RegistrationBase. */ class RegistrationBaseManipulator { public: - typedef RegistrationBase::TagMapType TagMapType; + using TagMapType = RegistrationBase::TagMapType; /*! @brief sets the tags of a registration @eguarantee strong */ void setTagValues(const TagMapType& tags) { _pBase->setTagValues(tags); }; /*! @brief allows non const access to the registration tags. @eguarantee no fail */ TagMapType& getTagValues() { return _pBase->getTagValues(); }; RegistrationBaseManipulator(RegistrationBase* pBase): _pBase(pBase) { assert(pBase); }; protected: RegistrationBase* _pBase; private: //No copy constructor allowed - RegistrationBaseManipulator(const RegistrationBaseManipulator& source); - void operator=(const RegistrationBaseManipulator&); //purposely not implemented + RegistrationBaseManipulator(const RegistrationBaseManipulator& source) = delete; + void operator=(const RegistrationBaseManipulator&) = delete; //purposely not implemented }; /*! @class RegistrationManipulator @brief Grants public write access to Registration classes */ template class RegistrationManipulator { public: - typedef TRegistration RegistrationType; + using RegistrationType = TRegistration; /*! sets the DirectMapping kernel @param pKernel the kernel for direct mapping @eguarantee no fail */ virtual void setDirectMapping(typename RegistrationType::DirectMappingType* pKernel); /*! sets the InverseMapping kernel @param pKernel the kernel for inverse mapping @eguarantee no fail */ virtual void setInverseMapping(typename RegistrationType::InverseMappingType* pKernel); - typedef typename RegistrationType::TagMapType TagMapType; + using TagMapType = typename RegistrationType::TagMapType; /*! @Sets the tags of a registration by replacing the existing tag map with the passed one. * @remark If tags do not contain the tag "RegistrationUID" it will be added automatically. * If it is present it stays untouched. If you define your own UID ensure that it is unique. @eguarantee strong */ virtual void setTagValues(const TagMapType& tags); /*! @brief allows non const access to the registration tags. @eguarantee no fail */ virtual TagMapType& getTagValues(); RegistrationManipulator(RegistrationType* pI); protected: RegistrationType* _pInterface; private: //No copy constructor allowed - RegistrationManipulator(const RegistrationManipulator& source); - void operator=(const RegistrationManipulator&); //purposely not implemented + RegistrationManipulator(const RegistrationManipulator& source) = delete; + void operator=(const RegistrationManipulator&) = delete; //purposely not implemented }; - } -} + } // namespace core +} // namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapRegistrationManipulator.tpp" #endif #endif diff --git a/Code/Core/include/mapRegistrationTopology.h b/Code/Core/include/mapRegistrationTopology.h index 9484895..0b54753 100644 --- a/Code/Core/include/mapRegistrationTopology.h +++ b/Code/Core/include/mapRegistrationTopology.h @@ -1,90 +1,89 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_REGISTRATION_TOPOLOGY_H #define __MAP_REGISTRATION_TOPOLOGY_H #include "mapContinuousElements.h" #include "mapDiscreteElements.h" #include "itkTransform.h" namespace map { namespace core { /*! @class RegistrationTopology * @brief RegistrationTopology defines the very basic data containers needed in the context of registration * * Type of vectors, fields, points and other data depends on the dimensions of the moving * and the target space. The mapping style depends on the nature of the data: continuous * (direct mapping) and discrete (inverse mapping). This is a helper class only containing typedefs * that specify the correct vector fields for both mapping styles depending on the dimensions given * as template parameter. * @remarks This class is not ment to be constructed an is therfore abstract with no constructors of any kind. * @ingroup Registration */ template struct RegistrationTopology { public: //direct mapping itkStaticConstMacro(DirectInputDimension, unsigned int, VMovingDimensions); itkStaticConstMacro(DirectOutputDimension, unsigned int, VTargetDimensions); - typedef typename continuous::Elements< DirectOutputDimension >::VectorType DirectMappingVectorType; + using DirectMappingVectorType = typename continuous::Elements::VectorType; typedef itk::Image< DirectMappingVectorType, DirectInputDimension> DirectFieldType; - typedef typename DirectFieldType::Pointer DirectFieldPointer; - typedef typename DirectFieldType::RegionType DirectFieldRegionType; + using DirectFieldPointer = typename DirectFieldType::Pointer; + using DirectFieldRegionType = typename DirectFieldType::RegionType; typedef ::itk::Transform DirectTransformType; //inverse mapping itkStaticConstMacro(InverseInputDimension, unsigned int, VTargetDimensions); itkStaticConstMacro(InverseOutputDimension, unsigned int, VMovingDimensions); - typedef typename continuous::Elements< InverseOutputDimension >::VectorType - InverseMappingVectorType; + using InverseMappingVectorType = typename continuous::Elements::VectorType; typedef itk::Image< InverseMappingVectorType, InverseInputDimension > InverseFieldType; - typedef typename InverseFieldType::Pointer InverseFieldPointer; - typedef typename InverseFieldType::RegionType InverseFieldRegionType; + using InverseFieldPointer = typename InverseFieldType::Pointer; + using InverseFieldRegionType = typename InverseFieldType::RegionType; typedef ::itk::Transform InverseTransformType; //general - typedef typename continuous::Elements::PointType MovingPointType; - typedef typename continuous::Elements::PointType TargetPointType; + using MovingPointType = typename continuous::Elements::PointType; + using TargetPointType = typename continuous::Elements::PointType; private: typedef RegistrationTopology Self; //purposely not implemented - RegistrationTopology(); + RegistrationTopology() = delete; //purposely not implemented - RegistrationTopology(const Self& source); + RegistrationTopology(const Self& source) = delete; //purposely not implemented - virtual Self& operator = (const Self& source) = 0; + virtual Self& operator = (const Self& source) = delete; }; } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapRepresentationException.h b/Code/Core/include/mapRepresentationException.h index 09f06aa..9d2a31a 100644 --- a/Code/Core/include/mapRepresentationException.h +++ b/Code/Core/include/mapRepresentationException.h @@ -1,92 +1,92 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_REPRESENTATION_EXCEPTION_H #define __MAP_REPRESENTATION_EXCEPTION_H #include "mapExceptionObject.h" namespace map { namespace core { /*! @class RepresentationException * @brief Base exception class for problems with the field representation used within MatchPoint. * * This is the base class for any exception in context of field representations. * @ingroup Exception */ class MAPCore_EXPORT RepresentationException : public ExceptionObject { public: - typedef RepresentationException Self; - typedef ExceptionObject Superclass; + using Self = RepresentationException; + using Superclass = ExceptionObject; /*! Default constructor. Needed to ensure the exception object can be * copied. */ - RepresentationException() : Superclass() {} + RepresentationException() = default; /*! Constructor. Needed to ensure the exception object can be copied. */ RepresentationException(const char* file, unsigned int lineNumber) : Superclass(file, lineNumber) {} /*! Constructor. Needed to ensure the exception object can be copied. */ RepresentationException(const std::string& file, unsigned int lineNumber) : Superclass(file, lineNumber) {} /*! Constructor. Needed to ensure the exception object can be copied. */ RepresentationException(const std::string& file, unsigned int lineNumber, const std::string& desc, const std::string& loc) : Superclass(file, lineNumber, desc, loc) {} /*! Virtual destructor needed for subclasses. Has to have empty throw(). */ - virtual ~RepresentationException() throw() {} + ~RepresentationException() noexcept override = default; - virtual const char* GetNameOfClass() const + const char* GetNameOfClass() const override { return "map::RepresentationException"; } /*! Clones the exception object and returns a pointer to a copy of the exception object. * The cloned object is created on the heap and should function caller has to take care about * proper destruction (e.g. using auto pointer or tr1::shared_pointer). * @remark Used a plain pointer as return value in this case to ensure the no throw guarantee. * This feature is needed by some classes like MappingTaskBatch to ensure the feature of * processing tasks in multiple threads and to deal with any exception after joining the threads * and every task is processed (or failed through an exception). * @return Pointer to the cloned exception. If the cloning fails for any reason the return is NULL. * @eguarantee no throw*/ - virtual BaseExceptionType* clone() const throw(); + BaseExceptionType* clone() const noexcept override; }; /*! @class DimRepresentationException * @brief This exception is used if something is wrong withe the dimension/dimensionality * of a representation. * @ingroup Exception */ mapDeclareExceptionClassMacro(DimRepresentationException, RepresentationException); } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapSDElement.h b/Code/Core/include/mapSDElement.h index 9fe2e68..08d5708 100644 --- a/Code/Core/include/mapSDElement.h +++ b/Code/Core/include/mapSDElement.h @@ -1,234 +1,234 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_SD_ELEMENT_H #define __MAP_SD_ELEMENT_H #include #include #include "itkLightObject.h" #include "itkObjectFactory.h" #include "mapString.h" #include "mapMacros.h" #include "mapMAPCoreExports.h" namespace map { namespace structuredData { /** @class Element @brief class to store and stream structured data This class is inspired by an former f.r.e.e. implementation it models an xml like data structuring scheme and can be used to store and stream data that is some how structured. @ingroup SD */ class MAPCore_EXPORT Element: public ::itk::LightObject { public: - typedef Element Self; - typedef ::itk::LightObject Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = Element; + using Superclass = ::itk::LightObject; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(Element, ::itk::LightObject); itkNewMacro(Self); - typedef core::String TagType; - typedef core::String ValueType; + using TagType = core::String; + using ValueType = core::String; protected: - typedef std::vector SubElementVectorType; + using SubElementVectorType = std::vector; typedef std::map< ::map::core::String, core::String> AttributeMapType; public: - typedef std::vector< ::map::core::String> AttributeNameVectorType; - typedef SubElementVectorType::iterator SubElementIteratorType; - typedef SubElementVectorType::const_iterator ConstSubElementIteratorType; - typedef SubElementVectorType::size_type SubElementIndexType; + using AttributeNameVectorType = std::vector< ::map::core::String>; + using SubElementIteratorType = SubElementVectorType::iterator; + using ConstSubElementIteratorType = SubElementVectorType::const_iterator; + using SubElementIndexType = SubElementVectorType::size_type; //Sub elements ////////////////////////////////////////////////////////////////// SubElementIteratorType getSubElementBegin(); ConstSubElementIteratorType getSubElementBegin() const; SubElementIteratorType getSubElementEnd(); ConstSubElementIteratorType getSubElementEnd() const; /** Returns the sub element indicated by the passed index. * @pre index must be valid * @param [in] index Index of the sub element * @return Pointer to the sub element. If the function returns successfully * the pointer is always valid.*/ const Self* getSubElement(SubElementIndexType index) const; /** @overload non const version*/ Self* getSubElement(SubElementIndexType index); /**Removes the sub element that is located at the passed index. * @pre Index must be within the range of the sub elements. * @param [in] index Index of the sub element that should be removed.*/ void removeSubElement(SubElementIndexType index); /**Removes the sub element that is located at the passed iterator. * @param [in] it Iterator that designates the element that should be removed * @return Iterator that designates the first element beyond the removed one or the end of the vector.*/ SubElementIteratorType removeSubElement(SubElementIteratorType it); /**Adds the passed sub element at the end of the sub element vector * @pre pNewElement must not be NULL * @param [in] pNewElement Pointer to the element that should be added * @return Index of the added element*/ SubElementIndexType addSubElement(Self* pNewElement); /**Adds the passed sub element at the location indicated by the iterator * also passed with the function call. * @pre pNewElement must not be NULL * @param [in] pNewElement Pointer to the element that should be added * @param [in] location Iterator that designates the insert location * @return Iterator that marks the location of the added element.*/ SubElementIteratorType insertSubElement(Self* pNewElement, SubElementIteratorType location); /**Adds the passed sub element at the location indicated by the location index * also passed with the function call. * @pre pNewElement must not be NULL. * @pre location must be within the range of the current sub element vectors. * @param [in] pNewElement Pointer to the element that should be added * @param [in] location Index that indicates the insert location.*/ void insertSubElement(Self* pNewElement, SubElementIndexType location); /**Removes all sub elements*/ void resetSubElements(); /**Returns the number of sub elements*/ SubElementIndexType getSubElementsCount() const; //Attributes ////////////////////////////////////////////////////////////////// /**Removes all attributes */ void resetAttributes(); /**Removes an attribute if existing from the element. @param name The name of the attribute @param recursively Indicates if the attribute should be removed from all sub elements (and their sub elements...) after removed from the current element. @return Indicates if the attribute had existed and was deleted (true) or could not be found (false). If the method was called recursively, the return will be true if at least one time the attribute was found and removed.*/ bool removeAttribute(const core::String& name, bool recursively = false); /**Sets an existing attribute to the passed value, if the attribute does not exist, it will be added. @param name The name of the attribute @param value The new value of the attribute @param recursively Indicates if the attribute should be also set in all sub elements (and their sub elements...) after set in the current element. @return Indicates if the attribute was just set (true) or if it was added by the call (false). If the method was called recursively, the return will be true if at least one time the attribute was just set.*/ bool setAttribute(const core::String& name, const core::String& value, bool recursively = false); /**Returns the value of the specified attribute. * If the attribute does not exist an exception (MissingIdentifierException) will be thrown. * @param name The name of the attribute * @return The value of the attribute.*/ const core::String& getAttribute(const core::String& name) const; /**Indicates if the elements owns the specified attribute. * @param name The name of the attribute * @return Indicates if the attribute exists for this instance.*/ bool attributeExists(const core::String& name) const; /**Return the names of all existing attributes in a vector.*/ AttributeNameVectorType getAttributeNames() const; //All others ////////////////////////////////////////////////////////////////// const TagType& getTag() const; void setTag(const TagType& tag); const ValueType& getValue() const; void setValue(const ValueType& value); void reset(); /**Clones the values of a given instance in a new instance. * @eguarantee strong * @return Smart pointer to the clone.*/ Pointer clone() const; /** Convinience function that creates a simple value element.*/ static Pointer createElement(const TagType& tag, const ValueType& value); protected: Element(); - ~Element(); + ~Element() override; - virtual void PrintSelf(std::ostream& os, ::itk::Indent indent) const; + void PrintSelf(std::ostream& os, ::itk::Indent indent) const override; TagType _Tag; ValueType _Value; SubElementVectorType _SubElements; AttributeMapType _Attributes; private: //No copy constructor allowed - Element(const Self& source); - void operator=(const Self&); //purposely not implemented + Element(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; MAPCore_EXPORT std::ostream& operator<<(std::ostream& os, const Element& element); /** Helper function that takes an sub element iterator, an searches * for the first element that fits the search "description".\n * The search description is always the tag of the element. In addition, * you can specify a attribute and its value to further specify the * searched elements. * @return iterator to a matching element or iterator that equals endPos. * @pre the passed iterators must be from the same container.*/ MAPCore_EXPORT Element::SubElementIteratorType findNextSubElement(const Element::SubElementIteratorType& beginPos, const structuredData::Element::SubElementIteratorType& endPos, const core::String& tag, const core::String& attrName = "", const core::String& attrValue = ""); MAPCore_EXPORT Element::ConstSubElementIteratorType findNextSubElement( const Element::ConstSubElementIteratorType& beginPos, const structuredData::Element::ConstSubElementIteratorType& endPos, const core::String& tag, const core::String& attrName = "", const core::String& attrValue = ""); } //end of namespace structuredData } //end of namespace map #endif diff --git a/Code/Core/include/mapSDExceptions.h b/Code/Core/include/mapSDExceptions.h index e8e668d..c4683ed 100644 --- a/Code/Core/include/mapSDExceptions.h +++ b/Code/Core/include/mapSDExceptions.h @@ -1,178 +1,178 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_SD_EXCEPTIONS_H #define __MAP_SD_EXCEPTIONS_H #include "mapExceptionObject.h" namespace map { namespace core { /** @class MissingIdentifierException * @brief Exception for missing keys (e.g. in structured data) * * MissingIdentifierException is used if request specified by a key/name/id was made * and this identifier is missing. * * @ingroup Exception */ class MAPCore_EXPORT MissingIdentifierException : public ExceptionObject { public: - typedef MissingIdentifierException Self; - typedef ExceptionObject Superclass; + using Self = MissingIdentifierException; + using Superclass = ExceptionObject; /*! Default constructor. Needed to ensure the exception object can be * copied. */ MissingIdentifierException(); /*! Constructor. Needed to ensure the exception object can be copied. */ MissingIdentifierException(const String& file, unsigned int lineNumber); /*! Constructor. Needed to ensure the exception object can be copied. */ MissingIdentifierException(const String& file, unsigned int lineNumber, const String& desc, const String& loc); /*! Virtual destructor needed for subclasses. Has to have empty throw(). */ - virtual ~MissingIdentifierException() throw(); + ~MissingIdentifierException() noexcept override; - virtual const char* GetNameOfClass() const + const char* GetNameOfClass() const override { return "map::MissingIdentifierException"; } /*! Clones the exception object and returns a pointer to a copy of the exception object. * The cloned object is created on the heap and should function caller has to take care about * proper destruction (e.g. using auto pointer or tr1::shared_pointer). * @remark Used a plain pointer as return value in this case to ensure the no throw guarantee. * This feature is needed by some classes like RegistrationTaskBatch to ensure the feature of * processing tasks in multiple threads and to deal with any exception after joining the threads * and every task is processed (or failed through an exception). * @return Pointer to the cloned exception. If the cloning fails for any reason the return is NULL. * @eguarantee no throw*/ - virtual BaseExceptionType* clone() const throw(); + BaseExceptionType* clone() const noexcept override; }; MAPCore_EXPORT std::ostream& operator<<(std::ostream& os, const MissingIdentifierException& exception); /** @class OutOfRangeException * @brief Exception for requests that are out of range. * * OutOfRangeException is used if an index or request is out of range. * * @ingroup Exception */ class MAPCore_EXPORT OutOfRangeException : public ExceptionObject { public: - typedef OutOfRangeException Self; - typedef ExceptionObject Superclass; + using Self = OutOfRangeException; + using Superclass = ExceptionObject; /*! Default constructor. Needed to ensure the exception object can be * copied. */ OutOfRangeException(); /*! Constructor. Needed to ensure the exception object can be copied. */ OutOfRangeException(const String& file, unsigned int lineNumber); /*! Constructor. Needed to ensure the exception object can be copied. */ OutOfRangeException(const String& file, unsigned int lineNumber, const String& desc, const String& loc); /*! Virtual destructor needed for subclasses. Has to have empty throw(). */ - virtual ~OutOfRangeException() throw(); + ~OutOfRangeException() noexcept override; - virtual const char* GetNameOfClass() const + const char* GetNameOfClass() const override { return "map::OutOfRangeException"; } /*! Clones the exception object and returns a pointer to a copy of the exception object. * The cloned object is created on the heap and should function caller has to take care about * proper destruction (e.g. using auto pointer or tr1::shared_pointer). * @remark Used a plain pointer as return value in this case to ensure the no throw guarantee. * This feature is needed by some classes like RegistrationTaskBatch to ensure the feature of * processing tasks in multiple threads and to deal with any exception after joining the threads * and every task is processed (or failed through an exception). * @return Pointer to the cloned exception. If the cloning fails for any reason the return is NULL. * @eguarantee no throw*/ - virtual BaseExceptionType* clone() const throw(); + BaseExceptionType* clone() const noexcept override; }; MAPCore_EXPORT std::ostream& operator<<(std::ostream& os, const OutOfRangeException& exception); /** @class SDStreamingException * @brief Exception for missing keys in f.r.e.e.. * * SDStreamingException is used if there is an error while streaming structured data. * * @ingroup Exceptions */ class MAPCore_EXPORT SDStreamingException : public ExceptionObject { public: - typedef SDStreamingException Self; - typedef ExceptionObject Superclass; + using Self = SDStreamingException; + using Superclass = ExceptionObject; /*! Default constructor. Needed to ensure the exception object can be * copied. */ SDStreamingException(); /*! Constructor. Needed to ensure the exception object can be copied. */ SDStreamingException(const String& file, unsigned int lineNumber); /*! Constructor. Needed to ensure the exception object can be copied. */ SDStreamingException(const String& file, unsigned int lineNumber, const String& desc, const String& loc); /*! Virtual destructor needed for subclasses. Has to have empty throw(). */ - virtual ~SDStreamingException() throw(); + ~SDStreamingException() noexcept override; - virtual const char* GetNameOfClass() const + const char* GetNameOfClass() const override { return "map::SDStreamingException"; } /*! Clones the exception object and returns a pointer to a copy of the exception object. * The cloned object is created on the heap and should function caller has to take care about * proper destruction (e.g. using auto pointer or tr1::shared_pointer). * @remark Used a plain pointer as return value in this case to ensure the no throw guarantee. * This feature is needed by some classes like RegistrationTaskBatch to ensure the feature of * processing tasks in multiple threads and to deal with any exception after joining the threads * and every task is processed (or failed through an exception). * @return Pointer to the cloned exception. If the cloning fails for any reason the return is NULL. * @eguarantee no throw*/ - virtual BaseExceptionType* clone() const throw(); + BaseExceptionType* clone() const noexcept override; }; MAPCore_EXPORT std::ostream& operator<<(std::ostream& os, const SDStreamingException& exception); } //end of namespace core } //end of namespace map #endif diff --git a/Code/Core/include/mapSDITKStreamingHelper.tpp b/Code/Core/include/mapSDITKStreamingHelper.tpp index c701825..1470c4e 100644 --- a/Code/Core/include/mapSDITKStreamingHelper.tpp +++ b/Code/Core/include/mapSDITKStreamingHelper.tpp @@ -1,159 +1,159 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_SD_ITK_STREAMING_HELPER_TPP #define __MAP_SD_ITK_STREAMING_HELPER_TPP #include "mapSDITKStreamingHelper.h" #include "mapExceptionObjectMacros.h" namespace map { namespace structuredData { template Element::Pointer streamITKMatrixToSD(const TMatrix& matrix) { structuredData::Element::Pointer spMatrixElement = structuredData::Element::New(); spMatrixElement->setTag("Matrix"); for (unsigned int rowID = 0; rowID < TMatrix::RowDimensions; ++rowID) { for (unsigned int colID = 0; colID < TMatrix::ColumnDimensions; ++colID) { structuredData::Element::Pointer spValueElement = structuredData::Element::New(); spValueElement->setTag(tags::Value); spValueElement->setValue(core::convert::toStr(matrix(rowID, colID))); spValueElement->setAttribute(tags::Column, core::convert::toStr(colID)); spValueElement->setAttribute(tags::Row, core::convert::toStr(rowID)); spMatrixElement->addSubElement(spValueElement); } } return spMatrixElement; }; template TMatrix streamSDToITKMatrix(const Element* pElement) { assert(pElement); if (!pElement) { mapDefaultExceptionStaticMacro( << "Cannot convert structured data into itk matrix. Structured element is missing."); } if (pElement->getSubElementsCount() != TMatrix::RowDimensions * TMatrix::ColumnDimensions) { mapDefaultExceptionStaticMacro( << "Error: convert structured data into itk matrix. Reason: matrix has wrong number of elements. Expected: " << TMatrix::RowDimensions * TMatrix::ColumnDimensions << "; found: " << pElement->getSubElementsCount()); } TMatrix matrix; - for (structuredData::Element::ConstSubElementIteratorType pos = pElement->getSubElementBegin(); + for (auto pos = pElement->getSubElementBegin(); pos != pElement->getSubElementEnd(); ++pos) { if ((*pos)->getTag() != tags::Value) { mapDefaultExceptionStaticMacro( << "Error: convert structured data into itk matrix. Reason: contains wrong sub elements, only \"Value\" os allowed. Wrong sub element tag: " << (*pos)->getTag()); } unsigned int rowID = core::convert::toUInt((*pos)->getAttribute(tags::Row)); unsigned int colID = core::convert::toUInt((*pos)->getAttribute(tags::Column)); matrix(rowID, colID) = core::convert::toValueGeneric(( *pos)->getValue()); } return matrix; }; template Element::Pointer streamITKFixedArrayToSD(const TITKFixedArray& array) { structuredData::Element::Pointer spArrayElement = structuredData::Element::New(); spArrayElement->setTag("FixedArray"); for (unsigned int rowID = 0; rowID < TITKFixedArray::Dimension; ++rowID) { structuredData::Element::Pointer spValueElement = structuredData::Element::New(); spValueElement->setTag(tags::Value); spValueElement->setValue(core::convert::toStr(array[rowID])); spValueElement->setAttribute(tags::Row, core::convert::toStr(rowID)); spArrayElement->addSubElement(spValueElement); } return spArrayElement; }; template TITKFixedArray streamSDToITKFixedArray(const Element* pElement) { assert(pElement); if (!pElement) { mapDefaultExceptionStaticMacro( << "Cannot convert structured data into itk fixed array. Structured element is missing."); } if (pElement->getSubElementsCount() != TITKFixedArray::Dimension) { mapDefaultExceptionStaticMacro( << "Error: convert structured data into itk fixed array. Reason: matrix has wrong number of elements. Expected: " << TITKFixedArray::Dimension << "; found: " << pElement->getSubElementsCount()); } TITKFixedArray fixedArray; - for (structuredData::Element::ConstSubElementIteratorType pos = pElement->getSubElementBegin(); + for (auto pos = pElement->getSubElementBegin(); pos != pElement->getSubElementEnd(); ++pos) { unsigned int rowID = core::convert::toUInt((*pos)->getAttribute(tags::Row)); fixedArray[rowID] = core::convert::toValueGeneric(( *pos)->getValue()); } return fixedArray; }; } //end of namespace structuredData } //end of namespace map #endif diff --git a/Code/Core/include/mapSDStreamingInterface.h b/Code/Core/include/mapSDStreamingInterface.h index d9dbf80..f95d60e 100644 --- a/Code/Core/include/mapSDStreamingInterface.h +++ b/Code/Core/include/mapSDStreamingInterface.h @@ -1,69 +1,69 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_SD_STREAMING_INTERFACE_H #define __MAP_SD_STREAMING_INTERFACE_H #include "mapSDElement.h" namespace map { namespace structuredData { /** @class StreamingInterface * @brief Interface class that should be inherited and implemented by every class that should by * able to stream via map::structuredData elements. * @ingroup SD */ class MAPCore_EXPORT StreamingInterface { public: - typedef Element::Pointer ElementPointer; + using ElementPointer = Element::Pointer; ElementPointer streamToStructuredData() const; void streamFromStructuredData(const Element* pElement); protected: virtual ElementPointer streamToSDInternal() const = 0; virtual void streamFromSDInternal(const Element* pElement) = 0; StreamingInterface(); virtual ~StreamingInterface(); private: //No copy constructor allowed - StreamingInterface(const StreamingInterface& source); - void operator=(const StreamingInterface&); //purposely not implemented + StreamingInterface(const StreamingInterface& source) = delete; + void operator=(const StreamingInterface&) = delete; //purposely not implemented }; } //end of namespace structuredData } //end of namespace map #endif diff --git a/Code/Core/include/mapSDTags.h b/Code/Core/include/mapSDTags.h index 2ad4dd0..417dbce 100644 --- a/Code/Core/include/mapSDTags.h +++ b/Code/Core/include/mapSDTags.h @@ -1,51 +1,51 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_SD_TAGS_H #define __MAP_SD_TAGS_H namespace map { namespace tags { /** Indicates which kind of reader was used to recieve the data that was used to generate the structured data. e.g.: file = for FileReader; string = string in memory...*/ const char* const SDInternalSourceReader = "sdInternal:SourceReader"; const char* const SDInternalSourceReader_file = "file"; const char* const SDInternalSourceReader_string = "string"; /** Indicates which kind of format the structured data was stored in. e.g.: xml...*/ const char* const SDInternalSourceFormat = "sdInternal:SourceFormat"; const char* const SDInternalSourceFormat_xml = "xml"; /** Indicates the location of the data source. e.g.: the file path...*/ const char* const SDInternalSourceURI = "sdInternal:SourceURI"; - } -} + } // namespace tags +} // namespace map #endif diff --git a/Code/Core/include/mapSDXMLFileReader.h b/Code/Core/include/mapSDXMLFileReader.h index deda678..3fbda11 100644 --- a/Code/Core/include/mapSDXMLFileReader.h +++ b/Code/Core/include/mapSDXMLFileReader.h @@ -1,94 +1,94 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_SD_XML_FILE_READER_H #define __MAP_SD_XML_FILE_READER_H #include "mapSDElement.h" #include "mapSDStreamingInterface.h" namespace map { namespace structuredData { /** @class XMLFileReader * @brief Takes a xml containing file and converts its content into StructuredData elements * Converts the xml content of a file into StructuredData elements. The root element is always representing * the complete file, all sub elements of the root element are top level xml elemtents found * in the string. * @ingroup SD */ class MAPCore_EXPORT XMLFileReader: public ::itk::LightObject { public: - typedef XMLFileReader Self; - typedef ::itk::LightObject Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = XMLFileReader; + using Superclass = ::itk::LightObject; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(XMLFileReader, ::itk::LightObject); itkNewMacro(Self); - typedef Element::Pointer ElementPointer; + using ElementPointer = Element::Pointer; /**Reads the content of a file. The content will be handled as XML and parsed * to generate the according structured data elements. * @param [in] filePath String that defines the location of the file that should be read. * @return SmartPointer to the root element. The root * element designates the file itself. All found * top level xml elements will be added as sub elements * to the root StructuredData element.*/ ElementPointer read(const core::String& filePath); /**Reads StructuredData elements from the the specified filepath and streams it to the passed instance of the StreamingInterface * @param [in] filePath String that defines the location of the file. * @param [in] pInterface Pointer to the streamable interface instance. The pointer must not be NULL. * @pre The Pointer pInterface must not be NULL. * @pre The specified file path must specify a file location within an existing directory.*/ void read(const core::String& filePath, StreamingInterface* pInterface); /**Returns the xml top level element read from the file. * @return SmartPointer to the top level element of the read file. If no file has been read * successfully or the file does not contain an xml element the return is NULL.*/ ElementPointer getXMLContent(); protected: ElementPointer _spRoot; XMLFileReader(); - ~XMLFileReader(); + ~XMLFileReader() override; private: //No copy constructor allowed - XMLFileReader(const Self& source); - void operator=(const Self&); //purposely not implemented + XMLFileReader(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; } //end of namespace structuredData } //end of namespace map #endif diff --git a/Code/Core/include/mapSDXMLFileWriter.h b/Code/Core/include/mapSDXMLFileWriter.h index 6fca0a1..26b8b5e 100644 --- a/Code/Core/include/mapSDXMLFileWriter.h +++ b/Code/Core/include/mapSDXMLFileWriter.h @@ -1,94 +1,94 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_SD_XML_FILE_WRITER_H #define __MAP_SD_XML_FILE_WRITER_H #include "mapSDElement.h" #include "mapSDStreamingInterface.h" namespace map { namespace structuredData { //* @TODO Und in der XMLStrReader-Implementierung die Encodings oder ähnliches noch freilegen. /** @class XMLFileWriter * @brief Transforms StructuredData elements into xml and store it as file. * Converts a StructuredData element instance or object implementing the StreamingInterface into an xml content. * This content is stored as a file specified by the file path. * @ingroup SD */ class MAPCore_EXPORT XMLFileWriter: public ::itk::LightObject { public: - typedef XMLFileWriter Self; - typedef ::itk::LightObject Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = XMLFileWriter; + using Superclass = ::itk::LightObject; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(XMLFileWriter, ::itk::LightObject); itkNewMacro(Self); - typedef Element::Pointer ElementPointer; + using ElementPointer = Element::Pointer; void setXSLTFile(const core::String& file); ::map::core::String getXSLTFile() const; /**Write the passed StructuredData element as xml to the specified filepath. * @param [in] filePath String that defines the location of the file. If the file already exists, * it will be overwritten. * @param [in] pElement Pointer to the StructuredData element that should be converted into an * xml file. The pointer must not be NULL. * @pre The Pointer pElement must not be NULL. * @pre The specified file path must specify a file location within an existing directory.*/ void write(const core::String& filePath, const Element* pElement); /**Write the passed instance with a StreamingInterface as xml to the specified filepath * by converting the instance to a StructuredData element. * @param [in] filePath String that defines the location of the file. If the file already exists, * it will be overwritten. * @param [in] pInterface Pointer to the streamable interface instance. The pointer must not be NULL. * @pre The Pointer pInterface must not be NULL. * @pre The specified file path must specify a file location within an existing directory.*/ void write(const core::String& filePath, const StreamingInterface* pInterface); protected: ::map::core::String _XSLTFile; ::map::core::String _EncodingType; XMLFileWriter(); - ~XMLFileWriter(); + ~XMLFileWriter() override; private: //No copy constructor allowed - XMLFileWriter(const Self& source); - void operator=(const Self&); //purposely not implemented + XMLFileWriter(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; } //end of namespace structuredData } //end of namespace map #endif diff --git a/Code/Core/include/mapSDXMLStrReader.h b/Code/Core/include/mapSDXMLStrReader.h index f3b3c2f..d0c04e1 100644 --- a/Code/Core/include/mapSDXMLStrReader.h +++ b/Code/Core/include/mapSDXMLStrReader.h @@ -1,95 +1,95 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_SD_XML_READER_H #define __MAP_SD_XML_READER_H #include "mapSDElement.h" namespace map { namespace structuredData { //* @TODO Und in der XMLStrReader-Implementierung die Encodings oder ähnliches noch freilegen. /** @class XMLStrReader * @brief Takes a xml containing string and converts it into StructuredData elements * Converts the xml string into StructuredData elements. The root element is always representing * the complete string, all sub elements of the root element are top level xml elemtents found * in the string. * @ingroup SD */ class MAPCore_EXPORT XMLStrReader: public ::itk::LightObject { public: - typedef XMLStrReader Self; - typedef ::itk::LightObject Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = XMLStrReader; + using Superclass = ::itk::LightObject; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(XMLStrReader, ::itk::LightObject); itkNewMacro(Self); - typedef core::String XMLRawDataType; - typedef Element::Pointer ElementPointer; + using XMLRawDataType = core::String; + using ElementPointer = Element::Pointer; /**Reads the string and converts the xml top level element and all * sub elements into structured data elements. * @param [in] Reference to the xml string * @return SmartPointer to the top level xml element. If the string contains no XML element * an exception will be raised.*/ - ElementPointer readXMLContent(const XMLRawDataType&); + ElementPointer readXMLContent(const XMLRawDataType& /*data*/); /**Reads the string and converts it into structured * data elements. * @param [in] Reference to the xml string * @return SmartPointer to the root element. The root * element designates the string itself. All found * top level xml elements and information will be added as sub elements * to the root StructuredData element.*/ - ElementPointer read(const XMLRawDataType&); + ElementPointer read(const XMLRawDataType& /*data*/); protected: XMLStrReader(); - ~XMLStrReader(); + ~XMLStrReader() override; private: //No copy constructor allowed - XMLStrReader(const Self& source); - void operator=(const Self&); //purposely not implemented + XMLStrReader(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; /** * Helper function that deescapes substrings that are xml encoded (e.g. ">" -> ">") * @param sSrc The src string to escape. * @return sSrc encoded for insertion into xml. * @ingroup SD */ MAPCore_EXPORT core::String decodeForXml(const core::String& sSrc); - } //end of namespace StructuredData + } // namespace structuredData -} //end of namespace free +} // namespace map #endif diff --git a/Code/Core/include/mapSDXMLStrWriter.h b/Code/Core/include/mapSDXMLStrWriter.h index 1e17180..9ebfc4f 100644 --- a/Code/Core/include/mapSDXMLStrWriter.h +++ b/Code/Core/include/mapSDXMLStrWriter.h @@ -1,123 +1,123 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_SD_XML_STR_WRITER_H #define __MAP_SD_XML_STR_WRITER_H #include #include #include "mapSDElement.h" namespace map { namespace structuredData { /** @class XMLStrWriter @brief Takes a StructuredData element and converts it into a plain xml string. @remark Internal attributes (namespace "sdInternal:") will be removed before StructuredData will be converted into a string. @ingroup SD */ class MAPCore_EXPORT XMLStrWriter: public ::itk::LightObject { public: - typedef XMLStrWriter Self; - typedef ::itk::LightObject Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = XMLStrWriter; + using Superclass = ::itk::LightObject; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(XMLStrWriter, ::itk::LightObject); itkNewMacro(Self); /**Transforms a passed element into the according xml * structure and returns it as a string. * @pre Passed element pointer must not be NULL. * @param [in] Pointer to the structured data element * @return String continingxontmartPointer to the root element. The root * element designates the string itself. All found * top level xml elements will be added as sub elements * to the root StructuredData element.*/ ::map::core::String write(const Element* pElement) const; protected: - typedef unsigned long ElementLevelType; + using ElementLevelType = unsigned long; virtual core::String writeElement(const Element* pElement, const ElementLevelType& level) const; virtual core::String writeAttributes(const Element* pElement, const ElementLevelType& level) const; virtual core::String writeSubElements(const Element* pElement, const ElementLevelType& level) const; XMLStrWriter(); - ~XMLStrWriter(); + ~XMLStrWriter() override; private: //No copy constructor allowed - XMLStrWriter(const Self& source); - void operator=(const Self&); //purposely not implemented + XMLStrWriter(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; /** @class XMLIntendedStrWriter @brief Takes a StructuredData element and converts it into a formated and intended xml string. @remark Internal attributes (namespace "sdInternal:") will be removed before StructuredData will be converted into a string. @ingroup SD */ class MAPCore_EXPORT XMLIntendedStrWriter: public XMLStrWriter { public: - typedef XMLIntendedStrWriter Self; - typedef XMLStrWriter Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = XMLIntendedStrWriter; + using Superclass = XMLStrWriter; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(XMLIntendedStrWriter, XMLStrWriter); itkNewMacro(Self); protected: - typedef Superclass::ElementLevelType ElementLevelType; + using ElementLevelType = Superclass::ElementLevelType; - virtual core::String writeElement(const Element* pElement, const ElementLevelType& level) const; + core::String writeElement(const Element* pElement, const ElementLevelType& level) const override; XMLIntendedStrWriter(); - ~XMLIntendedStrWriter(); + ~XMLIntendedStrWriter() override; private: //No copy constructor allowed - XMLIntendedStrWriter(const Self& source); - void operator=(const Self&); //purposely not implemented + XMLIntendedStrWriter(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; /** * Helper function that escape characters that will interfere with xml. * @param sSrc The src string to escape. * @return sSrc encoded for insertion into xml. * @ingroup SD */ MAPCore_EXPORT core::String encodeForXml(const core::String& sSrc); } //end of namespace structuredData } //end of namespace map #endif diff --git a/Code/Core/include/mapServiceException.h b/Code/Core/include/mapServiceException.h index aea2280..891dac1 100644 --- a/Code/Core/include/mapServiceException.h +++ b/Code/Core/include/mapServiceException.h @@ -1,83 +1,83 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_SERVICE_EXCEPTION_H #define __MAP_SERVICE_EXCEPTION_H #include "mapExceptionObject.h" namespace map { namespace core { /*! @class ServiceException * @brief Base exception class for exception within the service classes. * * This is the base class for any exception that is caused by service providers or service stacks in the context of providing services. * @ingroup Exception */ class MAPCore_EXPORT ServiceException : public ExceptionObject { public: - typedef ServiceException Self; - typedef ExceptionObject Superclass; + using Self = ServiceException; + using Superclass = ExceptionObject; /*! Default constructor. Needed to ensure the exception object can be * copied. */ - ServiceException() : Superclass() {} + ServiceException() = default; /*! Constructor. Needed to ensure the exception object can be copied. */ ServiceException(const char* file, unsigned int lineNumber) : Superclass(file, lineNumber) {} /*! Constructor. Needed to ensure the exception object can be copied. */ ServiceException(const std::string& file, unsigned int lineNumber) : Superclass(file, lineNumber) {} /*! Constructor. Needed to ensure the exception object can be copied. */ ServiceException(const std::string& file, unsigned int lineNumber, const std::string& desc, const std::string& loc) : Superclass(file, lineNumber, desc, loc) {} /*! Virtual destructor needed for subclasses. Has to have empty throw(). */ - virtual ~ServiceException() throw() {} + ~ServiceException() noexcept override = default; - virtual const char* GetNameOfClass() const + const char* GetNameOfClass() const override { return "map::ServiceException"; } /*! Clones the exception object and returns a pointer to a copy of the exception object. * The cloned object is created on the heap and should function caller has to take care about * proper destruction (e.g. using auto pointer or tr1::shared_pointer). * @remark Used a plain pointer as return value in this case to ensure the no throw guarantee. * This feature is needed by some classes like MappingTaskBatch to ensure the feature of * processing tasks in multiple threads and to deal with any exception after joining the threads * and every task is processed (or failed through an exception). * @return Pointer to the cloned exception. If the cloning fails for any reason the return is NULL. * @eguarantee no throw*/ - virtual BaseExceptionType* clone() const throw(); + BaseExceptionType* clone() const noexcept override; }; } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapServiceProvider.h b/Code/Core/include/mapServiceProvider.h index e2029e7..8926e7c 100644 --- a/Code/Core/include/mapServiceProvider.h +++ b/Code/Core/include/mapServiceProvider.h @@ -1,94 +1,94 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_SERVICE_PROVIDER_H #define __MAP_SERVICE_PROVIDER_H #include "mapString.h" #include "itkObject.h" namespace map { namespace core { namespace services { /*! @class ServiceProvider * @brief Base class for any instance in MatchPoint that provides services * * In different parts of the code MatchPoint uses a dynamic dispatch mechanism * to get a proper provider for a needed type of service (e.g. the inversion of * registration kernels). To allow dynamic selection of the right code and integration * in the service fascility, you can deriver from ServiceProvider the base class of a * special service provider type. * * @sa ServiceStack * @ingroup Services */ template class ServiceProvider : public itk::Object { public: /*! Standard class typedefs. */ - typedef ServiceProvider Self; - typedef itk::Object Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Self = ServiceProvider; + using Superclass = itk::Object; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(ServiceProvider, itk::Object); - typedef TRequestType RequestType; + using RequestType = TRequestType; /*! Uses the passed request data to check if the provider is able to provide the service for * this request. * @return Indicates if the provider offers the right solution. * @retval true Provider can handle the request. * @retval false Provider is not able to handle the request.*/ virtual bool canHandleRequest(const RequestType& request) const = 0; /*! Returns an ID of the provider as string. May be equal to GetClassName(), but it may differ. * @return Service provider ID.*/ virtual String getProviderName() const = 0; /*! Returns an ID of the provider as string. May be equal to GetClassName(), but it may differ. * @return Service provider ID. * @remark It is a return by value, becaus it might be possible that the description is generated on line * when calling this method.*/ virtual String getDescription() const = 0; protected: - ServiceProvider() {}; - virtual ~ServiceProvider() {}; + ServiceProvider() = default; + ~ServiceProvider() override = default; private: - ServiceProvider(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented + ServiceProvider(const Self&) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; } // end namespace services } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapServiceRepositoryPolicyLoadInterface.h b/Code/Core/include/mapServiceRepositoryPolicyLoadInterface.h index d1613b4..40bfb4d 100644 --- a/Code/Core/include/mapServiceRepositoryPolicyLoadInterface.h +++ b/Code/Core/include/mapServiceRepositoryPolicyLoadInterface.h @@ -1,137 +1,137 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_SERVICE_REPOSITORY_POLICY_LOAD_INTERFACE_H #define __MAP_SERVICE_REPOSITORY_POLICY_LOAD_INTERFACE_H #include "itkObject.h" -#include +#include namespace map { namespace core { namespace services { //forward decleration template class ServiceRepositoryPolicyLoader; /*! @class ServiceRepositoryPolicyLoadInterface * @brief Interface for repositories that load service providers via policies. * * @ingroup Services * @tparam TProviderBase Base class of the service providers that should be loaded. * must be based on ServicProvider */ template class ServiceRepositoryPolicyLoadInterface { protected: - typedef ServiceRepositoryPolicyLoadInterface Self; + using Self = ServiceRepositoryPolicyLoadInterface; friend class ServiceRepositoryPolicyLoader; - typedef TProviderBase ProviderBaseType; + using ProviderBaseType = TProviderBase; /*! Registers a given provider in the stack. The new provider will be topmost and therfore * will be favored over providers registered ealier. The stack will behave like a smartpointer * for the registered provider, thus as long as a provider is registered he won't be deleted. * An instance of a provider (identified via pointer) can only added once to the stack. If the instance * is already on the stack, the stack will stay unchanged. * \n Function is supposed to be used by loading policies of the repository (e.g. stack). * @eguarantee strong * @param [in] pProvider Pointer to the provider that should be added. * @return Boolean that indicates if the provider (identified by provider name) has been added. * @retval true The provider was added as topmost element to the stack. * @retval false The provider was already on the stack. Stack is unchanged. * @post Stack is unchanged or added provider is the topmost element on the stack. */ virtual bool addProviderByPolicy(ProviderBaseType* pProvider) = 0; /*! Removes the provider (identified by the pointer address) from the stack. * \n Function is supposed to be used by loading policies of the repository (e.g. stack). * @eguarantee strong * @param [in] pProvider Pointer to the provider that should be removed from stack. * @return Boolean that indicates if there was a provider (identified by pointer) * on the stack. * @retval true The provider instance was on the stack and was removed. * @retval false The provider instance is not a part of the stack. */ virtual bool removeProviderByPolicy(ProviderBaseType* pProvider) = 0; protected: - ServiceRepositoryPolicyLoadInterface() {}; - virtual ~ServiceRepositoryPolicyLoadInterface() {}; + ServiceRepositoryPolicyLoadInterface() = default; + virtual ~ServiceRepositoryPolicyLoadInterface() = default; private: - ServiceRepositoryPolicyLoadInterface(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented + ServiceRepositoryPolicyLoadInterface(const Self&) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; /*! @class ServiceRepositoryPolicyLoader * @brief Helper class to access the ServiceRepositoryPolicyLoadInterface methods * of any class that implements these methods. * @sa ServiceRepositoryPolicyLoader * @ingroup Services * @tparam TInterface Interface the loader should interact with. */ template class ServiceRepositoryPolicyLoader { public: - typedef TInterface InterfaceType; - typedef typename InterfaceType::ProviderBaseType ProviderBaseType; + using InterfaceType = TInterface; + using ProviderBaseType = typename InterfaceType::ProviderBaseType; virtual bool addProviderByPolicy(ProviderBaseType* pProvider) { return _pInterface->addProviderByPolicy(pProvider); }; virtual bool removeProviderByPolicy(ProviderBaseType* pProvider) { return _pInterface->removeProviderByPolicy(pProvider); }; ServiceRepositoryPolicyLoader(InterfaceType* pInterface): _pInterface(pInterface) { assert(pInterface); }; - virtual ~ServiceRepositoryPolicyLoader() {}; + virtual ~ServiceRepositoryPolicyLoader() = default; protected: InterfaceType* _pInterface; private: - typedef ServiceRepositoryPolicyLoader Self; - ServiceRepositoryPolicyLoader(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented + using Self = ServiceRepositoryPolicyLoader; + ServiceRepositoryPolicyLoader(const Self&) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; } // end namespace services } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapServiceStack.h b/Code/Core/include/mapServiceStack.h index 678f2a2..e1e50c2 100644 --- a/Code/Core/include/mapServiceStack.h +++ b/Code/Core/include/mapServiceStack.h @@ -1,233 +1,233 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_SERVICE_STACK_H #define __MAP_SERVICE_STACK_H #include "mapString.h" #include "mapNoneStaticLoadPolicy.h" #include "mapFastLockedThreadingPolicy.h" #include "mapServiceRepositoryPolicyLoadInterface.h" #include "itkObject.h" namespace map { namespace core { namespace services { /*! @class ServiceStack * @brief Class is implements a kind of "run time dynamic" switch yard * * In different parts of the code MatchPoint uses a dynamic dispatch mechanism * to get a proper provider for a needed type of service (e.g. the inversion of * registration kernels). This is normaly done by a ServiceStack. ServiceStacks * contain a number of service provider. If a suitable provider should be found * each provider in the stack, from top (last added) to bottom (first added) will * asked if it can handle the request. The first provider proclaiming itself suitable * will be selected. So it can be seen like switch-cases with breaks. * The default providers of a stack can be adjusted by the loading policy passed * as template TStaticLoadPolicy (1). The threading behaviour of the class can * be changed by TThreadingPolicy. \n * @remark the Stack will act like a smart pointer for providers, thus it increases the * reference count (on register) and decreases it (on unregister) if needed. * (1): The concept of policy based class designed is explained in the following book:\ * Andrei Alexandrescu: Modern C++ Design, C++ In-Depth Series, Addison Wesley, 2001. * * @sa ServiceProvider * @ingroup Services * @tparam TProviderBase Base class of the service providers handled by the stack. * must be based on ServicProvider * @tparam TStaticLoadPolicy Policy defines the default providers of the stack and there sequence * @tparam TThreadingPolicy Policy defines the stack will handles issues of the use in a multi * threadding context. * @TODO Mit die providerliste als eigene Classe kapseln, dann kann sie elegant als pimpel genutzt werden und * und wir erreichen eine strong guarantee be remove all und rehash. */ template , class TThreadingPolicy = FastLockedThreadingPolicy> class ServiceStack: public itk::Object, public TStaticLoadPolicy, public TThreadingPolicy, public ServiceRepositoryPolicyLoadInterface { public: /*! Standard class typedefs. */ typedef ServiceStack Self; - typedef itk::Object Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Superclass = itk::Object; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; - typedef TStaticLoadPolicy StaticLoadPolicyType; - typedef TThreadingPolicy ThreadingPolicyType; - typedef TProviderBase ProviderBaseType; - typedef typename ProviderBaseType::Pointer ProviderBasePointer; - typedef typename ProviderBaseType::RequestType RequestType; + using StaticLoadPolicyType = TStaticLoadPolicy; + using ThreadingPolicyType = TThreadingPolicy; + using ProviderBaseType = TProviderBase; + using ProviderBasePointer = typename ProviderBaseType::Pointer; + using RequestType = typename ProviderBaseType::RequestType; itkTypeMacro(ServiceProvider, itk::Object); /*! Static methods that creates a provider stack, registeres the stack to the load policy * and calls rehash for the first time to ensure that all the default providers are loaded. * Thus it is a specialized version of the itkNewMacro() * @eguarantee strong * @param [in] doRehash Indicates if rehash should be called directly after creating the stack. * @return Smart pointer to the new stack*/ static Pointer New(bool doRehash = true); /*! Creates a stack via New and returns it as a LightObject smart pointer. * @eguarantee strong * @return Smart pointer to the new stack as LightObject*/ - virtual ::itk::LightObject::Pointer CreateAnother(void) const; + ::itk::LightObject::Pointer CreateAnother() const override; /*! Returns a pointer to the provider that might can handle the request. * @eguarantee strong * @param [in] request Referenz to the request specifing the requirements on the provider * @return Pointer to a suitable provider. Return value may be null. * @retval NULL There was no suitable provider in the stack. */ ProviderBaseType* getProvider(const RequestType& request) const; /*! Returns a pointer to the provider with the specified name. * @eguarantee strong * @param [in] providerName String referenz to the wanted provider name. * @return Pointer to a suitable provider. Return value may be null. * @retval NULL There was no suitable provider in the stack. */ ProviderBaseType* getProvider(const String& providerName) const; /*! Indicates if there is a provider that can handle the passed request. * @eguarantee strong * @param [in] request Referenz to the request specifing the requirements on the provider * @return Boolean that indicates if there is at least on suitable provider. * @retval true There is a suitable provider in the stack. * @retval false There is no suitable provider in the stack. */ bool providerIsAvailable(const RequestType& request) const; /*! Registers a given provider in the stack. The new provider will be topmost and therfore * will be favored over providers registered ealier. The stack will behave like a smartpointer * for the registered provider, thus as long as a provider is registered he won't be deleted. * An instance of a provider (identified via pointer) can only added once to the stack. If the instance * is already on the stack, the stack will stay unchanged. * @eguarantee strong * @param [in] pProvider Pointer to the provider that should be added. * @return Boolean that indicates if the provider (identified by provider name) has been added. * @retval true The provider was added as topmost element to the stack. * @retval false The provider was already on the stack. Stack is unchanged. * @post Stack is unchanged or added provider is the topmost element on the stack. */ bool registerProvider(ProviderBaseType* pProvider); /*! Removes the provider (identified only by the pointer address) from the stack. * @eguarantee strong * @param [in] pProvider Pointer to the provider that should be removed from stack. * @return Boolean that indicates if there was a provider (identified by pointer) * on the stack. * @retval true The provider instance was on the stack and was removed. * @retval false The provider instance is not a part of the stack. */ bool unregisterProviderByPointer(ProviderBaseType* pProvider); /*! Removes the topmost entry of a given provider (identified by the provider name) * from the stack. * @eguarantee strong * @param [in] providerName String reference to the provider name that identifies the provider. * @return Boolean that indicates if the provider (identified by pointer) has at least one mor * entry on the stack. * @retval true There is no more entry for this provider in the stack. * @retval false There is at least one more entry for this provider in the stack. */ bool unregisterProvider(const String& providerName); /*! Removes all providers from the stack. * @eguarantee basic*/ void unregisterAll(); /*! Clears the stack (unregisterAll) and loads all default providers by calling StaticLoadPolicyType::loadStaticProviders(). * @eguarantee basic*/ void rehash(); /*! returns the size of the stack*/ unsigned int size() const; protected: ServiceStack(); - virtual ~ServiceStack(); + ~ServiceStack() override; - typedef std::vector ProviderVectorType; + using ProviderVectorType = std::vector; ProviderVectorType _providers; /*!Implements the ServiceRepositoryPolicyLoadInterface that allows loading policies to remove or add providers from the stack. * This methods just adds the given provider to providers and registers the use of the object. * @remark This impolementation uses unregisterProviderByPointerInternal() under the assumption that this method is only invoked by * loadStaticProviders() of the policy and this method itself is only invoked by this->rehash() which does the mutex locking*/ - virtual bool addProviderByPolicy(ProviderBaseType* pProvider); + bool addProviderByPolicy(ProviderBaseType* pProvider) override; /*! Registers a given provider in the stack. The new provider will be topmost and therefore * will be favored over providers registered earlier. The stack will behave like a smartpointer * for the registered provider, thus as long as a provider is registered he won't be deleted. * An instance of a provider (identified via pointer) can only added once to the stack. If the instance * is already on the stack, the stack will stay unchanged. * This method is not secured via the mutex is used by registerProvider() and addProviderByPolicy() * @eguarantee strong * @param [in] pProvider Pointer to the provider that should be added. * @return Boolean that indicates if the provider (identified by provider name) has been added. * @retval true The provider was added as topmost element to the stack. * @retval false The provider was already on the stack. Stack is unchanged. * @post Stack is unchanged or added provider is the topmost element on the stack. */ bool registerProviderInternal(ProviderBaseType* pProvider); /*!Implements the ServiceRepositoryPolicyLoadInterface that allows loading policies to remove or add providers from the stack * This methods just removes the given provider from the provider list, if present, and lowers the reference count of the object. * @remark This impolementation uses unregisterProviderByPointerInternal() under the assumption that this method is only invoked by * loadStaticProviders() of the policy and this method itself is only invoked by this->rehash() which does the mutex locking*/ - virtual bool removeProviderByPolicy(ProviderBaseType* pProvider); + bool removeProviderByPolicy(ProviderBaseType* pProvider) override; /*! Removes the provider (identified only by the pointer address) from the stack. * This method is not secured via the mutex is used by unregisterProviderByPointer() and removeProviderByPolicy() * @eguarantee strong * @param [in] pProvider Pointer to the provider that should be removed from stack. * @return Boolean that indicates if there was a provider (identified by pointer) * on the stack. * @retval true The provider instance was on the stack and was removed. * @retval false The provider instance is not a part of the stack. */ bool unregisterProviderByPointerInternal(ProviderBaseType* pProvider); /*! Methods invoked by itk::LightObject::Print(). */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ServiceStack(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace services } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapServiceStack.tpp" #endif #endif diff --git a/Code/Core/include/mapServiceStack.tpp b/Code/Core/include/mapServiceStack.tpp index 7992cf9..a116a9d 100644 --- a/Code/Core/include/mapServiceStack.tpp +++ b/Code/Core/include/mapServiceStack.tpp @@ -1,314 +1,314 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_SERVICE_STACK_TPP #define __MAP_SERVICE_STACK_TPP #include "mapServiceStack.h" #include "mapServiceProvider.h" #include namespace map { namespace core { namespace services { template typename ServiceStack::Pointer ServiceStack:: New(bool doRehash) { Pointer smartPtr = new Self; smartPtr->UnRegister(); if (doRehash) { smartPtr->rehash(); } return smartPtr; }; template ::itk::LightObject::Pointer ServiceStack:: - CreateAnother(void) const + CreateAnother() const { ::itk::LightObject::Pointer smartPtr; smartPtr = Self::New(false).GetPointer(); return smartPtr; }; template typename ServiceStack::ProviderBaseType* ServiceStack:: getProvider(const RequestType& request) const { - ProviderBaseType* pResult = NULL; + ProviderBaseType* pResult = nullptr; this->lock(); // search vector in reverse order, because ServiceStack should operate by the LIFU principle (last in, first used) // thus the lastest added provider suitable for a request should be used. - for (typename ProviderVectorType::const_reverse_iterator pos = _providers.rbegin(); + for (auto pos = _providers.rbegin(); pos != _providers.rend(); ++pos) { if ((*pos)->canHandleRequest(request)) { pResult = *pos; break; } } this->unlock(); return pResult; }; template typename ServiceStack::ProviderBaseType* ServiceStack:: getProvider(const String& providerName) const { ProviderBaseType* pResult = NULL; this->lock(); // search vector in reverse order, because ServiceStack should operate by the LIFU principle (last in, first used) // thus the lastest added provider suitable for a request should be used. for (typename ProviderVectorType::const_reverse_iterator pos = _providers.rbegin(); pos != _providers.rend(); ++pos) { if ((*pos)->getProviderName() == providerName) { pResult = *pos; break; } } this->unlock(); return pResult; }; template bool ServiceStack:: providerIsAvailable(const RequestType& request) const { return getProvider(request) != NULL; }; template bool ServiceStack:: registerProvider(ProviderBaseType* pProvider) { this->lock(); bool result = registerProviderInternal(pProvider); this->unlock(); return result; }; template bool ServiceStack:: registerProviderInternal(ProviderBaseType* pProvider) { - typename ProviderVectorType::iterator finding = std::find(_providers.begin(), _providers.end(), + auto finding = std::find(_providers.begin(), _providers.end(), pProvider); bool result = false; if (finding == _providers.end()) { //not in stack so add provider result = true; pProvider->Register(); _providers.push_back(pProvider); } return result; }; template bool ServiceStack:: unregisterProviderByPointer(ProviderBaseType* pProvider) { this->lock(); bool result = unregisterProviderByPointerInternal(pProvider); this->unlock(); return result; }; template bool ServiceStack:: unregisterProviderByPointerInternal(ProviderBaseType* pProvider) { - typename ProviderVectorType::iterator finding = std::find(_providers.begin(), _providers.end(), + auto finding = std::find(_providers.begin(), _providers.end(), pProvider); bool result = false; if (finding != _providers.end()) { //add provider result = true; (*finding)->UnRegister(); _providers.erase(finding); } return result; }; template bool ServiceStack:: unregisterProvider(const String& providerName) { this->lock(); bool result = false; // search vector in reverse order, because ServiceStack should operate by the LIFU principle (last in, first used) // thus the lastest added provider suitable for a request should be used. typename ProviderVectorType::iterator finding = _providers.end(); for (typename ProviderVectorType::iterator pos = _providers.begin(); pos != _providers.end(); ++pos) { if ((*pos)->getProviderName() == providerName) { finding = pos; } } if (finding != _providers.end()) { result = true; (*finding)->UnRegister(); _providers.erase(finding); } this->unlock(); return result; }; template void ServiceStack:: unregisterAll() { this->lock(); while (!_providers.empty()) { _providers.back()->UnRegister(); _providers.pop_back(); } this->unlock(); }; template void ServiceStack:: rehash() { this->unregisterAll(); this->lock(); StaticLoadPolicyType::loadStaticProviders(); this->unlock(); }; template ServiceStack:: ServiceStack() { StaticLoadPolicyType::registerInterfaceForStaticLoading(*this); }; template ServiceStack:: ~ServiceStack() { this->unregisterAll(); }; template bool ServiceStack:: addProviderByPolicy(ProviderBaseType* pProvider) { return registerProviderInternal(pProvider); }; template bool ServiceStack:: removeProviderByPolicy(ProviderBaseType* pProvider) { return unregisterProviderByPointerInternal(pProvider); }; template void ServiceStack:: PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "Provider count: " << _providers.size() << std::endl; os << indent << "Stack content (in descending priority): " << std::endl; itk::Indent indent2 = indent.GetNextIndent(); - for (typename ProviderVectorType::const_reverse_iterator pos = _providers.rbegin(); + for (auto pos = _providers.rbegin(); pos != _providers.rend(); ++pos) { os << indent2 << (*pos)->getProviderName() << std::endl; } }; template unsigned int ServiceStack:: size() const { return _providers.size(); }; } // end namespace services } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapSmartMetaProperty.h b/Code/Core/include/mapSmartMetaProperty.h index c7fb5a2..0e71092 100644 --- a/Code/Core/include/mapSmartMetaProperty.h +++ b/Code/Core/include/mapSmartMetaProperty.h @@ -1,161 +1,161 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_SMART_META_PROPERTY_H #define __MAP_SMART_META_PROPERTY_H #include "mapMetaPropertyBase.h" #include "mapMetaPropertyAccessInterface.h" namespace map { namespace core { /*! @class SmartMetaProperty * @brief Property class for smart pointered value types. * * A SmartMetaProperty instance is used to encapsulat types that use smart pointer (e.g. all derivates of itk::LightObject). * The used type must have a valid smart pointer support. * If it is a const type the value must be set while constructing the property (see special New() method). * For normal data types please use MetaProperty. * @sa MetaProperty * * @ingroup Core */ template class SmartMetaProperty : public MetaPropertyBase, public MetaPropertyAccessInterface< TValue* >, public MetaPropertyLightPointerAccessInterface { public: /** Smart pointer typedef support. */ - typedef SmartMetaProperty Self; - typedef MetaPropertyBase Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = SmartMetaProperty; + using Superclass = MetaPropertyBase; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; - typedef TValue ValueType; - typedef ::itk::SmartPointer ValueSmartPointerType; - typedef TValue* ValuePointerType; + using ValueType = TValue; + using ValueSmartPointerType = ::itk::SmartPointer; + using ValuePointerType = TValue *; - typedef MetaPropertyAccessInterface< ValuePointerType > AccessInterfaceType; - typedef typename AccessInterfaceType::ValueSetType ValueSetType; - typedef typename AccessInterfaceType::ValueGetType ValueGetType; + using AccessInterfaceType = MetaPropertyAccessInterface; + using ValueSetType = typename AccessInterfaceType::ValueSetType; + using ValueGetType = typename AccessInterfaceType::ValueGetType; - typedef MetaPropertyLightPointerAccessInterface::ConstLightPointer ConstLightPointer; - typedef MetaPropertyLightPointerAccessInterface::LightPointer LightPointer; + using ConstLightPointer = MetaPropertyLightPointerAccessInterface::ConstLightPointer; + using LightPointer = MetaPropertyLightPointerAccessInterface::LightPointer; /** Run-time type information (and related methods). */ itkTypeMacro(SmartMetaProperty, MetaPropertyBase); /** * @brief Creates a MetaProperty instance, initializes it and returns it via smartpointer. * @return A pointer to the MetaProperty. * @param initValue The value that should be used to initialize the MetaProperty * @eguarantee strong */ static Pointer New(ValueSetType initValue); /** * @brief Dublicates a MetaProperty instance. * @return A pointer to the MetaProperty clone. * @eguarantee strong */ - virtual ::itk::LightObject::Pointer CreateAnother(void) const; + ::itk::LightObject::Pointer CreateAnother() const override; /** * @brief Returns the unique type name of the value type that stores the property. * @return A pointer to a const char array containing the unique type name. * @eguarantee strong */ - virtual const char* getMetaPropertyTypeName() const; + const char* getMetaPropertyTypeName() const override; /** * @brief Returns the type_id of the value type that stores the property. * @eguarantee strong * @return A constant reference to a std::type_info object */ - virtual const std::type_info& getMetaPropertyTypeInfo(void) const; + const std::type_info& getMetaPropertyTypeInfo() const override; /** * @brief Returns the property value * @return Property value. * @eguarantee strong */ - virtual ValueGetType getValue() const; + ValueGetType getValue() const override; /** * @brief Sets the property to the passed value * @param newValue The new value of the property. * @eguarantee strong */ - virtual void setValue(ValueSetType newValue); + void setValue(ValueSetType newValue) override; /** * @brief Returns the property Value as LightObject pointer * @return indicates if it is possible to convert * @eguarantee strong */ - virtual bool getUntypedValue(ConstLightPointer&) const; + bool getUntypedValue(ConstLightPointer& /*pValue*/) const override; /** * @brief Returns the property Value as LightObject pointer * @return indicates if it is possible to convert * @eguarantee strong */ - virtual bool getUntypedValue(LightPointer&) const; + bool getUntypedValue(LightPointer& /*pValue*/) const override; protected: /** @reimplementation Reimplementation of the itk::LightObject::InternalClone*/ - virtual ::itk::LightObject::Pointer InternalClone() const; + ::itk::LightObject::Pointer InternalClone() const override; - virtual ~SmartMetaProperty(); + ~SmartMetaProperty() override; SmartMetaProperty(ValueSetType initValue); /** * Defines the default behavior for printing out this element * @eguarantee strong * @param os An output stream */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: /*! Property value.*/ ValueSmartPointerType _spValue; - SmartMetaProperty(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented + SmartMetaProperty(const Self&) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; - } -} + } // namespace core +} // namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapSmartMetaProperty.tpp" #endif #endif diff --git a/Code/Core/include/mapSmartMetaProperty.tpp b/Code/Core/include/mapSmartMetaProperty.tpp index 8f01997..732f185 100644 --- a/Code/Core/include/mapSmartMetaProperty.tpp +++ b/Code/Core/include/mapSmartMetaProperty.tpp @@ -1,192 +1,191 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_SMART_META_PROPERTY_TPP #define __MAP_SMART_META_PROPERTY_TPP namespace map { namespace core { /****************************************************************** * Helper template class that is used to differenciate between * const and non const smart pointer conversion to raw pointer ******************************************************************/ template class SmartMetaPropertyUntypeHelper { //This helper class should only be used and is only defined for pointer types. //see below }; template class SmartMetaPropertyUntypeHelper { public: - typedef typename SmartMetaProperty::LightPointer LightPointer; - typedef typename SmartMetaProperty::ConstLightPointer ConstLightPointer; + using LightPointer = typename SmartMetaProperty::LightPointer; + using ConstLightPointer = typename SmartMetaProperty::ConstLightPointer; static bool Convert(const TValue* pValue, LightPointer& pRaw) { return false; }; static bool Convert(const TValue* pValue, ConstLightPointer& pRaw) { pRaw = pValue; return true; }; }; template class SmartMetaPropertyUntypeHelper { public: - typedef typename SmartMetaProperty::LightPointer LightPointer; - typedef typename SmartMetaProperty::ConstLightPointer ConstLightPointer; + using LightPointer = typename SmartMetaProperty::LightPointer; + using ConstLightPointer = typename SmartMetaProperty::ConstLightPointer; static bool Convert(TValue* pValue, LightPointer& pRaw) { pRaw = pValue; return true; }; static bool Convert(TValue* pValue, ConstLightPointer& pRaw) { pRaw = pValue; return true; }; }; /****************************************************************** * End of helper template classes ******************************************************************/ template typename SmartMetaProperty::Pointer SmartMetaProperty:: New(ValueSetType initValue) { Pointer smartPtr; Self* rawPtr = new Self(initValue); smartPtr = rawPtr; rawPtr->UnRegister(); return smartPtr; } template ::itk::LightObject::Pointer SmartMetaProperty:: - CreateAnother(void) const + CreateAnother() const { ::itk::LightObject::Pointer smartPtr; smartPtr = Self::New(this->_spValue.GetPointer()).GetPointer(); return smartPtr; } template ::itk::LightObject::Pointer SmartMetaProperty:: InternalClone() const { ::itk::LightObject::Pointer smartPtr; smartPtr = Self::New(this->_spValue.GetPointer()).GetPointer(); return smartPtr; } template const char* SmartMetaProperty:: getMetaPropertyTypeName() const { return typeid(ValuePointerType).name(); }; template const std::type_info& SmartMetaProperty:: - getMetaPropertyTypeInfo(void) const + getMetaPropertyTypeInfo() const { return typeid(ValuePointerType); }; template typename SmartMetaProperty::ValueGetType SmartMetaProperty:: getValue() const { return _spValue.GetPointer(); }; template void SmartMetaProperty:: setValue(ValueSetType newValue) { _spValue = newValue; }; template bool SmartMetaProperty:: getUntypedValue(ConstLightPointer& pValue) const { return SmartMetaPropertyUntypeHelper::Convert(_spValue.GetPointer(), pValue); }; template bool SmartMetaProperty:: getUntypedValue(LightPointer& pValue) const { return SmartMetaPropertyUntypeHelper::Convert(_spValue.GetPointer(), pValue); }; template void SmartMetaProperty:: PrintSelf(std::ostream& os, itk::Indent indent) const { os << indent << "SmartMetaProperty [" << this->getMetaPropertyTypeName() << "]: " << std::endl; os << indent.GetNextIndent() << _spValue << std::endl; }; template SmartMetaProperty:: ~SmartMetaProperty() - { - }; + = default; template SmartMetaProperty:: SmartMetaProperty(ValueSetType initValue) { _spValue = initValue; }; - } -} + } // namespace core +} // namespace map #endif \ No newline at end of file diff --git a/Code/Core/include/mapStaticServiceStack.h b/Code/Core/include/mapStaticServiceStack.h index d10600b..10dc674 100644 --- a/Code/Core/include/mapStaticServiceStack.h +++ b/Code/Core/include/mapStaticServiceStack.h @@ -1,174 +1,174 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_STATIC_SERVICE_STACK_H #define __MAP_STATIC_SERVICE_STACK_H #include "mapDefaultSLStaticPolicy.h" #include "mapFastLockedThreadingStaticPolicy.h" #include "mapServiceStack.h" namespace map { namespace core { namespace services { /*! @class StaticServiceStack * @brief Class wraps a ServiceStack as an singelton. * * This class can be used as a wrapper to realize a ServiceStack as singelton, thus * all function calling this static stack will work on the same provider stack. Also * changes on the provider stack will be global. * Every static method that interacts with the concrete ServiceStack will call ensureStack(). * Calling this function the first time will create the concrete ServiceStack. * * @sa ServiceStack * @ingroup Services * @tparam TConcreteServiceStack The service stack class that should be wrapped. * @tparam TStaticLoadStaticPolicy Policy defines the default providers of the stack and there sequence * @tparam TThreadingStaticPolicy Policy defines the stack will handles issues of the use in a multi * threadding context. */ template < class TConcreteServiceStack, template class TStaticLoadStaticPolicy = DefaultSLStaticPolicy, class TThreadingStaticPolicy = FastLockedThreadingStaticPolicy > class StaticServiceStack: public TStaticLoadStaticPolicy, public TThreadingStaticPolicy { public: /*! Standard class typedefs. */ - typedef TConcreteServiceStack ConcreteServiceStackType; - typedef typename ConcreteServiceStackType::Pointer ConcreteServiceStackPointer; - typedef typename ConcreteServiceStackType::ProviderBaseType ProviderBaseType; - typedef typename ProviderBaseType::Pointer ProviderBasePointer; - typedef typename ProviderBaseType::RequestType RequestType; + using ConcreteServiceStackType = TConcreteServiceStack; + using ConcreteServiceStackPointer = typename ConcreteServiceStackType::Pointer; + using ProviderBaseType = typename ConcreteServiceStackType::ProviderBaseType; + using ProviderBasePointer = typename ProviderBaseType::Pointer; + using RequestType = typename ProviderBaseType::RequestType; typedef StaticServiceStack Self; - typedef TStaticLoadStaticPolicy StaticLoadStaticPolicyType; - typedef typename ConcreteServiceStackType::StaticLoadPolicyType StaticLoadPolicyType; - typedef TThreadingStaticPolicy ThreadingStaticPolicyType; - typedef typename ConcreteServiceStackType::ThreadingPolicyType ThreadingPolicyType; + using StaticLoadStaticPolicyType = TStaticLoadStaticPolicy; + using StaticLoadPolicyType = typename ConcreteServiceStackType::StaticLoadPolicyType; + using ThreadingStaticPolicyType = TThreadingStaticPolicy; + using ThreadingPolicyType = typename ConcreteServiceStackType::ThreadingPolicyType; /*! Returns a pointer to the provider that might can handle the request. * @eguarantee strong * @param [in] request Referenz to the request specifing the requirements on the provider * @return Pointer to a suitable provider. Return value may be null. * @retval NULL There was no suitable provider in the stack. */ static ProviderBaseType* getProvider(const RequestType& request); /*! Returns a pointer to the provider with the specified name. * @eguarantee strong * @param [in] providerName String referenz to the wanted provider name. * @return Pointer to a suitable provider. Return value may be null. * @retval NULL There was no suitable provider in the stack. */ static ProviderBaseType* getProvider(const String& providerName); /*! Indicates if there is a provider that can handle the passed request. * @eguarantee strong * @param [in] request Referenz to the request specifing the requirements on the provider * @return Boolean that indicates if there is at least on suitable provider. * @retval true There is a suitable provider in the stack. * @retval false There is no suitable provider in the stack. */ static bool providerIsAvailable(const RequestType& request); /*! Registers a given provider in the stack. The new provider will be topmost and therfore * will be favored over providers registered ealier. The stack will behave like a smartpointer * for the registered provider, thus as long as a provider is registered he won't be deleted. * An instance of a provider (identified via pointer) can only added once to the stack. If the instance * is already on the stack, the stack will stay unchanged. * @eguarantee strong * @param [in] pProvider Pointer to the provider that should be added. * @return Boolean that indicates if the provider (identified by provider name) has been added. * @retval true The provider was added as topmost element to the stack. * @retval false The provider was already on the stack. Stack is unchanged. * @post Stack is unchanged or added provider is the topmost element on the stack. */ static bool registerProvider(ProviderBaseType* pProvider); /*! Removes the provider (identified only by the pointer address) from the stack. * @eguarantee strong * @param [in] pProvider Pointer to the provider that should be removed from stack. * @return Boolean that indicates if there was a provider (identified by pointer) * on the stack. * @retval true The provider instance was on the stack and was removed. * @retval false The provider instance is not a part of the stack. */ static bool unregisterProviderByPointer(ProviderBaseType* pProvider); /*! Removes the topmost entry of a given provider (identified by the provider name) * from the stack. * @eguarantee strong * @param [in] providerName String reference to the provider name that identifies the provider. * @return Boolean that indicates if the provider (identified by pointer) has at least one mor * entry on the stack. * @retval true There is no more entry for this provider in the stack. * @retval false There is at least one more entry for this provider in the stack. */ static bool unregisterProvider(const String& providerName); /*! Removes all providers from the stack. * @eguarantee strong*/ static void unregisterAll(); /*! Clears the stack (unregisterAll) and loads all default providers by calling StaticLoadPolicyType::loadStaticProviders(). * @eguarantee strong*/ static void rehash(); static unsigned int size(); protected: /*! Checks if a concrete stack exists (_spConcreteStack != NULL). * If not, the stack will be created (establishConcreteStack) and _spConcreteStack will be set. * @eguarantee strong*/ static void ensureStack(); /*! Creates a concrete stack, do static load on it and than pass it as return value.*/ static ConcreteServiceStackPointer establishConcreteStack(); /*! Smartpointer to the concrete stack instance. Will be created by ensureStack() if needed.*/ static ConcreteServiceStackPointer _spConcreteStack; StaticServiceStack() {}; virtual ~StaticServiceStack() {}; private: StaticServiceStack(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace services } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapStaticServiceStack.tpp" #endif #endif diff --git a/Code/Core/include/mapString.h b/Code/Core/include/mapString.h index fe3bebe..93061f5 100644 --- a/Code/Core/include/mapString.h +++ b/Code/Core/include/mapString.h @@ -1,42 +1,42 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_STRING_H #define __MAP_STRING_H #include #include namespace map { namespace core { - typedef std::string String; + using String = std::string; - typedef std::ostringstream OStringStream; - typedef std::istringstream IStringStream; + using OStringStream = std::ostringstream; + using IStringStream = std::istringstream; } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapSyncObject.h b/Code/Core/include/mapSyncObject.h index ca8629d..e5da885 100644 --- a/Code/Core/include/mapSyncObject.h +++ b/Code/Core/include/mapSyncObject.h @@ -1,74 +1,74 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_SYNC_OBJECT_H #define __MAP_SYNC_OBJECT_H #include #include "mapString.h" #include "mapMetaPropertyBase.h" #include "mapMetaPropertyAccessor.h" #include "mapMAPCoreExports.h" namespace map { namespace deployment { /** SyncObject that containes all relevant informations * for deployment DLLs to be synced with the host apllication. * This class is used by deployment::Synchronizer and Objects * that implement the DeploymentSyncInterface.*/ class MAPCore_EXPORT SyncObject { public: - typedef core::String SyncPropertyTagType; + using SyncPropertyTagType = core::String; typedef std::map SyncPropertyMapType; SyncPropertyMapType _map; template bool getProperty(SyncPropertyTagType tag, TPropReturnType& prop) const { bool result = false; - SyncPropertyMapType::const_iterator finding = _map.find(tag); + auto finding = _map.find(tag); if (finding != _map.end()) { result = core::unwrapCastedMetaProperty(finding->second, prop); } return result; } SyncObject(); ~SyncObject(); }; } // end namespace deployment } // end namespace map #endif diff --git a/Code/Core/include/mapThreadEvents.h b/Code/Core/include/mapThreadEvents.h index c261b0a..9821443 100644 --- a/Code/Core/include/mapThreadEvents.h +++ b/Code/Core/include/mapThreadEvents.h @@ -1,142 +1,142 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_THREAD_EVENTS_H #define __MAP_THREAD_EVENTS_H #include "mapEvents.h" namespace map { namespace core { /** @class EventObject * @brief Base object for all MatchPoint events * @ingroup Events * */ class MAPCore_EXPORT ThreadEventObject : public EventObject { public: - typedef ThreadEventObject Self; - typedef EventObject Superclass; - typedef int ThreadIDType; + using Self = ThreadEventObject; + using Superclass = EventObject; + using ThreadIDType = int; static const ThreadIDType anyThreadID; - ThreadEventObject(ThreadIDType threadID, void* pData = NULL, const std::string& comment = ""); + ThreadEventObject(ThreadIDType threadID, void* pData = nullptr, const std::string& comment = ""); - virtual ~ThreadEventObject(); + ~ThreadEventObject() override; ThreadIDType getThreadID() const; - virtual const char* GetEventName() const; + const char* GetEventName() const override; /*! In addition to the normal event check the thread IDs will also be compared. * If the IDs are equal or one of the IDs equals anyThreadID the return of the check will be * true*/ - virtual bool CheckEvent(const ::itk::EventObject* e) const; + bool CheckEvent(const ::itk::EventObject* e) const override; - virtual ::itk::EventObject* MakeObject() const; + ::itk::EventObject* MakeObject() const override; ThreadEventObject(const Self& s); - virtual void Print(std::ostream& os) const; + void Print(std::ostream& os) const override; private: /*! The ID of the thread that called the event or, if this object is part of an observer, * the ID that should trigger the observer. In the later case use anyThreadID (value: -1) * to allow the CheckEvent() method to trigger without regarding the ID.*/ ThreadIDType _threadID; - void operator=(const Self&); + void operator=(const Self&) = delete; }; /*! @def mapThreadEventMacro * Helper macro that creates thread event objects for MatchPoint. */ #define mapThreadEventMacro( classname , super ) \ /*! @ingroup Events */ \ class MAPCore_EXPORT classname : public super { \ public: \ typedef classname Self; \ typedef super Superclass; \ classname(ThreadIDType threadID, void* pData = NULL, const std::string& comment = ""):super(threadID, pData, comment) {}\ virtual ~classname() {} \ virtual const char * GetEventName() const { return #classname; } \ virtual bool CheckEvent(const ::itk::EventObject* e) const \ { \ const Self* pE = dynamic_cast(e); \ bool result = false; \ if (pE) result = (this->getThreadID()==anyThreadID) || (pE->getThreadID()==this->getThreadID()); \ return result; \ } \ virtual ::itk::EventObject* MakeObject() const \ { return new Self(*this); } \ classname(const Self& s) :super(s) {}; \ private: \ void operator=(const Self&); \ } - } + } // namespace core namespace events { /*!@class AnyMatchPointThreadEvent * @brief General event that can be used if you want to observe any thread event defined by MatchPoint. * @ingroup Events */ - typedef core::ThreadEventObject AnyMatchPointThreadEvent; + using AnyMatchPointThreadEvent = core::ThreadEventObject; /*!@class TaskBatchThreadEvent * @brief General/base event concering task batch threads. * @ingroup Events */ mapThreadEventMacro(TaskBatchThreadEvent, AnyMatchPointThreadEvent); /*!@class NextTaskThreadEvent * @brief Event that is invoked if a task processing thread needs a now task. * @ingroup Events */ mapThreadEventMacro(NextTaskThreadEvent, TaskBatchThreadEvent); /*!@class ProcessedTaskThreadEvent * @brief Event that is invoked if a task processing thread has successfully processed a task. * @ingroup Events */ mapThreadEventMacro(ProcessedTaskThreadEvent, TaskBatchThreadEvent); /*!@class FailedTaskThreadEvent * @brief Event that is invoked if a task processing thread faild to process the task (e.g. an exception was raised). * @ingroup Events */ mapThreadEventMacro(FailedTaskThreadEvent, TaskBatchThreadEvent); /*!@class ThreadTerminatingErrorEvent * @brief Event that is invoked if a thread terminates because of an error. * @ingroup Events */ mapThreadEventMacro(ThreadTerminatingErrorEvent, AnyMatchPointThreadEvent); - } -} + } // namespace events +} // namespace map #endif diff --git a/Code/Core/include/mapTransformGenerationFunctor.h b/Code/Core/include/mapTransformGenerationFunctor.h index 247972f..45a6049 100644 --- a/Code/Core/include/mapTransformGenerationFunctor.h +++ b/Code/Core/include/mapTransformGenerationFunctor.h @@ -1,128 +1,128 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_TRANSFORM_GENERATION_FUNCTOR_H #define __MAP_TRANSFORM_GENERATION_FUNCTOR_H #include "mapFieldRepresentationDescriptor.h" #include "mapRegistrationTopology.h" #include "mapClassMacros.h" #include "itkObject.h" namespace map { namespace core { namespace functors { /*! @class TransformGenerationFunctor * @brief Base class for functors that gernerate transform instances * * The field functors are used in conjunction with special service providers * to realize the "lazy" generation of transforms that are used in a mapping * kernel of a registration. The "lazy" generation of the transform is prefered * if/because the representation of a mapping direction may consume memory without * really being needed to register a certain data type. E.g. To register * point data you only need a direct mapping. The inverse mapping will only be * created (by a functor), if an image should also be registered. * Typical candidates for such a lazy generation are itk::DiscplacementFieldTransform * based instances. * * @ingroup RegFunctors * @tparam VInputDimensions Dimensions of the input space the transform should map from. * @tparam VOutputDimensions Dimensions of the output space the transform should map into. */ template class TransformGenerationFunctor : public itk::Object { public: /*! Standard class typedefs. */ typedef TransformGenerationFunctor Self; - typedef itk::Object Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Superclass = itk::Object; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkStaticConstMacro(InputDimensions, unsigned int, VInputDimensions); itkStaticConstMacro(OutputDimensions, unsigned int, VOutputDimensions); - typedef FieldRepresentationDescriptor InFieldRepresentationType; - typedef typename InFieldRepresentationType::ConstPointer InFieldRepresentationConstPointer; - typedef FieldRepresentationDescriptor OutFieldRepresentationType; - typedef typename OutFieldRepresentationType::ConstPointer OutFieldRepresentationConstPointer; + using InFieldRepresentationType = FieldRepresentationDescriptor; + using InFieldRepresentationConstPointer = typename InFieldRepresentationType::ConstPointer; + using OutFieldRepresentationType = FieldRepresentationDescriptor; + using OutFieldRepresentationConstPointer = typename OutFieldRepresentationType::ConstPointer; typedef typename RegistrationTopology < VInputDimensions, VOutputDimensions >::DirectTransformType TransformType; - typedef typename TransformType::Pointer TransformPointer; + using TransformPointer = typename TransformType::Pointer; typedef typename RegistrationTopology::TargetPointType NullPointType; itkTypeMacro(TransformGenerationFunctor, itk::Object); /*! Generates the field an returns the result as a smart pointer. * @eguarantee should be strong * @return Smart pointer to the generated field. */ virtual TransformPointer generateTransform() const = 0; /*! Returns a const pointer to the input field representation descriptor. * @eguarantee no fail * @return Pointer to the input field representation descriptor, if set. May be NULL if no special * representation is declared. * @retval NULL There is no explicit field representation descriptor for the input space. */ - const InFieldRepresentationType* getInFieldRepresentation(void) const; + const InFieldRepresentationType* getInFieldRepresentation() const; mapSetVarMacro(NullPoint, NullPointType, _nullPoint); mapGetConstVarMacro(NullPoint, NullPointType, _nullPoint); mapSetVarMacro(NullPointUsage, bool, _useNullPoint); mapGetConstVarMacro(NullPointUsage, bool, _useNullPoint); protected: TransformGenerationFunctor(const InFieldRepresentationType* pInFieldRepresentation); - virtual ~TransformGenerationFunctor(); + ~TransformGenerationFunctor() override; InFieldRepresentationConstPointer _spInFieldRepresentation; NullPointType _nullPoint; bool _useNullPoint; /*! Methods invoked by itk::LightObject::Print(). */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: TransformGenerationFunctor(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace functors } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapTransformGenerationFunctor.tpp" #endif #endif diff --git a/Code/Core/include/mapTransformGenerationFunctor.tpp b/Code/Core/include/mapTransformGenerationFunctor.tpp index 569cbc9..2a3891f 100644 --- a/Code/Core/include/mapTransformGenerationFunctor.tpp +++ b/Code/Core/include/mapTransformGenerationFunctor.tpp @@ -1,73 +1,73 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_TRANSFORM_GENERATION_FUNCTOR_TPP #define __MAP_TRANSFORM_GENERATION_FUNCTOR_TPP #include "mapTransformGenerationFunctor.h" namespace map { namespace core { namespace functors { template const typename TransformGenerationFunctor::InFieldRepresentationType* TransformGenerationFunctor:: - getInFieldRepresentation(void) const + getInFieldRepresentation() const { return _spInFieldRepresentation; }; template TransformGenerationFunctor:: TransformGenerationFunctor(const InFieldRepresentationType* pInFieldRepresentation): _spInFieldRepresentation(pInFieldRepresentation), _useNullPoint(false) { _nullPoint.Fill(itk::NumericTraits< ::map::core::continuous::ScalarType>::NonpositiveMin()); }; template TransformGenerationFunctor:: ~TransformGenerationFunctor() { }; template void TransformGenerationFunctor:: PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "In field representation: " << std::endl << _spInFieldRepresentation << std::endl; }; } // end namespace functors } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapVolume.h b/Code/Core/include/mapVolume.h index 524ec75..ad7cd24 100644 --- a/Code/Core/include/mapVolume.h +++ b/Code/Core/include/mapVolume.h @@ -1,211 +1,211 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_VOLUME_H #define __MAP_VOLUME_H #include "mapPMVolume.h" #include "mapVolumeSize.h" #include "mapContinuousElements.h" #include "itkMacro.h" namespace map { namespace core { namespace continuous { /*! @class Volume * @brief Represents a continuouse volume by a bounding box. * * Serves as continuouse analogy for the discrete image region * @sa PMVolume * @sa ImageRegion * * @ingroup Continuous */ template class Volume { public: /*! Standard class typedefs. */ - typedef Volume Self; + using Self = Volume; /*! Dimension of the volume available at compile time. */ itkStaticConstMacro(VolumeDimension, unsigned int, VDimensions); /*! Dimension of the volume available at run time. */ static unsigned int getVolumeDimension() { return VDimensions; } /*! Point typedef support.*/ - typedef typename Elements::PointType PointType; - typedef typename Elements::PointType OriginType; - typedef typename PointType::ValueType OriginValueType; + using PointType = typename Elements::PointType; + using OriginType = typename Elements::PointType; + using OriginValueType = typename PointType::ValueType; /*! Size typedef support. A size is used to define volume bounds. */ - typedef VolumeSize SizeType; - typedef typename SizeType::SizeValueType SizeValueType; + using SizeType = VolumeSize; + using SizeValueType = typename SizeType::SizeValueType; /*! Constructor. Volume is a lightweight object that is not reference * counted, so the constructor is public. * @eguarantee strong */ Volume(); /*! Destructor. Volume is a lightweight object that is not reference * counted and not supposed to be a base object, so the destructor is non virtual public. * @eguarantee none throw*/ ~Volume(); /*! Copy constructor. Volume is a lightweight object that is not * reference counted, so the copy constructor is public. * @eguarantee strong */ Volume(const Self& volume); /*! Constructor that takes an origin and size. Volume is a lightweight * object that is not reference counted, so this constructor is public. * @eguarantee strong * @pre Parameter size must be positive. */ Volume(const OriginType& origin, const SizeType& size); /*! Constructor that takes a size and assumes an origin of zero. Volume * is lightweight object that is not reference counted so this constructor * is public. * @eguarantee strong * @pre Parameter size must be positive. */ Volume(const SizeType& size); /*! operator=. Volume is a lightweight object that is not reference * counted, so operator= is public. * @eguarantee basic */ void operator=(const Self& volume); /*! Set the point defining the origin of the volume. * @eguarantee strong */ void setOrigin(const OriginType& origin); /*! Get the point defining the origin of the volume. * @eguarantee strong */ const OriginType& getOrigin() const; /*! Set the size of the volume. This plus the origin determines the * rectangular shape, or extent, of the volume. * @eguarantee strong * @pre Parameter size must be positive.*/ void setSize(const SizeType& size); /*! Get the size of the volume. * @eguarantee strong */ const SizeType& getSize() const; /*! Convenience methods to set the size of the particular dimension i. * @param [in] i Index of the particular dimension; must be within the range * of the volume dimensions (0..VDimensions-1). * @param [in] sze new size of the particular dimension; must be positive or zero. * @pre see parameters*/ void setSize(unsigned long i, SizeValueType sze); /*! Convenience methods to get the size of the particular dimension i. * @param [in] i Index of the particular dimension; must be within the range * of the volume dimensions (0..VDimensions-1). * @pre see parameters*/ SizeValueType getSize(unsigned long i) const; /*! Convenience methods to set the origin value of the particular dimension i. * @param [in] i Index of the particular dimension; must be within the range * of the volume dimensions (0..VDimensions-1). * @pre see parameters*/ void setOrigin(unsigned long i, OriginValueType sze); /*! Convenience methods to get the origin value of the particular dimension i. * @param [in] i Index of the particular dimension; must be within the range * of the volume dimensions (0..VDimensions-1). * @pre see parameters*/ OriginValueType getOrigin(unsigned long i) const; /*! Compare two volumes. */ bool operator==(const Self& volume) const; /*! Compare two volumes. */ bool operator!=(const Self& volume) const; /*! Test if an point is inside */ bool isInside(const PointType& point) const; /*! Test if a region (the argument) is completly inside of this volume */ bool isInside(const Self& volume) const; /*! Crop a region by another region. If this region is outside of the * crop, this method returns false and does not modify the * region. Otherwise, this method returns true and the region is * modified to reflect the crop. */ bool crop(const Self& region); /*! Creates a copy of this volume and expands the copie in such a way, * that the new volume is a bounding box of the original volume and the point. * @param [in] point Point that should be contained by the new volume. * @return the new expanded volume. * @eguarantee strong */ Self expand(const PointType& point) const; /*! Creates a copy of this volume and expands the copy in such a way, * that the new volume is a bounding box of this and the second volume. * @eguarantee strong * @param [in] volume2 The second volume that should also be contained * by the new volume. * @return the new expanded volume. */ Self expand(const Self& volume2) const; /*! Converts this to a poly morphical volume representation (PMVolume). * @eguarantee strong * @return PMVolume instance of the volume.*/ PMVolume convertToPMVolume() const; private: OriginType _origin; SizeType _size; }; template std::ostream& operator<<(std::ostream& os, const Volume& region); template Volume convertToVolume(const PMVolume& pmVolume); template PMVolume convertToPMVolume(const Volume& volume); } // end namespace continuous } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapVolume.tpp" #endif #endif diff --git a/Code/Core/include/mapVolume.tpp b/Code/Core/include/mapVolume.tpp index 7b9222f..5014bb0 100644 --- a/Code/Core/include/mapVolume.tpp +++ b/Code/Core/include/mapVolume.tpp @@ -1,390 +1,390 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_VOLUME_TPP #define __MAP_VOLUME_TPP #include "mapVolume.h" -#include +#include namespace map { namespace core { namespace continuous { template Volume:: Volume() { }; template Volume:: ~Volume() {}; template Volume:: Volume(const Self& volume): _origin(volume._origin), _size(volume._size) {}; template Volume:: Volume(const OriginType& origin, const SizeType& size): _origin(origin), _size(size) { assert(size.isPositive()); //size must be positive }; template Volume:: Volume(const SizeType& size): _size(size) { assert(size.isPositive()); //size must be positive _origin.Fill(0); } ; template void Volume:: operator=(const Self& volume) { _origin = volume._origin; _size = volume._size; }; template void Volume:: setOrigin(const OriginType& origin) { _origin = origin; }; template const typename Volume::OriginType& Volume:: getOrigin() const { return _origin; }; template void Volume:: setSize(const SizeType& size) { assert(size.isPositive()); //size must be positive _size = size; }; template const typename Volume::SizeType& Volume:: getSize() const { return _size; } template void Volume:: setSize(unsigned long i, SizeValueType sze) { assert(i < VDimensions); //index for setting may not be out of bound assert(sze >= 0); //size must be positive _size[i] = sze; } template typename Volume::SizeValueType Volume:: getSize(unsigned long i) const { assert(i < VDimensions); //index for getting may not be out of bound return _size[i]; } template void Volume:: setOrigin(unsigned long i, OriginValueType sze) { assert(i < VDimensions); //index for getting may not be out of bound _origin[i] = sze; } template typename Volume::OriginValueType Volume:: getOrigin(unsigned long i) const { assert(i < VDimensions); //index for getting may not be out of bound return _origin[i]; } template bool Volume:: operator==(const Self& volume) const { bool same = 1; same = (_origin == volume._origin); same = same && (_size == volume._size); return same; } template bool Volume:: operator!=(const Self& volume) const { bool same = 1; same = (_origin == _origin); same = same && (_size == _size); return !same; } template bool Volume:: isInside(const PointType& point) const { for (unsigned int i = 0; i < VolumeDimension; ++i) { if (point[i] < _origin[i]) { return false; } if (point[i] >= _origin[i] + _size[i]) { return false; } } return true; } template bool Volume:: isInside(const Self& volume) const { OriginType beginCorner = volume.GetIndex(); if (! this->isInside(beginCorner)) { return false; } OriginType endCorner; SizeType size = volume.GetSize(); for (unsigned int i = 0; i < VDimensions; i++) { endCorner[i] = beginCorner[i] + size[i] - 1; } if (! this->IsInside(endCorner)) { return false; } return true; } template bool Volume:: crop(const Self& region) { double crop; unsigned int i; bool cropPossible = true; // Can we crop? for (i = 0; i < VDimensions && cropPossible; i++) { // Is left edge of current region to the right of the right edge // of the region to crop with? (if so, we cannot crop) if (_origin[i] >= region.GetIndex()[i] + static_cast(region.GetSize()[i])) { cropPossible = false; } // If right edge of the current region to the left of the left // edge of the region to crop with? (if so, we cannot crop) if (_origin[i] + static_cast(_size[i]) <= region.GetIndex()[i]) { cropPossible = false; } } // if we cannot crop, return without changing anythin if (!cropPossible) { return cropPossible; } // we can crop, so crop for (i = 0; i < VDimensions; i++) { // first check the start index if (_origin[i] < region.GetIndex()[i]) { // how much do we need to adjust crop = region.GetIndex()[i] - _origin[i]; // adjust the start index and the size of the current region _origin[i] += crop; _size[i] -= static_cast(crop); } // now check the final size if (_origin[i] + static_cast(_size[i]) > region.GetIndex()[i] + static_cast(region.GetSize()[i])) { // how much do we need to adjust crop = _origin[i] + static_cast(_size[i]) - region.GetIndex()[i] - static_cast(region.GetSize()[i]); // adjust the size _size[i] -= static_cast(crop); } } return cropPossible; }; template typename Volume::Self Volume:: expand(const PointType& point) const { OriginType origin = this->getOrigin(); SizeType size = this->getSize(); for (unsigned int i = 0; i < VolumeDimension; ++i) { if (point[i] < origin[i]) { size[i] += origin[i] - point[i]; origin[i] = point[i]; } else if (point[i] >= origin[i] + size[i]) { size[i] = point[i] - origin[i]; } } return Self(origin, size); }; template typename Volume::Self Volume:: expand(const Self& volume2) const { const OriginType& origin = this->getOrigin(); const SizeType& size = this->getSize(); const OriginType& origin2 = volume2.getOrigin(); const SizeType& size2 = volume2.getSize(); OriginType blP(origin); //bottom left point OriginType trP; //top right point SizeType resultSize; //compute outer points for (unsigned int i = 0; i < VolumeDimension; ++i) { if (origin2[i] < origin[i]) { blP[i] = origin2[i]; } if (origin2[i] + size2[i] > origin[i] + size[i]) { trP[i] = origin2[i] + size2[i]; } else { trP[i] = origin[i] + size[i]; } resultSize[i] = trP[i] - blP[i]; } return Self(blP, resultSize); }; template std::ostream& operator<<(std::ostream& os, const Volume& volume) { os << "Dimension: " << volume.getVolumeDimension() << std::endl; os << "Origin: " << volume.getOrigin() << std::endl; - os << "Size: " << volume.getSize() << std::endl;; + os << "Size: " << volume.getSize() << std::endl; return os; } template Volume convertToVolume(const PMVolume& pmVolume) { assert(pmVolume.getVolumeDimension() == VDimensions); //PMVolume must have the same dimension to be convertible typedef Volume VolumeType; typename VolumeType::OriginType origin; typename VolumeType::SizeType size; for (unsigned int i = 0; i < VDimensions; ++i) { origin[i] = pmVolume.getOrigin()[i]; size[i] = pmVolume.getSize()[i]; } return VolumeType(origin, size); }; template PMVolume convertToPMVolume(const Volume& volume) { typedef Volume VolumeType; PMVolume::OriginType origin; PMVolume::SizeType size; for (unsigned int i = 0; i < VDimensions; ++i) { origin[i] = volume.getOrigin(i); size[i] = volume.getSize(i); } return PMVolume(origin, size); }; } // end namespace continuous } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapVolumeSize.h b/Code/Core/include/mapVolumeSize.h index d6900cd..4f4d3a3 100644 --- a/Code/Core/include/mapVolumeSize.h +++ b/Code/Core/include/mapVolumeSize.h @@ -1,168 +1,168 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_VOLUME_SIZE_H #define __MAP_VOLUME_SIZE_H #include #include "mapContinuous.h" #include "mapSDStreamingInterface.h" namespace map { namespace core { namespace continuous { /*! @class Size * @brief Represent the size (bounds) of a n-dimensional volume. * * Size is a class to represent multi-dimensional volume bounds, * templated over the dimension. * * For the sake of efficiency, Size does not define a default constructor, a * copy constructor, or an operator=. We rely on the compiler to provide * efficient bitwise copies. * * Size is an "aggregate" class. Its data is public (_size) * allowing for fast and convenient instantiations/assignments. * * The following syntax for assigning a size is allowed/suggested: * VolumeSize<3> size = {256, 256, 20}; * * @ingroup Continuous */ template class VolumeSize { public: /** Standard class typedefs. */ - typedef VolumeSize Self; + using Self = VolumeSize; /** Compatible Size and value typedef */ - typedef VolumeSize SizeType; - typedef ScalarType SizeValueType; + using SizeType = VolumeSize; + using SizeValueType = ScalarType; /** Get the dimension of the size object. */ - static unsigned int getVolumeSizeDimension(void) + static unsigned int getVolumeSizeDimension() { return VDimensions; } /** Add two sizes. */ Self operator+(const Self& vec) const; /** Increment size by a size. */ const Self& operator+=(const Self& vec); /** Subtract two sizes. */ Self operator-(const Self& vec) const; /** Decrement size by a size. */ const Self& operator-=(const Self& vec); /** Multiply two sizes (elementwise product). */ Self operator*(const Self& vec) const; /** Multiply two sizes (elementwise product). */ const Self& operator*=(const Self& vec); /** Compare two sizes. */ bool operator==(const Self& vec) const; /** Compare two sizes. */ bool operator!=(const Self& vec) const; /** Access an element of the size. Elements are numbered * 0, ..., VDimension-1. No bounds checking is performed. */ SizeValueType& operator[](unsigned int dim); /** Access an element of the size. Elements are numbered * 0, ..., VDimension-1. This version can only be an rvalue. * No bounds checking is performed. */ - const SizeValueType operator[](unsigned int dim) const; + SizeValueType operator[](unsigned int dim) const; /** Get the value array of VolumeSize. This provides a read only reference to the size. * @sa SetSize */ const SizeValueType* getVolumeSize() const; /** Set the value array of VolumeSize. * Try to prototype this function so that val has to point to a block of * memory that is the appropriate size. @sa GetSize */ void setVolumeSize(const SizeValueType val[VDimensions]); /** Set an element of the Size. * sets the value of one of the elements in the Size * This method is mainly intended to facilitate the access to elements * from Tcl and Python where C++ notation is not very convenient. * @warning No bound checking is performed. * @sa SetSize() @sa GetElement() */ void setElement(unsigned long element, SizeValueType val); /** Get an element of the Size. * gets the value of one of the elements in the size * This method is mainly intended to facilitate the access to elements * from Tcl and Python where C++ notation is not very convenient. * @warning No bound checking is performed * @sa GetSize() @sa SetElement() */ SizeValueType getElement(unsigned long element) const; /** Set one value for the index in all dimensions. Useful for initializing * an offset to zero. */ void fill(SizeValueType value); /** Checks if the volume is positive. */ bool isPositive() const; /** Size is an "aggregate" class. Its data is public (m_Size) * allowing for fast and convenient instantiations/assignments. * * The following syntax for assigning a size is allowed/suggested: * * Size<3> size = {{256, 256, 20}}; * * The doubled braces {{ and }} are required to prevent `gcc -Wall' * (and perhaps other compilers) from complaining about a partly * bracketed initializer. */ SizeValueType _size[VDimensions]; static structuredData::StreamingInterface::ElementPointer streamToStructuredData(const Self& vs); static Self streamFromStructuredData(const structuredData::Element* pElement); }; template std::ostream& operator<<(std::ostream& os, const VolumeSize& size); } // end namespace continuous } // end namespace core } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapVolumeSize.tpp" #endif #endif diff --git a/Code/Core/include/mapVolumeSize.tpp b/Code/Core/include/mapVolumeSize.tpp index 220e1f4..9f64926 100644 --- a/Code/Core/include/mapVolumeSize.tpp +++ b/Code/Core/include/mapVolumeSize.tpp @@ -1,308 +1,308 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_VOLUME_SIZE_TPP #define __MAP_VOLUME_SIZE_TPP -#include +#include #include "mapVolumeSize.tpp" #include "mapConvert.h" #include "mapSDITKStreamingHelper.h" #include "mapExceptionObjectMacros.h" namespace map { namespace core { namespace continuous { template typename VolumeSize::Self VolumeSize:: operator+(const Self& vec) const { Self result; for (unsigned int i = 0; i < VDimensions; ++i) { result[i] = _size[i] + vec._size[i]; } return result; } template const typename VolumeSize::Self& VolumeSize:: operator+=(const Self& vec) { for (unsigned int i = 0; i < VDimensions; ++i) { _size[i] += vec._size[i]; } return *this; } template typename VolumeSize::Self VolumeSize:: operator-(const Self& vec) const { Self result; for (unsigned int i = 0; i < VDimensions; ++i) { result[i] = _size[i] - vec._size[i]; } return result; } template const typename VolumeSize::Self& VolumeSize:: operator-=(const Self& vec) { for (unsigned int i = 0; i < VDimensions; ++i) { _size[i] -= vec._size[i]; } return *this; } template typename VolumeSize::Self VolumeSize:: operator*(const Self& vec) const { Self result; for (unsigned int i = 0; i < VDimensions; ++i) { result[i] = _size[i] * vec._size[i]; } return result; } template const typename VolumeSize::Self& VolumeSize:: operator*=(const Self& vec) { for (unsigned int i = 0; i < VDimensions; ++i) { _size[i] *= vec._size[i]; } return *this; } template bool VolumeSize:: operator==(const Self& vec) const { bool same = true; for (unsigned int i = 0; i < VDimensions && same; ++i) { same = (_size[i] == vec._size[i]); } return same; } template bool VolumeSize:: operator!=(const Self& vec) const { bool same = true; for (unsigned int i = 0; i < VDimensions && same; ++i) { same = (_size[i] == vec._size[i]); } return !same; } template typename VolumeSize::SizeValueType& VolumeSize:: operator[](unsigned int dim) { assert(dim < VDimensions); //check if index dim is out of bound return _size[dim]; } template - const typename VolumeSize::SizeValueType + typename VolumeSize::SizeValueType VolumeSize:: operator[](unsigned int dim) const { assert(dim < VDimensions); //check if index dim is out of bound return _size[dim]; } template const typename VolumeSize::SizeValueType* VolumeSize:: getVolumeSize() const { return _size; }; template void VolumeSize:: setVolumeSize(const SizeValueType val[VDimensions]) { memcpy(_size, val, sizeof(SizeValueType)*VDimensions); } template void VolumeSize:: setElement(unsigned long element, SizeValueType val) { _size[ element ] = val; } template typename VolumeSize::SizeValueType VolumeSize:: getElement(unsigned long element) const { assert(element < VDimensions); //check if index element is out of bound return _size[ element ]; } template void VolumeSize:: fill(SizeValueType value) { for (unsigned int i = 0; i < VDimensions; ++i) { _size[i] = value; } } template bool VolumeSize:: isPositive() const { for (unsigned int i = 0; i < VDimensions; ++i) { if (_size[i] < 0) { return false; } } return true; }; template ::map::structuredData::StreamingInterface::ElementPointer VolumeSize:: streamToStructuredData(const Self& vs) { structuredData::Element::Pointer spElement = structuredData::Element::New(); spElement->setTag("VolumeSize"); for (unsigned int rowID = 0; rowID < VDimensions; ++rowID) { structuredData::Element::Pointer spValueElement = structuredData::Element::New(); spValueElement->setTag(tags::Value); spValueElement->setValue(convert::toStr(vs._size[rowID])); spValueElement->setAttribute(tags::Row, convert::toStr(rowID)); spElement->addSubElement(spValueElement); } return spElement; }; template typename VolumeSize::Self VolumeSize:: streamFromStructuredData(const structuredData::Element* pElement) { - if (!pElement) + if (pElement == nullptr) { mapDefaultExceptionStaticMacro( << "Error: convert structured data into VolumeSize. Reason: passed structured element point to NULL."); } if (pElement->getSubElementsCount() != VDimensions) { mapDefaultExceptionStaticMacro( << "Error: convert structured data into VolumeSize. Reason: Wrong number of sub elements. Expected: " << VDimensions << "; found: " << pElement->getSubElementsCount()); } Self vs; - for (structuredData::Element::ConstSubElementIteratorType pos = pElement->getSubElementBegin(); + for (auto pos = pElement->getSubElementBegin(); pos != pElement->getSubElementEnd(); ++pos) { unsigned int rowID = core::convert::toUInt((*pos)->getAttribute(tags::Row)); vs._size[rowID] = core::convert::toValueGeneric((*pos)->getValue()); } return vs; }; template std::ostream& operator<<(std::ostream& os, const VolumeSize& size) { os << "["; for (unsigned int i = 0; i + 1 < VDimensions; ++i) { os << size[i] << ", "; } if (VDimensions >= 1) { os << size[VDimensions - 1]; } os << "]"; return os; } } // end namespace continuous } // end namespace core } // end namespace map #endif diff --git a/Code/Core/include/mapXMLLogger.h b/Code/Core/include/mapXMLLogger.h index 121aebf..6753f00 100644 --- a/Code/Core/include/mapXMLLogger.h +++ b/Code/Core/include/mapXMLLogger.h @@ -1,90 +1,90 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_XML_LOGGER_H #define __MAP_XML_LOGGER_H #include "itkLogger.h" #include "mapMacros.h" #include "mapMAPCoreExports.h" namespace map { namespace core { /*! @class XMLLogger * @brief Logger based on itk::Logger but generating XML outputs. * * Build xml log entries, regarding the following pattern:\n * \n * ...content...\n * * @remark The logger does not escape any special xml characters, * thus it is possible to inject further xml strutcures with the content * string. If you want to prevent such an injection you may convert the * string we the global function escapeSpecialXMLCharacters() befor you pass * the string to the logger. * @ingroup Logging */ class MAPCore_EXPORT XMLLogger: public itk::Logger { public: - typedef XMLLogger Self; - typedef Logger Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Self = XMLLogger; + using Superclass = Logger; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; /** Run-time type information (and related methods). */ itkTypeMacro(XMLLogger, itk::Logger); /** New macro for creation of through a Smart Pointer */ itkNewMacro(Self); /** Provides a xml formatted log entry */ - virtual std::string BuildFormattedEntry(PriorityLevelType level, std::string const& content); + std::string BuildFormattedEntry(PriorityLevelType level, std::string const& content) override; protected: /** Constructor */ - XMLLogger() {}; + XMLLogger() = default; /** Destructor */ - virtual ~XMLLogger() {}; + ~XMLLogger() override = default; private: - XMLLogger(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented + XMLLogger(const Self&) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; /*! Converts the passed content and "escapes" any special xml characters. * (e.g. "<" to "<"). * @return Converted string.*/ MAPCore_EXPORT std::string escapeSpecialXMLCharacters(std::string content); } // end namespace core } // end namespace map #endif diff --git a/Code/Core/source/mapConvert.cpp b/Code/Core/source/mapConvert.cpp index 114ee52..e865d95 100644 --- a/Code/Core/source/mapConvert.cpp +++ b/Code/Core/source/mapConvert.cpp @@ -1,246 +1,246 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ -#include // for atoi +#include // for atoi #include "mapConvert.h" #include "mapExceptionObjectMacros.h" #include #include "itksys/SystemTools.hxx" namespace map { namespace core { namespace convert { String toStr(const double& value, const int precision) { String sResult; OStringStream stream; stream.precision(precision); stream << std::showpoint << value; sResult = stream.str(); return sResult; }; String toStr(const float& value, const int precision) { String sResult; OStringStream stream; stream.precision(precision); stream << std::showpoint << value; sResult = stream.str(); return sResult; }; String toStr(const bool& value) { if (value) { return "1"; } - else - { + + return "0"; - } + }; String toStr(const int& value) { String sResult; OStringStream stream; stream << value; sResult = stream.str(); return sResult; }; String toStr(const unsigned int& value) { String sResult; OStringStream stream; stream << value; sResult = stream.str(); return sResult; }; String toStr(const long& value) { String sResult; OStringStream stream; stream << value; sResult = stream.str(); return sResult; }; String toStr(const unsigned long& value) { String sResult; OStringStream stream; stream << value; sResult = stream.str(); return sResult; }; String toStr(const String& str) { return str; }; double toDouble(const String& value) { char* pStopstring; double x; x = strtod(value.c_str(), &pStopstring); return x; }; bool isADouble(const String& value) { char* pStopstring; double x; x = strtod(value.c_str(), &pStopstring); String sTemp = pStopstring; - return (sTemp == "") & (value != ""); + return (static_cast(sTemp.empty()) & static_cast(!value.empty())) != 0; }; float toFloat(const String& value) { return toValueGeneric(value); }; int toInt(const String& value) { return atoi(value.c_str()); }; bool isAInt(const String& value) { int iTest = toInt(value); String sTest = toStr(iTest); return value == sTest; }; unsigned int toUInt(const String& value) { return toValueGeneric(value); }; long toLong(const String& value) { return toValueGeneric(value); }; bool isALong(const String& value) { long lTest = toLong(value); String sTest = toStr(lTest); return value == sTest; }; unsigned long toULong(const String& value) { return toValueGeneric(value); }; bool toBool(const String& value) { if (value == "0") { return false; } if (value == "false") { return false; } if (value == "FALSE") { return false; } if (value == "False") { return false; } return true; }; String fileContentToStr(const String& filePath) { - String result = ""; + String result; std::ifstream file; std::ios_base::openmode iOpenFlag = std::ios_base::in; file.open(filePath.c_str(), iOpenFlag); if (file.is_open()) { bool hasError = false; - std::streamsize filesize = itksys::SystemTools::FileLength(filePath.c_str()); + std::streamsize filesize = itksys::SystemTools::FileLength(filePath); char* buffer = new char [filesize]; try { file.read(buffer, filesize); std::streamsize gsize = file.gcount(); result.insert(0, buffer, gsize); } catch (...) { hasError = true; } delete[] buffer; file.close(); if (hasError) { mapDefaultExceptionStaticMacro( << "Error while reading file content into buffer. File path:" << filePath); } } return result; }; - } - } -} //end of namespace free + } // namespace convert + } // namespace core +} // namespace map diff --git a/Code/Core/source/mapDimensionlessRegistrationKernelBase.cpp b/Code/Core/source/mapDimensionlessRegistrationKernelBase.cpp index 2b16713..7c6ae19 100644 --- a/Code/Core/source/mapDimensionlessRegistrationKernelBase.cpp +++ b/Code/Core/source/mapDimensionlessRegistrationKernelBase.cpp @@ -1,52 +1,52 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapDimensionlessRegistrationKernelBase.h" namespace map { namespace core { void DimensionlessRegistrationKernelBase::PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "Input dimensions: " << getInputDimensions() << std::endl; os << indent << "Output dimensions: " << getOutputDimensions() << std::endl; os << indent << "limited Representation: " << hasLimitedRepresentation() << std::endl; }; DimensionlessRegistrationKernelBase::DimensionlessRegistrationKernelBase() - {}; + = default; DimensionlessRegistrationKernelBase::~DimensionlessRegistrationKernelBase() - {}; + = default; std::ostream& operator<< (std::ostream& os, const DimensionlessRegistrationKernelBase& p) { p.Print(os); return os; } - } -} + } // namespace core +} // namespace map diff --git a/Code/Core/source/mapEvents.cpp b/Code/Core/source/mapEvents.cpp index 47292c5..1467a72 100644 --- a/Code/Core/source/mapEvents.cpp +++ b/Code/Core/source/mapEvents.cpp @@ -1,92 +1,94 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapEvents.h" +#include + namespace map { namespace core { EventObject:: - EventObject(void* pData, const std::string& comment): _pData(pData), _comment(comment) + EventObject(void* pData, std::string comment): _pData(pData), _comment(std::move(comment)) {}; EventObject:: - ~EventObject() {}; + ~EventObject() = default; void* EventObject:: getData() const { return _pData; }; const std::string& EventObject:: getComment() const { return _comment; }; const char* EventObject:: GetEventName() const { return "map::EventObject"; }; bool EventObject:: CheckEvent(const ::itk::EventObject* e) const { - return dynamic_cast(e); + return dynamic_cast(e) != nullptr; } ::itk::EventObject* EventObject:: MakeObject() const { return new EventObject(*this); } EventObject:: EventObject(const Self& s) : Superclass(s) { _comment = s.getComment(); _pData = s.getData(); }; void EventObject:: Print(std::ostream& os) const { Superclass::Print(os); os << "Comment: " << _comment << std::endl; os << "Data pointer: " << _pData << std::endl; }; - } -} \ No newline at end of file + } // namespace core +} // namespace map \ No newline at end of file diff --git a/Code/Core/source/mapExceptionObject.cpp b/Code/Core/source/mapExceptionObject.cpp index c7ac86d..67a1c9a 100644 --- a/Code/Core/source/mapExceptionObject.cpp +++ b/Code/Core/source/mapExceptionObject.cpp @@ -1,88 +1,86 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapExceptionObject.h" namespace map { namespace core { ExceptionObject::BaseExceptionType* ExceptionObject:: - clone() const throw() + clone() const noexcept { - BaseExceptionType* pResult = 0; + BaseExceptionType* pResult = nullptr; try { pResult = new ExceptionObject(this->GetFile() , this->GetLine() , this->GetDescription() , this->GetLocation()); } catch (...) { //no throw guarantee } return pResult; }; ExceptionObject::ExceptionObject() - { - } + = default; ExceptionObject::ExceptionObject(const char* file, unsigned int lineNumber) : Superclass(file, lineNumber) { } ExceptionObject::ExceptionObject(const std::string& file, unsigned int lineNumber) : Superclass(file, lineNumber) { } ExceptionObject::ExceptionObject(const std::string& file, unsigned int lineNumber, const std::string& desc, const std::string& loc) : Superclass(file, lineNumber, desc, loc) { } - ExceptionObject::~ExceptionObject() throw() - { - } + ExceptionObject::~ExceptionObject() noexcept + = default; const char* ExceptionObject::GetNameOfClass() const { return "map::ExceptionObject"; } std::ostream& operator<<(std::ostream& os, const ExceptionObject& e) { e.Print(os); return os; } } // end namespace core } // end namespace map diff --git a/Code/Core/source/mapFastLockedThreadingPolicy.cpp b/Code/Core/source/mapFastLockedThreadingPolicy.cpp index fc7f6fa..20154fa 100644 --- a/Code/Core/source/mapFastLockedThreadingPolicy.cpp +++ b/Code/Core/source/mapFastLockedThreadingPolicy.cpp @@ -1,63 +1,63 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapFastLockedThreadingPolicy.h" namespace map { namespace core { namespace services { void FastLockedThreadingPolicy:: lock() const { _mutex.Lock(); } void FastLockedThreadingPolicy:: unlock() const { _mutex.Unlock(); }; void FastLockedThreadingPolicy:: activateSentinel(SentinelType& sentinel) const { sentinel.initializeSentinel(&_mutex); //lock will be done by initializeSentinel() }; FastLockedThreadingPolicy:: FastLockedThreadingPolicy() - {}; + = default; FastLockedThreadingPolicy:: ~FastLockedThreadingPolicy() - {}; + = default; } // end namespace services } // end namespace core } // end namespace map diff --git a/Code/Core/source/mapFastLockedThreadingStaticPolicy.cpp b/Code/Core/source/mapFastLockedThreadingStaticPolicy.cpp index 7572828..a653b8a 100644 --- a/Code/Core/source/mapFastLockedThreadingStaticPolicy.cpp +++ b/Code/Core/source/mapFastLockedThreadingStaticPolicy.cpp @@ -1,69 +1,67 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapFastLockedThreadingStaticPolicy.h" namespace map { namespace core { namespace services { void FastLockedThreadingStaticPolicy:: activateSentinel(SentinelType& sentinel) { sentinel.initializeSentinel(&FastLockedThreadingStaticPolicy::_mutex); //lock will be done by initializeSentinel() }; void FastLockedThreadingStaticPolicy:: lock() { FastLockedThreadingStaticPolicy::_mutex.Lock(); }; void FastLockedThreadingStaticPolicy:: unlock() { FastLockedThreadingStaticPolicy::_mutex.Unlock(); }; FastLockedThreadingStaticPolicy:: FastLockedThreadingStaticPolicy() - { - }; + = default; FastLockedThreadingStaticPolicy:: ~FastLockedThreadingStaticPolicy() - { - }; + = default; FastLockedThreadingStaticPolicy::MutexType FastLockedThreadingStaticPolicy::_mutex; } // end namespace services } // end namespace core } // end namespace map diff --git a/Code/Core/source/mapFastMutexLockSentinel.cpp b/Code/Core/source/mapFastMutexLockSentinel.cpp index 51307c8..2d09a1c 100644 --- a/Code/Core/source/mapFastMutexLockSentinel.cpp +++ b/Code/Core/source/mapFastMutexLockSentinel.cpp @@ -1,57 +1,57 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapFastMutexLockSentinel.h" -#include +#include namespace map { namespace core { namespace services { void FastMutexLockSentinel:: initializeSentinel(MutexType* pMutex) { - assert(_pMutex == NULL); //must not be used before! + assert(_pMutex == nullptr); //must not be used before! _pMutex = pMutex; _pMutex->Lock(); } FastMutexLockSentinel:: - FastMutexLockSentinel() : _pMutex(NULL) + FastMutexLockSentinel() {}; FastMutexLockSentinel:: ~FastMutexLockSentinel() { - if (_pMutex) + if (_pMutex != nullptr) { _pMutex->Unlock(); } }; } // end namespace services } // end namespace core } // end namespace map diff --git a/Code/Core/source/mapFileDispatch.cpp b/Code/Core/source/mapFileDispatch.cpp index b76de9b..af1c221 100644 --- a/Code/Core/source/mapFileDispatch.cpp +++ b/Code/Core/source/mapFileDispatch.cpp @@ -1,170 +1,170 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapFileDispatch.h" #include "itksys/SystemTools.hxx" namespace map { namespace core { String FileDispatch:: getName(const String& sFilePath) { String result = itksys::SystemTools::GetFilenameWithoutLastExtension(sFilePath); return result; }; String FileDispatch:: getExtension(const String& sFilePath) { String result = itksys::SystemTools::GetFilenameLastExtension(sFilePath); return result; }; String FileDispatch:: getFullName(const String& sFilePath) { String result = itksys::SystemTools::GetFilenameName(sFilePath); return result; }; String FileDispatch:: getPath(const String& sFilePath) { String result = itksys::SystemTools::GetFilenamePath(sFilePath); return ensureCorrectOSPathSeparator(result); }; String FileDispatch:: getName() { return getName(_fileName); }; String FileDispatch:: getExtension() { return getExtension(_fileName); }; String FileDispatch:: getFullName() { return getFullName(_fileName); }; String FileDispatch:: getPath() { return getPath(_fileName); }; FileDispatch:: FileDispatch(const String& filePath) { _fileName = filePath; }; /** * A file scope helper function to concat path and file into * a full path */ String FileDispatch:: createFullPath(const char* path, const char* file) { String ret; #ifdef _WIN32 const char sep = '\\'; #else const char sep = '/'; #endif /** * make sure the end of path is a separator */ ret = path; ret = ensureCorrectOSPathSeparator(ret); - if (ret.size()) + if (!ret.empty() != 0u) { if (ret[ret.size() - 1] != sep) { ret.append(1, sep); } } ret.append(file); return ret; } String FileDispatch:: createFullPath(const String& path, const String& file) { String ret = createFullPath(path.c_str(), file.c_str()); return ret; } /** Convertes all path seperators in the seperators used in the current OS.*/ String FileDispatch:: ensureCorrectOSPathSeparator(const String& path) { String ret = path; #ifdef _WIN32 const String curSep = "\\"; const char wrongSep = '/'; #else const String curSep = "/"; const char wrongSep = '\\'; #endif String::size_type pos = ret.find_first_of(wrongSep); while (pos != String::npos) { ret.replace(pos, 1, curSep); pos = ret.find_first_of(wrongSep); } return ret; } - } -} \ No newline at end of file + } // namespace core +} // namespace map \ No newline at end of file diff --git a/Code/Core/source/mapLogbook.cpp b/Code/Core/source/mapLogbook.cpp index 331c32a..8974cc0 100644 --- a/Code/Core/source/mapLogbook.cpp +++ b/Code/Core/source/mapLogbook.cpp @@ -1,264 +1,264 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapLogbook.h" #include "mapLogbookImplementation.h" #include "mapSmartMetaProperty.h" #include "mapMetaProperty.h" #include "itkMutexLockHolder.h" -#include +#include namespace map { namespace core { Logbook::LogImplPointer Logbook::_spLoggerImpl = nullptr; itk::SimpleFastMutexLock Logbook::_testMutex; itk::SimpleFastMutexLock Logbook::_initMutex; Logbook::PriorityLevelType Logbook::_currentPriorityLevel = itk::LoggerBase::INFO; bool Logbook::_syncedAsDedicated = false; String Logbook::_defaultFilename = "MatchPoint.log"; void Logbook:: write(PriorityLevelType level, const String& content) { if (_spLoggerImpl.IsNull()) { initializeLogger(); } - _spLoggerImpl->getLogger().Write(level, content.c_str()); + _spLoggerImpl->getLogger().Write(level, content); }; void Logbook:: flush() { if (_spLoggerImpl.IsNotNull()) { _spLoggerImpl->getLogger().Flush(); } }; void Logbook:: setDefaultLogFileName(const String& fileName) { if (_spLoggerImpl.IsNotNull() && _defaultFilename != fileName) { //we need to exchange the implementation mapLogDebugStaticMacro( << "Attempt to change logbook default file. New file name: " << fileName); LogImplPointer spNewImpl = _spLoggerImpl->clone(fileName); //if we reached this point without exception the implementation //with the new file is open and established, thus swap the implmentations, //store the new default file and print the header. swapImplementations(spNewImpl); _defaultFilename = fileName; } else { _defaultFilename = fileName; } }; void Logbook:: addAdditionalLogOutput(OutputType* pOutput) { assert(pOutput); //must not be null if (_spLoggerImpl.IsNull()) { initializeLogger(); } mapLogDebugStaticMacro( << "Add output to logbook. Output: " << pOutput->GetNameOfClass()); LogImplPointer spNewImpl = _spLoggerImpl->clone(); spNewImpl->addAdditionalLogOutput(pOutput); swapImplementations(spNewImpl); }; void Logbook:: attachITKOutputWindow() { if (_spLoggerImpl.IsNull()) { initializeLogger(); } mapLogDebugStaticMacro( << "Attached itk ouput window to MatchPoint logbook"); itk::MutexLockHolder testHolder(_testMutex); itk::MutexLockHolder initHolder(_initMutex); if (_spLoggerImpl->_spItkOutputWindow.IsNull()) { itk::LoggerOutput::Pointer spNewLogger = itk::LoggerOutput::New(); itk::OutputWindow::SetInstance(spNewLogger); _spLoggerImpl->_spItkOutputWindow = spNewLogger; } _spLoggerImpl->_spItkOutputWindow->SetLogger(&(_spLoggerImpl->getLogger())); }; Logbook::PriorityLevelType Logbook:: - getLogbookMode(void) + getLogbookMode() { return _currentPriorityLevel; }; void Logbook:: - setLogbookToDebugMode(void) + setLogbookToDebugMode() { setLogbookMode(itk::LoggerBase::DEBUG); }; void Logbook:: - setLogbookToInfoMode(void) + setLogbookToInfoMode() { setLogbookMode(itk::LoggerBase::INFO); }; void Logbook:: - setLogbookToCriticalMode(void) + setLogbookToCriticalMode() { setLogbookMode(itk::LoggerBase::CRITICAL); }; void Logbook:: setLogbookMode(PriorityLevelType level) { if (_spLoggerImpl.IsNotNull()) { _spLoggerImpl->getLogger().SetPriorityLevel(level); } _currentPriorityLevel = level; }; bool Logbook:: - isInitialized(void) + isInitialized() { return _spLoggerImpl.IsNotNull(); }; void Logbook:: - initializeLogger(void) + initializeLogger() { itk::MutexLockHolder testHolder(_testMutex); if (_spLoggerImpl.IsNull()) { { //mutex lock holder scope itk::MutexLockHolder initHolder(_initMutex); LogImplPointer spNewImpl = LogbookImplementation::New(); spNewImpl->initializeOutputs(_defaultFilename); _spLoggerImpl = spNewImpl; } // end of mutex lock holder scope } }; void Logbook:: swapImplementations(LogbookImplementation* pImpl) { assert(pImpl); //must not be null; _testMutex.Lock(); _initMutex.Lock(); _spLoggerImpl = pImpl; _initMutex.Unlock(); _testMutex.Unlock(); }; void Logbook:: getSynchronization(deployment::SyncObject& syncObject) { core::MetaPropertyBase::Pointer prop = core::SmartMetaProperty::New(_spLoggerImpl).GetPointer(); deployment::SyncObject::SyncPropertyMapType::value_type valuePair("Logbook_Impl", prop); syncObject._map.insert(valuePair); prop = core::MetaProperty::New(_currentPriorityLevel).GetPointer(); deployment::SyncObject::SyncPropertyMapType::value_type valuePair2("Logbook_Priority", prop); syncObject._map.insert(valuePair2); }; void Logbook:: setSynchronization(const deployment::SyncObject& syncObject) { LogImplPointer spNewLogger; if (syncObject.getProperty("Logbook_Impl", spNewLogger)) { //there is something to sync for the logbook... if (spNewLogger.GetPointer() != _spLoggerImpl) { _syncedAsDedicated = true; swapImplementations(spNewLogger); } syncObject.getProperty("Logbook_Priority", _currentPriorityLevel); } }; void Logbook:: deSynchronize() { mapLogInfoStaticMacro( << "Attempt to desync logbook."); LogImplPointer spNewImpl = _spLoggerImpl->clone(Logbook::_defaultFilename); //if we reached this point without exception the implementation //with the new file is open and established, thus swap the implmentations, //store the new default file and print the header. swapImplementations(spNewImpl); _syncedAsDedicated = false; }; } // end namespace core } // end namespace map diff --git a/Code/Core/source/mapLogbookImplementation.cpp b/Code/Core/source/mapLogbookImplementation.cpp index f53c07e..482e081 100644 --- a/Code/Core/source/mapLogbookImplementation.cpp +++ b/Code/Core/source/mapLogbookImplementation.cpp @@ -1,309 +1,308 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapLogbookImplementation.h" #include "mapExceptionObject.h" #include "itkFastMutexLock.h" -#include +#include namespace map { namespace core { /*! @class SharedFileStreamBase * @brief Helper class realizing an std stream handled as a object with smart pointer * * Reason: Need for a shared_ptr to handle the same stream across different logbook * implementations. VS2005 has no std::tr1::shared_ptr. Thus uses the itk::SmartPointer * functionality. * @ingroup Logging */ class SharedFileStreamBase : public itk::LightObject { public: - typedef SharedFileStreamBase Self; - typedef itk::LightObject Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Self = SharedFileStreamBase; + using Superclass = itk::LightObject; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(SharedFileStreamBase, itk::LightObject); virtual std::ostream& getStream() = 0; virtual const std::ostream& getStream() const = 0; protected: SharedFileStreamBase() - {}; + = default; - virtual ~SharedFileStreamBase() - {}; + ~SharedFileStreamBase() override + = default; private: - SharedFileStreamBase(const SharedFileStreamBase&); //purposely not implemented - void operator=(const SharedFileStreamBase&); //purposely not implemented + SharedFileStreamBase(const SharedFileStreamBase&) = delete; //purposely not implemented + void operator=(const SharedFileStreamBase&) = delete; //purposely not implemented }; /*! @class SharedDefaultLogFileStream * @brief Helper class realizing an dummy stream handled as a object with smart pointer * * Reason: Need for a shared_ptr to handle the same stream across different logbook * implementations. VS2005 has no std::tr1::shared_ptr. Thus uses the itk::SmartPointer * functionality. * @ingroup Logging */ class SharedNULLStream : public SharedFileStreamBase { public: - typedef SharedNULLStream Self; - typedef itk::LightObject Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Self = SharedNULLStream; + using Superclass = itk::LightObject; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(SharedNULLStream, itk::LightObject); itkNewMacro(Self); std::ostream& getStream() override { return _stream; }; const std::ostream& getStream() const override { return _stream; }; protected: /*! Helper class that allows to generate a dummy os*/ class NullBuffer : public std::streambuf { public: - int overflow(int c) { return c; } + int overflow(int c) override { return c; } }; NullBuffer _buffer; std::ostream _stream; SharedNULLStream() : _stream(&_buffer) { }; - virtual ~SharedNULLStream() - {}; + ~SharedNULLStream() override + = default; private: - SharedNULLStream(const SharedNULLStream&); //purposely not implemented - void operator=(const SharedNULLStream&); //purposely not implemented + SharedNULLStream(const SharedNULLStream&) = delete; //purposely not implemented + void operator=(const SharedNULLStream&) = delete; //purposely not implemented }; /*! @class SharedDefaultLogFileStream * @brief Helper class realizing an std stream handled as a object with smart pointer * * Reason: Need for a shared_ptr to handle the same stream across different logbook * implementations. VS2005 has no std::tr1::shared_ptr. Thus uses the itk::SmartPointer * functionality. * @ingroup Logging */ class SharedDefaultLogFileStream : public SharedFileStreamBase { public: - typedef SharedDefaultLogFileStream Self; - typedef SharedFileStreamBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Self = SharedDefaultLogFileStream; + using Superclass = SharedFileStreamBase; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(SharedDefaultLogFileStream, SharedFileStreamBase); itkNewMacro(Self); std::ostream& getStream() override { return _stream; }; const std::ostream& getStream() const override { return _stream; }; std::ofstream& getOFStream() { return _stream; }; const std::ofstream& getOFStream() const { return _stream; }; protected: std::ofstream _stream; SharedDefaultLogFileStream() - {}; + = default; - virtual ~SharedDefaultLogFileStream() - {}; + ~SharedDefaultLogFileStream() override + = default; private: - SharedDefaultLogFileStream(const SharedDefaultLogFileStream&); //purposely not implemented - void operator=(const SharedDefaultLogFileStream&); //purposely not implemented + SharedDefaultLogFileStream(const SharedDefaultLogFileStream&) = delete; //purposely not implemented + void operator=(const SharedDefaultLogFileStream&) = delete; //purposely not implemented }; //************************************************************************************************* //******************** class LogbookImplementation ********************************************** //************************************************************************************************* LogbookImplementation::LoggerType& LogbookImplementation:: - getLogger(void) + getLogger() { return *(_spLogger.GetPointer()); }; void LogbookImplementation:: initializeOutputs(const String& defaultOutputFileName) { if (!defaultOutputFileName.empty()) { SharedDefaultLogFileStream::Pointer spNewStream = SharedDefaultLogFileStream::New(); spNewStream->getOFStream().open(defaultOutputFileName.c_str(), std::ios::out | std::ios::app); if (!(spNewStream->getOFStream().is_open())) { mapLogbookCheckDefaultExceptionMacro(<< "Error: cannot open specified file as default logbook output file. Filename: " << defaultOutputFileName); } _spDefaultStream = spNewStream; _spDefaultOutput->SetStream(_spDefaultStream->getStream()); } else { _spDefaultStream = SharedNULLStream::New(); _spDefaultOutput->SetStream(_spDefaultStream->getStream()); } initializeAdditionalOutputs(); if (_spItkOutputWindow.IsNotNull()) { _spItkOutputWindow->SetLogger(_spLogger); } }; void LogbookImplementation:: addAdditionalLogOutput(OutputType* pOutput) { assert(pOutput); //output may not be null. std::pair result; result = _additionalOutputs.insert(pOutput); - if (result.second == true) + if (result.second) { //this output isn't already in the set, //so it was added and shall also be added to the logger. _spLogger->AddLogOutput(pOutput); } }; LogbookImplementation::Pointer LogbookImplementation:: - clone(void) const + clone() const { Pointer spNewImpl = LogbookImplementation::New(); spNewImpl->_additionalOutputs = this->_additionalOutputs; spNewImpl->_spDefaultStream = this->_spDefaultStream; spNewImpl->_spDefaultOutput->SetStream(spNewImpl->_spDefaultStream->getStream()); spNewImpl->_spItkOutputWindow = this->_spItkOutputWindow; spNewImpl->_currentPriorityLevel = this->_currentPriorityLevel; spNewImpl->initializeAdditionalOutputs(); if (spNewImpl->_spItkOutputWindow.IsNotNull()) { spNewImpl->_spItkOutputWindow->SetLogger(spNewImpl->_spLogger); } return spNewImpl; }; LogbookImplementation::Pointer LogbookImplementation:: clone(const String& newDefaultOutputFileName) const { Pointer spNewImpl = LogbookImplementation::New(); spNewImpl->_additionalOutputs = this->_additionalOutputs; spNewImpl->_spItkOutputWindow = this->_spItkOutputWindow; spNewImpl->_currentPriorityLevel = this->_currentPriorityLevel; spNewImpl->initializeOutputs(newDefaultOutputFileName); return spNewImpl; }; void LogbookImplementation:: initializeAdditionalOutputs() { - for (OutputContainerType::iterator pos = _additionalOutputs.begin(); - pos != _additionalOutputs.end(); ++pos) + for (const auto & _additionalOutput : _additionalOutputs) { - _spLogger->AddLogOutput(*pos); + _spLogger->AddLogOutput(_additionalOutput); } }; LogbookImplementation:: LogbookImplementation() { - _spItkOutputWindow = NULL; + _spItkOutputWindow = nullptr; _currentPriorityLevel = itk::LoggerBase::INFO; _spLogger = LoggerType::New(); _spDefaultOutput = DefaultOutputType::New(); _spLogger->AddLogOutput(_spDefaultOutput); }; LogbookImplementation:: ~LogbookImplementation() { //ensure that the logger is deleted before the default output (because logger flushes on destruction) //if the logger isn't used by other parts of the program. - _spLogger = 0; - _spDefaultOutput = 0; + _spLogger = nullptr; + _spDefaultOutput = nullptr; }; } // end namespace core } // end namespace map \ No newline at end of file diff --git a/Code/Core/source/mapMappingException.cpp b/Code/Core/source/mapMappingException.cpp index d8d49ef..d56467a 100644 --- a/Code/Core/source/mapMappingException.cpp +++ b/Code/Core/source/mapMappingException.cpp @@ -1,50 +1,50 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapMappingException.h" namespace map { namespace core { MappingException::BaseExceptionType* MappingException:: - clone() const throw() + clone() const noexcept { - BaseExceptionType* pResult = 0; + BaseExceptionType* pResult = nullptr; try { pResult = new MappingException(this->GetFile() , this->GetLine() , this->GetDescription() , this->GetLocation()); } catch (...) { //no throw guarantee } return pResult; }; } // end namespace core } // end namespace map \ No newline at end of file diff --git a/Code/Core/source/mapMetaPropertyBase.cpp b/Code/Core/source/mapMetaPropertyBase.cpp index d4ff399..b661889 100644 --- a/Code/Core/source/mapMetaPropertyBase.cpp +++ b/Code/Core/source/mapMetaPropertyBase.cpp @@ -1,52 +1,52 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapMetaPropertyBase.h" namespace map { namespace core { void MetaPropertyBase ::PrintSelf(std::ostream& os, itk::Indent indent) const { os << indent << "[UNKNOWN_PRINT_CHARACTERISTICS]" << std::endl; } MetaPropertyBase ::MetaPropertyBase() { //Nothing to do here } MetaPropertyBase ::~MetaPropertyBase() { //Nothing to do here } - } -} \ No newline at end of file + } // namespace core +} // namespace map \ No newline at end of file diff --git a/Code/Core/source/mapMissingProviderException.cpp b/Code/Core/source/mapMissingProviderException.cpp index 24b36b5..b332882 100644 --- a/Code/Core/source/mapMissingProviderException.cpp +++ b/Code/Core/source/mapMissingProviderException.cpp @@ -1,50 +1,50 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapMissingProviderException.h" namespace map { namespace core { MissingProviderException::BaseExceptionType* MissingProviderException:: - clone() const throw() + clone() const noexcept { - BaseExceptionType* pResult = 0; + BaseExceptionType* pResult = nullptr; try { pResult = new MissingProviderException(this->GetFile() , this->GetLine() , this->GetDescription() , this->GetLocation()); } catch (...) { //no throw guarantee } return pResult; }; } // end namespace core } // end namespace map \ No newline at end of file diff --git a/Code/Core/source/mapModificationTimeValidator.cpp b/Code/Core/source/mapModificationTimeValidator.cpp index 5976c76..d9d36fe 100644 --- a/Code/Core/source/mapModificationTimeValidator.cpp +++ b/Code/Core/source/mapModificationTimeValidator.cpp @@ -1,78 +1,77 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapModificationTimeValidator.h" namespace map { namespace core { ModificationTimeValidator::ModificationTimeValidator(const WatchedObjectType* obj) { - _spObj = NULL; + _spObj = nullptr; setWatchedObject(obj); } ModificationTimeValidator::ModificationTimeValidator() { - _spObj = NULL; + _spObj = nullptr; } ModificationTimeValidator::~ModificationTimeValidator() - { - } + = default; void ModificationTimeValidator::setWatchedObject(const WatchedObjectType* obj) { if (_spObj != obj) { _spObj = obj; - if (obj) + if (obj != nullptr) { _objTimeStamp = obj->GetMTime(); } _ownTimeStamp.Modified(); } } ModificationTimeValidator::MTimeType ModificationTimeValidator::getMTime() const { if (_spObj.IsNotNull()) { if (_objTimeStamp < _spObj->GetMTime()) { _objTimeStamp = _spObj->GetMTime(); _ownTimeStamp.Modified(); } } MTimeType result = _ownTimeStamp.GetMTime(); return result; } } // end namespace core } // end namespace map \ No newline at end of file diff --git a/Code/Core/source/mapObserverSentinel.cpp b/Code/Core/source/mapObserverSentinel.cpp index db0b5b9..30d4300 100644 --- a/Code/Core/source/mapObserverSentinel.cpp +++ b/Code/Core/source/mapObserverSentinel.cpp @@ -1,77 +1,77 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapObserverSentinel.h" #include "mapExceptionObjectMacros.h" -#include +#include namespace map { namespace core { ObserverSentinel::Pointer ObserverSentinel:: New(::itk::Object* pObserverOwner, const ::itk::EventObject& event, itk::Command* pCmd) { Pointer smartPtr; Self* rawPtr = new Self(pObserverOwner, event, pCmd); smartPtr = rawPtr; rawPtr->UnRegister(); return smartPtr; } ::itk::LightObject::Pointer ObserverSentinel:: - CreateAnother(void) const + CreateAnother() const { mapDefaultExceptionMacro( << "CreateAnother not implemented for ObserverSentinel"); } ObserverSentinel::ObserverTagType ObserverSentinel:: getObserverTage() const { return _tag; }; ObserverSentinel:: ObserverSentinel(::itk::Object* pObserverOwner, const ::itk::EventObject& event, itk::Command* pCmd) { assert(pObserverOwner); assert(pCmd); _spObject = pObserverOwner; _tag = _spObject->AddObserver(event, pCmd); }; ObserverSentinel:: ~ObserverSentinel() { _spObject->RemoveObserver(_tag); }; - } -} + } // namespace core +} // namespace map diff --git a/Code/Core/source/mapPMVolume.cpp b/Code/Core/source/mapPMVolume.cpp index f5be11b..c0c2314 100644 --- a/Code/Core/source/mapPMVolume.cpp +++ b/Code/Core/source/mapPMVolume.cpp @@ -1,208 +1,207 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapPMVolume.h" -#include +#include #include +#include namespace map { namespace core { namespace continuous { unsigned int PMVolume:: getVolumeDimension() const { //origin and _size must always have the same size. return _size.size(); }; PMVolume:: PMVolume() - { - }; + = default; PMVolume:: ~PMVolume() - { - }; + = default; PMVolume:: PMVolume(const Self& volume) { _size = volume._size; _origin = volume._origin; }; PMVolume:: PMVolume(const OriginType& origin, const SizeType& size): _origin(origin), _size(size) { assert(origin.size() == size.size()); }; PMVolume:: - PMVolume(const SizeType& size): _size(size) + PMVolume(SizeType size): _size(std::move(size)) { _origin.resize(_size.size(), 0.0); }; void PMVolume:: operator=(const Self& volume) { if (this != &volume) { _origin = volume._origin; _size = volume._size; } }; bool PMVolume:: operator==(const Self& volume) const { bool result = true; if (_size.size() != volume._size.size()) { result = false; } if (_origin.size() != volume._origin.size()) { result = false; } if (result) { result = std::equal(_size.begin(), _size.end(), volume._size.begin()); } if (result) { result = std::equal(_origin.begin(), _origin.end(), volume._origin.begin()); } return result; }; void PMVolume:: setOrigin(const OriginType& origin) { _origin = origin; }; const PMVolume::OriginType& PMVolume:: getOrigin() const { return _origin; }; void PMVolume:: setSize(const SizeType& size) { _size = size; }; const PMVolume::SizeType& PMVolume:: getSize() const { return _size; }; void PMVolume:: setSize(unsigned long i, SizeValueType sze) { assert(i < _size.size()); _size[i] = sze; }; PMVolume::SizeValueType PMVolume:: getSize(unsigned long i) const { assert(i < _size.size()); return _size[i]; }; void PMVolume:: setOrigin(unsigned long i, OriginValueType sze) { assert(i < _origin.size()); _origin[i] = sze; }; PMVolume::OriginValueType PMVolume:: getOrigin(unsigned long i) const { assert(i < _origin.size()); return _origin[i]; }; std::ostream& operator<<(std::ostream& os, const PMVolume& volume) { os << "PMVolume[origin["; PMVolume::OriginType origin = volume.getOrigin(); for (PMVolume::OriginType::const_iterator pos = origin.begin(); pos != origin.end(); ++pos) { os << *pos; if (pos + 1 != origin.end()) { os << ";"; } }; os << "] size["; PMVolume::SizeType size = volume.getSize(); for (PMVolume::SizeType::const_iterator pos = size.begin(); pos != size.end(); ++pos) { os << *pos; if (pos + 1 != size.end()) { os << ";"; } }; os << "]]"; return os; }; } // end namespace continuous } // end namespace core } // end namespace map \ No newline at end of file diff --git a/Code/Core/source/mapRegistrationBase.cpp b/Code/Core/source/mapRegistrationBase.cpp index a26abb0..c51825e 100644 --- a/Code/Core/source/mapRegistrationBase.cpp +++ b/Code/Core/source/mapRegistrationBase.cpp @@ -1,149 +1,148 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapRegistrationBase.h" #include "gdcmUIDGenerator.h" /*! @namespace map The namespace map::core is for the library of MatchPoint */ namespace map { namespace core { // **** protected methods **** // *************************** RegistrationBase:: RegistrationBase() { _tags.clear(); ensureRegistrationUID(); } RegistrationBase:: ~RegistrationBase() - { - } + = default; void RegistrationBase:: PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "MovingDimensions: " << this->getMovingDimensions() << std::endl; os << indent << "TargetDimensions: " << this->getTargetDimensions() << std::endl; // tags os << indent << "Registration tags: " << std::endl; TagMapType::const_iterator iter; iter = _tags.begin(); itk::Indent indent2 = indent.GetNextIndent(); while (iter != _tags.end()) { os << indent2 << iter -> first << ": " << iter -> second << std::endl; ++iter; } os << std::endl; } const RegistrationBase::TagMapType& RegistrationBase:: getTags() const { return _tags; } bool RegistrationBase:: getTagValue(const TagType& tag, ValueType& value) const { bool retval = false; TagMapType::const_iterator iter; iter = _tags.find(tag); if (iter != _tags.end()) // found one element { value = iter -> second; retval = true; } return retval; } void RegistrationBase:: setTagValues(const RegistrationBase::TagMapType& tags) { TagMapType tempTags = tags; ValueType uid = getRegistrationUID(); TagMapType::const_iterator iter; iter = tempTags.find(map::tags::RegistrationUID); if (iter == tempTags.end()) //found nothing { tempTags.insert(std::make_pair(map::tags::RegistrationUID, uid)); } _tags = tempTags; this->Modified(); }; RegistrationBase::TagMapType& RegistrationBase:: getTagValues() { return _tags; }; RegistrationBase::ValueType RegistrationBase:: getRegistrationUID() const { ValueType result; bool valid = getTagValue(tags::RegistrationUID, result); assert(valid); return result; }; void RegistrationBase:: ensureRegistrationUID() { String uid; if (!getTagValue(tags::RegistrationUID, uid)) { gdcm::UIDGenerator uidGenerator; uid = uidGenerator.Generate(); /*@TODO check how a prefix is defined, what the prefix for DKFZ would be to define a MatchPoint default prefix*/ //String prefix = String(MatchPoint_REGISTRATION_UID_PREFIX); _tags.insert(std::make_pair(tags::RegistrationUID, uid)); } }; - } -} + } // namespace core +} // namespace map diff --git a/Code/Core/source/mapRegistrationException.cpp b/Code/Core/source/mapRegistrationException.cpp index e584bf8..fc19fcd 100644 --- a/Code/Core/source/mapRegistrationException.cpp +++ b/Code/Core/source/mapRegistrationException.cpp @@ -1,50 +1,50 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapRegistrationException.h" namespace map { namespace core { RegistrationException::BaseExceptionType* RegistrationException:: - clone() const throw() + clone() const noexcept { - BaseExceptionType* pResult = 0; + BaseExceptionType* pResult = nullptr; try { pResult = new RegistrationException(this->GetFile() , this->GetLine() , this->GetDescription() , this->GetLocation()); } catch (...) { //no throw guarantee } return pResult; }; } // end namespace core } // end namespace map \ No newline at end of file diff --git a/Code/Core/source/mapRepresentationException.cpp b/Code/Core/source/mapRepresentationException.cpp index 74381d2..c9ae9f4 100644 --- a/Code/Core/source/mapRepresentationException.cpp +++ b/Code/Core/source/mapRepresentationException.cpp @@ -1,52 +1,52 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapRepresentationException.h" namespace map { namespace core { RepresentationException::BaseExceptionType* RepresentationException:: - clone() const throw() + clone() const noexcept { - BaseExceptionType* pResult = 0; + BaseExceptionType* pResult = nullptr; try { pResult = new RepresentationException(this->GetFile() , this->GetLine() , this->GetDescription() , this->GetLocation()); } catch (...) { //no throw guarantee } return pResult; }; mapDefineExceptionClassMacro(DimRepresentationException); } // end namespace core } // end namespace map \ No newline at end of file diff --git a/Code/Core/source/mapSDElement.cpp b/Code/Core/source/mapSDElement.cpp index cdf0ef7..f19ebca 100644 --- a/Code/Core/source/mapSDElement.cpp +++ b/Code/Core/source/mapSDElement.cpp @@ -1,457 +1,455 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapSDElement.h" #include "mapSDExceptions.h" namespace map { namespace structuredData { Element::SubElementIteratorType Element:: getSubElementBegin() { return _SubElements.begin(); }; Element::ConstSubElementIteratorType Element:: getSubElementBegin() const { return _SubElements.begin(); }; Element::SubElementIteratorType Element:: getSubElementEnd() { return _SubElements.end(); }; Element::ConstSubElementIteratorType Element:: getSubElementEnd() const { return _SubElements.end(); }; const Element::Self* Element:: getSubElement(SubElementIndexType index) const { if (index >= _SubElements.size()) { mapExceptionMacro(::map::core::OutOfRangeException, << "Error. Cannot get element. Passed index is out of sub elements vector range. Index: " << index << "; vector size: " << _SubElements.size()); } return _SubElements[index].GetPointer(); }; Element::Self* Element:: getSubElement(SubElementIndexType index) { if (index >= _SubElements.size()) { mapExceptionMacro(::map::core::OutOfRangeException, << "Error. Cannot get element. Passed index is out of sub elements vector range. Index: " << index << "; vector size: " << _SubElements.size()); } return _SubElements[index].GetPointer(); }; void Element:: removeSubElement(SubElementIndexType index) { if (index >= _SubElements.size()) { mapExceptionMacro(::map::core::OutOfRangeException, << "Error. Cannot remove element. Passed index is out of sub elements vector range. Index: " << index << "; vector size: " << _SubElements.size()); } _SubElements.erase(_SubElements.begin() + index); }; Element::SubElementIteratorType Element:: removeSubElement(SubElementIteratorType it) { return _SubElements.erase(it); }; /**Adds the passed sub element at the end of the sub element vector * @pre pNewElement must not be NULL * @param [in] pNewElement Pointer to the element that should be added * @return Index of the added element*/ Element::SubElementIndexType Element:: addSubElement(Self* pNewElement) { - if (!pNewElement) + if (pNewElement == nullptr) { mapDefaultExceptionMacro( << "Error. Cannot add new element. Passed element pointer is NULL."); } Pointer smp = pNewElement; _SubElements.push_back(smp); return _SubElements.size() - 1; }; Element::SubElementIteratorType Element:: insertSubElement(Self* pNewElement, SubElementIteratorType location) { - if (!pNewElement) + if (pNewElement == nullptr) { mapDefaultExceptionMacro( << "Error. Cannot insert new element. Passed element pointer is NULL."); } Pointer smp = pNewElement; return _SubElements.insert(location, smp); }; void Element:: insertSubElement(Self* pNewElement, SubElementIndexType location) { if (location >= _SubElements.size()) { mapExceptionMacro(::map::core::OutOfRangeException, << "Error. Cannot insert element. Passed index is out of sub elements vector range. Index: " << location << "; vector size: " << _SubElements.size()); } - if (!pNewElement) + if (pNewElement == nullptr) { mapDefaultExceptionMacro( << "Error. Cannot insert new element. Passed element pointer is NULL."); } Pointer smp = pNewElement; _SubElements.insert(_SubElements.begin() + location, smp); }; void Element:: resetSubElements() { _SubElements.clear(); }; Element::SubElementIndexType Element:: getSubElementsCount() const { return _SubElements.size(); }; //Attributes ////////////////////////////////////////////////////////////////// void Element:: resetAttributes() { _Attributes.clear(); }; bool Element:: removeAttribute(const core::String& name, bool recursively) { bool result = false; - AttributeMapType::iterator pos = _Attributes.find(name); + auto pos = _Attributes.find(name); if (pos != _Attributes.end()) { _Attributes.erase(pos); result = true; } if (recursively) { - for (SubElementVectorType::iterator pos = _SubElements.begin(); pos != _SubElements.end(); ++pos) + for (auto & _SubElement : _SubElements) { - bool subResult = (*pos)->removeAttribute(name, recursively); + bool subResult = _SubElement->removeAttribute(name, recursively); result = result || subResult; } } return result; }; bool Element:: setAttribute(const core::String& name, const core::String& value, bool recursively) { bool result = _Attributes.find(name) != _Attributes.end(); _Attributes[name] = value; if (recursively) { - for (SubElementVectorType::iterator pos = _SubElements.begin(); pos != _SubElements.end(); ++pos) + for (auto & _SubElement : _SubElements) { - bool subResult = (*pos)->setAttribute(name, value, recursively); + bool subResult = _SubElement->setAttribute(name, value, recursively); result = result || subResult; } } return result; }; const core::String& Element:: getAttribute(const core::String& name) const { - AttributeMapType::const_iterator pos = _Attributes.find(name); + auto pos = _Attributes.find(name); if (pos == _Attributes.end()) { mapExceptionMacro(::map::core::MissingIdentifierException, << "Error. Requested attribute does not exist. Attribute name: " << name); } return pos->second; }; bool Element:: attributeExists(const core::String& name) const { bool result = _Attributes.find(name) != _Attributes.end(); return result; }; /**Return the names of all existing attributes in a vector.*/ Element::AttributeNameVectorType Element:: getAttributeNames() const { AttributeNameVectorType names; - for (AttributeMapType::const_iterator pos = _Attributes.begin(); pos != _Attributes.end(); ++pos) + for (const auto & _Attribute : _Attributes) { - names.push_back(pos->first); + names.push_back(_Attribute.first); } return names; }; //All others ////////////////////////////////////////////////////////////////// const Element::TagType& Element:: getTag() const { return _Tag; }; void Element:: setTag(const TagType& tag) { _Tag = tag; }; const Element::ValueType& Element:: getValue() const { return _Value; }; void Element:: setValue(const ValueType& value) { _Value = value; }; void Element:: reset() { resetAttributes(); resetSubElements(); _Value = ""; }; Element:: Element() { _Tag = ""; reset(); }; Element:: ~Element() - { - }; + = default; Element::Pointer Element:: createElement(const TagType& tag, const ValueType& value) { Pointer smpNew = Self::New(); smpNew->setTag(tag); smpNew->setValue(value); return smpNew; }; Element::Pointer Element:: clone() const { Pointer spNew = Self::New(); spNew->setTag(_Tag); spNew->setValue(_Value); //attributes - for (AttributeMapType::const_iterator pos = _Attributes.begin(); pos != _Attributes.end(); ++pos) + for (const auto & _Attribute : _Attributes) { - spNew->setAttribute(pos->first, pos->second); + spNew->setAttribute(_Attribute.first, _Attribute.second); } //sub elements - for (SubElementVectorType::const_iterator pos = _SubElements.begin(); pos != _SubElements.end(); - ++pos) + for (const auto & _SubElement : _SubElements) { - spNew->addSubElement((*pos)->clone()); + spNew->addSubElement(_SubElement->clone()); } return spNew; }; void Element:: PrintSelf(std::ostream& os, ::itk::Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "Tag: " << _Tag << std::endl; os << indent << "Value: " << _Value << std::endl; os << indent << "Attributes: (" << _Attributes.size() << ")" << std::endl; ::itk::Indent indent2 = indent.GetNextIndent(); - for (AttributeMapType::const_iterator pos = _Attributes.begin(); pos != _Attributes.end(); ++pos) + for (const auto & _Attribute : _Attributes) { - os << indent2 << pos->first << " = '" << pos->second << "'" << std::endl; + os << indent2 << _Attribute.first << " = '" << _Attribute.second << "'" << std::endl; } os << indent << "Sub elements: (" << _SubElements.size() << ")" << std::endl; }; std::ostream& operator<<(std::ostream& os, const Element& element) { element.Print(os); return os; }; structuredData::Element::SubElementIteratorType findNextSubElement(const structuredData::Element::SubElementIteratorType& beginPos, const structuredData::Element::SubElementIteratorType& endPos, const core::String& tag, const core::String& attrName, const core::String& attrValue) { structuredData::Element::SubElementIteratorType result = endPos; structuredData::Element::SubElementIteratorType current = beginPos; for (; current != endPos; ++current) { if ((*current)->getTag() == tag) { if (attrName.empty()) { result = current; break; } - else - { + + if ((*current)->attributeExists(attrName)) { if ((*current)->getAttribute(attrName) == attrValue) { result = current; break; } } - } + } } return result; }; structuredData::Element::ConstSubElementIteratorType findNextSubElement( const structuredData::Element::ConstSubElementIteratorType& beginPos, const structuredData::Element::ConstSubElementIteratorType& endPos, const core::String& tag, const core::String& attrName, const core::String& attrValue) { structuredData::Element::ConstSubElementIteratorType result = endPos; structuredData::Element::ConstSubElementIteratorType current = beginPos; for (; current != endPos; ++current) { if ((*current)->getTag() == tag) { if (attrName.empty()) { result = current; break; } - else - { + + if ((*current)->attributeExists(attrName)) { if ((*current)->getAttribute(attrName) == attrValue) { result = current; break; } } - } + } } return result; } } //end of namespace structuredData } //end of namespace map diff --git a/Code/Core/source/mapSDExceptions.cpp b/Code/Core/source/mapSDExceptions.cpp index 6bf9fe3..b2c4ff4 100644 --- a/Code/Core/source/mapSDExceptions.cpp +++ b/Code/Core/source/mapSDExceptions.cpp @@ -1,177 +1,177 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapSDExceptions.h" namespace map { namespace core { //////////////////////////////////////////////////////////////////////// /// Implementation of map::MissingIdentifierException ////////////////// //////////////////////////////////////////////////////////////////////// MissingIdentifierException:: - MissingIdentifierException() : Superclass() + MissingIdentifierException() {}; MissingIdentifierException:: MissingIdentifierException(const String& file, unsigned int lineNumber) : Superclass(file, lineNumber) {} ; MissingIdentifierException:: MissingIdentifierException(const String& file, unsigned int lineNumber, const String& desc, const String& loc) : Superclass(file, lineNumber, desc, loc) {}; MissingIdentifierException:: - ~MissingIdentifierException() throw() - {}; + ~MissingIdentifierException() noexcept + = default; MissingIdentifierException::BaseExceptionType* MissingIdentifierException:: - clone() const throw() + clone() const noexcept { - BaseExceptionType* pResult = 0; + BaseExceptionType* pResult = nullptr; try { pResult = new MissingIdentifierException(this->GetFile() , this->GetLine() , this->GetDescription() , this->GetLocation()); } catch (...) { //no throw guarantee } return pResult; }; std::ostream& operator<<(std::ostream& os, const MissingIdentifierException& exception) { exception.Print(os); return os; }; //////////////////////////////////////////////////////////////////////// /// Implementation of map::OutOfRangeException ////////////////// //////////////////////////////////////////////////////////////////////// OutOfRangeException:: - OutOfRangeException() : Superclass() + OutOfRangeException() {}; OutOfRangeException:: OutOfRangeException(const String& file, unsigned int lineNumber) : Superclass(file, lineNumber) {} ; OutOfRangeException:: OutOfRangeException(const String& file, unsigned int lineNumber, const String& desc, const String& loc) : Superclass(file, lineNumber, desc, loc) {}; OutOfRangeException:: - ~OutOfRangeException() throw() - {}; + ~OutOfRangeException() noexcept + = default; OutOfRangeException::BaseExceptionType* OutOfRangeException:: - clone() const throw() + clone() const noexcept { - BaseExceptionType* pResult = 0; + BaseExceptionType* pResult = nullptr; try { pResult = new OutOfRangeException(this->GetFile() , this->GetLine() , this->GetDescription() , this->GetLocation()); } catch (...) { //no throw guarantee } return pResult; }; std::ostream& operator<<(std::ostream& os, const OutOfRangeException& exception) { exception.Print(os); return os; }; //////////////////////////////////////////////////////////////////////// /// Implementation of map::SDStreamingException ////////////////// //////////////////////////////////////////////////////////////////////// SDStreamingException:: - SDStreamingException() : Superclass() + SDStreamingException() {}; SDStreamingException:: SDStreamingException(const String& file, unsigned int lineNumber) : Superclass(file, lineNumber) {} ; SDStreamingException:: SDStreamingException(const String& file, unsigned int lineNumber, const String& desc, const String& loc) : Superclass(file, lineNumber, desc, loc) {}; SDStreamingException:: - ~SDStreamingException() throw() - {}; + ~SDStreamingException() noexcept + = default; SDStreamingException::BaseExceptionType* SDStreamingException:: - clone() const throw() + clone() const noexcept { - BaseExceptionType* pResult = 0; + BaseExceptionType* pResult = nullptr; try { pResult = new SDStreamingException(this->GetFile() , this->GetLine() , this->GetDescription() , this->GetLocation()); } catch (...) { //no throw guarantee } return pResult; }; std::ostream& operator<<(std::ostream& os, const SDStreamingException& exception) { exception.Print(os); return os; }; } //end of namespace core } //end of namespace map diff --git a/Code/Core/source/mapSDStreamingInterface.cpp b/Code/Core/source/mapSDStreamingInterface.cpp index a6c9b03..671804a 100644 --- a/Code/Core/source/mapSDStreamingInterface.cpp +++ b/Code/Core/source/mapSDStreamingInterface.cpp @@ -1,61 +1,61 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapSDStreamingInterface.h" #include "mapExceptionObjectMacros.h" namespace map { namespace structuredData { StreamingInterface::ElementPointer StreamingInterface:: streamToStructuredData() const { return this->streamToSDInternal(); }; void StreamingInterface:: streamFromStructuredData(const Element* pElement) { - if (!pElement) + if (pElement == nullptr) { mapDefaultExceptionStaticMacro( << "Error. Cannot stream from StructuredData element. Passed element pointer is NULL."); } this->streamFromSDInternal(pElement); }; StreamingInterface:: - StreamingInterface() {}; + StreamingInterface() = default; StreamingInterface:: - ~StreamingInterface() {}; + ~StreamingInterface() = default; } //end of namespace structuredData } //end of namespace map diff --git a/Code/Core/source/mapSDXMLFileReader.cpp b/Code/Core/source/mapSDXMLFileReader.cpp index 3ba5fe9..cbe0a45 100644 --- a/Code/Core/source/mapSDXMLFileReader.cpp +++ b/Code/Core/source/mapSDXMLFileReader.cpp @@ -1,143 +1,142 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include #include -#include +#include #include "itksys/SystemTools.hxx" #include "mapSDXMLStrReader.h" #include "mapSDXMLFileReader.h" #include "mapSDExceptions.h" #include "mapSDTags.h" namespace map { namespace structuredData { XMLFileReader::ElementPointer XMLFileReader:: read(const core::String& filePath) { ElementPointer spResult = nullptr; std::ifstream file; std::ios_base::openmode iOpenFlag = std::ios_base::in; file.open(filePath.c_str(), iOpenFlag); if (!file.is_open()) { mapDefaultExceptionMacro( << "Cannot open or create specified file to load. File path: " << filePath); } ::map::core::String data; bool hasError = false; - std::streamsize filesize = itksys::SystemTools::FileLength(filePath.c_str()); + std::streamsize filesize = itksys::SystemTools::FileLength(filePath); char* buffer = new char [filesize]; try { file.read(buffer, filesize); std::streamsize gsize = file.gcount(); data.insert(0, buffer, gsize); } catch (...) { hasError = true; } delete[] buffer; file.close(); if (hasError) { mapDefaultExceptionMacro( << "Error while reading file content into buffer. File path:" << filePath); } XMLStrReader::Pointer spStrReader = XMLStrReader::New(); spResult = spStrReader->read(data); spResult->setAttribute(tags::SDInternalSourceReader, tags::SDInternalSourceReader_file, true); spResult->setAttribute(tags::SDInternalSourceURI, filePath, true); _spRoot = spResult; return spResult; }; void XMLFileReader:: read(const core::String& filePath, StreamingInterface* pInterface) { - if (!pInterface) + if (pInterface == nullptr) { mapDefaultExceptionMacro( << "Error, cannot read passed object from xml file. Passed interface is NULL."); } read(filePath); pInterface->streamFromStructuredData(getXMLContent()); }; XMLFileReader::ElementPointer XMLFileReader:: getXMLContent() { ElementPointer spResult = nullptr; if (_spRoot.IsNotNull()) { if (_spRoot->getSubElementsCount() > 0) { spResult = _spRoot->getSubElement(0); } } return spResult; }; XMLFileReader:: XMLFileReader() { - _spRoot = NULL; + _spRoot = nullptr; }; XMLFileReader:: ~XMLFileReader() - { - }; + = default; } //end of namespace structuredData } //end of namespace map diff --git a/Code/Core/source/mapSDXMLFileWriter.cpp b/Code/Core/source/mapSDXMLFileWriter.cpp index c19c29f..a74fe6b 100644 --- a/Code/Core/source/mapSDXMLFileWriter.cpp +++ b/Code/Core/source/mapSDXMLFileWriter.cpp @@ -1,112 +1,111 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapSDXMLFileWriter.h" #include "mapSDXMLStrWriter.h" #include "mapSDExceptions.h" namespace map { namespace structuredData { void XMLFileWriter:: setXSLTFile(const core::String& file) { this->_XSLTFile = file; }; ::map::core::String XMLFileWriter:: getXSLTFile() const { return this->_XSLTFile; }; void XMLFileWriter:: write(const core::String& filePath, const Element* pElement) { - if (!pElement) + if (pElement == nullptr) { mapDefaultExceptionMacro( << "Error, cannot write passed StructuredData element to an xml file. Passed element is NULL."); } XMLIntendedStrWriter::Pointer spStrWriter = XMLIntendedStrWriter::New(); ::map::core::String savedStr = spStrWriter->write(pElement); std::ofstream file; std::ios_base::openmode iOpenFlag = std::ios_base::out | std::ios_base::trunc; file.open(filePath.c_str(), iOpenFlag); if (!file.is_open()) { mapDefaultExceptionMacro( << "Cannot open or create specified file to save. File path: " << filePath); } - file << "\n"; + file << R"(\n"; if (!_XSLTFile.empty()) { - file << "\n"; + file << R"(\n"; } file << savedStr; file.close(); }; void XMLFileWriter:: write(const core::String& filePath, const StreamingInterface* pInterface) { - if (!pInterface) + if (pInterface == nullptr) { mapDefaultExceptionMacro( << "Error, cannot write passed object to an xml file. Passed interface is NULL."); } ElementPointer spData = pInterface->streamToStructuredData(); this->write(filePath, spData); }; XMLFileWriter:: XMLFileWriter() { this->_XSLTFile = ""; this->_EncodingType = "ISO-8859-1"; }; XMLFileWriter:: ~XMLFileWriter() - { - }; + = default; } //end of namespace structuredData } //end of namespace map diff --git a/Code/Core/source/mapSDXMLStrReader.cpp b/Code/Core/source/mapSDXMLStrReader.cpp index ed89d25..92be951 100644 --- a/Code/Core/source/mapSDXMLStrReader.cpp +++ b/Code/Core/source/mapSDXMLStrReader.cpp @@ -1,415 +1,413 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "expat.h" #include #include #include -#include +#include #include "mapSDXMLStrReader.h" #include "mapSDExceptions.h" #include "mapSDTags.h" namespace map { namespace structuredData { ::map::core::String decodeForXmlChar(const core::String& sSrc, const core::String& searchStr, const core::String& newStr) { ::map::core::String sRet = sSrc; ::map::core::String::size_type pos = sRet.find(searchStr); while (pos != core::String::npos) { sRet.erase(pos, searchStr.size()); sRet.insert(pos, newStr); } return sRet; } ::map::core::String decodeForXml(const core::String& sSrc) { ::map::core::String sRet = decodeForXmlChar(sSrc, "'", "\'"); sRet = decodeForXmlChar(sRet, """, "\""); sRet = decodeForXmlChar(sRet, ">", ">"); sRet = decodeForXmlChar(sRet, "<", "<'"); sRet = decodeForXmlChar(sRet, "&", "&"); return sRet; } //////////////////////////////////////////////////////////////////////// /// Implementation of map::XMLStrReaderImpl /////////////////////////// //////////////////////////////////////////////////////////////////////// /** @class XMLStrReaderImpl * @brief Private implementation of the XMLStrReader. * * This class does the real work of XMLStrReader as non public implementation * to cover the internals like the use of expat. * The concept of the class has been designed for the requirements in free * and has been motivated by the wish using present resources of itk and introduce as * less as possible third-party libraries. * * @ingroup XML */ class XMLStrReaderImpl { public: virtual const char* GetNameOfClass() const { return "XMLStrReaderImpl"; }; typedef std::pair< ::map::core::String, core::String> AttributeType; typedef std::map< ::map::core::String, core::String> AttributesType; //uses vector for saving, to avoid automatic sort feature of stl::map - typedef std::vector AttributesSaveListType; + using AttributesSaveListType = std::vector; - typedef Element::Pointer ElementPointer; + using ElementPointer = Element::Pointer; /** Function to load a structure from a xml string. The function creates * an expat parser, manages the callbacks, calls Reset() and ResetRequirements(). * To control the loading process, the function SubElementLoadProcessing() should be * overridden. When the loading is finished, it will be checked, if the requirements * are meet, the expat resources will be freed. * @param [in] rsData Reference to the whole data of the xml element (with start and end tag and attributes)*/ - ElementPointer LoadFromString(const core::String& rsData); + ElementPointer LoadFromString(const core::String& rsRawData); /** Resets the object to default/initial state*/ void Reset(); /** Default constructor */ XMLStrReaderImpl(); /** destructor */ ~XMLStrReaderImpl(); protected: /** Function is called by LoadFromXMLString() to handle the Attributes contained by the xml string * for the passed SD element. * @param [in] pElement Pointer to the element that should get the attributes set. * @param [in] rAttributes Reference to a stl map with the attributes of the element.*/ static void AttributesLoadProcessing(Element* pElement, const AttributesType& rAttributes); static void CB_Static_StartElement(void* parser, const char* name, const char** pAttributes); static void CB_Static_EndElement(void* parser, const char* name); static void CB_Static_CharacterDataHandler(void* parser, const char* data, int length); /** Callback function -- called from XML parser when starting tag * encountered */ void CB_StartElement(const char* name, const char** pAttributes); /** Callback function -- called from XML parser when ending tag * encountered */ void CB_EndElement(const char* name); /** Callback function -- called from XML parser with the character data * for a XML element */ void CB_CharacterDataHandler(const char* inData, int inLength); /** Function adds the content of m_currentElementText to the Value of the passed element. * @param [in] pElement Pointer to the element that should get the content of m_currentElementText.*/ void TransferCurrentText(Element* pElement); /** Converts the attribute structure passed by expat to a stl string map.*/ static AttributesType ConvertExpatAttrToMap(const char** pAttributes); /** pointer to the data string passed with ReadString*/ const core::String* m_pLoadData; ElementPointer m_spRootElement; - typedef std::deque ElementStackType; + using ElementStackType = std::deque; /**Stack of all structured data element that are open right now. Therefor had * an start tag but no stop tag yet. An element is added to the stack when its * xml start tag occures and is removed if the proper end tag is found.*/ ElementStackType m_stack; /**String containing all data received by CB_CharacterDataHandler * it will used to set the current element's value.*/ ::map::core::String m_currentElementText; /** Pointer to the expat parser*/ XML_Parser m_Parser; }; void XMLStrReaderImpl:: CB_Static_StartElement(void* parser, const char* name, const char** pAttributes) { // Begin element handler that is registered with the XML_Parser. // This just casts the user data to an XMLStrReaderImpl and calls // StartElement. static_cast(parser)->CB_StartElement(name, pAttributes); } void XMLStrReaderImpl:: CB_Static_EndElement(void* parser, const char* name) { // End element handler that is registered with the XML_Parser. This // just casts the user data to an XMLStrReaderImpl and calls EndElement. static_cast(parser)->CB_EndElement(name); } void XMLStrReaderImpl:: CB_Static_CharacterDataHandler(void* parser, const char* data, int length) { // Character data handler that is registered with the XML_Parser. // This just casts the user data to an XMLStrReaderImpl and calls // CharacterDataHandler. static_cast(parser)->CB_CharacterDataHandler(data, length); } XMLStrReaderImpl::ElementPointer XMLStrReaderImpl:: LoadFromString(const core::String& rsRawData) { Reset(); - m_Parser = XML_ParserCreate(0); + m_Parser = XML_ParserCreate(nullptr); XML_SetElementHandler(m_Parser, &CB_Static_StartElement, &CB_Static_EndElement); XML_SetCharacterDataHandler(m_Parser, &CB_Static_CharacterDataHandler); XML_SetUserData(m_Parser, this); m_pLoadData = &rsRawData; m_spRootElement = Element::createElement("ROOT", ""); m_stack.push_back(m_spRootElement); - bool result = XML_Parse(m_Parser, m_pLoadData->c_str(), m_pLoadData->size(), true); + bool result = XML_Parse(m_Parser, m_pLoadData->c_str(), m_pLoadData->size(), 1); if (!result) { ::map::core::String errorMsg(XML_ErrorString(XML_GetErrorCode(m_Parser))); mapDefaultExceptionMacro( << "Expat error while parsing raw string. Error: " << errorMsg << "; Error position: " << XML_GetCurrentLineNumber(m_Parser) << ":" << XML_GetCurrentColumnNumber( m_Parser)); } ElementPointer spResult = m_spRootElement; Reset(); return spResult; }; void XMLStrReaderImpl:: CB_StartElement(const char* name, const char** pAttributes) { ElementPointer spNewElement = Element::createElement(::map::core::String(name), ""); m_stack.back()->addSubElement(spNewElement); //any data yet stored in m_CurrentElementText should now be stored to //the current last element in stack, befor pushing the new one. TransferCurrentText(m_stack.back()); m_stack.push_back(spNewElement); //set attributes AttributesLoadProcessing(spNewElement, ConvertExpatAttrToMap(pAttributes)); }; void XMLStrReaderImpl:: CB_EndElement(const char* name) { if (::map::core::String(name) != m_stack.back()->getTag()) { mapDefaultExceptionMacro( << "Error. XML structure seems not to be correct. XML tags seem to be mingeld end tag does not fit the last start tag. Start tag: " << m_stack.back()->getTag() << "; end tag: " << name); } if (m_stack.size() < 2) { mapDefaultExceptionMacro( << "Error. XML structure seems not to be correct. End tag found, but no top level element was started. End tag: " << name); } //any data yet stored in m_CurrentElementText should now be stored to //the current last element in stack, befor element is "popped". TransferCurrentText(m_stack.back()); m_stack.pop_back(); }; void XMLStrReaderImpl:: CB_CharacterDataHandler(const char* inData, int inLength) { m_currentElementText.append(inData, inLength); }; void XMLStrReaderImpl:: TransferCurrentText(Element* pElement) { assert(pElement); pElement->setValue(pElement->getValue() + decodeForXml(m_currentElementText)); m_currentElementText.clear(); }; XMLStrReaderImpl:: XMLStrReaderImpl() { - m_Parser = NULL; + m_Parser = nullptr; Reset(); }; XMLStrReaderImpl:: ~XMLStrReaderImpl() { Reset(); }; void XMLStrReaderImpl:: AttributesLoadProcessing(Element* pElement, const AttributesType& attributes) { - for (AttributesType::const_iterator pos = attributes.begin(); pos != attributes.end(); ++pos) + for (const auto & attribute : attributes) { - pElement->setAttribute(pos->first, pos->second); + pElement->setAttribute(attribute.first, attribute.second); } }; void XMLStrReaderImpl:: Reset() { m_stack.clear(); - m_spRootElement = NULL; - m_pLoadData = NULL; + m_spRootElement = nullptr; + m_pLoadData = nullptr; m_currentElementText.clear(); - if (m_Parser) + if (m_Parser != nullptr) { XML_ParserFree(m_Parser); - m_Parser = NULL; + m_Parser = nullptr; } }; XMLStrReaderImpl::AttributesType XMLStrReaderImpl:: ConvertExpatAttrToMap(const char** pAttributes) { AttributesType attrs; const char** pActAttr = pAttributes; - while (*pActAttr) + while (*pActAttr != nullptr) { ::map::core::String sKey = *pActAttr; pActAttr++; ::map::core::String sValue = *pActAttr; pActAttr++; attrs.insert(AttributeType(sKey, sValue)); }; return attrs; }; //////////////////////////////////////////////////////////////////////// /// Implementation of FREE::XMLStrReader /////////////////////////////// //////////////////////////////////////////////////////////////////////// XMLStrReader::ElementPointer XMLStrReader:: read(const XMLRawDataType& data) { XMLStrReaderImpl implementation; ElementPointer spResult = nullptr; spResult = implementation.LoadFromString(data); - if (spResult) + if (spResult != nullptr) { spResult->setAttribute(tags::SDInternalSourceReader, tags::SDInternalSourceReader_string, true); spResult->setAttribute(tags::SDInternalSourceFormat, tags::SDInternalSourceFormat_xml, true); } return spResult; }; XMLStrReader::ElementPointer XMLStrReader:: readXMLContent(const XMLRawDataType& data) { XMLStrReaderImpl implementation; ElementPointer spResult = nullptr; spResult = implementation.LoadFromString(data); if (spResult->getSubElementsCount() < 1) { mapDefaultExceptionMacro( << "Error. String does not contain any xml elements. String: " << data); } spResult = spResult->getSubElement(0); spResult->setAttribute(tags::SDInternalSourceReader, tags::SDInternalSourceReader_string, true); spResult->setAttribute(tags::SDInternalSourceFormat, tags::SDInternalSourceFormat_xml, true); return spResult; }; XMLStrReader:: XMLStrReader() - { - }; + = default; XMLStrReader:: ~XMLStrReader() - { - }; + = default; } //end of namespace structuredData -} //end of namespace free +} // namespace map diff --git a/Code/Core/source/mapSDXMLStrWriter.cpp b/Code/Core/source/mapSDXMLStrWriter.cpp index fce7f66..6c01224 100644 --- a/Code/Core/source/mapSDXMLStrWriter.cpp +++ b/Code/Core/source/mapSDXMLStrWriter.cpp @@ -1,256 +1,252 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapSDXMLStrWriter.h" #include "mapExceptionObjectMacros.h" #include "itkIndent.h" -#include +#include namespace map { namespace structuredData { ::map::core::String encodeForXml(const core::String& sSrc) { ::map::core::OStringStream sRet; - for (::map::core::String::const_iterator iter = sSrc.begin(); iter != sSrc.end(); iter++) + for (std::_String_const_iterator > >::value_type iter : sSrc) { - unsigned char c = (unsigned char) * iter; + auto c = static_cast(iter); switch (c) { case '&': sRet << "&"; break; case '<': sRet << "<"; break; case '>': sRet << ">"; break; case '"': sRet << """; break; case '\'': sRet << "'"; break; default: if (c < 32 || c > 127) { - sRet << "&#" << (unsigned int)c << ";"; + sRet << "&#" << static_cast(c) << ";"; } else { sRet << c; } } } return sRet.str(); } ::map::core::String XMLStrWriter:: write(const Element* pElement) const { - if (!pElement) + if (pElement == nullptr) { mapDefaultExceptionMacro( << "Error. Cannot convert structured element to string. Passed element pointer is NULL."); } ElementLevelType level = 0; ::map::core::String result = writeElement(pElement, level); return result; }; ::map::core::String XMLStrWriter:: writeElement(const Element* pElement, const ElementLevelType& level) const { assert(pElement); ::map::core::OStringStream stream; bool isEmptyElement = (pElement->getSubElementsCount() == 0) && pElement->getValue().empty(); ::map::core::String attributes = writeAttributes(pElement, level); stream << "<" << pElement->getTag(); if (!attributes.empty()) { stream << " " << attributes; } if (isEmptyElement) { stream << "/>"; } else { stream << ">"; stream << encodeForXml(pElement->getValue()) << writeSubElements(pElement, level); stream << "getTag() << ">"; } return stream.str(); }; ::map::core::String XMLStrWriter:: writeAttributes(const Element* pElement, const ElementLevelType& level) const { assert(pElement); ::map::core::OStringStream stream; Element::AttributeNameVectorType attributes = pElement->getAttributeNames(); bool firstLoop = true; for (Element::AttributeNameVectorType::const_iterator pos = attributes.begin(); pos != attributes.end(); ++pos) { if (pos->find("sdInternal:") != 0) { if (firstLoop) { firstLoop = false; } else { stream << " "; } stream << *pos << "='" << encodeForXml(pElement->getAttribute(*pos)) << "'"; } } return stream.str(); }; ::map::core::String XMLStrWriter:: writeSubElements(const Element* pElement, const ElementLevelType& level) const { assert(pElement); ::map::core::String result; ::map::core::OStringStream stream; ElementLevelType sublevel = level + 1; - for (Element::ConstSubElementIteratorType pos = pElement->getSubElementBegin(); + for (auto pos = pElement->getSubElementBegin(); pos != pElement->getSubElementEnd(); ++pos) { stream << writeElement(*pos, sublevel); } result = stream.str(); return result; }; XMLStrWriter:: XMLStrWriter() - { - }; + = default; XMLStrWriter:: ~XMLStrWriter() - { - }; + = default; ::map::core::String XMLIntendedStrWriter:: writeElement(const Element* pElement, const ElementLevelType& level) const { assert(pElement); ::itk::Indent indent(2 * level); ::map::core::OStringStream stream; bool isEmptyElement = (pElement->getSubElementsCount() == 0) && pElement->getValue().empty(); ::map::core::String attributes = writeAttributes(pElement, level); stream << indent << "<" << pElement->getTag(); if (!attributes.empty()) { stream << " " << attributes; } if (isEmptyElement) { stream << "/>"; } else { stream << ">" << encodeForXml(pElement->getValue()); if (pElement->getSubElementsCount() > 0) { stream << std::endl << writeSubElements(pElement, level) << indent; } stream << "getTag() << ">"; } stream << std::endl; return stream.str(); }; XMLIntendedStrWriter:: XMLIntendedStrWriter() - { - }; + = default; XMLIntendedStrWriter:: ~XMLIntendedStrWriter() - { - }; + = default; } //end of namespace structuredData } //end of namespace map diff --git a/Code/Core/source/mapServiceException.cpp b/Code/Core/source/mapServiceException.cpp index dd38c77..395d189 100644 --- a/Code/Core/source/mapServiceException.cpp +++ b/Code/Core/source/mapServiceException.cpp @@ -1,50 +1,50 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapServiceException.h" namespace map { namespace core { ServiceException::BaseExceptionType* ServiceException:: - clone() const throw() + clone() const noexcept { - BaseExceptionType* pResult = 0; + BaseExceptionType* pResult = nullptr; try { pResult = new ServiceException(this->GetFile() , this->GetLine() , this->GetDescription() , this->GetLocation()); } catch (...) { //no throw guarantee } return pResult; }; } // end namespace core } // end namespace map \ No newline at end of file diff --git a/Code/Core/source/mapSyncObject.cpp b/Code/Core/source/mapSyncObject.cpp index 2d507c6..d517b34 100644 --- a/Code/Core/source/mapSyncObject.cpp +++ b/Code/Core/source/mapSyncObject.cpp @@ -1,39 +1,39 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapSyncObject.h" #include "mapExceptionObject.h" namespace map { namespace deployment { SyncObject::SyncObject() - {}; + = default; SyncObject::~SyncObject() - {}; + = default; } // end namespace deployment } // end namespace map \ No newline at end of file diff --git a/Code/Core/source/mapThreadEvents.cpp b/Code/Core/source/mapThreadEvents.cpp index c54c14e..e64b665 100644 --- a/Code/Core/source/mapThreadEvents.cpp +++ b/Code/Core/source/mapThreadEvents.cpp @@ -1,93 +1,93 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapThreadEvents.h" namespace map { namespace core { const ThreadEventObject::ThreadIDType ThreadEventObject::anyThreadID = -1; ThreadEventObject:: ThreadEventObject(ThreadIDType threadID, void* pData, const std::string& comment): Superclass(pData, comment), _threadID(threadID) {}; ThreadEventObject:: - ~ThreadEventObject() {}; + ~ThreadEventObject() = default; ThreadEventObject::ThreadIDType ThreadEventObject:: getThreadID() const { return _threadID; }; const char* ThreadEventObject:: GetEventName() const { return "map::ThreadEventObject"; }; bool ThreadEventObject:: CheckEvent(const ::itk::EventObject* e) const { const Self* pE = dynamic_cast(e); bool result = false; - if (pE) + if (pE != nullptr) { result = (this->_threadID == anyThreadID) || (pE->getThreadID() == this->_threadID); } return result; } ::itk::EventObject* ThreadEventObject:: MakeObject() const { return new ThreadEventObject(*this); } ThreadEventObject:: ThreadEventObject(const Self& s) : Superclass(s) { _threadID = s.getThreadID(); }; void ThreadEventObject:: Print(std::ostream& os) const { Superclass::Print(os); os << "Thread ID: " << _threadID << std::endl; }; - } -} \ No newline at end of file + } // namespace core +} // namespace map \ No newline at end of file diff --git a/Code/Deployment/include/mapCheckDLLInterfaceVersion.h b/Code/Deployment/include/mapCheckDLLInterfaceVersion.h index 11f6e8e..e0eaed4 100644 --- a/Code/Deployment/include/mapCheckDLLInterfaceVersion.h +++ b/Code/Deployment/include/mapCheckDLLInterfaceVersion.h @@ -1,47 +1,47 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_CHECK_DLL_INTERFACE_VERSION_H #define __MAP_CHECK_DLL_INTERFACE_VERSION_H #include "mapMacros.h" #include "mapMAPDeploymentExports.h" namespace map { namespace deployment { /*! @brief Checks if a passed verion is consistent with the dll interface version of the current binaries. * This function is used by dll managment code to check back if they can handle the interface of a DLL * (which might have been builded with other binaries and therfore an other DLL interface version). * @remark Normaly you just have to include mapGetDLLInterfaceVersion.cpp to your project for adding * @return Indicates of the interface version indicated by the passed values can be legaly used. * True: Interface can be used. False: Interface cannot be used and is not consistent with the current interface * version. * @ingroup Deployment */ MAPDeployment_EXPORT bool checkDLLInterfaceVersion(unsigned int& major, unsigned int& minor); - } -} + } // namespace deployment +} // namespace map #endif diff --git a/Code/Deployment/include/mapDeploymentDLLAccess.h b/Code/Deployment/include/mapDeploymentDLLAccess.h index 9acd339..8edb743 100644 --- a/Code/Deployment/include/mapDeploymentDLLAccess.h +++ b/Code/Deployment/include/mapDeploymentDLLAccess.h @@ -1,161 +1,156 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_DEPLOYMENT_DLL_ACCESS_H #define __MAP_DEPLOYMENT_DLL_ACCESS_H #include "mapDeploymentDLLHandle.h" #include "mapRegistrationAlgorithmBase.h" #include "mapDeploymentExceptions.h" #include "mapDeploymentSync.h" namespace map { namespace deployment { /** * Function pointer for the mapGetDLLInterfaceVersion symbol in a deployment DLL. * @sa mapGetDLLInterfaceVersion * @ingroup DeployHost */ - typedef void (* MAP_GET_DLL_INTERFACE_VERSION_FUNCTION_POINTER)(unsigned int& major, - unsigned int& minor); + using MAP_GET_DLL_INTERFACE_VERSION_FUNCTION_POINTER = void (*)(unsigned int &, unsigned int &); /** * Function pointer for the mapGetRegistrationAlgorithmUID symbol in a deployment DLL. * @sa mapGetRegistrationAlgorithmUID * @ingroup DeployHost */ - typedef void (* MAP_GET_REGISTRATION_ALGORITHM_UID_FUNCTION_POINTER)(map::algorithm::UID::Pointer& - spUID); + using MAP_GET_REGISTRATION_ALGORITHM_UID_FUNCTION_POINTER = void (*)(map::algorithm::UID::Pointer &); /** * Function pointer for the mapGetRegistrationAlgorithmUID symbol in a deployment DLL. * @sa mapGetRegistrationAlgorithmUID * @ingroup DeployHost */ - typedef void (* MAP_GET_REGISTRATION_ALGORITHM_PROFILE_FUNCTION_POINTER)( - const map::core::String& profile); + using MAP_GET_REGISTRATION_ALGORITHM_PROFILE_FUNCTION_POINTER = void (*)(const map::core::String &); /** * Function pointer for the mapGetRegistrationAlgorithmInstance symbol in a deployment DLL. * @sa mapGetRegistrationAlgorithmInstance * @ingroup DeployHost */ - typedef void (* MAP_GET_REGISTRATION_ALGORITHM_INSTANCE_FUNCTION_POINTER)( - map::algorithm::RegistrationAlgorithmBase::Pointer& spAlgorithmBase, - map::deployment::SyncObject* pSyncObject); + using MAP_GET_REGISTRATION_ALGORITHM_INSTANCE_FUNCTION_POINTER = void (*)(map::algorithm::RegistrationAlgorithmBase::Pointer &, map::deployment::SyncObject *); - typedef map::algorithm::RegistrationAlgorithmBase RegistrationAlgorithmBase; - typedef RegistrationAlgorithmBase::Pointer RegistrationAlgorithmBasePointer; + using RegistrationAlgorithmBase = map::algorithm::RegistrationAlgorithmBase; + using RegistrationAlgorithmBasePointer = RegistrationAlgorithmBase::Pointer; /*! Method tries to open the passed file as dll, checks for the interface version and * compiles all information needed for a representing DLL information instance. * @ingroup DeployHost * @pre libraryFile must not be NULL * @eguarantee strong * @exception InvalidDLLException Thrown if file was not found, file is not a DLL or cannot be loaded. * @exception MissingSymbolException Thrown if DLL misses any symbols. * @exception InvalidInterfaceVersionException Thrown if the DLL has not a supported interface version. * @exception InvalidUIDException Thrown if the DLL returns no (valid) UID instance. */ MAPDeployment_EXPORT DLLHandle::Pointer openDeploymentDLL(const char* libraryFile); MAPDeployment_EXPORT DLLHandle::Pointer openDeploymentDLL(const core::String& libraryFile); /*! Method tries to close the DLL specified by the passed info instance. * @ingroup DeployHost * @pre pDLLHandle must not be NULL * @eguarantee strong * @exception InvalidDLLException Thrown if DLL cannot be closed. */ MAPDeployment_EXPORT void closeDeploymentDLL(const DLLHandle* pDLLHandle); /*! Method tries to open the passed file (using openDeploymentDLL()), retrieves the UID of * the algorithm stored in the DLL and closes the DLL again (using closeDeploymentDLL()). * @ingroup DeployHost * @pre libraryFile must not be NULL * @eguarantee strong * @exception InvalidDLLException Thrown if file was not found, file is not a DLL, cannot be loaded or closed. * @exception MissingSymbolException Thrown if DLL misses any symbols. * @exception InvalidInterfaceVersionException Thrown if the DLL has not a supported interface version. * @exception InvalidUIDException Thrown if the DLL returns no (valid) UID instance. */ MAPDeployment_EXPORT algorithm::UID::ConstPointer peekDeploymentDLL(const char* libraryFile); MAPDeployment_EXPORT algorithm::UID::ConstPointer peekDeploymentDLL(const core::String& libraryFile); MAPDeployment_EXPORT void peekDeploymentDLL(const char* libraryFile, ::map::algorithm::UID::ConstPointer& spUID, ::map::core::String& algProfile); MAPDeployment_EXPORT void peekDeploymentDLL(const core::String& libraryFile, ::map::algorithm::UID::ConstPointer& spUID, ::map::core::String& algProfile); /*! Method requests an algorithm instance of the DLL specified by the passed DLL info. * The pointer to the registration algorithm will be returned as result. * @ingroup DeployHost * @pre pDLLHandle must not be NULL * @eguarantee strong * @exception MissingSymbolException Thrown if DLL misses the mapGetRegistrationAlgorithmInstance symbol. * @exception InvalidUIDException Thrown if the UID of the returned algorithm doesn't fit the UID of the DLL info instance. * @exception InvalidAlgorithmException Thrown if the returned algorithm pointer is not valid. */ MAPDeployment_EXPORT RegistrationAlgorithmBasePointer getRegistrationAlgorithm( const DLLHandle* pDLLHandle); /** * A function to determine if a passed filename is compliant to the the naming conventions * for MatchPoint deployed algorithms: \n * mdra[verioning]_[name].[dll|so|dylib]\n\n * Example: mdra-D-0-9_FancyNewElasitc.dll * @pre fileName pointer must not be NULL. * @return Indicates if the file is compliant to the naming conventions. */ MAPDeployment_EXPORT bool checkFileNameIsMDRACompliant(const char* fileName); /** * A function to determine if a file has the shared library extension in its name, * this converts name to lower * case before the compare, DynamicLoader always uses * lower case for LibExtension values. * @pre name pointer must not be NULL. * @return Indicates if the file can be assumed to be a DLL by its (OS specific) extension */ MAPDeployment_EXPORT bool checkNameIsSharedLibrary(const char* name); /** * function returns the os specific extension for deployed algorithms (Windows: .dll; Linux: .so; Mac OS: .dylib). */ MAPDeployment_EXPORT map::core::String getDeploymentDLLExtension(); /** * function returns the os specific MDRA prefix for MDRA compliant file names:\n * mdra[verioning]\n\n * Example: mdra-D-0-12. */ MAPDeployment_EXPORT map::core::String getDeploymentDLLMDRAPrefix(); - } //end of namespace deployment; + } // namespace deployment -} //end of namespace map; +} // namespace map #endif diff --git a/Code/Deployment/include/mapDeploymentDLLDirectoryBrowser.h b/Code/Deployment/include/mapDeploymentDLLDirectoryBrowser.h index e5a8c78..aa83996 100644 --- a/Code/Deployment/include/mapDeploymentDLLDirectoryBrowser.h +++ b/Code/Deployment/include/mapDeploymentDLLDirectoryBrowser.h @@ -1,177 +1,177 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_DEPLOYMENT_DLL_DIRECTORY_BROWSER_H #define __MAP_DEPLOYMENT_DLL_DIRECTORY_BROWSER_H #include "itkObject.h" #include "mapDeploymentDLLInfo.h" namespace map { namespace deployment { /** @class DLLDirectoryBrowser * @brief Helper class that searches in given directories for valid deployment algorithms (DA). * * For each found but invalid DA an InvalidDLLEvent will be triggered. For each valid * DA a ValidDLLEvent will be triggered, containing a pointer to the corresponding * DLLInfo structure. You can add observer to the browser to get a notification * for that events.\n * The browser only lists a certain DLL once. The DLL is uniquely identified by its file path. * Thus even if add the same path several times as a search location or a directory and a dll file path contained * in the directory, no multiple listing of an DLL will occur.\n * The browser collapses every added search path, when it is added. Thus it resolves any relative path components using the current search base. * The base is by default the current working directory. * @remark The browser will only check and find DAs which have filenames following the naming convention:\n * mdra[verioning]_[name].[dll|so]; Example: mdra-D-0-9_CorrectlyNamedAlgorithm.dll\n * You can force the browser to find other DA by not only specifying the directory but the concrete filepath * of the DA. * * @ingroup DeployHost */ class MAPDeployment_EXPORT DLLDirectoryBrowser: public itk::Object { public: /** Smart pointer typedef support. */ - typedef DLLDirectoryBrowser Self; - typedef itk::Object Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = DLLDirectoryBrowser; + using Superclass = itk::Object; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; /** Run-time type information (and related methods). */ itkTypeMacro(DLLDirectoryBrowser, itk::Object); itkFactorylessNewMacro(Self); - typedef std::vector DLLInfoListType; - typedef std::vector< ::map::core::String> PathListType; + using DLLInfoListType = std::vector; + using PathListType = std::vector< ::map::core::String>; /** Sets the base that is used to collapse relative search paths when added as search locations. * @eguarantee strong */ void setSearchBase(const core::String& base); /** Returns the base path that is used to collapse relative search paths when added as search locations. * @eguarantee strong */ const core::String& getSearchBase() const; /** Adds the passed location to the dll search path list, that is used for searching deployment DLLs. * @param [in] sLocation String to the search location. It may be a file path to the library that should be loaded * or a directory. If a directory location is added, all files in the directory will be scanned if they are dynamic libraries. * @eguarantee strong */ void addDLLSearchLocation(const core::String& location); /** Returns the current list of additional search locations. * @eguarantee strong */ const PathListType& getDLLSearchLocations() const; /** Clears the DLL search path list * @eguarantee strong */ void clearDLLSearchLocations(); /** Clears the current list of DLL infos and starts a search for DLLs in the current search path list. * @eguarantee strong */ void update(); /** Returns the current list of found deployment DLLs. * @eguarantee strong */ DLLInfoListType getLibraryInfos() const; protected: /** looks for potential deployed algorithm (complying naming conventions) in the passed path. Assumes that real directory is passed. * Returns a list of file paths with all candidates in the path that should be "peeked".*/ PathListType getCandidatesInPath(const core::String& libraryPath) const; /** looks for potential deployed algorithm in the current search locations. If the search location specifies a file, it must exist and be a valid * shared object. If the location is a directory, the containing files must also following the naming conventions. Assumes that an existing directory is passed. * Returns a list of file paths with all candidates that should be "peeked".*/ PathListType getCandidates() const; /** looks for the specified DLL and add an DLLInfo to the parameter list if the file is a valid DLL.*/ void peekLibrary(const core::String& libraryFilePath, DLLInfoListType& list, PathListType& touchedFiles) const; /** looks if the passed libraryFilePath is already contained in the list of touched files.*/ bool libraryIsInList(const core::String& libraryFilePath, const PathListType& touchedFiles) const; DLLDirectoryBrowser(); - ~DLLDirectoryBrowser(); + ~DLLDirectoryBrowser() override; DLLInfoListType _dllInfoList; PathListType _pathList; /*! Base for collapsing of relative search paths. Default is the current working directory*/ ::map::core::String _basePath; private: - DLLDirectoryBrowser(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented + DLLDirectoryBrowser(const Self&) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; - typedef DLLDirectoryBrowser::DLLInfoListType DLLInfoListType; + using DLLInfoListType = DLLDirectoryBrowser::DLLInfoListType; /*! Helper method if you just need quick information about deployment DLLs in an specific directory. * The method uses a DLLDirectoryBrowser on the specified directory and passes back the result * the algorithm stored in the DLL and closes the DLL again (using closeDeploymentDLL()). * @ingroup DeployHost * @pre directoryPath must not be NULL * @eguarantee strong * @param directoryPath the directory path as c-string. * @result list with DLLInfo instances for all found, valid DLLs. */ MAPDeployment_EXPORT DLLInfoListType peekDeploymentDLLDirectory(const char* directoryPath); /*! @overload * @param directoryPath the directory path as string. * @eguarantee strong * @result list with DLLInfo instances for all found, valid DLLs. */ MAPDeployment_EXPORT DLLInfoListType peekDeploymentDLLDirectory(const core::String& directoryPath); /** Helper function that selects all dll infos from a given list, that match * with the passed uid (regarding the given wild cards, thus ignoring parts of the uid). * @pre passed uid must point to a valid instance; * @param [in] infoList The list that should be filtered. * @param [in] uid The reference uid. * @param [in] wcNamespace Indicates if the namespace is wild carded. (True: ignore). * @param [in] wcName Indicates if the name is wild carded. (True: ignore). * @param [in] wcVersion Indicates if the version is wild carded. (True: ignore). * @param [in] wcBuild Indicates if the build is wild carded. (True: ignore). * @return A dll info list that only contains dll infos, that match the given reference uid. * @eguarantee strong * @TODO add to unit test*/ MAPDeployment_EXPORT DLLInfoListType selectDLLInfosByUID(const DLLInfoListType& infoList, const algorithm::UID* uid, bool wcNamespace = false, bool wcName = false, bool wcVersion = false, bool wcBuild = false); } // end namespace deployment } // end namespace map #endif diff --git a/Code/Deployment/include/mapDeploymentDLLHandle.h b/Code/Deployment/include/mapDeploymentDLLHandle.h index 26c7d69..eda7e49 100644 --- a/Code/Deployment/include/mapDeploymentDLLHandle.h +++ b/Code/Deployment/include/mapDeploymentDLLHandle.h @@ -1,127 +1,127 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_DEPLOYMENT_DLL_HANDLE_H #define __MAP_DEPLOYMENT_DLL_HANDLE_H #include "mapDeploymentDLLInfo.h" // Ugly stuff for library handles // The OS dependent includes are necessary to define // the proper library handle type for each OS. // The itk::DynamicLoader::LibraryHandle is not used // directly to minimize the included (itk) header files // and therfore the risk of integration problems when using // these deployment classes in other application frame works. // One known problem for example are compilation errors // when implementing a MeVisLab 2.1 module dll. #if defined(__hpux) #include #elif defined(_WIN32) && !defined(__CYGWIN__) #include #elif defined(__APPLE__) #include #if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 #include #endif #elif defined(__BEOS__) #include #endif namespace map { namespace deployment { /** @class DLLHandle * @brief Information of deployment DLLs that contain MatchPoint algorithms. * * Structur contains in addition to DeploymentDLLInfo the library handle for * managing purposes. * @ingroup DeployHost */ class MAPDeployment_EXPORT DLLHandle: public DLLInfo { public: /** Smart pointer typedef support. */ - typedef DLLHandle Self; - typedef DLLInfo Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = DLLHandle; + using Superclass = DLLInfo; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; // Ugly stuff for library handles // They are different on several different OS's #if defined(__hpux) typedef shl_t LibraryHandleType; #elif defined(_WIN32) && !defined(__CYGWIN__) - typedef HMODULE LibraryHandleType; + using LibraryHandleType = HMODULE; #elif defined(__APPLE__) #if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 typedef NSModule LibraryHandleType; #else typedef void* LibraryHandleType; #endif #elif defined(__BEOS__) typedef image_id LibraryHandleType; #else // POSIX typedef void* LibraryHandleType; #endif /** Run-time type information (and related methods). */ itkTypeMacro(DLLHandle, DLLInfo); /** * @brief Creates a DLLHandle instance, initializes it and returns it via smartpointer. * @return A pointer to the MetaProperty. * @param pUID pointer to the UID of the algorithm offered by the DLL. * @param libraryHandle handle to the deployment DLL. * @param libraryFile File path of the DLL containing the algorithm * @eguarantee strong */ static Pointer New(const LibraryHandleType& libraryHandle, const map::algorithm::UID* pUID, const core::String& libraryFile, const core::String& profileStr); const LibraryHandleType& getLibraryHandle() const; protected: DLLHandle(const LibraryHandleType& libraryHandle, const map::algorithm::UID* pUID, const core::String& libraryFile, const core::String& profileStr); - ~DLLHandle(); + ~DLLHandle() override; LibraryHandleType _libraryHandle; private: - DLLHandle(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented + DLLHandle(const Self&) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; } // end namespace deployment } // end namespace map #endif diff --git a/Code/Deployment/include/mapDeploymentDLLHelper.h b/Code/Deployment/include/mapDeploymentDLLHelper.h index 505c92a..9567951 100644 --- a/Code/Deployment/include/mapDeploymentDLLHelper.h +++ b/Code/Deployment/include/mapDeploymentDLLHelper.h @@ -1,120 +1,120 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_DEPLOYMENT_DLL_HELPER_H #define __MAP_DEPLOYMENT_DLL_HELPER_H #include "mapRegistrationAlgorithmBase.h" #include "mapUID.h" #include "mapDeploymentSync.h" #include "mapDeploymentDLLInterface.h" /*! @namespace map The namespace map is used throughout the MatchPoint project to mark code as components of this project */ namespace map { namespace deployment { /*! @class DeploymentDLLHelper @brief This is a helper class for developers who want to deploy an algorithm via DLL/shared objects. See the dll test projects (e.g. mapTestAlgorithm) for examples how to use this helper class. @ingroup DeployAlgorithm */ template class DeploymentDLLHelper { public: - typedef DeploymentDLLHelper Self; + using Self = DeploymentDLLHelper; - typedef TAlgorithmType AlgorithmType; - typedef typename AlgorithmType::Pointer AlgorithmPointer; - typedef map::algorithm::RegistrationAlgorithmBase AlgorithmBaseType; - typedef typename AlgorithmBaseType::Pointer AlgorithmBasePointer; + using AlgorithmType = TAlgorithmType; + using AlgorithmPointer = typename AlgorithmType::Pointer; + using AlgorithmBaseType = map::algorithm::RegistrationAlgorithmBase; + using AlgorithmBasePointer = typename AlgorithmBaseType::Pointer; /*! Returns a smart pointer to the UID of the algorithm */ static map::algorithm::UID::Pointer mapGetRegistrationAlgorithmUID(); /*! Returns a profile string containing the profile of the algorithm type. * The profile is stored in xml format. String may be empty if no profile is specified. */ static map::core::String mapGetRegistrationAlgorithmProfile(); /*! Returns a smart pointer to an instance of the algorithm (as RegistrationAlgorithmBase) */ static AlgorithmBasePointer mapGetRegistrationAlgorithmInstance(SyncObject* pSyncObj); private: DeploymentDLLHelper(); //purposely not implemented ~DeploymentDLLHelper(); //purposely not implemented //No copy constructor allowed DeploymentDLLHelper(const Self& source); //purposely not implemented void operator=(const Self&); //purposely not implemented }; - } -} + } // namespace deployment +} // namespace map #ifdef _WIN32 #define MAP_DEPLOYMENT_ALG_EXPORT extern "C" __declspec(dllexport) #else #define MAP_DEPLOYMENT_ALG_EXPORT extern "C" #endif /*!@def mapDeployAlgorithmMacro * This macro is used to throw a basic ExceptionObject within an object method. * The macro presumes that the object owns a method this->GetNameOfClass().\n * Use mapExceptionMacro() if you want to specifiy a arbitrary exception class that should be thrown. * @sa DeploymentDLLHelper * @sa DeploymentDLLInterface * @ingroup DeployAlgorithm */ #define mapDeployAlgorithmMacro(AlgorithmClass) \ MAP_DEPLOYMENT_ALG_EXPORT void mapGetDLLInterfaceVersion(unsigned int &major, unsigned int &minor) \ { \ major = MAP_DLL_INTERFACE_VERSION_MAJOR; \ minor = MAP_DLL_INTERFACE_VERSION_MINOR; \ }; \ MAP_DEPLOYMENT_ALG_EXPORT void mapGetRegistrationAlgorithmUID(::map::algorithm::UID::Pointer &spUID) \ { \ spUID = ::map::deployment::DeploymentDLLHelper::mapGetRegistrationAlgorithmUID(); \ }; \ MAP_DEPLOYMENT_ALG_EXPORT void mapGetRegistrationAlgorithmProfile(::map::core::String &profileString)\ {\ profileString = ::map::deployment::DeploymentDLLHelper::mapGetRegistrationAlgorithmProfile();\ };\ MAP_DEPLOYMENT_ALG_EXPORT void mapGetRegistrationAlgorithmInstance(::map::algorithm::RegistrationAlgorithmBase::Pointer &spAlgorithm, ::map::deployment::SyncObject *syncObject)\ {\ spAlgorithm = ::map::deployment::DeploymentDLLHelper::mapGetRegistrationAlgorithmInstance(syncObject);\ } #ifndef MatchPoint_MANUAL_TPP #include "mapDeploymentDLLHelper.tpp" #endif #endif diff --git a/Code/Deployment/include/mapDeploymentDLLInfo.h b/Code/Deployment/include/mapDeploymentDLLInfo.h index df8cdbe..daef271 100644 --- a/Code/Deployment/include/mapDeploymentDLLInfo.h +++ b/Code/Deployment/include/mapDeploymentDLLInfo.h @@ -1,95 +1,95 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_DEPLOYMENT_DLL_INFO_H #define __MAP_DEPLOYMENT_DLL_INFO_H #include "mapUID.h" #include "mapMAPDeploymentExports.h" namespace map { namespace deployment { /** @class DLLInfo * @brief Basis information of deployment DLLs that contain MatchPoint algorithms. * * Structur contains the UID of an algorithm and the file path to the DLL that * contains that algorithm. * @ingroup DeployHost */ class MAPDeployment_EXPORT DLLInfo: public itk::LightObject { public: /** Smart pointer typedef support. */ - typedef DLLInfo Self; - typedef ::itk::LightObject Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = DLLInfo; + using Superclass = ::itk::LightObject; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; /** Run-time type information (and related methods). */ itkTypeMacro(DLLInfo, ::itk::LightObject); /** * @brief Creates a DeploymentDLLInfo instance, initializes it and returns it via smartpointer. * @return A pointer to the MetaProperty. * @pre pUID must not be NULL. * @param pUID pointer to the UID of the algorithm offered by the DLL. * @param libraryFilePath File path of the DLL containing the algorithm * @eguarantee strong */ static Pointer New(const map::algorithm::UID* pUID, const core::String& libraryFilePath, const core::String& profileStr); const map::algorithm::UID& getAlgorithmUID() const; const core::String& getAlgorithmProfileStr() const; const core::String& getLibraryFilePath() const; protected: DLLInfo(const map::algorithm::UID* pUID, const core::String& libraryFilePath, - const core::String& profileStr); + core::String profileStr); - ~DLLInfo(); + ~DLLInfo() override; map::algorithm::UID::ConstPointer _spAlgorithmUID; ::map::core::String _libraryFilePath; /** Profile string (xml structured) associated with the algorithm*/ ::map::core::String _profileStr; /** Description string associated with the algorithm*/ ::map::core::String _description; private: - DLLInfo(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented + DLLInfo(const Self&) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; } // end namespace deployment } // end namespace map #endif diff --git a/Code/Deployment/include/mapDeploymentEvents.h b/Code/Deployment/include/mapDeploymentEvents.h index 3a7f40b..6be0cc1 100644 --- a/Code/Deployment/include/mapDeploymentEvents.h +++ b/Code/Deployment/include/mapDeploymentEvents.h @@ -1,80 +1,80 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_DEPLOYMENT_EVENTS_H #define __MAP_DEPLOYMENT_EVENTS_H #include "mapEvents.h" namespace map { namespace events { /*! @def mapDeploymentEventMacro * Helper macro that creates events objects for map. */ #define mapDeploymentEventMacro( classname , super ) \ /*! @ingroup Events */ \ class MAPDeployment_EXPORT classname : public super { \ public: \ typedef classname Self; \ typedef super Superclass; \ classname(void* pData = NULL, const std::string& comment = ""): Superclass(pData, comment) {}\ virtual ~classname() {} \ virtual const char * GetEventName() const { return #classname; } \ virtual bool CheckEvent(const ::itk::EventObject* e) const \ { return dynamic_cast(e); } \ virtual ::itk::EventObject* MakeObject() const \ { return new Self(*this); } \ classname(const Self& s) : Superclass(s) {}; \ private: \ void operator=(const Self&); \ } /*!@class ServiceEvent * @brief General/base event concering deployment. * @ingroup Events * @ingroup DeploymentEvents */ mapDeploymentEventMacro(DeploymentEvent, AnyMatchPointEvent); /*!@class InvalidDLLEvent * @brief Event concering the attempt to handle an invalid DLLs. * @ingroup Events */ mapDeploymentEventMacro(InvalidDLLEvent, DeploymentEvent); /*!@class InvalidDLLEvent * @brief Event is triggered in case of an access to an valid DLL. * * The data pointer passed with this event is a pointer to the corresponding * map::deployment::DLLInfo structur. * @ingroup Events */ mapDeploymentEventMacro(ValidDLLEvent, DeploymentEvent); - } -} + } // namespace events +} // namespace map #endif diff --git a/Code/Deployment/include/mapDeploymentSync.h b/Code/Deployment/include/mapDeploymentSync.h index 8336636..97c2c3a 100644 --- a/Code/Deployment/include/mapDeploymentSync.h +++ b/Code/Deployment/include/mapDeploymentSync.h @@ -1,78 +1,78 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_DEPLOYMENT_SYNC_H #define __MAP_DEPLOYMENT_SYNC_H #include "mapSyncObject.h" #include "mapMAPDeploymentExports.h" namespace map { namespace deployment { /** @class Synchronizer * @brief Synchronizes deployment dlls with the host application. * * This class is used in deployment DLLs/SOs (by DeploymentDLLHelper) to synchronize * the dll with global settings of the host.\n * E.g. that the same map::core::Logbook implementation and settings are used. * * @ingroup DeployAlgorithm */ class MAPDeployment_EXPORT Synchronizer { public: /** Standard class typedefs. */ - typedef Synchronizer Self; + using Self = Synchronizer; /** This function is used in deployment DLLs/SOs (by DeploymentDLLHelper) to synchronize * the dll with global settings of the host. * @param [in] pSync Pointer to the sync object that will be used by the function to realize the synchronization. */ static void synchronizeDeployment(SyncObject* pSync); static SyncObject* getSyncObject(); Synchronizer(); ~Synchronizer(); private: friend class CleanUpSyncHelper; /** Pointer is null if the synchronizer is used in the deployment dll. If used in the host (getSyncObject()) it will point * to the SyncObject of the host. * */ static SyncObject* _SyncObject; /** Pointer is null if the synchronizer is used in the host. If used in the deployment dll (synchronizeDeployment()) it will point * to the SyncObject of the host. * */ static SyncObject* _SyncedObject; }; } // end namespace deployment } // end namespace map #endif diff --git a/Code/Deployment/source/mapCheckDLLInterfaceVersion.cpp b/Code/Deployment/source/mapCheckDLLInterfaceVersion.cpp index 9b448de..49b3a85 100644 --- a/Code/Deployment/source/mapCheckDLLInterfaceVersion.cpp +++ b/Code/Deployment/source/mapCheckDLLInterfaceVersion.cpp @@ -1,39 +1,39 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapCheckDLLInterfaceVersion.h" #include "mapConfigure.h" namespace map { namespace deployment { bool checkDLLInterfaceVersion(unsigned int& major, unsigned int& minor) { //it is assumed that a dll should at least have the same major version then these binaries. return (major == MAP_DLL_INTERFACE_VERSION_MAJOR); }; } -} +} // namespace map diff --git a/Code/Deployment/source/mapDeploymentDLLAccess.cpp b/Code/Deployment/source/mapDeploymentDLLAccess.cpp index 763c8ac..692de29 100644 --- a/Code/Deployment/source/mapDeploymentDLLAccess.cpp +++ b/Code/Deployment/source/mapDeploymentDLLAccess.cpp @@ -1,378 +1,373 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ -#include +#include #include "itksys/SystemTools.hxx" #include "itkDynamicLoader.h" #include "mapConfigure.h" #include "mapDeploymentDLLAccess.h" #include "mapCheckDLLInterfaceVersion.h" #include "mapDeploymentSync.h" #include "mapFileDispatch.h" namespace map { namespace deployment { map::core::String getDeploymentDLLExtension() { map::core::String result = itksys::DynamicLoader::LibExtension(); #ifdef __APPLE_CC__ result = ".dylib"; #endif return result; }; map::core::String getDeploymentDLLMDRAPrefix() { ::map::core::String prefix = core::String("mdra"); #if _DEBUG || (__linux__ && !defined(NDEBUG)) || (__APPLE__ && !defined(NDEBUG)) prefix = prefix + "-D"; #endif ::map::core::OStringStream ostr; ostr << "-" << MAP_VERSION_MAJOR << "-" << MAP_VERSION_MINOR; prefix = prefix + ostr.str(); return prefix; }; bool checkNameIsSharedLibrary(const char* name) { - if (!name) + if (name == nullptr) { mapDefaultExceptionStaticMacro("Error. File name pointer to check is NULL. Cannot determine if its an library."); } ::map::core::String sname = name; - if (sname.find(getDeploymentDLLExtension()) != core::String::npos) - { - return true; - } - - return false; + return sname.find(getDeploymentDLLExtension()) != core::String::npos; } bool checkFileNameIsMDRACompliant(const char* name) { - if (!name) + if (name == nullptr) { mapDefaultExceptionStaticMacro("Error. File name pointer to check is NULL. Cannot determine if its name is compliant to the naming style for deployed algorithms."); } ::map::core::String sname = name; sname = core::FileDispatch::getFullName(sname); ::map::core::String suffix = core::String(getDeploymentDLLExtension()); ::map::core::String prefix = getDeploymentDLLMDRAPrefix()+"_"; if (sname.find(prefix) != 0) { return false; } if (sname.find(suffix) == core::String::npos) { return false; } return true; } /*! Helper class to properly close a DLL properly (e.g. in case of an exception)*/ class DLLGuard { public: - typedef itksys::DynamicLoader::LibraryHandle HandleType; + using HandleType = itksys::DynamicLoader::LibraryHandle; void activate() { _active = true; } void deactivate() { _active = false; } bool isActive() const { return _active; } DLLGuard(HandleType handle) : _handle(handle), _active(true) { }; ~DLLGuard() { if (_active) { itksys::DynamicLoader::CloseLibrary(_handle); } } protected: HandleType _handle; bool _active; }; DLLHandle::Pointer openDeploymentDLL(const char* libraryFile) { - if (!libraryFile) + if (libraryFile == nullptr) { mapDefaultExceptionStaticMacro("Error. Passed pointer to the library file name is NULL."); } if (!itksys::SystemTools::FileExists(libraryFile, true)) { mapExceptionStaticMacro(InvalidDLLException, "Error. Passed library file does not exist. File path: " << libraryFile); } if (! checkNameIsSharedLibrary(libraryFile)) { mapExceptionStaticMacro(InvalidDLLException, "Error. Passed library file seems not to be a valid shared library (wrong file extension). File path: " << libraryFile); } itksys::DynamicLoader::LibraryHandle libHandle = itksys::DynamicLoader::OpenLibrary(libraryFile); - if (!libHandle) + if (libHandle == nullptr) { mapExceptionStaticMacro(InvalidDLLException, "Error. Passed library cannot be loaded; seems not to be a valid DLL. File path:" << libraryFile << ". Error note: " << itksys::DynamicLoader::LastError()); } DLLGuard dllGuard(libHandle); //DLL is not correctly loaded. Check for the InterfaceVersion Symbol MAP_GET_DLL_INTERFACE_VERSION_FUNCTION_POINTER pVersionFunction = - (MAP_GET_DLL_INTERFACE_VERSION_FUNCTION_POINTER) itksys::DynamicLoader::GetSymbolAddress(libHandle, - "mapGetDLLInterfaceVersion"); + reinterpret_cast(itksys::DynamicLoader::GetSymbolAddress(libHandle, + "mapGetDLLInterfaceVersion")); - if (pVersionFunction == NULL) + if (pVersionFunction == nullptr) { mapExceptionStaticMacro(MissingSymbolException, "Error. DLL seems to be invalid; mapGetDLLInterfaceVersion symbol is missing. File path: " << libraryFile << ". Error note: " << itksys::DynamicLoader::LastError()); } //now check the version of the dll unsigned int majorVersion = 0; unsigned int minorVersion = 0; (*pVersionFunction)(majorVersion, minorVersion); if (!checkDLLInterfaceVersion(majorVersion, minorVersion)) { mapExceptionStaticMacro(InvalidInterfaceVersionException, "Error. DLL seems to have wrong deployment interface version. File path:" << libraryFile << "; DLL version: " << majorVersion << "." << minorVersion << "; host version: " << MAP_DLL_INTERFACE_VERSION_MAJOR << "." << MAP_DLL_INTERFACE_VERSION_MINOR); } //look for the other expected symbols MAP_GET_REGISTRATION_ALGORITHM_UID_FUNCTION_POINTER pUIDFunction = - (MAP_GET_REGISTRATION_ALGORITHM_UID_FUNCTION_POINTER) itksys::DynamicLoader::GetSymbolAddress( - libHandle, "mapGetRegistrationAlgorithmUID"); + reinterpret_cast(itksys::DynamicLoader::GetSymbolAddress( + libHandle, "mapGetRegistrationAlgorithmUID")); MAP_GET_REGISTRATION_ALGORITHM_INSTANCE_FUNCTION_POINTER pInstanceFunction = - (MAP_GET_REGISTRATION_ALGORITHM_INSTANCE_FUNCTION_POINTER) itksys::DynamicLoader::GetSymbolAddress( - libHandle, "mapGetRegistrationAlgorithmInstance"); + reinterpret_cast(itksys::DynamicLoader::GetSymbolAddress( + libHandle, "mapGetRegistrationAlgorithmInstance")); MAP_GET_REGISTRATION_ALGORITHM_PROFILE_FUNCTION_POINTER pProfileFunction = - (MAP_GET_REGISTRATION_ALGORITHM_PROFILE_FUNCTION_POINTER) itksys::DynamicLoader::GetSymbolAddress( - libHandle, "mapGetRegistrationAlgorithmProfile"); + reinterpret_cast(itksys::DynamicLoader::GetSymbolAddress( + libHandle, "mapGetRegistrationAlgorithmProfile")); - if (pUIDFunction == NULL) + if (pUIDFunction == nullptr) { mapExceptionStaticMacro(MissingSymbolException, "Error. DLL seems to be invalid; mapGetRegistrationAlgorithmUID symbol is missing. File path: " << libraryFile << ". Error note: " << itksys::DynamicLoader::LastError()); } - if (pProfileFunction == NULL) + if (pProfileFunction == nullptr) { mapExceptionStaticMacro(MissingSymbolException, "Error. DLL seems to be invalid; mapGetRegistrationAlgorithmProfile symbol is missing. File path: " << libraryFile << ". Error note: " << itksys::DynamicLoader::LastError()); } - if (pInstanceFunction == NULL) + if (pInstanceFunction == nullptr) { mapExceptionStaticMacro(MissingSymbolException, "Error. DLL seems to be invalid; mapGetRegistrationAlgorithmInstance symbol is missing. File path: " << libraryFile << ". Error note: " << itksys::DynamicLoader::LastError()); } //DLL seems to be valid -> Get the UID and compile the DLL info ::map::algorithm::UID::Pointer spUIDdll; (*pUIDFunction)(spUIDdll); if (spUIDdll.IsNull()) { mapExceptionStaticMacro(InvalidUIDException, "Error. DLL returns NULL pointer as UID. File path: " << libraryFile); } map::core::String profileStr; (*pProfileFunction)(profileStr); //copy the UID information to a UID that is not instanciated within the DLL, thus the new UID does not depend on the DLL. ::map::algorithm::UID::Pointer spUID = algorithm::UID::New(spUIDdll->getNamespace(), spUIDdll->getName(), spUIDdll->getVersion(), spUIDdll->getBuildTag()); DLLHandle::Pointer spResult = DLLHandle::New(libHandle, spUID, libraryFile, profileStr); dllGuard.deactivate(); return spResult; }; DLLHandle::Pointer openDeploymentDLL(const core::String& libraryFile) { return openDeploymentDLL(libraryFile.c_str()); }; void closeDeploymentDLL(const DLLHandle* pDLLHandle) { - if (!pDLLHandle) + if (pDLLHandle == nullptr) { mapDefaultExceptionStaticMacro("Error. Passed DLL info pointer is NULL."); } - if (!(pDLLHandle->getLibraryHandle())) + if ((pDLLHandle->getLibraryHandle()) == nullptr) { mapExceptionStaticMacro(InvalidDLLException, "Error. Passed library handle is not valid. File path:" << (pDLLHandle->getLibraryFilePath()) << "; handle: " << pDLLHandle->getLibraryHandle()); } - if (!itksys::DynamicLoader::CloseLibrary(pDLLHandle->getLibraryHandle())) + if (itksys::DynamicLoader::CloseLibrary(pDLLHandle->getLibraryHandle()) == 0) { mapExceptionStaticMacro(InvalidDLLException, "Error. Passed library cannot be closed; seems not to be a valid DLL. File path:" << pDLLHandle->getLibraryFilePath() << ". Error note: " << itksys::DynamicLoader::LastError()); } }; ::map::algorithm::UID::ConstPointer peekDeploymentDLL(const char* libraryFile) { DLLHandle::Pointer spHandle = openDeploymentDLL(libraryFile); ::map::algorithm::UID::ConstPointer spUID; ::map::core::String tempProfile; peekDeploymentDLL(libraryFile, spUID, tempProfile); closeDeploymentDLL(spHandle); return spUID; }; ::map::algorithm::UID::ConstPointer peekDeploymentDLL(const core::String& libraryFile) { return peekDeploymentDLL(libraryFile.c_str()); }; void peekDeploymentDLL(const char* libraryFile, algorithm::UID::ConstPointer& spUID, ::map::core::String& algProfile) { DLLHandle::Pointer spHandle = openDeploymentDLL(libraryFile); spUID = algorithm::UID::New(spHandle->getAlgorithmUID().getNamespace(), spHandle->getAlgorithmUID().getName(), spHandle->getAlgorithmUID().getVersion(), spHandle->getAlgorithmUID().getBuildTag()); algProfile = spHandle->getAlgorithmProfileStr(); closeDeploymentDLL(spHandle); }; void peekDeploymentDLL(const core::String& libraryFile, algorithm::UID::ConstPointer& spUID, ::map::core::String& algProfile) { peekDeploymentDLL(libraryFile.c_str(), spUID, algProfile); }; RegistrationAlgorithmBasePointer getRegistrationAlgorithm(const DLLHandle* pDLLHandle) { - RegistrationAlgorithmBasePointer spResult = NULL; + RegistrationAlgorithmBasePointer spResult = nullptr; - if (!pDLLHandle) + if (pDLLHandle == nullptr) { mapDefaultExceptionStaticMacro("Error. Passed DLL info pointer is NULL."); } - if (!(pDLLHandle->getLibraryHandle())) + if ((pDLLHandle->getLibraryHandle()) == nullptr) { mapExceptionStaticMacro(InvalidDLLException, "Error. Passed library handle is not valid. File path:" << (pDLLHandle->getLibraryFilePath()) << "; handle: " << pDLLHandle->getLibraryHandle()); } //DLL is not correctly loaded. Check for the InterfaceVersion Symbol MAP_GET_REGISTRATION_ALGORITHM_INSTANCE_FUNCTION_POINTER pInstanceFunction = - (MAP_GET_REGISTRATION_ALGORITHM_INSTANCE_FUNCTION_POINTER) itksys::DynamicLoader::GetSymbolAddress( - pDLLHandle->getLibraryHandle(), "mapGetRegistrationAlgorithmInstance"); + reinterpret_cast(itksys::DynamicLoader::GetSymbolAddress( + pDLLHandle->getLibraryHandle(), "mapGetRegistrationAlgorithmInstance")); - if (pInstanceFunction == NULL) + if (pInstanceFunction == nullptr) { mapExceptionStaticMacro(MissingSymbolException, "Error. DLL seems to be invalid; mapGetRegistrationAlgorithmInstance symbol is missing. File path: " << pDLLHandle->getLibraryFilePath() << ". Error note: " << itksys::DynamicLoader::LastError()); } //DLL seems to be valid -> Get an algorithm instance SyncObject* pSyncObject = Synchronizer::getSyncObject(); (*pInstanceFunction)(spResult, pSyncObject); if (spResult.IsNull()) { mapExceptionStaticMacro(InvalidAlgorithmException, "Error. DLL returns NULL pointer as pointer to an algorithm instance. File path: " << pDLLHandle->getLibraryFilePath()); } return spResult; }; } // end namespace deployment } // end namespace map diff --git a/Code/Deployment/source/mapDeploymentDLLDirectoryBrowser.cpp b/Code/Deployment/source/mapDeploymentDLLDirectoryBrowser.cpp index 4f2be73..8d29f4e 100644 --- a/Code/Deployment/source/mapDeploymentDLLDirectoryBrowser.cpp +++ b/Code/Deployment/source/mapDeploymentDLLDirectoryBrowser.cpp @@ -1,274 +1,273 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapDeploymentDLLDirectoryBrowser.h" #include "mapDeploymentDLLAccess.h" #include "mapDeploymentEvents.h" #include "mapLogbook.h" #include "mapFileDispatch.h" #include "mapExceptionObjectMacros.h" #include "itkDirectory.h" #include "itksys/SystemTools.hxx" namespace map { namespace deployment { //implemented in mapDeploymentDLLAccess.cpp - extern bool checkNameIsSharedLibrary(const char* name); + void DLLDirectoryBrowser:: addDLLSearchLocation(const core::String& location) { ::map::core::String fullPath = core::FileDispatch::ensureCorrectOSPathSeparator( - itksys::SystemTools::CollapseFullPath(location.c_str(), _basePath.c_str())); + itksys::SystemTools::CollapseFullPath(location, _basePath.c_str())); _pathList.push_back(fullPath); }; const DLLDirectoryBrowser::PathListType& DLLDirectoryBrowser:: getDLLSearchLocations() const { return _pathList; }; void DLLDirectoryBrowser:: clearDLLSearchLocations() { _pathList.clear(); }; void DLLDirectoryBrowser:: setSearchBase(const core::String& base) { _basePath = base; }; const core::String& DLLDirectoryBrowser:: getSearchBase() const { return _basePath; }; bool DLLDirectoryBrowser:: libraryIsInList(const core::String& libraryFilePath, const PathListType& touchedFiles) const { bool result = false; PathListType::const_iterator pos; for (pos = touchedFiles.begin(); pos != touchedFiles.end(); ++pos) { if ((*pos) == libraryFilePath) { result = true; break; } } return result; }; DLLDirectoryBrowser::PathListType DLLDirectoryBrowser:: getCandidatesInPath(const core::String& libraryPath) const { PathListType result; itk::Directory::Pointer dir = itk::Directory::New(); if (dir->Load(libraryPath.c_str())) { /* * check each file in the directory */ for (unsigned int i = 0; i < dir->GetNumberOfFiles(); i++) { const char* file = dir->GetFile(i); if (checkFileNameIsMDRACompliant(file)) { ::map::core::String fullpath = core::FileDispatch::createFullPath(libraryPath.c_str(), file); result.push_back(fullpath); } } } return result; }; DLLDirectoryBrowser::PathListType DLLDirectoryBrowser:: getCandidates() const { PathListType result; - for (PathListType::const_iterator pos = _pathList.begin(); pos != _pathList.end(); ++pos) + for (const auto & pos : _pathList) { - if (itksys::SystemTools::FileExists(pos->c_str())) + if (itksys::SystemTools::FileExists(pos.c_str())) { //directory or file exists - if (itksys::SystemTools::FileExists(pos->c_str(), true)) + if (itksys::SystemTools::FileExists(pos.c_str(), true)) { //its directly defined file, so only check if it is a shared library; naming convention is irrelevant. - if (checkNameIsSharedLibrary(pos->c_str())) + if (checkNameIsSharedLibrary(pos.c_str())) { - result.push_back(*pos); + result.push_back(pos); } } else { //its a directory - PathListType subresult = this->getCandidatesInPath(*pos); + PathListType subresult = this->getCandidatesInPath(pos); result.insert(result.end(), subresult.begin(), subresult.end()); } } else { ::map::core::OStringStream stream; - stream << "Specified dll search location does not exist. Location: " << *pos; + stream << "Specified dll search location does not exist. Location: " << pos; mapLogWarningMacro( << stream.str()); - this->InvokeEvent(map::events::InvalidDLLEvent(NULL, stream.str())); + this->InvokeEvent(map::events::InvalidDLLEvent(nullptr, stream.str())); } } return result; }; void DLLDirectoryBrowser:: peekLibrary(const core::String& libraryFilePath, DLLInfoListType& list, PathListType& touchedFiles) const { if (!libraryIsInList(libraryFilePath, touchedFiles)) { try { ::map::algorithm::UID::ConstPointer spUID; ::map::core::String profileStr; map::deployment::peekDeploymentDLL(libraryFilePath, spUID, profileStr); DLLInfo::Pointer spInfo = DLLInfo::New(spUID, libraryFilePath, profileStr); list.push_back(spInfo); ::map::core::String sComment = "Valid DLL: " + libraryFilePath; this->InvokeEvent(map::events::ValidDLLEvent(spInfo.GetPointer(), sComment)); } catch (const map::core::ExceptionObject& e) { ::map::core::String sComment = e.GetDescription(); - this->InvokeEvent(map::events::InvalidDLLEvent(NULL, sComment)); + this->InvokeEvent(map::events::InvalidDLLEvent(nullptr, sComment)); } catch (...) { ::map::core::String sComment = "Unkown error while try to peek DLL. File path: " + libraryFilePath; - this->InvokeEvent(map::events::InvalidDLLEvent(NULL, sComment)); + this->InvokeEvent(map::events::InvalidDLLEvent(nullptr, sComment)); } } touchedFiles.push_back(libraryFilePath); }; void DLLDirectoryBrowser:: update() { DLLInfoListType result; PathListType touchedFiles; PathListType candidates = this->getCandidates(); for (PathListType::const_iterator pos = candidates.begin(); pos != candidates.end(); ++pos) { this->peekLibrary(*pos, result, touchedFiles); } //every thing worked just fine so exchange _dllInfoList.swap(result); }; DLLDirectoryBrowser::DLLInfoListType DLLDirectoryBrowser:: getLibraryInfos() const { return _dllInfoList; }; DLLDirectoryBrowser:: DLLDirectoryBrowser() { _basePath = itksys::SystemTools::GetCurrentWorkingDirectory(); }; DLLDirectoryBrowser:: ~DLLDirectoryBrowser() - { - }; + = default; DLLInfoListType peekDeploymentDLLDirectory(const char* directoryPath) { return peekDeploymentDLLDirectory(::map::core::String(directoryPath)); }; DLLInfoListType peekDeploymentDLLDirectory(const core::String& directoryPath) { DLLDirectoryBrowser::Pointer spBrowser = DLLDirectoryBrowser::New(); spBrowser->addDLLSearchLocation(directoryPath); spBrowser->update(); return spBrowser->getLibraryInfos(); }; DLLInfoListType selectDLLInfosByUID(const DLLInfoListType& infoList, const algorithm::UID* uid, bool wcNamespace, bool wcName, bool wcVersion, bool wcBuild) { - if (!uid) + if (uid == nullptr) { mapDefaultExceptionStaticMacro( << "Cannot select dll info list. Passed uid object is NULL."); } DLLInfoListType result; - for (DLLInfoListType::const_iterator pos = infoList.begin(); pos != infoList.end(); ++pos) + for (const auto & pos : infoList) { - if (compareUIDs(*uid, (*pos)->getAlgorithmUID(), wcNamespace, wcName, wcVersion, wcBuild)) + if (compareUIDs(*uid, pos->getAlgorithmUID(), wcNamespace, wcName, wcVersion, wcBuild)) { - result.push_back(*pos); + result.push_back(pos); } } return result; }; } // end namespace deployment } // end namespace map \ No newline at end of file diff --git a/Code/Deployment/source/mapDeploymentDLLHandle.cpp b/Code/Deployment/source/mapDeploymentDLLHandle.cpp index 64fb485..18ac5c0 100644 --- a/Code/Deployment/source/mapDeploymentDLLHandle.cpp +++ b/Code/Deployment/source/mapDeploymentDLLHandle.cpp @@ -1,74 +1,73 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapDeploymentDLLHandle.h" #include "mapExceptionObject.h" namespace map { namespace deployment { const DLLHandle::LibraryHandleType& DLLHandle:: getLibraryHandle() const { return _libraryHandle; }; DLLHandle:: DLLHandle(const LibraryHandleType& libraryHandle, const map::algorithm::UID* pUID, const core::String& libraryFile, const core::String& profileStr): DLLInfo(pUID, libraryFile, profileStr), _libraryHandle(libraryHandle) { }; DLLHandle:: ~DLLHandle() - { - }; + = default; DLLHandle::Pointer DLLHandle:: New(const LibraryHandleType& libraryHandle, const map::algorithm::UID* pUID, const core::String& libraryFile, const core::String& profileStr) { - if (!pUID) + if (pUID == nullptr) { mapDefaultExceptionStaticMacro( << "Cannot create DLLHandle instance. Passed UID pointer is NULL. Library: " << libraryFile); } Pointer smartPtr; Self* rawPtr = new Self(libraryHandle, pUID, libraryFile, profileStr); smartPtr = rawPtr; rawPtr->UnRegister(); return smartPtr; }; } // end namespace deployment } // end namespace map \ No newline at end of file diff --git a/Code/Deployment/source/mapDeploymentDLLInfo.cpp b/Code/Deployment/source/mapDeploymentDLLInfo.cpp index 30c9b19..9402fff 100644 --- a/Code/Deployment/source/mapDeploymentDLLInfo.cpp +++ b/Code/Deployment/source/mapDeploymentDLLInfo.cpp @@ -1,91 +1,92 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapDeploymentDLLInfo.h" + +#include #include "mapExceptionObject.h" namespace map { namespace deployment { const map::algorithm::UID& DLLInfo:: getAlgorithmUID() const { return *_spAlgorithmUID; }; const core::String& DLLInfo:: getAlgorithmProfileStr() const { return _profileStr; }; const core::String& DLLInfo:: getLibraryFilePath() const { return _libraryFilePath; }; DLLInfo:: DLLInfo(const map::algorithm::UID* pUID, const core::String& libraryFilePath, - const core::String& profileStr): _spAlgorithmUID(pUID), _libraryFilePath(libraryFilePath), - _profileStr(profileStr) + core::String profileStr): _spAlgorithmUID(pUID), _libraryFilePath(libraryFilePath), + _profileStr(std::move(profileStr)) { - if (!pUID) + if (pUID == nullptr) { mapDefaultExceptionStaticMacro( << "Cannot create DLLInfo instance. Passed UID pointer is NULL. Library: " << libraryFilePath); } }; DLLInfo:: ~DLLInfo() - { - }; + = default; DLLInfo::Pointer DLLInfo:: New(const map::algorithm::UID* pUID, const core::String& libraryFile, const core::String& profileStr) { - if (!pUID) + if (pUID == nullptr) { mapDefaultExceptionStaticMacro( << "Cannot create DLLInfo instance. Passed UID pointer is NULL. Library: " << libraryFile); } Pointer smartPtr; Self* rawPtr = new Self(pUID, libraryFile, profileStr); smartPtr = rawPtr; rawPtr->UnRegister(); return smartPtr; }; } // end namespace deployment } // end namespace map \ No newline at end of file diff --git a/Code/Deployment/source/mapDeploymentSync.cpp b/Code/Deployment/source/mapDeploymentSync.cpp index e142540..d702c4e 100644 --- a/Code/Deployment/source/mapDeploymentSync.cpp +++ b/Code/Deployment/source/mapDeploymentSync.cpp @@ -1,87 +1,87 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapDeploymentSync.h" #include "mapExceptionObject.h" #include "mapLogbook.h" #if !defined(_MSC_VER) && !defined(__APPLE__) && !defined(__linux__) #include #endif #include namespace map { namespace deployment { class CleanUpSyncHelper { public: inline void Use() { } ~CleanUpSyncHelper() { delete Synchronizer::_SyncObject; } }; static CleanUpSyncHelper CleanUpSyncHelperGlobal; - SyncObject* Synchronizer::_SyncObject = NULL; - SyncObject* Synchronizer::_SyncedObject = NULL; + SyncObject* Synchronizer::_SyncObject = nullptr; + SyncObject* Synchronizer::_SyncedObject = nullptr; void Synchronizer:: synchronizeDeployment(SyncObject* pSync) { - if (pSync) + if (pSync != nullptr) { _SyncedObject = pSync; ::map::core::Logbook::setSynchronization(*pSync); } }; SyncObject* Synchronizer:: getSyncObject() { - ::std::auto_ptr pNewSync(new SyncObject()); + ::std::unique_ptr pNewSync(new SyncObject()); ::map::core::Logbook::getSynchronization(*pNewSync); - if (!_SyncObject) + if (_SyncObject == nullptr) { delete _SyncObject; } _SyncObject = pNewSync.release(); return _SyncObject; }; } // end namespace deployment } // end namespace map diff --git a/Code/IO/include/mapExpandingFieldKernelWriter.h b/Code/IO/include/mapExpandingFieldKernelWriter.h index eb51b5d..421662e 100644 --- a/Code/IO/include/mapExpandingFieldKernelWriter.h +++ b/Code/IO/include/mapExpandingFieldKernelWriter.h @@ -1,110 +1,110 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_EXPANDING_FIELD_KERNEL_WRITER_H #define __MAP_EXPANDING_FIELD_KERNEL_WRITER_H #include "mapRegistrationKernelWriterBase.h" #include "mapRegistrationKernel.h" namespace map { namespace io { /*! @class ExpandingFieldKernelWriter * @brief Provider that is able to store field based kernels by expanding them to the corresponding vector field and store it to file. * * The writer allways store a field as a vector field information. Thus if it is any kind of lazzy field kernel or combination kernel * the field will be computed and then stored in a file. * * @sa FieldBasedRegistrationKernel * @ingroup RegOperation * @tparam VInputDimensions Dimensions of the input space of the kernel that should be inverted. * @tparam VOutputDimensions Dimensions of the output space of the kernel that should be inverted. */ template class ExpandingFieldKernelWriter : public RegistrationKernelWriterBase { public: /*! Standard class typedefs. */ typedef ExpandingFieldKernelWriter Self; typedef RegistrationKernelWriterBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(ExpandingFieldKernelWriter, RegistrationKernelWriterBase); itkNewMacro(Self); - typedef typename Superclass::KernelBaseType KernelBaseType; - typedef typename Superclass::KernelBasePointer KernelBasePointer; - typedef typename Superclass::RequestType RequestType; + using KernelBaseType = typename Superclass::KernelBaseType; + using KernelBasePointer = typename Superclass::KernelBasePointer; + using RequestType = typename Superclass::RequestType; typedef core::RegistrationKernel KernelType; /*! Uses the passed request data to check if the provider is able to provide the service for * this request. Thus if the kernel is field based with a concrete vector field or expanding is * wanted anyway. * @return Indicates if the provider offers the right solution. * @retval true Provider can handle the request. * @retval false Provider is not able to handle the request.*/ - virtual bool canHandleRequest(const RequestType& request) const; + bool canHandleRequest(const RequestType& request) const override; /*! Returns an ID of the provider as string. Calls getStaticProviderName(). * @return Service provider ID.*/ - virtual core::String getProviderName() const; + core::String getProviderName() const override; /*! Returns an ID of the provider as string. * @return Service provider ID.*/ static core::String getStaticProviderName(); /*! Returns an ID of the provider as string. May be equal to GetClassName(), but it may differ. * @return Service provider ID. * @remark It is a return by value, becaus it might be possible that the description is generated on line * when calling this method.*/ - virtual core::String getDescription() const; + core::String getDescription() const override; /*! Generates the inverse kernel. * Returns a structured element containing the matrix. * @eguarantee strong * @param [in] request Referenz to the request that contains the kernel and all relevant information for the storing process. * @return Smart pointer to structured date element containing the stored information. */ - virtual structuredData::Element::Pointer storeKernel(const RequestType& request) const; + structuredData::Element::Pointer storeKernel(const RequestType& request) const override; protected: ExpandingFieldKernelWriter(); - virtual ~ExpandingFieldKernelWriter() {}; + ~ExpandingFieldKernelWriter() override {}; private: ExpandingFieldKernelWriter(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace io } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapExpandingFieldKernelWriter.tpp" #endif #endif diff --git a/Code/IO/include/mapFieldKernelLoader.h b/Code/IO/include/mapFieldKernelLoader.h index b556375..0c462f6 100644 --- a/Code/IO/include/mapFieldKernelLoader.h +++ b/Code/IO/include/mapFieldKernelLoader.h @@ -1,108 +1,108 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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: 797 $ (last changed revision) // @date $Date: 2014-10-10 11:42:05 +0200 (Fr, 10 Okt 2014) $ (last change date) // @author $Author: floca $ (last changed by) // Subversion HeadURL: $HeadURL: https://svn/sbr/Sources/SBR-Projects/MatchPoint/trunk/Code/IO/include/mapFieldKernelLoader.h $ */ #ifndef __MAP_FIELD_KERNEL_LOADER_H #define __MAP_FIELD_KERNEL_LOADER_H #include "mapFieldKernelLoaderBase.h" #include "mapPreCachedRegistrationKernel.h" namespace map { namespace io { /*! @class FieldKernelLoader * @brief Provider that is able to load expanded field kernels. * * @sa FieldBasedRegistrationKernels * @ingroup RegOperation * @tparam VInputDimensions Dimensions of the input space of the kernel that should be inverted. * @tparam VOutputDimensions Dimensions of the output space of the kernel that should be inverted. */ template class FieldKernelLoader : public FieldKernelLoaderBase { public: /*! Standard class typedefs. */ typedef FieldKernelLoader Self; typedef FieldKernelLoaderBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(FieldKernelLoader, FieldKernelLoaderBase); itkNewMacro(Self); typedef core::RegistrationKernel KernelBaseType; - typedef typename KernelBaseType::Pointer KernelBasePointer; - typedef typename Superclass::RequestType RequestType; - typedef typename Superclass::GenericKernelType GenericKernelType; - typedef typename Superclass::GenericKernelPointer GenericKernelPointer; + using KernelBasePointer = typename KernelBaseType::Pointer; + using RequestType = typename Superclass::RequestType; + using GenericKernelType = typename Superclass::GenericKernelType; + using GenericKernelPointer = typename Superclass::GenericKernelPointer; /*! Uses the passed request data to check if the provider is able to provide the service for * this request. Thus if the kernel is an expanded field kernel * @return Indicates if the provider offers the right solution. * @retval true Provider can handle the request. * @retval false Provider is not able to handle the request.*/ virtual bool canHandleRequest(const RequestType& request) const; /*! Returns an ID of the provider as string. Calls getStaticProviderName(). * @return Service provider ID.*/ virtual core::String getProviderName() const; /*! Returns an ID of the provider as string. * @return Service provider ID.*/ static core::String getStaticProviderName(); /*! Returns an ID of the provider as string. May be equal to GetClassName(), but it may differ. * @return Service provider ID. * @remark It is a return by value, because it might be possible that the description is generated on line * when calling this method.*/ virtual core::String getDescription() const; /*! Loads kernel. * Returns a smart pointer to the loaded kernel specified by the request. * The methods throws exceptions if the request is invalid. * @eguarantee strong * @param [in] request Reference to the request that contains the loading information * @return Smart pointer to the loaded kernel. * @pre request must be valid. */ virtual GenericKernelPointer loadKernel(const RequestType& request) const; protected: FieldKernelLoader(); virtual ~FieldKernelLoader() {}; private: FieldKernelLoader(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace io } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapFieldKernelLoader.tpp" #endif #endif diff --git a/Code/IO/include/mapFieldKernelLoaderBase.h b/Code/IO/include/mapFieldKernelLoaderBase.h index 3b2d4b1..7036f2a 100644 --- a/Code/IO/include/mapFieldKernelLoaderBase.h +++ b/Code/IO/include/mapFieldKernelLoaderBase.h @@ -1,112 +1,112 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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: 797 $ (last changed revision) // @date $Date: 2014-10-10 11:42:05 +0200 (Fr, 10 Okt 2014) $ (last change date) // @author $Author: floca $ (last changed by) // Subversion HeadURL: $HeadURL: https://svn/sbr/Sources/SBR-Projects/MatchPoint/trunk/Code/IO/include/mapFieldKernelLoaderBase.h $ */ #ifndef __MAP_FIELD_KERNEL_LOADER_BASE_H #define __MAP_FIELD_KERNEL_LOADER_BASE_H #include "mapRegistrationKernelLoaderBase.h" #include "mapRegistrationKernel.h" namespace map { namespace io { /*! @class FieldKernelLoaderBase * @brief Base class for provider that are able to load stored vector fields as kernels. * * @sa FieldBasedRegistrationKernels * @ingroup RegOperation * @tparam VInputDimensions Dimensions of the input space of the kernel that should be inverted. * @tparam VOutputDimensions Dimensions of the output space of the kernel that should be inverted. */ template class FieldKernelLoaderBase : public RegistrationKernelLoaderBase { public: /*! Standard class typedefs. */ typedef FieldKernelLoaderBase Self; - typedef RegistrationKernelLoaderBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Superclass = RegistrationKernelLoaderBase; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(FieldKernelLoaderBase, RegistrationKernelLoaderBase); typedef core::RegistrationKernel KernelBaseType; - typedef typename KernelBaseType::Pointer KernelBasePointer; - typedef typename Superclass::RequestType RequestType; + using KernelBasePointer = typename KernelBaseType::Pointer; + using RequestType = typename Superclass::RequestType; /*! Uses the passed request data to check if the provider is able to provide the service for * this request. This implementation only checks for correct dimensionality. The rest must be * checked by derived classes. * @return Indicates if the provider offers the right solution. * @retval true Provider can handle the request. * @retval false Provider is not able to handle the request.*/ - virtual bool canHandleRequest(const RequestType& request) const; + bool canHandleRequest(const RequestType& request) const override; /*! Adds a given generic kernel to the passed registration as inverse kernel. * @eguarantee strong * @param [in] pKernel pointer to the kernel that should be added if the Pointer is null a fitting registration object will be created. * @param [in] pRegistration pointer to the registration that should receive the kernel * @pre pKernel must be valid and of correct dimensionality or NULL. * @pre pRegistration must be valid and of correct dimensionality. */ - virtual void addAsInverseKernel(GenericKernelType* pKernel, - ::map::core::RegistrationBase::Pointer& spRegistration) const; + void addAsInverseKernel(GenericKernelType* pKernel, + ::map::core::RegistrationBase::Pointer& spRegistration) const override; /*! Adds a given generic kernel to the passed registration as direct kernel. * @eguarantee strong * @param [in] pKernel pointer to the kernel that should be added if the Pointer is null a fitting registration object will be created. * @param [in] pRegistration pointer to the registration that should receive the kernel * @pre pKernel must be valid and of correct dimensionality or NULL. * @pre pRegistration must be valid and of correct dimensionality. */ - virtual void addAsDirectKernel(GenericKernelType* pKernel, - core::RegistrationBase::Pointer& spRegistration) const; + void addAsDirectKernel(GenericKernelType* pKernel, + core::RegistrationBase::Pointer& spRegistration) const override; protected: /** Returns the file path of the field defined in the request. * @eguarantee strong*/ ::map::core::String getFilePath(const RequestType& request) const; /** Checks the passed request if a null vector is defined and returns its value. * @param nullPoint Values of the null vector. Valid if method returns true. If it returns false, no vector was defined and the value is 0. * @result true if a null vector exists. * @eguarantee strong*/ bool hasNullPoint(const RequestType& request, typename KernelBaseType::OutputPointType& nullPoint) const; FieldKernelLoaderBase(); - virtual ~FieldKernelLoaderBase() {}; + ~FieldKernelLoaderBase() override {}; private: FieldKernelLoaderBase(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace io } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapFieldKernelLoaderBase.tpp" #endif #endif diff --git a/Code/IO/include/mapGenericImageReader.h b/Code/IO/include/mapGenericImageReader.h index f443508..9dca10f 100644 --- a/Code/IO/include/mapGenericImageReader.h +++ b/Code/IO/include/mapGenericImageReader.h @@ -1,160 +1,160 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_GENERIC_IMAGE_READER_H #define __MAP_GENERIC_IMAGE_READER_H #include "mapImageReader.h" #include "mapMAPIOExports.h" namespace map { namespace io { /** @class ImageReader * @brief Helper class manages the generic loading (unspecified dimension and pixel type) of 2D/3D images ... * * GenericImageReader uses the ImageReader class and dispatches the dimension and pixel type information from the specified image file. * GenericImageReader supports 2D and 3D images and the following pixel types: * - (unsigned) char * - (unsigned) short * - (unsigned) int * - (unsigned) long * - float * - double * . * Due to the fact that it builds upon the itk io infrastructure, all formats supported by ITK * can be read. * For further information regarding the usage see documentation of ImageReader. * @sa ImageReader * @ingroup Utils */ class MAPIO_EXPORT GenericImageReader : public ::itk::Object { public: - typedef GenericImageReader Self; - typedef ::itk::Object Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = GenericImageReader; + using Superclass = ::itk::Object; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(GenericImageReader, ::itk::Object); itkNewMacro(Self); - typedef ::itk::DataObject GenericOutputImageType; + using GenericOutputImageType = ::itk::DataObject; - typedef ::itk::ImageIOBase::IOPixelType LoadedPixelType; + using LoadedPixelType = ::itk::ImageIOBase::IOPixelType; - typedef ::itk::ImageIOBase::IOComponentType LoadedComponentType; + using LoadedComponentType = ::itk::ImageIOBase::IOComponentType; - typedef std::vector MetaDataDictionaryArrayType; + using MetaDataDictionaryArrayType = std::vector; private: /** Loaded Image.*/ GenericOutputImageType::Pointer _spImage; /** The file name of the image. */ core::String _fileName; /** The upper limit for the searching of series files in the path.*/ unsigned int _upperSeriesLimit; /** Indicates if the image data is up to date or should be read again.*/ bool _upToDate; /** Defines if the specified image file is part of a series and the * whole series should be read into one image. Only relevant for 3D images.*/ ImageSeriesReadStyle::Type _seriesReadStyle; unsigned int _loadedDimensions; LoadedPixelType _loadedPixelType; LoadedComponentType _loadedComponentType; core::String _loadedComponentTypeStr; core::String _loadedPixelTypeStr; MetaDataDictionaryArrayType _dictionaryArray; /** Loads the image. First identifies pixel type and dimension and then deligates according * to the pixel type. * @exception map::core::ExceptionObject If no ImageIO is found. * @exception map::core::ExceptionObject If dimension of the image is not supported. Only 2D/3D is supported. * @exception map::core::ExceptionObject If pixel type is not supported. Currently only scalar pixels are supported. */ void load(); /** Loads an scalar image. * @exception map::core::ExceptionObject If pixel component type is not supported. */ template void loadScalar(); //template //void loadRGB(); public: /** Function to access the member variable _FileName. _FileName represents the filename of the * headerfile. The path must be included, the file extension may left away. * @return File name of the header file.*/ const core::String& getFileName() const; /** Function to access the member variable _FileName. _FileName represents the filename of the * headerfile. The path must be included, the file extension may left away. * @param [in] sFileName The file name of the header file.*/ void setFileName(const core::String& sFileName); /** Function to access the member variable _upperSeriesLimit. _upperSeriesLimit represents * the upper limit for the series file search. * @return The upper limit of the series search.*/ - const unsigned int getUpperSeriesLimit() const; + unsigned int getUpperSeriesLimit() const; /** Function to access the member variable _upperSeriesLimit. _upperSeriesLimit represents * the upper limit for the series file search. Changing the series limit out dates the ImageReader. * @remark It is only relevant if series style is set to "Numeric". * @param [in] upperLimit The upper limit of the header file.*/ - void setUpperSeriesLimit(const unsigned int upperLimit); + void setUpperSeriesLimit(unsigned int upperLimit); /** Function to access the member variable _seriesReadStyle (see member description for more information).*/ - const ImageSeriesReadStyle::Type getSeriesReadStyle() const; + ImageSeriesReadStyle::Type getSeriesReadStyle() const; /** Function to access the member variable _seriesReadStyle (see member description for more information). * Changing the style out dates the ImageReader.*/ void setSeriesReadStyle(ImageSeriesReadStyle::Type readStyle); /** Function loads the image if needed and returns the data. * @return Pointer to loaded image. * @exception map::core::ExceptionObject If no ImageIO is found. * @exception map::core::ExceptionObject If dimension of the image is not supported. Only 2D/3D is supported. * @exception map::core::ExceptionObject If pixel type is not supported. Currently only scalar pixels are supported. * @exception map::core::ExceptionObject If pixel component type is not supported. */ GenericOutputImageType* GetOutput(unsigned int& loadedDimensions, LoadedPixelType& loadedPixelType, LoadedComponentType& loadedComponentType); /** Function returns the reference to the meta data dictionary(ies) of the latest file(s) loaded by this class. * Array may be empty if no MetaDictionary exists.*/ const MetaDataDictionaryArrayType& getMetaDictionaryArray(); protected: GenericImageReader(); - virtual ~GenericImageReader(); + ~GenericImageReader() override; }; - } -} + } // namespace io +} // namespace map #endif diff --git a/Code/IO/include/mapImageReader.h b/Code/IO/include/mapImageReader.h index e7ae746..6e17e83 100644 --- a/Code/IO/include/mapImageReader.h +++ b/Code/IO/include/mapImageReader.h @@ -1,222 +1,222 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_IMAGE_READER_H #define __MAP_IMAGE_READER_H #include "itkImage.h" #include "itkImageSource.h" #include "mapString.h" namespace map { namespace io { struct ImageSeriesReadStyle { enum Type { Default = 0, //* - Depending on the file extension (DICOM images (*.dcm, *.ima): Dicom; others: None; No image file: Dicom) None = 1, //* - No series reading, only the specified file Dicom = 2, //* - Use series reader and DCMTKSeriesFileNames Numeric = 3, //* - Use series reader and NumericSeriesFileNames GDCM = 4 //* - Use series reader and GDCMSeriesFileNames }; }; /** @class ImageReader * @brief Helper class manages the loading of 2D/3D images based on itk but with some convenience features ... * * ImageReader is used to load 2D or 3D images in an itk like style, but also offers * some convenience features and the specialties of different formats into account.\n * 2D images will be loaded directly by the IO classes of itk, so in this case the * ImageReader is only a layer of abstraction.\n * 3D images will be handled different, depending on the type of files and the chosen * series read style:\n * - Default: Depending on the file extension (DICOM images (*.dcm, *.ima): Dicom; others: None; No image file: Dicom * - None: directly by the itk io (no series reading) * - Dicom: uses itk series reader, currently a list of files will be generated that is similar to GDCM (old ::itk::DICOMKSeriesFileNames is not supported any more by itk > 4.3.x.) * - GDCM: uses itk series reader, the list of files will be generated * by the ::itk::GDCMSeriesFileNames in the specified path ordered by * imagePositionPatient. * - Numeric: Will be considered as series of images. The list of files will be * created by ::itk::NumericSeriesFileNames, so in this case the given * file name is already masked by %d for the increasing index within * the file name. * . * @todo implement Reader as an ::itk::ImageSource in the behavior. * @ingroup Utils */ template class ImageReader { public: typedef ::itk::Image InputImageType; typedef ::itk::Image OutputImageType; - typedef TInputPixel RescaleValueType; - typedef std::vector MetaDataDictionaryArrayType; + using RescaleValueType = TInputPixel; + using MetaDataDictionaryArrayType = std::vector; virtual const char* GetNameOfClass() const { return "ImageReader"; } private: /** Loaded Image.*/ typename OutputImageType::Pointer _spImage; /** The file name of the image. */ ::map::core::String _fileName; /** The upper limit for the searching of series files in the path.*/ unsigned int _upperSeriesLimit; /** Indicates if the image data is up to date or should be read again.*/ bool _upToDate; /** Indicates if the output image intensity should be rescaled.*/ bool _rescaleImage; /** Indicates the minimum of the output.*/ RescaleValueType _rescaleMin; /** Indicates the maximum of the output.*/ RescaleValueType _rescaleMax; /** Defines if the specified image file is part of a series and the * whole series should be read into one image. Only relevant for 3D images.*/ typename ImageSeriesReadStyle::Type _seriesReadStyle; MetaDataDictionaryArrayType _dictionaryArray; void load2D(); typename itk::ImageSource::Pointer prepareNumericSource() const; typename itk::ImageSource::Pointer prepareDICOMSource() const; typename itk::ImageSource::Pointer prepareNormalSource() const; typename itk::ImageSource::Pointer prepareGDCMSource() const; void load3D(); - typedef std::vector< ::itk::MetaDataDictionary*> ITKMetaDataDictionaryArray; + using ITKMetaDataDictionaryArray = std::vector< ::itk::MetaDataDictionary *>; void copyMetaDictionaryArray(const ITKMetaDataDictionaryArray* fromArray, MetaDataDictionaryArrayType& toArray); public: /** Function to access the member variable _FileName. _FileName represents the filename of the * headerfile. The path must be included, the file extension may left away. * @return File name of the header file.*/ const core::String& getFileName() const; /** Function to access the member variable _FileName. _FileName represents the filename of the * headerfile. The path must be included, the file extension may left away. * @param [in] sFileName The file name of the header file.*/ void setFileName(const core::String& sFileName); /** Function to access the member variable _rescaleMin. _rescaleMin represents * the minimum of the intensity rescale filter. * @return The minimum of the intensity rescale filter.*/ const RescaleValueType& getRescaleMinimum() const; /** Function to access the member variable _rescaleMin. _rescaleMin represents * the minimum of the intensity rescale filter. Changing the rescale minimum out dates the ImageReader. * @param [in] dRescaleMin The minimum of the intensity rescale filter.*/ void setRescaleMinimum(const RescaleValueType& rescaleMin); /** Function to access the member variable _rescaleMin. _rescaleMax represents * the minimum of the intensity rescale filter. * @return The minimum of the intensity rescale filter.*/ const RescaleValueType& getRescaleMaximum() const; /** Function to access the member variable _rescaleMin. _rescaleMax represents * the minimum of the intensity rescale filter. Changing the rescale maximum out dates the ImageReader. * @param [in] dRescaleMax The minimum of the intensity rescale filter.*/ void setRescaleMaximum(const RescaleValueType& rescaleMax); /** Function to access the member variable _rescaleImage. _rescaleImage indicates if a * loaded image should be rescaled regarding its intensities. * @return If the ImageReader converts images to iso-voxel.*/ - const bool getRescaleImage() const; + bool getRescaleImage() const; /** Function to access the member variable _rescaleImage. _rescaleImage indicates if a * loaded image should be rescaled regarding its intensities. Changing the rescale option out dates the ImageReader. * @param [in] rescaleImage Specifies if image should be converted to isovoxel.*/ - void setRescaleImage(const bool rescaleImage); + void setRescaleImage(bool rescaleImage); /** Function to access the member variable _upperSeriesLimit. _upperSeriesLimit represents * the upper limit for the series file search. * @return The upper limit of the series search.*/ - const unsigned int getUpperSeriesLimit() const; + unsigned int getUpperSeriesLimit() const; /** Function to access the member variable _upperSeriesLimit. _upperSeriesLimit represents * the upper limit for the series file search. Changing the series limit out dates the ImageReader. * @remark It is only relevant if series style is set to "Numeric". * @param [in] upperLimit The upper limit of the header file.*/ - void setUpperSeriesLimit(const unsigned int upperLimit); + void setUpperSeriesLimit(unsigned int upperLimit); /** Function to access the member variable _seriesReadStyle (see member description for more information).*/ - const typename ImageSeriesReadStyle::Type getSeriesReadStyle() const; + typename ImageSeriesReadStyle::Type getSeriesReadStyle() const; /** Function to access the member variable _seriesReadStyle (see member description for more information). * Changing the style out dates the ImageReader.*/ void setSeriesReadStyle(typename ImageSeriesReadStyle::Type readStyle); /** Function loads the image if needed and returns the data. * @return Pointer to loaded image.*/ - OutputImageType* GetOutput(void); + OutputImageType* GetOutput(); /** Function returns the reference to the meta data dictionary(ies) of the latest file(s) loaded by this class. * Array may be empty if no MetaDictionary exists.*/ const MetaDataDictionaryArrayType& getMetaDictionaryArray(); ImageReader(); virtual ~ImageReader(); }; /** * @brief Helper function for the use of ImageReader in on statement ... * * for specific informations please see the documentation of ImageReader. * @param pLoadedDictArray Pass a pointer to valid array to receive the meta dictionaries * loaded with the image. If the pointer is null, no dictionaries will be transfered. The array * will be reseted before the loaded dictionaries will be added. * @sa ImageReader * @ingroup Utils */ template typename ImageReader::OutputImageType::Pointer readImage(const core::String& fileName, ImageSeriesReadStyle::Type readStyle = ImageSeriesReadStyle::Default, bool rescaleImage = false, typename ImageReader::RescaleValueType rescaleMin = 0, typename ImageReader::RescaleValueType rescaleMax = 255, unsigned int upperNumericSeriesLimit = 100, typename ImageReader::MetaDataDictionaryArrayType* pLoadedDictArray = NULL); - } -} + } // namespace io +} // namespace map #ifndef MatchPoint_MANUAL_TPP #include "mapImageReader.tpp" #endif #endif diff --git a/Code/IO/include/mapImageReader.tpp b/Code/IO/include/mapImageReader.tpp index 6bcc82e..f74366c 100644 --- a/Code/IO/include/mapImageReader.tpp +++ b/Code/IO/include/mapImageReader.tpp @@ -1,538 +1,537 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_IMAGE_READER_TPP #define __MAP_IMAGE_READER_TPP #include #include #include #include #include "mapImageReader.h" #include "mapExceptionObjectMacros.h" #include "mapFileDispatch.h" #ifdef MAP_DISABLE_ITK_IO_FACTORY_AUTO_REGISTER #undef ITK_IO_FACTORY_REGISTER_MANAGER #endif //MAP_DISABLE_ITK_IO_FACTORY_AUTO_REGISTER #include "itkImageFileReader.h" #include "itkImageFileWriter.h" #include "itkImageSeriesReader.h" #include "itkImageSeriesWriter.h" #include "itkNumericSeriesFileNames.h" #include "itkGDCMSeriesFileNames.h" #include "itkRescaleIntensityImageFilter.h" #include "itkCastImageFilter.h" #include "itkFixedArray.h" #include "itksys/SystemTools.hxx" namespace map { namespace io { //////////////////////////////////////////////////////////////////////// /// Implementation of map::ImageReader //////////////////////////////// //////////////////////////////////////////////////////////////////////// template void ImageReader:: load2D() { - typedef ::itk::ImageFileReader< InputImageType > ImageReaderType; + using ImageReaderType = ::itk::ImageFileReader; typedef ::itk::RescaleIntensityImageFilter< InputImageType, InputImageType > RescaleFilterType; typedef ::itk::CastImageFilter< InputImageType, OutputImageType > CastFilterType; typename CastFilterType::Pointer imageCaster = CastFilterType::New(); typename ImageReaderType::Pointer imageReader = ImageReaderType::New(); typename RescaleFilterType::Pointer rescaleFilter = RescaleFilterType::New(); rescaleFilter->SetOutputMinimum(static_cast(_rescaleMin)); rescaleFilter->SetOutputMaximum(static_cast(_rescaleMax)); - imageReader->SetFileName(_fileName.c_str()); + imageReader->SetFileName(_fileName); rescaleFilter->SetInput(imageReader->GetOutput()); if (_rescaleImage) { imageCaster->SetInput(rescaleFilter->GetOutput()); } else { imageCaster->SetInput(imageReader->GetOutput()); } _spImage = imageCaster->GetOutput(); imageCaster->Update(); _dictionaryArray.clear(); _dictionaryArray.push_back(imageReader->GetImageIO()->GetMetaDataDictionary()); _upToDate = true; }; template const typename ImageReader::MetaDataDictionaryArrayType& ImageReader:: getMetaDictionaryArray() { return _dictionaryArray; }; template void ImageReader:: copyMetaDictionaryArray(const ITKMetaDataDictionaryArray* fromArray, MetaDataDictionaryArrayType& toArray) { toArray.clear(); - ITKMetaDataDictionaryArray::const_iterator itr = fromArray->begin(); - ITKMetaDataDictionaryArray::const_iterator end = fromArray->end(); + auto itr = fromArray->begin(); + auto end = fromArray->end(); while (itr != end) { toArray.push_back(*(*itr)); ++itr; } }; template typename itk::ImageSource::InputImageType>::Pointer ImageReader:: prepareNumericSource() const { //mumeric series image reader - typedef ::itk::ImageSeriesReader< InputImageType > SeriesReaderType; - typedef ::itk::NumericSeriesFileNames NamesType; + using SeriesReaderType = ::itk::ImageSeriesReader; + using NamesType = ::itk::NumericSeriesFileNames; typename SeriesReaderType::Pointer seriesReader = SeriesReaderType::New(); NamesType::Pointer names = NamesType::New(); names->SetStartIndex(1); names->SetEndIndex(_upperSeriesLimit); names->SetSeriesFormat(_fileName.c_str()); seriesReader->SetFileNames(names->GetFileNames()); - if (seriesReader->GetFileNames().size() == 0) + if (seriesReader->GetFileNames().empty()) { mapDefaultExceptionMacro( << "Image reader is not correctly configured. Preparing a series reading of a numeric source no(!) files were found. Pattern: " << _fileName << "; upperSeriesLimit: " << _upperSeriesLimit); } typename itk::ImageSource::InputImageType>::Pointer genericReader = seriesReader.GetPointer(); return genericReader; }; template typename itk::ImageSource::InputImageType>::Pointer ImageReader:: prepareDICOMSource() const { //ITK > v4.3.x removed old DICOMSeriesFileNames. Thus currently only support GDCM as source by default return prepareGDCMSource(); /**@TODO Add support for DCMTKSeriesFileNames too*/ }; template typename itk::ImageSource::InputImageType>::Pointer ImageReader:: prepareGDCMSource() const { ::map::core::FileDispatch dispatch(_fileName); ::map::core::String dir = dispatch.getPath(); ::map::core::String strippedFileName = dispatch.getFullName(); - typedef itk::GDCMSeriesFileNames NamesGeneratorType; + using NamesGeneratorType = itk::GDCMSeriesFileNames; NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New(); nameGenerator->SetInputDirectory(dir); nameGenerator->SetUseSeriesDetails(true); itk::FilenamesContainer fileNames; if (strippedFileName.empty()) { mapLogDebugStaticMacro( << "No file name specified. Use first DICOM series found in directory."); fileNames = nameGenerator->GetInputFileNames(); } else { itk::SerieUIDContainer seriesUIDs = nameGenerator->GetSeriesUIDs(); mapLogDebugStaticMacro( << "Checking found DICOM series"); //check the found series for the filename to pick the right series correlated to the passed filename - while (seriesUIDs.size() > 0) + while (!seriesUIDs.empty()) { fileNames = nameGenerator->GetFileNames(seriesUIDs.back()); mapLogDebugStaticMacro( << "Checking series: " << seriesUIDs.back() << " (file count: " << fileNames.size() << ")"); seriesUIDs.pop_back(); for (itk::SerieUIDContainer::const_iterator pos = fileNames.begin(); pos != fileNames.end(); ++pos) { if (pos->find(strippedFileName) != core::String::npos) { //this series containes the passed filename -> //we have the right block of files -> we are done. mapLogDebugStaticMacro( << "Found right series!"); seriesUIDs.clear(); break; } } } } - typedef ::itk::ImageSeriesReader< InputImageType > SeriesReaderType; + using SeriesReaderType = ::itk::ImageSeriesReader; typename SeriesReaderType::Pointer seriesReader = SeriesReaderType::New(); seriesReader->SetFileNames(fileNames); - if (seriesReader->GetFileNames().size() == 0) + if (seriesReader->GetFileNames().empty()) { mapDefaultExceptionMacro( << "Image reader is not correctly configured. Preparing a series reading of a DICOM source no(!) dicom files were found. search location: " << _fileName); } typename itk::ImageSource::InputImageType>::Pointer genericReader = seriesReader.GetPointer(); return genericReader; }; template typename itk::ImageSource::InputImageType>::Pointer ImageReader:: prepareNormalSource() const { //Normal image reader (no series read style) - typedef ::itk::ImageFileReader< InputImageType > ImageReaderType; + using ImageReaderType = ::itk::ImageFileReader; typename ImageReaderType::Pointer imageReader = ImageReaderType::New(); - imageReader->SetFileName(_fileName.c_str()); + imageReader->SetFileName(_fileName); typename itk::ImageSource::InputImageType>::Pointer genericReader = imageReader.GetPointer(); return genericReader; }; template void ImageReader:: load3D() { ::map::core::FileDispatch dispatch(_fileName); ::map::core::String sTemp = dispatch.getExtension(); ::map::core::String sDir = dispatch.getPath(); std::transform(sTemp.begin(), sTemp.end(), sTemp.begin(), ::tolower); typedef ::itk::RescaleIntensityImageFilter< InputImageType, InputImageType > RescaleFilterType; typedef ::itk::CastImageFilter< InputImageType, OutputImageType > CastFilterType; typename CastFilterType::Pointer imageCaster = CastFilterType::New(); typename RescaleFilterType::Pointer rescaleFilter = RescaleFilterType::New(); typename ::itk::ImageSource::Pointer spReader; rescaleFilter->SetOutputMinimum(static_cast(_rescaleMin)); rescaleFilter->SetOutputMaximum(static_cast(_rescaleMax)); if (_seriesReadStyle == ImageSeriesReadStyle::Numeric) { spReader = prepareNumericSource(); } else if (_seriesReadStyle == ImageSeriesReadStyle::Dicom) { spReader = prepareDICOMSource(); } else if (_seriesReadStyle == ImageSeriesReadStyle::GDCM) { spReader = prepareGDCMSource(); } else if (_seriesReadStyle == ImageSeriesReadStyle::Default) { - bool isDir = itksys::SystemTools::FileIsDirectory(_fileName.c_str()); + bool isDir = itksys::SystemTools::FileIsDirectory(_fileName); if (isDir || sTemp == ".dcm" || sTemp == ".ima") { spReader = prepareDICOMSource(); } else { spReader = prepareNormalSource(); } } else { //style is none spReader = prepareNormalSource(); } if (_rescaleImage) { rescaleFilter->SetInput(spReader->GetOutput()); imageCaster->SetInput(rescaleFilter->GetOutput()); } else { imageCaster->SetInput(spReader->GetOutput()); } imageCaster->Update(); _spImage = imageCaster->GetOutput(); - typedef ::itk::ImageFileReader< InputImageType > ImageReaderType; - typedef ::itk::ImageSeriesReader< InputImageType > ImageSeriesReaderType; - ImageReaderType* pFileReader = dynamic_cast(spReader.GetPointer()); - ImageSeriesReaderType* pSeriesReader = dynamic_cast(spReader.GetPointer()); + using ImageReaderType = ::itk::ImageFileReader; + using ImageSeriesReaderType = ::itk::ImageSeriesReader; + auto* pFileReader = dynamic_cast(spReader.GetPointer()); + auto* pSeriesReader = dynamic_cast(spReader.GetPointer()); if (pFileReader) { _dictionaryArray.clear(); _dictionaryArray.push_back(pFileReader->GetImageIO()->GetMetaDataDictionary()); } else if (pSeriesReader) { copyMetaDictionaryArray(pSeriesReader->GetMetaDataDictionaryArray(), _dictionaryArray); } else { mapDefaultExceptionMacro( << "Image reader is not valid. Internal reader seams not to be itk::ImageFileReader or itk::ImageSeriesReader."); } _upToDate = true; }; template const core::String& ImageReader:: getFileName() const { return _fileName; }; template void ImageReader:: setFileName(const core::String& fileName) { if (fileName != _fileName) { _upToDate = false; _fileName = fileName; } } template const typename ImageReader::RescaleValueType& ImageReader:: getRescaleMinimum() const { return _rescaleMin; }; template void ImageReader:: setRescaleMinimum(const RescaleValueType& dRescaleMin) { if (dRescaleMin != _rescaleMin) { _upToDate = false; _rescaleMin = dRescaleMin; }; }; template const typename ImageReader::RescaleValueType& ImageReader:: getRescaleMaximum() const { return _rescaleMax; }; template void ImageReader:: setRescaleMaximum(const RescaleValueType& dRescaleMax) { if (dRescaleMax != _rescaleMax) { _upToDate = false; _rescaleMax = dRescaleMax; }; }; template - const bool + bool ImageReader:: getRescaleImage() const { return _rescaleImage; }; template void ImageReader:: setRescaleImage(const bool rescaleImage) { if (rescaleImage != _rescaleImage) { _upToDate = false; _rescaleImage = rescaleImage; }; }; template - const unsigned int + unsigned int ImageReader:: getUpperSeriesLimit() const { return _upperSeriesLimit; }; template void ImageReader:: setUpperSeriesLimit(const unsigned int upperLimit) { if (upperLimit != _upperSeriesLimit) { _upToDate = false; _upperSeriesLimit = upperLimit; }; }; template - const ImageSeriesReadStyle::Type + ImageSeriesReadStyle::Type ImageReader:: getSeriesReadStyle() const { return _seriesReadStyle; }; template void ImageReader:: setSeriesReadStyle(ImageSeriesReadStyle::Type readStyle) { if (readStyle != _seriesReadStyle) { _upToDate = false; _seriesReadStyle = readStyle; }; }; template typename ImageReader::OutputImageType* ImageReader:: - GetOutput(void) + GetOutput() { if (!_upToDate) { switch (OutputImageType::GetImageDimension()) { case 2: load2D(); break; case 3: load3D(); break; default: mapDefaultExceptionMacro( << "Image reader only accepts 2 or 3 dimensional images.") }; }; return _spImage; }; template ImageReader:: ImageReader() { _fileName = ""; _upperSeriesLimit = 255; _upToDate = false; _rescaleImage = false; _rescaleMax = 255; _rescaleMin = 0; _seriesReadStyle = ImageSeriesReadStyle::Default; }; template ImageReader:: ~ImageReader() - { - }; + = default; template typename ImageReader::OutputImageType::Pointer readImage( const core::String& fileName, ImageSeriesReadStyle::Type readStyle, bool rescaleImage, typename ImageReader::RescaleValueType rescaleMin, typename ImageReader::RescaleValueType rescaleMax, unsigned int upperNumericSeriesLimit, typename ImageReader::MetaDataDictionaryArrayType* pLoadedDictArray) { ImageReader reader; reader.setFileName(fileName); reader.setSeriesReadStyle(readStyle); reader.setRescaleImage(rescaleImage); reader.setRescaleMaximum(rescaleMax); reader.setRescaleMinimum(rescaleMin); reader.setUpperSeriesLimit(upperNumericSeriesLimit); typename ImageReader::OutputImageType::Pointer spResult = reader.GetOutput(); if (pLoadedDictArray) { *pLoadedDictArray = reader.getMetaDictionaryArray(); }; return spResult; }; - } -} + } // namespace io +} // namespace map #endif diff --git a/Code/IO/include/mapInvertingKernelLoader.h b/Code/IO/include/mapInvertingKernelLoader.h index 713476b..0afd458 100644 --- a/Code/IO/include/mapInvertingKernelLoader.h +++ b/Code/IO/include/mapInvertingKernelLoader.h @@ -1,113 +1,113 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_INVERTING_FIELD_KERNEL_LOADER_H #define __MAP_INVERTING_FIELD_KERNEL_LOADER_H #include "mapFieldKernelLoaderBase.h" #include "mapInvertingRegistrationKernel.h" namespace map { namespace io { /*! @class InvertingKernelLoader * @brief Provider that is able to load InvertingFiledBasedKernels. * * The "loading" is done by using the related kernel of the loader request and inferting that kernel * by using the InverseRegistrationKernelGenerator. * * @sa FieldBasedRegistrationKernels * @ingroup RegOperation * @tparam VInputDimensions Dimensions of the input space of the kernel that should be inverted. * @tparam VOutputDimensions Dimensions of the output space of the kernel that should be inverted. */ template class InvertingKernelLoader : public FieldKernelLoaderBase < VInputDimensions, VOutputDimensions > { public: /*! Standard class typedefs. */ typedef InvertingKernelLoader Self; typedef FieldKernelLoaderBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(InvertingKernelLoader, FieldKernelLoaderBase); itkNewMacro(Self); typedef core::InvertingRegistrationKernel < VInputDimensions, VOutputDimensions > KernelBaseType; - typedef typename KernelBaseType::Pointer KernelBasePointer; - typedef typename Superclass::RequestType RequestType; + using KernelBasePointer = typename KernelBaseType::Pointer; + using RequestType = typename Superclass::RequestType; - typedef typename Superclass::GenericKernelType GenericKernelType; - typedef typename Superclass::GenericKernelPointer GenericKernelPointer; + using GenericKernelType = typename Superclass::GenericKernelType; + using GenericKernelPointer = typename Superclass::GenericKernelPointer; /*! Uses the passed request data to check if the provider is able to provide the service for * this request. Thus if the kernel is an expanded field kernel * @return Indicates if the provider offers the right solution. * @retval true Provider can handle the request. * @retval false Provider is not able to handle the request.*/ virtual bool canHandleRequest(const RequestType& request) const; /*! Returns an ID of the provider as string. Calls getStaticProviderName(). * @return Service provider ID.*/ virtual core::String getProviderName() const; /*! Returns an ID of the provider as string. * @return Service provider ID.*/ static core::String getStaticProviderName(); /*! Returns an ID of the provider as string. May be equal to GetClassName(), but it may differ. * @return Service provider ID. * @remark It is a return by value, because it might be possible that the description is generated on line * when calling this method.*/ virtual core::String getDescription() const; /*! Loads kernel. * Returns a smart pointer to the loaded kernel specified by the request. * The methods throws exceptions if the request is invalid. * @eguarantee strong * @param [in] request Reference to the request that contains the loading information * @return Smart pointer to the loaded kernel. * @pre request must be valid. */ virtual GenericKernelPointer loadKernel(const RequestType& request) const; protected: InvertingKernelLoader(); virtual ~InvertingKernelLoader() {}; private: InvertingKernelLoader(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace io } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapInvertingKernelLoader.tpp" #endif #endif diff --git a/Code/IO/include/mapInvertingKernelWriter.h b/Code/IO/include/mapInvertingKernelWriter.h index dd0a6ec..cb6007c 100644 --- a/Code/IO/include/mapInvertingKernelWriter.h +++ b/Code/IO/include/mapInvertingKernelWriter.h @@ -1,111 +1,111 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_INVERTING_FIELD_KERNEL_WRITER_H #define __MAP_INVERTING_FIELD_KERNEL_WRITER_H #include "mapRegistrationKernelWriterBase.h" #include "mapInvertingRegistrationKernel.h" namespace map { namespace io { /*! @class InvertingKernelWriter * @brief Provider that is able to store field based kernels based on the class InvertingFiledBasedKernels (thus lazy field * based kernels that invert an other kernel) if the source kernel is part of the registration instance that should be stored. * * The writer will only store the information to indicated, that the other kernel of the registration should be used (by inversion) * to "load" the stored kernel. The writer can only handle request that do not force expansion of lazy kernels. * * @sa FieldBasedRegistrationKernel * @ingroup RegOperation * @tparam VInputDimensions Dimensions of the input space of the kernel that should be inverted. * @tparam VOutputDimensions Dimensions of the output space of the kernel that should be inverted. */ template class InvertingKernelWriter : public RegistrationKernelWriterBase { public: /*! Standard class typedefs. */ typedef InvertingKernelWriter Self; typedef RegistrationKernelWriterBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(InvertingKernelWriter, RegistrationKernelWriterBase); itkNewMacro(Self); - typedef typename Superclass::KernelBaseType KernelBaseType; - typedef typename Superclass::KernelBasePointer KernelBasePointer; - typedef typename Superclass::RequestType RequestType; + using KernelBaseType = typename Superclass::KernelBaseType; + using KernelBasePointer = typename Superclass::KernelBasePointer; + using RequestType = typename Superclass::RequestType; typedef core::InvertingRegistrationKernel KernelType; /*! Uses the passed request data to check if the provider is able to provide the service for * this request. Thus if the kernel is field based with a concrete vector field or expanding is * wanted anyway. * @return Indicates if the provider offers the right solution. * @retval true Provider can handle the request. * @retval false Provider is not able to handle the request.*/ virtual bool canHandleRequest(const RequestType& request) const; /*! Returns an ID of the provider as string. Calls getStaticProviderName(). * @return Service provider ID.*/ virtual core::String getProviderName() const; /*! Returns an ID of the provider as string. * @return Service provider ID.*/ static core::String getStaticProviderName(); /*! Returns an ID of the provider as string. May be equal to GetClassName(), but it may differ. * @return Service provider ID. * @remark It is a return by value, because it might be possible that the description is generated on line * when calling this method.*/ virtual core::String getDescription() const; /*! Generates the inverse kernel. * Returns a structured element containing the matrix. * @eguarantee strong * @param [in] request reference to the request that contains the kernel and all relevant information for the storing process. * @return Smart pointer to structured date element containing the stored information. */ virtual structuredData::Element::Pointer storeKernel(const RequestType& request) const; protected: InvertingKernelWriter(); virtual ~InvertingKernelWriter() {}; private: InvertingKernelWriter(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace io } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapInvertingKernelWriter.tpp" #endif #endif diff --git a/Code/IO/include/mapKernelLoaderLoadPolicy.h b/Code/IO/include/mapKernelLoaderLoadPolicy.h index eb46fcf..beb4b26 100644 --- a/Code/IO/include/mapKernelLoaderLoadPolicy.h +++ b/Code/IO/include/mapKernelLoaderLoadPolicy.h @@ -1,79 +1,79 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_KERNEL_LOADER_LOAD_POLICY_H #define __MAP_KERNEL_LOADER_LOAD_POLICY_H #include "mapGenericStaticLoadPolicyBase.h" #include "mapRegistrationKernelLoaderBase.h" #include "mapMAPIOExports.h" namespace map { namespace io { /*! @class KernelLoaderLoadPolicy * @brief Load class used by RegistrationFileLoader to populate its service stacks. * * It loads the following providers: * - MatrixModelBasedKernelLoader<2,2> * - MatrixModelBasedKernelLoader<3,3> * - InvertingKernelLoader<2,2> * - InvertingKernelLoader<3,3> * - LazyFileFieldKernelLoader<2,2> * - LazyFileFieldKernelLoader<3,3> * - FieldKernelLoader<2,2> * - FieldKernelLoader<3,3> * - NullKernelLoader<2,2> * - NullKernelLoader<2,3> * - NullKernelLoader<3,3> * - NullKernelLoader<3,2> * . * @ingroup LoadPolicies * @ingroup RegOperation * @sa RegistrationFileReader */ class MAPIO_EXPORT KernelLoaderLoadPolicy : public ::map::core::services::GenericStaticLoadPolicyBase { protected: /*! Standard class typedefs. */ - typedef core::services::GenericStaticLoadPolicyBase Superclass; - typedef Superclass::ProviderBaseType ProviderBaseType; - typedef Superclass::ProviderBasePointer ProviderBasePointer; - typedef Superclass::LoadInterfaceType LoadInterfaceType; + using Superclass = core::services::GenericStaticLoadPolicyBase; + using ProviderBaseType = Superclass::ProviderBaseType; + using ProviderBasePointer = Superclass::ProviderBasePointer; + using LoadInterfaceType = Superclass::LoadInterfaceType; - virtual void doLoading(); + void doLoading() override; KernelLoaderLoadPolicy(); ~KernelLoaderLoadPolicy(); private: - KernelLoaderLoadPolicy(const KernelLoaderLoadPolicy&); //purposely not implemented - void operator=(const KernelLoaderLoadPolicy&); //purposely not implemented + KernelLoaderLoadPolicy(const KernelLoaderLoadPolicy&) = delete; //purposely not implemented + void operator=(const KernelLoaderLoadPolicy&) = delete; //purposely not implemented }; } // end namespace io } // end namespace map #endif diff --git a/Code/IO/include/mapKernelWriterLoadPolicy.h b/Code/IO/include/mapKernelWriterLoadPolicy.h index 98287cc..d6b536c 100644 --- a/Code/IO/include/mapKernelWriterLoadPolicy.h +++ b/Code/IO/include/mapKernelWriterLoadPolicy.h @@ -1,79 +1,79 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_KERNEL_WRITER_LOAD_POLICY_H #define __MAP_KERNEL_WRITER_LOAD_POLICY_H #include "mapGenericStaticLoadPolicyBase.h" #include "mapRegistrationKernelWriterBase.h" namespace map { namespace io { /*! @class KernelWriterLoadPolicy * @brief Load class used by RegistrationFileWriter to populate its service stacks. * * It loads the following providers: * - NullRegistrationKernelWriter * - InvertingKernelWriter * - MatrixModelBasedKernelWriter * - LazyFieldFileKernelWriter * - ExpandingFieldKernelWriter * . * @TODO Add missing writers * @ingroup LoadPolicies * @ingroup RegOperation * @sa RegistrationFileWriter * @tparam VInputDimensions Input dimensions of the registration that should be stored to file. * @tparam VOutputDimensions Output dimensions of the registration that should be stored to file. */ template class KernelWriterLoadPolicy : public ::map::core::services::GenericStaticLoadPolicyBase > { protected: /*! Standard class typedefs. */ typedef core::services::GenericStaticLoadPolicyBase > Superclass; - typedef typename Superclass::ProviderBaseType ProviderBaseType; - typedef typename Superclass::ProviderBasePointer ProviderBasePointer; - typedef typename Superclass::LoadInterfaceType LoadInterfaceType; + using ProviderBaseType = typename Superclass::ProviderBaseType; + using ProviderBasePointer = typename Superclass::ProviderBasePointer; + using LoadInterfaceType = typename Superclass::LoadInterfaceType; - virtual void doLoading(); + void doLoading() override; KernelWriterLoadPolicy(); ~KernelWriterLoadPolicy(); private: - KernelWriterLoadPolicy(const KernelWriterLoadPolicy&); //purposely not implemented - void operator=(const KernelWriterLoadPolicy&); //purposely not implemented + KernelWriterLoadPolicy(const KernelWriterLoadPolicy&) = delete; //purposely not implemented + void operator=(const KernelWriterLoadPolicy&) = delete; //purposely not implemented }; } // end namespace io } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapKernelWriterLoadPolicy.tpp" #endif #endif diff --git a/Code/IO/include/mapKernelWriterLoadPolicy.tpp b/Code/IO/include/mapKernelWriterLoadPolicy.tpp index 978f348..4a61019 100644 --- a/Code/IO/include/mapKernelWriterLoadPolicy.tpp +++ b/Code/IO/include/mapKernelWriterLoadPolicy.tpp @@ -1,115 +1,115 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_KERNEL_WRITER_LOAD_POLICY_TPP #define __MAP_KERNEL_WRITER_LOAD_POLICY_TPP #include "mapKernelWriterLoadPolicy.h" #include "mapServiceRepositoryPolicyLoadInterface.h" #include "mapMatrixModelBasedKernelWriter.h" #include "mapNullRegistrationKernelWriter.h" #include "mapExpandingFieldKernelWriter.h" #include "mapInvertingKernelWriter.h" #include "mapLazyFieldFileKernelWriter.h" namespace map { namespace io { template void KernelWriterLoadPolicy:: doLoading() { ::map::core::services::ServiceRepositoryPolicyLoader loader( Superclass::_pLoadInterface); typedef ExpandingFieldKernelWriter ExpandingFieldKernelWriterType; typename ExpandingFieldKernelWriterType::Pointer spExpandingFieldWriter = ExpandingFieldKernelWriterType::New(); if (!loader.addProviderByPolicy(spExpandingFieldWriter)) { mapLogWarningObjMacro("ExpandingFieldKernelWriter was not added because it was already on the service stack!"); } typedef LazyFieldFileKernelWriter LazyFieldFileKernelWriterType; typename LazyFieldFileKernelWriterType::Pointer spLazyFileWriter = LazyFieldFileKernelWriterType::New(); if (!loader.addProviderByPolicy(spLazyFileWriter)) { mapLogWarningObjMacro("LazyFieldFileKernelWriter was not added because it was already on the service stack!"); } typedef MatrixModelBasedKernelWriter ModelKernelWriterType; typename ModelKernelWriterType::Pointer spModelWriter = ModelKernelWriterType::New(); if (!loader.addProviderByPolicy(spModelWriter)) { mapLogWarningObjMacro("MatrixModelBasedKernelWriter was not added because it was already on the service stack!"); } typedef InvertingKernelWriter InvertingKernelWriterType; typename InvertingKernelWriterType::Pointer spInvertingFieldWriter = InvertingKernelWriterType::New(); if (!loader.addProviderByPolicy(spInvertingFieldWriter)) { mapLogWarningObjMacro("InvertingKernelWriter was not added because it was already on the service stack!"); } typedef NullRegistrationKernelWriter NullKernelWriterType; typename NullKernelWriterType::Pointer spNullWriter = NullKernelWriterType::New(); if (!loader.addProviderByPolicy(spNullWriter)) { mapLogWarningObjMacro("NullRegistrationKernelWriter was not added because it was already on the service stack!"); } } template KernelWriterLoadPolicy:: - KernelWriterLoadPolicy() { } + KernelWriterLoadPolicy() = default; template KernelWriterLoadPolicy:: - ~KernelWriterLoadPolicy() { } + ~KernelWriterLoadPolicy() = default; } // end namespace io } // end namespace map #endif diff --git a/Code/IO/include/mapLazyFieldFileKernelWriter.h b/Code/IO/include/mapLazyFieldFileKernelWriter.h index 0013ffd..b3c61e6 100644 --- a/Code/IO/include/mapLazyFieldFileKernelWriter.h +++ b/Code/IO/include/mapLazyFieldFileKernelWriter.h @@ -1,109 +1,109 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_LAZY_FIELD_FILE_KERNEL_WRITER_H #define __MAP_LAZY_FIELD_FILE_KERNEL_WRITER_H #include "mapRegistrationKernelWriterBase.h" #include "mapLazyRegistrationKernel.h" namespace map { namespace io { /*! @class LazyFieldFileKernelWriter * @brief Provider that is able to store lazy field based kernels that use a FieldByFileLoad functor. * * The writer always copies the file defined FieldByFileLoad functor to the new location defined by the current write operation. * * @sa FieldBasedRegistrationKernel * @ingroup RegOperation * @tparam VInputDimensions Dimensions of the input space of the kernel that should be inverted. * @tparam VOutputDimensions Dimensions of the output space of the kernel that should be inverted. */ template class LazyFieldFileKernelWriter : public RegistrationKernelWriterBase { public: /*! Standard class typedefs. */ typedef LazyFieldFileKernelWriter Self; typedef RegistrationKernelWriterBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(LazyFieldFileKernelWriter, RegistrationKernelWriterBase); itkNewMacro(Self); - typedef typename Superclass::KernelBaseType KernelBaseType; - typedef typename Superclass::KernelBasePointer KernelBasePointer; - typedef typename Superclass::RequestType RequestType; + using KernelBaseType = typename Superclass::KernelBaseType; + using KernelBasePointer = typename Superclass::KernelBasePointer; + using RequestType = typename Superclass::RequestType; typedef core::LazyRegistrationKernel KernelType; /*! Uses the passed request data to check if the provider is able to provide the service for * this request. Thus if the kernel is field based with a concrete vector field or expanding is * wanted anyway. * @return Indicates if the provider offers the right solution. * @retval true Provider can handle the request. * @retval false Provider is not able to handle the request.*/ virtual bool canHandleRequest(const RequestType& request) const; /*! Returns an ID of the provider as string. Calls getStaticProviderName(). * @return Service provider ID.*/ virtual core::String getProviderName() const; /*! Returns an ID of the provider as string. * @return Service provider ID.*/ static core::String getStaticProviderName(); /*! Returns an ID of the provider as string. May be equal to GetClassName(), but it may differ. * @return Service provider ID. * @remark It is a return by value, becaus it might be possible that the description is generated on line * when calling this method.*/ virtual core::String getDescription() const; /*! Generates the inverse kernel. * Returns a structured element containing the matrix. * @eguarantee strong * @param [in] request Referenz to the request that contains the kernel and all relevant information for the storing process. * @return Smart pointer to structured date element containing the stored information. */ virtual structuredData::Element::Pointer storeKernel(const RequestType& request) const; protected: LazyFieldFileKernelWriter(); virtual ~LazyFieldFileKernelWriter() {}; private: LazyFieldFileKernelWriter(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace io } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapLazyFieldFileKernelWriter.tpp" #endif #endif diff --git a/Code/IO/include/mapLazyFileFieldKernelLoader.h b/Code/IO/include/mapLazyFileFieldKernelLoader.h index c714727..72ebaa7 100644 --- a/Code/IO/include/mapLazyFileFieldKernelLoader.h +++ b/Code/IO/include/mapLazyFileFieldKernelLoader.h @@ -1,109 +1,109 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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: 797 $ (last changed revision) // @date $Date: 2014-10-10 11:42:05 +0200 (Fr, 10 Okt 2014) $ (last change date) // @author $Author: floca $ (last changed by) // Subversion HeadURL: $HeadURL: https://svn/sbr/Sources/SBR-Projects/MatchPoint/trunk/Code/IO/include/mapLazyFileFieldKernelLoader.h $ */ #ifndef __MAP_LAZY_FILE_FIELD_KERNEL_LOADER_H #define __MAP_LAZY_FILE_FIELD_KERNEL_LOADER_H #include "mapFieldKernelLoaderBase.h" #include "mapLazyRegistrationKernel.h" namespace map { namespace io { /*! @class LazyFileFieldKernelLoader * @brief Provider that is able to load expanded field kernels, but uses a lazy loading scheme (on demand via functor). * * @sa FieldBasedRegistrationKernels * @ingroup RegOperation * @tparam VInputDimensions Dimensions of the input space of the kernel that should be inverted. * @tparam VOutputDimensions Dimensions of the output space of the kernel that should be inverted. */ template class LazyFileFieldKernelLoader : public FieldKernelLoaderBase { public: /*! Standard class typedefs. */ typedef LazyFileFieldKernelLoader Self; typedef FieldKernelLoaderBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(LazyFileFieldKernelLoader, FieldKernelLoaderBase); itkNewMacro(Self); typedef core::RegistrationKernel KernelBaseType; - typedef typename KernelBaseType::Pointer KernelBasePointer; - typedef typename Superclass::RequestType RequestType; + using KernelBasePointer = typename KernelBaseType::Pointer; + using RequestType = typename Superclass::RequestType; - typedef typename Superclass::GenericKernelType GenericKernelType; - typedef typename Superclass::GenericKernelPointer GenericKernelPointer; + using GenericKernelType = typename Superclass::GenericKernelType; + using GenericKernelPointer = typename Superclass::GenericKernelPointer; /*! Uses the passed request data to check if the provider is able to provide the service for * this request. Thus if the kernel is an expanded field kernel * @return Indicates if the provider offers the right solution. * @retval true Provider can handle the request. * @retval false Provider is not able to handle the request.*/ virtual bool canHandleRequest(const RequestType& request) const; /*! Returns an ID of the provider as string. Calls getStaticProviderName(). * @return Service provider ID.*/ virtual core::String getProviderName() const; /*! Returns an ID of the provider as string. * @return Service provider ID.*/ static core::String getStaticProviderName(); /*! Returns an ID of the provider as string. May be equal to GetClassName(), but it may differ. * @return Service provider ID. * @remark It is a return by value, because it might be possible that the description is generated on line * when calling this method.*/ virtual core::String getDescription() const; /*! Loads kernel. * Returns a smart pointer to the loaded kernel specified by the request. * The methods throws exceptions if the request is invalid. * @eguarantee strong * @param [in] request Reference to the request that contains the loading information * @return Smart pointer to the loaded kernel. * @pre request must be valid. */ virtual GenericKernelPointer loadKernel(const RequestType& request) const; protected: LazyFileFieldKernelLoader(); virtual ~LazyFileFieldKernelLoader() {}; private: LazyFileFieldKernelLoader(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace io } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapLazyFileFieldKernelLoader.tpp" #endif #endif diff --git a/Code/IO/include/mapMatrixModelBasedKernelLoader.h b/Code/IO/include/mapMatrixModelBasedKernelLoader.h index bfd4390..3425726 100644 --- a/Code/IO/include/mapMatrixModelBasedKernelLoader.h +++ b/Code/IO/include/mapMatrixModelBasedKernelLoader.h @@ -1,128 +1,128 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_MATRIX_MODEL_BASED_KERNEL_LOADER_H #define __MAP_MATRIX_MODEL_BASED_KERNEL_LOADER_H #include "mapRegistrationKernelLoaderBase.h" #include "mapRegistrationKernelBase.h" namespace map { namespace io { /*! @class MatrixModelBasedKernelLoader * @brief Provider that is able to load MatrixModelBasedKernels. * * @remark The loader is kept for backwards compatibility. We do not have the MatrixModelBasedKernel * any more. It is now covered by the PreCachedRegistrationKernel. But the loader/writer are usefull * if the transform is matrix based in order to store it directly in the matchpoint xml file. * @sa PreCachedRegistrationKernel * @ingroup RegOperation * @tparam VInputDimensions Dimensions of the input space of the kernel that should be inverted. */ template class MatrixModelBasedKernelLoader : public RegistrationKernelLoaderBase { public: /*! Standard class typedefs. */ - typedef MatrixModelBasedKernelLoader Self; - typedef RegistrationKernelLoaderBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Self = MatrixModelBasedKernelLoader; + using Superclass = RegistrationKernelLoaderBase; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(MatrixModelBasedKernelLoader, RegistrationKernelLoaderBase); itkNewMacro(Self); typedef core::RegistrationKernelBase KernelBaseType; - typedef typename KernelBaseType::Pointer KernelBasePointer; - typedef typename Superclass::RequestType RequestType; + using KernelBasePointer = typename KernelBaseType::Pointer; + using RequestType = typename Superclass::RequestType; /*! Uses the passed request data to check if the provider is able to provide the service for * this request. Thus if the kernel is model based and a matrix * @return Indicates if the provider offers the right solution. * @retval true Provider can handle the request. * @retval false Provider is not able to handle the request.*/ - virtual bool canHandleRequest(const RequestType& request) const; + bool canHandleRequest(const RequestType& request) const override; /*! Returns an ID of the provider as string. Calls getStaticProviderName(). * @return Service provider ID.*/ - virtual core::String getProviderName() const; + core::String getProviderName() const override; /*! Returns an ID of the provider as string. * @return Service provider ID.*/ static core::String getStaticProviderName(); /*! Returns an ID of the provider as string. May be equal to GetClassName(), but it may differ. * @return Service provider ID. * @remark It is a return by value, because it might be possible that the description is generated on line * when calling this method.*/ - virtual core::String getDescription() const; + core::String getDescription() const override; /*! Loads kernel. * Returns a smart pointer to the loaded kernel specified by the request. * The methods throws exceptions if the request is invalid. * @eguarantee strong * @param [in] request Reference to the request that contains the loading information * @return Smart pointer to the loaded kernel. * @pre request must be valid. */ - virtual GenericKernelPointer loadKernel(const RequestType& request) const; + GenericKernelPointer loadKernel(const RequestType& request) const override; /*! Adds a given generic kernel to the passed registration as inverse kernel. * @eguarantee strong * @param [in] pKernel pointer to the kernel that should be added if the Pointer is null a fitting registration object will be created. * @param [in] pRegistration pointer to the registration that should receive the kernel * @pre pKernel must be valid and of correct dimensionality or NULL. * @pre pRegistration must be valid and of correct dimensionality. */ - virtual void addAsInverseKernel(GenericKernelType* pKernel, - ::map::core::RegistrationBase::Pointer& spRegistration) const; + void addAsInverseKernel(GenericKernelType* pKernel, + ::map::core::RegistrationBase::Pointer& spRegistration) const override; /*! Adds a given generic kernel to the passed registration as direct kernel. * @eguarantee strong * @param [in] pKernel pointer to the kernel that should be added if the Pointer is null a fitting registration object will be created. * @param [in] pRegistration pointer to the registration that should receive the kernel * @pre pKernel must be valid and of correct dimensionality or NULL. * @pre pRegistration must be valid and of correct dimensionality. */ - virtual void addAsDirectKernel(GenericKernelType* pKernel, - core::RegistrationBase::Pointer& spRegistration) const; + void addAsDirectKernel(GenericKernelType* pKernel, + core::RegistrationBase::Pointer& spRegistration) const override; protected: MatrixModelBasedKernelLoader(); - virtual ~MatrixModelBasedKernelLoader() {}; + ~MatrixModelBasedKernelLoader() override {}; private: MatrixModelBasedKernelLoader(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace io } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapMatrixModelBasedKernelLoader.tpp" #endif #endif diff --git a/Code/IO/include/mapMatrixModelBasedKernelWriter.h b/Code/IO/include/mapMatrixModelBasedKernelWriter.h index 6d9c967..2fc2afd 100644 --- a/Code/IO/include/mapMatrixModelBasedKernelWriter.h +++ b/Code/IO/include/mapMatrixModelBasedKernelWriter.h @@ -1,109 +1,109 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_MATRIX_MODEL_BASED_KERNEL_WRITER_H #define __MAP_MATRIX_MODEL_BASED_KERNEL_WRITER_H #include "mapRegistrationKernelWriterBase.h" #include "mapPreCachedRegistrationKernel.h" namespace map { namespace io { /*! @class MatrixModelBasedKernelWriter * @brief Provider that is able to store PreCachedRegistrationKernel that are based on a matrix. * * If the tranformation model of the given kernel is based on a matrix * the writer will directly store it in the SDElement. * * @sa ModelBasedRegistrationKernel * @ingroup RegOperation * @tparam VInputDimensions Dimensions of the input space of the kernel that should be inverted. * @tparam VOutputDimensions Dimensions of the output space of the kernel that should be inverted. */ template class MatrixModelBasedKernelWriter : public RegistrationKernelWriterBase { public: /*! Standard class typedefs. */ typedef MatrixModelBasedKernelWriter Self; typedef RegistrationKernelWriterBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(MatrixModelBasedKernelWriter, RegistrationKernelWriterBase); itkNewMacro(Self); - typedef typename Superclass::KernelBaseType KernelBaseType; - typedef typename Superclass::KernelBasePointer KernelBasePointer; - typedef typename Superclass::RequestType RequestType; + using KernelBaseType = typename Superclass::KernelBaseType; + using KernelBasePointer = typename Superclass::KernelBasePointer; + using RequestType = typename Superclass::RequestType; typedef core::PreCachedRegistrationKernel KernelType; /*! Uses the passed request data to check if the provider is able to provide the service for * this request. Thus if the kernel is model based and a matrix * @return Indicates if the provider offers the right solution. * @retval true Provider can handle the request. * @retval false Provider is not able to handle the request.*/ virtual bool canHandleRequest(const RequestType& request) const; /*! Returns an ID of the provider as string. Calls getStaticProviderName(). * @return Service provider ID.*/ virtual core::String getProviderName() const; /*! Returns an ID of the provider as string. * @return Service provider ID.*/ static core::String getStaticProviderName(); /*! Returns an ID of the provider as string. May be equal to GetClassName(), but it may differ. * @return Service provider ID. * @remark It is a return by value, becaus it might be possible that the description is generated on line * when calling this method.*/ virtual core::String getDescription() const; /*! Generates the inverse kernel. * Returns a structured element containing the matrix. * @eguarantee strong * @param [in] request Referenz to the request that contains the kernel and all relevant information for the storing process. * @return Smart pointer to structured date element containing the stored information. */ virtual structuredData::Element::Pointer storeKernel(const RequestType& request) const; protected: MatrixModelBasedKernelWriter(); virtual ~MatrixModelBasedKernelWriter() {}; private: MatrixModelBasedKernelWriter(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace io } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapMatrixModelBasedKernelWriter.tpp" #endif #endif diff --git a/Code/IO/include/mapNullRegistrationKernelLoader.h b/Code/IO/include/mapNullRegistrationKernelLoader.h index 0a57b1e..33ee3d8 100644 --- a/Code/IO/include/mapNullRegistrationKernelLoader.h +++ b/Code/IO/include/mapNullRegistrationKernelLoader.h @@ -1,127 +1,127 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_NULL_REGISTRATION_KERNEL_LOADER_H #define __MAP_NULL_REGISTRATION_KERNEL_LOADER_H #include "mapRegistrationKernelLoaderBase.h" #include "mapNullRegistrationKernel.h" namespace map { namespace io { /*! @class NullRegistrationKernelLoader * @brief Provider that is able to load NullRegistrationKernels. * * @sa PreCachedRegistrationKernel * @ingroup RegOperation * @tparam VInputDimensions Dimensions of the input space of the kernel that should be inverted. * @tparam VOutputDimensions Dimensions of the output space of the kernel that should be inverted. */ template class NullRegistrationKernelLoader : public RegistrationKernelLoaderBase { public: /*! Standard class typedefs. */ typedef NullRegistrationKernelLoader Self; - typedef RegistrationKernelLoaderBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Superclass = RegistrationKernelLoaderBase; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(NullRegistrationKernelLoader, RegistrationKernelLoaderBase); itkNewMacro(Self); typedef core::RegistrationKernelBase KernelBaseType; - typedef typename KernelBaseType::Pointer KernelBasePointer; - typedef typename Superclass::RequestType RequestType; + using KernelBasePointer = typename KernelBaseType::Pointer; + using RequestType = typename Superclass::RequestType; typedef core::NullRegistrationKernel KernelType; /*! Uses the passed request data to check if the provider is able to provide the service for * this request. Thus if the kernel is model based and a matrix * @return Indicates if the provider offers the right solution. * @retval true Provider can handle the request. * @retval false Provider is not able to handle the request.*/ - virtual bool canHandleRequest(const RequestType& request) const; + bool canHandleRequest(const RequestType& request) const override; /*! Returns an ID of the provider as string. Calls getStaticProviderName(). * @return Service provider ID.*/ - virtual core::String getProviderName() const; + core::String getProviderName() const override; /*! Returns an ID of the provider as string. * @return Service provider ID.*/ static core::String getStaticProviderName(); /*! Returns an ID of the provider as string. May be equal to GetClassName(), but it may differ. * @return Service provider ID. * @remark It is a return by value, becaus it might be possible that the description is generated on line * when calling this method.*/ - virtual core::String getDescription() const; + core::String getDescription() const override; /*! Loads kernel. * Returns a smart pointer to the loaded kernel specified by the request. * The methods throws exceptions if the request is invalid. * @eguarantee strong * @param [in] request Reference to the request that contains the loadingh information * @return Smart pointer to the loaded kernel. * @pre request must be valid. */ - virtual GenericKernelPointer loadKernel(const RequestType& request) const; + GenericKernelPointer loadKernel(const RequestType& request) const override; /*! Adds a given generic kernel to the passed registration as inverse kernel. * @eguarantee strong * @param [in] pKernel pointer to the kernel that should be added if the Pointer is null a fitting registration object will be created. * @param [in] pRegistration pointer to the registration that should receive the kernel * @pre pKernel must be valid and of correct dimensionality or NULL. * @pre pRegistration must be valid and of correct dimensionality. */ - virtual void addAsInverseKernel(GenericKernelType* pKernel, - ::map::core::RegistrationBase::Pointer& spRegistration) const; + void addAsInverseKernel(GenericKernelType* pKernel, + ::map::core::RegistrationBase::Pointer& spRegistration) const override; /*! Adds a given generic kernel to the passed registration as direct kernel. * @eguarantee strong * @param [in] pKernel pointer to the kernel that should be added if the Pointer is null a fitting registration object will be created. * @param [in] pRegistration pointer to the registration that should receive the kernel * @pre pKernel must be valid and of correct dimensionality or NULL. * @pre pRegistration must be valid and of correct dimensionality. */ - virtual void addAsDirectKernel(GenericKernelType* pKernel, - core::RegistrationBase::Pointer& spRegistration) const; + void addAsDirectKernel(GenericKernelType* pKernel, + core::RegistrationBase::Pointer& spRegistration) const override; protected: NullRegistrationKernelLoader(); - virtual ~NullRegistrationKernelLoader() {}; + ~NullRegistrationKernelLoader() override {}; private: NullRegistrationKernelLoader(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace io } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapNullRegistrationKernelLoader.tpp" #endif #endif diff --git a/Code/IO/include/mapNullRegistrationKernelWriter.h b/Code/IO/include/mapNullRegistrationKernelWriter.h index ca6309f..626126a 100644 --- a/Code/IO/include/mapNullRegistrationKernelWriter.h +++ b/Code/IO/include/mapNullRegistrationKernelWriter.h @@ -1,106 +1,106 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_NULL_REGISTRATION_KERNEL_WRITER_H #define __MAP_NULL_REGISTRATION_KERNEL_WRITER_H #include "mapRegistrationKernelWriterBase.h" #include "mapNullRegistrationKernel.h" namespace map { namespace io { /*! @class NullRegistrationKernelWriter * @brief Provider that is able to store NullRegistrationKernels. * * @sa NullRegistrationKernel * @ingroup RegOperation * @tparam VInputDimensions Dimensions of the input space of the kernel that should be inverted. * @tparam VOutputDimensions Dimensions of the output space of the kernel that should be inverted. */ template class NullRegistrationKernelWriter : public RegistrationKernelWriterBase { public: /*! Standard class typedefs. */ typedef NullRegistrationKernelWriter Self; typedef RegistrationKernelWriterBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(NullRegistrationKernelWriter, RegistrationKernelWriterBase); itkNewMacro(Self); - typedef typename Superclass::KernelBaseType KernelBaseType; - typedef typename Superclass::KernelBasePointer KernelBasePointer; - typedef typename Superclass::RequestType RequestType; + using KernelBaseType = typename Superclass::KernelBaseType; + using KernelBasePointer = typename Superclass::KernelBasePointer; + using RequestType = typename Superclass::RequestType; typedef core::NullRegistrationKernel KernelType; /*! Uses the passed request data to check if the provider is able to provide the service for * this request. Thus if the kernel is model based and a matrix * @return Indicates if the provider offers the right solution. * @retval true Provider can handle the request. * @retval false Provider is not able to handle the request.*/ virtual bool canHandleRequest(const RequestType& request) const; /*! Returns an ID of the provider as string. Calls getStaticProviderName(). * @return Service provider ID.*/ virtual core::String getProviderName() const; /*! Returns an ID of the provider as string. * @return Service provider ID.*/ static core::String getStaticProviderName(); /*! Returns an ID of the provider as string. May be equal to GetClassName(), but it may differ. * @return Service provider ID. * @remark It is a return by value, becaus it might be possible that the description is generated on line * when calling this method.*/ virtual core::String getDescription() const; /*! Generates the inverse kernel. * Returns a structured element containing the matrix. * @eguarantee strong * @param [in] request Referenz to the request that contains the kernel and all relevant information for the storing process. * @return Smart pointer to structured date element containing the stored information. */ virtual structuredData::Element::Pointer storeKernel(const RequestType& request) const; protected: NullRegistrationKernelWriter(); virtual ~NullRegistrationKernelWriter() {}; private: NullRegistrationKernelWriter(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace io } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapNullRegistrationKernelWriter.tpp" #endif #endif diff --git a/Code/IO/include/mapRegistrationFileReader.h b/Code/IO/include/mapRegistrationFileReader.h index ff52268..0187377 100644 --- a/Code/IO/include/mapRegistrationFileReader.h +++ b/Code/IO/include/mapRegistrationFileReader.h @@ -1,111 +1,111 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_REGISTRATION_FILE_READER_H #define __MAP_REGISTRATION_FILE_READER_H #include "itkObject.h" #include "mapStaticServiceStack.h" #include "mapRegistrationKernelLoaderBase.h" #include "mapRegistration.h" #include "mapKernelLoaderLoadPolicy.h" #include "mapMAPIOExports.h" namespace map { namespace io { /*! @class RegistrationFileReader * @brief Class loads a registration object stored in a file. * * This class is used to load registration from file(s).\n * To load the registrations the class uses a static service stack populated with * RegistrationKernelLoaders for the direct and the inverse mapping direction. * You can change the stack content by the static class methods of the member typedef KernelLoaderStackType.\n * * @ingroup RegOperation * @ingroup Registration */ class MAPIO_EXPORT RegistrationFileReader: public itk::Object { public: /*! Standard class typedefs. */ - typedef RegistrationFileReader Self; - typedef itk::Object Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Self = RegistrationFileReader; + using Superclass = itk::Object; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(RegistrationFileReader, itk::Object); itkNewMacro(Self); - typedef RegistrationKernelLoaderBase KernelLoaderBaseType; + using KernelLoaderBaseType = RegistrationKernelLoaderBase; - typedef core::RegistrationBase LoadedRegistrationType; - typedef core::RegistrationBase::Pointer LoadedRegistrationPointer; + using LoadedRegistrationType = core::RegistrationBase; + using LoadedRegistrationPointer = core::RegistrationBase::Pointer; protected: typedef core::services::ServiceStack ConcreteLoaderStackType; public: - typedef core::services::StaticServiceStack LoaderStackType; + using LoaderStackType = core::services::StaticServiceStack; /*! Reads the registration from the file and returns the object. * The method throws expceptions if the there is a registration kernel stored with no suitable kernel reader. * @pre the file must exist from where to read. * @pre the process must have the rights to open and read the file. * @eguarantee strong * @param [in] registrationFile string that specifies the location of the registration file. * @return Smart pointer to the loaded registration. */ LoadedRegistrationPointer read(const core::String& registrationFile) const; /*! gets _preferLazyLoading */ bool getPreferLazyLoading() const; /*! Sets _preferLazzyLoading . */ void setPreferLazyLoading(bool preferLazyLoading); protected: RegistrationFileReader(); - virtual ~RegistrationFileReader(); + ~RegistrationFileReader() override; /*! Indicicates if the KernelLoader should prefer lazzy loading when loading a kernel takes a lot resources. * (e.g. loading a field kernel with a large vector field: preferring lazy loading would only keep the reference to the * file. The field wouldn't be loaded until realy needed to save memory. If lazy loading isn't preferred it is directly * loaded, thus it can be directly used, but maybe unnecessarily occupies memory space. */ - bool _preferLazyLoading; + bool _preferLazyLoading{true}; /*! Methods invoked by itk::LightObject::Print(). */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: - RegistrationFileReader(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented + RegistrationFileReader(const Self&) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; } // end namespace io } // end namespace map #endif diff --git a/Code/IO/include/mapRegistrationFileTags.h b/Code/IO/include/mapRegistrationFileTags.h index 027e1d3..1bcf6a1 100644 --- a/Code/IO/include/mapRegistrationFileTags.h +++ b/Code/IO/include/mapRegistrationFileTags.h @@ -1,63 +1,63 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_REGISTRATION_FILE_TAGS_H #define __MAP_REGISTRATION_FILE_TAGS_H namespace map { namespace tags { const char* const Registration = "Registration"; const char* const RegistrationTag = "Tag"; const char* const RegistrationTagName = "Name"; const char* const MovingDimensions = "MovingDimensions"; const char* const TargetDimensions = "TargetDimensions"; const char* const InputDimensions = "InputDimensions"; const char* const OutputDimensions = "OutputDimensions"; const char* const Kernel = "Kernel"; const char* const KernelID = "ID"; const char* const StreamProvider = "StreamProvider"; const char* const KernelType = "KernelType"; const char* const direct = "direct"; const char* const inverse = "inverse"; const char* const Matrix = "Matrix"; const char* const Offset = "Offset"; const char* const MatrixStr = "MatrixStr"; const char* const OffsetStr = "OffsetStr"; const char* const FieldPath = "FieldPath"; const char* const NullPoint = "NullPoint"; const char* const UseNullPoint = "UseNullPoint"; const char* const InverseFieldRepresentation = "InverseFieldRepresentation"; //This is an legacy tag. It is deprecated and should not be used activaly any more. const char* const NullVector = "NullVector"; //This is an legacy tag. It is deprecated and should not be used activaly any more. const char* const UseNullVector = "UseNullVector"; - } -} + } // namespace tags +} // namespace map #endif diff --git a/Code/IO/include/mapRegistrationFileWriter.h b/Code/IO/include/mapRegistrationFileWriter.h index 4602735..2c10039 100644 --- a/Code/IO/include/mapRegistrationFileWriter.h +++ b/Code/IO/include/mapRegistrationFileWriter.h @@ -1,124 +1,122 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_REGISTRATION_FILE_WRITER_H #define __MAP_REGISTRATION_FILE_WRITER_H #include "mapStaticServiceStack.h" #include "mapRegistrationKernelWriterBase.h" #include "mapRegistration.h" #include "mapKernelWriterLoadPolicy.h" #include "mapString.h" #include "itkObject.h" namespace map { namespace io { /*! @class RegistrationFileWriter * @brief Class stores a registration object in a file. * * This class is used to store registration to file(s).\n * To store the registrations the class uses a static service stack populated with * RegistrationKernelWriters. * You can change the stack content by the static class methods of the member typedef DirectKernelWriterStackType or InverseKernelWriterStackType.\n * * @ingroup RegOperation * @ingroup Registration * @tparam VMovingDimensions Dimensions of the moving space of the registration. * @tparam VTargetDimensions Dimensions of the target space of the registration. * @tparam TLoadPolicy the load policy that should be used for the provider stack of the recombinator. */ template class RegistrationFileWriter: public itk::Object { public: /*! Standard class typedefs. */ typedef RegistrationFileWriter Self; - typedef itk::Object Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Superclass = itk::Object; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(RegistrationFileWriter, itk::Object); itkNewMacro(Self); typedef core::Registration RegistrationType; - typedef typename RegistrationType::Pointer RegistrationPointer; + using RegistrationPointer = typename RegistrationType::Pointer; itkStaticConstMacro(MovingDimensions, unsigned int, VMovingDimensions); itkStaticConstMacro(TargetDimensions, unsigned int, VTargetDimensions); typedef RegistrationKernelWriterBase DirectKernelWriterBaseType; typedef RegistrationKernelWriterBase InverseKernelWriterBaseType; protected: typedef core::services::ServiceStack > ConcreteDirectKernelWriterStackType; typedef core::services::ServiceStack > ConcreteInverseKernelWriterStackType; public: - typedef core::services::StaticServiceStack - DirectKernelWriterStackType; - typedef core::services::StaticServiceStack - InverseKernelWriterStackType; + using DirectKernelWriterStackType = core::services::StaticServiceStack; + using InverseKernelWriterStackType = core::services::StaticServiceStack; /*! Stores the passed registration in the specified path. * @eguarantee strong * @param [in] registration Pointer to the registration. * @param [in] path Defines the file path were the registration should be stored. The write process * may generate more then one file in the specified directory depending on the kernels to store. * @pre registration must point to a valid instance. */ bool write(const RegistrationType* registration, const core::String& path) const; bool getExpandLazyKernels() const; void setExpandLazyKernels(bool expandLazyKernels); protected: RegistrationFileWriter(); - virtual ~RegistrationFileWriter(); + ~RegistrationFileWriter() override; /*! Determines if lazy kernels that have not been processed should be stored with there generation functors (false) * or should be generated and stored with the actual kernel data (true). Default is true.*/ - bool _expandLazyKernels; + bool _expandLazyKernels{true}; /*! Methods invoked by itk::LightObject::Print(). */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: RegistrationFileWriter(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace io } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapRegistrationFileWriter.tpp" #endif #endif diff --git a/Code/IO/include/mapRegistrationFileWriter.tpp b/Code/IO/include/mapRegistrationFileWriter.tpp index 30944c8..8d8e055 100644 --- a/Code/IO/include/mapRegistrationFileWriter.tpp +++ b/Code/IO/include/mapRegistrationFileWriter.tpp @@ -1,158 +1,158 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_REGISTRATION_FILE_WRITER_TPP #define __MAP_REGISTRATION_FILE_WRITER_TPP #include "mapRegistrationFileWriter.h" #include "mapRegistrationManipulator.h" #include "mapMissingProviderException.h" #include "mapRegistrationFileTags.h" #include "mapSDXMLFileWriter.h" #include "mapFileDispatch.h" #include "mapConvert.h" namespace map { namespace io { template bool RegistrationFileWriter:: write(const RegistrationType* registration, const core::String& path) const { if (!registration) { mapDefaultExceptionMacro( << "Cannot serialize registration. Passed registration object is NULL."); } ::map::core::String fileName = core::FileDispatch::getName(path); ::map::core::String dir = core::FileDispatch::getPath(path); typename DirectKernelWriterBaseType::RequestType directRequest(registration->getDirectMapping(), dir, fileName + "_D", _expandLazyKernels, &(registration->getInverseMapping())); typename InverseKernelWriterBaseType::RequestType inverseRequest(registration->getInverseMapping(), dir, fileName + "_I", _expandLazyKernels, &(registration->getDirectMapping())); DirectKernelWriterBaseType* pDirectWriter = DirectKernelWriterStackType::getProvider(directRequest); InverseKernelWriterBaseType* pInverseWriter = InverseKernelWriterStackType::getProvider( inverseRequest); mapLogInfoMacro( << "Write registration. Registration: " << registration << std::endl); if (!pDirectWriter) { mapExceptionMacro(::map::core::MissingProviderException, << "No responsible writer available for given direct request. Request:" << directRequest); } if (!pInverseWriter) { mapExceptionMacro(::map::core::MissingProviderException, << "No responsible writer available for given inverse request. Request:" << inverseRequest); } structuredData::Element::Pointer spDirectKernelStream = pDirectWriter->storeKernel(directRequest); structuredData::Element::Pointer spInverseKernelStream = pInverseWriter->storeKernel( inverseRequest); assert(spDirectKernelStream.IsNotNull()); assert(spInverseKernelStream.IsNotNull()); structuredData::Element::Pointer spRegElement = structuredData::Element::New(); spRegElement->setTag(tags::Registration); //add tags ::map::core::RegistrationBase::TagMapType tagMap = registration->getTags(); - for (::map::core::RegistrationBase::TagMapType::iterator pos = tagMap.begin(); pos != tagMap.end(); ++pos) + for (auto & pos : tagMap) { structuredData::Element::Pointer spTagElement = structuredData::Element::New(); spTagElement->setTag(tags::RegistrationTag); - spTagElement->setValue(pos->second); - spTagElement->setAttribute(tags::RegistrationTagName, pos->first); + spTagElement->setValue(pos.second); + spTagElement->setAttribute(tags::RegistrationTagName, pos.first); spRegElement->addSubElement(spTagElement); } //add dimensions spRegElement->addSubElement(structuredData::Element::createElement(tags::MovingDimensions, ::map::core::convert::toStr(registration->getMovingDimensions()))); spRegElement->addSubElement(structuredData::Element::createElement(tags::TargetDimensions, ::map::core::convert::toStr(registration->getTargetDimensions()))); //add kernels spDirectKernelStream->setAttribute(tags::KernelID, tags::direct); spInverseKernelStream->setAttribute(tags::KernelID, tags::inverse); spRegElement->addSubElement(spDirectKernelStream); spRegElement->addSubElement(spInverseKernelStream); //store in file structuredData::XMLFileWriter::Pointer spWriter = structuredData::XMLFileWriter::New(); spWriter->write(path, spRegElement); return true; } template void RegistrationFileWriter:: PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "ExpandLazyKernels: " << _expandLazyKernels << std::endl; } template RegistrationFileWriter:: - RegistrationFileWriter(): _expandLazyKernels(true) + RegistrationFileWriter() {} template RegistrationFileWriter:: ~RegistrationFileWriter() - {} + = default; template bool RegistrationFileWriter:: getExpandLazyKernels() const { return _expandLazyKernels; } template void RegistrationFileWriter:: setExpandLazyKernels(bool expandLazyKernels) { _expandLazyKernels = expandLazyKernels; } } // end namespace io } // end namespace map #endif diff --git a/Code/IO/include/mapRegistrationKernelLoadRequest.h b/Code/IO/include/mapRegistrationKernelLoadRequest.h index 4ad61c5..8cb12a8 100644 --- a/Code/IO/include/mapRegistrationKernelLoadRequest.h +++ b/Code/IO/include/mapRegistrationKernelLoadRequest.h @@ -1,72 +1,72 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_REGISTRATION_KERNEL_LOAD_REQUEST_H #define __MAP_REGISTRATION_KERNEL_LOAD_REQUEST_H #include "mapSDElement.h" #include "mapMAPIOExports.h" #include "mapDimensionlessRegistrationKernelBase.h" namespace map { namespace io { /*! @class RegistrationKernelLoadRequest * @brief Request class used by RegistrationFileReader and RegistrationKernelLoaderBase. * * This class is used as request type for the provider stack of RegistrationFileReader. * @ingroup RegOperation * @sa RegistrationFileReader */ class MAPIO_EXPORT RegistrationKernelLoadRequest { public: /*! Descriptor for the kernel that should be loaded.*/ structuredData::Element::ConstPointer _spKernelDescriptor; /*! Optional information that specifies the "sibling" kernel of the registration instance _spKernelDescriptor * is a part of. * Default value is NULL, indicating that there is no sibling or it should not regarded in the loading request.*/ ::map::core::DimensionlessRegistrationKernelBase::ConstPointer _spComplementaryKernel; bool _preferLazyLoading; /*! Constructor * \pre pKernelDescriptor must not be NULL*/ RegistrationKernelLoadRequest(const structuredData::Element* pKernelDescriptor, bool preferLazyLoading, const core::DimensionlessRegistrationKernelBase* pComplementaryKernel = - NULL); + nullptr); ~RegistrationKernelLoadRequest(); - RegistrationKernelLoadRequest(const RegistrationKernelLoadRequest&); - void operator=(const RegistrationKernelLoadRequest&); + RegistrationKernelLoadRequest(const RegistrationKernelLoadRequest& /*request*/); + void operator=(const RegistrationKernelLoadRequest& /*request*/); }; std::ostream& operator<<(std::ostream& os, const RegistrationKernelLoadRequest& request); } // end namespace io } // end namespace map #endif diff --git a/Code/IO/include/mapRegistrationKernelLoaderBase.h b/Code/IO/include/mapRegistrationKernelLoaderBase.h index f9f103b..6654f46 100644 --- a/Code/IO/include/mapRegistrationKernelLoaderBase.h +++ b/Code/IO/include/mapRegistrationKernelLoaderBase.h @@ -1,108 +1,108 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_REGISTRATION_KERNEL_LOADER_BASE_H #define __MAP_REGISTRATION_KERNEL_LOADER_BASE_H #include "mapServiceProvider.h" #include "mapRegistrationKernelLoadRequest.h" #include "mapRegistrationKernelBase.h" #include "mapRegistrationTopology.h" #include "mapRegistrationBase.h" #include "mapMAPIOExports.h" namespace map { namespace io { /*! @class RegistrationKernelLoaderBase * @brief Base class for any instance in MatchPoint that provides the service of registration kernel loading. * * @ingroup RegOperation */ class MAPIO_EXPORT RegistrationKernelLoaderBase : public ::map::core::services::ServiceProvider< RegistrationKernelLoadRequest > { public: - typedef RegistrationKernelLoadRequest RequestType; + using RequestType = RegistrationKernelLoadRequest; /*! Standard class typedefs. */ - typedef RegistrationKernelLoaderBase Self; - typedef core::services::ServiceProvider Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Self = RegistrationKernelLoaderBase; + using Superclass = core::services::ServiceProvider; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; - typedef itk::Object GenericKernelType; - typedef itk::Object::Pointer GenericKernelPointer; + using GenericKernelType = itk::Object; + using GenericKernelPointer = itk::Object::Pointer; itkTypeMacro(RegistrationKernelLoaderBase, ServiceProvider); /*! Loads kernel. * Returns a smart pointer to the loaded kernel specified by the request. * The methods throws exceptions if the request is invalid. * @eguarantee strong * @param [in] request Reference to the request that contains the loadingh information * @param [in] preferLazzyLoading Indicates if the kernel should use lazy loading if possible (e.g. a vector field is not directly * loaded. Only a functor is used that references the file and loads the field on demand) * @return Smart pointer to the loaded kernel. * @pre request must be valid. */ virtual GenericKernelPointer loadKernel(const RequestType& request) const = 0; /*! Adds a given generic kernel to the passed registration as inverse kernel. * @eguarantee strong * @param [in] pKernel pointer to the kernel that should be added if the Pointer is null a fitting registration object will be created. * @param [in] pRegistration pointer to the registration that should receive the kernel * @pre pKernel must be valid and of correct dimensionality or NULL. * @pre pRegistration must be valid and of correct dimensionality. */ virtual void addAsInverseKernel(GenericKernelType* pKernel, ::map::core::RegistrationBase::Pointer& spRegistration) const = 0; /*! Adds a given generic kernel to the passed registration as direct kernel. * @eguarantee strong * @param [in] pKernel pointer to the kernel that should be added if the Pointer is null a fitting registration object will be created. * @param [in] pRegistration pointer to the registration that should receive the kernel * @pre pKernel must be valid and of correct dimensionality or NULL. * @pre pRegistration must be valid and of correct dimensionality. */ virtual void addAsDirectKernel(GenericKernelType* pKernel, core::RegistrationBase::Pointer& spRegistration) const = 0; protected: /*! Methods invoked by itk::LightObject::Print(). */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; RegistrationKernelLoaderBase(); - virtual ~RegistrationKernelLoaderBase(); + ~RegistrationKernelLoaderBase() override; private: - RegistrationKernelLoaderBase(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented + RegistrationKernelLoaderBase(const Self&) = delete; //purposely not implemented + void operator=(const Self&) = delete; //purposely not implemented }; } // end namespace io } // end namespace map #endif diff --git a/Code/IO/include/mapRegistrationKernelWriteRequest.h b/Code/IO/include/mapRegistrationKernelWriteRequest.h index 44c4cf2..d93e5fa 100644 --- a/Code/IO/include/mapRegistrationKernelWriteRequest.h +++ b/Code/IO/include/mapRegistrationKernelWriteRequest.h @@ -1,125 +1,125 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_REGISTRATION_KERNEL_WRITE_REQUEST_H #define __MAP_REGISTRATION_KERNEL_WRITE_REQUEST_H #include "mapRegistrationKernelBase.h" namespace map { namespace io { /*! @class RegistrationKernelWriteRequest * @brief Request class used by RegistrationKernelWriterBase / RegistrationFileWriter. * * This class is used as request type for the provider stack of RegistrationCombinator * @ingroup RegOperation * @sa RegistrationFileWriter * @tparam VInputDimensions Dimensions of the input space of the first kernel. * @tparam VOutputDimensions Dimensions of the output space of the second kernel. */ template class RegistrationKernelWriteRequest { public: typedef core::RegistrationKernelBase KernelBaseType; - typedef typename KernelBaseType::ConstPointer KernelBaseConstPointer; + using KernelBaseConstPointer = typename KernelBaseType::ConstPointer; typedef core::RegistrationKernelBase ComplementaryKernelBaseType; - typedef typename ComplementaryKernelBaseType::ConstPointer ComplementaryKernelConstPointer; + using ComplementaryKernelConstPointer = typename ComplementaryKernelBaseType::ConstPointer; /*! Kernel that should be stored with this request*/ KernelBaseConstPointer _spKernel; /*! Optional information that specifies the "sibling" kernel of the registration instance _spKernel * is a part of. * Default value is NULL, indicating that there is no sibling or it should not regarded in the request.*/ ComplementaryKernelConstPointer _spComplementaryKernel; /*! Path to where the kernel is going to be stored and additional data *(e.g. image of the deformation field) should be stored).*/ ::map::core::String _path; /*! "Project name" for the write operation which can be used to generate i.a. file names * if needed*/ ::map::core::String _name; /*! Determines if lazy kernels that have not been processed should be stored with there generation functors (false) * or should be generated and stored with the actual kernel data (true). Default is true.*/ bool _expandLazyKernels; /*! Constructor * \pre pKernel1 and pKernel2 must not be NULL*/ RegistrationKernelWriteRequest(const KernelBaseType* pKernel, const core::String& path, const core::String& name, bool expandLazyKernels, const ComplementaryKernelBaseType* pComplementaryKernel = NULL); - RegistrationKernelWriteRequest(const KernelBaseType& kernel, const core::String& path, - const core::String& name, bool expandLazyKernels, + RegistrationKernelWriteRequest(const KernelBaseType& kernel, core::String path, + core::String name, bool expandLazyKernels, const ComplementaryKernelBaseType* pComplementaryKernel = NULL); ~RegistrationKernelWriteRequest(); - RegistrationKernelWriteRequest(const RegistrationKernelWriteRequest&); - void operator=(const RegistrationKernelWriteRequest&); + RegistrationKernelWriteRequest(const RegistrationKernelWriteRequest& /*req*/); + void operator=(const RegistrationKernelWriteRequest& /*req*/); }; template std::ostream& operator<<(std::ostream& os, const RegistrationKernelWriteRequest& request) { os << "Kernel: "; if (request._spKernel.IsNull()) { os << "NULL" << std::endl; } else { os << request._spKernel << std::endl; } os << "Path: " << request._path << std::endl; os << "Name: " << request._name << std::endl; os << "ExpandLazyKernels: " << request._expandLazyKernels << std::endl; os << "Complementary Kernel: "; if (request._spComplementaryKernel.IsNull()) { os << "NULL" << std::endl; } else { os << request._spComplementaryKernel << std::endl; } return os; }; } // end namespace io } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapRegistrationKernelWriteRequest.tpp" #endif #endif diff --git a/Code/IO/include/mapRegistrationKernelWriteRequest.tpp b/Code/IO/include/mapRegistrationKernelWriteRequest.tpp index 92ea8b6..e578c8e 100644 --- a/Code/IO/include/mapRegistrationKernelWriteRequest.tpp +++ b/Code/IO/include/mapRegistrationKernelWriteRequest.tpp @@ -1,90 +1,90 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_REGISTRATION_KERNEL_WRITE_REQUEST_TPP #define __MAP_REGISTRATION_KERNEL_WRITE_REQUEST_TPP #include "mapRegistrationKernelWriteRequest.h" namespace map { namespace io { template RegistrationKernelWriteRequest:: RegistrationKernelWriteRequest(const KernelBaseType* pKernel, const core::String& path, const core::String& name, bool expandLazyKernels, const ComplementaryKernelBaseType* pComplementaryKernel): _spKernel(pKernel), _path(path), _name(name), _expandLazyKernels(expandLazyKernels), _spComplementaryKernel(pComplementaryKernel) { assert(pKernel); } template RegistrationKernelWriteRequest:: - RegistrationKernelWriteRequest(const KernelBaseType& kernel, const core::String& path, - const core::String& name, bool expandLazyKernels, + RegistrationKernelWriteRequest(const KernelBaseType& kernel, core::String path, + core::String name, bool expandLazyKernels, const ComplementaryKernelBaseType* pComplementaryKernel): - _spKernel(&kernel), _path(path), _name(name), _expandLazyKernels(expandLazyKernels), + _spKernel(&kernel), _path(std::move(path)), _name(std::move(name)), _expandLazyKernels(expandLazyKernels), _spComplementaryKernel(pComplementaryKernel) { }; template RegistrationKernelWriteRequest:: ~RegistrationKernelWriteRequest() { // intentionally left blank } template RegistrationKernelWriteRequest:: RegistrationKernelWriteRequest(const RegistrationKernelWriteRequest& req): _spKernel(req._spKernel), _path(req._path), _name(req._name), _expandLazyKernels(req._expandLazyKernels) { assert(_spKernel.IsNotNull()); } template void RegistrationKernelWriteRequest:: operator=(const RegistrationKernelWriteRequest& req) { if (&req != this) { _spKernel = req._spKernel; _path = req._path; _name = req._name; _expandLazyKernels = req._expandLazyKernels; _spComplementaryKernel = req._spComplementaryKernel; } } } // end namespace io } // end namespace map #endif diff --git a/Code/IO/include/mapRegistrationKernelWriterBase.h b/Code/IO/include/mapRegistrationKernelWriterBase.h index 8335b33..3ce5ea9 100644 --- a/Code/IO/include/mapRegistrationKernelWriterBase.h +++ b/Code/IO/include/mapRegistrationKernelWriterBase.h @@ -1,99 +1,99 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_REGISTRATION_KERNEL_WRITER_BASE_H #define __MAP_REGISTRATION_KERNEL_WRITER_BASE_H #include "mapServiceProvider.h" #include "mapRegistrationKernelWriteRequest.h" #include "mapRegistrationKernelBase.h" #include "mapSDElement.h" namespace map { namespace io { /*! @class RegistrationKernelWriterBase * @brief Base class for any instance in MatchPoint that provides the service of registration kernel combination. * * @ingroup RegOperation * @tparam VInputDimensions Dimensions of the input space of the first kernel. * @tparam VInterimDimensions Dimensions of the output space of the first kernel and the input space of the second. * @tparam VOutputDimensions Dimensions of the output space of the second kernel. */ template class RegistrationKernelWriterBase : public ::map::core::services::ServiceProvider< RegistrationKernelWriteRequest< VInputDimensions, VOutputDimensions> > { public: typedef core::RegistrationKernelBase KernelBaseType; - typedef typename KernelBaseType::Pointer KernelBasePointer; + using KernelBasePointer = typename KernelBaseType::Pointer; typedef RegistrationKernelWriteRequest RequestType; - typedef core::FieldRepresentationDescriptor InputFieldRepresentationType; + using InputFieldRepresentationType = core::FieldRepresentationDescriptor; itkStaticConstMacro(InputDimensions, unsigned int, VInputDimensions); itkStaticConstMacro(OutputDimensions, unsigned int, VOutputDimensions); /*! Standard class typedefs. */ typedef RegistrationKernelWriterBase Self; - typedef core::services::ServiceProvider Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Superclass = core::services::ServiceProvider; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; itkTypeMacro(RegistrationKernelWriterBase, ServiceProvider); /*! Combines two kernel. * Returns a smart pointer to a structured data element that containes all information of the stored kernel. * Depending on the kernel, associated data may have allready stored in the file system to the location specified * by the request (e.g. a Field kernel storing the field as vector image and returning the information in the * structuredData::Element.). * @eguarantee strong * @param [in] request Referenz to the request that contains the kernel and all relevant information for the storing process. * @return Smart pointer to structured date element containing the stored information. */ virtual structuredData::Element::Pointer storeKernel(const RequestType& request) const = 0; protected: /*! Methods invoked by itk::LightObject::Print(). */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; RegistrationKernelWriterBase(); - virtual ~RegistrationKernelWriterBase(); + ~RegistrationKernelWriterBase() override; private: RegistrationKernelWriterBase(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace io } // end namespace map #ifndef MatchPoint_MANUAL_TPP # include "mapRegistrationKernelWriterBase.tpp" #endif #endif diff --git a/Code/IO/source/mapGenericImageReader.cpp b/Code/IO/source/mapGenericImageReader.cpp index 4061ff3..b7b0ba7 100644 --- a/Code/IO/source/mapGenericImageReader.cpp +++ b/Code/IO/source/mapGenericImageReader.cpp @@ -1,385 +1,384 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapGenericImageReader.h" namespace map { namespace io { //////////////////////////////////////////////////////////////////////// /// Implementation of map::GenericImageReader //////////////////////////////// //////////////////////////////////////////////////////////////////////// void GenericImageReader:: load() { - _spImage = NULL; + _spImage = nullptr; ::map::core::String probeFileName = this->_fileName; if (this->_seriesReadStyle == ImageSeriesReadStyle::Numeric) { - typedef ::itk::NumericSeriesFileNames NamesType; + using NamesType = ::itk::NumericSeriesFileNames; NamesType::Pointer names = NamesType::New(); names->SetStartIndex(1); names->SetEndIndex(1); names->SetSeriesFormat(this->_fileName.c_str()); probeFileName = names->GetFileNames()[0]; } ::itk::ImageIOBase::Pointer imageIO = ::itk::ImageIOFactory::CreateImageIO(probeFileName.c_str(), ::itk::ImageIOFactory::ReadMode); - if (!imageIO) + if (imageIO == nullptr) { mapDefaultExceptionMacro( << "No ImageIO found for given file. Please check if the file exists and has a supported format. File:" << probeFileName); return; } // Now that we found the appropriate ImageIO class, ask it to // read the meta data from the image file. imageIO->SetFileName(probeFileName.c_str()); imageIO->ReadImageInformation(); this->_loadedComponentType = imageIO->GetComponentType(); this->_loadedPixelType = imageIO->GetPixelType(); if (this->_loadedPixelType == ::itk::ImageIOBase::RGB && imageIO->GetNumberOfComponents() == 1) { //if only one channel per pixel handle as scalar as long as RGB etc. is not supported this->_loadedPixelType = ::itk::ImageIOBase::SCALAR; } this->_loadedComponentTypeStr = imageIO->GetComponentTypeAsString(this->_loadedComponentType); this->_loadedPixelTypeStr = imageIO->GetPixelTypeAsString(this->_loadedPixelType); this->_loadedDimensions = imageIO->GetNumberOfDimensions(); if (this->_seriesReadStyle == ImageSeriesReadStyle::Numeric && this->_loadedDimensions == 2) { this->_loadedDimensions = 3; //it is a stack of 2D images -> 3D } if (this->_loadedDimensions < 2 || this->_loadedDimensions > 3) { mapDefaultExceptionMacro( << "The file uses a number of dimensions that is not supported in this application. PixelType: " << this->_loadedPixelTypeStr << "; ComponentType: " << this->_loadedComponentTypeStr << "; Number of dimension: " << this->_loadedDimensions); } switch (_loadedPixelType) { case ::itk::ImageIOBase::SCALAR: { if (this->_loadedDimensions == 2) { loadScalar<2>(); } else { loadScalar<3>(); } break; } default: { mapDefaultExceptionMacro( << "The file uses a pixel type that is not supported in this application. PixelType: " << this->_loadedPixelTypeStr << "; ComponentType: " << this->_loadedComponentTypeStr << "; Number of pixel channels: " << imageIO->GetNumberOfComponents() << "; Number of image dimensions: " << this->_loadedDimensions); } } _upToDate = true; }; template void GenericImageReader:: loadScalar() { // Use the pixel type to instantiate the appropriate reader switch (this->_loadedComponentType) { case ::itk::ImageIOBase::UCHAR: { this->_spImage = readImage(_fileName, _seriesReadStyle, false, 0, 0, _upperSeriesLimit, &_dictionaryArray); break; } case ::itk::ImageIOBase::CHAR: { this->_spImage = readImage(_fileName, _seriesReadStyle, false, 0, 0, _upperSeriesLimit, &_dictionaryArray); break; } case ::itk::ImageIOBase::USHORT: { this->_spImage = readImage(_fileName, _seriesReadStyle, false, 0, 0, _upperSeriesLimit, &_dictionaryArray); break; } case ::itk::ImageIOBase::SHORT: { this->_spImage = readImage(_fileName, _seriesReadStyle, false, 0, 0, _upperSeriesLimit, &_dictionaryArray); break; } case ::itk::ImageIOBase::UINT: { this->_spImage = readImage(_fileName, _seriesReadStyle, false, 0, 0, _upperSeriesLimit, &_dictionaryArray); break; } case ::itk::ImageIOBase::INT: { this->_spImage = readImage(_fileName, _seriesReadStyle, false, 0, 0, _upperSeriesLimit, &_dictionaryArray); break; } case ::itk::ImageIOBase::ULONG: { this->_spImage = readImage(_fileName, _seriesReadStyle, false, 0, 0, _upperSeriesLimit, &_dictionaryArray); break; } case ::itk::ImageIOBase::LONG: { this->_spImage = readImage(_fileName, _seriesReadStyle, false, 0, 0, _upperSeriesLimit, &_dictionaryArray); break; } case ::itk::ImageIOBase::FLOAT: { this->_spImage = readImage(_fileName, _seriesReadStyle, false, 0, 0, _upperSeriesLimit, &_dictionaryArray); break; } case ::itk::ImageIOBase::DOUBLE: { this->_spImage = readImage(_fileName, _seriesReadStyle, false, 0, 0, _upperSeriesLimit, &_dictionaryArray); break; } default: { mapDefaultExceptionMacro( << "The file uses a pixel component type that is not supported in this application. PixelType: " << this->_loadedPixelTypeStr << "; ComponentType: " << this->_loadedComponentTypeStr << "; Number of dimension: " << this->_loadedDimensions); } } }; //template //void // GenericImageReader:: // loadRGB() //{ // assert(false); // mapDefaultExceptionStaticMacro(<<"RGB support is yet not implemented."); // switch( this->_loadedComponentType ) // { // case ::itk::ImageIOBase::UCHAR: // { // this->_spImage = readImageA< ::itk::RGBPixel, ::itk::RGBPixel, IDimension>(_fileName,_seriesReadStyle); // break; // } // case ::itk::ImageIOBase::CHAR: // { // this->_spImage = readImageA< ::itk::RGBPixel, ::itk::RGBPixel, IDimension>(_fileName,_seriesReadStyle); // break; // } // case ::itk::ImageIOBase::USHORT: // { // this->_spImage = readImageA< ::itk::RGBPixel, ::itk::RGBPixel, IDimension>(_fileName,_seriesReadStyle); // break; // } // case ::itk::ImageIOBase::SHORT: // { // this->_spImage = readImageA< ::itk::RGBPixel, ::itk::RGBPixel, IDimension>(_fileName,_seriesReadStyle); // break; // } // case ::itk::ImageIOBase::UINT: // { // this->_spImage = readImageA< ::itk::RGBPixel, ::itk::RGBPixel, IDimension>(_fileName,_seriesReadStyle); // break; // } // case ::itk::ImageIOBase::INT: // { // this->_spImage = readImageA< ::itk::RGBPixel, ::itk::RGBPixel, IDimension>(_fileName,_seriesReadStyle); // break; // } // case ::itk::ImageIOBase::ULONG: // { // this->_spImage = readImageA< ::itk::RGBPixel, ::itk::RGBPixel, IDimension>(_fileName,_seriesReadStyle); // break; // } // case ::itk::ImageIOBase::LONG: // { // this->_spImage = readImageA< ::itk::RGBPixel, ::itk::RGBPixel, IDimension>(_fileName,_seriesReadStyle); // break; // } // case ::itk::ImageIOBase::FLOAT: // { // this->_spImage = readImageA< ::itk::RGBPixel, ::itk::RGBPixel, IDimension>(_fileName,_seriesReadStyle); // break; // } // case ::itk::ImageIOBase::DOUBLE: // { // this->_spImage = readImageA< ::itk::RGBPixel, ::itk::RGBPixel, IDimension>(_fileName,_seriesReadStyle); // break; // } // default: // { // mapDefaultExceptionMacro(<<"The file uses a pixel component type that is not supported in this application. PixelType: "<_loadedPixelTypeStr<<"; ComponentType: "<_loadedComponentTypeStr<<"; Number of dimension: "<_loadedDimensions); // } // } //}; const core::String& GenericImageReader:: getFileName() const { return _fileName; }; void GenericImageReader:: setFileName(const core::String& fileName) { if (fileName != _fileName) { _upToDate = false; _fileName = fileName; } } - const unsigned int + unsigned int GenericImageReader:: getUpperSeriesLimit() const { return _upperSeriesLimit; }; void GenericImageReader:: setUpperSeriesLimit(const unsigned int upperLimit) { if (upperLimit != _upperSeriesLimit) { _upToDate = false; _upperSeriesLimit = upperLimit; }; }; - const ImageSeriesReadStyle::Type + ImageSeriesReadStyle::Type GenericImageReader:: getSeriesReadStyle() const { return _seriesReadStyle; }; void GenericImageReader:: setSeriesReadStyle(ImageSeriesReadStyle::Type readStyle) { if (readStyle != _seriesReadStyle) { _upToDate = false; _seriesReadStyle = readStyle; }; }; GenericImageReader::GenericOutputImageType* GenericImageReader:: GetOutput(unsigned int& loadedDimensions, LoadedPixelType& loadedPixelType, LoadedComponentType& loadedComponentType) { if (!_upToDate) { load(); loadedPixelType = _loadedPixelType; loadedComponentType = _loadedComponentType; loadedDimensions = _loadedDimensions; }; return _spImage; }; GenericImageReader:: GenericImageReader() { _fileName = ""; _upperSeriesLimit = 255; _upToDate = false; _seriesReadStyle = ImageSeriesReadStyle::Default; }; GenericImageReader:: ~GenericImageReader() - { - }; + = default; const GenericImageReader::MetaDataDictionaryArrayType& GenericImageReader:: getMetaDictionaryArray() { return _dictionaryArray; }; - } -} + } // namespace io +} // namespace map diff --git a/Code/IO/source/mapKernelLoaderLoadPolicy.cpp b/Code/IO/source/mapKernelLoaderLoadPolicy.cpp index 0c4550f..f7116fd 100644 --- a/Code/IO/source/mapKernelLoaderLoadPolicy.cpp +++ b/Code/IO/source/mapKernelLoaderLoadPolicy.cpp @@ -1,115 +1,115 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapKernelLoaderLoadPolicy.h" #include "mapServiceRepositoryPolicyLoadInterface.h" #include "mapMatrixModelBasedKernelLoader.h" #include "mapNullRegistrationKernelLoader.h" #include "mapFieldKernelLoader.h" #include "mapLazyFileFieldKernelLoader.h" #include "mapInvertingKernelLoader.h" namespace map { namespace io { void KernelLoaderLoadPolicy:: doLoading() { ::map::core::services::ServiceRepositoryPolicyLoader loader(_pLoadInterface); if (!loader.addProviderByPolicy(MatrixModelBasedKernelLoader<2>::New())) { mapLogWarningObjMacro("MatrixModelBasedKernelLoader<2> was not added because it was already on the service stack!"); } if (!loader.addProviderByPolicy(MatrixModelBasedKernelLoader<3>::New())) { mapLogWarningObjMacro("MatrixModelBasedKernelLoader<3> was not added because it was already on the service stack!"); } if (!loader.addProviderByPolicy(NullRegistrationKernelLoader<2, 2>::New())) { mapLogWarningObjMacro("NullRegistrationKernelLoader<2,2> was not added because it was already on the service stack!"); } if (!loader.addProviderByPolicy(NullRegistrationKernelLoader<2, 3>::New())) { mapLogWarningObjMacro("NullRegistrationKernelLoader<2,3> was not added because it was already on the service stack!"); } if (!loader.addProviderByPolicy(NullRegistrationKernelLoader<3, 3>::New())) { mapLogWarningObjMacro("NullRegistrationKernelLoader<3,3> was not added because it was already on the service stack!"); } if (!loader.addProviderByPolicy(NullRegistrationKernelLoader<3, 2>::New())) { mapLogWarningObjMacro("NullRegistrationKernelLoader<3,2> was not added because it was already on the service stack!"); } if (!loader.addProviderByPolicy(InvertingKernelLoader<2, 2>::New())) { mapLogWarningObjMacro("InvertingKernelLoader<2,2> was not added because it was already on the service stack!"); } if (!loader.addProviderByPolicy(InvertingKernelLoader<3, 3>::New())) { mapLogWarningObjMacro("InvertingKernelLoader<3,3> was not added because it was already on the service stack!"); } if (!loader.addProviderByPolicy(FieldKernelLoader<2, 2>::New())) { mapLogWarningObjMacro("FieldKernelLoader<2,2> was not added because it was already on the service stack!"); } if (!loader.addProviderByPolicy(FieldKernelLoader<3, 3>::New())) { mapLogWarningObjMacro("FieldKernelLoader<3,3> was not added because it was already on the service stack!"); } if (!loader.addProviderByPolicy(LazyFileFieldKernelLoader<2, 2>::New())) { mapLogWarningObjMacro("LazyFileFieldKernelLoader<2,2> was not added because it was already on the service stack!"); } if (!loader.addProviderByPolicy(LazyFileFieldKernelLoader<3, 3>::New())) { mapLogWarningObjMacro("LazyFileFieldKernelLoader<3,3> was not added because it was already on the service stack!"); } } KernelLoaderLoadPolicy:: - KernelLoaderLoadPolicy() { } + KernelLoaderLoadPolicy() = default; KernelLoaderLoadPolicy:: - ~KernelLoaderLoadPolicy() { } + ~KernelLoaderLoadPolicy() = default; } // end namespace io } // end namespace map diff --git a/Code/IO/source/mapRegistrationFileReader.cpp b/Code/IO/source/mapRegistrationFileReader.cpp index 554188c..cff8987 100644 --- a/Code/IO/source/mapRegistrationFileReader.cpp +++ b/Code/IO/source/mapRegistrationFileReader.cpp @@ -1,185 +1,185 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapRegistrationFileReader.h" #include "mapSDXMLFileReader.h" #include "mapMissingProviderException.h" #include "mapSDElement.h" #include "mapRegistrationFileTags.h" #include "mapRegistrationManipulator.h" namespace map { namespace io { RegistrationFileReader::LoadedRegistrationPointer RegistrationFileReader:: read(const core::String& registrationFile) const { structuredData::XMLFileReader::Pointer spReader = structuredData::XMLFileReader::New(); mapLogInfoMacro( << "Read registration file. File: " << registrationFile); structuredData::Element::Pointer spFileData = spReader->read(registrationFile); if (spFileData->getSubElementsCount() < 1) { mapDefaultExceptionMacro( << "Illegal registration file. No registration stored."); } //don't need the root, but the first sub element. spFileData = spFileData->getSubElement(0); - structuredData::Element::SubElementIteratorType directKernelPos = + auto directKernelPos = structuredData::findNextSubElement(spFileData->getSubElementBegin(), spFileData->getSubElementEnd(), tags::Kernel, tags::KernelID, tags::direct); if (directKernelPos == spFileData->getSubElementEnd()) { mapDefaultExceptionMacro( << "Illegal registration file. No direct kernel entry found"); } - structuredData::Element::SubElementIteratorType inverseKernelPos = + auto inverseKernelPos = structuredData::findNextSubElement(spFileData->getSubElementBegin(), spFileData->getSubElementEnd(), tags::Kernel, tags::KernelID, tags::inverse); if (inverseKernelPos == spFileData->getSubElementEnd()) { mapDefaultExceptionMacro( << "Illegal registration file. No inverse kernel entry found"); } KernelLoaderBaseType::RequestType directRequest(*directKernelPos, _preferLazyLoading); KernelLoaderBaseType::RequestType inverseRequest(*inverseKernelPos, _preferLazyLoading); KernelLoaderBaseType* pDirectLoader = LoaderStackType::getProvider(directRequest); KernelLoaderBaseType::GenericKernelPointer spDirectKernel; - if (!pDirectLoader) + if (pDirectLoader == nullptr) { mapLogDebugMacro( << "No responsible loader available for given direct request. Try to load inverse request first and retry with additional complementary kernel."); } else { spDirectKernel = pDirectLoader->loadKernel(directRequest); inverseRequest._spComplementaryKernel = dynamic_cast< ::map::core::DimensionlessRegistrationKernelBase*> (spDirectKernel.GetPointer()); } KernelLoaderBaseType* pInverseLoader = LoaderStackType::getProvider(inverseRequest); KernelLoaderBaseType::GenericKernelPointer spInverseKernel; - if (!pInverseLoader) + if (pInverseLoader == nullptr) { mapExceptionMacro(::map::core::MissingProviderException, << "No responsible loader available for given inverse request. Request:" << inverseRequest); } else { spInverseKernel = pInverseLoader->loadKernel(inverseRequest); } if (spDirectKernel.IsNull()) { //retry direct kernel loading with additional complimentary kernel information directRequest._spComplementaryKernel = dynamic_cast< ::map::core::DimensionlessRegistrationKernelBase*> (spInverseKernel.GetPointer()); pDirectLoader = LoaderStackType::getProvider(directRequest); - if (!pDirectLoader) + if (pDirectLoader == nullptr) { mapExceptionMacro(::map::core::MissingProviderException, << "No responsible loader available for given direct request. Request:" << directRequest); } spDirectKernel = pDirectLoader->loadKernel(directRequest); } LoadedRegistrationPointer spRegistration; pDirectLoader->addAsDirectKernel(spDirectKernel, spRegistration); pInverseLoader->addAsInverseKernel(spInverseKernel, spRegistration); //read registration tags ::map::core::RegistrationBaseManipulator manip(spRegistration); ::map::core::RegistrationBaseManipulator::TagMapType tagMap; - structuredData::Element::SubElementIteratorType pos = structuredData::findNextSubElement( + auto pos = structuredData::findNextSubElement( spFileData->getSubElementBegin(), spFileData->getSubElementEnd(), tags::RegistrationTag); while (pos != spFileData->getSubElementEnd()) { if (!(*pos)->attributeExists(tags::RegistrationTagName)) { mapLogInfoMacro( << "Error when reading registration. Tag is invalid, no tag name. Tag value: " << (*pos)->getValue()); } else { tagMap.insert(std::make_pair((*pos)->getAttribute(tags::RegistrationTagName), (*pos)->getValue())); } ++pos; } manip.setTagValues(tagMap); return spRegistration; } bool RegistrationFileReader:: getPreferLazyLoading() const { return _preferLazyLoading; } void RegistrationFileReader:: setPreferLazyLoading(bool preferLazyLoading) { _preferLazyLoading = preferLazyLoading; } void RegistrationFileReader:: PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "Prefere lazy loading :" << _preferLazyLoading << std::endl; } RegistrationFileReader:: - RegistrationFileReader(): _preferLazyLoading(true) + RegistrationFileReader() {} RegistrationFileReader:: ~RegistrationFileReader() - {} + = default; } // end namespace io } // end namespace map diff --git a/Code/IO/source/mapRegistrationKernelLoadRequest.cpp b/Code/IO/source/mapRegistrationKernelLoadRequest.cpp index 87a1c4d..76210d4 100644 --- a/Code/IO/source/mapRegistrationKernelLoadRequest.cpp +++ b/Code/IO/source/mapRegistrationKernelLoadRequest.cpp @@ -1,75 +1,74 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapRegistrationKernelLoadRequest.h" -#include +#include namespace map { namespace io { RegistrationKernelLoadRequest:: RegistrationKernelLoadRequest(const structuredData::Element* pKernelDescriptor, bool preferLazyLoading, const core::DimensionlessRegistrationKernelBase* pComplementaryKernel): _spKernelDescriptor( pKernelDescriptor), _preferLazyLoading(preferLazyLoading), _spComplementaryKernel(pComplementaryKernel) { assert(pKernelDescriptor); }; RegistrationKernelLoadRequest:: ~RegistrationKernelLoadRequest() - { - }; + = default; RegistrationKernelLoadRequest:: RegistrationKernelLoadRequest(const RegistrationKernelLoadRequest& request): _spKernelDescriptor( request._spKernelDescriptor), _preferLazyLoading(request._preferLazyLoading) { assert(_spKernelDescriptor.IsNotNull()); }; void RegistrationKernelLoadRequest:: operator=(const RegistrationKernelLoadRequest& request) { if (&request != this) { _spKernelDescriptor = request._spKernelDescriptor; _preferLazyLoading = request._preferLazyLoading; _spComplementaryKernel = request._spComplementaryKernel; } }; std::ostream& operator<<(std::ostream& os, const RegistrationKernelLoadRequest& request) { os << "Data: " << request._spKernelDescriptor << std::endl; os << "Lazy loading: " << request._preferLazyLoading << std::endl; os << "Complementary kernel: " << request._spComplementaryKernel << std::endl; return os; }; } // end namespace io } // end namespace map diff --git a/Code/IO/source/mapRegistrationKernelLoaderBase.cpp b/Code/IO/source/mapRegistrationKernelLoaderBase.cpp index 1392cba..7edf482 100644 --- a/Code/IO/source/mapRegistrationKernelLoaderBase.cpp +++ b/Code/IO/source/mapRegistrationKernelLoaderBase.cpp @@ -1,45 +1,45 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include "mapRegistrationKernelLoaderBase.h" namespace map { namespace io { void RegistrationKernelLoaderBase:: PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os, indent); }; RegistrationKernelLoaderBase:: RegistrationKernelLoaderBase() - {}; + = default; RegistrationKernelLoaderBase:: - ~RegistrationKernelLoaderBase() {}; + ~RegistrationKernelLoaderBase() = default; } // end namespace io } // end namespace map diff --git a/Code/ITK/include/itkMatrixOffsetBasedTranslationTransform.h b/Code/ITK/include/itkMatrixOffsetBasedTranslationTransform.h index 2ba204f..407f957 100644 --- a/Code/ITK/include/itkMatrixOffsetBasedTranslationTransform.h +++ b/Code/ITK/include/itkMatrixOffsetBasedTranslationTransform.h @@ -1,290 +1,290 @@ /*========================================================================= * * Copyright Insight Software Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *=========================================================================*/ #ifndef __itkMatrixOffsetBasedTranslationTransform_h #define __itkMatrixOffsetBasedTranslationTransform_h #include "itkMatrixOffsetTransformBase.h" #include namespace itk { /** * Translation transformation of a vector space (e.g. space coordinates) * * This class allows the definition and manipulation of translation * transformations of an n-dimensional affine space (and its * associated vector space) onto itself. One common use is to define * and manipulate Euclidean coordinate transformations in two and * three dimensions, but other uses are possible as well. * * This class serves the same purpose then itk::TranslationTransform. * But it is derived from MatrixOffsetTransformBase and can therfore * used wherever derived classes are assumed (e.g. itk::CenteredTransformInitializer) * * \ingroup ITKTransform */ template < typename TScalar = double, // Data type for scalars // (e.g. float or double) unsigned int NDimensions = 3 > // Number of dimensions in the input space class MatrixOffsetBasedTranslationTransform: public MatrixOffsetTransformBase< TScalar, NDimensions, NDimensions > { public: /** Standard typedefs */ - typedef MatrixOffsetBasedTranslationTransform Self; + using Self = MatrixOffsetBasedTranslationTransform; typedef MatrixOffsetTransformBase< TScalar, NDimensions, NDimensions > Superclass; - typedef SmartPointer< Self > Pointer; - typedef SmartPointer< const Self > ConstPointer; + using Pointer = SmartPointer; + using ConstPointer = SmartPointer; /** Run-time type information (and related methods). */ itkTypeMacro(MatrixOffsetBasedTranslationTransform, MatrixOffsetTransformBase); /** New macro for creation of through a Smart Pointer */ itkNewMacro(Self); /** Dimension of the domain space. */ itkStaticConstMacro(InputSpaceDimension, unsigned int, NDimensions); itkStaticConstMacro(OutputSpaceDimension, unsigned int, NDimensions); itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions); itkStaticConstMacro(ParametersDimension, unsigned int, NDimensions); /** Parameters Type */ - typedef typename Superclass::ParametersType ParametersType; - typedef typename Superclass::JacobianType JacobianType; - typedef typename Superclass::ScalarType ScalarType; - typedef typename Superclass::InputPointType InputPointType; - typedef typename Superclass::OutputPointType OutputPointType; - typedef typename Superclass::InputVectorType InputVectorType; - typedef typename Superclass::OutputVectorType OutputVectorType; - typedef typename Superclass::InputVnlVectorType InputVnlVectorType; - typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType; - typedef typename Superclass::InputCovariantVectorType InputCovariantVectorType; - typedef typename Superclass::OutputCovariantVectorType OutputCovariantVectorType; - typedef typename Superclass::MatrixType MatrixType; - typedef typename Superclass::InverseMatrixType InverseMatrixType; - typedef typename Superclass::CenterType CenterType; - typedef typename Superclass::OffsetType OffsetType; - typedef typename Superclass::TranslationType TranslationType; + using ParametersType = typename Superclass::ParametersType; + using JacobianType = typename Superclass::JacobianType; + using ScalarType = typename Superclass::ScalarType; + using InputPointType = typename Superclass::InputPointType; + using OutputPointType = typename Superclass::OutputPointType; + using InputVectorType = typename Superclass::InputVectorType; + using OutputVectorType = typename Superclass::OutputVectorType; + using InputVnlVectorType = typename Superclass::InputVnlVectorType; + using OutputVnlVectorType = typename Superclass::OutputVnlVectorType; + using InputCovariantVectorType = typename Superclass::InputCovariantVectorType; + using OutputCovariantVectorType = typename Superclass::OutputCovariantVectorType; + using MatrixType = typename Superclass::MatrixType; + using InverseMatrixType = typename Superclass::InverseMatrixType; + using CenterType = typename Superclass::CenterType; + using OffsetType = typename Superclass::OffsetType; + using TranslationType = typename Superclass::TranslationType; /** Base inverse transform type. This type should not be changed to the * concrete inverse transform type or inheritance would be lost.*/ - typedef typename Superclass::InverseTransformBaseType InverseTransformBaseType; - typedef typename InverseTransformBaseType::Pointer InverseTransformBasePointer; + using InverseTransformBaseType = typename Superclass::InverseTransformBaseType; + using InverseTransformBasePointer = typename InverseTransformBaseType::Pointer; /** Compose affine transformation with a translation * * This method modifies self to include a translation of the * origin. The translation is precomposed with self if pre is * true, and postcomposed otherwise. * This updates Translation based on current center. */ void Translate(const OutputVectorType& offset, bool pre = 0); /** Get an inverse of this transform. */ bool GetInverse(Self* inverse) const; /** Return an inverse of this transform. */ virtual InverseTransformBasePointer GetInverseTransform() const; /** Back transform by an affine transformation * * This method finds the point or vector that maps to a given * point or vector under the affine transformation defined by * self. If no such point exists, an exception is thrown. * * \deprecated Please use GetInverseTransform and then call the * forward transform function */ itkLegacyMacro(InputPointType BackTransform(const OutputPointType& point) const); itkLegacyMacro(InputVectorType BackTransform(const OutputVectorType& vector) const); itkLegacyMacro(InputVnlVectorType BackTransform(const OutputVnlVectorType& vector) const); itkLegacyMacro(InputCovariantVectorType BackTransform(const OutputCovariantVectorType& vector) const); /** Back transform a point by an affine transform * * This method finds the point that maps to a given point under * the affine transformation defined by self. If no such point * exists, an exception is thrown. The returned value is (a * pointer to) a brand new point created with new. * * \deprecated Please use GetInverseTransform and then call the * forward transform function */ itkLegacyMacro(InputPointType BackTransformPoint(const OutputPointType& point) const); virtual const ParametersType& GetParameters() const; virtual void SetParameters(const ParametersType& parameters); /** Set the fixed parameters and update internal * transformation. This transform has no fixed paramaters */ - virtual void SetFixedParameters(const ParametersType&) + virtual void SetFixedParameters(const ParametersType& /*unused*/) { } /** Get the fixed parameters */ - virtual const ParametersType& GetFixedParameters(void) const; + virtual const ParametersType& GetFixedParameters() const; /** Get the Jacobian matrix. */ virtual void ComputeJacobianWithRespectToParameters(const InputPointType& point, JacobianType& j) const; /** Get the jacobian with respect to position, which simply is the * matrix because the transform is position-invariant. * jac will be resized as needed, but it will be more efficient if * it is already properly sized. */ virtual void ComputeJacobianWithRespectToPosition(const InputPointType& x, JacobianType& jac) const; protected: /** Construct an MatrixOffsetBasedTranslationTransform object * * This method constructs a new MatrixOffsetBasedTranslationTransform object and * initializes the matrix and offset parts of the transformation * to values specified by the caller. If the arguments are * omitted, then the MatrixOffsetBasedTranslationTransform is initialized to an identity * transformation in the appropriate number of dimensions. */ MatrixOffsetBasedTranslationTransform(const MatrixType& matrix, const OutputVectorType& offset); MatrixOffsetBasedTranslationTransform(unsigned int paramDims); MatrixOffsetBasedTranslationTransform(); /** Destroy an MatrixOffsetBasedTranslationTransform object */ virtual ~MatrixOffsetBasedTranslationTransform(); /** Print contents of an MatrixOffsetBasedTranslationTransform */ void PrintSelf(std::ostream& s, Indent indent) const; private: JacobianType m_IdentityJacobian; MatrixOffsetBasedTranslationTransform(const Self& other); const Self& operator=(const Self&); }; //class MatrixOffsetBasedTranslationTransform #if !defined(ITK_LEGACY_REMOVE) /** Back transform a vector */ template< typename TScalar, unsigned int NDimensions > inline typename MatrixOffsetBasedTranslationTransform< TScalar, NDimensions >::InputVectorType MatrixOffsetBasedTranslationTransform< TScalar, NDimensions >::BackTransform( const OutputVectorType& vect) const { itkWarningMacro( << "BackTransform(): This method is slated to be removed " << "from ITK. Instead, please use GetInverse() to generate an inverse " << "transform and then perform the transform using that inverted transform."); return this->GetInverseMatrix() * vect; } /** Back transform a vnl_vector */ template< typename TScalar, unsigned int NDimensions > inline typename MatrixOffsetBasedTranslationTransform< TScalar, NDimensions >::InputVnlVectorType MatrixOffsetBasedTranslationTransform< TScalar, NDimensions >::BackTransform( const OutputVnlVectorType& vect) const { itkWarningMacro( << "BackTransform(): This method is slated to be removed " << "from ITK. Instead, please use GetInverse() to generate an inverse " << "transform and then perform the transform using that inverted transform."); return this->GetInverseMatrix() * vect; } /** Back Transform a CovariantVector */ template< typename TScalar, unsigned int NDimensions > inline typename MatrixOffsetBasedTranslationTransform< TScalar, NDimensions >::InputCovariantVectorType MatrixOffsetBasedTranslationTransform< TScalar, NDimensions >::BackTransform( const OutputCovariantVectorType& vec) const { itkWarningMacro( << "BackTransform(): This method is slated to be removed " << "from ITK. Instead, please use GetInverse() to generate an inverse " << "transform and then perform the transform using that inverted transform."); InputCovariantVectorType result; // Converted vector for (unsigned int i = 0; i < NDimensions; i++) { result[i] = NumericTraits< ScalarType >::Zero; for (unsigned int j = 0; j < NDimensions; j++) { result[i] += this->GetMatrix()[j][i] * vec[j]; // Direct matrix transposed } } return result; } /** Back transform a given point which is represented as type PointType */ template< typename TScalar, unsigned int NDimensions > inline typename MatrixOffsetBasedTranslationTransform< TScalar, NDimensions >::InputPointType MatrixOffsetBasedTranslationTransform< TScalar, NDimensions >::BackTransformPoint( const OutputPointType& point) const { return this->BackTransform(point); } /** Back transform a point */ template< typename TScalar, unsigned int NDimensions > inline typename MatrixOffsetBasedTranslationTransform< TScalar, NDimensions >::InputPointType MatrixOffsetBasedTranslationTransform< TScalar, NDimensions >::BackTransform( const OutputPointType& point) const { itkWarningMacro( << "BackTransform(): This method is slated to be removed " << "from ITK. Instead, please use GetInverse() to generate an inverse " << "transform and then perform the transform using that inverted transform."); InputPointType result; // Converted point ScalarType temp[NDimensions]; unsigned int i, j; for (j = 0; j < NDimensions; j++) { temp[j] = point[j] - this->GetOffset()[j]; } for (i = 0; i < NDimensions; i++) { result[i] = 0.0; for (j = 0; j < NDimensions; j++) { result[i] += this->GetInverseMatrix()[i][j] * temp[j]; } } return result; } #endif } // namespace itk #ifndef ITK_MANUAL_INSTANTIATION #include "itkMatrixOffsetBasedTranslationTransform.hxx" #endif #endif /* __itkMatrixOffsetBasedTranslationTransform_h */ diff --git a/Code/ITK/include/itkMatrixOffsetBasedTranslationTransform.hxx b/Code/ITK/include/itkMatrixOffsetBasedTranslationTransform.hxx index 484e442..aa1ef21 100644 --- a/Code/ITK/include/itkMatrixOffsetBasedTranslationTransform.hxx +++ b/Code/ITK/include/itkMatrixOffsetBasedTranslationTransform.hxx @@ -1,208 +1,208 @@ /*========================================================================= * * Copyright Insight Software Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *=========================================================================*/ #ifndef __itkMatrixOffsetBasedTranslationTransform_hxx #define __itkMatrixOffsetBasedTranslationTransform_hxx #include "itkNumericTraits.h" #include "itkMatrixOffsetBasedTranslationTransform.h" #include "vnl/algo/vnl_matrix_inverse.h" namespace itk { /** Constructor with default arguments */ template< typename TScalar, unsigned int NDimensions > MatrixOffsetBasedTranslationTransform< TScalar, NDimensions >::MatrixOffsetBasedTranslationTransform() : Superclass(ParametersDimension), m_IdentityJacobian(NDimensions, NDimensions) { // The Jacobian of this transform is constant. // Therefore the m_IdentityJacobian variable can be // initialized here and be shared among all the threads. this->m_IdentityJacobian.Fill(0.0); for (unsigned int i = 0; i < NDimensions; i++) { this->m_IdentityJacobian(i, i) = 1.0; } } /** Constructor with default arguments */ template< typename TScalar, unsigned int NDimensions > MatrixOffsetBasedTranslationTransform< TScalar, NDimensions >::MatrixOffsetBasedTranslationTransform( unsigned int parametersDimension): Superclass(parametersDimension), m_IdentityJacobian(NDimensions, NDimensions) { // The Jacobian of this transform is constant. // Therefore the m_IdentityJacobian variable can be // initialized here and be shared among all the threads. this->m_IdentityJacobian.Fill(0.0); for (unsigned int i = 0; i < NDimensions; i++) { this->m_IdentityJacobian(i, i) = 1.0; } } /** Constructor with explicit arguments */ template< typename TScalar, unsigned int NDimensions > MatrixOffsetBasedTranslationTransform< TScalar, NDimensions >::MatrixOffsetBasedTranslationTransform( const MatrixType& matrix, const OutputVectorType& offset): Superclass(matrix, offset), m_IdentityJacobian(NDimensions, NDimensions) { // The Jacobian of this transform is constant. // Therefore the m_IdentityJacobian variable can be // initialized here and be shared among all the threads. this->m_IdentityJacobian.Fill(0.0); for (unsigned int i = 0; i < NDimensions; i++) { this->m_IdentityJacobian(i, i) = 1.0; } } /** Destructor */ template< typename TScalar, unsigned int NDimensions > MatrixOffsetBasedTranslationTransform< TScalar, NDimensions >:: ~MatrixOffsetBasedTranslationTransform() { } /** Print self */ template< typename TScalar, unsigned int NDimensions > void MatrixOffsetBasedTranslationTransform< TScalar, NDimensions >::PrintSelf(std::ostream& os, Indent indent) const { Superclass::PrintSelf(os, indent); } /** Get an inverse of this transform. */ template< typename TScalar, unsigned int NDimensions > bool MatrixOffsetBasedTranslationTransform< TScalar, NDimensions > ::GetInverse(Self* inverse) const { return this->Superclass::GetInverse(inverse); } /** Return an inverse of this transform. */ template< typename TScalar, unsigned int NDimensions > typename MatrixOffsetBasedTranslationTransform< TScalar, NDimensions >::InverseTransformBasePointer MatrixOffsetBasedTranslationTransform< TScalar, NDimensions > ::GetInverseTransform() const { Pointer inv = New(); return this->GetInverse(inv) ? inv.GetPointer() : ITK_NULLPTR; } // Set parameters template< typename TScalar, unsigned int NDimensions > void MatrixOffsetBasedTranslationTransform< TScalar, NDimensions > ::SetParameters(const ParametersType& parameters) { if (parameters.Size() < NDimensions) { itkExceptionMacro ( << "Error setting parameters: parameters array size (" << parameters.Size() << ") is less than expected " << " (NDimensions) " << " (" << NDimensions << ")" ); } // Save parameters. Needed for proper operation of TransformUpdateParameters. if (¶meters != &(this->m_Parameters)) { this->m_Parameters = parameters; } // Transfer the constant part OutputVectorType trans; for (unsigned int i = 0; i < NDimensions; i++) { trans[i] = this->m_Parameters[i]; } this->SetVarTranslation(trans); this->ComputeOffset(); // Modified is always called since we just have a pointer to the // parameters and cannot know if the parameters have changed. this->Modified(); } // Get parameters template< typename TScalar, unsigned int NDimensions > const typename MatrixOffsetBasedTranslationTransform< TScalar, NDimensions >::ParametersType & MatrixOffsetBasedTranslationTransform< TScalar, NDimensions > ::GetParameters() const { // Transfer the constant part OutputVectorType trans = this->GetTranslation(); for (unsigned int i = 0; i < NDimensions; i++) { this->m_Parameters[i] = trans[i]; } return this->m_Parameters; } template const typename MatrixOffsetBasedTranslationTransform::ParametersType & MatrixOffsetBasedTranslationTransform - ::GetFixedParameters(void) const + ::GetFixedParameters() const { this->m_FixedParameters.SetSize(0); return this->m_FixedParameters; } // Compute the Jacobian of the transformation // It follows the same order of Parameters vector template void MatrixOffsetBasedTranslationTransform ::ComputeJacobianWithRespectToParameters(const InputPointType& p, JacobianType& j) const { // the Jacobian is constant for this transform, and it has already been // initialized in the constructor, so we just need to return it here. j = this->m_IdentityJacobian; } // Compute the Jacobian of the transformation with respect to position template void MatrixOffsetBasedTranslationTransform - ::ComputeJacobianWithRespectToPosition(const InputPointType&, + ::ComputeJacobianWithRespectToPosition(const InputPointType& /*unused*/, JacobianType& jac) const { // the Jacobian is constant for this transform, and it has already been // initialized in the constructor, so we just need to return it here. jac = this->m_IdentityJacobian; } -} // namespace +} // namespace itk #endif diff --git a/Code/ITK/include/mapIterativeInverseTransformToDisplacementFieldSource.h b/Code/ITK/include/mapIterativeInverseTransformToDisplacementFieldSource.h index 132b868..e61eb11 100644 --- a/Code/ITK/include/mapIterativeInverseTransformToDisplacementFieldSource.h +++ b/Code/ITK/include/mapIterativeInverseTransformToDisplacementFieldSource.h @@ -1,174 +1,174 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_ITERATIVE_INVERSE_DEFORMATION_FIELD_SOURCE_H #define __MAP_ITERATIVE_INVERSE_DEFORMATION_FIELD_SOURCE_H #include "itkImageSource.h" #include "itkTransform.h" #include "itkWarpVectorImageFilter.h" #include "itkVectorLinearInterpolateImageFunction.h" #include "itkImageRegionIterator.h" #include "itkTimeProbe.h" namespace itk { namespace map { /** \class IterativeInverseTransformToDisplacementFieldSource * \brief Computes the inverse of an transform numerically as deformation field. * * IterativeInverseTransformToDisplacementFieldSource generates a deformation field * like itk::IterativeInverseDisplacementFieldImageFilter (based on the same algorithmic * code). In difference to the later a itk::Transform will be used instead * of an input information field. * @TODO Test if the directions where correct incooperated. Add directional tests to the unit test */ template < class TOutputImage, typename TTransformScalarType > class ITK_EXPORT IterativeInverseTransformToDisplacementFieldSource : public itk::ImageSource { public: /** Standard class typedefs. */ - typedef IterativeInverseTransformToDisplacementFieldSource Self; - typedef itk::ImageSource Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + using Self = IterativeInverseTransformToDisplacementFieldSource; + using Superclass = itk::ImageSource; + using Pointer = itk::SmartPointer; + using ConstPointer = itk::SmartPointer; /** Method for creation through the object factory. */ itkNewMacro(Self); /** Run-time type information (and related methods). */ itkTypeMacro(IterativeInverseTransformToDisplacementFieldSource, ImageSource); /** Some typedefs. */ - typedef TOutputImage OutputImageType; - typedef typename OutputImageType::Pointer OutputImagePointer; - typedef typename OutputImageType::PixelType OutputImagePixelType; - typedef typename OutputImageType::PointType OutputImagePointType; - typedef typename OutputImageType::IndexType OutputImageIndexType; - typedef typename OutputImagePixelType::ValueType OutputImageValueType; - typedef typename OutputImageType::RegionType OutputImageRegionType; - typedef typename OutputImageType::SpacingType OutputImageSpacingType; - typedef typename OutputImageType::SizeType OutputImageSizeType; - typedef typename OutputImageType::DirectionType OutputImageDirectionType; + using OutputImageType = TOutputImage; + using OutputImagePointer = typename OutputImageType::Pointer; + using OutputImagePixelType = typename OutputImageType::PixelType; + using OutputImagePointType = typename OutputImageType::PointType; + using OutputImageIndexType = typename OutputImageType::IndexType; + using OutputImageValueType = typename OutputImagePixelType::ValueType; + using OutputImageRegionType = typename OutputImageType::RegionType; + using OutputImageSpacingType = typename OutputImageType::SpacingType; + using OutputImageSizeType = typename OutputImageType::SizeType; + using OutputImageDirectionType = typename OutputImageType::DirectionType; typedef itk::Transform < TTransformScalarType, OutputImageType::ImageDimension, OutputImageType::ImageDimension > TransformType; - typedef typename TransformType::Pointer TransformPointer; - typedef typename TransformType::ConstPointer TransformConstPointer; + using TransformPointer = typename TransformType::Pointer; + using TransformConstPointer = typename TransformType::ConstPointer; - typedef itk::TimeProbe TimeType; + using TimeType = itk::TimeProbe; - typedef itk::ImageRegionIterator OutputIterator; + using OutputIterator = itk::ImageRegionIterator; typedef itk::WarpVectorImageFilter VectorWarperType; typedef itk::VectorLinearInterpolateImageFunction FieldInterpolatorType; - typedef typename FieldInterpolatorType::Pointer FieldInterpolatorPointer; - typedef typename FieldInterpolatorType::OutputType FieldInterpolatorOutputType; + using FieldInterpolatorPointer = typename FieldInterpolatorType::Pointer; + using FieldInterpolatorOutputType = typename FieldInterpolatorType::OutputType; itkSetMacro(NumberOfIterations, unsigned int); itkGetMacro(NumberOfIterations, unsigned int); // If the error (in mm) between forward and backward mapping is smaller than the StopValue, // the algorithm stops. // This value can be used to speed up the calculation. itkSetMacro(StopValue, double); itkGetMacro(StopValue, double); char* GetReport() { return this->m_Report; } virtual void SetTransform(const TransformType* transform); - virtual const TransformType* GetTransform(void) const; + virtual const TransformType* GetTransform() const; /** Specify the size of the output image. */ virtual void SetSize(const OutputImageSizeType& size); /** Get the size of the output image. */ itkGetMacro(Size, const OutputImageSizeType); /** Specify the spacing of the output image. */ virtual void SetSpacing(const OutputImageSpacingType& spacing); /** Get the spacing of the output image. */ itkGetMacro(Spacing, const OutputImageSpacingType); /** Specify the origin of the output image. */ virtual void SetOrigin(const OutputImagePointType& origin); /** Get the origin of the output image. */ itkGetMacro(Origin, OutputImagePointType); /** Specify the origin of the output image. */ virtual void SetDirection(const OutputImageDirectionType& direction); /** Get the origin of the output image. */ itkGetMacro(Direction, OutputImageDirectionType); #ifdef ITK_USE_CONCEPT_CHECKING /** Begin concept checking */ itkConceptMacro(OutputHasNumericTraitsCheck, (Concept::HasNumericTraits)); /** End concept checking */ #endif protected: IterativeInverseTransformToDisplacementFieldSource(); ~IterativeInverseTransformToDisplacementFieldSource() {} void PrintSelf(std::ostream& os, Indent indent) const; void MakeReport(); void GenerateData(); virtual void GenerateOutputInformation(); unsigned int m_NumberOfIterations; double m_StopValue; double m_Time; private: TransformConstPointer m_Transform; OutputImageSizeType m_Size; //size of the output image OutputImageSpacingType m_Spacing; //spacing of the output image OutputImagePointType m_Origin; //origin of the output image OutputImageDirectionType m_Direction;//direction of the output image IterativeInverseTransformToDisplacementFieldSource(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace map } // end namespace itk #include "mapIterativeInverseTransformToDisplacementFieldSource.txx" #endif diff --git a/Code/ITK/include/mapIterativeInverseTransformToDisplacementFieldSource.txx b/Code/ITK/include/mapIterativeInverseTransformToDisplacementFieldSource.txx index 67e36af..3d9d7ad 100644 --- a/Code/ITK/include/mapIterativeInverseTransformToDisplacementFieldSource.txx +++ b/Code/ITK/include/mapIterativeInverseTransformToDisplacementFieldSource.txx @@ -1,400 +1,400 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_ITERATIVE_INVERSE_DEFORMATION_FIELD_SOURCE_TXX #define __MAP_ITERATIVE_INVERSE_DEFORMATION_FIELD_SOURCE_TXX #include "mapIterativeInverseTransformToDisplacementFieldSource.h" #include "itkProgressReporter.h" namespace itk { namespace map { //---------------------------------------------------------------------------- // Constructor template IterativeInverseTransformToDisplacementFieldSource ::IterativeInverseTransformToDisplacementFieldSource(){ m_NumberOfIterations = 5; m_StopValue = 0; m_Time = 0; m_Transform = NULL; //Initial image is 64 wide in each direction. m_Size.Fill(64); m_Spacing.Fill(1.0); m_Origin.Fill(0.0); m_Direction.SetIdentity(); } //---------------------------------------------------------------------------- template void IterativeInverseTransformToDisplacementFieldSource ::SetTransform(const TransformType* transform) { if (transform != m_Transform.GetPointer()) { m_Transform = transform; this->Modified(); } }; template const typename IterativeInverseTransformToDisplacementFieldSource::TransformType* IterativeInverseTransformToDisplacementFieldSource - ::GetTransform(void) const + ::GetTransform() const { return m_Transform; }; template void IterativeInverseTransformToDisplacementFieldSource ::SetOrigin(const OutputImagePointType& origin) { unsigned int i; for (i=0; iModified(); } } template void IterativeInverseTransformToDisplacementFieldSource ::SetSpacing(const OutputImageSpacingType& spacing ) { unsigned int i; for (i=0; iModified(); } } template void IterativeInverseTransformToDisplacementFieldSource ::SetSize(const OutputImageSizeType& size) { unsigned int i; for (i=0; iModified(); } } template void IterativeInverseTransformToDisplacementFieldSource ::SetDirection(const OutputImageDirectionType& direction) { if ( direction != m_Direction ) { m_Direction = direction; this->Modified(); } } //---------------------------------------------------------------------------- template void IterativeInverseTransformToDisplacementFieldSource ::GenerateData(){ const unsigned int ImageDimension = OutputImageType::ImageDimension; TimeType time; time.Start(); //time measurement OutputImagePointer outputPtr = this->GetOutput(0); // some checks if (m_Transform.IsNull()) { itkExceptionMacro("\n Transform is missing."); } OutputImageRegionType outputRegion(m_Size); // calculate a first guess // (calculate negative deformation field and apply it to itself) OutputImagePointer negField = OutputImageType::New(); negField->SetRegions(outputRegion); negField->SetSpacing(m_Spacing); negField->SetOrigin(m_Origin); negField->SetDirection(m_Direction); negField->Allocate(); OutputIterator negImageIt = OutputIterator(negField, outputRegion); for (negImageIt.GoToBegin(); !negImageIt.IsAtEnd(); ++negImageIt) { OutputImagePointType point; outputPtr->TransformIndexToPhysicalPoint(negImageIt.GetIndex(),point); OutputImagePointType transformedPoint = m_Transform->TransformPoint(point); OutputImagePixelType vector = transformedPoint - point; negImageIt.Set( vector*-1 ); } outputPtr->SetRegions(outputRegion); outputPtr->SetSpacing(m_Spacing); outputPtr->SetOrigin(m_Origin); outputPtr->SetDirection(m_Direction); outputPtr->Allocate(); typename VectorWarperType::Pointer vectorWarper = VectorWarperType::New(); typename FieldInterpolatorType::Pointer VectorInterpolator = FieldInterpolatorType::New(); vectorWarper->SetInput(negField); vectorWarper->SetInterpolator(VectorInterpolator); vectorWarper->SetOutputSpacing(m_Spacing); vectorWarper->SetOutputOrigin(m_Origin); vectorWarper->SetOutputDirection(m_Direction); vectorWarper->SetDisplacementField(negField); vectorWarper->GraftOutput(outputPtr); vectorWarper->UpdateLargestPossibleRegion(); // If the number of iterations is zero, just output the first guess // (negative deformable field applied to itself) if(m_NumberOfIterations == 0) { this->GraftOutput( vectorWarper->GetOutput() ); } else { // calculate the inverted field OutputImagePointType mappedPoint, newPoint; OutputImagePointType point, originalPoint, backMappedPoint; OutputImageIndexType index; OutputImagePixelType displacement, outputValue; double spacing = m_Spacing[0]; double smallestError = 0; int stillSamePoint; unsigned int numberOfPoints = 1; for ( unsigned int i=0; iGetRequestedRegion()); OutputIt.GoToBegin(); while( !OutputIt.IsAtEnd() ) { // get the output image index index = OutputIt.GetIndex(); outputPtr->TransformIndexToPhysicalPoint( index, originalPoint ); stillSamePoint = 0; double step = spacing; // get the required displacement displacement = OutputIt.Get(); // compute the required input image point for(unsigned int j = 0; j < ImageDimension; j++ ) { mappedPoint[j] = originalPoint[j] + displacement[j]; newPoint[j] = mappedPoint[j]; } // calculate the error of the last iteration backMappedPoint = m_Transform->TransformPoint( mappedPoint ); smallestError = 0; for(unsigned int j = 0; j < ImageDimension; j++ ) { smallestError += vcl_pow(backMappedPoint[j]-originalPoint[j],2); } smallestError = vcl_sqrt(smallestError); // iteration loop for (unsigned int i=0; iTransformPoint( mappedPoint ); //forwardVector = inputFieldInterpolator->Evaluate( mappedPoint ); tmp = 0; for (unsigned int l=0; lTransformPoint( mappedPoint ); //forwardVector = inputFieldInterpolator->Evaluate( mappedPoint ); tmp = 0; for (unsigned int l=0; l( mappedPoint[k]-originalPoint[k] ); } OutputIt.Set( outputValue ); ++OutputIt; progress.CompletedPixel(); } //end while loop }//end else time.Stop(); m_Time = time.GetMean(); } //---------------------------------------------------------------------------- template void IterativeInverseTransformToDisplacementFieldSource ::GenerateOutputInformation() { TOutputImage *output; output = this->GetOutput(0); typename TOutputImage::RegionType largestPossibleRegion(m_Size); output->SetLargestPossibleRegion( largestPossibleRegion ); output->SetSpacing(m_Spacing); output->SetOrigin(m_Origin); output->SetDirection(m_Direction); } //---------------------------------------------------------------------------- template void IterativeInverseTransformToDisplacementFieldSource ::PrintSelf(std::ostream& os, Indent indent) const { Superclass::PrintSelf(os,indent); os << indent << "Number of iterations: " << m_NumberOfIterations << std::endl; os << indent << "Stop value: " << m_StopValue << " mm" << std::endl; os << indent << "Elapsed time: " << m_Time << " sec" << std::endl; os << indent << "Output spacing: " << m_Spacing << std::endl; os << indent << "Output size: " << m_Size << std::endl; os << indent << "Output origin: " << m_Origin << std::endl; os << indent << "Output direction: " << m_Direction << std::endl; os << indent << "Transform: " << m_Transform << std::endl; os << std::endl; } } // end namespace map } // end namespace itk #endif diff --git a/Code/ITK/include/mapNULLVectorAwareLinearInterpolateImageFunction.h b/Code/ITK/include/mapNULLVectorAwareLinearInterpolateImageFunction.h index 647524a..8c1801d 100644 --- a/Code/ITK/include/mapNULLVectorAwareLinearInterpolateImageFunction.h +++ b/Code/ITK/include/mapNULLVectorAwareLinearInterpolateImageFunction.h @@ -1,141 +1,141 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __NULL_VECTOR_AWARE_LINEAR_INTERPOLATE_IMAGE_FUNCTION_H #define __NULL_VECTOR_AWARE_LINEAR_INTERPOLATE_IMAGE_FUNCTION_H #include "itkVectorLinearInterpolateImageFunction.h" namespace itk { namespace map { /** * \class NULLVectorAwareLinearInterpolateImageFunction * \brief Linearly interpolate a vector image at specified positions and awares the null vector. * * NULLVectorAwareLinearInterpolateImageFunction extends the normal itk::VectorLinearInteroplateImageFunction * by support/awareness of null vectors. It is used e.g. to map the MatchPoint field kernels. * * This function works for N-dimensional images. * * \warning This function work only for Vector images. For * scalar images use LinearInterpolateImageFunction. * * \ingroup ImageFunctions ImageInterpolators * */ template class ITK_EXPORT NULLVectorAwareLinearInterpolateImageFunction : public VectorLinearInterpolateImageFunction { public: /** Standard class typedefs. */ - typedef NULLVectorAwareLinearInterpolateImageFunction Self; + using Self = NULLVectorAwareLinearInterpolateImageFunction; typedef VectorLinearInterpolateImageFunction Superclass; - typedef SmartPointer Pointer; - typedef SmartPointer ConstPointer; + using Pointer = SmartPointer; + using ConstPointer = SmartPointer; /** Method for creation through the object factory. */ itkNewMacro(Self); /** Run-time type information (and related methods). */ itkTypeMacro(NULLVectorAwareLinearInterpolateImageFunction, VectorLinearInterpolateImageFunction); /** InputImageType typedef support. */ - typedef typename Superclass::InputImageType InputImageType; - typedef typename Superclass::PixelType PixelType; - typedef typename Superclass::ValueType ValueType; - typedef typename Superclass::RealType RealType; + using InputImageType = typename Superclass::InputImageType; + using PixelType = typename Superclass::PixelType; + using ValueType = typename Superclass::ValueType; + using RealType = typename Superclass::RealType; /** Index typedef support. */ - typedef typename Superclass::IndexType IndexType; + using IndexType = typename Superclass::IndexType; /** ContinuousIndex typedef support. */ - typedef typename Superclass::ContinuousIndexType ContinuousIndexType; + using ContinuousIndexType = typename Superclass::ContinuousIndexType; /** Output type is Vector */ - typedef typename Superclass::OutputType OutputType; + using OutputType = typename Superclass::OutputType; /** Evaluate the function at a ContinuousIndex position * * Returns the linearly interpolated vectors at a * specified point position. No bounds checking is done. * The point is assume to lie within the image buffer. * If one of the interplated vectors is the null vector * while null vector usage is activated, the null vector * will allways be returned. * * ImageFunction::IsInsideBuffer() can be used to check bounds before * calling the method. */ virtual OutputType EvaluateAtContinuousIndex( const ContinuousIndexType& index) const; const OutputType& GetNullVector() const { return _nullVector; }; void SetNullVector(const OutputType& nullVector) { _nullVector = nullVector; }; bool UsesNullVector() const { return _useNullVector; }; void SetNullVectorUsage(bool use) { _useNullVector = use; }; protected: NULLVectorAwareLinearInterpolateImageFunction(); ~NULLVectorAwareLinearInterpolateImageFunction() {}; void PrintSelf(std::ostream& os, Indent indent) const; bool _useNullVector; OutputType _nullVector; /** Number of neighbors used in the interpolation */ static const unsigned long m_Neighbors; private: NULLVectorAwareLinearInterpolateImageFunction(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace map } // end namespace itk #ifndef MatchPoint_MANUAL_TPP # include "mapNULLVectorAwareLinearInterpolateImageFunction.tpp" #endif #endif diff --git a/Code/Ontology/Common/include/mapAlgorithmExecutionInfo.h b/Code/Ontology/Common/include/mapAlgorithmExecutionInfo.h index 8040afe..f6f09d2 100644 --- a/Code/Ontology/Common/include/mapAlgorithmExecutionInfo.h +++ b/Code/Ontology/Common/include/mapAlgorithmExecutionInfo.h @@ -1,266 +1,266 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_ALGORITHM_EXECUTION_INFO_H #define __MAP_ALGORITHM_EXECUTION_INFO_H #include "mapOntologyString.h" #include #include #include #include namespace iro { /** This class is used to collect and store an relevant information about * an algorithm execution. The gathered information can be compiled by * different sources (e.g. User, clients using the ontology). * @tparam TInformationSpaceTraits The traits of the information space, depending on the application scenario. * @tparam TInformationEntityTraits The traits of the information entity, depending on the application scenario.*/ template class AlgorithmExecutionInfo { public: typedef AlgorithmExecutionInfo Self; - typedef ::std::shared_ptr Pointer; - typedef ::std::shared_ptr ConstPointer; + using Pointer = ::std::shared_ptr; + using ConstPointer = ::std::shared_ptr; - typedef String RelevantEntityLabelType; - typedef typename TInformationEntityTraits::ConstPointer RelevantEntityPointer; + using RelevantEntityLabelType = String; + using RelevantEntityPointer = typename TInformationEntityTraits::ConstPointer; - typedef String AdaptedParameterNameType; - typedef String AdaptedParameterValueType; + using AdaptedParameterNameType = String; + using AdaptedParameterValueType = String; - typedef String QualityMeasureNameType; - typedef String QualityMeasureValueType; + using QualityMeasureNameType = String; + using QualityMeasureValueType = String; - typedef String TagLabelType; - typedef String TagType; + using TagLabelType = String; + using TagType = String; - typedef std::chrono::milliseconds DurationType; - typedef String AlgorithmIDType; + using DurationType = std::chrono::milliseconds; + using AlgorithmIDType = String; protected: typedef typename std::multimap RelevantEntityMapType; typedef typename std::map AdaptedParameterMapType; typedef typename std::map QualityMeasureMapType; typedef typename std::multimap TagMapType; public: - typedef typename RelevantEntityMapType::iterator RelevantEntityIterator; - typedef typename RelevantEntityMapType::const_iterator ConstRelevantEntityIterator; - typedef typename RelevantEntityMapType::size_type RelevantEntityCountType; + using RelevantEntityIterator = typename RelevantEntityMapType::iterator; + using ConstRelevantEntityIterator = typename RelevantEntityMapType::const_iterator; + using RelevantEntityCountType = typename RelevantEntityMapType::size_type; typedef std::pair RelevantEntityRangeType; typedef std::pair ConstRelevantEntityRangeType; - typedef typename AdaptedParameterMapType::iterator AdaptedParameterIterator; - typedef typename AdaptedParameterMapType::const_iterator ConstAdaptedParameterIterator; - typedef typename AdaptedParameterMapType::size_type AdaptedParameterCountType; + using AdaptedParameterIterator = typename AdaptedParameterMapType::iterator; + using ConstAdaptedParameterIterator = typename AdaptedParameterMapType::const_iterator; + using AdaptedParameterCountType = typename AdaptedParameterMapType::size_type; - typedef typename QualityMeasureMapType::iterator QualityMeasureIterator; - typedef typename QualityMeasureMapType::const_iterator ConstQualityMeasureIterator; - typedef typename QualityMeasureMapType::size_type QualityMeasureCountType; + using QualityMeasureIterator = typename QualityMeasureMapType::iterator; + using ConstQualityMeasureIterator = typename QualityMeasureMapType::const_iterator; + using QualityMeasureCountType = typename QualityMeasureMapType::size_type; - typedef typename TagMapType::iterator TagIterator; - typedef typename TagMapType::const_iterator ConstTagIterator; - typedef typename TagMapType::size_type TagCountType; + using TagIterator = typename TagMapType::iterator; + using ConstTagIterator = typename TagMapType::const_iterator; + using TagCountType = typename TagMapType::size_type; typedef std::pair TagRangeType; typedef std::pair ConstTagRangeType; ////////////////////////////////////////////////////// // Relevant entities /*! Returns the iterator to the begin of the relevant entity map.*/ RelevantEntityIterator getRelevantEntitiesBegin(); /*! Returns the const iterator to the begin of th relevant entity map.*/ ConstRelevantEntityIterator getRelevantEntitiesBegin() const; /*! Returns a iterator pair the first iterator points at the first entity * that is associated with the passed label, the second iterator points to the first * entity whose label is greater then the searched label. If the label does not exist * both iterators point to getRelevantEntitiesEnd(). The second iterator may also point * to getRelevantEntitiesEnd() if it is the last label in the map.*/ RelevantEntityRangeType getRelevantEntities(const RelevantEntityLabelType& label); ConstRelevantEntityRangeType getRelevantEntities(const RelevantEntityLabelType& label) const; /*! Returns the iterator to the end of the relevant entity map.*/ RelevantEntityIterator getRelevantEntitiesEnd(); /*! Returns the const iterator to the end of the relevant entity map.*/ ConstRelevantEntityIterator getRelevantEntitiesEnd() const; /*! Returns the size of the relevant entity map (number of elements).*/ RelevantEntityCountType getRelevantEntitiesCount() const; /*! adds the passed newEntity under the label and returns its position. * @param [in] label Label of the entity. * @param [in] newEntity The new entity that should be added. * @pre newEntity must point to a valid instance. * @exception ::iro::exceptions::InvalidArgument: newEntity is no valid instance. * @return Iterator that points to the position of the inserted element.*/ RelevantEntityIterator addRelevantEntity(const RelevantEntityLabelType& label, RelevantEntityPointer newEntity); /*! removes the element at the passed position. * @param [in] pos Iterator indicating the postion of the element that should be removed. * @return Iterator that points to the position behind the removed element. If it was the last element it points to getRelevantEntitiesEnd().*/ RelevantEntityIterator removeRelevantEntity(RelevantEntityIterator pos); /*! removes all elements with the passed label. * @param [in] label Label that indicates all elements that should be removed. * @return Number of elements that have been removed with this function call.*/ RelevantEntityCountType removeRelevantEntities(const RelevantEntityLabelType& label); ////////////////////////////////////////////////////// // adapted parameters /*! Returns the iterator to the begin of the adapted parameter map.*/ AdaptedParameterIterator getAdaptedParametersBegin(); /*! Returns the const iterator to the begin of the adapted parameter map.*/ ConstAdaptedParameterIterator getAdaptedParametersBegin() const; /*! Returns the iterator to the end of the adapted parameter map.*/ AdaptedParameterIterator getAdaptedParametersEnd(); /*! Returns the const iterator to the end of the adapted parameter map.*/ ConstAdaptedParameterIterator getAdaptedParametersEnd() const; AdaptedParameterIterator getAdaptedParameter(const AdaptedParameterNameType& name); ConstAdaptedParameterIterator getAdaptedParameter(const AdaptedParameterNameType& name) const; /*! Returns the size of the adapted parameter map (number of elements).*/ AdaptedParameterCountType getAdaptedParametersCount() const; /*! adds the passed name/value and returns its position. * @param [in] name Name of the parameter that should be added. * @param [in] value Value of the parameter that should be added. * @return Iterator that points to the position of the inserted value.*/ AdaptedParameterIterator addAdaptedParameter(const AdaptedParameterNameType& name, const AdaptedParameterValueType& value); /*! removes the name/value at the passed position. * @param [in] pos Iterator indicating the postion of the element that should be removed. * @return Iterator that points to the position behind the removed element. If it was the last element it points to getAdaptedParametersEnd().*/ AdaptedParameterIterator removeAdaptedParameter(AdaptedParameterIterator pos); ////////////////////////////////////////////////////// // quality measures /*! Returns the iterator to the begin of the quality measures map.*/ QualityMeasureIterator getQualityMeasuresBegin(); /*! Returns the const iterator to the begin of the quality measures map.*/ ConstQualityMeasureIterator getQualityMeasuresBegin() const; /*! Returns the iterator to the end of the quality measures map.*/ QualityMeasureIterator getQualityMeasuresEnd(); /*! Returns the const iterator to the end of the quality measures map.*/ ConstQualityMeasureIterator getQualityMeasuresEnd() const; QualityMeasureIterator getQualityMeasure(const QualityMeasureNameType& name); ConstQualityMeasureIterator getQualityMeasure(const QualityMeasureNameType& name) const; /*! Returns the size of the quality measures map (number of elements).*/ QualityMeasureCountType getQualityMeasuresCount() const; /*! adds the passed name/value and returns its position. * @param [in] name Name of the parameter that should be added. * @param [in] value Value of the parameter that should be added. * @return Iterator that points to the position of the inserted value.*/ QualityMeasureIterator addQualityMeasure(const QualityMeasureNameType& name, const QualityMeasureValueType& value); /*! removes the name/value at the passed position. * @param [in] pos Iterator indicating the postion of the element that should be removed. * @return Iterator that points to the position behind the removed element. If it was the last element it points to getQualityMeasuresEnd().*/ QualityMeasureIterator removeQualityMeasure(QualityMeasureIterator pos); ////////////////////////////////////////////////////// // tags /*! Returns the iterator to the begin of the tags map.*/ TagIterator getTagsBegin(); /*! Returns the const iterator to the begin of the tags map.*/ ConstTagIterator getTagsBegin() const; /*! Returns the iterator to the end of the tags map.*/ TagIterator getTagsEnd(); /*! Returns the const iterator to the end of the tags map.*/ ConstTagIterator getTagsEnd() const; /*! Returns a iterator pair the first iterator points at the first entity * that is associated with the passed label, the second iterator points to the first * entity whose label is greater then the searched label. If the label does not exist * both iterators point to getRelevantEntitiesEnd(). The second iterator may also point * to getRelevantEntitiesEnd() if it is the last label in the map.*/ TagRangeType getTags(const TagLabelType& label); ConstTagRangeType getTags(const TagLabelType& label) const; /*! Returns the size of the tags map (number of elements).*/ TagCountType getTagsCount() const; /*! adds the passed newEntity under the label and returns its position. * @param [in] label Label of the entity. * @param [in] tag The new tag that should be added. * @return Iterator that points to the position of the inserted element.*/ TagIterator addTag(const TagLabelType& label, const TagType& tag); /*! removes the element at the passed position. * @param [in] pos Iterator indicating the postion of the element that should be removed. * @return Iterator that points to the position behind the removed element. If it was the last element it points to getRelevantEntitiesEnd().*/ TagIterator removeTag(TagIterator pos); /*! removes all elements with the passed label. * @param [in] label Label that indicates all elements that should be removed. * @return Number of elements that have been removed with this function call.*/ TagCountType removeTags(const TagLabelType& label); ////////////////////////////////////////////////////// // others const AlgorithmIDType& getAlgorithmID() const; void setAlgorithmID(const AlgorithmIDType& id); /** Returns the duration of the execution (in milliseconds).*/ const DurationType& getDuration() const; /** Sets the duration of the execution (in milliseconds).*/ void setDuration(const DurationType& duration); /* Clones the content of the execution info and returns it as * non const pointer. It can be used to alter the execution info and * update the knowledge base of the ontology. */ Pointer clone() const; virtual ~AlgorithmExecutionInfo(); AlgorithmExecutionInfo(); protected: DurationType _duration; AlgorithmIDType _id; RelevantEntityMapType _relevantEntities; AdaptedParameterMapType _parameters; QualityMeasureMapType _measures; TagMapType _tags; private: AlgorithmExecutionInfo(const Self&); //not implemented by purpose Self& operator=(const Self&); //not implemented by purpose }; } // end namespace iro #ifndef MatchPoint_MANUAL_TPP #include "mapAlgorithmExecutionInfo.tpp" #endif #endif diff --git a/Code/Ontology/Common/include/mapBijectivCorrelation.h b/Code/Ontology/Common/include/mapBijectivCorrelation.h index 241248d..bda0381 100644 --- a/Code/Ontology/Common/include/mapBijectivCorrelation.h +++ b/Code/Ontology/Common/include/mapBijectivCorrelation.h @@ -1,55 +1,55 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_BIJECTIV_CORRELATION_H #define __MAP_BIJECTIV_CORRELATION_H #include "mapInjectivCorrelation.h" #include "mapMAPOntologyExports.h" namespace iro { /** @class BijectivCorrelation * This class defines a semantic identity that is known and bijective. * Thus you know for the exact correspondence of one entity (element) * in the other information space. * @ingroup CorrelationType*/ class MAPOntology_EXPORT BijectivCorrelation : public InjectivCorrelation { public: - typedef BijectivCorrelation Self; - typedef std::shared_ptr Pointer; - typedef std::shared_ptr ConstPointer; + using Self = BijectivCorrelation; + using Pointer = std::shared_ptr; + using ConstPointer = std::shared_ptr; /** Returns the identifier name of the correlation type.*/ - virtual String getName() const; + String getName() const override; - virtual ~BijectivCorrelation(); + ~BijectivCorrelation() override; BijectivCorrelation(); private: - BijectivCorrelation(const BijectivCorrelation&); //not implemented by purpose - BijectivCorrelation& operator=(const BijectivCorrelation&); //not implemented by purpose + BijectivCorrelation(const BijectivCorrelation&) = delete; //not implemented by purpose + BijectivCorrelation& operator=(const BijectivCorrelation&) = delete; //not implemented by purpose }; } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapIEntityInference.h b/Code/Ontology/Common/include/mapIEntityInference.h index 52381ab..75133c6 100644 --- a/Code/Ontology/Common/include/mapIEntityInference.h +++ b/Code/Ontology/Common/include/mapIEntityInference.h @@ -1,356 +1,356 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_I_ENTITY_INFERENCE_H #define __MAP_I_ENTITY_INFERENCE_H #include "mapOntologyResult.h" #include "mapDataRepresentation.h" #include namespace iro { namespace core { /*! @class IEntityInference * @brief Interface of the registration ontology used for inference queries in the context of entities or entity related questions that can be handled without caring about registration. * * As inference interface it is analog to a pure getter interface. * Setting and writing will be done be integration interfaces (IProblemIntegration). * This interface is implemented regarding the NVI paradigm. * * @tparam TIETraits type that define the traits of information entities. * @tparam TISTraits type that define the traits of information spaces. * @tparam TSCTraits type that define the traits of semantic correlations. * @sa IProblemInference * @sa IViewingInference * @sa IMappingInference * @sa IProblemIntegration * @ingroup Inference */ template class IEntityInference { public: - typedef typename TIETraits::Type InfEntityType; - typedef typename TISTraits::Type InfSpaceType; - typedef typename TSCTraits::Type CorrelationType; - typedef typename TIETraits::ConstPointer ConstInfEntityPointer; - typedef typename TISTraits::ConstPointer ConstInfSpacePointer; - typedef typename TSCTraits::ConstPointer ConstCorrelationPointer; - typedef typename TIETraits::InferencePointer InfEntityInferencePointer; - typedef typename TISTraits::InferencePointer InfSpaceInferencePointer; - typedef typename TSCTraits::InferencePointer CorrelationInferencePointer; - - typedef typename std::vector ConstInfEntityVectorType; - typedef typename std::vector ConstInfSpaceVectorType; - typedef typename std::vector ConstCorrelationVectorType; - - typedef DataRepresentation::Type DataRepresentationType; + using InfEntityType = typename TIETraits::Type; + using InfSpaceType = typename TISTraits::Type; + using CorrelationType = typename TSCTraits::Type; + using ConstInfEntityPointer = typename TIETraits::ConstPointer; + using ConstInfSpacePointer = typename TISTraits::ConstPointer; + using ConstCorrelationPointer = typename TSCTraits::ConstPointer; + using InfEntityInferencePointer = typename TIETraits::InferencePointer; + using InfSpaceInferencePointer = typename TISTraits::InferencePointer; + using CorrelationInferencePointer = typename TSCTraits::InferencePointer; + + using ConstInfEntityVectorType = typename std::vector; + using ConstInfSpaceVectorType = typename std::vector; + using ConstCorrelationVectorType = typename std::vector; + + using DataRepresentationType = DataRepresentation::Type; /*! Returns the information space of the passed entity. *@param [in] pEntity Const pointer to the entity whose information space should be detected. *@return Pointer to the correlated information space. If the passed entity is unkown, * a null pointer will be returned. *@pre pEntity must point to a valid instance. *@pre pEntity must be defined in the ontology (use actualize() in order to check * this in before). *@exception ::iro::exceptions::InvalidArgument : entity pointer is null. *@exception ::iro::exceptions::UndefinedElement : entity is not defined in the ontology. */ Result getContainingIS(InfEntityInferencePointer pEntity) const; /*! Queries for all entities that are contained by the passed information space. *@param [in] pIS Pointer to the information space that contains the wanted entities. *@return a collection containing pointers to all entities associated with the passed information space. * If the space is unkown, an empty collection will be returned. *@pre Information space must point to a valid instance. *@pre pIS must be defined in the ontology (use actualize() in order to check * this in before). *@exception ::iro::exceptions::InvalidArgument : information space pointer is null. *@exception ::iro::exceptions::UndefinedElement : information space is not defined in the ontology. */ Result getEntitiesInIS(InfSpaceInferencePointer pIS) const; /*! Function checks if two entities are located in the same information space. *@param [in] pEntity1 Pointer to the first entity. *@param [in] pEntity2 Pointer to the second entity. *@return True if the passed entities are locates in the same information space. *@pre pEntity1 must point to a valid instance. *@pre pEntity2 must point to a valid instance. *@pre pEntity1 must be defined in the ontology (use actualize() in order to check * this in before). *@pre pEntity2 must be defined in the ontology (use actualize() in order to check * this in before). *@exception ::iro::exceptions::InvalidArgument : entity pointer is null. *@exception ::iro::exceptions::UndefinedElement : at least on entity is not defined in the ontology. */ Result checkForSameIS(InfEntityInferencePointer pEntity1, InfEntityInferencePointer pEntity2) const; /*! Function checks if the passed entities are located in the same information space. *@param [in] entities collection with pointers to entities that should be checked. *@return True if the passed entities are locates in the same information space. *@pre entities must contain pointer to valid instances. *@pre entities must be defined in the ontology (use actualize() in order to check * this in before). *@exception ::iro::exceptions::InvalidArgument : collection containes invalid entity pointers. *@exception ::iro::exceptions::UndefinedElement : at least on entity is not defined in the ontology.*/ Result checkForSameIS(const ConstInfEntityVectorType& entities) const; /*! Queries for all entities that have a semantic correlation to the passed entity. *@param [in] pEntity Pointer to the entity that should be checked for correlations. *@return A collection containing pointers to all entities correlated with the passed * entity. *@pre pEntity must point to valid instances. *@pre pEntity must be defined in the ontology (use actualize() in order to check * this in before). *@exception ::iro::exceptions::InvalidArgument : pEntity is not valid. *@exception ::iro::exceptions::UndefinedElement : entity is not defined in the ontology. */ Result getEntitiesWithSemanticCorrelations(InfEntityInferencePointer pEntity) const; /*! Returns all entities of "pSourceIS" that have a semantic correlation into "pCorrelatedIS". *@param [in] pSourceIS Pointer to the information spaces whose entities will be queried for the fact if they have correlations with entities in pCorrelatedIS. *@param [in] pCorrelatedIS Pointer to the information space the entities from pSourceIS should have correlations into. *@return A collection containing pointers to all entities in pSourceIS that are correlated with * at least one entity in pCorrelatedIS. *@pre pSourceIS must point to valid instances. *@pre pCorrelatedIS must point to valid instances. *@pre pSourceIS must be defined in the ontology (use actualize() in order to check * this in before). *@pre pCorrelatedIS must be defined in the ontology (use actualize() in order to check * this in before). *@exception ::iro::exceptions::InvalidArgument : pSourceIS or pCorrelatedIS is not valid. *@exception ::iro::exceptions::UndefinedElement : at least on of the information spaces is not defined in the ontology. */ Result getSemanticallyCorrelatedEntities(InfSpaceInferencePointer pSourceIS, InfSpaceInferencePointer pCorrelatedIS) const; /*! Queries for all semantic correlations that exist between the passed information spaces. *@param [in] pIS1 Pointer to the first information spaces. *@param [in] pIS2 Pointer to the second information space. *@return A collection containing semantic correlations between entities of the passed information spaces. *@pre is1 must point to valid instances. *@pre is2 must point to valid instances. *@pre pIS1 must be defined in the ontology (use actualize() in order to check * this in before). *@pre pIS2 must be defined in the ontology (use actualize() in order to check * this in before). *@exception ::iro::exceptions::InvalidArgument : is1 or is2 is not valid. *@exception ::iro::exceptions::UndefinedElement : at least on of the information spaces is not defined in the ontology. */ Result getSemanticCorrelations(InfSpaceInferencePointer pIS1, InfSpaceInferencePointer pIS2) const; /*! Queries for all semantic correlations that exist between the passed entity and entities of the passed information space. *@param [in] pEntity Pointer to the entity. *@param [in] pIs Pointer to the information space. *@return A collection containing found semantic correlations. *@pre pEntity must point to valid instances. *@pre pIS must point to valid instances. *@pre pEntity must be defined in the ontology (use actualize() in order to check * this in before). *@pre pIS must be defined in the ontology (use actualize() in order to check * this in before). *@exception ::iro::exceptions::InvalidArgument : pEntity or pIS is not valid. *@exception ::iro::exceptions::UndefinedElement : entity or information space is not defined in the ontology. */ Result getSemanticCorrelations(InfEntityInferencePointer pEntity, InfSpaceInferencePointer pIS) const; /*! Queries for all semantic correlations that exist between the passed entities. *@param [in] pEntity1 Pointer to the first entity. *@param [in] pEntity2 Pointer to the second entity. *@return A collection containing found semantic correlations. *@pre pEntity1 must point to valid instances. *@pre pEntity2 must point to valid instances. *@pre pEntity1 must be defined in the ontology (use actualize() in order to check * this in before). *@pre pEntity2 must be defined in the ontology (use actualize() in order to check * this in before). *@exception ::iro::exceptions::InvalidArgument : pEntity1 or pEntity2 is not valid. *@exception ::iro::exceptions::UndefinedElement : at least on entity is not defined in the ontology. */ Result getSemanticCorrelations(InfEntityInferencePointer pEntity1, InfEntityInferencePointer pEntity2) const; /*!Returns the data representation type of the passed entity. *@param [in] pEntity Pointer to the entity whose representation type should be queried. *@pre pEntity must point to valid instances. *@pre pEntity must be defined in the ontology (use actualize() in order to check * this in before). *@exception ::iro::exceptions::InvalidArgument : pEntity is not valid. *@exception ::iro::exceptions::UndefinedElement : entity is not defined in the ontology. */ Result getDataRepresentationType(InfEntityInferencePointer pEntity) const; /*!Indicates if the passed entity is represented by discrete data. *@param [in] pEntity Pointer to the entity whose representation type should be checked. *@pre pEntity must point to valid instances. *@pre pEntity must be defined in the ontology (use actualize() in order to check * this in before). *@exception ::iro::exceptions::InvalidArgument : pEntity is not valid. *@exception ::iro::exceptions::UndefinedElement : entity is not defined in the ontology. */ Result hasDiscreteDataRepresentation(InfEntityInferencePointer pEntity) const; /*!Indicates if the passed entity is represented by continuous data. *@param [in] pEntity Pointer to the entity whose representation type should be checked. *@pre pEntity must point to valid instances. *@pre pEntity must be defined in the ontology (use actualize() in order to check * this in before). *@exception ::iro::exceptions::InvalidArgument : pEntity is not valid. *@exception ::iro::exceptions::UndefinedElement : entity is not defined in the ontology. */ Result hasContinuousDataRepresentation(InfEntityInferencePointer pEntity) const; /*! Returns a vector that containes all entities that are defined in the ontology. * @remark Depending on the ontology the returning vector can be very large and thus the function call * can be of low performance. */ Result getEntities() const; /*! Returns a vector that containes all information spaces that are defined in the ontology. * @remark Depending on the ontology the returning vector can be very large and thus the function call * can be of low performance. */ Result getInformationSpaces() const; /*! Returns a vector that containes all semantic correlations that are defined in the ontology. * @remark Depending on the ontology the returning vector can be very large and thus the function call * can be of low performance. */ Result getSemanticCorrelations() const; /*!Takes the passed entity and returns the version of the entity (UID equals) * that represents the current state of the ontology. * @param [in] pEntity Pointer to the entity that should be actualized. * @return Smart pointer to the current version of the element. If the entity * does not exist (any more) in the ontology, a NULL pointer will be returned. * @pre pEntity must point to valid instances. * @overload * @exception ::iro::exceptions::InvalidArgument : pEntity is not a valid pointer.*/ Result actualize(InfEntityInferencePointer pEntity) const; /*!Takes the passed information space and returns the version of the IS (UID equals) * that represents the current state of the ontology. * @param [in] pIS Pointer to the IS that should be actualized. * @return Smart pointer to the current version of the element. If the information space * does not exist (any more) in the ontology, a NULL pointer will be returned. * @pre pIS must point to valid instances. * @overload * @exception ::iro::exceptions::InvalidArgument : pIS is not a valid pointer.*/ Result actualize(InfSpaceInferencePointer pIS) const; /*!Takes the passed correlation and returns the version of the correlation (UID equals) * that represents the current state of the ontology. * @param [in] corr Pointer to the information space that should be actualized. * @return Smart pointer to the current version of the element. If the correlation * does not exist (any more) in the ontology, a NULL pointer will be returned. * @pre corr must point to valid instances. * @overload * @exception ::iro::exceptions::InvalidArgument : corr is not a valid pointer.*/ Result actualize(CorrelationInferencePointer corr) const; protected: /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getContainingIS*/ virtual Result doGetContainingIS(InfEntityInferencePointer pEntity) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getEntitiesInIS*/ virtual Result doGetEntitiesInIS(InfSpaceInferencePointer pIS) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see checkForSameIS*/ virtual Result doCheckForSameIS(InfEntityInferencePointer pEntity1, InfEntityInferencePointer pEntity2) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see checkForSameIS*/ virtual Result doCheckForSameIS(const ConstInfEntityVectorType& entities) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getEntitiesWithSemanticCorrelations*/ virtual Result doGetEntitiesWithSemanticCorrelations(InfEntityInferencePointer pEntity) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getSemanticallyCorrelatedEntities*/ virtual Result doGetSemanticallyCorrelatedEntities(InfSpaceInferencePointer pSourceIS, InfSpaceInferencePointer pCorrelatedIS) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getSemanticCorrelations*/ virtual Result doGetSemanticCorrelations(InfSpaceInferencePointer pIS1, InfSpaceInferencePointer pIS2) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getSemanticCorrelations*/ virtual Result doGetSemanticCorrelations(InfEntityInferencePointer pEntity, InfSpaceInferencePointer pIs) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getSemanticCorrelations*/ virtual Result doGetSemanticCorrelations(InfEntityInferencePointer pEntity1, InfEntityInferencePointer pEntity2) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getDataRepresentationType*/ virtual Result doGetDataRepresentationType(InfEntityInferencePointer pEntity) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see hasDiscreteDataRepresentation*/ virtual Result doHasDiscreteDataRepresentation(InfEntityInferencePointer pEntity) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see hasContinuousDataRepresentation*/ virtual Result doHasContinuousDataRepresentation(InfEntityInferencePointer pEntity) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getEntities*/ virtual Result doGetEntities() const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getInformationSpaces*/ virtual Result doGetInformationSpaces() const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getSemanticCorrelations*/ virtual Result doGetSemanticCorrelations() const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see actualize*/ virtual Result doActualize(InfEntityInferencePointer pEntity) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see actualize*/ virtual Result doActualize(InfSpaceInferencePointer pIS) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see actualize*/ virtual Result doActualize(CorrelationInferencePointer corr) const = 0; - virtual ~IEntityInference() {}; - IEntityInference() {}; + virtual ~IEntityInference() = default; + IEntityInference() = default; private: IEntityInference(const IEntityInference&); //not implemented by purpose IEntityInference& operator=(const IEntityInference&); //not implemented by purpose }; } // end namespace core } // end namespace iro #ifndef MatchPoint_MANUAL_TPP #include "mapIEntityInference.tpp" #endif #endif diff --git a/Code/Ontology/Common/include/mapIEntityIntegration.h b/Code/Ontology/Common/include/mapIEntityIntegration.h index 7ed26b4..b2de841 100644 --- a/Code/Ontology/Common/include/mapIEntityIntegration.h +++ b/Code/Ontology/Common/include/mapIEntityIntegration.h @@ -1,277 +1,277 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_I_ENTITY_INTEGRATION_H #define __MAP_I_ENTITY_INTEGRATION_H #include "mapIEntityInference.h" namespace iro { namespace core { /*! @class IEntityIntegration * @brief Interface of the registration ontology decorator used for integration queries in the context of entities or entity * related information that is independent from registration/transformation. * * As integration interface it is analog to a pure setter interface. * Getting will be done be inference interfaces (IEntityInference). * This interface is implemented regarding the NVI paradigm. * * @tparam TIETraits type that define the traits of information entities. * @tparam TISTraits type that define the traits of information spaces. * @tparam TSCTraits type that define the traits of semantic correlations. * @tparam TIEInference type of the information entity inference interface that should be used. * @tparam TEDReturnType type that is returned by entity delete operations. * @tparam TISDReturnType type that is returned by information space delete operations. * @tparam TCDReturnType type that is returned by correlation delete operations. * @sa IProblemIntegration * @sa IMappingIntegration * @sa IEntityInference * @ingroup Integration */ template class IEntityIntegration { public: - typedef typename TIETraits::Type InfEntityType; - typedef typename TISTraits::Type InfSpaceType; - typedef typename TSCTraits::Type CorrelationType; - typedef typename TIETraits::ConstPointer ConstInfEntityPointer; - typedef typename TISTraits::ConstPointer ConstInfSpacePointer; - typedef typename TSCTraits::ConstPointer ConstCorrelationPointer; - typedef typename TIETraits::InferencePointer InfEntityInferencePointer; - typedef typename TISTraits::InferencePointer InfSpaceInferencePointer; - typedef typename TSCTraits::InferencePointer CorrelationInferencePointer; - - typedef TEDReturnType EntityDeleteReturnType; - typedef TISDReturnType ISDeleteReturnType; - typedef TCDReturnType CorrelationDeleteReturnType; + using InfEntityType = typename TIETraits::Type; + using InfSpaceType = typename TISTraits::Type; + using CorrelationType = typename TSCTraits::Type; + using ConstInfEntityPointer = typename TIETraits::ConstPointer; + using ConstInfSpacePointer = typename TISTraits::ConstPointer; + using ConstCorrelationPointer = typename TSCTraits::ConstPointer; + using InfEntityInferencePointer = typename TIETraits::InferencePointer; + using InfSpaceInferencePointer = typename TISTraits::InferencePointer; + using CorrelationInferencePointer = typename TSCTraits::InferencePointer; + + using EntityDeleteReturnType = TEDReturnType; + using ISDeleteReturnType = TISDReturnType; + using CorrelationDeleteReturnType = TCDReturnType; /*! Defines and stores the copy of the passed entity and associates it with the passed information space * after checking all relevant integration rules.\n * Relevant integration rules: * - handleExistenceOnEntityDef * . * See integration rule set of application scenario for information how it is handled in the used scenario. * @param [in] pNewEntity Pointer to the entity that should be added as definition to the ontology. * @param [in] pContainingIS Pointer to the information space the entity sof the searched paths. * @return Returns the entity after the insertion of the definition into the ontology. * @pre pNewEntity must point to a valid instance. * @pre pContainingIS must point to a valid instance. * @pre pContainingIS must be defined in the ontology (use actualize() in order to check * this in before). * @exception ::iro::exceptions::InvalidArgument : pNewEntity or pContainingIS pointer is null. * @exception ::iro::exceptions::UndefinedElement : pContainingIS is not defined in the ontology. */ Result defineEntity(InfEntityInferencePointer pNewEntity, InfSpaceInferencePointer pContainingIS); /*! Stores the copy of the passed entity or commits the changes between the passed version of the entity and the * one stored in the ontology after checking all relevant integration rules.\n * Relevant integration rules: * - handleInexistenceOnEntityStore * . * See integration rule set of application scenario for information how it is handled in the used scenario. * @see IntegrationRuleSets * @param [in] pEntity Pointer to the entity whose changes should be commited to the ontology. * @return Returns the entity after the changes are commited to the ontology. * @pre pEntity must point to a valid instance. * @exception ::iro::exceptions::InvalidArgument : pEntity is null. */ Result storeEntity(InfEntityInferencePointer pEntity); /*! Deletes the passed entity after checking all relevant integration rules.\n * Relevant integration rules: * - handleInexistenceOnEntityDel * - handleDependentsOnEntityDel * . * See integration rule set of application scenario for information how it is handled in the used scenario. * @see IntegrationRuleSets * @param [in] pEntity Pointer to the entity that should be deleted. * @return The return type depends on the used scenario the the scenario and its interface realization for more information. * @pre pEntity must point to a valid instance. * @exception ::iro::exceptions::InvalidArgument : pEntity pointer is null. */ EntityDeleteReturnType deleteEntity(InfEntityInferencePointer pEntity); /*! Defines and stores the copy of the passed IS after checking all relevant integration rules.\n * Relevant integration rules: * - handleExistenceOnISDef * . * See integration rule set of application scenario for information how it is handled in the used scenario. * @param [in] pNewEntity Pointer to the entity that should be added as definition to the ontology. * @param [in] pContainingIS Pointer to the information space the entity sof the searched paths. * @return Returns the IS after the definition was added to the ontology. * @pre pNewIS must point to a valid instance. * @exception ::iro::exceptions::InvalidArgument : pNewIS pointer is null. */ Result defineInformationSpace(InfSpaceInferencePointer pNewIS); /*! Stores the copy of the passed IS or commits the changes between the passed version of the IS and the * one stored in the ontology after checking all relevant integration rules.\n * Relevant integration rules: * - handleInexistenceOnISStore * . * See integration rule set of application scenario for information how it is handled in the used scenario. * @see IntegrationRuleSets * @param [in] pIS Pointer to the IS whose changes should be commited to the ontology. * @return Returns the IS after the changes are commited to the ontology. * @pre pIS must point to a valid instance. * @exception ::iro::exceptions::InvalidArgument : pIS is null. */ Result storeInformationSpace(InfSpaceInferencePointer pIS); /*! Deletes the passed IS from the ontology after after checking all relevant integration rules.\n * Relevant integration rules: * - handleInexistenceOnISDel * - handleDepTransOnISDel * - handleDepEntitiesOnISDel * . * See integration rule set of application scenario for information how it is handled in the used scenario. * @see IntegrationRuleSets * @param [in] pIS Pointer to the IS that should be deleted. * @return The return type depends on the used scenario the the scenario and its interface realization for more information. * @pre pIS must point to a valid instance. * @exception ::iro::exceptions::InvalidArgument : pIS is null. */ ISDeleteReturnType deleteInformationSpace(InfSpaceInferencePointer pIS); /*! Changes the information space of a given entity after checking all relevant integration rules.\n * Relevant integration rules: * - handleDepTransOnEntitySwitch * . * See integration rule set of application scenario for information how it is handled in the used scenario. * @param [in] pEntity Pointer to the entity that should be reassigned to the new IS. * @param [in] pNewIS Pointer to the information space the entity should be reassigned to. * @pre pEntity must point to a valid instance. * @pre pNewIS must point to a valid instance. * @pre pEntity must be defined in the ontology (use actualize() in order to check * this in before). * @pre pNewIS must be defined in the ontology (use actualize() in order to check * this in before). * @exception ::iro::exceptions::InvalidArgument : pEntity or pNewIS is null. * @exception ::iro::exceptions::UndefinedElement : pEntity or pNewIS are not defined in the ontology. */ void switchInformationSpace(InfEntityInferencePointer pEntity, InfSpaceInferencePointer pNewIS); /*! Defines and stores the copy of the passed correlations * after checking all relevant integration rules.\n * Relevant integration rules: * - handleExistenceOnCorrDef * . * See integration rule set of application scenario for information how it is handled in the used scenario. * @param [in] pNewCorr Pointer to the correlation that should be added as definition to the ontology. * @return Returns the correlation after the definition was added to the ontology. * @pre pNewCorr must point to a valid instance. * @exception ::iro::exceptions::InvalidArgument : pNewCorr is null. */ Result defineSemanticCorrelation(CorrelationInferencePointer pNewCorr); /*! Stores the copy of the passed correlation or commits the changes between the passed version of the correlation and the * one stored in the ontology after checking all relevant integration rules.\n * Relevant integration rules: * - handleInexistenceOnCorrStore * . * See integration rule set of application scenario for information how it is handled in the used scenario. * @see IntegrationRuleSets * @param [in] corr Pointer to the correlation whose changes should be commited to the ontology. * @return Returns the correlation after the changes are commited to the ontology. * @pre corr must point to a valid instance. * @exception ::iro::exceptions::InvalidArgument : corr pointer is null. */ Result storeSemanticCorrelation(CorrelationInferencePointer corr); /*! Deletes the passed entity after checking all relevant integration rules.\n * Relevant integration rules: * - handleInexistenceOnCorrDel * . * See integration rule set of application scenario for information how it is handled in the used scenario. * @see IntegrationRuleSets * @param [in] corr Pointer to the correlation that should be deleted. * @return The return type depends on the used scenario the the scenario and its interface realization for more information. * @pre corr must point to a valid instance. * @exception ::iro::exceptions::InvalidArgument : corr is null. */ CorrelationDeleteReturnType deleteSemanticCorrelation(CorrelationInferencePointer corr); protected: - virtual ~IEntityIntegration() {}; - IEntityIntegration() {}; + virtual ~IEntityIntegration() = default; + IEntityIntegration() = default; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see defineEntity*/ virtual Result doDefineEntity(InfEntityInferencePointer pNewEntity, InfSpaceInferencePointer pContainingIS) = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see storeEntity*/ virtual Result doStoreEntity(InfEntityInferencePointer pEntity) = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see convertTransformationToRegistrationPath*/ virtual EntityDeleteReturnType doDeleteEntity(InfEntityInferencePointer pEntity) = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see defineInformationSpace*/ virtual Result doDefineInformationSpace(InfSpaceInferencePointer pNewIS) = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see storeInformationSpace*/ virtual Result doStoreInformationSpace(InfSpaceInferencePointer pIS) = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see deleteInformationSpace*/ virtual ISDeleteReturnType doDeleteInformationSpace(InfSpaceInferencePointer pIS) = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see switchInformationSpace*/ virtual void doSwitchInformationSpace(InfEntityInferencePointer pEntity, InfSpaceInferencePointer pNewIS) = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see defineSemanticCorrelation*/ virtual Result doDefineSemanticCorrelation(CorrelationInferencePointer pNewCorr) = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see storeSemanticCorrelation*/ virtual Result doStoreSemanticCorrelation(CorrelationInferencePointer corr) = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see deleteSemanticCorrelation*/ virtual CorrelationDeleteReturnType doDeleteSemanticCorrelation(CorrelationInferencePointer corr) = 0; using EntityInferenceInterface = TIEInference; /*!Sets the pointer to the interface that should be used to actualze inference elements * (e.g. entities or information spaces)*/ void setEntityInferenceInterface(const EntityInferenceInterface* pInterface); /*!Used to actualize the passed inference elements (e.g. entities or information spaces)*/ const EntityInferenceInterface* _pEntityInferenceInterface; private: IEntityIntegration(const IEntityIntegration&); //not implemented by purpose IEntityIntegration& operator=(const IEntityIntegration&); //not implemented by purpose }; } // end namespace core } // end namespace iro #ifndef MatchPoint_MANUAL_TPP #include "mapIEntityIntegration.tpp" #endif #endif diff --git a/Code/Ontology/Common/include/mapIEntityIntegration.tpp b/Code/Ontology/Common/include/mapIEntityIntegration.tpp index ec5d2f5..a40b5e6 100644 --- a/Code/Ontology/Common/include/mapIEntityIntegration.tpp +++ b/Code/Ontology/Common/include/mapIEntityIntegration.tpp @@ -1,207 +1,207 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_I_ENTITY_INTEGRATION_TPP #define __MAP_I_ENTITY_INTEGRATION_TPP -#include +#include #include "mapIEntityIntegration.h" namespace iro { namespace core { template Result::ConstInfEntityPointer> IEntityIntegration:: defineEntity(InfEntityInferencePointer pNewEntity, InfSpaceInferencePointer pContainingIS) { assert(_pEntityInferenceInterface); if (!pNewEntity) { throw exceptions::InvalidArgument("Cannot define entity. Passed entity pointer is NULL."); } if (!pContainingIS) { throw exceptions::InvalidArgument("Cannot define entity. Passed IS pointer is NULL."); } ConstInfSpacePointer spContainingIS = _pEntityInferenceInterface->actualize(pContainingIS); if (!spContainingIS) { throw exceptions::UndefinedElement("Cannot define entity. Passed IS is not defined in the ontology."); } return doDefineEntity(pNewEntity, spContainingIS); }; template Result::ConstInfEntityPointer> IEntityIntegration:: storeEntity(InfEntityInferencePointer pEntity) { if (!pEntity) { throw exceptions::InvalidArgument("Cannot store entity. Passed entity pointer is NULL."); } return doStoreEntity(pEntity); }; template typename IEntityIntegration::EntityDeleteReturnType IEntityIntegration:: deleteEntity(InfEntityInferencePointer pEntity) { if (!pEntity) { throw exceptions::InvalidArgument("Cannot store entity. Passed entity pointer is NULL."); } return doDeleteEntity(pEntity); }; template Result::ConstInfSpacePointer> IEntityIntegration:: defineInformationSpace(InfSpaceInferencePointer pNewIS) { if (!pNewIS) { throw exceptions::InvalidArgument("Cannot define IS. Passed IS pointer is NULL."); } return doDefineInformationSpace(pNewIS); }; template Result::ConstInfSpacePointer> IEntityIntegration:: storeInformationSpace(InfSpaceInferencePointer pIS) { if (!pIS) { throw exceptions::InvalidArgument("Cannot store IS. Passed IS pointer is NULL."); } return doStoreInformationSpace(pIS); }; template typename IEntityIntegration::ISDeleteReturnType IEntityIntegration:: deleteInformationSpace(InfSpaceInferencePointer pIS) { if (!pIS) { throw exceptions::InvalidArgument("Cannot delete IS. Passed IS pointer is NULL."); } return doDeleteInformationSpace(pIS); }; template void IEntityIntegration:: switchInformationSpace(InfEntityInferencePointer pEntity, InfSpaceInferencePointer pNewIS) { assert(_pEntityInferenceInterface); if (!pEntity) { throw exceptions::InvalidArgument("Cannot define entity. Passed entity pointer is NULL."); } if (!pNewIS) { throw exceptions::InvalidArgument("Cannot define entity. Passed IS pointer is NULL."); } ConstInfEntityPointer spEntity = _pEntityInferenceInterface->actualize(pEntity); if (!spEntity) { throw exceptions::UndefinedElement("Cannot switch entity. Passed entity is not defined in the ontology."); } ConstInfSpacePointer spNewIS = _pEntityInferenceInterface->actualize(pNewIS); if (!spNewIS) { throw exceptions::UndefinedElement("Cannot switch entity. Passed IS is not defined in the ontology."); } doSwitchInformationSpace(spEntity, spNewIS); }; template Result::ConstCorrelationPointer> IEntityIntegration:: defineSemanticCorrelation(CorrelationInferencePointer pNewCorr) { if (!pNewCorr) { throw exceptions::InvalidArgument("Cannot define correlation. Passed correlation pointer is NULL."); } return doDefineSemanticCorrelation(pNewCorr); }; template Result::ConstCorrelationPointer> IEntityIntegration:: storeSemanticCorrelation(CorrelationInferencePointer corr) { if (!corr) { throw exceptions::InvalidArgument("Cannot store correlation. Passed correlation pointer is NULL."); } return doStoreSemanticCorrelation(corr); }; template typename IEntityIntegration::CorrelationDeleteReturnType IEntityIntegration:: deleteSemanticCorrelation(CorrelationInferencePointer corr) { if (!corr) { throw exceptions::InvalidArgument("Cannot delete correlation. Passed correlation pointer is NULL."); } return doDeleteSemanticCorrelation(corr); }; template void IEntityIntegration:: setEntityInferenceInterface(const EntityInferenceInterface* pInterface) { _pEntityInferenceInterface = pInterface; }; } // end namespace core } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapIInformationSpaceConnector.h b/Code/Ontology/Common/include/mapIInformationSpaceConnector.h index ea5718e..e080490 100644 --- a/Code/Ontology/Common/include/mapIInformationSpaceConnector.h +++ b/Code/Ontology/Common/include/mapIInformationSpaceConnector.h @@ -1,52 +1,52 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_I_INFORMATION_SPACE_CONNECTOR_H #define __MAP_I_INFORMATION_SPACE_CONNECTOR_H namespace iro { /** Interface for any class that realizes a connection between two information spaces. Most relevant realizations are TransformationInfo and RegistrationInfo.*/ template class IInformationSpaceConnector { public: - typedef typename TInformationSpaceTraits::ConstPointer ConstISPointer; + using ConstISPointer = typename TInformationSpaceTraits::ConstPointer; /** Returns the pointer to the associated moving information space. If the connector has no IS defined the return * can be a NULL pointer.*/ virtual ConstISPointer getMovingIS() const = 0 ; /** Returns the pointer to the associated moving information space. If the connector has no IS defined the return * can be a NULL pointer.*/ virtual ConstISPointer getTargetIS() const = 0 ; protected: - virtual ~IInformationSpaceConnector() {}; - IInformationSpaceConnector() {}; + virtual ~IInformationSpaceConnector() = default; + IInformationSpaceConnector() = default; private: - IInformationSpaceConnector(const IInformationSpaceConnector&); //not implemented by purpose - IInformationSpaceConnector& operator=(const IInformationSpaceConnector&); //not implemented by purpose + IInformationSpaceConnector(const IInformationSpaceConnector&) = delete; //not implemented by purpose + IInformationSpaceConnector& operator=(const IInformationSpaceConnector&) = delete; //not implemented by purpose }; } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapIMappingInference.h b/Code/Ontology/Common/include/mapIMappingInference.h index 71fd992..d2bea24 100644 --- a/Code/Ontology/Common/include/mapIMappingInference.h +++ b/Code/Ontology/Common/include/mapIMappingInference.h @@ -1,565 +1,565 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_I_MAPPING_INFERENCE_H #define __MAP_I_MAPPING_INFERENCE_H #include "mapOntologyResult.h" #include "mapDataRepresentation.h" #include "mapMappingError.h" #include "mapIProblemComplianceDefinition.h" #include "mapIProblemStatementAssociated.h" #include "mapIPathMetric.h" #include "mapIEntityInference.h" namespace iro { namespace core { /*! @class IMappingInference * @brief Interface of the registration ontology decorator used for inference queries in the context of mapping and registration/transformation. * * As inference interface it is analog to a pure getter interface. * Setting and writing will be done be integration interfaces (IMappingIntegration). * This interface is implemented regarding the NVI paradigm. * * @tparam TRPTraits type that define the traits of registration paths. * @tparam TRPOCTraits type that define the traits of registration path option collections. * @tparam TTPOCTraits type that define the traits of transformation path option collections. * @tparam TIEInference type of the information entity inference interface that should be used. * @sa IProblemInference * @sa IViewingInference * @sa IEntityInference * @sa IMappingIntegration * @ingroup Inference */ template class IMappingInference { public: - typedef typename TRPTraits::InformationEntityTraitsType InformationEntityTraitsType; - typedef typename TRPTraits::InformationSpaceTraitsType InformationSpaceTraitsType; - typedef typename TRPTraits::ProblemStatementTraitsType ProblemStatementTraitsType; - typedef typename TRPTraits::RegistrationInfoTraitsType RegistrationInfoTraitsType; - typedef typename TRPTraits::TransformationInfoTraitsType TransformationInfoTraitsType; - typedef typename TRPTraits::TransformationPathTraitsType TransformationPathTraitsType; - - typedef typename InformationEntityTraitsType::Type InfEntityType; - typedef typename InformationSpaceTraitsType::Type InfSpaceType; - typedef typename ProblemStatementTraitsType::Type ProblemStatementType; - typedef IProblemComplianceDefinition ProblemComplianceInterface; - typedef typename InformationEntityTraitsType::InferencePointer InfEntityInferencePointer; - typedef typename InformationSpaceTraitsType::InferencePointer InfSpaceInferencePointer; - - typedef typename InfEntityType::ConstPointer ConstInfEntityPointer; - typedef typename InfSpaceType::ConstPointer ConstInfSpacePointer; - typedef typename std::vector ConstInfEntityVectorType; - typedef typename std::vector ConstInfSpaceVectorType; - - typedef typename RegistrationInfoTraitsType::Type RegistrationInfoType; - typedef typename RegistrationInfoType::Pointer RegistrationInfoPointer; - typedef typename RegistrationInfoType::ConstPointer ConstRegistrationInfoPointer; - typedef typename RegistrationInfoTraitsType::InferencePointer RegistrationInfoInferencePointer; - - typedef typename TransformationInfoTraitsType::Type TransformationInfoType; - typedef typename TransformationInfoType::Pointer TransformationInfoPointer; - typedef typename TransformationInfoType::ConstPointer ConstTransformationInfoPointer; - typedef typename TransformationInfoTraitsType::InferencePointer TransformationInfoInferencePointer; - - typedef IPathMetric RegPathMetricInterface; - typedef IPathMetric TransPathMetricInterface; - - typedef typename TRPTraits::Type RegistrationPathType; - typedef typename TRPTraits::ConstPointer ConstRegistrationPathPointer; - - typedef typename TransformationPathTraitsType::Type TransformationPathType; - typedef typename TransformationPathTraitsType::ConstPointer ConstTransformationPathPointer; - - typedef typename TRPOCTraits::Type RegPathOptCollectionType; - typedef typename TRPOCTraits::ConstPointer ConstRegPathOptColPointer; - typedef std::vector ConstRegPathOptColVectorType; - - typedef typename TTPOCTraits::Type TransPathOptCollectionType; - typedef typename TTPOCTraits::ConstPointer ConstTransPathOptColPointer; - typedef std::vector ConstTransPathOptColVectorType; - - typedef MappingError::Type MappingErrorType; + using InformationEntityTraitsType = typename TRPTraits::InformationEntityTraitsType; + using InformationSpaceTraitsType = typename TRPTraits::InformationSpaceTraitsType; + using ProblemStatementTraitsType = typename TRPTraits::ProblemStatementTraitsType; + using RegistrationInfoTraitsType = typename TRPTraits::RegistrationInfoTraitsType; + using TransformationInfoTraitsType = typename TRPTraits::TransformationInfoTraitsType; + using TransformationPathTraitsType = typename TRPTraits::TransformationPathTraitsType; + + using InfEntityType = typename InformationEntityTraitsType::Type; + using InfSpaceType = typename InformationSpaceTraitsType::Type; + using ProblemStatementType = typename ProblemStatementTraitsType::Type; + using ProblemComplianceInterface = IProblemComplianceDefinition; + using InfEntityInferencePointer = typename InformationEntityTraitsType::InferencePointer; + using InfSpaceInferencePointer = typename InformationSpaceTraitsType::InferencePointer; + + using ConstInfEntityPointer = typename InfEntityType::ConstPointer; + using ConstInfSpacePointer = typename InfSpaceType::ConstPointer; + using ConstInfEntityVectorType = typename std::vector; + using ConstInfSpaceVectorType = typename std::vector; + + using RegistrationInfoType = typename RegistrationInfoTraitsType::Type; + using RegistrationInfoPointer = typename RegistrationInfoType::Pointer; + using ConstRegistrationInfoPointer = typename RegistrationInfoType::ConstPointer; + using RegistrationInfoInferencePointer = typename RegistrationInfoTraitsType::InferencePointer; + + using TransformationInfoType = typename TransformationInfoTraitsType::Type; + using TransformationInfoPointer = typename TransformationInfoType::Pointer; + using ConstTransformationInfoPointer = typename TransformationInfoType::ConstPointer; + using TransformationInfoInferencePointer = typename TransformationInfoTraitsType::InferencePointer; + + using RegPathMetricInterface = IPathMetric; + using TransPathMetricInterface = IPathMetric; + + using RegistrationPathType = typename TRPTraits::Type; + using ConstRegistrationPathPointer = typename TRPTraits::ConstPointer; + + using TransformationPathType = typename TransformationPathTraitsType::Type; + using ConstTransformationPathPointer = typename TransformationPathTraitsType::ConstPointer; + + using RegPathOptCollectionType = typename TRPOCTraits::Type; + using ConstRegPathOptColPointer = typename TRPOCTraits::ConstPointer; + using ConstRegPathOptColVectorType = std::vector; + + using TransPathOptCollectionType = typename TTPOCTraits::Type; + using ConstTransPathOptColPointer = typename TTPOCTraits::ConstPointer; + using ConstTransPathOptColVectorType = std::vector; + + using MappingErrorType = MappingError::Type; /*! Queries for all registration paths that are (potentially) able to map between the passed * moving and fixed information space. * @remark It is only guaranteed that every found registration path by default connects both information spaces. * But a returned path may be unable to map a specific entity of the information space (e.g. wrong field of view, * wrong data representation support). To get registration paths that care about mapping support for certain entities, * use the overloaded version with movingEntities parameter. * @param [in] pMovingIS Pointer to the moving information space of the searched paths. * @param [in] pFixedIS Pointer to the target information space of the searched paths. * @param [in] pProblemCompliance Pointer to a ProblemComplianceInterface (normaly implemented by a ProblemStatement or ProblemModel). If an instance is * given every element will be checked for compliance (e.g. same ProblemStamtement or within same ProblemModel). If a null pointer is * passed the problem compliance is not regarded -> any path will be returned. * @return A collection containing pointers to all registration path found. * @pre pMovingIS must point to a valid instance. * @pre pFixedIS must point to a valid instance. * @pre pMovingIS must be defined in the ontology (use actualize() in order to check * this in before). * @pre pFixedIS must be defined in the ontology (use actualize() in order to check * this in before). * @exception ::iro::exceptions::InvalidArgument : pMovingIS or pFixedIS pointer is null. * @exception ::iro::exceptions::UndefinedElement : at least one of th entities is not defined in the ontology. */ Result getRegistrationPaths(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = NULL) const; /*! For each passed entity all registration paths that are able to map the entity into the fixed information space are compiled. * Each RegistrationPathOptionCollections instance contains all valid registration paths for a specific entity to map it into the fixed * information space. * @param [in] movingEntities Collection with all entities for which valid path options should be found. * @param [in] pFixedIS Pointer to the target information space of the searched paths where the entities should be mapped to. * @param [in] pProblemCompliance Pointer to a ProblemComplianceInterface (normaly implemented by a ProblemStatement or ProblemModel). If an instance is * given every element will be checked for compliance (e.g. same ProblemStamtement or within same ProblemModel). If a null pointer is * passed the problem compliance is not regarded -> any path will be returned. * @return A vector to collections for all entities with their RegistrationPathOptions found. * A collection may contain no options. meaning that there are no possibilities for a certain entity * to be mapped. * @remark The passed moving entity vector and the collection vector are sorted in the same way. * thus you can use the same index to adress the entity and its collection. * @pre pFixedIS must point to a valid instance. * @pre pFixedIS must be defined in the ontology (use actualize() in order to check * this in before). * @pre movingEntities must contain elements that are defined in the ontology (use actualize() in order to check * this in before). * @exception ::iro::exceptions::InvalidArgument : pFixedIS pointer is null. * @exception ::iro::exceptions::UndefinedElement : at least one of the entities or the information space is not defined in the ontology. */ Result getRegistrationPaths(const ConstInfEntityVectorType& movingEntities, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = NULL) const; /*! Queries for all transformation paths that are (potentially) able to map between * the passed moving and fixed information space. * @remark It is only guaranteed that every found transformation path by default connects * both information spaces. But each path is only able to map one type of representation * data and may be unable to map a specific entity of the information space * (e.g. wrong field of view, wrong data representation support). * To get transformation paths that care about mapping support for certain entities, * use one of the overloaded entity specific versions. * @param [in] pMovingIS Pointer to the moving information space of the searched paths. * @param [in] pFixedIS Pointer to the target information space of the searched paths. * @param [in] pProblemCompliance Pointer to a ProblemComplianceInterface (normaly implemented by a ProblemStatement or ProblemModel). If an instance is * given every element will be checked for compliance (e.g. same ProblemStamtement or within same ProblemModel). If a null pointer is * passed the problem compliance is not regarded -> any path will be returned. * @return A collection containing pointers to all transformation path found. * @pre pMovingIS must point to a valid instance. * @pre pFixedIS must point to a valid instance. * @pre pMovingIS must be defined in the ontology (use actualize() in order to check * this in before). * @pre pFixedIS must be defined in the ontology (use actualize() in order to check * this in before). * @exception ::iro::exceptions::InvalidArgument : pMovingIS or pFixedIS pointer is null. * @exception ::iro::exceptions::UndefinedElement : at least one of the information spaces is not defined in the ontology. */ Result getTransformationPaths(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = NULL) const; /*! For each passed entity all transformation paths that are able to map the entity into the fixed information space are compiled. Each TransPathOptionCollections instance contains all valid transformation paths for a specific entity to map it into the fixed information space. * @param [in] movingEntities Collection with all entities for which valid path options should be found. * @param [in] pFixedIS Pointer to the target information space of the searched paths where the entities should be mapped to. * @param [in] pProblemCompliance Pointer to a ProblemComplianceInterface (normaly implemented by a ProblemStatement or ProblemModel). If an instance is * given every element will be checked for compliance (e.g. same ProblemStamtement or within same ProblemModel). If a null pointer is * passed the problem compliance is not regarded -> any path will be returned. * @return A vector to collections for all entities with their TransformationPathOptions found. * A collection may contain no options. meaning that there are no possibilities for a certain entity * to be mapped. * @remark The passed moving entity vector and the collection vector are sorted in the same way. * thus you can use the same index to adress the entity and its collection. * @pre pFixedIS must point to a valid instance. * @pre pFixedIS must be defined in the ontology (use actualize() in order to check * this in before). * @pre movingEntities must contain elements that are defined in the ontology (use actualize() in order to check * this in before). * @exception ::iro::exceptions::InvalidArgument : pFixedIS pointer is null. * @exception ::iro::exceptions::UndefinedElement : at least one of the entities or the information space is not defined in the ontology. */ Result getTransformationPaths(const ConstInfEntityVectorType& movingEntities, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = NULL) const; /*! Queries for the optimal registration path that is (potentially) able to map between the passed * moving and fixed information space. How a path is evaluated as optimal can be defined via passing an * instance implementing a RegPathMetricInterface. This metric will be used to calculate the "costs" of each * path step in order to find an optimal path. * @remark It is only guaranteed that every found transformation path by default connects both information spaces. * But a returned path may be unable to map a specific entity of the information space (e.g. wrong field of view, * wrong data representation support). To get registration paths that care about mapping support for certain entities, * use the overloaded version with movingEntities parameter. * @remark Normaly the returned collection should contain only one path. But it is possible that several paths have the same * optimal rating. In this case all will be returned in the collection. If this is the case, you should either readjust the criterias * and redo the search, or just pick the path you like because regarding the given criteria all options are fine. * @remark If no metric is passed via pMetric, the definition of "optimum" depends on the application scenerio and is defined by its * implementation. Please see the documentation of the scenario for more information. * @param [in] pMovingIS Pointer to the moving information space of the searched paths. * @param [in] pFixedIS Pointer to the target information space of the searched paths. * @param [in] pMetric Pointer to the metric that is used to evaluate every path element. If NULL is passed the default optimum criteria will be used. * @param [in] requiredDataSupport Specifies the data representation support that should be regarded. * The sum of all path element measures is the rating for the complete graph. * @param [in] pProblemCompliance Pointer to a ProblemComplianceInterface (normaly implemented by a ProblemStatement or ProblemModel). If an instance is * given every element will be checked for compliance (e.g. same ProblemStamtement or within same ProblemModel). If a null pointer is * passed the problem compliance is not regarded -> any path will be returned. * @return A collection containing pointers to all optimal registration path options found. * @pre pMovingIS must point to a valid instance. * @pre pFixedIS must point to a valid instance. * @pre pMovingIS must be defined in the ontology (use actualize() in order to check * this in before). * @pre pFixedIS must be defined in the ontology (use actualize() in order to check * this in before). * @exception ::iro::exceptions::InvalidArgument : pMovingIS or pFixedIS pointer is null. * @exception ::iro::exceptions::UndefinedElement : at least one of the information spaces is not defined in the ontology. */ Result getOptimalRegistrationPaths(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, DataRepresentationSupport::Type requiredDataSupport = DataRepresentationSupport::All, const ProblemComplianceInterface* pProblemCompliance = NULL, const RegPathMetricInterface* pMetric = NULL) const; /*! For each passed entity all optimal registration paths, that are able to map the entity into the fixed information * space, are compiled. How a path is evaluated as optimal can be defined via passing an * instance implementing a RegPathMetricInterface. This metric will be used to calculate the "costs" of each * path step in order to find an optimal path. * @remark Normaly the returned collection should contain only one optimal path. But it is possible that several paths have the same * optimal rating. In this case all will be returned in the collection. If this is the case, you should either readjust the criterias * and redo the search, or just pick the path you like because regarding the given criteria all options are fine. * @remark If no metric is passed via pMetric, the definition of "optimum" depends on the application scenerio and is defined by its * implementation. Please see the documentation of the scenario for more information. * @param [in] movingEntities Collection with all entities for which valid path options should be found. * @param [in] pFixedIS Pointer to the target information space of the searched paths. * @param [in] pMetric Pointer to the metric that is used to evaluate every path element. If NULL is passed the default optimum criteria will be used. * The sum of all path element measures is the rating for the complete graph. * @param [in] pProblemCompliance Pointer to a ProblemComplianceInterface (normaly implemented by a ProblemStatement or ProblemModel). If an instance is * given every element will be checked for compliance (e.g. same ProblemStamtement or within same ProblemModel). If a null pointer is * passed the problem compliance is not regarded -> any path will be returned. * @return A vector to collections for all entities with their optimal RegistrationPathOptions found. * A collection may contain no options. meaning that there are no possibilities for a certain entity * to be mapped. * @remark The passed moving entity vector and the collection vector are sorted in the same way. * thus you can use the same index to adress the entity and its collection. * @pre pFixedIS must point to a valid instance. * @pre pFixedIS must be defined in the ontology (use actualize() in order to check * this in before). * @pre movingEntities must contain elements that are defined in the ontology (use actualize() in order to check * this in before). * @exception ::iro::exceptions::InvalidArgument : pFixedIS pointer is null. * @exception ::iro::exceptions::UndefinedElement : at least one of the entities or the information space is not defined in the ontology. */ Result getOptimalRegistrationPaths(const ConstInfEntityVectorType& movingEntities, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = NULL, const RegPathMetricInterface* pMetric = NULL) const; /*! Queries for the optimal transformation path that is (potentially) able to map between the passed * moving and fixed information space. How a path is evaluated as optimal can be defined via passing an * instance implementing a TransPathMetricInterface. This metric will be used to calculate the "costs" of each * path step in order to find an optimal path. * @remark It is only guaranteed that every found transformation path by default connects both information spaces. * But a returned path may be unable to map a specific entity of the information space (e.g. wrong field of view, * wrong data representation support). To get registration paths that care about mapping support for certain entities, * use the overloaded version with movingEntities parameter. * @remark Normaly the returned collection should contain only one path. But it is possible that several paths have the same * optimal rating. In this case all will be returned in the collection. If this is the case, you should either readjust the criterias * and redo the search, or just pick the path you like because regarding the given criteria all options are fine. * @remark If no metric is passed via pMetric, the definition of "optimum" depends on the application scenerio and is defined by its * implementation. Please see the documentation of the scenario for more information. * @param [in] pMovingIS Pointer to the moving information space of the searched paths. * @param [in] pFixedIS Pointer to the target information space of the searched paths. * @param [in] pMetric Pointer to the metric that is used to evaluate every path element. If NULL is passed the default optimum criteria will be used. * The sum of all path element measures is the rating for the complete graph. * @param [in] pProblemCompliance Pointer to a ProblemComplianceInterface (normaly implemented by a ProblemStatement or ProblemModel). If an instance is * given every element will be checked for compliance (e.g. same ProblemStamtement or within same ProblemModel). If a null pointer is * passed the problem compliance is not regarded -> any path will be returned. * @return A collection containing pointers to all optimal transformation path found. * @pre pMovingIS must point to a valid instance. * @pre pFixedIS must point to a valid instance. * @pre pMovingIS must be defined in the ontology (use actualize() in order to check * this in before). * @pre pFixedIS must be defined in the ontology (use actualize() in order to check * this in before). * @exception ::iro::exceptions::InvalidArgument : pMovingIS or pFixedIS pointer is null. * @exception ::iro::exceptions::UndefinedElement : at least one of the information spaces is not defined in the ontology. */ Result getOptimalTransformationPaths(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = NULL, const TransPathMetricInterface* pMetric = NULL) const; /*! For each passed entity all optimal transformation paths that are able to map the entity into the fixed information * space are compiled. How a path is evaluated as optimal can be defined via passing an * instance implementing a TransPathMetricInterface. This metric will be used to calculate the "costs" of each * path step in order to find an optimal path. * @remark It is only guaranteed that every found transformation path by default connects both information spaces. * But a returned path may be unable to map a specific entity of the information space (e.g. wrong field of view, * wrong data representation support). To get registration paths that care about mapping support for certain entities, * use the overloaded version with movingEntities parameter. * @remark Normaly the returned collection should contain only one path. But it is possible that several paths have the same * optimal rating. In this case all will be returned in the collection. If this is the case, you should either readjust the criterias * and redo the search, or just pick the path you like because regarding the given criteria all options are fine. * @remark If no metric is passed via pMetric, the definition of "optimum" depends on the application scenerio and is defined by its * implementation. Please see the documentation of the scenario for more information. * @param [in] movingEntities Collection with all entities for which valid path options should be found. * @param [in] pFixedIS Pointer to the target information space of the searched paths. * @param [in] pMetric Pointer to the metric that is used to evaluate every path element. If NULL is passed the default optimum criteria will be used. * The sum of all path element measures is the rating for the complete graph. * @param [in] pProblemCompliance Pointer to a ProblemComplianceInterface (normaly implemented by a ProblemStatement or ProblemModel). If an instance is * given every element will be checked for compliance (e.g. same ProblemStamtement or within same ProblemModel). If a null pointer is * passed the problem compliance is not regarded -> any path will be returned. * @return A vector to collections for all entities with their optimal TransformationPathOptions found. * A collection may contain no options. meaning that there are no possibilities for a certain entity * to be mapped. * @remark The passed moving entity vector and the collection vector are sorted in the same way. * thus you can use the same index to adress the entity and its collection. * @pre pFixedIS must point to a valid instance. * @pre pFixedIS must be defined in the ontology (use actualize() in order to check * this in before). * @exception ::iro::exceptions::InvalidArgument : pFixedIS pointer is null. * @exception ::iro::exceptions::UndefinedElement : the information spaces is not defined in the ontology. */ Result getOptimalTransformationPaths(const ConstInfEntityVectorType& movingEntities, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = NULL, const TransPathMetricInterface* pMetric = NULL) const; /*! Queries for all information spaces that can be mapped into a given information space * How a path is evaluated as optimal can be defined via passing an * instance implementing a RegPathMetricInterface. This metric will be used to calculate the "costs" of each * path step in order to find an optimal path. * @remark It is only guaranteed that every found IS is connected. * But there may be no existing path that is able to map a specific entity of the information space (e.g. wrong field of view, * wrong data representation support). To get registration paths that care about mapping support for certain entities, * use getOptimalTransformationPath() for entities. * @remark Normally the returned collection should contain only one path. But it is possible that several paths have the same * optimal rating. In this case all will be returned in the collection. If this is the case, you should either readjust the criterias * and redo the search, or just pick the path you like because regarding the given criteria all options are fine. * @remark If no metric is passed via pMetric, the definition of "optimum" depends on the application scenerio and is defined by its * implementation. Please see the documentation of the scenario for more information. * @param [in] pFixedIS Pointer to the target information space of the searched paths. * @param [in] pMetric Pointer to the metric that is used to evaluate every path element. If NULL is passed the default optimum criteria will be used. * @param [in] requiredDataSupport Specifies the data representation support that should be regarded. * The sum of all path element measures is the rating for the complete graph. * @param [in] pProblemCompliance Pointer to a ProblemComplianceInterface (normaly implemented by a ProblemStatement or ProblemModel). If an instance is * given every element will be checked for compliance (e.g. same ProblemStamtement or within same ProblemModel). If a null pointer is * passed the problem compliance is not regarded -> any path will be returned. * @return A collection of information spaces that can be mapped. * @pre pFixedIS must point to a valid instance. * @pre pFixedIS must be defined in the ontology (use actualize() in order to check * this in before). * @exception ::iro::exceptions::InvalidArgument : pFixedIS pointer is null. * @exception ::iro::exceptions::UndefinedElement : the information spaces is not defined in the ontology. */ Result getMappableInformationSpaces(InfSpaceInferencePointer pFixedIS, DataRepresentationSupport::Type requiredDataSupport = DataRepresentationSupport::All, const ProblemComplianceInterface* pProblemCompliance = NULL, const RegPathMetricInterface* pMetric = NULL) const; /*! Checks if there are any valid transformation paths for enitity pMovingEntity to get mapped into pFixedIS. If not, it will be ascertained why * there is no suitable transformation path. The most precise reason will be returned: * - No failure (at least one valid path is available): MappingError::NoFailure * - No TransformationPath available : MappingError::NoPath * - No TransformationPath for the needed data type (meaning: there are tranformation paths but not for the required data type support) : MappingError::NoDataSupport * - No TransformationPath with sufficient FOV/Mapping guarantee : MappingError::NoMappingGuarantee * . * @param [in] pMovingEntity Pointer to the entity that should be checked for mapping failures. * @param [in] pFixedIS Pointer to the target information space of the paths that should be validated. * @param [in] pProblemCompliance Pointer to a ProblemComplianceInterface (normaly implemented by a ProblemStatement or ProblemModel). If an instance is * given every element will be checked for compliance (e.g. same ProblemStamtement or within same ProblemModel). If a null pointer is * passed the problem compliance is not regarded -> any path will be returned. * @return The mapping error reason. * @pre pFixedIS must point to a valid instance. * @pre pMovingEntity must point to a valid instance. * @pre pFixedIS must be defined in the ontology (use actualize() in order to check * this in before). * @pre pMovingEntity must be defined in the ontology (use actualize() in order to check * this in before). * @exception ::iro::exceptions::InvalidArgument : pMovingEntity or pFixedIS pointer is null. * @exception ::iro::exceptions::UndefinedElement : the entity or the information spaces is not defined in the ontology. */ Result checkForMappingFailureReason(InfEntityInferencePointer pMovingEntity, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = NULL) const; /*! Checks if there are any valid transformation paths that maps between the given information spaces regarding the defined data * representation support. If not, it will be ascertained why there is no suitable transformation path. The most precise reason * will be returned: * - No failure (at least one valid path is available, but mapping is not guaranteed): MappingError::NoFailure * - No TransformationPath available : MappingError::NoPath * - No TransformationPath for the needed data type (meaning: there are tranformation paths but not for the required data type support) : MappingError::NoDataSupport * . * @Remark This function cannot guarantee full mapping. If it returns with no error it only indicates that * at least a part of the information could be mapped. If you also want to check vor mapping guarantee, use * the overloaded member and pass a concrete entity that should be checked. * @param [in] pMovingIS Pointer to the moving information space of the paths that should be validated. * @param [in] pFixedIS Pointer to the target information space of the paths that should be validated. * @param [in] requiredDataSupport Specifies the data representation support that should be regarded. * @param [in] pProblemCompliance Pointer to a ProblemComplianceInterface (normaly implemented by a ProblemStatement or ProblemModel). If an instance is * given every element will be checked for compliance (e.g. same ProblemStamtement or within same ProblemModel). If a null pointer is * passed the problem compliance is not regarded -> any path will be returned. * @return The mapping error reason. * @pre pFixedIS must point to a valid instance. * @pre pMovingIS must point to a valid instance. * @pre pFixedIS must be defined in the ontology (use actualize() in order to check * this in before). * @pre pMovingIS must be defined in the ontology (use actualize() in order to check * this in before). * @exception ::iro::exceptions::InvalidArgument : pMovingIS or pFixedIS pointer is null. * @exception ::iro::exceptions::UndefinedElement : at least one of the information spaces is not defined in the ontology. */ Result checkForMappingFailureReason(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, DataRepresentationSupport::Type requiredDataSupport = DataRepresentationSupport::All, const ProblemComplianceInterface* pProblemCompliance = NULL) const; /*! Checks if the passed registration path is able to map the given movingEntity. * If not, it will be acertained why there is no suitable registration path. The most precise reason will be returned: * - No failure (at least one valid path is available): MappingError::NoFailure * - No TransformationPath available : MappingError::NoPath * - No TransformationPath for the needed data type (meaning: there are tranformation paths but not for the required data type support) : MappingError::NoDataSupport * - No TransformationPath with sufficient FOV/Mapping guarantee : MappingError::NoMappingGuarantee * . * @param [in] pMovingEntity Pointer to the entity that should be checked for mapping failures. * @param [in] pPath Pointer to the path that should be checked for failure. * @return The mapping error reason. * @pre pPath must point to a valid instance. * @pre pMovingEntity must point to a valid instance. * @pre pMovingEntity must be defined in the ontology (use actualize() in order to check * this in before). * @pre Moving and fixed IS of pPath must be defined in the ontology. * @exception ::iro::exceptions::InvalidArgument : pMovingEntity or pPath pointer is null. * @exception ::iro::exceptions::UndefinedElement : the entity or the ISs of the path are not defined in the ontology. */ Result checkForMappingFailureReason(InfEntityInferencePointer pMovingEntity, ConstRegistrationPathPointer pPath) const; /*! Checks if the passed transformation path is able to map the given movingEntity. * If not, it will be acertained why there is no suitable transformation path. The most precise reason will be returned: * - No failure (at least one valid path is available): MappingError::NoFailure * - No TransformationPath available (the passed path has not the same moving information space): MappingError::NoPath * - No TransformationPath for the needed data type (meaning: there are tranformation paths but not for the required data type support) : MappingError::NoDataSupport * - No TransformationPath with sufficient FOV/Mapping guarantee : MappingError::NoMappingGuarantee * . * @param [in] pMovingEntity Pointer to the entity that should be checked for mapping failures. * @param [in] pPath Pointer to the path that should be checked for failure. * @return The mapping error reason. * @pre pPath must point to a valid instance. * @pre pMovingEntity must point to a valid instance. * @pre pMovingEntity must be defined in the ontology (use actualize() in order to check * this in before). * @pre Moving and target IS of pPath must be defined in the ontology. * @exception ::iro::exceptions::InvalidArgument : pMovingEntity or pPath pointer is null. * @exception ::iro::exceptions::UndefinedElement : the entity or the ISs of the path are not defined in the ontology. */ Result checkForMappingFailureReason(InfEntityInferencePointer pMovingEntity, ConstTransformationPathPointer pPath) const; /*! This function converts a given transformation path into a registration path. * This is done by searching the fitting complement TransformationInfo (if it exists) * for each TransformationInfo in the path and compiling them into a RegistrationInfo. * If no complement transformation info exists the RegistrationInfo will stay undefined * for the affected data representation type. * @remark A transformation info B is complement to info A if A and B have the same moving and fixed * information spaces and the same problem statement but different data representations (one * is discrete, the other is continuous). * @param [in] pPath Pointer to the path that should be converted. * @return The pointer to the instance of the registration path. * @pre pPath must point to a valid instance. * @pre Moving and target IS of pPath must be defined in the ontology. * @exception ::iro::exceptions::UndefinedElement : The ISs of the path are not defined in the ontology. * @exception ::iro::exceptions::InvalidArgument : pPath pointer is null.*/ Result convertTransformationToRegistrationPath(ConstTransformationPathPointer pPath) const; /*!Takes the passed transformation information and returns the current version (UID equals) * that represents the current state of the ontology. * @param [in] pTI Pointer to the transformation info that should be actualized. * @return Smart pointer to the current version of the element. If the information space * does not exist (any more) in the ontology, a NULL pointer will be returned. * @pre pTI must point to valid instances. * @overload * @exception ::iro::exceptions::InvalidArgument : pIS is not a valid pointer.*/ Result actualize(TransformationInfoInferencePointer pTI) const; protected: - virtual ~IMappingInference() {}; - IMappingInference() {}; + virtual ~IMappingInference() = default; + IMappingInference() = default; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getRegistrationPaths*/ virtual Result doGetRegistrationPaths(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = NULL) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getRegistrationPaths*/ virtual Result doGetRegistrationPaths(const ConstInfEntityVectorType& movingEntities, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = NULL) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getTransformationPaths*/ virtual Result doGetTransformationPaths(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = NULL) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getTransformationPaths*/ virtual Result doGetTransformationPaths(const ConstInfEntityVectorType& movingEntities, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = NULL) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getOptimalRegistrationPaths*/ virtual Result doGetOptimalRegistrationPaths(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, DataRepresentationSupport::Type requiredDataSupport, const ProblemComplianceInterface* pProblemCompliance = NULL, const RegPathMetricInterface* pMetric = NULL) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getOptimalRegistrationPaths*/ virtual Result doGetOptimalRegistrationPaths(const ConstInfEntityVectorType& movingEntities, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = NULL, const RegPathMetricInterface* pMetric = NULL) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getOptimalTransformationPaths*/ virtual Result doGetOptimalTransformationPaths(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = NULL, const TransPathMetricInterface* pMetric = NULL) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getOptimalTransformationPaths*/ virtual Result doGetOptimalTransformationPaths(const ConstInfEntityVectorType& movingEntities, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = NULL, const TransPathMetricInterface* pMetric = NULL) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getMappableInformationSpaces*/ virtual Result doGetMappableInformationSpaces(InfSpaceInferencePointer pFixedIS, DataRepresentationSupport::Type requiredDataSupport = DataRepresentationSupport::All, const ProblemComplianceInterface* pProblemCompliance = NULL, const RegPathMetricInterface* pMetric = NULL) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see checkForMappingFailureReason*/ virtual Result doCheckForMappingFailureReason(InfEntityInferencePointer pMovingEntity, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = NULL) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see checkForMappingFailureReason*/ virtual Result doCheckForMappingFailureReason(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, DataRepresentationSupport::Type requiredDataSupport = DataRepresentationSupport::All, const ProblemComplianceInterface* pProblemCompliance = NULL) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see checkForMappingFailureReason*/ virtual Result doCheckForMappingFailureReason(InfEntityInferencePointer pMovingEntity, ConstRegistrationPathPointer pPath) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see checkForMappingFailureReason*/ virtual Result doCheckForMappingFailureReason(InfEntityInferencePointer pMovingEntity, ConstTransformationPathPointer pPath) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see convertTransformationToRegistrationPath*/ virtual Result doConvertTransformationToRegistrationPath(ConstTransformationPathPointer pPath) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see actualize*/ virtual Result doActualize(TransformationInfoInferencePointer pTI) const = 0; /*! Helper function that checks the entities in the vector if they are part of the ontology * and returns the vector containing the actualized entites. If at least one entity in the * vector is an invalid pointer or not defined in the ontology an exception will be thrown. * @exception ::iro::exceptions::InvalidArgument : at least one entity is not valid. * @exception ::iro::exceptions::UndefinedElement : at least one entity is not defined in the ontology.*/ ConstInfEntityVectorType actualizeVector(const ConstInfEntityVectorType& oldV) const; - typedef TIEInference EntityInferenceInterface; + using EntityInferenceInterface = TIEInference; /*!Sets the pointer to the interface that should be used to actualze inference elements * (e.g. entities or information spaces)*/ void setEntityInferenceInterface(const EntityInferenceInterface* pInterface); /*!Used to actualize the passed inference elements (e.g. entities or information spaces)*/ const EntityInferenceInterface* _pEntityInferenceInterface; private: IMappingInference(const IMappingInference&); //not implemented by purpose IMappingInference& operator=(const IMappingInference&); //not implemented by purpose }; } // end namespace core } // end namespace iro #ifndef MatchPoint_MANUAL_TPP #include "mapIMappingInference.tpp" #endif #endif diff --git a/Code/Ontology/Common/include/mapIMappingInference.tpp b/Code/Ontology/Common/include/mapIMappingInference.tpp index 8088409..323c823 100644 --- a/Code/Ontology/Common/include/mapIMappingInference.tpp +++ b/Code/Ontology/Common/include/mapIMappingInference.tpp @@ -1,506 +1,506 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_I_MAPPING_INFERENCE_TPP #define __MAP_I_MAPPING_INFERENCE_TPP -#include +#include #include "mapIMappingInference.h" namespace iro { namespace core { template Result::ConstRegPathOptColPointer> IMappingInference:: getRegistrationPaths(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance) const { assert(_pEntityInferenceInterface); if (!pMovingIS) { throw exceptions::InvalidArgument("Cannot get registration paths. Passed moving IS pointer is NULL."); } if (!pFixedIS) { throw exceptions::InvalidArgument("Cannot get registration paths. Passed fixed IS pointer is NULL."); } typename InfSpaceType::ConstPointer spCurrentMIS = _pEntityInferenceInterface->actualize(pMovingIS); if (!spCurrentMIS) { throw exceptions::UndefinedElement("Cannot get registration paths. Passed moving IS is not defined in the ontology."); } typename InfSpaceType::ConstPointer spCurrentFIS = _pEntityInferenceInterface->actualize(pFixedIS); if (!spCurrentFIS) { throw exceptions::UndefinedElement("Cannot get registration paths. Passed fixed IS is not defined in the ontology."); } return doGetRegistrationPaths(spCurrentMIS, spCurrentFIS, pProblemCompliance); }; template Result::ConstRegPathOptColVectorType> IMappingInference:: getRegistrationPaths(const ConstInfEntityVectorType& movingEntities, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance) const { assert(_pEntityInferenceInterface); if (!pFixedIS) { throw exceptions::InvalidArgument("Cannot get registration paths. Passed fixed IS pointer is NULL."); } typename InfSpaceType::ConstPointer spCurrentFIS = _pEntityInferenceInterface->actualize(pFixedIS); if (!spCurrentFIS) { throw exceptions::UndefinedElement("Cannot get registration paths. Passed fixed IS is not defined in the ontology."); } //check validity of moving entities ConstInfEntityVectorType currentEntities = actualizeVector(movingEntities); return doGetRegistrationPaths(currentEntities, spCurrentFIS, pProblemCompliance); }; template Result::ConstTransPathOptColPointer> IMappingInference:: getTransformationPaths(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance) const { assert(_pEntityInferenceInterface); if (!pMovingIS) { throw exceptions::InvalidArgument("Cannot get transformation paths. Passed moving IS pointer is NULL."); } if (!pFixedIS) { throw exceptions::InvalidArgument("Cannot get transformation paths. Passed fixed IS pointer is NULL."); } typename InfSpaceType::ConstPointer spCurrentMIS = _pEntityInferenceInterface->actualize(pMovingIS); if (!spCurrentMIS) { throw exceptions::UndefinedElement("Cannot get transformation paths. Passed moving IS is not defined in the ontology."); } typename InfSpaceType::ConstPointer spCurrentFIS = _pEntityInferenceInterface->actualize(pFixedIS); if (!spCurrentFIS) { throw exceptions::UndefinedElement("Cannot get transformation paths. Passed fixed IS is not defined in the ontology."); } return doGetTransformationPaths(spCurrentMIS, spCurrentFIS, pProblemCompliance); }; template Result::ConstTransPathOptColVectorType> IMappingInference:: getTransformationPaths(const ConstInfEntityVectorType& movingEntities, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance) const { assert(_pEntityInferenceInterface); if (!pFixedIS) { throw exceptions::InvalidArgument("Cannot get transformation paths. Passed fixed IS pointer is NULL."); } typename InfSpaceType::ConstPointer spCurrentFIS = _pEntityInferenceInterface->actualize(pFixedIS); if (!spCurrentFIS) { throw exceptions::UndefinedElement("Cannot get transformation paths. Passed fixed IS is not defined in the ontology."); } //check validity of moving entities ConstInfEntityVectorType currentEntities = actualizeVector(movingEntities); return doGetTransformationPaths(currentEntities, spCurrentFIS, pProblemCompliance); }; template Result::ConstRegPathOptColPointer> IMappingInference:: getOptimalRegistrationPaths(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, DataRepresentationSupport::Type requiredDataSupport, const ProblemComplianceInterface* pProblemCompliance, const RegPathMetricInterface* pMetric) const { assert(_pEntityInferenceInterface); if (!pMovingIS) { throw exceptions::InvalidArgument("Cannot get optimal registration paths. Passed moving IS pointer is NULL."); } if (!pFixedIS) { throw exceptions::InvalidArgument("Cannot get optimal registration paths. Passed fixed IS pointer is NULL."); } typename InfSpaceType::ConstPointer spCurrentMIS = _pEntityInferenceInterface->actualize(pMovingIS); if (!spCurrentMIS) { throw exceptions::UndefinedElement("Cannot get optimal registration paths. Passed moving IS is not defined in the ontology."); } typename InfSpaceType::ConstPointer spCurrentFIS = _pEntityInferenceInterface->actualize(pFixedIS); if (!spCurrentFIS) { throw exceptions::UndefinedElement("Cannot get optimal registration paths. Passed fixed IS is not defined in the ontology."); } return doGetOptimalRegistrationPaths(spCurrentMIS, spCurrentFIS, requiredDataSupport, pProblemCompliance, pMetric); }; template Result::ConstRegPathOptColVectorType> IMappingInference:: getOptimalRegistrationPaths(const ConstInfEntityVectorType& movingEntities, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance, const RegPathMetricInterface* pMetric) const { assert(_pEntityInferenceInterface); if (!pFixedIS) { throw exceptions::InvalidArgument("Cannot get optimal registration paths. Passed fixed IS pointer is NULL."); } typename InfSpaceType::ConstPointer spCurrentFIS = _pEntityInferenceInterface->actualize(pFixedIS); if (!spCurrentFIS) { throw exceptions::UndefinedElement("Cannot get optimal registration paths. Passed fixed IS is not defined in the ontology."); } //check validity of moving entities ConstInfEntityVectorType currentEntities = actualizeVector(movingEntities); return doGetOptimalRegistrationPaths(currentEntities, spCurrentFIS, pProblemCompliance, pMetric); }; template Result::ConstTransPathOptColPointer> IMappingInference:: getOptimalTransformationPaths(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance, const TransPathMetricInterface* pMetric) const { assert(_pEntityInferenceInterface); if (!pMovingIS) { throw exceptions::InvalidArgument("Cannot get optimal transformation paths. Passed moving IS pointer is NULL."); } if (!pFixedIS) { throw exceptions::InvalidArgument("Cannot get optimal transformation paths. Passed fixed IS pointer is NULL."); } typename InfSpaceType::ConstPointer spCurrentMIS = _pEntityInferenceInterface->actualize(pMovingIS); if (!spCurrentMIS) { throw exceptions::UndefinedElement("Cannot get optimal transformation paths. Passed moving IS is not defined in the ontology."); } typename InfSpaceType::ConstPointer spCurrentFIS = _pEntityInferenceInterface->actualize(pFixedIS); if (!spCurrentFIS) { throw exceptions::UndefinedElement("Cannot get optimal transformation paths. Passed fixed IS is not defined in the ontology."); } return doGetOptimalTransformationPaths(spCurrentMIS, spCurrentFIS, pProblemCompliance, pMetric); }; template Result::ConstTransPathOptColVectorType> IMappingInference:: getOptimalTransformationPaths(const ConstInfEntityVectorType& movingEntities, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance, const TransPathMetricInterface* pMetric) const { assert(_pEntityInferenceInterface); if (!pFixedIS) { throw exceptions::InvalidArgument("Cannot get optimal transformation paths. Passed fixed IS pointer is NULL."); } typename InfSpaceType::ConstPointer spCurrentFIS = _pEntityInferenceInterface->actualize(pFixedIS); if (!spCurrentFIS) { throw exceptions::UndefinedElement("Cannot get optimal transformation paths. Passed fixed IS is not defined in the ontology."); } //check validity of moving entities ConstInfEntityVectorType currentEntities = actualizeVector(movingEntities); return doGetOptimalTransformationPaths(currentEntities, spCurrentFIS, pProblemCompliance, pMetric); }; template Result::ConstInfSpaceVectorType> IMappingInference:: getMappableInformationSpaces(InfSpaceInferencePointer pFixedIS, DataRepresentationSupport::Type requiredDataSupport, const ProblemComplianceInterface* pProblemCompliance, const RegPathMetricInterface* pMetric) const { assert(_pEntityInferenceInterface); if (!pFixedIS) { throw exceptions::InvalidArgument("Cannot get optimal registration paths. Passed fixed IS pointer is NULL."); } typename InfSpaceType::ConstPointer spCurrentFIS = _pEntityInferenceInterface->actualize(pFixedIS); if (!spCurrentFIS) { throw exceptions::UndefinedElement("Cannot get optimal registration paths. Passed fixed IS is not defined in the ontology."); } return doGetMappableInformationSpaces(spCurrentFIS, requiredDataSupport, pProblemCompliance, pMetric); }; template Result::MappingErrorType> IMappingInference:: checkForMappingFailureReason(InfEntityInferencePointer pMovingEntity, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance) const { assert(_pEntityInferenceInterface); if (!pMovingEntity) { throw exceptions::InvalidArgument("Cannot check failure resaons. Passed moving entity pointer is NULL."); } if (!pFixedIS) { throw exceptions::InvalidArgument("Cannot check failure resaons. Passed fixed IS pointer is NULL."); } typename InfEntityType::ConstPointer spCurrentEntity = _pEntityInferenceInterface->actualize(pMovingEntity); if (!spCurrentEntity) { throw exceptions::UndefinedElement("Cannot check failure resaons. Passed moving IS is not defined in the ontology."); } typename InfSpaceType::ConstPointer spCurrentFIS = _pEntityInferenceInterface->actualize(pFixedIS); if (!spCurrentFIS) { throw exceptions::UndefinedElement("Cannot check failure resaons. Passed fixed IS is not defined in the ontology."); } return doCheckForMappingFailureReason(spCurrentEntity, spCurrentFIS, pProblemCompliance); }; template Result::MappingErrorType> IMappingInference:: checkForMappingFailureReason(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, DataRepresentationSupport::Type requiredDataSupport, const ProblemComplianceInterface* pProblemCompliance) const { assert(_pEntityInferenceInterface); if (!pMovingIS) { throw exceptions::InvalidArgument("Cannot check failure resaons. Passed moving IS pointer is NULL."); } if (!pFixedIS) { throw exceptions::InvalidArgument("Cannot check failure resaons. Passed fixed IS pointer is NULL."); } typename InfSpaceType::ConstPointer spCurrentMIS = _pEntityInferenceInterface->actualize(pMovingIS); if (!spCurrentMIS) { throw exceptions::UndefinedElement("Cannot check failure resaons. Passed moving IS is not defined in the ontology."); } typename InfSpaceType::ConstPointer spCurrentFIS = _pEntityInferenceInterface->actualize(pFixedIS); if (!spCurrentFIS) { throw exceptions::UndefinedElement("Cannot check failure resaons. Passed fixed IS is not defined in the ontology."); } return doCheckForMappingFailureReason(spCurrentMIS, spCurrentFIS, requiredDataSupport, pProblemCompliance); }; template Result::MappingErrorType> IMappingInference:: checkForMappingFailureReason(InfEntityInferencePointer pMovingEntity, ConstRegistrationPathPointer pPath) const { assert(_pEntityInferenceInterface); if (!pMovingEntity) { throw exceptions::InvalidArgument("Cannot check failure resaons. Passed moving entity pointer is NULL."); } if (!pPath) { throw exceptions::InvalidArgument("Cannot check failure resaons. Passed path pointer is NULL."); } ConstInfEntityPointer spCurrentMIE = _pEntityInferenceInterface->actualize(pMovingEntity); if (!spCurrentMIE) { throw exceptions::UndefinedElement("Cannot check for failure reason. Passed moving entitiy is not defined in the ontology."); } ConstInfSpacePointer spCurrentMIS = pPath->getMovingIS(); if (!spCurrentMIS) { throw exceptions::UndefinedElement("Cannot check for failure reason. Moving space of passed path is not defined in the ontology."); } ConstInfSpacePointer spCurrentTIS = pPath->getTargetIS(); if (!spCurrentTIS) { throw exceptions::UndefinedElement("Cannot check for failure reason. Target space of passed path is not defined in the ontology."); } return doCheckForMappingFailureReason(spCurrentMIE, pPath); }; template Result::MappingErrorType> IMappingInference:: checkForMappingFailureReason(InfEntityInferencePointer pMovingEntity, ConstTransformationPathPointer pPath) const { assert(_pEntityInferenceInterface); if (!pMovingEntity) { throw exceptions::InvalidArgument("Cannot check failure resaons. Passed moving entity pointer is NULL."); } if (!pPath) { throw exceptions::InvalidArgument("Cannot check failure resaons. Passed path pointer is NULL."); } ConstInfEntityPointer spCurrentMIE = _pEntityInferenceInterface->actualize(pMovingEntity); if (!spCurrentMIE) { throw exceptions::UndefinedElement("Cannot check for failure reason. Passed moving entitiy is not defined in the ontology."); } ConstInfSpacePointer spCurrentMIS = _pEntityInferenceInterface->actualize(pPath->getMovingIS()); if (!spCurrentMIS) { throw exceptions::UndefinedElement("Cannot check for failure reason. Moving space of passed path is not defined in the ontology."); } ConstInfSpacePointer spCurrentTIS = _pEntityInferenceInterface->actualize(pPath->getTargetIS()); if (!spCurrentTIS) { throw exceptions::UndefinedElement("Cannot check for failure reason. Target space of passed path is not defined in the ontology."); } return doCheckForMappingFailureReason(spCurrentMIE, pPath); }; template Result::ConstRegistrationPathPointer> IMappingInference:: convertTransformationToRegistrationPath(ConstTransformationPathPointer pPath) const { if (!pPath) { throw exceptions::InvalidArgument("Cannot convert path resaons. Passed path pointer is NULL."); } ConstInfSpacePointer spCurrentMIS = _pEntityInferenceInterface->actualize(pPath->getMovingIS()); if (!spCurrentMIS) { throw exceptions::UndefinedElement("Cannot check for failure reason. Moving space of passed path is not defined in the ontology."); } ConstInfSpacePointer spCurrentTIS = _pEntityInferenceInterface->actualize(pPath->getTargetIS()); if (!spCurrentTIS) { throw exceptions::UndefinedElement("Cannot check for failure reason. Target space of passed path is not defined in the ontology."); } return doConvertTransformationToRegistrationPath(pPath); }; template Result::ConstTransformationInfoPointer> IMappingInference:: actualize(TransformationInfoInferencePointer pTI) const { if (!pTI) { throw exceptions::InvalidArgument("Cannot actualize transformation info. Passed entity pointer is NULL."); } return doActualize(pTI); }; template typename IMappingInference::ConstInfEntityVectorType IMappingInference:: actualizeVector(const ConstInfEntityVectorType& oldV) const { assert(_pEntityInferenceInterface); ConstInfEntityVectorType newEntities; - for (typename ConstInfEntityVectorType::const_iterator pos = oldV.begin(); pos!=oldV.end(); ++pos) + for (auto pos = oldV.begin(); pos!=oldV.end(); ++pos) { if (!(*pos)) { throw exceptions::InvalidArgument("Cannot actualize entity vector. At least one entity pointer is NULL."); } ConstInfEntityPointer spCurrentIE = _pEntityInferenceInterface->actualize(*pos); if (!spCurrentIE) { throw exceptions::UndefinedElement("Cannot actualize entity vector. At least one moving entitiy is not defined in the ontology."); } newEntities.push_back(spCurrentIE); } return newEntities; }; template void IMappingInference:: setEntityInferenceInterface(const EntityInferenceInterface* pInterface) { _pEntityInferenceInterface = pInterface; }; } // end namespace core } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapIMappingIntegration.h b/Code/Ontology/Common/include/mapIMappingIntegration.h index a8f2cb2..8f9561b 100644 --- a/Code/Ontology/Common/include/mapIMappingIntegration.h +++ b/Code/Ontology/Common/include/mapIMappingIntegration.h @@ -1,155 +1,155 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_I_MAPPING_INTEGRATION_H #define __MAP_I_MAPPING_INTEGRATION_H #include "mapIEntityInference.h" #include "mapIProblemInference.h" namespace iro { namespace core { /*! @class IMappingIntegration * @brief Interface of the registration ontology decorator used for integration queries in the context of transformations or mapping * related information. * * As integration interface it is analog to a pure setter interface. * Getting will be done be inference interfaces (IMappingInference). * This interface is implemented regarding the NVI paradigm. * * @tparam TTITraits type that define the traits of transformation info. * @tparam TPInference type of the problem inference interface that should be used. * @tparam TIEInference type of the information entity inference interface that should be used. * @tparam TTDReturnType type that is returned by transformation/registration delete operations. * @sa IProblemIntegration * @sa IEntityIntegration * @sa IMappingInference * @ingroup Integration */ template class IMappingIntegration { public: - typedef typename TTITraits::Type TransformationInfoType; - typedef typename TTITraits::ConstPointer ConstTransformationInfoPointer; - typedef typename TTITraits::InferencePointer TransInfoInferencePointer; + using TransformationInfoType = typename TTITraits::Type; + using ConstTransformationInfoPointer = typename TTITraits::ConstPointer; + using TransInfoInferencePointer = typename TTITraits::InferencePointer; using InformationSpaceTraitsType = typename TTITraits::InformationSpaceTraitsType; using InformationEntityTraitsType = typename TTITraits::InformationEntityTraitsType; using ProblemStatementTraitsType = typename TTITraits::ProblemStatementTraitsType; - typedef TTDReturnType TransformationDeleteReturnType; + using TransformationDeleteReturnType = TTDReturnType; /*! Defines and stores the copy of the passed transformation information * after checking all relevant integration rules.\n * Relevant integration rules: * - handleExistenceOnTransInfoDef * . * See integration rule set of application scenario for information how it is handled in the used scenario. * @param [in] newTransformation Pointer to the transformation info that should be added as definition to the ontology. * @return Returns the transformation info after the insertion of the definition into the ontology. * @pre newTransformation must point to a valid instance. * @pre newTransformation must reference information spaces that are defined in the ontology. * @pre If newTransformation is associated to a problem statement this statement must be defined in the ontology. * @exception ::iro::exceptions::InvalidArgument : newTransformation pointer is null. * @exception ::iro::exceptions::UndefinedElement : the information spaces or problem statement of the new transformation info are not defined in the ontology. */ Result defineTransformation(TransInfoInferencePointer newTransformation); /*! Stores the copy of the passed transformation and commits the changes between the passed version of the entity and the * one stored in the ontology after checking all relevant integration rules.\n * Relevant integration rules: * - handleInexistenceOnTransInfoStore * - handleExistenceOnTransInfoStore * . * See integration rule set of application scenario for information how it is handled in the used scenario. * @see IntegrationRuleSets * @param [in] pEntity Pointer to the entity whose changes should be commited to the ontology. * @return Returns the entity after the changes are commited to the ontology. * @pre pEntity must point to a valid instance. * @pre transformation must point to a valid instance. * @pre transformation must reference information spaces that are defined in the ontology. * @pre If transformation is associated to a problem statement this statement must be defined in the ontology. * @exception ::iro::exceptions::InvalidArgument : transformation pointer is null. * @exception ::iro::exceptions::UndefinedElement : the information spaces or problem statement of the transformation info are not defined in the ontology. */ Result storeTransformation(TransInfoInferencePointer transformation); /*! Deletes the passed transformation info after checking all relevant integration rules.\n * Relevant integration rules: * - handleInexistenceOnTransInfoDel * - handleDependentsOnTransInfoDel * . * See integration rule set of application scenario for information how it is handled in the used scenario. * @see IntegrationRuleSets * @param [in] transformation Pointer to the transformation info that should be deleted. * @return The return type depends on the used scenario the the scenario and its interface realization for more information. * @pre transformation must point to a valid instance. * @exception ::iro::exceptions::InvalidArgument : transformation pointer is null. */ TransformationDeleteReturnType deleteTransformation(TransInfoInferencePointer transformation); protected: - virtual ~IMappingIntegration() {}; - IMappingIntegration() {}; + virtual ~IMappingIntegration() = default; + IMappingIntegration() = default; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see defineTransformation*/ virtual Result doDefineTransformation(TransInfoInferencePointer newTransformation) = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see storeTransformation*/ virtual Result doStoreTransformation(TransInfoInferencePointer transformation) = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see deleteTransformation*/ virtual TransformationDeleteReturnType doDeleteTransformation(TransInfoInferencePointer transformation) = 0; using EntityInferenceInterface = TIEInference; using ProblemInferenceInterface = TPInference; /*!Sets the pointer to the interface that should be used to actualize inference elements * (e.g. entities or information spaces)*/ void setEntityInferenceInterface(const EntityInferenceInterface* pInterface); /*!Sets the pointer to the interface that should be used to actualize inference elements * (e.g. problem statements)*/ void setProblemInferenceInterface(const ProblemInferenceInterface* pInterface); /*!Used to actualize the passed inference elements (e.g. entities or information spaces)*/ const EntityInferenceInterface* _pEntityInferenceInterface; /*!Used to actualize the passed inference elements (e.g. problem statements)*/ const ProblemInferenceInterface* _pProblemInferenceInterface; private: IMappingIntegration(const IMappingIntegration&); //not implemented by purpose IMappingIntegration& operator=(const IMappingIntegration&); //not implemented by purpose }; } // end namespace core } // end namespace iro #ifndef MatchPoint_MANUAL_TPP #include "mapIMappingIntegration.tpp" #endif #endif diff --git a/Code/Ontology/Common/include/mapIPathMetric.h b/Code/Ontology/Common/include/mapIPathMetric.h index fed9678..9bf5b2a 100644 --- a/Code/Ontology/Common/include/mapIPathMetric.h +++ b/Code/Ontology/Common/include/mapIPathMetric.h @@ -1,66 +1,67 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_I_PATH_METRIC_H #define __MAP_I_PATH_METRIC_H #include "mapOntologyExceptions.h" #include namespace iro { /** This interface is realized by any class that * implements a path element metric. * @ingroup Interface * */ template class IPathMetric { public: - typedef IPathMetric Self; - typedef std::shared_ptr Pointer; - typedef std::shared_ptr ConstPointer; + using Self = IPathMetric; + using Pointer = std::shared_ptr; + using ConstPointer = std::shared_ptr; - typedef typename TPathElementTraits::Type PathElementType; - typedef double MeasureType; + using PathElementType = typename TPathElementTraits::Type; + using MeasureType = double; /** evaluates the passe Element and returns the measure. * @pre pElement must not be NULL * @exception exceptions::InvalidArgument: precondition is violated.*/ MeasureType evaluatePathElement(const PathElementType* pElement) const { - if (!pElement) throw exceptions::InvalidArgument("Passed path element pointer is NULL. Cannot evaluate Element"); + if (!pElement) { throw exceptions::InvalidArgument("Passed path element pointer is NULL. Cannot evaluate Element"); +} return doEvaluatePathElement(pElement); }; protected: virtual MeasureType doEvaluatePathElement(const PathElementType* pElement) const = 0; virtual ~IPathMetric() {}; IPathMetric() {}; private: IPathMetric(const Self&); //not implemented by purpose Self& operator=(const Self&); //not implemented by purpose }; } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapIProblemComplianceChecker.h b/Code/Ontology/Common/include/mapIProblemComplianceChecker.h index d09db66..a48d3fe 100644 --- a/Code/Ontology/Common/include/mapIProblemComplianceChecker.h +++ b/Code/Ontology/Common/include/mapIProblemComplianceChecker.h @@ -1,60 +1,61 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_I_PROBLEM_COMPLIANCE_CHECKER_H #define __MAP_I_PROBLEM_COMPLIANCE_CHECKER_H #include "mapIProblemComplianceDefinition.h" namespace iro { /** This interface is realized by any class that offer the possibility * to be checked if it complies with a certain problem compliance definition * (e.g. if a registration path is valid within a certain problem model * or only contains transformations of a certain problem statement.*/ template class IProblemComplianceChecker { public: - typedef IProblemComplianceDefinition ProblemComplianceInterface; + using ProblemComplianceInterface = IProblemComplianceDefinition; /** Checks if the instance that implements this interface is in compliance eith the passed problem compliance definition. * @return True: the instance complies with the passed definition. False: the instance is not in compliance (e.g. defined * for an other problem statement or valid within an other problem model). * @pre pProblemCompliance must point to a valid instance. * @exception ::iro::exceptions::InvalidArgument: pProblemCompliance is not valid*/ bool checkProblemCompliance(const ProblemComplianceInterface* pProblemCompliance) const { - if (!pProblemCompliance) throw ::iro::exceptions::InvalidArgument("Cannot check compliance. Invalid proplem compliance pointer"); + if (!pProblemCompliance) { throw ::iro::exceptions::InvalidArgument("Cannot check compliance. Invalid proplem compliance pointer"); +} return doCheckProblemCompliance(pProblemCompliance); }; protected: virtual bool doCheckProblemCompliance(const ProblemComplianceInterface* pProblemCompliance) const = 0; - virtual ~IProblemComplianceChecker() {}; - IProblemComplianceChecker() {}; + virtual ~IProblemComplianceChecker() = default; + IProblemComplianceChecker() = default; private: - IProblemComplianceChecker(const IProblemComplianceChecker&); //not implemented by purpose - IProblemComplianceChecker& operator=(const IProblemComplianceChecker&); //not implemented by purpose + IProblemComplianceChecker(const IProblemComplianceChecker&) = delete; //not implemented by purpose + IProblemComplianceChecker& operator=(const IProblemComplianceChecker&) = delete; //not implemented by purpose }; } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapIProblemComplianceDefinition.h b/Code/Ontology/Common/include/mapIProblemComplianceDefinition.h index fc0ce14..f48e6b8 100644 --- a/Code/Ontology/Common/include/mapIProblemComplianceDefinition.h +++ b/Code/Ontology/Common/include/mapIProblemComplianceDefinition.h @@ -1,56 +1,57 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_I_PROBLEM_COMPLIANCE_DEFINITION_H #define __MAP_I_PROBLEM_COMPLIANCE_DEFINITION_H #include "mapOntologyExceptions.h" namespace iro { /** This interface is realized by any class that defines a * problem compliance and offer the possibility to check a statement * if it is compliant to this definition.*/ template class IProblemComplianceDefinition { public: - typedef TProblemStatement ProblemStatementType; + using ProblemStatementType = TProblemStatement; /** Checks if the passed problem statement is compliant. * @pre pProblem must point to a valid instance. * @exception ::iro::exceptions::InvalidArgument: pProblem is not valid*/ bool checkComplianceOfStatement(const ProblemStatementType* pProblem) const { - if (!pProblem) throw ::iro::exceptions::InvalidArgument("Cannot check compliance. Invalid proplem statement pointer"); + if (!pProblem) { throw ::iro::exceptions::InvalidArgument("Cannot check compliance. Invalid proplem statement pointer"); +} return doCheckComplianceOfStatement(pProblem); }; protected: virtual bool doCheckComplianceOfStatement(const ProblemStatementType* pProblem) const = 0; - virtual ~IProblemComplianceDefinition() {}; - IProblemComplianceDefinition() {}; + virtual ~IProblemComplianceDefinition() = default; + IProblemComplianceDefinition() = default; private: - IProblemComplianceDefinition(const IProblemComplianceDefinition&); //not implemented by purpose - IProblemComplianceDefinition& operator=(const IProblemComplianceDefinition&); //not implemented by purpose + IProblemComplianceDefinition(const IProblemComplianceDefinition&) = delete; //not implemented by purpose + IProblemComplianceDefinition& operator=(const IProblemComplianceDefinition&) = delete; //not implemented by purpose }; } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapIProblemInference.h b/Code/Ontology/Common/include/mapIProblemInference.h index 47cd4c3..d3556fb 100644 --- a/Code/Ontology/Common/include/mapIProblemInference.h +++ b/Code/Ontology/Common/include/mapIProblemInference.h @@ -1,161 +1,161 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_I_PROBLEM_INFERENCE_H #define __MAP_I_PROBLEM_INFERENCE_H #include "mapOntologyResult.h" #include "mapIProblemStatementAssociated.h" #include namespace iro { namespace core { /*! @class IProblemInference * @brief Interface of the registration ontology used for inference queries in the context of entities or entity related questions that can be handled without caring about registration. * * Interface of the registration ontology decorator used for inference queries in the * context of problem models and statements. As inference interface it is analog to a * pure getter interface. Setting and writing will be done be integration interfaces (IProblemIntegration). * This interface is implemented regarding the NVI paradigm. * * @tparam TPMTraits type that represents the problem model traits. * @sa IEntityInference * @sa IViewingInference * @sa IMappingInference * @sa IProblemIntegration * @ingroup Inference */ template class IProblemInference { public: - typedef typename TPMTraits::Type ProblemModelType; - typedef typename TPMTraits::ConstPointer ConstProblemModelPointer; - typedef typename TPMTraits::InferencePointer ProblemModelInferencePointer; + using ProblemModelType = typename TPMTraits::Type; + using ConstProblemModelPointer = typename TPMTraits::ConstPointer; + using ProblemModelInferencePointer = typename TPMTraits::InferencePointer; - typedef typename std::vector ConstProblemModelVectorType; + using ConstProblemModelVectorType = typename std::vector; using ProblemStatementTraitsType = typename TPMTraits::ProblemStatementTraitsType; - typedef typename ProblemStatementTraitsType::Type ProblemStatementType; - typedef typename ProblemStatementTraitsType::ConstPointer ConstProblemStatementPointer; - typedef typename ProblemStatementTraitsType::InferencePointer ProblemStatementInferencePointer; + using ProblemStatementType = typename ProblemStatementTraitsType::Type; + using ConstProblemStatementPointer = typename ProblemStatementTraitsType::ConstPointer; + using ProblemStatementInferencePointer = typename ProblemStatementTraitsType::InferencePointer; - typedef typename std::vector ConstProblemStatementVectorType; + using ConstProblemStatementVectorType = typename std::vector; - typedef IProblemStatementAssociated ProblemAssociatedInterface; + using ProblemAssociatedInterface = IProblemStatementAssociated; /*! Queries for all ProblemModels that are associated with the given instance * (more precise with its associated problem statement) and returns result set. * This method is a convenience overload of getAssociatedProblemModels(...). *@param [in] pAssociated Const pointer to the entity that is associated with an problem statement. *@return a collection containing pointers to all problem models that contain the problem statement * and therefor are associated with the passed instance. *@pre pAssociated must point to a valid instance. *@pre pAssociated must be associated to a problem statement that is defined in the ontology. *@exception ::iro::exceptions::InvalidArgument : entity pointer is null. *@exception ::iro::exceptions::UndefinedElement : associated problem statement is not defined in the ontology. */ Result getAssociatedProblemModels(const ProblemAssociatedInterface* pAssociated) const; /*! Queries for all ProblemModels that are associated with the given ProblemStatement and returns the filtered result set. *@param [in] ps problem statement whose associated problem models should be returned. *@return a collection containing pointers to all problem models that are associated to the passed problem statement * If the problem statement is unknown. *@pre ps must point to a valid instance. *@pre ps must be defined in the ontology (use actualize() in order to check * this in before). *@exception ::iro::exceptions::InvalidArgument : problem statement pointer is null. *@exception ::iro::exceptions::UndefinedElement : problem statement is not defined in the ontology. */ Result getAssociatedProblemModels(ProblemStatementInferencePointer ps) const; /*! Returns a vector that contains all problem models that are defined in the ontology. * @remark Depending on the ontology the returning vector can be very large and thus the function call * can be of low performance. */ Result getProblemModels() const; /*! Returns a vector that contains all problem statements that are defined in the ontology. * @remark Depending on the ontology the returning vector can be very large and thus the function call * can be of low performance. */ Result getProblemStatements() const; /*!Takes the passed problem statement and returns the version of the problem statement (UID equals) * that represents the current state of the ontology. * @param [in] ps Pointer to the problem statement that should be actualized. * @return Smart pointer to the current version of the element. If the problem statement * does not exist (any more) in the ontology, a NULL pointer will be returned. * @pre ps must point to valid instances. * @overload * @exception ::iro::exceptions::InvalidArgument : ps is not a valid pointer.*/ Result actualize(ProblemStatementInferencePointer ps) const; /*!Takes the passed problem model and returns the version of the problem model (UID equals) * that represents the current state of the ontology. * @param [in] pm Pointer to the problem model that should be actualized. * @return Smart pointer to the current version of the element. If the problem model * does not exist (any more) in the ontology, a NULL pointer will be returned. * @pre ps must point to valid instances. * @overload * @exception ::iro::exceptions::InvalidArgument : pm is not a valid pointer.*/ Result actualize(ProblemModelInferencePointer pm) const; protected: /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getAssociatedProblemModels*/ virtual Result doGetAssociatedProblemModels(ProblemStatementInferencePointer ps) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see geProblemModels*/ virtual Result doGetProblemModels() const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getProblemStatements*/ virtual Result doGetProblemStatements() const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see actualize*/ virtual Result doActualize(ProblemStatementInferencePointer ps) const = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see actualize*/ virtual Result doActualize(ProblemModelInferencePointer pm) const = 0; - virtual ~IProblemInference() {}; - IProblemInference() {}; + virtual ~IProblemInference() = default; + IProblemInference() = default; private: IProblemInference(const IProblemInference&); //not implemented by purpose IProblemInference& operator=(const IProblemInference&); //not implemented by purpose }; } // end namespace core } // end namespace iro #ifndef MatchPoint_MANUAL_TPP #include "mapIProblemInference.tpp" #endif #endif diff --git a/Code/Ontology/Common/include/mapIProblemIntegration.h b/Code/Ontology/Common/include/mapIProblemIntegration.h index f91aebd..d952866 100644 --- a/Code/Ontology/Common/include/mapIProblemIntegration.h +++ b/Code/Ontology/Common/include/mapIProblemIntegration.h @@ -1,194 +1,194 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_I_PROBLEM_INTEGRATION_H #define __MAP_I_PROBLEM_INTEGRATION_H #include "mapOntologyResult.h" namespace iro { namespace core { /*! @class IProblemIntegration * @brief Interface of the registration ontology decorator used for integration queries in the context of entities or entity * related information that is independent from registration/transformation. * * As integration interface it is analog to a pure setter interface. * Getting will be done be inference interfaces (IProblemInference). * This interface is implemented regarding the NVI paradigm. * * @tparam TIETraits type that define the traits of problem models. * @tparam TPInference type of the problem inference interface that should be used. * @tparam TPSDReturnType type that is returned by problem statement delete operations. * @tparam TPMDReturnType type that is returned by problem model delete operations. * @sa IProblemIntegration * @sa IMappingIntegration * @sa IProblemInference * @ingroup Integration */ template class IProblemIntegration { public: - typedef typename TPMTraits::Type ProblemModelType; - typedef typename TPMTraits::ConstPointer ConstProblemModelPointer; - typedef typename TPMTraits::InferencePointer ProblemModelInferencePointer; + using ProblemModelType = typename TPMTraits::Type; + using ConstProblemModelPointer = typename TPMTraits::ConstPointer; + using ProblemModelInferencePointer = typename TPMTraits::InferencePointer; using ProblemStatementTraitsType = typename TPMTraits::ProblemStatementTraitsType; - typedef typename ProblemStatementTraitsType::Type ProblemStatementType; - typedef typename ProblemStatementTraitsType::ConstPointer ConstProblemStatementPointer; - typedef typename ProblemStatementTraitsType::InferencePointer ProblemStatementInferencePointer; + using ProblemStatementType = typename ProblemStatementTraitsType::Type; + using ConstProblemStatementPointer = typename ProblemStatementTraitsType::ConstPointer; + using ProblemStatementInferencePointer = typename ProblemStatementTraitsType::InferencePointer; - typedef typename std::vector ConstProblemStatementVectorType; + using ConstProblemStatementVectorType = typename std::vector; - typedef TPSDReturnType StatementDeleteReturnType; - typedef TPMDReturnType ModelDeleteReturnType; + using StatementDeleteReturnType = TPSDReturnType; + using ModelDeleteReturnType = TPMDReturnType; /*! Defines and stores the copy of the passed statement after checking all relevant integration rules.\n * Relevant integration rules: * - handleExistenceOnStatementDef * . * See integration rule set of application scenario for information how it is handled in the used scenario. * @param [in] pNewStatement Pointer to the problem statement that should be added as definition to the ontology. * @return Returns the entity after the insertion of the definition into the ontology. * @pre pNewStatement must point to a valid instance. * @exception ::iro::exceptions::InvalidArgument : pNewStatement pointer is null. */ Result defineProblemStatement(ProblemStatementInferencePointer pNewStatement); /*! Stores the copy of the passed statement or commits the changes between the passed version of the statement and the * one stored in the ontology after checking all relevant integration rules.\n * Relevant integration rules: * - handleInexistenceOnStatementStore * . * See integration rule set of application scenario for information how it is handled in the used scenario. * @see IntegrationRuleSets * @param [in] pStatement Pointer to the statement whose changes should be commited to the ontology. * @return Returns the statement after the changes are commited to the ontology. * @pre pStatement must point to a valid instance. * @exception ::iro::exceptions::InvalidArgument : pStatement is null. */ Result storeProblemStatement(ProblemStatementInferencePointer pStatement); /*! Deletes the passed statement after checking all relevant integration rules.\n * Relevant integration rules: * - handleInexistenceOnStatementDel * - handleDependentsOnStatementDel * . * See integration rule set of application scenario for information how it is handled in the used scenario. * @see IntegrationRuleSets * @param [in] pStatement Pointer to the statement that should be deleted. * @return The return type depends on the used scenario the the scenario and its interface realization for more information. * @pre pStatement must point to a valid instance. * @exception ::iro::exceptions::InvalidArgument : pStatement pointer is null. */ StatementDeleteReturnType deleteProblemStatement(ProblemStatementInferencePointer pStatement); /*! Defines and stores the copy of the passed model after checking all relevant integration rules.\n * Relevant integration rules: * - handleExistenceOnModelDef * . * See integration rule set of application scenario for information how it is handled in the used scenario. * @param [in] pNewModel Pointer to the problem model that should be added as definition to the ontology. * @return Returns the entity after the insertion of the definition into the ontology. * @pre pNewModel must point to a valid instance. * @exception ::iro::exceptions::InvalidArgument : pNewModel pointer is null. */ Result defineProblemModel(ProblemModelInferencePointer pNewModel); /*! Stores the copy of the passed model or commits the changes between the passed version of the model and the * one stored in the ontology after checking all relevant integration rules.\n * Relevant integration rules: * - handleInexistenceOnModelStore * . * See integration rule set of application scenario for information how it is handled in the used scenario. * @see IntegrationRuleSets * @param [in] pModel Pointer to the model whose changes should be committed to the ontology. * @return Returns the model after the changes are committed to the ontology. * @pre pModel must point to a valid instance. * @exception ::iro::exceptions::InvalidArgument : pModel is null. */ Result storeProblemModel(ProblemModelInferencePointer pModel); /*! Deletes the passed model after checking all relevant integration rules.\n * Relevant integration rules: * - handleInexistenceOnModelDel * - handleDependentsOnModelDel * . * See integration rule set of application scenario for information how it is handled in the used scenario. * @see IntegrationRuleSets * @param [in] pModel Pointer to the model that should be deleted. * @return The return type depends on the used scenario the the scenario and its interface realization for more information. * @pre pModel must point to a valid instance. * @exception ::iro::exceptions::InvalidArgument : pModel pointer is null. */ ModelDeleteReturnType deleteProblemModel(ProblemModelInferencePointer pModel); protected: - virtual ~IProblemIntegration() {}; - IProblemIntegration() {}; + virtual ~IProblemIntegration() = default; + IProblemIntegration() = default; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see defineProblemStatement*/ virtual Result doDefineProblemStatement(ProblemStatementInferencePointer pNewStatement) = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see storeProblemStatement*/ virtual Result doStoreProblemStatement(ProblemStatementInferencePointer pStatement) = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see deleteProblemStatement*/ virtual StatementDeleteReturnType doDeleteProblemStatement(ProblemStatementInferencePointer pStatement) = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see defineProblemModel*/ virtual Result doDefineProblemModel(ProblemModelInferencePointer pNewModel) = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see storeProblemModel*/ virtual Result doStoreProblemModel(ProblemModelInferencePointer pModel) = 0; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see deleteProblemModel*/ virtual ModelDeleteReturnType doDeleteProblemModel(ProblemModelInferencePointer pModel) = 0; using ProblemInferenceInterface = TPInference; /*!Sets the pointer to the interface that should be used to actualze inference elements * (e.g. entities or information spaces)*/ void setProblemInferenceInterface(const ProblemInferenceInterface* pInterface); /*!Used to actualize the passed inference elements (e.g. entities or information spaces)*/ const ProblemInferenceInterface* _pProblemInferenceInterface; private: IProblemIntegration(const IProblemIntegration&); //not implemented by purpose IProblemIntegration& operator=(const IProblemIntegration&); //not implemented by purpose }; } // end namespace core } // end namespace iro #ifndef MatchPoint_MANUAL_TPP #include "mapIProblemIntegration.tpp" #endif #endif diff --git a/Code/Ontology/Common/include/mapIProblemStatementAssociated.h b/Code/Ontology/Common/include/mapIProblemStatementAssociated.h index 2822c31..6da287d 100644 --- a/Code/Ontology/Common/include/mapIProblemStatementAssociated.h +++ b/Code/Ontology/Common/include/mapIProblemStatementAssociated.h @@ -1,81 +1,82 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_PROBLEM_STATEMENT_ASSOCIATED_INTERFACE_H #define __MAP_PROBLEM_STATEMENT_ASSOCIATED_INTERFACE_H #include "mapIProblemComplianceChecker.h" namespace iro { /** This interface is realized by any class that * has an association with a problem statement.*/ template class IProblemStatementAssociated : public IProblemComplianceChecker { public: - typedef typename TProblemStatementTraits::ConstPointer ConstProblemPointer; - typedef IProblemStatementAssociated Self; + using ConstProblemPointer = typename TProblemStatementTraits::ConstPointer; + using Self = IProblemStatementAssociated; /** Returns the const pointer to the associated problem statement. * Pointer may be null, if no statement is defined.*/ virtual ConstProblemPointer getAssociatedProblemStatement() const = 0; /**Checks if this and the passed instance are associated with the same * problem statement. * @param [in] nullEquals Indicates if it counts as equal if both * associates have no problem statement (NULL). * @return Indicates if they have the same problem statement. * @pre pAssociate must point to a valid instance * @exception: ::iro::exceptions::InvalidArgument: pAssociate is not valid*/ bool hasSameProblemStatement( const Self* pAssociate, bool nullEquals = true) const { - if (!pAssociate) throw ::iro::exceptions::InvalidArgument("Error. Cannot equality of problem statements. pAssociate is a NULL pointer."); + if (!pAssociate) { throw ::iro::exceptions::InvalidArgument("Error. Cannot equality of problem statements. pAssociate is a NULL pointer."); +} bool result = false; if (pAssociate->getAssociatedProblemStatement()) { if (this->getAssociatedProblemStatement()) { result = pAssociate->getAssociatedProblemStatement()->getUID() == this->getAssociatedProblemStatement()->getUID(); } } else { //first one is null if (!(this->getAssociatedProblemStatement())) { //second one is also null result = nullEquals; } } return result; }; protected: - virtual ~IProblemStatementAssociated() {}; - IProblemStatementAssociated() {}; + ~IProblemStatementAssociated() override = default; + IProblemStatementAssociated() = default; private: - IProblemStatementAssociated(const Self&); //not implemented by purpose - IProblemStatementAssociated& operator=(const Self&); //not implemented by purpose + IProblemStatementAssociated(const Self&) = delete; //not implemented by purpose + IProblemStatementAssociated& operator=(const Self&) = delete; //not implemented by purpose }; } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapISCacheKey.h b/Code/Ontology/Common/include/mapISCacheKey.h index dd2fea7..dbed5d0 100644 --- a/Code/Ontology/Common/include/mapISCacheKey.h +++ b/Code/Ontology/Common/include/mapISCacheKey.h @@ -1,59 +1,59 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_IS_CACHE_KEY_H #define __MAP_IS_CACHE_KEY_H #include "mapDataRepresentation.h" namespace iro { namespace core { /** Helper class used by ontologies as key in maps, where InformationSpaces should not just be distinguished by ther UID but also by the data representation type they are currently requested for. @tparam TISTraits traits of the used information space type. */ template struct ISCacheKey { - typedef typename TISTraits::UIDType UIDType; - typedef ISCacheKey Self; + using UIDType = typename TISTraits::UIDType; + using Self = ISCacheKey; UIDType _uid; DataRepresentationSupport::Type _dataRep; bool operator == (const Self& source) const; bool operator != (const Self& source) const; bool operator < (const Self& source) const; Self& operator = (const Self& source); ISCacheKey(const UIDType& uid, DataRepresentationSupport::Type dataRep); }; } // end namespace core } // end namespace iro #ifndef MatchPoint_MANUAL_TPP #include "mapISCacheKey.tpp" #endif #endif diff --git a/Code/Ontology/Common/include/mapISCacheKey.tpp b/Code/Ontology/Common/include/mapISCacheKey.tpp index cef8bd9..1dab889 100644 --- a/Code/Ontology/Common/include/mapISCacheKey.tpp +++ b/Code/Ontology/Common/include/mapISCacheKey.tpp @@ -1,81 +1,83 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_IS_CACHE_KEY_TPP #define __MAP_IS_CACHE_KEY_TPP #include "mapISCacheKey.h" namespace iro { namespace core { template bool ISCacheKey:: operator == (const Self& source) const { return (this->_uid == source._uid) && (this->_dataRep == source._dataRep); }; template bool ISCacheKey:: operator != (const Self& source) const { return !(*this == source); }; template bool ISCacheKey:: operator < (const Self& source) const { - if (_uid_dataRep < source._dataRep) return true; + if (_uid_dataRep < source._dataRep) { return true; +} return false; }; template typename ISCacheKey::Self& ISCacheKey:: operator = (const Self& source) { if (this != &source) { this->_uid = source._uid; this->_dataRep = source._dataRep; } return *this; }; template ISCacheKey:: ISCacheKey(const UIDType& uid, DataRepresentationSupport::Type dataRep) { _uid = uid; _dataRep = dataRep; }; } // end namespace core } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapISConnectorPathBase.h b/Code/Ontology/Common/include/mapISConnectorPathBase.h index 2d6adc9..e8c2c7c 100644 --- a/Code/Ontology/Common/include/mapISConnectorPathBase.h +++ b/Code/Ontology/Common/include/mapISConnectorPathBase.h @@ -1,148 +1,148 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_CONNECTOR_PATH_BASE_H #define __MAP_CONNECTOR_PATH_BASE_H #include "mapIInformationSpaceConnector.h" #include "mapIProblemComplianceChecker.h" #include #include namespace iro { /** Base class for all class that defines sequential * connection between information spaces. Most relevant realizations * are TransformationPath and RegistrationPath. This interface combines * the interfaces IInformationSpaceConnector and IProblemModelAssociated*/ template class ISConnectorPathBase: public IInformationSpaceConnector, public IProblemComplianceChecker { public: typedef ISConnectorPathBase Self; - typedef ::std::shared_ptr Pointer; - typedef ::std::shared_ptr ConstPointer; + using Pointer = ::std::shared_ptr; + using ConstPointer = ::std::shared_ptr; - typedef IInformationSpaceConnector ConnectorInterface; - typedef typename ConnectorInterface::ConstISPointer ConstISPointer; + using ConnectorInterface = IInformationSpaceConnector; + using ConstISPointer = typename ConnectorInterface::ConstISPointer; - typedef IProblemComplianceChecker ComplianceCheckerInterface; - typedef typename ComplianceCheckerInterface::ProblemComplianceInterface ProblemComplianceInterface; + using ComplianceCheckerInterface = IProblemComplianceChecker; + using ProblemComplianceInterface = typename ComplianceCheckerInterface::ProblemComplianceInterface; - typedef typename TProblemStatementTraits::Type ProblemStatementType; - typedef typename TProblemStatementTraits::Pointer ProblemPointer; - typedef typename TProblemStatementTraits::ConstPointer ConstProblemPointer; + using ProblemStatementType = typename TProblemStatementTraits::Type; + using ProblemPointer = typename TProblemStatementTraits::Pointer; + using ConstProblemPointer = typename TProblemStatementTraits::ConstPointer; - typedef typename TPathElementTraits::Type PathElementType; - typedef typename TPathElementTraits::ConstPointer ConstPathElementPointer; + using PathElementType = typename TPathElementTraits::Type; + using ConstPathElementPointer = typename TPathElementTraits::ConstPointer; protected: - typedef typename std::list PathElementListType; + using PathElementListType = typename std::list; public: - typedef typename PathElementListType::iterator PathElementIterator; - typedef typename PathElementListType::const_iterator ConstPathElementIterator; - typedef typename PathElementListType::size_type PathSizeType; + using PathElementIterator = typename PathElementListType::iterator; + using ConstPathElementIterator = typename PathElementListType::const_iterator; + using PathSizeType = typename PathElementListType::size_type; /*! Implementation of abstract member. See documentation in interface. * @see IInformationSpaceConnector*/ - virtual ConstISPointer getMovingIS() const; + ConstISPointer getMovingIS() const override; /*! Implementation of abstract member. See documentation in interface. * @see IInformationSpaceConnector*/ - virtual ConstISPointer getTargetIS() const; + ConstISPointer getTargetIS() const override; /*! Returns the iterator to the begin of th path.*/ PathElementIterator getBegin(); /*! Returns the const iterator to the begin of th path.*/ ConstPathElementIterator getBegin() const; /*! Returns the iterator to the end of the path.*/ PathElementIterator getEnd(); /*! Returns the const iterator to the end of the path.*/ ConstPathElementIterator getEnd() const; /*! Returns the size of the path (number of elements).*/ PathSizeType size() const; /*! Inserts the passed newElement at the postion in the path indicated by pos. * Calls doInsertElement() after the preconditions are checked. * @remark Derivated classes may introducs further preconditions. E.g. see TransformationPath * @pre The moving IS of the new element must equal the target IS of the preceeding element (if new element is not inserted at the beginning) * @pre The target IS of the new element must equal the moving IS of the succeeding element (if new element is not inserted at the end) * @param [in] pos Iterator indicating the postion of the element where the element should be inserted. * @param [in] newElement The new element that should be inserted. * @return Iterator that points to the position of the inserted element in the path. * @exception ::iro::exceptions::InvalidMovingIS: the preconditions are violated * @exception ::iro::exceptions::InvalidTargetIS: the preconditions are violated*/ PathElementIterator insertElement(PathElementIterator pos, ConstPathElementPointer newElement); /*! Adds the passed newElement at the end of the path. * Calls doAppend() after the preconditions are checked. * @remark Derivated classes may introducs further preconditions. E.g. see TransformationPath * @pre The moving IS of the new element must equal the target IS of the preceeding element (if the path is not empty) * @param [in] newElement The new element that should be inserted. * @exception ::iro::exceptions::InvalidMovingIS: the preconditions are violated*/ void appendElement(ConstPathElementPointer newElement); /*! removes the element at the passed position from the path. * @param [in] pos Iterator indicating the postion of the element that should be removed. * @return Iterator that points to the position behind the removed element in the path. If it was the last element it points to getEnd().*/ PathElementIterator removeElement(PathElementIterator pos); /*! Removes all elements of the path*/ void resetElements(); - virtual ~ISConnectorPathBase(); + ~ISConnectorPathBase() override; ISConnectorPathBase(); protected: /*! Is called by InsertElement() after the preconditions are checked. * Base implementation just adds the element. * @param [in] pos Iterator indicating the postion of the element where the element should be inserted. * @param [in] newElement The new element that should be inserted. * @return Iterator that points to the position of the inserted element in the path. */ virtual PathElementIterator doInsertElement(PathElementIterator pos, ConstPathElementPointer newElement); /*! Is called by appendElement() after the preconditions are checked. * Base implementation just appends the element. * @param [in] newElement The new element that should be inserted. */ virtual void doAppend(ConstPathElementPointer newElement); /*! Implementation of abstract member. This implementation checks the associated * problem statement of all elements for compliance. See also documentation in interface. * @see IProblemComplianceChecker*/ - virtual bool doCheckProblemCompliance(const ProblemComplianceInterface* pProblemCompliance) const; + bool doCheckProblemCompliance(const ProblemComplianceInterface* pProblemCompliance) const override; PathElementListType _pathElements; private: ISConnectorPathBase(const Self&); //not implemented by purpose Self& operator=(const Self&); //not implemented by purpose }; } // end namespace iro #ifndef MatchPoint_MANUAL_TPP #include "mapISConnectorPathBase.tpp" #endif #endif diff --git a/Code/Ontology/Common/include/mapISConnectorPathBase.tpp b/Code/Ontology/Common/include/mapISConnectorPathBase.tpp index b5ba3bc..4adecf5 100644 --- a/Code/Ontology/Common/include/mapISConnectorPathBase.tpp +++ b/Code/Ontology/Common/include/mapISConnectorPathBase.tpp @@ -1,205 +1,203 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_CONNECTOR_PATH_BASE_TPP #define __MAP_CONNECTOR_PATH_BASE_TPP #include "mapISConnectorPathBase.h" namespace iro { template typename ISConnectorPathBase::ConstISPointer ISConnectorPathBase:: getMovingIS() const { ConstISPointer spIS; if (!_pathElements.empty()) { spIS = _pathElements.front()->getMovingIS(); } return spIS; }; template typename ISConnectorPathBase::ConstISPointer ISConnectorPathBase:: getTargetIS() const { ConstISPointer spIS; if (!_pathElements.empty()) { spIS = _pathElements.back()->getTargetIS(); } return spIS; }; template bool ISConnectorPathBase:: doCheckProblemCompliance(const ProblemComplianceInterface* pProblemCompliance) const { bool result = true; - ConstPathElementIterator pos = _pathElements.begin(); + auto pos = _pathElements.begin(); while (result && pos!=_pathElements.end()) { //we haven't reched the end of the path and till now all elements were compliant -> check the next element result = (*pos)->checkProblemCompliance(pProblemCompliance); ++pos; } return result; }; template typename ISConnectorPathBase::PathElementIterator ISConnectorPathBase:: getBegin() { return _pathElements.begin(); }; template typename ISConnectorPathBase::ConstPathElementIterator ISConnectorPathBase:: getBegin() const { return _pathElements.begin(); }; template typename ISConnectorPathBase::PathElementIterator ISConnectorPathBase:: getEnd() { return _pathElements.end(); }; template typename ISConnectorPathBase::ConstPathElementIterator ISConnectorPathBase:: getEnd() const { return _pathElements.end(); }; template typename ISConnectorPathBase::PathSizeType ISConnectorPathBase:: size() const { return _pathElements.size(); }; template typename ISConnectorPathBase::PathElementIterator ISConnectorPathBase:: insertElement(PathElementIterator pos, ConstPathElementPointer newElement) { //check the connection correctness precondition if (pos!=_pathElements.begin() && !_pathElements.empty()) { //there will be an element bevor the newElement -> check IS compliance PathElementIterator predecessor = pos; --predecessor; if ((*predecessor)->getTargetIS() != newElement->getMovingIS()) { throw exceptions::InvalidMovingIS("The insert element would violated the IS connection correctness."); } } if (pos!=_pathElements.end() && !_pathElements.empty()) { //there will be an element after (pos itself) the newElement -> check IS compliance if ((*pos)->getMovingIS() != newElement->getTargetIS()) { throw exceptions::InvalidTargetIS("The insert element would violated the IS connection correctness."); } } return doInsertElement(pos,newElement); }; template void ISConnectorPathBase:: appendElement(ConstPathElementPointer newElement) { //check the connection correctness precondition if (!_pathElements.empty()) { //there will be an element bevor the newElement -> check IS compliance if (_pathElements.back()->getTargetIS() != newElement->getMovingIS()) { throw exceptions::InvalidMovingIS("The insert element would violated the IS connection correctness."); } } doAppend(newElement); }; template typename ISConnectorPathBase::PathElementIterator ISConnectorPathBase:: doInsertElement(PathElementIterator pos, ConstPathElementPointer newElement) { return _pathElements.insert(pos,newElement); }; template void ISConnectorPathBase:: doAppend(ConstPathElementPointer newElement) { _pathElements.push_back(newElement); }; template typename ISConnectorPathBase::PathElementIterator ISConnectorPathBase:: removeElement(PathElementIterator pos) { return _pathElements.erase(pos); }; template void ISConnectorPathBase:: resetElements() { _pathElements.clear(); }; template ISConnectorPathBase:: ~ISConnectorPathBase() - { - }; + = default; template ISConnectorPathBase:: ISConnectorPathBase() - { - }; + = default; } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapISemanticCorrelationType.h b/Code/Ontology/Common/include/mapISemanticCorrelationType.h index a6eb62f..bf05870 100644 --- a/Code/Ontology/Common/include/mapISemanticCorrelationType.h +++ b/Code/Ontology/Common/include/mapISemanticCorrelationType.h @@ -1,57 +1,57 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_I_SEMANTIC_CORRELATION_TYPE_H #define __MAP_I_SEMANTIC_CORRELATION_TYPE_H #include "mapOntologyString.h" #include #include "mapMAPOntologyExports.h" namespace iro { /** @class ISemanticCorrelationType *Interface for all kind of correlation types. * @ingroup CorrelationType Interfaces */ class MAPOntology_EXPORT ISemanticCorrelationType { public: - typedef ISemanticCorrelationType Self; - typedef std::shared_ptr Pointer; - typedef std::shared_ptr ConstPointer; + using Self = ISemanticCorrelationType; + using Pointer = std::shared_ptr; + using ConstPointer = std::shared_ptr; /** Checks if the type of this and pType are equal by comparing there names.*/ bool equals(const ISemanticCorrelationType* pType) const; /** Returns the identifier name of the correlation type.*/ virtual String getName() const = 0; protected: virtual ~ISemanticCorrelationType(); ISemanticCorrelationType(); private: - ISemanticCorrelationType(const ISemanticCorrelationType&); //not implemented by purpose - ISemanticCorrelationType& operator=(const ISemanticCorrelationType&); //not implemented by purpose + ISemanticCorrelationType(const ISemanticCorrelationType&) = delete; //not implemented by purpose + ISemanticCorrelationType& operator=(const ISemanticCorrelationType&) = delete; //not implemented by purpose }; } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapInjectivCorrelation.h b/Code/Ontology/Common/include/mapInjectivCorrelation.h index d953de5..6f5cd84 100644 --- a/Code/Ontology/Common/include/mapInjectivCorrelation.h +++ b/Code/Ontology/Common/include/mapInjectivCorrelation.h @@ -1,54 +1,54 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_INJECTIV_CORRELATION_H #define __MAP_INJECTIV_CORRELATION_H #include "mapUnkownBijectivCorrelation.h" #include "mapMAPOntologyExports.h" namespace iro { /** @class InjectivCorrelation * This class defines a semantic identity that is known but injective. * Thus you know the exact correspondence between the entities but it cover the entities only in parts * (e.g. the same set of intrinsic landmarks in different images and it is not guaranteed that all landmarks * are visible in all images. But the landmarks are uniquely identified, so when there is a landmark in to images * you are able to determin this). * @ingroup CorrelationType*/ class MAPOntology_EXPORT InjectivCorrelation : public UnkownBijectivCorrelation { public: - typedef InjectivCorrelation Self; - typedef std::shared_ptr Pointer; - typedef std::shared_ptr ConstPointer; + using Self = InjectivCorrelation; + using Pointer = std::shared_ptr; + using ConstPointer = std::shared_ptr; /** Returns the identifier name of the correlation type.*/ - virtual String getName() const; + String getName() const override; - virtual ~InjectivCorrelation(); + ~InjectivCorrelation() override; InjectivCorrelation(); private: - InjectivCorrelation(const InjectivCorrelation&); //not implemented by purpose - InjectivCorrelation& operator=(const InjectivCorrelation&); //not implemented by purpose + InjectivCorrelation(const InjectivCorrelation&) = delete; //not implemented by purpose + InjectivCorrelation& operator=(const InjectivCorrelation&) = delete; //not implemented by purpose }; } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapOntologyAccess.h b/Code/Ontology/Common/include/mapOntologyAccess.h index fadb5d3..868a899 100644 --- a/Code/Ontology/Common/include/mapOntologyAccess.h +++ b/Code/Ontology/Common/include/mapOntologyAccess.h @@ -1,130 +1,130 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_ONTOLOGY_ACCESS_H #define __MAP_ONTOLOGY_ACCESS_H #include "mapIEntityInference.h" #include "mapIMappingInference.h" #include "mapIProblemInference.h" #include "mapIEntityIntegration.h" #include "mapIProblemIntegration.h" #include "mapIMappingIntegration.h" namespace iro { namespace core { /** *@tparam TRPTraits type that define the traits of registration paths. * @tparam TRPOCTraits type that define the traits of registration path option collections. * @tparam TTPOCTraits type that define the traits of transformation path option collections. * @tparam TSCTraits type that define the traits of semantic correlations. * @tparam TPMTraits type that represents the problem model traits. * @tparam TEDReturnType type that is returned by entity delete operations. * @tparam TISDReturnType type that is returned by information space delete operations. * @tparam TCDReturnType type that is returned by correlation delete operations. * @tparam TPSDReturnType type that is returned by problem statement delete operations. * @tparam TPMDReturnType type that is returned by problem model delete operations. * @tparam TTDReturnType type that is returned by transformation / registration delete operations. */ template struct OntologyAccessTraits { using SemanticCorrelationTraitsType = TSCTraits; using ProblemModelTraitsType = TPMTraits; using ProblemStatementTraitsType = typename TPMTraits::ProblemStatementTraitsType; using InformationEntityTraitsType = typename TRPTraits::InformationEntityTraitsType; using InformationSpaceTraitsType = typename TRPTraits::InformationSpaceTraitsType; using TransformationInfoTraitsType = typename TRPTraits::TransformationInfoTraitsType; using TransformationPathTraitsType = typename TRPTraits::TransformationPathTraitsType; using TransPathOptionCollectionTraitsType = TTPOCTraits; using TransPathOptionTraitsType = typename TTPOCTraits::OptionTraitsType; using RegistrationInfoTraitsType = typename TRPTraits::RegistrationInfoTraitsType; using RegistrationPathTraitsType = TRPTraits; using RegPathOptionCollectionTraitsType = TRPOCTraits; using RegPathOptionTraitsType = typename TRPOCTraits::OptionTraitsType; using EDReturnType = TEDReturnType; using ISDReturnType = TISDReturnType; using CDReturnType = TCDReturnType; using PSDReturnType = TPSDReturnType; using PMDReturnType = TPMDReturnType; using TDReturnType = TTDReturnType; }; /*! @class OntologyAccess * Base class for classes that implement a complete ontology with all interfaces. * @tparam TRPTraits type that define the traits of registration paths. * @tparam TRPOCTraits type that define the traits of registration path option collections. * @tparam TTPOCTraits type that define the traits of transformation path option collections. * @tparam TSCTraits type that define the traits of semantic correlations. * @tparam TPMTraits type that represents the problem model traits. * @tparam TEDReturnType type that is returned by entity delete operations. * @tparam TISDReturnType type that is returned by information space delete operations. * @tparam TCDReturnType type that is returned by correlation delete operations. * @tparam TPSDReturnType type that is returned by problem statement delete operations. * @tparam TPMDReturnType type that is returned by problem model delete operations. * @tparam TTDReturnType type that is returned by transformation/registration delete operations. */ template class OntologyAccess : public IEntityInference, public IProblemInference, public IMappingInference >, public IEntityIntegration, typename TOATraits::EDReturnType, typename TOATraits::ISDReturnType, typename TOATraits::CDReturnType>, public IProblemIntegration, typename TOATraits::PSDReturnType, typename TOATraits::PMDReturnType>, public IMappingIntegration, IProblemInference, typename TOATraits::TDReturnType> { public: using EntityInferenceInterface = IEntityInference; using MappingInferenceInterface = IMappingInference; using ProblemInferenceInterface = IProblemInference; using EntityIntegrationInterface = IEntityIntegration; using MappingIntegrationInterface = IMappingIntegration; using ProblemIntegrationInterface = IProblemIntegration; using EntityInferenceInterface::actualize; using ProblemInferenceInterface::actualize; using MappingInferenceInterface::actualize; protected: - virtual ~OntologyAccess(); + ~OntologyAccess() override; OntologyAccess(); private: - OntologyAccess(const OntologyAccess&); //not implemented by purpose - OntologyAccess& operator=(const OntologyAccess&); //not implemented by purpose + OntologyAccess(const OntologyAccess&) = delete; //not implemented by purpose + OntologyAccess& operator=(const OntologyAccess&) = delete; //not implemented by purpose }; } // end namespace core } // end namespace iro #ifndef MatchPoint_MANUAL_TPP #include "mapOntologyAccess.tpp" #endif #endif diff --git a/Code/Ontology/Common/include/mapOntologyAccess.tpp b/Code/Ontology/Common/include/mapOntologyAccess.tpp index 4bc77ed..0eb3d10 100644 --- a/Code/Ontology/Common/include/mapOntologyAccess.tpp +++ b/Code/Ontology/Common/include/mapOntologyAccess.tpp @@ -1,50 +1,49 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_ONTOLOGY_ACCESS_TPP #define __MAP_ONTOLOGY_ACCESS_TPP #include "mapOntologyAccess.h" namespace iro { namespace core { template OntologyAccess:: ~OntologyAccess() - { - }; + = default; template OntologyAccess:: OntologyAccess() { MappingInferenceInterface::setEntityInferenceInterface(this); EntityIntegrationInterface::setEntityInferenceInterface(this); ProblemIntegrationInterface::setProblemInferenceInterface(this); MappingIntegrationInterface::setEntityInferenceInterface(this); MappingIntegrationInterface::setProblemInferenceInterface(this); }; } // end namespace core } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapOntologyExceptions.h b/Code/Ontology/Common/include/mapOntologyExceptions.h index 3762d13..10370ad 100644 --- a/Code/Ontology/Common/include/mapOntologyExceptions.h +++ b/Code/Ontology/Common/include/mapOntologyExceptions.h @@ -1,85 +1,85 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_EXCEPTIONS_H #define __MAP_EXCEPTIONS_H #include #include "mapOntologyString.h" #include "mapMAPOntologyExports.h" namespace iro { namespace exceptions { - MAPOntology_EXPORT typedef ::std::invalid_argument InvalidArgument; + MAPOntology_EXPORT using InvalidArgument = ::std::invalid_argument; /** @class InvalidIS * Exception class that is thrown when an problem correlated with * information spaces occures * @ingroup Exception*/ class MAPOntology_EXPORT InvalidIS : public InvalidArgument { public: explicit InvalidIS (const String& what_arg); }; /** @class InvalidMovingIS * Exception class that is thrown when an problem correlated with * moving information spaces occures * @ingroup Exception*/ class MAPOntology_EXPORT InvalidMovingIS : public InvalidIS { public: explicit InvalidMovingIS (const String& what_arg); }; /** @class InvalidTargetIS * Exception class that is thrown when an problem correlated with * target information spaces occures * @ingroup Exception*/ class MAPOntology_EXPORT InvalidTargetIS : public InvalidIS { public: explicit InvalidTargetIS (const String& what_arg); }; /** @class InvalidDataRepresentation * Exception class that is thrown when an problem correlated with * invalid data representation support occures * @ingroup Exception*/ class MAPOntology_EXPORT InvalidDataRepresentation : public InvalidArgument { public: explicit InvalidDataRepresentation (const String& what_arg); }; /** @class UndefinedElement * Exception class that is thrown when an element is used for * inference or integration that is not part of the ontology * @ingroup Exceptions*/ class MAPOntology_EXPORT UndefinedElement : public InvalidArgument { public: explicit UndefinedElement (const String& what_arg); }; } // end namespace exceptions } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapOntologyResult.h b/Code/Ontology/Common/include/mapOntologyResult.h index 225c4d4..d79ea15 100644 --- a/Code/Ontology/Common/include/mapOntologyResult.h +++ b/Code/Ontology/Common/include/mapOntologyResult.h @@ -1,113 +1,113 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_RESULT_H #define __MAP_RESULT_H #include "mapValidityIndicator.h" #include namespace iro { /*! @class Result * @brief Helper class that is used by inference interfaces to return the query results and to bind them to a validity indicator. * * This class is used by the ontology to bind a validity indicator to inference query results and therefore offers the possibility * to check the validity of conclusions later on. This helper class is implemented like a pointer. Offering the possibility to * access directly the actual result value by operator * and ->. * @remark There is a template specialication for shared_ptr result types. In these cases * and -> will directly access * the pointer value (pointer becomes transparent). To access the shared_pointer itself use getValue(). * @tparam TResultType The type of the result value that is passed back by a inference or integration interface.*/ template class Result { public: - typedef TResultType ResultType; + using ResultType = TResultType; using OntologyRevisionTag = ::iro::OntologyRevisionTag; ResultType& operator*(); const ResultType& operator*() const; ResultType* operator->(); const ResultType* operator->() const; operator ResultType() const; ResultType& getValue(); const ResultType& getValue() const; const OntologyRevisionTag& getRevision() const; ~Result(); Result(ResultType resultValue, const OntologyRevisionTag& tag); Result(const Result& result); Result& operator=(const Result& result); protected: ResultType _result; OntologyRevisionTag _revision; }; /*! Template specialication for shared pointer. Operator * and -> will directly access * the pointer value (pointer becomes transparent). To access the shared_pointer itself use getValue(). * @tparam TResultType The type of the result value that is passed back by a inference or integration interface.*/ template class Result< std::shared_ptr > { public: - typedef typename std::shared_ptr ResultType; - typedef TResultType PlainResultType; - typedef Result< std::shared_ptr > Self; + using ResultType = typename std::shared_ptr; + using PlainResultType = TResultType; + using Self = Result >; using OntologyRevisionTag = ::iro::OntologyRevisionTag; PlainResultType& operator*(); const PlainResultType& operator*() const; PlainResultType* operator->(); const PlainResultType* operator->() const; operator ResultType() const; ResultType& getValue(); const ResultType& getValue() const; const OntologyRevisionTag& getRevision() const; ~Result(); Result(ResultType resultValue, const OntologyRevisionTag& tag); Result(const Self& result); Self& operator=(const Self& result); protected: ResultType _result; OntologyRevisionTag _revision; }; } // end namespace iro #ifndef MatchPoint_MANUAL_TPP #include "mapOntologyResult.tpp" #endif #endif diff --git a/Code/Ontology/Common/include/mapOntologyResult.tpp b/Code/Ontology/Common/include/mapOntologyResult.tpp index 35e7ddc..7dd1ba1 100644 --- a/Code/Ontology/Common/include/mapOntologyResult.tpp +++ b/Code/Ontology/Common/include/mapOntologyResult.tpp @@ -1,220 +1,218 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_RESULT_TPP #define __MAP_RESULT_TPP namespace iro { template typename Result::ResultType& Result:: operator*() { return this->_result; }; template const typename Result::ResultType& Result:: operator*() const { return this->_result; }; template const typename Result::ResultType* Result:: operator->() const { return &(this->_result); }; template typename Result::ResultType* Result:: operator->() { return &(this->_result); }; template Result:: operator ResultType() const { return this->_result; }; template typename Result::ResultType& Result:: getValue() { return this->_result; }; template const typename Result::ResultType& Result:: getValue() const { return this->_result; }; template const typename Result::OntologyRevisionTag& Result:: getRevision() const { return _revision; }; template Result:: ~Result() - { - }; + = default; template Result:: - Result(ResultType resultValue, const OntologyRevisionTag& tag) : _result(resultValue), _revision(tag) + Result(ResultType resultValue, const OntologyRevisionTag& tag) : _result(std::move(resultValue)), _revision(tag) {}; template Result:: Result(const Result& result) : _result(result._result), _revision(result._revision) { }; template Result& Result:: operator=(const Result& result) { if (&result != this) { _result = result._result; _revision = result._revision; } return *this; }; template typename Result< std::shared_ptr >::PlainResultType& Result< std::shared_ptr >:: operator*() { return *(this->_result.get()); }; template const typename Result< std::shared_ptr >::PlainResultType& Result< std::shared_ptr >:: operator*() const { return *(this->_result.get()); }; template const typename Result< std::shared_ptr >::PlainResultType* Result< std::shared_ptr >:: operator->() const { return this->_result.get(); }; template typename Result< std::shared_ptr >::PlainResultType* Result< std::shared_ptr >:: operator->() { return this->_result.get(); }; template Result< std::shared_ptr >:: operator ResultType() const { return this->_result; }; template typename Result< std::shared_ptr >::ResultType& Result< std::shared_ptr >:: getValue() { return this->_result; }; template const typename Result< std::shared_ptr >::ResultType& Result< std::shared_ptr >:: getValue() const { return this->_result; }; template const typename Result< std::shared_ptr >::OntologyRevisionTag& Result< std::shared_ptr >:: getRevision() const { return _revision; }; template Result< std::shared_ptr >:: ~Result() - { - }; + = default; template Result< std::shared_ptr >:: - Result(ResultType resultValue, const OntologyRevisionTag& tag) : _result(resultValue), _revision(tag) + Result(ResultType resultValue, const OntologyRevisionTag& tag) : _result(std::move(resultValue)), _revision(tag) {}; template Result< std::shared_ptr >:: Result(const Result< std::shared_ptr >& result) : _result(result._result), _revision(result._revision) { }; template Result< std::shared_ptr >& Result< std::shared_ptr >:: operator=(const Result< std::shared_ptr >& result) { if (&result != this) { _result = result._result; _revision = result._revision; } return *this; }; } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapOntologyString.h b/Code/Ontology/Common/include/mapOntologyString.h index b247f0a..f4dd2fc 100644 --- a/Code/Ontology/Common/include/mapOntologyString.h +++ b/Code/Ontology/Common/include/mapOntologyString.h @@ -1,34 +1,34 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_ONTOLOGY_STRING_H #define __MAP_ONTOLOGY_STRING_H #include #include namespace iro { - typedef std::string String; + using String = std::string; - typedef std::ostringstream OStringStream; + using OStringStream = std::ostringstream; } // end namespace regOnt #endif diff --git a/Code/Ontology/Common/include/mapPathOption.h b/Code/Ontology/Common/include/mapPathOption.h index 9d439aa..a360290 100644 --- a/Code/Ontology/Common/include/mapPathOption.h +++ b/Code/Ontology/Common/include/mapPathOption.h @@ -1,111 +1,111 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_PATH_OPTION_H #define __MAP_PATH_OPTION_H #include "mapOntologyString.h" #include "mapMappingError.h" #include "mapOntologyExceptions.h" #include "mapIProblemComplianceChecker.h" #include namespace iro { /*! @class PathOption * @brief Template class that is used for path options. * * A path option correlates a certain entity with a mapping path and can * be used to quickly access the validity check for the path * regarding the moving entity. * */ template class PathOption: public IProblemComplianceChecker { public: typedef PathOption Self; - typedef IProblemComplianceChecker Superclass; - typedef ::std::shared_ptr Pointer; - typedef ::std::shared_ptr ConstPointer; + using Superclass = IProblemComplianceChecker; + using Pointer = ::std::shared_ptr; + using ConstPointer = ::std::shared_ptr; - typedef TPathTraits PathTraitsType; - typedef TPathCheckPolicy PathCheckPolicy; + using PathTraitsType = TPathTraits; + using PathCheckPolicy = TPathCheckPolicy; - typedef typename PathTraitsType::InformationEntityTraitsType::ConstPointer ConstIEPointer; - typedef typename PathTraitsType::InformationSpaceTraitsType::ConstPointer ConstISPointer; - typedef typename PathTraitsType::ConstPointer ConstPathPointer; - typedef MappingError::Type MappingErrorType; + using ConstIEPointer = typename PathTraitsType::InformationEntityTraitsType::ConstPointer; + using ConstISPointer = typename PathTraitsType::InformationSpaceTraitsType::ConstPointer; + using ConstPathPointer = typename PathTraitsType::ConstPointer; + using MappingErrorType = MappingError::Type; using ProblemComplianceInterface = typename Superclass::ProblemComplianceInterface; /*! Returns the entity this path option was compiled for.*/ ConstIEPointer getMovingEntity() const; /*! Sets the moving entity of this path option. * @pre If a path is set it must support the entity according to the PathCheckPolicy * of this option. * @exception InvalidDataRepresentation: precondition is violated*/ void setMovingEntity(ConstIEPointer movingEntity); /*! Returns the pointer to the path of this option.*/ ConstPathPointer getPath() const; /*! Sets the path of this option. * @pre If a entity is set it must have a data representation supported by the new path * according to the PathCheckPolicy of this option. * @exception InvalidDataRepresentation: precondition is violated*/ void setPath(ConstPathPointer path); /*! Returns the target information space of the path. If no path is set it returns a NULL pointer.*/ ConstISPointer getTargetIS() const; /*! Checks if the path is able to map the moving entity or if there are any * possible reasons for a mapping failure. * @pre path and moving entity must be defined * @exception InvalidArgument: precondition is violated*/ MappingErrorType checkForFailureReason() const; /*! Checks if the mapping of the moving entity is guaranteed by the path * it is the same like checkForFailureReason()==MappinError::NoFailure. * @pre path and moving entity must be defined * @exception InvalidArgument: precondition is violated*/ bool hasFullMappingGuarantee() const; - virtual ~PathOption(); + ~PathOption() override; PathOption(); protected: /*! Implementation of abstract member. This implementation checks the associated * problem statement of all elements for compliance. See also documentation in interface. * @see IProblemComplianceChecker*/ - virtual bool doCheckProblemCompliance(const ProblemComplianceInterface* pProblemCompliance) const; + bool doCheckProblemCompliance(const ProblemComplianceInterface* pProblemCompliance) const override; ConstIEPointer _movingEntity; ConstPathPointer _path; private: PathOption(const Self&); //not implemented by purpose Self& operator=(const Self&); //not implemented by purpose }; } // end namespace iro #ifndef MatchPoint_MANUAL_TPP #include "mapPathOption.tpp" #endif #endif diff --git a/Code/Ontology/Common/include/mapPathOption.tpp b/Code/Ontology/Common/include/mapPathOption.tpp index 70f20fe..2839268 100644 --- a/Code/Ontology/Common/include/mapPathOption.tpp +++ b/Code/Ontology/Common/include/mapPathOption.tpp @@ -1,139 +1,139 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_PATH_OPTION_TPP #define __MAP_PATH_OPTION_TPP #include "mapTransformationPathBase.h" namespace iro { template typename PathOption::ConstIEPointer PathOption:: getMovingEntity() const { return _movingEntity; }; template void PathOption:: setMovingEntity(ConstIEPointer movingEntity) { if (_path && movingEntity && (movingEntity!=_movingEntity)) { //check the support if (TPathCheckPolicy::checkForFailureReason(_path,movingEntity)>MappingError::NoMappingGuarantee) { throw exceptions::InvalidDataRepresentation("New moving entity is not supported by path option."); } } _movingEntity = movingEntity; }; template typename PathOption::ConstPathPointer PathOption:: getPath() const { return _path; }; template void PathOption:: setPath(ConstPathPointer path) { if (_movingEntity && path && (path.get()!=_path.get())) { //check the support if (TPathCheckPolicy::checkForFailureReason(path,_movingEntity)>MappingError::NoMappingGuarantee) { throw exceptions::InvalidDataRepresentation("New path does not support moving entity of the path option."); } } _path = path; }; template typename PathOption::ConstISPointer PathOption:: getTargetIS() const { ConstISPointer spResult; if (_path) { spResult = _path->getTargetIS(); } return spResult; }; template typename PathOption::MappingErrorType PathOption:: checkForFailureReason() const { - if (!_path) throw exceptions::InvalidArgument("No path is set. Cannot ascertain failure risks."); - if (!_movingEntity) throw exceptions::InvalidArgument("No moving entity is set. Cannot ascertain failure risks."); + if (!_path) { throw exceptions::InvalidArgument("No path is set. Cannot ascertain failure risks."); +} + if (!_movingEntity) { throw exceptions::InvalidArgument("No moving entity is set. Cannot ascertain failure risks."); +} return TPathCheckPolicy::checkForFailureReason(_path,_movingEntity); }; template bool PathOption:: hasFullMappingGuarantee() const { if (!_path) throw exceptions::InvalidArgument("No path is set. Cannot ascertain failure risks."); if (!_movingEntity) throw exceptions::InvalidArgument("No moving entity is set. Cannot ascertain failure risks."); return TPathCheckPolicy::checkForFailureReason(_path,_movingEntity)== MappingError::NoFailure; }; template bool PathOption:: doCheckProblemCompliance(const ProblemComplianceInterface* pProblemCompliance) const { bool result = true; if (_path) { result = _path->checkProblemCompliance(pProblemCompliance); } return result; }; template PathOption:: ~PathOption() - { - }; + = default; template PathOption:: PathOption() - { - }; + = default; } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapPathOptionCollection.h b/Code/Ontology/Common/include/mapPathOptionCollection.h index 0dde90f..e1aa627 100644 --- a/Code/Ontology/Common/include/mapPathOptionCollection.h +++ b/Code/Ontology/Common/include/mapPathOptionCollection.h @@ -1,133 +1,133 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_PATH_OPTION_COLLECTION_H #define __MAP_PATH_OPTION_COLLECTION_H #include "mapPathOption.h" #include "mapOntologyExceptions.h" namespace iro { /*! @class PathOptionCollection * @brief Template class that is used for path options. * * This template class is used to compile several path options * for the same entity. It is used by some inference queries if * the result must not be unambiguous. */ template class PathOptionCollection { public: - typedef PathOptionCollection Self; - typedef ::std::shared_ptr Pointer; - typedef ::std::shared_ptr ConstPointer; + using Self = PathOptionCollection; + using Pointer = ::std::shared_ptr; + using ConstPointer = ::std::shared_ptr; - typedef typename TPathOption::PathTraitsType PathTraitsType; + using PathTraitsType = typename TPathOption::PathTraitsType; - typedef typename PathTraitsType::InformationEntityTraitsType::ConstPointer ConstIEPointer; - typedef typename PathTraitsType::InformationSpaceTraitsType::ConstPointer ConstISPointer; - typedef typename PathTraitsType::ConstPointer ConstPathPointer; - typedef MappingError::Type MappingErrorType; + using ConstIEPointer = typename PathTraitsType::InformationEntityTraitsType::ConstPointer; + using ConstISPointer = typename PathTraitsType::InformationSpaceTraitsType::ConstPointer; + using ConstPathPointer = typename PathTraitsType::ConstPointer; + using MappingErrorType = MappingError::Type; - typedef TPathOption OptionType; - typedef typename TPathOption::ConstPointer ConstOptionPointer; + using OptionType = TPathOption; + using ConstOptionPointer = typename TPathOption::ConstPointer; protected: - typedef std::list OptionCollectionType; + using OptionCollectionType = std::list; public: - typedef typename OptionCollectionType::iterator OptionIterator; - typedef typename OptionCollectionType::const_iterator ConstOptionIterator; - typedef typename OptionCollectionType::size_type SizeType; + using OptionIterator = typename OptionCollectionType::iterator; + using ConstOptionIterator = typename OptionCollectionType::const_iterator; + using SizeType = typename OptionCollectionType::size_type; - typedef std::list FullMappingOptionCollectionType; + using FullMappingOptionCollectionType = std::list; /*! Returns the entity this path option collection was compiled for. * It may return NULL if no option was added and moving entity was * not set*/ ConstIEPointer getMovingEntity() const; /*! Sets the moving entity of the collection. * @pre the collection may not contain options with a moving entity != NULL * before the * moving entity is changed. .*/ void setMovingEntity(ConstIEPointer spMovingEntity); OptionIterator getBegin(); ConstOptionIterator getBegin() const; OptionIterator getEnd(); ConstOptionIterator getEnd() const; /*! Returns the number of statements assigned to the model */ SizeType getOptionCount() const; /*! Adds the passed option to the collection. If not defined yet, the moving entity * will be defined by the added option. * @pre option must point to a valid instance or an exception will be raised. * @pre If the collection has a defined moving entity (by user or other options), "option" must have the same enity. * @exception InvalidArgument: precondition is violated*/ void addOption(ConstOptionPointer option); /*! Removes the option indecated by the passed iterator and returns the iterator the next option. * If it is the last option in the list the end iterator will be returned.*/ OptionIterator removeOption(OptionIterator pos); /*! removes all options from the collection.*/ void resetOptions(); /*! Checks the options for the failure reason that is less fatal or for * at least on success. * @pre At least one path option must be defined. * @exception InvalidArgument: precondition is violated*/ MappingErrorType checkForFailureReason() const; /*! returns a list with al options in this collection * that guarantee full mapping of the moving entity..*/ FullMappingOptionCollectionType getFullMappingGuaranteeOptions() const; virtual ~PathOptionCollection(); PathOptionCollection(); protected: //*Collection of the options OptionCollectionType _options; //* Entity can be set directly or is set automatically when an option is added. ConstIEPointer _movingEntity; mutable MappingErrorType _currentFailureReason; //*cache for all options that guarantee mapping (no failure reason) mutable FullMappingOptionCollectionType _guranteeCache; //*indicates if the cache is still valid. mutable bool _cacheIsUpToDate; private: PathOptionCollection(const Self&); //not implemented by purpose Self& operator=(const Self&); //not implemented by purpose }; } // end namespace iro #ifndef MatchPoint_MANUAL_TPP #include "mapPathOptionCollection.tpp" #endif #endif diff --git a/Code/Ontology/Common/include/mapPathOptionCollection.tpp b/Code/Ontology/Common/include/mapPathOptionCollection.tpp index bf98dc1..85d0c8e 100644 --- a/Code/Ontology/Common/include/mapPathOptionCollection.tpp +++ b/Code/Ontology/Common/include/mapPathOptionCollection.tpp @@ -1,196 +1,197 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_PATH_OPTION_COLLECTION_TPP #define __MAP_PATH_OPTION_COLLECTION_TPP #include "mapTransformationPathBase.h" namespace iro { template typename PathOptionCollection::ConstIEPointer PathOptionCollection:: getMovingEntity() const { return _movingEntity; }; template void PathOptionCollection:: setMovingEntity(ConstIEPointer spMovingEntity) { if (_options.empty()) { _movingEntity = spMovingEntity; } else { exceptions::InvalidArgument("Cannot change moving entity of option collection. Collection contains options. Reset the collection before setting the moving entity."); } }; template typename PathOptionCollection::OptionIterator PathOptionCollection:: getBegin() { return _options.begin(); }; template typename PathOptionCollection::ConstOptionIterator PathOptionCollection:: getBegin() const { return _options.begin(); }; template typename PathOptionCollection::OptionIterator PathOptionCollection:: getEnd() { return _options.end(); }; template typename PathOptionCollection::ConstOptionIterator PathOptionCollection:: getEnd() const { return _options.end(); }; template typename PathOptionCollection::SizeType PathOptionCollection:: getOptionCount() const { return _options.size(); }; template void PathOptionCollection:: addOption(ConstOptionPointer option) { - if (!option) throw exceptions::InvalidArgument("Cannot add path option. Option pointer is null"); + if (!option) { throw exceptions::InvalidArgument("Cannot add path option. Option pointer is null"); +} if (this->getMovingEntity() && this->getMovingEntity()!=option->getMovingEntity()) { throw exceptions::InvalidDataRepresentation("Collection has a different moving entity than the option that should be added."); } if (!(this->getMovingEntity()) && _options.empty()) { //define the moving entity _movingEntity = option->getMovingEntity(); } _options.push_back(option); _cacheIsUpToDate = false; }; template typename PathOptionCollection::OptionIterator PathOptionCollection:: removeOption(OptionIterator pos) { typename PathOptionCollection::OptionIterator result = _options.erase(pos); _cacheIsUpToDate = false; return result; }; template void PathOptionCollection:: resetOptions() { _options.clear(); _guranteeCache.clear(); _cacheIsUpToDate = true; }; template typename PathOptionCollection::MappingErrorType PathOptionCollection:: checkForFailureReason() const { - if (_options.empty()) throw exceptions::InvalidArgument("No option is set. Cannot ascertain failure risks."); + if (_options.empty()) { throw exceptions::InvalidArgument("No option is set. Cannot ascertain failure risks."); +} if (!_cacheIsUpToDate) { MappingErrorType result = MappingError::NoPath; OptionCollectionType newCache; - for ( ConstOptionIterator pos = _options.begin(); pos!=_options.end(); ++pos) + for ( auto pos = _options.begin(); pos!=_options.end(); ++pos) { MappingErrorType currentValue = (*pos)->checkForFailureReason(); if (currentValue typename PathOptionCollection::FullMappingOptionCollectionType PathOptionCollection:: getFullMappingGuaranteeOptions() const { if (!_cacheIsUpToDate) { checkForFailureReason(); } return _guranteeCache; }; template PathOptionCollection:: ~PathOptionCollection() - { - }; + = default; template PathOptionCollection:: PathOptionCollection() { _cacheIsUpToDate = true; }; } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapProblemBasedEdgeValidator.h b/Code/Ontology/Common/include/mapProblemBasedEdgeValidator.h index 559fbaf..926ffd6 100644 --- a/Code/Ontology/Common/include/mapProblemBasedEdgeValidator.h +++ b/Code/Ontology/Common/include/mapProblemBasedEdgeValidator.h @@ -1,49 +1,49 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_PROPBLEM_BASED_EDGE_VALIDATOR_H #define __MAP_PROPBLEM_BASED_EDGE_VALIDATOR_H #include "mapDataRepresentation.h" namespace iro { /** Simple edge validator based on problem compliance and data representation. valid edges are all edges that fulfill the following requirements: - Fulfilling the passed problem compliance definition. - Supporting the passed data representation. @tparam TRegistrationGraphType type that boost graph that represents the registration graph. @tparam TProblemComplianceInterface Type of the problem compliance definition interface */ template class ProblemBasedEdgeValidator { public: - typedef TRegistrationGraphType GraphType; - typedef typename GraphType::edge_descriptor EdgeDescriptorType; - typedef TProblemComplianceInterface ProblemComplianceInterface; + using GraphType = TRegistrationGraphType; + using EdgeDescriptorType = typename GraphType::edge_descriptor; + using ProblemComplianceInterface = TProblemComplianceInterface; bool isValid(EdgeDescriptorType edge, const GraphType& graph, DataRepresentationSupport::Type dataRep, const ProblemComplianceInterface* pProblemCompliance, bool& currentCTrail, bool& currentDTrail) const; }; } // end namespace iro #include "mapProblemBasedEdgeValidator.tpp" #endif diff --git a/Code/Ontology/Common/include/mapProblemBasedEdgeValidator.tpp b/Code/Ontology/Common/include/mapProblemBasedEdgeValidator.tpp index 83102ca..695ffd2 100644 --- a/Code/Ontology/Common/include/mapProblemBasedEdgeValidator.tpp +++ b/Code/Ontology/Common/include/mapProblemBasedEdgeValidator.tpp @@ -1,64 +1,66 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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. // //------------------------------------------------------------------------ #include "mapProblemBasedEdgeValidator.h" namespace iro { template bool ProblemBasedEdgeValidator:: isValid(EdgeDescriptorType edge, const GraphType& graph, DataRepresentationSupport::Type dataRep, const ProblemComplianceInterface* pProblemCompliance, bool& currentCTrail, bool& currentDTrail) const { - if (currentCTrail) currentCTrail = graph[edge].direct != nullptr; - if (currentDTrail) currentDTrail = graph[edge].inverse != nullptr; + if (currentCTrail) { currentCTrail = graph[edge].direct != nullptr; +} + if (currentDTrail) { currentDTrail = graph[edge].inverse != nullptr; +} if (!currentCTrail && (dataRep == DataRepresentationSupport::All || dataRep == DataRepresentationSupport::Continuous)) { //direct transform is not set but needed return false; } if (!currentDTrail && (dataRep == DataRepresentationSupport::All || dataRep == DataRepresentationSupport::Discrete)) { //inverse transform is not set but needed return false; } if (pProblemCompliance) { if (currentCTrail && (dataRep == DataRepresentationSupport::All || dataRep == DataRepresentationSupport::Continuous)) { //direct transform is set and needed ->check problem compliance if (!(pProblemCompliance->checkComplianceOfStatement( graph[edge].direct->getAssociatedProblemStatement().get()))) { return false; } } if (currentDTrail && (dataRep == DataRepresentationSupport::All || dataRep == DataRepresentationSupport::Discrete)) { //inverse transform is set and needed ->check problem compliance if (!(pProblemCompliance->checkComplianceOfStatement( graph[edge].direct->getAssociatedProblemStatement().get()))) { return false; } } } return true; }; } // end namespace iro diff --git a/Code/Ontology/Common/include/mapProblemModelBase.h b/Code/Ontology/Common/include/mapProblemModelBase.h index 9e9b10f..22f3e25 100644 --- a/Code/Ontology/Common/include/mapProblemModelBase.h +++ b/Code/Ontology/Common/include/mapProblemModelBase.h @@ -1,138 +1,138 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_PROBLEM_MODEL_BASE_H #define __MAP_PROBLEM_MODEL_BASE_H #include "mapOntologyString.h" #include "mapProblemStatementBase.h" #include #include namespace iro { namespace scenario { /*! @class ProblemModelBase * @brief base for problem models. * * Problem models specify/represent a distinct abstracted view (the problem model) on a real world problem. * This is motivated by the assumption that a registration, as a model for a real world correlation, * might introduce abstraction errors. Thus solutions based on this registration are only simplified models * for the real world problem and its solution. ProblemStatements that are grouped in one ProblemModel are * assumed to be valid in the same abstracted view and thus registrations of these ProblemStatements may be * "used" together. Therefor an entity should not be mapped consecutively by registrations that are not * affiliated to the same ProblemModel via the according ProblemStatements because there is no accepted * "view" on the real world problem allowing there combination.\n * E.g.: Entities mapped prostate centric should not be displayed together * with entities that are mapped pelvis centric.\n\n * * Uses boost::uuid as ID and ior::String as name type. Both informations are stored as members. * the policiy offers public setters and initilizes name with an empty string and the UID with a new unique ID. */ template class ProblemModelBase : public IProblemComplianceDefinition { public: typedef ProblemModelBase Self; - typedef iro::String NameType; - typedef typename TUIDPolicy::UIDType UIDType; + using NameType = iro::String; + using UIDType = typename TUIDPolicy::UIDType; - typedef std::shared_ptr< Self > Pointer; - typedef std::shared_ptr< const Self > ConstPointer; + using Pointer = std::shared_ptr; + using ConstPointer = std::shared_ptr; using ProblemStatementTraitsType = TProblemStatementTraits; - typedef typename ProblemStatementTraitsType::Type ProblemStatementType; - typedef typename ProblemStatementType::ConstPointer ProblemStatementConstPointer; - typedef std::vector StatementVectorType; + using ProblemStatementType = typename ProblemStatementTraitsType::Type; + using ProblemStatementConstPointer = typename ProblemStatementType::ConstPointer; + using StatementVectorType = std::vector; - typedef typename StatementVectorType::iterator ProblemIterator; - typedef typename StatementVectorType::const_iterator ConstProblemIterator; + using ProblemIterator = typename StatementVectorType::iterator; + using ConstProblemIterator = typename StatementVectorType::const_iterator; - typedef typename StatementVectorType::size_type SizeType; + using SizeType = typename StatementVectorType::size_type; - typedef typename ProblemStatementType::UIDType ProblemStatementUIDType; + using ProblemStatementUIDType = typename ProblemStatementType::UIDType; /*! returns the UID of the statement.*/ const UIDType& getUID() const; void setUID(const UIDType& uid); /*! returns the name of the statement.*/ const NameType& getName() const; void setName(const NameType& name); ProblemIterator getStatementBegin(); ConstProblemIterator getStatementBegin() const; ProblemIterator getStatementEnd(); ConstProblemIterator getStatementEnd() const; /*! Returns the number of statements assigned to the model */ SizeType getStatementCount() const; ProblemIterator findStatement(const ProblemStatementUIDType& uid); ConstProblemIterator findStatement(const ProblemStatementUIDType& uid) const; /*! Adds the passed statement instance to the model. * @pre pStatement must point to a valid instance or an exception will be raised. * @pre pStatement must not have the same UID then an other statment already associated * with the modell or an exception will be thrown.*/ void addStatement(ProblemStatementConstPointer pStatement); /*! removes the statement indecated by the passed iterator and returns the iterator the next statement. * if it is the last statement in the list the end iterator will be returned.*/ ProblemIterator removeStatement(ProblemIterator pos); /*! removes all statements from the model.*/ void resetStatements(); /* Clones the content of the ProblemModel and returns it as * non const pointer. It can be used to alter the model and * update the knowledge base of the ontology. */ Pointer clone() const; - ~ProblemModelBase(); + ~ProblemModelBase() override; ProblemModelBase(); protected: - virtual bool doCheckComplianceOfStatement(const ProblemStatementType* pProblem) const; + bool doCheckComplianceOfStatement(const ProblemStatementType* pProblem) const override; StatementVectorType _associatedStatements; NameType _name; UIDType _uid; private: Self& operator=(const Self&); //not implemented by purpose ProblemModelBase(const Self&); //not implemented by purpose }; } // end namespace scenario } // end namespace iro #ifndef MatchPoint_MANUAL_TPP #include "mapProblemModelBase.tpp" #endif #endif diff --git a/Code/Ontology/Common/include/mapProblemModelBase.tpp b/Code/Ontology/Common/include/mapProblemModelBase.tpp index c9819ab..5e3df7b 100644 --- a/Code/Ontology/Common/include/mapProblemModelBase.tpp +++ b/Code/Ontology/Common/include/mapProblemModelBase.tpp @@ -1,220 +1,219 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_PROBLEM_MODEL_BASE_TPP #define __MAP_PROBLEM_MODEL_BASE_TPP #include "mapProblemModelBase.h" namespace iro { namespace scenario { template const typename ProblemModelBase::UIDType& ProblemModelBase:: getUID() const { return _uid; }; template void ProblemModelBase:: setUID(const UIDType& uid) { _uid = uid; }; template const typename ProblemModelBase::NameType& ProblemModelBase:: getName() const { return _name; }; template void ProblemModelBase:: setName(const NameType& name) { _name = name; }; template ProblemModelBase:: ProblemModelBase():_name("") { _uid = TUIDPolicy::generateUID(); }; template ProblemModelBase:: ~ProblemModelBase() - { - }; + = default; template typename ProblemModelBase::ProblemIterator ProblemModelBase:: getStatementBegin() { return _associatedStatements.begin(); }; template typename ProblemModelBase::ConstProblemIterator ProblemModelBase:: getStatementBegin() const { return _associatedStatements.begin(); }; template typename ProblemModelBase::ProblemIterator ProblemModelBase:: getStatementEnd() { return _associatedStatements.end(); }; template typename ProblemModelBase::ConstProblemIterator ProblemModelBase:: getStatementEnd() const { return _associatedStatements.end(); }; template typename ProblemModelBase::SizeType ProblemModelBase:: getStatementCount() const { return _associatedStatements.size(); }; template typename ProblemModelBase::ProblemIterator ProblemModelBase:: findStatement(const ProblemStatementUIDType& uid) { ProblemIterator result = getStatementEnd(); for ( typename StatementVectorType::iterator pos = _associatedStatements.begin(); pos!=_associatedStatements.end(); ++pos) { if ( (*pos)->getUID() == uid) { result = pos; break; } } return result; }; template typename ProblemModelBase::ConstProblemIterator ProblemModelBase:: findStatement(const ProblemStatementUIDType& uid) const { ConstProblemIterator result = getStatementEnd(); for ( ConstProblemIterator pos = _associatedStatements.begin(); pos!=_associatedStatements.end(); ++pos) { if ( (*pos)->getUID() == uid) { result = pos; break; } } return result; }; template void ProblemModelBase:: addStatement(ProblemStatementConstPointer pStatement) { if (!pStatement) { //@TODO add exception } if (findStatement(pStatement->getUID())!=_associatedStatements.end()) { //it is not allowed that the same UID is allready included //@TODO add exception } _associatedStatements.push_back(pStatement); }; template typename ProblemModelBase::ProblemIterator ProblemModelBase:: removeStatement(ProblemIterator pos) { return _associatedStatements.erase(pos); }; template void ProblemModelBase:: resetStatements() { _associatedStatements.clear(); }; template typename ProblemModelBase::Pointer ProblemModelBase:: clone() const { Pointer spClone(new Self()); spClone->setName(_name); spClone->setUID(_uid); spClone->_associatedStatements = _associatedStatements; return spClone; }; template bool ProblemModelBase:: doCheckComplianceOfStatement(const ProblemStatementType* pProblem) const { bool result = false; - ConstProblemIterator pos = _associatedStatements.begin(); + auto pos = _associatedStatements.begin(); while (!result && pos!=_associatedStatements.end()) { //we haven't reached the end of the path and till now all elements were compliant -> check the next element result = (*pos)->checkComplianceOfStatement(pProblem); ++pos; } return result; }; } // end namespace scenario } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapProblemStatementBase.h b/Code/Ontology/Common/include/mapProblemStatementBase.h index 5ab19d4..9646ad4 100644 --- a/Code/Ontology/Common/include/mapProblemStatementBase.h +++ b/Code/Ontology/Common/include/mapProblemStatementBase.h @@ -1,89 +1,89 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_PROBLEM_STATEMENT_BASE_H #define __MAP_PROBLEM_STATEMENT_BASE_H #include "mapOntologyString.h" #include "mapIProblemComplianceDefinition.h" #include namespace iro { namespace scenario { /*! @class ProblemStatementBase * @brief base for problem statements. * * A problem statement is for example: Pelvis centric rigid registration of the reference MRI images of two given studies. * This class is used to resolve ambiguities between translation if they would connect the same information spaces.\n\n * * @tparam TUIDPolicy specifies the type and who to handle UIDs (see for example BoostUIDPolicy which implements boost based UIDs. */ template class ProblemStatementBase : public IProblemComplianceDefinition< ProblemStatementBase > { public: - typedef ProblemStatementBase Self; + using Self = ProblemStatementBase; - typedef iro::String NameType; - typedef typename TUIDPolicy::UIDType UIDType; + using NameType = iro::String; + using UIDType = typename TUIDPolicy::UIDType; - typedef std::shared_ptr< Self > Pointer; - typedef std::shared_ptr< const Self > ConstPointer; + using Pointer = std::shared_ptr; + using ConstPointer = std::shared_ptr; /*! returns the UID of the statement.*/ const UIDType& getUID() const; void setUID(const UIDType& uid); /*! returns the name of the statement.*/ const NameType& getName() const; void setName(const NameType& name); - ~ProblemStatementBase(); + ~ProblemStatementBase() override; ProblemStatementBase(); /* Clones the content of the ProblemStatement and returns it as * non const pointer. It can be used to alter the statement and * update the knowledge base of the ontology. */ Pointer clone() const; protected: - virtual bool doCheckComplianceOfStatement(const Self* pProblem) const; + bool doCheckComplianceOfStatement(const Self* pProblem) const override; NameType _name; UIDType _uid; private: - ProblemStatementBase(const Self&); //not implemented by purpose - ProblemStatementBase& operator=(const Self&); //not implemented by purpose + ProblemStatementBase(const Self&) = delete; //not implemented by purpose + ProblemStatementBase& operator=(const Self&) = delete; //not implemented by purpose }; } // end namespace scenario } // end namespace iro #ifndef MatchPoint_MANUAL_TPP #include "mapProblemStatementBase.tpp" #endif #endif diff --git a/Code/Ontology/Common/include/mapProblemStatementBase.tpp b/Code/Ontology/Common/include/mapProblemStatementBase.tpp index d01c602..6394427 100644 --- a/Code/Ontology/Common/include/mapProblemStatementBase.tpp +++ b/Code/Ontology/Common/include/mapProblemStatementBase.tpp @@ -1,96 +1,95 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_PROBLEM_STATEMENT_BASE_TPP #define __MAP_PROBLEM_STATEMENT_BASE_TPP #include "mapProblemStatementBase.h" namespace iro { namespace scenario { template const typename ProblemStatementBase::UIDType& ProblemStatementBase:: getUID() const { return _uid; }; template void ProblemStatementBase:: setUID(const UIDType& uid) { _uid = uid; }; template const typename ProblemStatementBase::NameType& ProblemStatementBase:: getName() const { return _name; }; template void ProblemStatementBase:: setName(const NameType& name) { _name = name; }; template ProblemStatementBase:: ProblemStatementBase(): _name("") { _uid = TUIDPolicy::generateUID(); }; template ProblemStatementBase:: ~ProblemStatementBase() - { - }; + = default; template bool ProblemStatementBase:: doCheckComplianceOfStatement(const Self* pProblem) const { return pProblem->getUID() == _uid; }; template typename ProblemStatementBase::Pointer ProblemStatementBase:: clone() const { Pointer spClone(new Self()); spClone->setName(_name); spClone->setUID(_uid); return spClone; }; } // end namespace scenario } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapRegistrationInfo.h b/Code/Ontology/Common/include/mapRegistrationInfo.h index 9c04615..aa2f108 100644 --- a/Code/Ontology/Common/include/mapRegistrationInfo.h +++ b/Code/Ontology/Common/include/mapRegistrationInfo.h @@ -1,121 +1,121 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_REGISTRATION_INFO_H #define __MAP_REGISTRATION_INFO_H #include "mapIInformationSpaceConnector.h" #include "mapIProblemStatementAssociated.h" #include #include namespace iro { /** Class that specifies a way to map information from one information space to an other. * It may contain, if available, the transformation info for discrete data * (e.g. pixel images; inverse mapping; getDiscreteTransformation) * and continuous data (e.g. point sets; direct mapping, getContinousTransformation). * @remark The transformation infos in this class always have the same moving and target * information space as well as the same problem statement association. * @tparam TInformationSpaceTraits The traits of the information space used with the registration info. * @tparam TProblemStatementTraits The traits of the problem statement used with the registration info. * @tparam TTransformationInfoTraits The traits of the transformation info used with the registration info.*/ template class RegistrationInfo: public IInformationSpaceConnector, public IProblemStatementAssociated { public: typedef RegistrationInfo Self; - typedef ::std::shared_ptr Pointer; - typedef ::std::shared_ptr ConstPointer; + using Pointer = ::std::shared_ptr; + using ConstPointer = ::std::shared_ptr; - typedef IInformationSpaceConnector ConnectorInterface; - typedef typename ConnectorInterface::ConstISPointer ConstISPointer; + using ConnectorInterface = IInformationSpaceConnector; + using ConstISPointer = typename ConnectorInterface::ConstISPointer; - typedef IProblemStatementAssociated ProblemAssociatedInterface; - typedef typename ProblemAssociatedInterface::ProblemComplianceInterface ProblemComplianceInterface; - typedef typename ProblemAssociatedInterface::ConstProblemPointer ConstProblemPointer; + using ProblemAssociatedInterface = IProblemStatementAssociated; + using ProblemComplianceInterface = typename ProblemAssociatedInterface::ProblemComplianceInterface; + using ConstProblemPointer = typename ProblemAssociatedInterface::ConstProblemPointer; - typedef typename TTransformationInfoTraits::ConstPointer ConstTransformationInfoPointer; - typedef typename TTransformationInfoTraits::Pointer TransformationInfoPointer; - typedef typename TTransformationInfoTraits::Type TransformationInfoType; + using ConstTransformationInfoPointer = typename TTransformationInfoTraits::ConstPointer; + using TransformationInfoPointer = typename TTransformationInfoTraits::Pointer; + using TransformationInfoType = typename TTransformationInfoTraits::Type; /*! Implementation of abstract member. See documentation in interface. * @see IInformationSpaceConnector*/ - virtual ConstISPointer getMovingIS() const; + ConstISPointer getMovingIS() const override; /*! Implementation of abstract member. See documentation in interface. * @see IInformationSpaceConnector*/ - virtual ConstISPointer getTargetIS() const; + ConstISPointer getTargetIS() const override; /** Returns the const pointer to the associated problem statement. * Pointer may be null, if no statement is defined.*/ - virtual ConstProblemPointer getAssociatedProblemStatement() const; + ConstProblemPointer getAssociatedProblemStatement() const override; /*! Returns the transformation for continuous data types. * If no transformation is defined for the data type, NULL will be returned.*/ ConstTransformationInfoPointer getContinuousTransformation() const; /*! Returns the transformation for discrete data types. * If no transformation is defined for the data type, NULL will be returned.*/ ConstTransformationInfoPointer getDiscreteTransformation() const; /*! Sets the transformation info of the registration info instance for discrete and continuous data types. * @remark You may set a NULL pointer if one data representation has no transformation. * @pre Both transformations must have the same moving and target information space and must be * associated with the same problem statement. * @pre The continous transformation info must have a continuous data representation. * @pre The discrete transformation info must have a discrete data representation. * @param [in] continuous Pointer to the transformation info for continuous data types. * @param [in] discrete Pointer to the transformation info for discrete data types. * @exception ::iro::exceptions::InvalidArgument: one of the preconditions is violated.*/ void setTransformations(ConstTransformationInfoPointer continuous, ConstTransformationInfoPointer discrete); /* Clones the content of the RegistrationInfo and returns it as * non const pointer. It can be used to alter the info and * update the knowledge base of the ontology. */ Pointer clone() const; - virtual ~RegistrationInfo(); + ~RegistrationInfo() override; RegistrationInfo(); protected: /*! Implementation of abstract member. This implementation checks the associated * problem statement for compliance. See also documentation in interface. * @see IProblemComplianceChecker*/ - virtual bool doCheckProblemCompliance(const ProblemComplianceInterface* pProblemCompliance) const; + bool doCheckProblemCompliance(const ProblemComplianceInterface* pProblemCompliance) const override; ConstTransformationInfoPointer _continuous; ConstTransformationInfoPointer _discrete; ConstISPointer _movingIS; ConstISPointer _targetIS; ConstProblemPointer _associatedProblem; private: RegistrationInfo(const Self&); //not implemented by purpose Self& operator=(const Self&); //not implemented by purpose }; } // end namespace iro #ifndef MatchPoint_MANUAL_TPP #include "mapRegistrationInfo.tpp" #endif #endif diff --git a/Code/Ontology/Common/include/mapRegistrationInfo.tpp b/Code/Ontology/Common/include/mapRegistrationInfo.tpp index e53d097..2648aad 100644 --- a/Code/Ontology/Common/include/mapRegistrationInfo.tpp +++ b/Code/Ontology/Common/include/mapRegistrationInfo.tpp @@ -1,196 +1,194 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_REGISTRATION_INFO_TPP #define __MAP_REGISTRATION_INFO_TPP #include "mapRegistrationInfo.h" #include "mapOntologyExceptions.h" #include "mapDataRepresentation.h" namespace iro { template typename RegistrationInfo::ConstISPointer RegistrationInfo:: getMovingIS() const { return _movingIS; }; template typename RegistrationInfo::ConstISPointer RegistrationInfo:: getTargetIS() const { return _targetIS; }; template bool RegistrationInfo:: doCheckProblemCompliance(const ProblemComplianceInterface* pProblemCompliance) const { return pProblemCompliance->checkComplianceOfStatement(this->_associatedProblem.get()); }; template typename RegistrationInfo::ConstProblemPointer RegistrationInfo:: getAssociatedProblemStatement() const { return _associatedProblem; }; template typename RegistrationInfo::ConstTransformationInfoPointer RegistrationInfo:: getContinuousTransformation() const { return _continuous; }; template typename RegistrationInfo::ConstTransformationInfoPointer RegistrationInfo:: getDiscreteTransformation() const { return _discrete; }; template void RegistrationInfo:: setTransformations(ConstTransformationInfoPointer continuous, ConstTransformationInfoPointer discrete) { ConstISPointer tempMovingIS; ConstISPointer tempTargetIS; ConstProblemPointer tempAssociatedProblem; //check the data representation type if ( continuous && continuous->getSupportedDataRepresentation()!=::iro::DataRepresentation::Continuous) { throw ::iro::exceptions::InvalidArgument("Passed continuous transform has no continuous data representation type."); } if ( discrete && discrete->getSupportedDataRepresentation()!=::iro::DataRepresentation::Discrete) { throw ::iro::exceptions::InvalidArgument("Passed continuous transform has no continuous data representation type."); } //check the problem statement preconditon if ( continuous && discrete) { //both are defined -> conflict is possible if ( continuous->getAssociatedProblemStatement()->getUID() != discrete->getAssociatedProblemStatement()->getUID()) { throw ::iro::exceptions::InvalidArgument("Associated problem statement of transformation info instances is not equal."); } tempAssociatedProblem = continuous->getAssociatedProblemStatement(); } else { //only one is defined -> no conflict -> determin associated problem statement if (continuous) { tempAssociatedProblem = continuous->getAssociatedProblemStatement(); } else { tempAssociatedProblem = discrete->getAssociatedProblemStatement(); } } //check the moving IS preconditon if ( continuous && discrete) { //both are defined -> conflict is possible if (continuous->getMovingIS()->getUID() != discrete->getMovingIS()->getUID()) { throw ::iro::exceptions::InvalidArgument("Moving IS of transformation info instances is not equal."); } tempMovingIS = continuous->getMovingIS(); } else { //only one is defined -> no conflict -> determin IS if (continuous) { tempMovingIS = continuous->getMovingIS(); } else { tempMovingIS = discrete->getMovingIS(); } } //check the target IS preconditon if ( continuous && discrete) { //both are defined -> conflict is possible if (continuous->getTargetIS()->getUID() != discrete->getTargetIS()->getUID()) { throw ::iro::exceptions::InvalidArgument("Target IS of transformation info instances is not equal."); } tempTargetIS = continuous->getTargetIS(); } else { //only one is defined -> no conflict -> determin IS if (continuous) { tempTargetIS = continuous->getTargetIS(); } else { tempTargetIS = discrete->getTargetIS(); } } _movingIS = tempMovingIS; _targetIS = tempTargetIS; _associatedProblem = tempAssociatedProblem; _continuous = continuous; _discrete = discrete; }; template typename RegistrationInfo::Pointer RegistrationInfo:: clone() const { Pointer spClone(new Self()); spClone->_movingIS = _movingIS; spClone->_targetIS = _targetIS; spClone->_associatedProblem = _associatedProblem; spClone->_continuous = _continuous; spClone->_discrete = _discrete; return spClone; }; template RegistrationInfo:: ~RegistrationInfo() - { - }; + = default; template RegistrationInfo:: RegistrationInfo() - { - }; + = default; } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapRegistrationPathBase.h b/Code/Ontology/Common/include/mapRegistrationPathBase.h index ff75d1d..d5ebba6 100644 --- a/Code/Ontology/Common/include/mapRegistrationPathBase.h +++ b/Code/Ontology/Common/include/mapRegistrationPathBase.h @@ -1,91 +1,91 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_REGISTRATON_PATH_BASE_H #define __MAP_REGISTRATON_PATH_BASE_H #include "mapISConnectorPathBase.h" namespace iro { /*! @class RegistrationPathBase * @brief Base class for all registration paths. * * A Registration path defines a sequence of registrations that lead from * the moving information space of the path to the target information space. * Because the ontology supports the fact that an entity may be mapped by * using interim registration spaces (Moving IS -> Interim IS -> Target IS) * all evaluations of "mappablility" result in paths and not plain * RegistrationInfo. Although most of the paths should be of size 1, * because long paths will introduce more error risks.\n * A RegistrationPath may "contain" up to two TransformationPaths, * one for each data representation type. */ template class RegistrationPathBase : public ISConnectorPathBase< TRegistrationInfoTraits, typename TTransformationPathTraits::InformationSpaceTraitsType, typename TTransformationPathTraits::ProblemStatementTraitsType > { public: typedef RegistrationPathBase Self; typedef ISConnectorPathBase Superclass; - typedef ::std::shared_ptr Pointer; - typedef ::std::shared_ptr ConstPointer; + using Pointer = ::std::shared_ptr; + using ConstPointer = ::std::shared_ptr; - typedef typename Superclass::ConstISPointer ConstISPointer; + using ConstISPointer = typename Superclass::ConstISPointer; - typedef typename Superclass::ConstISPointer ProblemComplianceInterface; + using ProblemComplianceInterface = typename Superclass::ConstISPointer; - typedef typename Superclass::ProblemStatementType ProblemStatementType; - typedef typename Superclass::ProblemPointer ProblemPointer; - typedef typename Superclass::ConstProblemPointer ConstProblemPointer; + using ProblemStatementType = typename Superclass::ProblemStatementType; + using ProblemPointer = typename Superclass::ProblemPointer; + using ConstProblemPointer = typename Superclass::ConstProblemPointer; - typedef typename Superclass::ConstPathElementPointer ConstPathElementPointer; + using ConstPathElementPointer = typename Superclass::ConstPathElementPointer; - typedef typename Superclass::PathElementIterator PathElementIterator; - typedef typename Superclass::ConstPathElementIterator ConstPathElementIterator; - typedef typename Superclass::PathSizeType PathSizeType; + using PathElementIterator = typename Superclass::PathElementIterator; + using ConstPathElementIterator = typename Superclass::ConstPathElementIterator; + using PathSizeType = typename Superclass::PathSizeType; - typedef typename TTransformationPathTraits::ConstPointer ConstTransformationPathPointer; - typedef typename TTransformationPathTraits::Pointer TransformationPathPointer; - typedef typename TTransformationPathTraits::Type TransformationPathType; + using ConstTransformationPathPointer = typename TTransformationPathTraits::ConstPointer; + using TransformationPathPointer = typename TTransformationPathTraits::Pointer; + using TransformationPathType = typename TTransformationPathTraits::Type; /*! Returns the transformation path formed by the continuous transformations stored in each path element. * @remark If not every element of the path has a continuous transformation the transformation path cannot * be established and a null pointer will be returned, indicating that for this data representation type there * is no valid pathway.*/ ConstTransformationPathPointer getContinuousTransformationPath() const; /*! Returns the transformation path formed by the discrete transformations stored in each path element. * @remark If not every element of the path has a discrete transformation the transformation path cannot * be established and a null pointer will be returned, indicating that for this data representation type there * is no valid pathway.*/ ConstTransformationPathPointer getDiscreteTransformationPath() const; - virtual ~RegistrationPathBase(); + ~RegistrationPathBase() override; RegistrationPathBase(); private: RegistrationPathBase(const Self&); //not implemented by purpose Self& operator=(const Self&); //not implemented by purpose }; } // end namespace iro #ifndef MatchPoint_MANUAL_TPP #include "mapRegistrationPathBase.tpp" #endif #endif diff --git a/Code/Ontology/Common/include/mapRegistrationPathBase.tpp b/Code/Ontology/Common/include/mapRegistrationPathBase.tpp index 4b242b4..5209044 100644 --- a/Code/Ontology/Common/include/mapRegistrationPathBase.tpp +++ b/Code/Ontology/Common/include/mapRegistrationPathBase.tpp @@ -1,111 +1,109 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_REGISTRATON_PATH_BASE_TPP #define __MAP_REGISTRATON_PATH_BASE_TPP #include "mapRegistrationPathBase.h" namespace iro { template typename RegistrationPathBase::ConstTransformationPathPointer RegistrationPathBase:: getContinuousTransformationPath() const { TransformationPathPointer spNewPath(new TransformationPathType); ConstPathElementIterator pos = this->_pathElements.begin(); bool valid = true; while (valid && pos!=this->_pathElements.end()) { //we haven't reched the end of the path and till now all elements were valid -> go on typename TransformationPathType::ConstPathElementPointer spTransElement = (*pos)->getContinuousTransformation(); if (spTransElement) { //there is an element, so add it spNewPath->appendElement(spTransElement); } else { //path is broken valid = false; } ++pos; } ConstTransformationPathPointer spResult; if (valid) { spResult = spNewPath; } return spResult; }; template typename RegistrationPathBase::ConstTransformationPathPointer RegistrationPathBase:: getDiscreteTransformationPath() const { TransformationPathPointer spNewPath(new TransformationPathType); ConstPathElementIterator pos = this->_pathElements.begin(); bool valid = true; while (valid && pos!= this->pathElements.end()) { //we haven't reched the end of the path and till now all elements were valid -> go on typename TransformationPathType::ConstPathElementPointer spTransElement = (*pos)->getDiscreteTransformation(); if (spTransElement) { //there is an element, so add it spNewPath->appendElement(spTransElement); } else { //path is broken valid = false; } ++pos; } ConstTransformationPathPointer spResult; if (valid) { spResult = spNewPath; } return spResult; }; template RegistrationPathBase:: ~RegistrationPathBase() - { - }; + = default; template RegistrationPathBase:: RegistrationPathBase() - { - }; + = default; } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapSemanticCorrelation.h b/Code/Ontology/Common/include/mapSemanticCorrelation.h index 5b13050..d1430e7 100644 --- a/Code/Ontology/Common/include/mapSemanticCorrelation.h +++ b/Code/Ontology/Common/include/mapSemanticCorrelation.h @@ -1,126 +1,126 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_SEMANTIC_CORRELATION_H #define __MAP_SEMANTIC_CORRELATION_H #include "mapISemanticCorrelationType.h" #include "mapOntologyExceptions.h" #include "mapSemanticCorrelationTraits.h" namespace iro { /*! @class SemanticCorrelation * @brief Template class for semantic correlations. * * Class is used to gather information about certain semantic correlations. * It grants access to the type of the correlation and to the list of entities that are correlated. * @remark The default type of a correlation is UnkownInjectivCorrelation * @ingroup Correlation */ template class SemanticCorrelation { public: typedef SemanticCorrelation Self; - typedef ::std::shared_ptr Pointer; - typedef ::std::shared_ptr ConstPointer; + using Pointer = ::std::shared_ptr; + using ConstPointer = ::std::shared_ptr; - typedef typename TInformationEntityTraits::ConstPointer ConstIEPointer; - typedef typename TInformationEntityTraits::Type IEType; - typedef typename TInformationEntityTraits::UIDType IEUIDType; - typedef ISemanticCorrelationType::ConstPointer ConstTypePointer; + using ConstIEPointer = typename TInformationEntityTraits::ConstPointer; + using IEType = typename TInformationEntityTraits::Type; + using IEUIDType = typename TInformationEntityTraits::UIDType; + using ConstTypePointer = ISemanticCorrelationType::ConstPointer; - typedef typename TUIDPolicy::UIDType UIDType; + using UIDType = typename TUIDPolicy::UIDType; protected: - typedef std::list EntityListType; + using EntityListType = std::list; public: - typedef typename EntityListType::iterator EntityIterator; - typedef typename EntityListType::const_iterator ConstEntityIterator; - typedef typename EntityListType::size_type SizeType; + using EntityIterator = typename EntityListType::iterator; + using ConstEntityIterator = typename EntityListType::const_iterator; + using SizeType = typename EntityListType::size_type; EntityIterator getCorrelatedEntitiesBegin(); ConstEntityIterator getCorrelatedEntitiesBegin() const; EntityIterator getCorrelatedEntitiesEnd(); ConstEntityIterator getCorrelatedEntitiesEnd() const; /*! Searches for the related entity that has the passed UID. * @param [in] id The ID of the entity that is searched * @return iterator pointing to the found entity. If no entity * was found the iterator equals getCorrelatedEntitiesEnd(). */ EntityIterator findCorrelatedEntity(const IEUIDType& id); /*!@overload * const overload * \see findCorrelatedEntity(const IEUIDType& id) */ ConstEntityIterator findCorrelatedEntity(const IEUIDType& id) const; /*! Returns the number of statements assigned to the model */ SizeType getCorrelatedEntitiesCount() const; /*! Adds the passed entity to the collection. * @pre enity must point to a valid instance or an exception will be raised. * @exception InvalidArgument: precondition is violated*/ void addCorrelatedEntity(ConstIEPointer entity); /*! Removes the related entity indecated by the passed iterator and returns the iterator the next entity. * If it is the last entity in the list the end iterator will be returned.*/ EntityIterator removeCorrelatedEntity(EntityIterator pos); /*! removes all options from the collection.*/ void resetCorrelatedEntities(); /*! Returns a shared_ptr to the type instance of the correlation.*/ ConstTypePointer getType() const; /*! Sets the type of the correlation. * @pre corrType must point to a valid instance or an exception will be raised. * @exception InvalidArgument: precondition is violated*/ void setType(ConstTypePointer corrType); const UIDType& getUID() const; Pointer clone() const; virtual ~SemanticCorrelation(); SemanticCorrelation(); protected: //Collection of the entities EntityListType _entities; ConstTypePointer _spType; UIDType _uid; private: SemanticCorrelation(const Self&); //not implemented by purpose Self& operator=(const Self&); //not implemented by purpose }; } // end namespace iro #ifndef MatchPoint_MANUAL_TPP #include "mapSemanticCorrelation.tpp" #endif #endif diff --git a/Code/Ontology/Common/include/mapSemanticCorrelation.tpp b/Code/Ontology/Common/include/mapSemanticCorrelation.tpp index 853b2ea..d4195c8 100644 --- a/Code/Ontology/Common/include/mapSemanticCorrelation.tpp +++ b/Code/Ontology/Common/include/mapSemanticCorrelation.tpp @@ -1,188 +1,187 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_SEMANTIC_CORRELATION_TPP #define __MAP_SEMANTIC_CORRELATION_TPP #include "mapUnkownInjectivCorrelation.h" #include "mapSemanticCorrelation.h" namespace iro { template typename SemanticCorrelation::EntityIterator SemanticCorrelation:: getCorrelatedEntitiesBegin() { return _entities.begin(); }; template typename SemanticCorrelation::ConstEntityIterator SemanticCorrelation:: getCorrelatedEntitiesBegin() const { return _entities.begin(); }; template typename SemanticCorrelation::EntityIterator SemanticCorrelation:: getCorrelatedEntitiesEnd() { return _entities.end(); }; template typename SemanticCorrelation::ConstEntityIterator SemanticCorrelation:: getCorrelatedEntitiesEnd() const { return _entities.end(); }; template typename SemanticCorrelation::SizeType SemanticCorrelation:: getCorrelatedEntitiesCount() const { return _entities.size(); }; template typename SemanticCorrelation::EntityIterator SemanticCorrelation:: findCorrelatedEntity(const IEUIDType& id) { EntityIterator result = _entities.begin(); while (result != _entities.end()) { if (TInformationEntityTraits::identifyEntity(*((*result).get()),id)) { //it is the search entity break; } ++result; } return result; }; template typename SemanticCorrelation::ConstEntityIterator SemanticCorrelation:: findCorrelatedEntity(const IEUIDType& id) const { ConstEntityIterator result = _entities.begin(); while (result != _entities.end()) { if (TInformationEntityTraits::identifyEntity(*((*result).get()),id)) { //it is the search entity break; } ++result; } return result; }; template void SemanticCorrelation:: addCorrelatedEntity(ConstIEPointer entity) { if (!entity) throw exceptions::InvalidArgument("Cannot add entity. Entity pointer is null"); _entities.push_back(entity); }; template typename SemanticCorrelation::EntityIterator SemanticCorrelation:: removeCorrelatedEntity(EntityIterator pos) { - EntityIterator result = _entities.erase(pos); + auto result = _entities.erase(pos); return result; }; template void SemanticCorrelation:: resetCorrelatedEntities() { _entities.clear(); }; template typename SemanticCorrelation::ConstTypePointer SemanticCorrelation:: getType() const { return _spType; }; template void SemanticCorrelation:: setType(ConstTypePointer corrType) { if (!corrType) throw exceptions::InvalidArgument("Cannot add NULL pointer as type."); _spType = corrType; }; template const typename SemanticCorrelation::UIDType& SemanticCorrelation:: getUID() const { return _uid; }; template typename SemanticCorrelation::Pointer SemanticCorrelation:: clone() const { Pointer spClone(new Self()); spClone->_entities = _entities; spClone->_spType = _spType; spClone->_uid = _uid; return spClone; }; template SemanticCorrelation:: ~SemanticCorrelation() - { - }; + = default; template SemanticCorrelation:: SemanticCorrelation() { _uid = TUIDPolicy::generateUID(); _spType = ConstTypePointer(new UnkownInjectivCorrelation); }; } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapTransformationPathBase.h b/Code/Ontology/Common/include/mapTransformationPathBase.h index 2b18380..b8b0936 100644 --- a/Code/Ontology/Common/include/mapTransformationPathBase.h +++ b/Code/Ontology/Common/include/mapTransformationPathBase.h @@ -1,93 +1,93 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_TRANSFORMATION_PATH_BASE_H #define __MAP_TRANSFORMATION_PATH_BASE_H #include "mapISConnectorPathBase.h" #include "mapOntologyExceptions.h" namespace iro { /*! @class TransformationPathBase * @brief Base class for all transformation paths. * * A Transformation path defines a sequence of transformations (TransformationInfo instances) * that lead from the moving information space of the path to the target information space. * Because the ontology supports the fact that an entity may be mapped by using interim * registration spaces (Moving IS -> Interim IS -> Target IS) all evaluations of * "mappablility" result in paths and not plain Transformation-/RegistrationInfo. * Although most of the paths should be of size 1, because long paths will introduce more * error risks.\n * Because a TransformationPath is compiled of TransformationInfo instances it is only valid * for one data representation type. Therefore a TransformationPath has more precondition * regarding elements that should be added than ISConnectorPathBase.\n\n * */ template class TransformationPathBase : public ISConnectorPathBase< TTransformationInfoTraits, TInformationSpaceTraits, TProblemStatementTraits > { public: typedef TransformationPathBase< TTransformationInfoTraits, TInformationSpaceTraits, TProblemStatementTraits > Self; typedef ISConnectorPathBase< TTransformationInfoTraits, TInformationSpaceTraits, TProblemStatementTraits > Superclass; - typedef ::std::shared_ptr Pointer; - typedef ::std::shared_ptr ConstPointer; + using Pointer = ::std::shared_ptr; + using ConstPointer = ::std::shared_ptr; - typedef typename Superclass::ConstISPointer ConstISPointer; + using ConstISPointer = typename Superclass::ConstISPointer; - typedef typename Superclass::ConstISPointer ProblemComplianceInterface; + using ProblemComplianceInterface = typename Superclass::ConstISPointer; - typedef typename Superclass::ProblemStatementType ProblemStatementType; - typedef typename Superclass::ProblemPointer ProblemPointer; - typedef typename Superclass::ConstProblemPointer ConstProblemPointer; + using ProblemStatementType = typename Superclass::ProblemStatementType; + using ProblemPointer = typename Superclass::ProblemPointer; + using ConstProblemPointer = typename Superclass::ConstProblemPointer; - typedef typename Superclass::ConstPathElementPointer ConstPathElementPointer; + using ConstPathElementPointer = typename Superclass::ConstPathElementPointer; - typedef typename Superclass::PathElementIterator PathElementIterator; - typedef typename Superclass::ConstPathElementIterator ConstPathElementIterator; - typedef typename Superclass::PathSizeType PathSizeType; + using PathElementIterator = typename Superclass::PathElementIterator; + using ConstPathElementIterator = typename Superclass::ConstPathElementIterator; + using PathSizeType = typename Superclass::PathSizeType; - virtual ~TransformationPathBase(); + ~TransformationPathBase() override; TransformationPathBase(); protected: /*! In addition to the base implementation it also checks if the elment has the same data support. * @pre The data representation support of the new element must equal the support of the path elements. * @param [in] pos Iterator indicating the postion of the element where the element should be inserted. * @param [in] newElement The new element that should be inserted. * @return Iterator that points to the position of the inserted element in the path. * @exception ::iro::exceptions::InvalidDataRepresentation: the precondition is violated*/ - virtual PathElementIterator doInsertElement(PathElementIterator pos, ConstPathElementPointer newElement); + PathElementIterator doInsertElement(PathElementIterator pos, ConstPathElementPointer newElement) override; /*! Adds the passed newElement at the end of the path. * @pre The moving IS of the new element must equal the target IS of the preceeding element (if the path is not empty) * @param [in] newElement The new element that should be inserted. * @exception ::iro::exceptions::InvalidDataRepresentation: the preconditions is violated*/ - virtual void doAppend(ConstPathElementPointer newElement); + void doAppend(ConstPathElementPointer newElement) override; private: - TransformationPathBase(const Self&); //not implemented by purpose - Self& operator=(const Self&); //not implemented by purpose + TransformationPathBase(const Self&) = delete; //not implemented by purpose + Self& operator=(const Self&) = delete; //not implemented by purpose }; } // end namespace iro #ifndef MatchPoint_MANUAL_TPP #include "mapTransformationPathBase.tpp" #endif #endif diff --git a/Code/Ontology/Common/include/mapTransformationPathBase.tpp b/Code/Ontology/Common/include/mapTransformationPathBase.tpp index 0b59bbb..f6bd985 100644 --- a/Code/Ontology/Common/include/mapTransformationPathBase.tpp +++ b/Code/Ontology/Common/include/mapTransformationPathBase.tpp @@ -1,74 +1,72 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_TRANSFORMATION_PATH_BASE_TPP #define __MAP_TRANSFORMATION_PATH_BASE_TPP #include "mapTransformationPathBase.h" namespace iro { template typename TransformationPathBase::PathElementIterator TransformationPathBase:: doInsertElement(PathElementIterator pos, ConstPathElementPointer newElement) { //check data representation if (!this->_pathElements.empty()) { //there will be an element bevor the newElement -> check IS compliance if (this->_pathElements.front()->getSupportedDataRepresentation() != newElement->getSupportedDataRepresentation()) { throw exceptions::InvalidDataRepresentation("The insert element has wrong data representation support."); } } return Superclass::doInsertElement(pos,newElement); }; template void TransformationPathBase:: doAppend(ConstPathElementPointer newElement) { if (!this->_pathElements.empty()) { //there will be an element bevor the newElement -> check IS compliance if (this->_pathElements.front()->getSupportedDataRepresentation() != newElement->getSupportedDataRepresentation()) { throw exceptions::InvalidDataRepresentation("The insert element has wrong data representation support."); } } Superclass::doAppend(newElement); }; template TransformationPathBase:: ~TransformationPathBase() - { - }; + = default; template TransformationPathBase:: TransformationPathBase() - { - }; + = default; } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapUnkownBijectivCorrelation.h b/Code/Ontology/Common/include/mapUnkownBijectivCorrelation.h index 7fbea94..9cf81f0 100644 --- a/Code/Ontology/Common/include/mapUnkownBijectivCorrelation.h +++ b/Code/Ontology/Common/include/mapUnkownBijectivCorrelation.h @@ -1,51 +1,51 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_UNKOWN_BIJECTIV_CORRELATION_H #define __MAP_UNKOWN_BIJECTIV_CORRELATION_H #include "mapUnkownInjectivCorrelation.h" #include "mapMAPOntologyExports.h" namespace iro { /** @class UnkownBijectivCorrelation * This class defines a semantic identity that is unkown but bijective. * Thus you know that to entities have exact correspondence (e.g. the same set of markers in different images) * but it is unknown how they match exactly (e.g. which marker is displayed in certain renderings in the image). * @ingroup CorrelationType*/ class MAPOntology_EXPORT UnkownBijectivCorrelation : public UnkownInjectivCorrelation { public: - typedef UnkownBijectivCorrelation Self; - typedef std::shared_ptr Pointer; - typedef std::shared_ptr ConstPointer; + using Self = UnkownBijectivCorrelation; + using Pointer = std::shared_ptr; + using ConstPointer = std::shared_ptr; /** Returns the identifier name of the correlation type.*/ - virtual String getName() const; + String getName() const override; - virtual ~UnkownBijectivCorrelation(); + ~UnkownBijectivCorrelation() override; UnkownBijectivCorrelation(); private: - UnkownBijectivCorrelation(const UnkownBijectivCorrelation&); //not implemented by purpose - UnkownBijectivCorrelation& operator=(const UnkownBijectivCorrelation&); //not implemented by purpose + UnkownBijectivCorrelation(const UnkownBijectivCorrelation&) = delete; //not implemented by purpose + UnkownBijectivCorrelation& operator=(const UnkownBijectivCorrelation&) = delete; //not implemented by purpose }; } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapUnkownInjectivCorrelation.h b/Code/Ontology/Common/include/mapUnkownInjectivCorrelation.h index ceeb652..9dd50fa 100644 --- a/Code/Ontology/Common/include/mapUnkownInjectivCorrelation.h +++ b/Code/Ontology/Common/include/mapUnkownInjectivCorrelation.h @@ -1,53 +1,53 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_UNKOWN_INJECTIV_CORRELATION_H #define __MAP_UNKOWN_INJECTIV_CORRELATION_H #include "mapISemanticCorrelationType.h" #include "mapMAPOntologyExports.h" namespace iro { /** @class UnkownInjectivCorrelation * This class defines a semantic identity that is unknown but injective. * Thus you know that the entities are partly correspondent * (e.g. the same set of markers in different images but it is not guaranteed * that all landmarks are visible in all images), but you don't know which parts * correspond. The weakest of all correlations. * @ingroup CorrelationType*/ class MAPOntology_EXPORT UnkownInjectivCorrelation : public ISemanticCorrelationType { public: - typedef UnkownInjectivCorrelation Self; - typedef std::shared_ptr Pointer; - typedef std::shared_ptr ConstPointer; + using Self = UnkownInjectivCorrelation; + using Pointer = std::shared_ptr; + using ConstPointer = std::shared_ptr; /** Returns the identifier name of the correlation type.*/ - virtual String getName() const; + String getName() const override; - virtual ~UnkownInjectivCorrelation(); + ~UnkownInjectivCorrelation() override; UnkownInjectivCorrelation(); private: - UnkownInjectivCorrelation(const UnkownInjectivCorrelation&); //not implemented by purpose - UnkownInjectivCorrelation& operator=(const UnkownInjectivCorrelation&); //not implemented by purpose + UnkownInjectivCorrelation(const UnkownInjectivCorrelation&) = delete; //not implemented by purpose + UnkownInjectivCorrelation& operator=(const UnkownInjectivCorrelation&) = delete; //not implemented by purpose }; } // end namespace iro #endif diff --git a/Code/Ontology/Common/include/mapValidityIndicator.h b/Code/Ontology/Common/include/mapValidityIndicator.h index 8bb3853..6a6ac04 100644 --- a/Code/Ontology/Common/include/mapValidityIndicator.h +++ b/Code/Ontology/Common/include/mapValidityIndicator.h @@ -1,28 +1,28 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_VALIDITY_INDICATOR_H #define __MAP_VALIDITY_INDICATOR_H namespace iro { - typedef unsigned long OntologyRevisionTag; + using OntologyRevisionTag = unsigned long; } // end namespace iro #endif diff --git a/Code/Ontology/Common/source/mapBijectivCorrelation.cpp b/Code/Ontology/Common/source/mapBijectivCorrelation.cpp index 54b8c7a..bdc1a52 100644 --- a/Code/Ontology/Common/source/mapBijectivCorrelation.cpp +++ b/Code/Ontology/Common/source/mapBijectivCorrelation.cpp @@ -1,38 +1,38 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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. // //------------------------------------------------------------------------ #include "mapBijectivCorrelation.h" namespace iro { String BijectivCorrelation:: getName() const { return "BijectivCorrelation"; }; BijectivCorrelation:: - ~BijectivCorrelation() {}; + ~BijectivCorrelation() = default; BijectivCorrelation:: - BijectivCorrelation() {}; + BijectivCorrelation() = default; } // end namespace iro diff --git a/Code/Ontology/Common/source/mapDataRepresentation.cpp b/Code/Ontology/Common/source/mapDataRepresentation.cpp index 86b4068..1024c99 100644 --- a/Code/Ontology/Common/source/mapDataRepresentation.cpp +++ b/Code/Ontology/Common/source/mapDataRepresentation.cpp @@ -1,32 +1,33 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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. // //------------------------------------------------------------------------ #include "mapDataRepresentation.h" namespace iro { /** Conversion function for data representation type to data * representation support type.*/ DataRepresentationSupport::Type convertToSupport(DataRepresentation::Type data) { - if (data == DataRepresentation::Continuous) return DataRepresentationSupport::Continuous; - else return DataRepresentationSupport::Discrete; + if (data == DataRepresentation::Continuous) { return DataRepresentationSupport::Continuous; + } { return DataRepresentationSupport::Discrete; +} }; } // end namespace iro diff --git a/Code/Ontology/Common/source/mapISemanticCorrelationType.cpp b/Code/Ontology/Common/source/mapISemanticCorrelationType.cpp index 1f7c401..6f87493 100644 --- a/Code/Ontology/Common/source/mapISemanticCorrelationType.cpp +++ b/Code/Ontology/Common/source/mapISemanticCorrelationType.cpp @@ -1,42 +1,43 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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. // //------------------------------------------------------------------------ #include "mapISemanticCorrelationType.h" #include "mapOntologyExceptions.h" namespace iro { /** Checks if the type of this and pType are equal by comparing there names.*/ bool ISemanticCorrelationType:: equals(const ISemanticCorrelationType* pType) const { - if (!pType) throw exceptions::InvalidArgument("Passed correlation type pointer is NULL."); + if (pType == nullptr) { throw exceptions::InvalidArgument("Passed correlation type pointer is NULL."); +} return this->getName() == pType->getName(); }; ISemanticCorrelationType:: - ~ISemanticCorrelationType() {}; + ~ISemanticCorrelationType() = default; ISemanticCorrelationType:: - ISemanticCorrelationType() {}; + ISemanticCorrelationType() = default; } // end namespace iro diff --git a/Code/Ontology/Common/source/mapInjectivCorrelation.cpp b/Code/Ontology/Common/source/mapInjectivCorrelation.cpp index 594f8c5..3d8bbd4 100644 --- a/Code/Ontology/Common/source/mapInjectivCorrelation.cpp +++ b/Code/Ontology/Common/source/mapInjectivCorrelation.cpp @@ -1,37 +1,37 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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. // //------------------------------------------------------------------------ #include "mapInjectivCorrelation.h" namespace iro { String InjectivCorrelation:: getName() const { return "InjectivCorrelation"; }; InjectivCorrelation:: - ~InjectivCorrelation() {}; + ~InjectivCorrelation() = default; InjectivCorrelation:: - InjectivCorrelation() {}; + InjectivCorrelation() = default; } // end namespace iro diff --git a/Code/Ontology/Common/source/mapUnkownBijectivCorrelation.cpp b/Code/Ontology/Common/source/mapUnkownBijectivCorrelation.cpp index 43019b9..0a3a9ac 100644 --- a/Code/Ontology/Common/source/mapUnkownBijectivCorrelation.cpp +++ b/Code/Ontology/Common/source/mapUnkownBijectivCorrelation.cpp @@ -1,38 +1,38 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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. // //------------------------------------------------------------------------ #include "mapUnkownBijectivCorrelation.h" namespace iro { String UnkownBijectivCorrelation:: getName() const { return "UnkownBijectivCorrelation"; }; UnkownBijectivCorrelation:: - ~UnkownBijectivCorrelation() {}; + ~UnkownBijectivCorrelation() = default; UnkownBijectivCorrelation:: - UnkownBijectivCorrelation() {}; + UnkownBijectivCorrelation() = default; } // end namespace iro diff --git a/Code/Ontology/Common/source/mapUnkownInjectivCorrelation.cpp b/Code/Ontology/Common/source/mapUnkownInjectivCorrelation.cpp index d909999..38c8d78 100644 --- a/Code/Ontology/Common/source/mapUnkownInjectivCorrelation.cpp +++ b/Code/Ontology/Common/source/mapUnkownInjectivCorrelation.cpp @@ -1,37 +1,37 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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. // //------------------------------------------------------------------------ #include "mapUnkownInjectivCorrelation.h" namespace iro { String UnkownInjectivCorrelation:: getName() const { return "UnkownInjectivCorrelation"; }; UnkownInjectivCorrelation:: - ~UnkownInjectivCorrelation() {}; + ~UnkownInjectivCorrelation() = default; UnkownInjectivCorrelation:: - UnkownInjectivCorrelation() {}; + UnkownInjectivCorrelation() = default; } // end namespace iro diff --git a/Code/Ontology/Simple/include/mapBoostUIDPolicy.h b/Code/Ontology/Simple/include/mapBoostUIDPolicy.h index 5b6d34c..6943ce4 100644 --- a/Code/Ontology/Simple/include/mapBoostUIDPolicy.h +++ b/Code/Ontology/Simple/include/mapBoostUIDPolicy.h @@ -1,40 +1,40 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_BOOST_UID_POLICY_H #define __MAP_BOOST_UID_POLICY_H #include "mapMAPOntologySimpleExports.h" #include "boost/uuid/uuid.hpp" namespace iro { /*! @struct BoostUIDPolicy * @brief Policy for using boost::uuid as UID in MatchPoint ontologies. * * @ingroup UIDPolicy */ struct MAPOntologySimple_EXPORT BoostUIDPolicy { - typedef boost::uuids::uuid UIDType; + using UIDType = boost::uuids::uuid; static UIDType generateUID(); }; } // end namespace iro #endif diff --git a/Code/Ontology/Simple/include/mapSimpleInformationEntity.h b/Code/Ontology/Simple/include/mapSimpleInformationEntity.h index 9836a10..ce6e5b9 100644 --- a/Code/Ontology/Simple/include/mapSimpleInformationEntity.h +++ b/Code/Ontology/Simple/include/mapSimpleInformationEntity.h @@ -1,94 +1,94 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_SIMPLE_INFORMATION_ENTITY_H #define __MAP_SIMPLE_INFORMATION_ENTITY_H #include #include "mapDataRepresentation.h" #include "mapInformationEntityTraits.h" #include "mapOntologyString.h" #include "mapMAPOntologySimpleExports.h" namespace iro { namespace scenario { /*! @class SimpleInformationEntity * @brief Simple specific implementation of an InformationEntity * Uses a string type to store the UID. * @ingroup Simple*/ class MAPOntologySimple_EXPORT SimpleInformationEntity { public: - typedef SimpleInformationEntity Self; - typedef ::iro::String UIDType; - typedef DataRepresentation::Type DataRepresentationType; + using Self = SimpleInformationEntity; + using UIDType = ::iro::String; + using DataRepresentationType = DataRepresentation::Type; - typedef std::shared_ptr< Self > Pointer; - typedef std::shared_ptr< const Self > ConstPointer; + using Pointer = std::shared_ptr; + using ConstPointer = std::shared_ptr; /*! returns the UID of the statement.*/ const UIDType& getUID() const; void setUID(const UIDType& uid); const DataRepresentationType& getDataRepresentation() const; void setDataRepresentation(const DataRepresentationType& rep); virtual ~SimpleInformationEntity(); SimpleInformationEntity(); bool operator == (const Self& is) const; /** Clones the content of the information entity and returns it as * non const pointer. It can be used to alter the entity and * update the knowledge base of the ontology. */ Pointer clone() const; protected: UIDType _uid; - DataRepresentationType _dataRep; + DataRepresentationType _dataRep{DataRepresentation::Discrete}; private: - SimpleInformationEntity(const Self&); //not implemented by purpose - Self& operator=(const Self&); //not implemented by purpose + SimpleInformationEntity(const Self&) = delete; //not implemented by purpose + Self& operator=(const Self&) = delete; //not implemented by purpose }; /*! @struct SimpleEntityIdentificationPolicy * @brief Policy used in the information entity traits to check if the passed entity has a given UID. * @ingroup Simple */ struct SimpleEntityIdentificationPolicy { using UIDType = ::iro::scenario::SimpleInformationEntity::UIDType; static bool identifyEntity(const ::iro::scenario::SimpleInformationEntity& pEntity, const UIDType& uid) { return pEntity.getUID() == uid; }; }; using SimpleInformationEntityTraits = InformationEntityTraits<::iro::scenario::SimpleInformationEntity, SimpleEntityIdentificationPolicy>; } // end namespace scenario } // end namespace iro #endif diff --git a/Code/Ontology/Simple/include/mapSimpleInformationSpace.h b/Code/Ontology/Simple/include/mapSimpleInformationSpace.h index 0321fe5..c455dde 100644 --- a/Code/Ontology/Simple/include/mapSimpleInformationSpace.h +++ b/Code/Ontology/Simple/include/mapSimpleInformationSpace.h @@ -1,75 +1,75 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_SIMPLE_INFORMATION_SPACE_H #define __MAP_SIMPLE_INFORMATION_SPACE_H #include #include "mapInformationSpaceTraits.h" #include "mapOntologyString.h" #include "mapMAPOntologySimpleExports.h" namespace iro { namespace scenario { /*! @class SimpleInformationSpace * @brief Simple specific implementation of an information space * Uses a string type to store the UID. * @ingroup Simple*/ class MAPOntologySimple_EXPORT SimpleInformationSpace { public: - typedef SimpleInformationSpace Self; - typedef ::iro::String UIDType; + using Self = SimpleInformationSpace; + using UIDType = ::iro::String; - typedef std::shared_ptr< Self > Pointer; - typedef std::shared_ptr< const Self > ConstPointer; + using Pointer = std::shared_ptr; + using ConstPointer = std::shared_ptr; /*! returns the UID of the statement.*/ const UIDType& getUID() const; void setUID(const UIDType& uid); virtual ~SimpleInformationSpace(); SimpleInformationSpace(); bool operator == (const Self& is) const; /** Clones the content of the information space and returns it as * non const pointer. It can be used to alter the entity and * update the knowledge base of the ontology. */ Pointer clone() const; protected: UIDType _uid; private: - SimpleInformationSpace(const Self&); //not implemented by purpose - Self& operator=(const Self&); //not implemented by purpose + SimpleInformationSpace(const Self&) = delete; //not implemented by purpose + Self& operator=(const Self&) = delete; //not implemented by purpose }; using SimpleInformationSpaceTraits = InformationSpaceTraits<::iro::scenario::SimpleInformationSpace>; } // end namespace scenario } // end namespace iro #endif diff --git a/Code/Ontology/Simple/include/mapSimpleOntology.h b/Code/Ontology/Simple/include/mapSimpleOntology.h index e1037b3..00380b9 100644 --- a/Code/Ontology/Simple/include/mapSimpleOntology.h +++ b/Code/Ontology/Simple/include/mapSimpleOntology.h @@ -1,385 +1,385 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_SIMPLE_ONTOLOGY_H #define __MAP_SIMPLE_ONTOLOGY_H #include "mapOntologyAccess.h" #include "mapSimpleRegPathOptionCollection.h" #include "mapSimpleTransPathOptionCollection.h" #include "mapSimpleAlgorithmExecutionInfo.h" #include "mapSimpleProblemModel.h" #include "mapSimpleSemanticCorrelation.h" #include "mapMAPOntologySimpleExports.h" namespace iro { namespace scenario { struct SimpleOntologyAccessTraits : public iro::core::OntologyAccessTraits < SimpleRegistrationPathTraits, SimpleRegPathOptionCollectionTraits, SimpleTransPathOptionCollectionTraits, SimpleSemanticCorrelationTraits, SimpleProblemModelTraits> {}; template class SimpleOntologyCore; /*! @class SimpleOntology * @brief Simple specific implementation of the ontology * @ingroup Simple*/ class MAPOntologySimple_EXPORT SimpleOntology : public iro::core::OntologyAccess { public: - typedef SimpleOntology Self; + using Self = SimpleOntology; - typedef std::shared_ptr< Self > Pointer; - typedef std::shared_ptr< const Self > ConstPointer; + using Pointer = std::shared_ptr; + using ConstPointer = std::shared_ptr; using Superclass = iro::core::OntologyAccess; using EntityInferenceInterface = Superclass::EntityInferenceInterface; using MappingInferenceInterface = Superclass::MappingInferenceInterface; using ProblemInferenceInterface = Superclass::ProblemInferenceInterface; using EntityIntegrationInterface = Superclass::EntityIntegrationInterface; using MappingIntegrationInterface = Superclass::MappingIntegrationInterface; - typedef EntityInferenceInterface::InfEntityType InfEntityType; - typedef EntityInferenceInterface::InfSpaceType InfSpaceType; - typedef EntityInferenceInterface::CorrelationType CorrelationType; - typedef EntityInferenceInterface::ConstInfEntityPointer ConstInfEntityPointer; - typedef EntityInferenceInterface::ConstInfSpacePointer ConstInfSpacePointer; - typedef EntityInferenceInterface::ConstCorrelationPointer ConstCorrelationPointer; - typedef EntityInferenceInterface::InfEntityInferencePointer InfEntityInferencePointer; - typedef EntityInferenceInterface::InfSpaceInferencePointer InfSpaceInferencePointer; - typedef EntityInferenceInterface::CorrelationInferencePointer CorrelationInferencePointer; + using InfEntityType = EntityInferenceInterface::InfEntityType; + using InfSpaceType = EntityInferenceInterface::InfSpaceType; + using CorrelationType = EntityInferenceInterface::CorrelationType; + using ConstInfEntityPointer = EntityInferenceInterface::ConstInfEntityPointer; + using ConstInfSpacePointer = EntityInferenceInterface::ConstInfSpacePointer; + using ConstCorrelationPointer = EntityInferenceInterface::ConstCorrelationPointer; + using InfEntityInferencePointer = EntityInferenceInterface::InfEntityInferencePointer; + using InfSpaceInferencePointer = EntityInferenceInterface::InfSpaceInferencePointer; + using CorrelationInferencePointer = EntityInferenceInterface::CorrelationInferencePointer; - typedef EntityInferenceInterface::ConstInfEntityVectorType ConstInfEntityVectorType; - typedef EntityInferenceInterface::ConstInfSpaceVectorType ConstInfSpaceVectorType; - typedef EntityInferenceInterface::ConstCorrelationVectorType ConstCorrelationVectorType; + using ConstInfEntityVectorType = EntityInferenceInterface::ConstInfEntityVectorType; + using ConstInfSpaceVectorType = EntityInferenceInterface::ConstInfSpaceVectorType; + using ConstCorrelationVectorType = EntityInferenceInterface::ConstCorrelationVectorType; - typedef MappingInferenceInterface::ProblemComplianceInterface ProblemComplianceInterface; + using ProblemComplianceInterface = MappingInferenceInterface::ProblemComplianceInterface; - typedef MappingInferenceInterface::RegistrationPathType RegistrationPathType; - typedef MappingInferenceInterface::ConstRegistrationPathPointer ConstRegistrationPathPointer; + using RegistrationPathType = MappingInferenceInterface::RegistrationPathType; + using ConstRegistrationPathPointer = MappingInferenceInterface::ConstRegistrationPathPointer; - typedef MappingInferenceInterface::TransformationPathType TransformationPathType; - typedef MappingInferenceInterface::ConstTransformationPathPointer ConstTransformationPathPointer; + using TransformationPathType = MappingInferenceInterface::TransformationPathType; + using ConstTransformationPathPointer = MappingInferenceInterface::ConstTransformationPathPointer; - typedef MappingInferenceInterface::RegPathOptCollectionType RegPathOptCollectionType; - typedef MappingInferenceInterface::ConstRegPathOptColPointer ConstRegPathOptColPointer; - typedef MappingInferenceInterface::ConstRegPathOptColVectorType ConstRegPathOptColVectorType; - typedef RegPathOptCollectionType::OptionType RegPathOptionType; - typedef RegPathOptCollectionType::ConstOptionPointer ConstRegPathOptionPointer; - - typedef MappingInferenceInterface::TransPathOptCollectionType TransPathOptCollectionType; - typedef MappingInferenceInterface::ConstTransPathOptColPointer ConstTransPathOptColPointer; - typedef MappingInferenceInterface::ConstTransPathOptColVectorType ConstTransPathOptColVectorType; - typedef TransPathOptCollectionType::OptionType TransPathOptionType; - typedef TransPathOptCollectionType::ConstOptionPointer ConstTransPathOptionPointer; - - typedef ProblemInferenceInterface::ProblemStatementType ProblemStatementType; - typedef ProblemInferenceInterface::ConstProblemStatementPointer ConstProblemStatementPointer; - typedef ProblemInferenceInterface::ProblemStatementInferencePointer ProblemStatementInferencePointer; - typedef ProblemInferenceInterface::ConstProblemStatementVectorType ConstProblemStatementVectorType; - - typedef ProblemInferenceInterface::ProblemModelType ProblemModelType; - typedef ProblemInferenceInterface::ConstProblemModelPointer ConstProblemModelPointer; - typedef ProblemInferenceInterface::ProblemModelInferencePointer ProblemModelInferencePointer; - typedef ProblemInferenceInterface::ConstProblemModelVectorType ConstProblemModelVectorType; - - typedef ProblemInferenceInterface::ProblemAssociatedInterface ProblemAssociatedInterface; - - typedef EntityIntegrationInterface::EntityDeleteReturnType EntityDeleteReturnType; - typedef EntityIntegrationInterface::ISDeleteReturnType ISDeleteReturnType; - typedef EntityIntegrationInterface::CorrelationDeleteReturnType CorrelationDeleteReturnType; - - typedef MappingIntegrationInterface::TransInfoInferencePointer TransInfoInferencePointer; - typedef MappingIntegrationInterface::ConstTransformationInfoPointer ConstTransformationInfoPointer; - typedef MappingIntegrationInterface::TransformationDeleteReturnType TransformationDeleteReturnType; + using RegPathOptCollectionType = MappingInferenceInterface::RegPathOptCollectionType; + using ConstRegPathOptColPointer = MappingInferenceInterface::ConstRegPathOptColPointer; + using ConstRegPathOptColVectorType = MappingInferenceInterface::ConstRegPathOptColVectorType; + using RegPathOptionType = RegPathOptCollectionType::OptionType; + using ConstRegPathOptionPointer = RegPathOptCollectionType::ConstOptionPointer; + + using TransPathOptCollectionType = MappingInferenceInterface::TransPathOptCollectionType; + using ConstTransPathOptColPointer = MappingInferenceInterface::ConstTransPathOptColPointer; + using ConstTransPathOptColVectorType = MappingInferenceInterface::ConstTransPathOptColVectorType; + using TransPathOptionType = TransPathOptCollectionType::OptionType; + using ConstTransPathOptionPointer = TransPathOptCollectionType::ConstOptionPointer; + + using ProblemStatementType = ProblemInferenceInterface::ProblemStatementType; + using ConstProblemStatementPointer = ProblemInferenceInterface::ConstProblemStatementPointer; + using ProblemStatementInferencePointer = ProblemInferenceInterface::ProblemStatementInferencePointer; + using ConstProblemStatementVectorType = ProblemInferenceInterface::ConstProblemStatementVectorType; + + using ProblemModelType = ProblemInferenceInterface::ProblemModelType; + using ConstProblemModelPointer = ProblemInferenceInterface::ConstProblemModelPointer; + using ProblemModelInferencePointer = ProblemInferenceInterface::ProblemModelInferencePointer; + using ConstProblemModelVectorType = ProblemInferenceInterface::ConstProblemModelVectorType; + + using ProblemAssociatedInterface = ProblemInferenceInterface::ProblemAssociatedInterface; + + using EntityDeleteReturnType = EntityIntegrationInterface::EntityDeleteReturnType; + using ISDeleteReturnType = EntityIntegrationInterface::ISDeleteReturnType; + using CorrelationDeleteReturnType = EntityIntegrationInterface::CorrelationDeleteReturnType; + + using TransInfoInferencePointer = MappingIntegrationInterface::TransInfoInferencePointer; + using ConstTransformationInfoPointer = MappingIntegrationInterface::ConstTransformationInfoPointer; + using TransformationDeleteReturnType = MappingIntegrationInterface::TransformationDeleteReturnType; /** Resets the complete ontology. Revision number will be increased and is keept consistent.*/ void reset(); - virtual ~SimpleOntology(); + ~SimpleOntology() override; SimpleOntology(); protected: /////////////////////////////////////////////////////////////// // Entity Inference /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getContainingIS*/ - virtual Result doGetContainingIS(InfEntityInferencePointer pEntity) const; + Result doGetContainingIS(InfEntityInferencePointer pEntity) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getEntitiesInIS*/ - virtual Result doGetEntitiesInIS(InfSpaceInferencePointer pIS) const; + Result doGetEntitiesInIS(InfSpaceInferencePointer pIS) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see checkForSameIS*/ - virtual Result doCheckForSameIS(InfEntityInferencePointer pEntity1, InfEntityInferencePointer pEntity2) const; + Result doCheckForSameIS(InfEntityInferencePointer pEntity1, InfEntityInferencePointer pEntity2) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see checkForSameIS*/ - virtual Result doCheckForSameIS(const ConstInfEntityVectorType& entities) const; + Result doCheckForSameIS(const ConstInfEntityVectorType& entities) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getEntitiesWithSemanticCorrelations*/ - virtual Result doGetEntitiesWithSemanticCorrelations(InfEntityInferencePointer pEntity) const; + Result doGetEntitiesWithSemanticCorrelations(InfEntityInferencePointer pEntity) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getSemanticallyCorrelatedEntities*/ - virtual Result doGetSemanticallyCorrelatedEntities(InfSpaceInferencePointer pSourceIS, InfSpaceInferencePointer pCorrelatedIS) const; + Result doGetSemanticallyCorrelatedEntities(InfSpaceInferencePointer pSourceIS, InfSpaceInferencePointer pCorrelatedIS) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getSemanticCorrelations*/ - virtual Result doGetSemanticCorrelations(InfSpaceInferencePointer pIS1, InfSpaceInferencePointer pIS2) const; + Result doGetSemanticCorrelations(InfSpaceInferencePointer pIS1, InfSpaceInferencePointer pIS2) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getSemanticCorrelations*/ - virtual Result doGetSemanticCorrelations(InfEntityInferencePointer pEntity, InfSpaceInferencePointer pIs) const; + Result doGetSemanticCorrelations(InfEntityInferencePointer pEntity, InfSpaceInferencePointer pIs) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getSemanticCorrelations*/ - virtual Result doGetSemanticCorrelations(InfEntityInferencePointer pEntity1, InfEntityInferencePointer pEntity2) const; + Result doGetSemanticCorrelations(InfEntityInferencePointer pEntity1, InfEntityInferencePointer pEntity2) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getDataRepresentationType*/ - virtual Result doGetDataRepresentationType(InfEntityInferencePointer pEntity) const; + Result doGetDataRepresentationType(InfEntityInferencePointer pEntity) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see hasDiscreteDataRepresentation*/ - virtual Result doHasDiscreteDataRepresentation(InfEntityInferencePointer pEntity) const; + Result doHasDiscreteDataRepresentation(InfEntityInferencePointer pEntity) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see hasContinuousDataRepresentation*/ - virtual Result doHasContinuousDataRepresentation(InfEntityInferencePointer pEntity) const; + Result doHasContinuousDataRepresentation(InfEntityInferencePointer pEntity) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getEntities*/ - virtual Result doGetEntities() const; + Result doGetEntities() const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getInformationSpaces*/ - virtual Result doGetInformationSpaces() const; + Result doGetInformationSpaces() const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getSemanticCorrelations*/ - virtual Result doGetSemanticCorrelations() const; + Result doGetSemanticCorrelations() const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see actualize*/ - virtual Result doActualize(InfEntityInferencePointer pEntity) const; + Result doActualize(InfEntityInferencePointer pEntity) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see actualize*/ - virtual Result doActualize(InfSpaceInferencePointer pIS) const; + Result doActualize(InfSpaceInferencePointer pIS) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see actualize*/ - virtual Result doActualize(CorrelationInferencePointer corr) const; + Result doActualize(CorrelationInferencePointer corr) const override; /////////////////////////////////////////////////////////////// // Entity Integration /*! virtual abstract part of the NVI idiom. See public member for more information. *@see defineEntity*/ - virtual Result doDefineEntity(InfEntityInferencePointer pNewEntity, InfSpaceInferencePointer pContainingIS); + Result doDefineEntity(InfEntityInferencePointer pNewEntity, InfSpaceInferencePointer pContainingIS) override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see storeEntity*/ - virtual Result doStoreEntity(InfEntityInferencePointer pEntity); + Result doStoreEntity(InfEntityInferencePointer pEntity) override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see convertTransformationToRegistrationPath*/ - virtual EntityDeleteReturnType doDeleteEntity(InfEntityInferencePointer pEntity); + EntityDeleteReturnType doDeleteEntity(InfEntityInferencePointer pEntity) override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see defineInformationSpace*/ - virtual Result doDefineInformationSpace(InfSpaceInferencePointer pNewIS); + Result doDefineInformationSpace(InfSpaceInferencePointer pNewIS) override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see storeInformationSpace*/ - virtual Result doStoreInformationSpace(InfSpaceInferencePointer pIS); + Result doStoreInformationSpace(InfSpaceInferencePointer pIS) override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see deleteInformationSpace*/ - virtual ISDeleteReturnType doDeleteInformationSpace(InfSpaceInferencePointer pIS); + ISDeleteReturnType doDeleteInformationSpace(InfSpaceInferencePointer pIS) override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see switchInformationSpace*/ - virtual void doSwitchInformationSpace(InfEntityInferencePointer pEntity, InfSpaceInferencePointer pNewIS); + void doSwitchInformationSpace(InfEntityInferencePointer pEntity, InfSpaceInferencePointer pNewIS) override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see defineSemanticCorrelation*/ - virtual Result doDefineSemanticCorrelation(CorrelationInferencePointer pNewCorr); + Result doDefineSemanticCorrelation(CorrelationInferencePointer pNewCorr) override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see storeSemanticCorrelation*/ - virtual Result doStoreSemanticCorrelation(CorrelationInferencePointer corr); + Result doStoreSemanticCorrelation(CorrelationInferencePointer corr) override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see deleteSemanticCorrelation*/ - virtual CorrelationDeleteReturnType doDeleteSemanticCorrelation(CorrelationInferencePointer corr); + CorrelationDeleteReturnType doDeleteSemanticCorrelation(CorrelationInferencePointer corr) override; /////////////////////////////////////////////////////////////// // Mapping inference /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getRegistrationPaths*/ - virtual Result doGetRegistrationPaths(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = NULL) const; + Result doGetRegistrationPaths(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = nullptr) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getRegistrationPaths*/ - virtual Result doGetRegistrationPaths(const ConstInfEntityVectorType& movingEntities, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = NULL) const; + Result doGetRegistrationPaths(const ConstInfEntityVectorType& movingEntities, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = nullptr) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getTransformationPaths*/ - virtual Result doGetTransformationPaths(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = NULL) const; + Result doGetTransformationPaths(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = nullptr) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getTransformationPaths*/ - virtual Result doGetTransformationPaths(const ConstInfEntityVectorType& movingEntities, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = NULL) const; + Result doGetTransformationPaths(const ConstInfEntityVectorType& movingEntities, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = nullptr) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getOptimalRegistrationPaths*/ - virtual Result doGetOptimalRegistrationPaths(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, DataRepresentationSupport::Type requiredDataSupport, const ProblemComplianceInterface* pProblemCompliance = NULL, const RegPathMetricInterface* pMetric = NULL) const; + Result doGetOptimalRegistrationPaths(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, DataRepresentationSupport::Type requiredDataSupport, const ProblemComplianceInterface* pProblemCompliance = nullptr, const RegPathMetricInterface* pMetric = nullptr) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getOptimalRegistrationPaths*/ - virtual Result doGetOptimalRegistrationPaths(const ConstInfEntityVectorType& movingEntities, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = NULL, const RegPathMetricInterface* pMetric = NULL) const; + Result doGetOptimalRegistrationPaths(const ConstInfEntityVectorType& movingEntities, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = nullptr, const RegPathMetricInterface* pMetric = nullptr) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getOptimalTransformationPaths*/ - virtual Result doGetOptimalTransformationPaths(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = NULL, const TransPathMetricInterface* pMetric = NULL) const; + Result doGetOptimalTransformationPaths(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = nullptr, const TransPathMetricInterface* pMetric = nullptr) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getOptimalTransformationPaths*/ - virtual Result doGetOptimalTransformationPaths(const ConstInfEntityVectorType& movingEntities, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = NULL, const TransPathMetricInterface* pMetric = NULL) const; + Result doGetOptimalTransformationPaths(const ConstInfEntityVectorType& movingEntities, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = nullptr, const TransPathMetricInterface* pMetric = nullptr) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getMappableInformationSpaces*/ - virtual Result doGetMappableInformationSpaces(InfSpaceInferencePointer pFixedIS, DataRepresentationSupport::Type requiredDataSupport = DataRepresentationSupport::All, const ProblemComplianceInterface* pProblemCompliance = NULL, const RegPathMetricInterface* pMetric = NULL) const; + Result doGetMappableInformationSpaces(InfSpaceInferencePointer pFixedIS, DataRepresentationSupport::Type requiredDataSupport = DataRepresentationSupport::All, const ProblemComplianceInterface* pProblemCompliance = nullptr, const RegPathMetricInterface* pMetric = nullptr) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see checkForMappingFailureReason*/ - virtual Result doCheckForMappingFailureReason(InfEntityInferencePointer pMovingEntity, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = NULL) const; + Result doCheckForMappingFailureReason(InfEntityInferencePointer pMovingEntity, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance = nullptr) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see checkForMappingFailureReason*/ - virtual Result doCheckForMappingFailureReason(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, DataRepresentationSupport::Type requiredDataSupport = DataRepresentationSupport::All, const ProblemComplianceInterface* pProblemCompliance = NULL) const; + Result doCheckForMappingFailureReason(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, DataRepresentationSupport::Type requiredDataSupport = DataRepresentationSupport::All, const ProblemComplianceInterface* pProblemCompliance = nullptr) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see checkForMappingFailureReason*/ - virtual Result doCheckForMappingFailureReason(InfEntityInferencePointer pMovingEntity, ConstRegistrationPathPointer pPath) const; + Result doCheckForMappingFailureReason(InfEntityInferencePointer pMovingEntity, ConstRegistrationPathPointer pPath) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see checkForMappingFailureReason*/ - virtual Result doCheckForMappingFailureReason(InfEntityInferencePointer pMovingEntity, ConstTransformationPathPointer pPath) const; + Result doCheckForMappingFailureReason(InfEntityInferencePointer pMovingEntity, ConstTransformationPathPointer pPath) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see convertTransformationToRegistrationPath*/ - virtual Result doConvertTransformationToRegistrationPath(ConstTransformationPathPointer pPath) const; + Result doConvertTransformationToRegistrationPath(ConstTransformationPathPointer pPath) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see actualize*/ - virtual Result doActualize(TransformationInfoInferencePointer pTI) const; + Result doActualize(TransformationInfoInferencePointer pTI) const override; /////////////////////////////////////////////////////////////// // Mapping Integration /*! virtual abstract part of the NVI idiom. See public member for more information. *@see defineTransformation*/ - virtual Result doDefineTransformation(TransInfoInferencePointer newTransformation); + Result doDefineTransformation(TransInfoInferencePointer newTransformation) override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see storeTransformation*/ - virtual Result doStoreTransformation(TransInfoInferencePointer transformation); + Result doStoreTransformation(TransInfoInferencePointer transformation) override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see deleteTransformation*/ - virtual TransformationDeleteReturnType doDeleteTransformation(TransInfoInferencePointer transformation); + TransformationDeleteReturnType doDeleteTransformation(TransInfoInferencePointer transformation) override; /////////////////////////////////////////////////////////////// // Problem Inference /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getAssociatedProblemModels*/ - virtual Result doGetAssociatedProblemModels(ProblemStatementInferencePointer ps) const; + Result doGetAssociatedProblemModels(ProblemStatementInferencePointer ps) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see geProblemModels*/ - virtual Result doGetProblemModels() const; + Result doGetProblemModels() const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see getProblemStatements*/ - virtual Result doGetProblemStatements() const; + Result doGetProblemStatements() const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see actualize*/ - virtual Result doActualize(ProblemStatementInferencePointer ps) const; + Result doActualize(ProblemStatementInferencePointer ps) const override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see actualize*/ - virtual Result doActualize(ProblemModelInferencePointer pm) const; + Result doActualize(ProblemModelInferencePointer pm) const override; /////////////////////////////////////////////////////////////// // Problem Integration /*! virtual abstract part of the NVI idiom. See public member for more information. *@see defineProblemStatement*/ - virtual Result doDefineProblemStatement(ProblemStatementInferencePointer pNewStatement); + Result doDefineProblemStatement(ProblemStatementInferencePointer pNewStatement) override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see storeProblemStatement*/ - virtual Result doStoreProblemStatement(ProblemStatementInferencePointer pStatement); + Result doStoreProblemStatement(ProblemStatementInferencePointer pStatement) override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see deleteProblemStatement*/ - virtual StatementDeleteReturnType doDeleteProblemStatement(ProblemStatementInferencePointer pStatement); + StatementDeleteReturnType doDeleteProblemStatement(ProblemStatementInferencePointer pStatement) override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see defineProblemModel*/ - virtual Result doDefineProblemModel(ProblemModelInferencePointer pNewModel); + Result doDefineProblemModel(ProblemModelInferencePointer pNewModel) override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see storeProblemModel*/ - virtual Result doStoreProblemModel(ProblemModelInferencePointer pModel); + Result doStoreProblemModel(ProblemModelInferencePointer pModel) override; /*! virtual abstract part of the NVI idiom. See public member for more information. *@see deleteProblemModel*/ - virtual ModelDeleteReturnType doDeleteProblemModel(ProblemModelInferencePointer pModel); + ModelDeleteReturnType doDeleteProblemModel(ProblemModelInferencePointer pModel) override; /////////////////////////////////////////////////////////////// // internals using OntologyCoreType = SimpleOntologyCore; std::shared_ptr< OntologyCoreType > _spCore; private: - SimpleOntology(const Self&); //not implemented by purpose - Self& operator=(const Self&); //not implemented by purpose + SimpleOntology(const Self&) = delete; //not implemented by purpose + Self& operator=(const Self&) = delete; //not implemented by purpose }; } // end namespace scenario } // end namespace iro #endif diff --git a/Code/Ontology/Simple/include/mapSimpleOntologyCore.h b/Code/Ontology/Simple/include/mapSimpleOntologyCore.h index 4458703..b5ca590 100644 --- a/Code/Ontology/Simple/include/mapSimpleOntologyCore.h +++ b/Code/Ontology/Simple/include/mapSimpleOntologyCore.h @@ -1,269 +1,269 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_SIMPLE_ONTOLOGY_CORE_H #define __MAP_SIMPLE_ONTOLOGY_CORE_H #include #include "mapValidityIndicator.h" #include "mapProblemBasedEdgeValidator.h" #include "mapDataRepresentation.h" #include "mapIPathMetric.h" #include "mapMappingError.h" #include "mapGraphProperties.h" #include "mapSimplePathSearch.h" #include "boost/graph/adjacency_list.hpp" #define BOOST_DATE_TIME_NO_LIB #include "boost/interprocess/sync/interprocess_upgradable_mutex.hpp" #include "boost/interprocess/sync/sharable_lock.hpp" #include "boost/interprocess/sync/scoped_lock.hpp" namespace iro { namespace scenario { /*! @class SimpleOntologyCore * @brief Simple specific implementation of the ontology core * @ingroup Simple*/ template class SimpleOntologyCore { public: - typedef SimpleOntologyCore Self; + using Self = SimpleOntologyCore; - typedef ::boost::interprocess::interprocess_upgradable_mutex MutexType; - typedef ::boost::interprocess::sharable_lock SharableLockType; - typedef ::boost::interprocess::scoped_lock LockType; + using MutexType = ::boost::interprocess::interprocess_upgradable_mutex; + using SharableLockType = ::boost::interprocess::sharable_lock; + using LockType = ::boost::interprocess::scoped_lock; using InfEntityType = typename TOATraits::InformationEntityTraitsType::Type; using InfEntityUIDType = typename TOATraits::InformationEntityTraitsType::UIDType; using InfSpaceType = typename TOATraits::InformationSpaceTraitsType::Type; using InfSpaceUIDType = typename TOATraits::InformationSpaceTraitsType::UIDType; using CorrelationType = typename TOATraits::SemanticCorrelationTraitsType::Type; using CorrelationUIDType = typename CorrelationType::UIDType; using ConstInfEntityPointer = typename TOATraits::InformationEntityTraitsType::ConstPointer; using ConstInfSpacePointer = typename TOATraits::InformationSpaceTraitsType::ConstPointer; using ConstCorrelationPointer = typename TOATraits::SemanticCorrelationTraitsType::ConstPointer; using InfEntityPointer = typename TOATraits::InformationEntityTraitsType::Pointer; using InfSpacePointer = typename TOATraits::InformationSpaceTraitsType::Pointer; using CorrelationPointer = typename TOATraits::SemanticCorrelationTraitsType::Pointer; using ProblemStatementType = typename TOATraits::ProblemStatementTraitsType::Type; using ProblemStatementUIDType = typename ProblemStatementType::UIDType; using ProblemStatementPointer = typename TOATraits::ProblemStatementTraitsType::Pointer; using ProblemModelType = typename TOATraits::ProblemModelTraitsType::Type; using ProblemModelUIDType = typename ProblemModelType::UIDType; using ProblemModelPointer = typename TOATraits::ProblemModelTraitsType::Pointer; using ConstProblemModelPointer = typename TOATraits::ProblemModelTraitsType::ConstPointer; using TransformationInfoType = typename TOATraits::TransformationInfoTraitsType::Type; using TransformationInfoPointer = typename TOATraits::TransformationInfoTraitsType::Pointer; using ConstTransformationInfoPointer = typename TOATraits::TransformationInfoTraitsType::ConstPointer; using TransformationInfoUIDType = typename TOATraits::TransformationInfoTraitsType::UIDType; - typedef typename TOATraits::RegistrationInfoTraitsType::Type RegistrationInfoType; - typedef typename TOATraits::RegistrationInfoTraitsType::Pointer RegistrationInfoPointer; - typedef IProblemComplianceDefinition ProblemComplianceInterface; - typedef IPathMetric RegPathMetricInterface; - typedef IPathMetric TransPathMetricInterface; - typedef typename TOATraits::TransformationPathTraitsType::Type TransformationPathType; - typedef typename TOATraits::TransformationPathTraitsType::Pointer TransformationPathPointer; - typedef typename TOATraits::RegistrationPathTraitsType::Type RegistrationPathType; + using RegistrationInfoType = typename TOATraits::RegistrationInfoTraitsType::Type; + using RegistrationInfoPointer = typename TOATraits::RegistrationInfoTraitsType::Pointer; + using ProblemComplianceInterface = IProblemComplianceDefinition; + using RegPathMetricInterface = IPathMetric; + using TransPathMetricInterface = IPathMetric; + using TransformationPathType = typename TOATraits::TransformationPathTraitsType::Type; + using TransformationPathPointer = typename TOATraits::TransformationPathTraitsType::Pointer; + using RegistrationPathType = typename TOATraits::RegistrationPathTraitsType::Type; using RegistrationPathPointer = typename TOATraits::RegistrationPathTraitsType::Pointer; - typedef typename TOATraits::RegPathOptionCollectionTraitsType::Type RegPathOptColType; - typedef typename TOATraits::RegPathOptionCollectionTraitsType::Pointer RegPathOptColPointer; - typedef typename TOATraits::RegPathOptionCollectionTraitsType::ConstPointer ConstRegPathOptColPointer; - typedef typename TOATraits::TransPathOptionCollectionTraitsType::Type TransPathOptColType; - typedef typename TOATraits::TransPathOptionCollectionTraitsType::Pointer TransPathOptColPointer; + using RegPathOptColType = typename TOATraits::RegPathOptionCollectionTraitsType::Type; + using RegPathOptColPointer = typename TOATraits::RegPathOptionCollectionTraitsType::Pointer; + using ConstRegPathOptColPointer = typename TOATraits::RegPathOptionCollectionTraitsType::ConstPointer; + using TransPathOptColType = typename TOATraits::TransPathOptionCollectionTraitsType::Type; + using TransPathOptColPointer = typename TOATraits::TransPathOptionCollectionTraitsType::Pointer; //Basic entity maps typedef std::map EntityMapType; typedef std::map ConstEntityMapType; typedef std::map ISMapType; typedef std::map CorrelationMapType; typedef std::map ModelMapType; typedef std::map StatementMapType; typedef std::map TransformationMapType; //look up maps typedef std::multimap StatementModelMapType; typedef std::map EntityISMapType; typedef std::multimap EntityCorrelationMapType; typedef ::boost::adjacency_list<::boost::vecS,::boost::vecS,::boost::directedS,core::ISGraphInfo, core::RegistrationISGraphInfo > RegistrationGraphType; //utility maps/collections typedef std::map ConstCorrelationMapType; typedef std::map ConstModelMapType; - typedef std::set EntityUIDSetType; + using EntityUIDSetType = std::set; typedef std::map WeightMapType; typedef std::map PredecessorMapType; typedef std::map EdgeMapType; - typedef std::vector ConstInfEntityVectorType; - typedef ::std::vector< ::std::vector< typename RegistrationGraphType::edge_descriptor> > SimpleSearchMapType; - typedef std::vector ConstInfSpaceEntityVectorType; + using ConstInfEntityVectorType = std::vector; + using SimpleSearchMapType = ::std::vector< ::std::vector >; + using ConstInfSpaceEntityVectorType = std::vector; using EdgeValidatorType = ProblemBasedEdgeValidator >; MutexType _mutex; EntityMapType _entityMap; ISMapType _ISMap; CorrelationMapType _correlationMap; StatementMapType _statementMap; ModelMapType _modelMap; TransformationMapType _transformationMap; RegistrationGraphType _graph; EntityISMapType _entity2ISMap; EntityCorrelationMapType _entity2CorrelationMap; StatementModelMapType _stat2ModelMap; mutable OntologyRevisionTag _revision; /**changes the revision*/ void notifyChange() const; /**! Get all correlations between source entities and target entities. @remark the passed variable corrs is not reseted only "updated". If you want a "clean" result clear the map before adding.*/ void getCorrelations(ConstCorrelationMapType& corrs, const EntityUIDSetType& sourceEntities, const EntityUIDSetType& targetEntities) const; /**! Get all correlations between source entities and target entities. @remark the passed variable corrs is not reseted only "updated". If you want a "clean" result clear the map before adding.*/ void getCorrelations(ConstCorrelationMapType& corrs, const InfEntityUIDType& sourceEntity, const InfEntityUIDType& targetEntity) const; /**! Get all correlations of passed entity. @remark the passed variable corrs is not reseted only "updated". If you want a "clean" result clear the map before adding.*/ void getCorrelations(ConstCorrelationMapType& corrs, const InfEntityUIDType& entity) const; /**! Get all models that are associated with the passed statement. @remark the passed variable models is not reseted only "updated". If you want a "clean" result clear the map before adding.*/ void getProblemModels(ConstModelMapType& models, const ProblemStatementUIDType& ps) const; /**! stores (new or updated) transformation infos to the core. handles the update of reference and of the graph*/ void storeTransformationInfo(TransformationInfoPointer trans); /**! deletes transformation infos to the core. handles the update of reference and of the graph*/ void deleteTransformationInfo(ConstTransformationInfoPointer trans); /**checks if the transformation info only relates to entities defined in the ontology. * if not it returns false. All referenced entities will be updated/exchange with the current * instances of the ontology.*/ bool validateForCommit(TransformationInfoPointer trans); /** searches for the edge containing the transformation. throws an exception if not found*/ typename RegistrationGraphType::edge_descriptor getAssociatedEdge(ConstTransformationInfoPointer trans); /** searches for an edge that has the right IS connection and problem statement association and returns it via edge. If no edge has been found it returns false.*/ bool getFittingEdge(ConstTransformationInfoPointer trans, typename RegistrationGraphType::edge_descriptor& edge); /** adds an edge connecting the passed spaces*/ typename RegistrationGraphType::edge_descriptor addEdge(ConstInfSpacePointer movingIS, ConstInfSpacePointer targetIS); /** inserts the transformation into the edge. If there is already an transformation it will be removed from the * edge and ontology.*/ - void updateEdge(typename RegistrationGraphType::edge_descriptor, TransformationInfoPointer trans); + void updateEdge(typename RegistrationGraphType::edge_descriptor /*edge*/, TransformationInfoPointer trans); typename RegistrationGraphType::vertex_descriptor getVertex(ConstInfSpacePointer is) const; void addVertex(ConstInfSpacePointer is); void deleteVertex(ConstInfSpacePointer is); /**generates a weight map on registration info level for all edges regarding the passed requirements.*/ WeightMapType generateWeightMap_reg(DataRepresentationSupport::Type requiredDataSupport = DataRepresentationSupport::All, const ProblemComplianceInterface* pProblemCompliance = NULL, const RegPathMetricInterface* pMetric = NULL); /**generates a weight map on transformation info level for all edges regarding the passed requirements.*/ WeightMapType generateWeightMap_trans(DataRepresentationSupport::Type requiredDataSupport, const ProblemComplianceInterface* pProblemCompliance = NULL, const TransPathMetricInterface* pMetric = NULL); void generateMinimalPathPredecessors(ConstInfSpacePointer targetIS, WeightMapType& map, PredecessorMapType& predecessors, EdgeMapType& edges); RegistrationPathPointer generateRegPath(ConstInfSpacePointer movingIS, ConstInfSpacePointer targetIS, const WeightMapType& weights, const PredecessorMapType& predecessors, const EdgeMapType& edges); TransformationPathPointer generateTransPath(ConstInfSpacePointer movingIS, ConstInfSpacePointer targetIS, DataRepresentation::Type requiredDataSupport, const WeightMapType& weights, const PredecessorMapType& predecessors, const EdgeMapType& edges); /*generates path options out of the simple search results and sets the entity of the option if passed*/ RegPathOptColPointer generateRegCollection(const SimpleSearchMapType& searchResult, ConstInfEntityPointer ie) const; /**generates path options out of the simple search results and sets the entity of the option if passed * if no entity is passed all types of paths will be generated, otherwise only the fitting paths.*/ TransPathOptColPointer generateTransCollection(const SimpleSearchMapType& searchResult, ConstInfEntityPointer ie) const; /** Generates a vector with all information spaces that can be mapped into the target IS.*/ ConstInfSpaceEntityVectorType generateMapableIS(ConstInfSpacePointer targetIS, const WeightMapType& weights, const PredecessorMapType& predecessors, const EdgeMapType& edges); /**deletes look ups of entities that aren't related to corr any more and add all entities that are related to corr*/ void updateEntity2CorrelationMap(ConstCorrelationPointer corr); /**goes through all correlations and removes the passed entity if related.*/ void removeEntityFromCorrelations(const InfEntityUIDType& entity); /**goes through all correlations and updates the entity specified by the UID if it is related to the correlation * @remark the updated entity must already be in _entityMap;*/ void actualizeEntityInCorrelations(const InfEntityUIDType& entity); /**checks if the correlation only relates to entities defined in the ontology. * if not it returns false. All referenced entities will be updated/exchange with the current * instances of the ontology.*/ bool validateForCommit(CorrelationPointer corr); /**deletes look ups of statements that aren't related to pModell any more and add all statements that are related to pModell*/ void updateStatement2ModelMap(ConstProblemModelPointer pModell); /**goes through all models and removes the passed statement if associated.*/ void removeStatementFromModels(const ProblemStatementUIDType& stat); /**goes through all models and updates the statement specified by the UID if it is related to the model * @remark the updated statement must already be in _statementMap;*/ void actualizeStatementInModels(const ProblemStatementUIDType& stat); /**checks if the model only relates to statements defined in the ontology. * if not it returns false. All referenced statements will be updated/exchange with the current * instances of the ontology.*/ bool validateForCommit(ProblemModelPointer model); //*! Get all entities correlations relate to. You can specify an entity UID set and exclude all entities that match to this set or only include entities that match with this set. static ConstEntityMapType getEntitiesByCorrelations(const ConstCorrelationMapType& correlations, const EntityUIDSetType& entities, bool excludeEntities = true); static void spliteEntitiesByData(const ConstInfEntityVectorType& movingEntities, ConstInfEntityVectorType& continuousEntities, ConstInfEntityVectorType& discreteEntities); template static void extracValuesFromMap( const TMap & m, TList & v ) { - for( typename TMap::const_iterator it = m.begin(); it != m.end(); ++it ) + for( auto it = m.begin(); it != m.end(); ++it ) { v.push_back( it->second ); } } template static void extractUIDs( const TVector & v, TUIDVector & uids ) { uids.clear(); - for( typename TVector::const_iterator it = v.begin(); it != v.end(); ++it ) + for( auto it = v.begin(); it != v.end(); ++it ) { uids.insert( (*it)->getUID() ); } } MappingError::Type checkOptionCollectionSupport( ConstRegPathOptColPointer col, DataRepresentationSupport::Type requiredDataSupport ) const; virtual ~SimpleOntologyCore(); SimpleOntologyCore(); protected: const static double fatalPenaltyCost; const static double baseCost; private: SimpleOntologyCore(const Self&); //not implemented by purpose Self& operator=(const Self&); //not implemented by purpose }; } // end namespace scenario } // end namespace iro #include "mapSimpleOntologyCore.tpp" #endif diff --git a/Code/Ontology/Simple/include/mapSimpleOntologyCore.tpp b/Code/Ontology/Simple/include/mapSimpleOntologyCore.tpp index c954811..ed05b40 100644 --- a/Code/Ontology/Simple/include/mapSimpleOntologyCore.tpp +++ b/Code/Ontology/Simple/include/mapSimpleOntologyCore.tpp @@ -1,1166 +1,1171 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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. // //------------------------------------------------------------------------ #include "mapSimpleOntologyCore.h" #include namespace iro { namespace scenario { template const double SimpleOntologyCore::fatalPenaltyCost = 1e9; template const double SimpleOntologyCore::baseCost = 0.0; template SimpleOntologyCore:: ~SimpleOntologyCore() - { - }; + = default; template SimpleOntologyCore:: SimpleOntologyCore() { _revision = 0; }; template void SimpleOntologyCore:: notifyChange() const { ++_revision; }; template void SimpleOntologyCore:: getCorrelations(ConstCorrelationMapType& corrs, const EntityUIDSetType& sourceEntities, const EntityUIDSetType& targetEntities) const { - for (typename EntityUIDSetType::const_iterator sourcePos = sourceEntities.begin(); sourcePos!= sourceEntities.end(); ++sourcePos) + for (auto sourcePos = sourceEntities.begin(); sourcePos!= sourceEntities.end(); ++sourcePos) { - for (typename EntityUIDSetType::const_iterator targetPos = targetEntities.begin(); targetPos!= targetEntities.end(); ++targetPos) + for (auto targetPos = targetEntities.begin(); targetPos!= targetEntities.end(); ++targetPos) { getCorrelations(corrs, *sourcePos,*targetPos); } } }; template void SimpleOntologyCore:: getCorrelations(ConstCorrelationMapType& corrs, const InfEntityUIDType& sourceEntity, const InfEntityUIDType& targetEntity) const { typedef std::pair PairType; PairType sourceFindings = _entity2CorrelationMap.equal_range(sourceEntity); PairType targetFindings = _entity2CorrelationMap.equal_range(targetEntity); //got through all source entity correlations - for (typename EntityCorrelationMapType::const_iterator sourcePos = sourceFindings.first; sourcePos!= sourceFindings.second; ++sourcePos) + for (auto sourcePos = sourceFindings.first; sourcePos!= sourceFindings.second; ++sourcePos) { - for (typename EntityCorrelationMapType::const_iterator targetPos = targetFindings.first; targetPos!= targetFindings.second; ++targetPos) + for (auto targetPos = targetFindings.first; targetPos!= targetFindings.second; ++targetPos) { if (sourcePos->second == targetPos->second) { //source and target are related to the same correlation //get Correlation - typename CorrelationMapType::const_iterator posCorr = _correlationMap.find(sourcePos->second); + auto posCorr = _correlationMap.find(sourcePos->second); if (posCorr != _correlationMap.end()) { corrs[posCorr->second->getUID()] = posCorr->second; break; } } } } }; template void SimpleOntologyCore:: getCorrelations(ConstCorrelationMapType& corrs, const InfEntityUIDType& entity) const { typedef std::pair PairType; PairType sourceFindings = _entity2CorrelationMap.equal_range(entity); //got through all source entity correlations - for (typename EntityCorrelationMapType::const_iterator sourcePos = sourceFindings.first; sourcePos!= sourceFindings.second; ++sourcePos) + for (auto sourcePos = sourceFindings.first; sourcePos!= sourceFindings.second; ++sourcePos) { - typename CorrelationMapType::const_iterator posCorr = _correlationMap.find(sourcePos->second); + auto posCorr = _correlationMap.find(sourcePos->second); if (posCorr != _correlationMap.end()) { corrs[posCorr->second->getUID()] = posCorr->second; } } }; template void SimpleOntologyCore:: storeTransformationInfo(TransformationInfoPointer trans) { - typename TransformationMapType::iterator trPos = _transformationMap.find(trans->getUID()); + auto trPos = _transformationMap.find(trans->getUID()); if (trPos!=_transformationMap.end()) { //existing transformation -> check if edges must be refined or even deleted bool changedIS = (trPos->second->getTargetIS()->getUID() != trans->getTargetIS()->getUID()) || (trPos->second->getMovingIS()->getUID() != trans->getMovingIS()->getUID()); bool changedPS = !(trPos->second->hasSameProblemStatement(trans.get())); if (changedIS || changedPS) {//check if existant edge would be empty bool willBeEmpty = false; typename RegistrationGraphType::edge_descriptor oldEdge = getAssociatedEdge(trPos->second); if (trans->getSupportedDataRepresentation()==DataRepresentation::Continuous) { willBeEmpty = !(_graph[oldEdge].inverse); } else { willBeEmpty = !(_graph[oldEdge].direct); } if (willBeEmpty) { // delete the old edge ::boost::remove_edge(oldEdge,_graph); } } } typename RegistrationGraphType::edge_descriptor newEdge; if (!getFittingEdge(trans,newEdge)) { //need new edge newEdge = addEdge(trans->getMovingIS(),trans->getTargetIS()); }; updateEdge(newEdge,trans); _transformationMap[trans->getUID()] = trans; notifyChange(); }; template void SimpleOntologyCore:: deleteTransformationInfo(ConstTransformationInfoPointer trans) { typename RegistrationGraphType::edge_descriptor oldEdge = getAssociatedEdge(trans); ::boost::remove_edge(oldEdge,_graph); _transformationMap.erase(trans->getUID()); notifyChange(); }; template bool SimpleOntologyCore:: validateForCommit(TransformationInfoPointer trans) { bool result = true; if (trans->getMovingIS()) { typename ISMapType::const_iterator isPos = _ISMap.find(trans->getMovingIS()->getUID()); if (isPos==_ISMap.end()) { result = false; } else { trans->setMovingIS(isPos->second); } } else { result = false; } if (trans->getTargetIS()) { typename ISMapType::const_iterator isPos = _ISMap.find(trans->getTargetIS()->getUID()); if (isPos==_ISMap.end()) { result = false; } else { trans->setTargetIS(isPos->second); } } else { result = false; } if (trans->getAssociatedProblemStatement()) { typename StatementMapType::const_iterator statPos = _statementMap.find(trans->getAssociatedProblemStatement()->getUID()); if (statPos==_statementMap.end()) { result = false; } else { trans->setAssociatedProblemStatement(statPos->second); } } return result; }; template typename SimpleOntologyCore::RegistrationGraphType::edge_descriptor SimpleOntologyCore:: getAssociatedEdge(ConstTransformationInfoPointer trans) { typename RegistrationGraphType::edge_descriptor result; std::pair range = boost::edges(_graph); for (typename RegistrationGraphType::edge_iterator pos = range.first; pos != range.second; ++pos) { if (trans->getSupportedDataRepresentation()==DataRepresentation::Continuous) { if(_graph[*pos].direct && _graph[*pos].direct->getUID() == trans->getUID()) { return *pos; } } else { if (_graph[*pos].inverse && _graph[*pos].inverse->getUID() == trans->getUID()) { return *pos; } } } throw exceptions::InvalidArgument("Error, cannot find transformation in registration graph. Should be there. Check graph initialization."); }; template bool SimpleOntologyCore:: getFittingEdge(ConstTransformationInfoPointer trans, typename RegistrationGraphType::edge_descriptor& edge) { bool result = false; std::pair range = boost::edges(_graph); for (typename RegistrationGraphType::edge_iterator pos = range.first; pos != range.second; ++pos) { //check IS //target vertex == moving IS : for explanation see addEdge(); typename RegistrationGraphType::vertex_descriptor movingV = ::boost::target(*pos,_graph); if (_graph[movingV].infSpace->getUID() != trans->getMovingIS()->getUID()) { continue; } //source vertex == moving IS : for explanation see addEdge(); typename RegistrationGraphType::vertex_descriptor targetV = ::boost::source(*pos,_graph); if (_graph[targetV].infSpace->getUID() != trans->getTargetIS()->getUID()) { continue; } //check PS if (_graph[*pos].direct) { if (_graph[*pos].direct->hasSameProblemStatement(trans.get())) { edge = *pos; result = true; //ok IS is correct and PS also break; }; } else if (_graph[*pos].inverse) { if (_graph[*pos].inverse->hasSameProblemStatement(trans.get())) { edge = *pos; result = true; //ok IS is correct and PS also break; }; } } return result; }; template typename SimpleOntologyCore::RegistrationGraphType::edge_descriptor SimpleOntologyCore:: addEdge(ConstInfSpacePointer movingIS, ConstInfSpacePointer targetIS) { typename RegistrationGraphType::edge_descriptor result; typename RegistrationGraphType::vertex_descriptor movingV = getVertex(movingIS); typename RegistrationGraphType::vertex_descriptor targetV = getVertex(targetIS); //we add the edge as "target -> moving" because it is more efficient when //searching in the registration graph via dijkstra_shortest_path etc. ::std::pair addResult = ::boost::add_edge(targetV, movingV,_graph); result = addResult.first; - if (!(addResult.second)) throw exceptions::InvalidArgument("Unable to add an edge."); + if (!(addResult.second)) { throw exceptions::InvalidArgument("Unable to add an edge."); +} return result; }; template void SimpleOntologyCore:: updateEdge(typename RegistrationGraphType::edge_descriptor edge, TransformationInfoPointer trans) { bool hasRemovedEdge = false; TransformationInfoPointer oldTrans; if (trans->getSupportedDataRepresentation()==DataRepresentation::Continuous) { if (_graph[edge].direct) { hasRemovedEdge=true; oldTrans = _graph[edge].direct; } _graph[edge].direct = trans; } else { if (_graph[edge].inverse) { hasRemovedEdge=true; oldTrans = _graph[edge].inverse; } _graph[edge].inverse = trans; } if (hasRemovedEdge) { _transformationMap.erase(oldTrans->getUID()); } }; template typename SimpleOntologyCore::RegistrationGraphType::vertex_descriptor SimpleOntologyCore:: getVertex(ConstInfSpacePointer is) const { std::pair range = boost::vertices(_graph); for (typename RegistrationGraphType::vertex_iterator pos = range.first; pos != range.second; ++pos) { if (_graph[*pos].infSpace->getUID() == is->getUID()) { return *pos; } } throw exceptions::InvalidArgument("Error, cannot find IS in registration graph. Should be there. Check graph initialization."); }; template void SimpleOntologyCore:: addVertex(ConstInfSpacePointer is) { typename RegistrationGraphType::vertex_descriptor v = ::boost::add_vertex(_graph); _graph[v].infSpace = is; }; template void SimpleOntologyCore:: deleteVertex(ConstInfSpacePointer is) { typename RegistrationGraphType::vertex_descriptor v = getVertex(is); ::boost::remove_vertex(v,_graph); }; template typename SimpleOntologyCore::WeightMapType SimpleOntologyCore:: generateWeightMap_reg(DataRepresentationSupport::Type requiredDataSupport, const ProblemComplianceInterface* pProblemCompliance, const RegPathMetricInterface* pMetric) { WeightMapType result; std::pair range = boost::edges(_graph); for (typename RegistrationGraphType::edge_iterator pos = range.first; pos != range.second; ++pos) { double weight = baseCost; if ((requiredDataSupport == DataRepresentationSupport::All|| requiredDataSupport == DataRepresentationSupport::Discrete)&& (!_graph[*pos].inverse)) { weight += fatalPenaltyCost; } if ((requiredDataSupport == DataRepresentationSupport::All|| requiredDataSupport == DataRepresentationSupport::Continuous)&& (!_graph[*pos].direct)) { weight += fatalPenaltyCost; } RegistrationInfoPointer spRegInfo(new RegistrationInfoType); spRegInfo->setTransformations(_graph[*pos].direct,_graph[*pos].inverse); if (pProblemCompliance) { if (!pProblemCompliance->checkComplianceOfStatement(spRegInfo->getAssociatedProblemStatement().get())) { weight += fatalPenaltyCost; } } if (pMetric) { weight += pMetric->evaluatePathElement(spRegInfo.get()); } result[*pos] = weight; } return result; }; template typename SimpleOntologyCore::WeightMapType SimpleOntologyCore:: generateWeightMap_trans(DataRepresentationSupport::Type requiredDataSupport, const ProblemComplianceInterface* pProblemCompliance, const TransPathMetricInterface* pMetric) { WeightMapType result; std::pair range = boost::edges(_graph); for (typename RegistrationGraphType::edge_iterator pos = range.first; pos != range.second; ++pos) { double weight = baseCost; if ((requiredDataSupport == DataRepresentationSupport::All|| requiredDataSupport == DataRepresentationSupport::Discrete)&& (!_graph[*pos].inverse)) { weight += fatalPenaltyCost; } if ((requiredDataSupport == DataRepresentationSupport::All|| requiredDataSupport == DataRepresentationSupport::Continuous)&& (!_graph[*pos].direct)) { weight += fatalPenaltyCost; } if (pProblemCompliance) { RegistrationInfoPointer spRegInfo(new RegistrationInfoType); spRegInfo->setTransformations(_graph[*pos].direct,_graph[*pos].inverse); if (!pProblemCompliance->checkComplianceOfStatement(spRegInfo->getAssociatedProblemStatement().get())) { weight += fatalPenaltyCost; } } if (pMetric) { double weightD = fatalPenaltyCost; - if (_graph[*pos].direct) weightD = pMetric->evaluatePathElement(_graph[*pos].direct.get()); + if (_graph[*pos].direct) { weightD = pMetric->evaluatePathElement(_graph[*pos].direct.get()); +} double weightI = fatalPenaltyCost; - if (_graph[*pos].direct) weightI = pMetric->evaluatePathElement(_graph[*pos].inverse.get()); + if (_graph[*pos].direct) { weightI = pMetric->evaluatePathElement(_graph[*pos].inverse.get()); +} if (requiredDataSupport == DataRepresentationSupport::Discrete) { weight += weightI; } else if (requiredDataSupport == DataRepresentationSupport::Continuous) { weight += weightD; } else if (requiredDataSupport == DataRepresentationSupport::All) { weight += weightI>weightD ? weightI : weightD; } else { weight += weightI class record_edges : public ::boost::dijkstra_visitor<> { public: record_edges(TEdgeMap& e) : m_edges(e) { } template void edge_relaxed(Edge e, Graph& g) { // set the parent of the target(e) to source(e) m_edges[::boost::target(e, g)] = e; } protected: TEdgeMap& m_edges; }; template void SimpleOntologyCore:: generateMinimalPathPredecessors(ConstInfSpacePointer targetIS, WeightMapType& map, PredecessorMapType& predecessors, EdgeMapType& edges) { typename RegistrationGraphType::vertex_descriptor v = getVertex(targetIS); PredecessorMapType result; record_edges recorder(edges); ::boost::associative_property_map pmWeigth(map); ::boost::associative_property_map pmPredecessor(predecessors); ::boost::dijkstra_shortest_paths(_graph,v,::boost::weight_map(pmWeigth).predecessor_map(pmPredecessor).visitor(recorder)); }; template typename SimpleOntologyCore::RegistrationPathPointer SimpleOntologyCore:: generateRegPath(ConstInfSpacePointer movingIS, ConstInfSpacePointer targetIS, const WeightMapType& weights, const PredecessorMapType& predecessors, const EdgeMapType& edges) { RegistrationPathPointer result; RegistrationPathPointer temp(new RegistrationPathType); bool reachedTarget = false; typename RegistrationGraphType::vertex_descriptor currentV = getVertex(movingIS); typename RegistrationGraphType::vertex_descriptor targetV = getVertex(targetIS); while (!reachedTarget) { - typename PredecessorMapType::const_iterator posV = predecessors.find(currentV); + auto posV = predecessors.find(currentV); assert(posV!=predecessors.end()); if (posV->second == currentV) { if (posV->second == targetV) { reachedTarget = true; } else { //this moving IS has no connection break; } } else { - typename EdgeMapType::const_iterator posEdge = edges.find(currentV); + auto posEdge = edges.find(currentV); assert(posEdge!=edges.end()); - typename WeightMapType::const_iterator posWeigth = weights.find(posEdge->second); + auto posWeigth = weights.find(posEdge->second); if (posWeigth->secondsetTransformations(_graph[posEdge->second].direct,_graph[posEdge->second].inverse); temp->appendElement(spInfo); } else { //even the shortest path is not valid -> breake generation. break; } currentV = posV->second; } } - if (reachedTarget) result = temp; + if (reachedTarget) { result = temp; +} return result; }; template typename SimpleOntologyCore::TransformationPathPointer SimpleOntologyCore:: generateTransPath(ConstInfSpacePointer movingIS, ConstInfSpacePointer targetIS, DataRepresentation::Type requiredDataSupport, const WeightMapType& weights, const PredecessorMapType& predecessors, const EdgeMapType& edges) { TransformationPathPointer result; TransformationPathPointer temp(new TransformationPathType); bool reachedTarget = false; typename RegistrationGraphType::vertex_descriptor currentV = getVertex(movingIS); typename RegistrationGraphType::vertex_descriptor targetV = getVertex(targetIS); while (!reachedTarget) { - typename PredecessorMapType::const_iterator posV = predecessors.find(currentV); + auto posV = predecessors.find(currentV); assert(posV!=predecessors.end()); if (posV->second == currentV) { if (posV->second == targetV) { reachedTarget = true; } else { //this moving IS has no connection break; } } else { - typename EdgeMapType::const_iterator posEdge = edges.find(currentV); + auto posEdge = edges.find(currentV); assert(posEdge!=edges.end()); - typename WeightMapType::const_iterator posWeigth = weights.find(posEdge->second); + auto posWeigth = weights.find(posEdge->second); if (posWeigth->secondsecond].direct) { temp->appendElement(_graph[posEdge->second].direct); } else { break; //shortest path isn't valid for this data representation } } else { if (_graph[posEdge->second].inverse) { temp->appendElement(_graph[posEdge->second].inverse); } else { break; //shortest path isn't valid for this data representation } } } else { //even the shortest path is not valid -> breake generation. break; } currentV = posV->second; } } - if (reachedTarget) result = temp; + if (reachedTarget) { result = temp; +} return result; }; template typename SimpleOntologyCore::RegPathOptColPointer SimpleOntologyCore:: generateRegCollection(const SimpleSearchMapType& searchResult, ConstInfEntityPointer ie) const { RegPathOptColPointer result(new RegPathOptColType); if (ie) { result->setMovingEntity(ie); } - for (typename SimpleSearchMapType::const_iterator pos = searchResult.begin(); pos != searchResult.end(); ++pos) + for (auto pos = searchResult.begin(); pos != searchResult.end(); ++pos) { typename RegPathOptColType::OptionType::Pointer spOption (new typename RegPathOptColType::OptionType); spOption->setMovingEntity(ie); RegistrationPathPointer spPath(new RegistrationPathType); //must iterate reverse because of inverse graph layout - for (typename SimpleSearchMapType::value_type::const_reverse_iterator posPath = pos->rbegin(); posPath!=pos->rend(); ++posPath) + for (auto posPath = pos->rbegin(); posPath!=pos->rend(); ++posPath) { RegistrationInfoPointer spInfo(new RegistrationInfoType); spInfo->setTransformations(_graph[*posPath].direct,_graph[*posPath].inverse); spPath->appendElement(spInfo); } spOption->setPath(spPath); result->addOption(spOption); } return result; }; template typename SimpleOntologyCore::TransPathOptColPointer SimpleOntologyCore:: generateTransCollection(const SimpleSearchMapType& searchResult, ConstInfEntityPointer ie) const { TransPathOptColPointer result(new TransPathOptColType); DataRepresentationSupport::Type requiredDataSupport = DataRepresentationSupport::Arbitrary; if (ie) { requiredDataSupport = convertToSupport(ie->getDataRepresentation()); result->setMovingEntity(ie); } - for (typename SimpleSearchMapType::const_iterator pos = searchResult.begin(); pos != searchResult.end(); ++pos) + for (auto pos = searchResult.begin(); pos != searchResult.end(); ++pos) { TransformationPathPointer spCPath(new TransformationPathType); TransformationPathPointer spDPath(new TransformationPathType); //must iterate reverse because of inverse graph layout - for (typename SimpleSearchMapType::value_type::const_reverse_iterator posPath = pos->rbegin(); posPath!=pos->rend(); ++posPath) + for (auto posPath = pos->rbegin(); posPath!=pos->rend(); ++posPath) { if (requiredDataSupport != DataRepresentationSupport::Discrete) { spCPath->appendElement(_graph[*posPath].direct); } if (requiredDataSupport != DataRepresentationSupport::Continuous) { spDPath->appendElement(_graph[*posPath].inverse); } } if (requiredDataSupport != DataRepresentationSupport::Discrete) { typename TransPathOptColType::OptionType::Pointer spOption (new typename TransPathOptColType::OptionType()); spOption->setMovingEntity(ie); spOption->setPath(spCPath); result->addOption(spOption); } if (requiredDataSupport != DataRepresentationSupport::Continuous) { typename TransPathOptColType::OptionType::Pointer spOption (new typename TransPathOptColType::OptionType()); spOption->setMovingEntity(ie); spOption->setPath(spDPath); result->addOption(spOption); } } return result; }; template typename SimpleOntologyCore::ConstInfSpaceEntityVectorType SimpleOntologyCore:: generateMapableIS( ConstInfSpacePointer targetIS, const WeightMapType& weights, const PredecessorMapType& predecessors, const EdgeMapType& edges ) { ConstInfSpaceEntityVectorType result; typename RegistrationGraphType::vertex_descriptor targetV = getVertex(targetIS); std::pair range = boost::vertices(_graph); //go through all vertices for (typename RegistrationGraphType::vertex_iterator pos = range.first; pos != range.second; ++pos) { bool reachedTarget = false; typename RegistrationGraphType::vertex_descriptor currentV = *pos; if (currentV != targetV) { //don't check self reference, only other information spaces. while (!reachedTarget) { - typename PredecessorMapType::const_iterator posV = predecessors.find(currentV); + auto posV = predecessors.find(currentV); assert(posV!=predecessors.end()); if (posV->second == currentV) { if (posV->second == targetV) { reachedTarget = true; } else { break; } } else { - typename EdgeMapType::const_iterator posEdge = edges.find(currentV); + auto posEdge = edges.find(currentV); assert(posEdge!=edges.end()); - typename WeightMapType::const_iterator posWeigth = weights.find(posEdge->second); + auto posWeigth = weights.find(posEdge->second); if (posWeigth->second>=fatalPenaltyCost) { //even the shortest path is not valid -> breake generation. break; } currentV = posV->second; } } } - if (reachedTarget) result.push_back(_graph[*pos].infSpace); + if (reachedTarget) { result.push_back(_graph[*pos].infSpace); +} } return result; } template void SimpleOntologyCore:: updateEntity2CorrelationMap(ConstCorrelationPointer corr) { typedef std::pair PairType; //1st remove all old look ups for this correlation - typename EntityCorrelationMapType::iterator pos = _entity2CorrelationMap.begin(); + auto pos = _entity2CorrelationMap.begin(); while (pos!= _entity2CorrelationMap.end()) { if (pos->second == corr->getUID()) { pos = _entity2CorrelationMap.erase(pos); } else { ++pos; } } //2nd add current relations - for (typename CorrelationType::ConstEntityIterator relatedPos = corr->getCorrelatedEntitiesBegin(); relatedPos!=corr->getCorrelatedEntitiesEnd(); ++relatedPos) + for (auto relatedPos = corr->getCorrelatedEntitiesBegin(); relatedPos!=corr->getCorrelatedEntitiesEnd(); ++relatedPos) { _entity2CorrelationMap.insert(std::make_pair((*relatedPos)->getUID(),corr->getUID())); } }; template void SimpleOntologyCore:: removeEntityFromCorrelations(const InfEntityUIDType& entity) { typedef std::pair PairType; PairType sourceFindings = _entity2CorrelationMap.equal_range(entity); //got through all source entity correlations - for (typename EntityCorrelationMapType::iterator pos = sourceFindings.first; pos!= sourceFindings.second; ++pos) + for (auto pos = sourceFindings.first; pos!= sourceFindings.second; ++pos) { - typename CorrelationMapType::iterator posCorr = _correlationMap.find(pos->second); + auto posCorr = _correlationMap.find(pos->second); if (posCorr != _correlationMap.end()) { - typename CorrelationType::EntityIterator relatedPos = posCorr->second->getCorrelatedEntitiesBegin(); + auto relatedPos = posCorr->second->getCorrelatedEntitiesBegin(); while(relatedPos!=posCorr->second->getCorrelatedEntitiesEnd()) { if ((*relatedPos)->getUID()==entity) { relatedPos = posCorr->second->removeCorrelatedEntity(relatedPos); } else { ++relatedPos; } } } } }; template void SimpleOntologyCore:: actualizeEntityInCorrelations(const InfEntityUIDType& entity) { typename EntityMapType::const_iterator entityPos = _entityMap.find(entity); if (entityPos==_entityMap.end()) throw exceptions::InvalidArgument("Cannot actualize entity. It does not exist"); typedef std::pair PairType; PairType sourceFindings = _entity2CorrelationMap.equal_range(entity); //got through all source entity correlations for (typename EntityCorrelationMapType::iterator pos = sourceFindings.first; pos!= sourceFindings.second; ++pos) { typename CorrelationMapType::iterator posCorr = _correlationMap.find(pos->second); if (posCorr != _correlationMap.end()) { typename CorrelationType::EntityIterator relatedPos = posCorr->second->findCorrelatedEntity(entity); if (relatedPos!=posCorr->second->getCorrelatedEntitiesEnd()) { *relatedPos == entityPos->second; } } } }; template bool SimpleOntologyCore:: validateForCommit(CorrelationPointer corr) { bool result = true; - for(typename CorrelationType::EntityIterator relatedPos = corr->getCorrelatedEntitiesBegin(); relatedPos!=corr->getCorrelatedEntitiesEnd(); ++relatedPos) + for(auto relatedPos = corr->getCorrelatedEntitiesBegin(); relatedPos!=corr->getCorrelatedEntitiesEnd(); ++relatedPos) { typename EntityMapType::const_iterator entityPos = _entityMap.find((*relatedPos)->getUID()); if (entityPos==_entityMap.end()) { result = false; break; } *relatedPos = entityPos->second; }; return result; }; template typename SimpleOntologyCore::ConstEntityMapType SimpleOntologyCore:: getEntitiesByCorrelations(const ConstCorrelationMapType& correlations, const EntityUIDSetType& entities, bool excludeEntities) { ConstEntityMapType result; //got through all correlations - for (typename ConstCorrelationMapType::const_iterator pos = correlations.begin(); pos!= correlations.end(); ++pos) + for (auto pos = correlations.begin(); pos!= correlations.end(); ++pos) { //go through there entities - for (typename CorrelationType::ConstEntityIterator relatedPos = pos->second->getCorrelatedEntitiesBegin(); relatedPos!=pos->second->getCorrelatedEntitiesEnd(); ++relatedPos) + for (auto relatedPos = pos->second->getCorrelatedEntitiesBegin(); relatedPos!=pos->second->getCorrelatedEntitiesEnd(); ++relatedPos) { if ((entities.find((*relatedPos)->getUID())!=entities.end()) != excludeEntities) { // the entity exists in the passed list and but its include mode or it is not in the list and it is exclude mode // -> transfer entity result[(*relatedPos)->getUID()] = *relatedPos; } } } return result; }; template void SimpleOntologyCore:: getProblemModels(ConstModelMapType& models, const ProblemStatementUIDType& ps) const { typedef std::pair PairType; PairType sourceFindings = _stat2ModelMap.equal_range(ps); //got through all source entity correlations - for (typename StatementModelMapType::const_iterator sourcePos = sourceFindings.first; sourcePos!= sourceFindings.second; ++sourcePos) + for (auto sourcePos = sourceFindings.first; sourcePos!= sourceFindings.second; ++sourcePos) { - typename ModelMapType::const_iterator posModel = _modelMap.find(sourcePos->second); + auto posModel = _modelMap.find(sourcePos->second); if (posModel != _modelMap.end()) { models[posModel->second->getUID()] = posModel->second; } } }; template void SimpleOntologyCore:: updateStatement2ModelMap(ConstProblemModelPointer pModell) { typedef std::pair PairType; //1st remove all old look ups for this correlation - typename StatementModelMapType::iterator pos = _stat2ModelMap.begin(); + auto pos = _stat2ModelMap.begin(); while (pos!= _stat2ModelMap.end()) { if (pos->second == pModell->getUID()) { pos = _stat2ModelMap.erase(pos); } else { ++pos; } } //2nd add current relations - for (typename ProblemModelType::ConstProblemIterator relatedPos = pModell->getStatementBegin(); relatedPos!=pModell->getStatementEnd(); ++relatedPos) + for (auto relatedPos = pModell->getStatementBegin(); relatedPos!=pModell->getStatementEnd(); ++relatedPos) { _stat2ModelMap.insert(std::make_pair((*relatedPos)->getUID(),pModell->getUID())); } }; template void SimpleOntologyCore:: removeStatementFromModels(const ProblemStatementUIDType& stat) { typedef std::pair PairType; PairType sourceFindings = _stat2ModelMap.equal_range(stat); //got through all source entity correlations - for (typename StatementModelMapType::iterator pos = sourceFindings.first; pos!= sourceFindings.second; ++pos) + for (auto pos = sourceFindings.first; pos!= sourceFindings.second; ++pos) { - typename ModelMapType::iterator posModel = _modelMap.find(pos->second); + auto posModel = _modelMap.find(pos->second); if (posModel != _modelMap.end()) { - typename ProblemModelType::ProblemIterator relatedPos = posModel->second->getStatementBegin(); + auto relatedPos = posModel->second->getStatementBegin(); while(relatedPos!=posModel->second->getStatementEnd()) { if ((*relatedPos)->getUID()==stat) { relatedPos = posModel->second->removeStatement(relatedPos); } else { ++relatedPos; } } } } }; template void SimpleOntologyCore:: actualizeStatementInModels(const ProblemStatementUIDType& stat) { typename StatementMapType::const_iterator statPos = _statementMap.find(stat); if (statPos==_statementMap.end()) throw exceptions::InvalidArgument("Cannot actualize statement. It is not defined in the ontology."); typedef std::pair PairType; PairType sourceFindings = _stat2ModelMap.equal_range(stat); //got through all source entity correlations for (typename StatementModelMapType::iterator pos = sourceFindings.first; pos!= sourceFindings.second; ++pos) { typename ModelMapType::iterator posModel = _modelMap.find(pos->second); if (posModel != _modelMap.end()) { typename ProblemModelType::ProblemIterator relatedPos = posModel->second->findStatement(stat); if (relatedPos!=posModel->second->getStatementEnd()) { *relatedPos == statPos->second; } } } }; template bool SimpleOntologyCore:: validateForCommit(ProblemModelPointer model) { bool result = true; - for(typename ProblemModelType::ProblemIterator relatedPos = model->getStatementBegin(); relatedPos!=model->getStatementEnd(); ++relatedPos) + for(auto relatedPos = model->getStatementBegin(); relatedPos!=model->getStatementEnd(); ++relatedPos) { typename StatementMapType::const_iterator statPos = _statementMap.find((*relatedPos)->getUID()); if (statPos==_statementMap.end()) { result = false; break; } *relatedPos = statPos->second; }; return result; }; template void SimpleOntologyCore:: spliteEntitiesByData(const ConstInfEntityVectorType& movingEntities, ConstInfEntityVectorType& continuousEntities, ConstInfEntityVectorType& discreteEntities) { continuousEntities.clear(); discreteEntities.clear(); - for (typename ConstInfEntityVectorType::const_iterator pos = movingEntities.begin(); pos != movingEntities.end(); ++pos) + for (auto pos = movingEntities.begin(); pos != movingEntities.end(); ++pos) { if ((*pos)->getDataRepresentation()==DataRepresentation::Continuous) { continuousEntities.push_back(*pos); } else { discreteEntities.push_back(*pos); } } }; template MappingError::Type SimpleOntologyCore::checkOptionCollectionSupport(ConstRegPathOptColPointer col, DataRepresentationSupport::Type requiredDataSupport) const { MappingError::Type result = MappingError::NoFailure; if (col->getOptionCount()>0) { MappingError::Type cResult = MappingError::NoFailure; MappingError::Type dResult = MappingError::NoFailure; using PolicyType = typename TOATraits::RegPathOptionTraitsType::Type::PathCheckPolicy; if (requiredDataSupport!=DataRepresentationSupport::Discrete) { InfEntityPointer spDummy(new InfEntityType()); spDummy->setDataRepresentation(DataRepresentation::Continuous); - for (typename RegPathOptColType::ConstOptionIterator pos = col->getBegin(); pos != col->getEnd(); ++pos) + for (auto pos = col->getBegin(); pos != col->getEnd(); ++pos) { MappingError::Type temp = PolicyType::checkForFailureReason((*pos)->getPath(),spDummy); if (temp>cResult) { cResult = temp; } } } if (requiredDataSupport!=DataRepresentationSupport::Continuous) { InfEntityPointer spDummy(new InfEntityType()); spDummy->setDataRepresentation(DataRepresentation::Discrete); - for (typename RegPathOptColType::ConstOptionIterator pos = col->getBegin(); pos != col->getEnd(); ++pos) + for (auto pos = col->getBegin(); pos != col->getEnd(); ++pos) { MappingError::Type temp = PolicyType::checkForFailureReason((*pos)->getPath(),spDummy); if (temp>dResult) { dResult = temp; } } } if (requiredDataSupport == DataRepresentationSupport::Continuous) { result = cResult; } else if (requiredDataSupport == DataRepresentationSupport::Discrete) { result = dResult; } else if (requiredDataSupport == DataRepresentationSupport::All) { result = (cResult void simplePathSearchStep(::std::vector< ::std::vector< TEdgeDescriptor> >& result, const TGraph& graph, TVertexDescriptor currentIS, TVertexDescriptor searchedIS, DataRepresentationSupport::Type dataRep, const TProblemCompliance* pProblemCompliance, ::std::vector& currentPath, ::std::map& colorMap, TEdgeValidator& validator, bool cTrail, bool dTrail) { if (searchedIS == currentIS) { //match -> current path is a valid result, so transfere it, and back in stack result.push_back(currentPath); } else { //normal search colorMap[currentIS] = SearchColor::Gray; - typedef typename TGraph::out_edge_iterator EdgeIterator; + using EdgeIterator = typename TGraph::out_edge_iterator; std::pair edgeRange = ::boost::out_edges(currentIS, graph); for (EdgeIterator pos = edgeRange.first; pos != edgeRange.second; ++pos) { TVertexDescriptor nextIS = ::boost::target(*pos,graph); if (colorMap[nextIS]== SearchColor::White) { //not touched in the current path search, thus go this way bool currentCTrail = cTrail; bool currentDTrail = dTrail; //check if the edge is valid if (validator.isValid(*pos, graph, dataRep, pProblemCompliance, currentCTrail, currentDTrail)) { currentPath.push_back(*pos); simplePathSearchStep(result,graph,nextIS,searchedIS,dataRep,pProblemCompliance,currentPath,colorMap,validator, currentCTrail, currentDTrail); currentPath.pop_back(); } } } colorMap[currentIS] = SearchColor::White; } }; /**Helper function that searches for an registration path represented by a boost graph. The strategy used is that the function searches for the shortest paths that a) support the needed data representation and b) have problem compliance (if a ProblemCompliance instance was passed). To validate the edge and check the requirements the passed edge validator "validator" is used.*/ template void simplePathSearch(::std::vector< ::std::vector< TEdgeDescriptor> >& result, const TGraph& graph, TVertexDescriptor startIS, TVertexDescriptor searchedIS, DataRepresentationSupport::Type dataRep, const TProblemCompliance* pProblemCompliance, TEdgeValidator validator) { ::std::vector currentPath; ::std::map colorMap; ::std::pair range = ::boost::vertices(graph); bool currentCTrail = true; bool currentDTrail = true; for (typename TGraph::vertex_iterator pos = range.first; pos!=range.second; ++pos) { colorMap[*pos] = SearchColor::White; } simplePathSearchStep(result,graph,startIS,searchedIS,dataRep,pProblemCompliance,currentPath,colorMap,validator,currentCTrail,currentDTrail); } } // end namespace core } // end namespace iro #endif diff --git a/Code/Ontology/Simple/include/mapSimpleProblemStatement.h b/Code/Ontology/Simple/include/mapSimpleProblemStatement.h index cbeb73e..b9890a7 100644 --- a/Code/Ontology/Simple/include/mapSimpleProblemStatement.h +++ b/Code/Ontology/Simple/include/mapSimpleProblemStatement.h @@ -1,42 +1,42 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_SIMPLE_PROBLEM_STATEMENT_H #define __MAP_SIMPLE_PROBLEM_STATEMENT_H #include "mapProblemStatementBase.h" #include "mapProblemStatementTraits.h" #include "mapBoostUIDPolicy.h" namespace iro { namespace scenario { /*! @class SimpleProblemStatement * @brief Simple definition for problem statements. * @ingroup Simple */ - typedef ProblemStatementBase SimpleProblemStatement; + using SimpleProblemStatement = ProblemStatementBase; using SimpleProblemStatementTraits = ProblemStatementTraits; } // end namespace scenario } // end namespace iro #endif diff --git a/Code/Ontology/Simple/include/mapSimpleRegPathCheckPolicy.h b/Code/Ontology/Simple/include/mapSimpleRegPathCheckPolicy.h index eddbef6..b31649e 100644 --- a/Code/Ontology/Simple/include/mapSimpleRegPathCheckPolicy.h +++ b/Code/Ontology/Simple/include/mapSimpleRegPathCheckPolicy.h @@ -1,49 +1,49 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_SIMPLE_REG_PATH_CHECK_POLICY_H #define __MAP_SIMPLE_REG_PATH_CHECK_POLICY_H #include "mapMappingError.h" namespace iro { /*! @class SimpleRegPathCheckPolicy * * */ template struct SimpleRegPathCheckPolicy { - typedef typename TPathTraits::Type PathType; - typedef typename TPathTraits::InformationEntityTraitsType::Type EntityType; - typedef typename TPathTraits::ConstPointer ConstPathPointer; - typedef typename TPathTraits::InformationEntityTraitsType::ConstPointer ConstEntityPointer; + using PathType = typename TPathTraits::Type; + using EntityType = typename TPathTraits::InformationEntityTraitsType::Type; + using ConstPathPointer = typename TPathTraits::ConstPointer; + using ConstEntityPointer = typename TPathTraits::InformationEntityTraitsType::ConstPointer; static bool checkPathSupportOfEntity(ConstPathPointer path, ConstEntityPointer entity); static MappingError::Type checkForFailureReason(ConstPathPointer path, ConstEntityPointer entity); }; } // end namespace iro #ifndef MatchPoint_MANUAL_TPP #include "mapSimpleRegPathCheckPolicy.tpp" #endif #endif diff --git a/Code/Ontology/Simple/include/mapSimpleRegPathCheckPolicy.tpp b/Code/Ontology/Simple/include/mapSimpleRegPathCheckPolicy.tpp index 85b8a76..a4b5365 100644 --- a/Code/Ontology/Simple/include/mapSimpleRegPathCheckPolicy.tpp +++ b/Code/Ontology/Simple/include/mapSimpleRegPathCheckPolicy.tpp @@ -1,70 +1,70 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_SIMPLE_REG_PATH_CHECK_POLICY_TPP #define __MAP_SIMPLE_REG_PATH_CHECK_POLICY_TPP #include "mapFOVScope.h" #include "mapSimpleRegPathCheckPolicy.h" namespace iro { template bool SimpleRegPathCheckPolicy:: checkPathSupportOfEntity(ConstPathPointer path, ConstEntityPointer entity) { return checkForFailureReason(path,entity) == MappingError::NoFailure; }; template MappingError::Type SimpleRegPathCheckPolicy:: checkForFailureReason(ConstPathPointer path, ConstEntityPointer entity) { MappingError::Type result = MappingError::NoFailure; - for (typename PathType::ConstPathElementIterator pos = path->getBegin(); pos!=path->getEnd(); ++pos) + for (auto pos = path->getBegin(); pos!=path->getEnd(); ++pos) { typename TPathTraits::TransformationInfoTraitsType::ConstPointer relevantInfo = (*pos)->getContinuousTransformation(); if (entity->getDataRepresentation()==DataRepresentation::Discrete) { relevantInfo = (*pos)->getDiscreteTransformation(); } if (!relevantInfo) { result = MappingError::NoDataSupport; break; } - else - { + + if (relevantInfo->getFOVScope()!=FOVScope::Global) { result = MappingError::NoMappingGuarantee; } - } + } return result; }; } // end namespace iro #endif diff --git a/Code/Ontology/Simple/include/mapSimpleTransPathCheckPolicy.h b/Code/Ontology/Simple/include/mapSimpleTransPathCheckPolicy.h index af79c96..a8a07c3 100644 --- a/Code/Ontology/Simple/include/mapSimpleTransPathCheckPolicy.h +++ b/Code/Ontology/Simple/include/mapSimpleTransPathCheckPolicy.h @@ -1,49 +1,49 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_SIMPLE_TRANS_PATH_CHECK_POLICY_H #define __MAP_SIMPLE_TRANS_PATH_CHECK_POLICY_H #include "mapMappingError.h" namespace iro { /*! @class SimpleTransPathCheckPolicy * * */ template struct SimpleTransPathCheckPolicy { - typedef typename TPathTraits::Type PathType; - typedef typename TPathTraits::InformationEntityTraitsType::Type EntityType; - typedef typename TPathTraits::ConstPointer ConstPathPointer; - typedef typename TPathTraits::InformationEntityTraitsType::ConstPointer ConstEntityPointer; + using PathType = typename TPathTraits::Type; + using EntityType = typename TPathTraits::InformationEntityTraitsType::Type; + using ConstPathPointer = typename TPathTraits::ConstPointer; + using ConstEntityPointer = typename TPathTraits::InformationEntityTraitsType::ConstPointer; static bool checkPathSupportOfEntity(ConstPathPointer path, ConstEntityPointer entity); static MappingError::Type checkForFailureReason(ConstPathPointer path, ConstEntityPointer entity); }; } // end namespace iro #ifndef MatchPoint_MANUAL_TPP #include "mapSimpleTransPathCheckPolicy.tpp" #endif #endif diff --git a/Code/Ontology/Simple/include/mapSimpleTransPathCheckPolicy.tpp b/Code/Ontology/Simple/include/mapSimpleTransPathCheckPolicy.tpp index d37d269..f917686 100644 --- a/Code/Ontology/Simple/include/mapSimpleTransPathCheckPolicy.tpp +++ b/Code/Ontology/Simple/include/mapSimpleTransPathCheckPolicy.tpp @@ -1,63 +1,63 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_SIMPLE_TRANS_PATH_CHECK_POLICY_TPP #define __MAP_SIMPLE_TRANS_PATH_CHECK_POLICY_TPP #include "mapSimpleTransPathCheckPolicy.h" namespace iro { template bool SimpleTransPathCheckPolicy:: checkPathSupportOfEntity(ConstPathPointer path, ConstEntityPointer entity) { return checkForFailureReason(path,entity) == MappingError::NoFailure; }; template MappingError::Type SimpleTransPathCheckPolicy:: checkForFailureReason(ConstPathPointer path, ConstEntityPointer entity) { MappingError::Type result = MappingError::NoFailure; - for (typename PathType::ConstPathElementIterator pos = path->getBegin(); pos!=path->getEnd(); ++pos) + for (auto pos = path->getBegin(); pos!=path->getEnd(); ++pos) { if ((*pos)->getSupportedDataRepresentation()!=entity->getDataRepresentation()) { result = MappingError::NoDataSupport; break; } - else - { + + if ((*pos)->getFOVScope()!=FOVScope::Global) { result = MappingError::NoMappingGuarantee; } - } + } return result; }; } // end namespace iro #endif diff --git a/Code/Ontology/Simple/include/mapSimpleTransformationInfo.h b/Code/Ontology/Simple/include/mapSimpleTransformationInfo.h index ffac34f..34b2676 100644 --- a/Code/Ontology/Simple/include/mapSimpleTransformationInfo.h +++ b/Code/Ontology/Simple/include/mapSimpleTransformationInfo.h @@ -1,134 +1,134 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_SIMPLE_TRANSFORMATION_INFO_H #define __MAP_SIMPLE_TRANSFORMATION_INFO_H #include "mapIInformationSpaceConnector.h" #include "mapIProblemStatementAssociated.h" #include "mapSimpleInformationSpace.h" #include "mapSimpleInformationEntity.h" #include "mapSimpleProblemStatement.h" #include "mapDataRepresentation.h" #include "mapFOVScope.h" #include "mapAlgorithmExecutionInfo.h" #include "mapTransformationInfoTraits.h" #include #include "mapMAPOntologySimpleExports.h" namespace iro { namespace scenario { /*! @class SimpleTransformationInfo * @brief Simple specific implementation for transformation infos. * @ingroup Simple */ class MAPOntologySimple_EXPORT SimpleTransformationInfo : public IInformationSpaceConnector< SimpleInformationSpaceTraits >, public IProblemStatementAssociated< SimpleProblemStatementTraits > { public: - typedef SimpleTransformationInfo Self; - typedef ::std::shared_ptr Pointer; - typedef ::std::shared_ptr ConstPointer; + using Self = SimpleTransformationInfo; + using Pointer = ::std::shared_ptr; + using ConstPointer = ::std::shared_ptr; - typedef IInformationSpaceConnector< SimpleInformationSpaceTraits > ConnectorInterface; - typedef ConnectorInterface::ConstISPointer ConstISPointer; + using ConnectorInterface = IInformationSpaceConnector; + using ConstISPointer = ConnectorInterface::ConstISPointer; - typedef IProblemStatementAssociated< SimpleProblemStatementTraits > ProblemAssociatedInterface; - typedef ProblemAssociatedInterface::ProblemComplianceInterface ProblemComplianceInterface; - typedef ProblemAssociatedInterface::ConstProblemPointer ConstProblemPointer; + using ProblemAssociatedInterface = IProblemStatementAssociated; + using ProblemComplianceInterface = ProblemAssociatedInterface::ProblemComplianceInterface; + using ConstProblemPointer = ProblemAssociatedInterface::ConstProblemPointer; - typedef DataRepresentation::Type DataRepresentationType; - typedef FOVScope::Type FOVScopeType; - typedef ::iro::String UIDType; + using DataRepresentationType = DataRepresentation::Type; + using FOVScopeType = FOVScope::Type; + using UIDType = ::iro::String; typedef AlgorithmExecutionInfo< SimpleInformationSpaceTraits, SimpleInformationEntityTraits > ExecutionInfoType; /*! Implementation of abstract member. See documentation in interface. * @see IInformationSpaceConnector*/ - virtual ConstISPointer getMovingIS() const override; + ConstISPointer getMovingIS() const override; /*! Sets the moving information space */ void setMovingIS(ConstISPointer movingIS); /*! Implementation of abstract member. See documentation in interface. * @see IInformationSpaceConnector*/ - virtual ConstISPointer getTargetIS() const override; + ConstISPointer getTargetIS() const override; /*! Sets the target information space */ void setTargetIS(ConstISPointer targetIS); /** Returns the const pointer to the associated problem statement. * Pointer may be null, if no statement is defined.*/ - virtual ConstProblemPointer getAssociatedProblemStatement() const override; + ConstProblemPointer getAssociatedProblemStatement() const override; /*! Sets the associated problem statement */ void setAssociatedProblemStatement(ConstProblemPointer problem); DataRepresentationType getSupportedDataRepresentation() const; void setSupportedDataRepresentation(DataRepresentationType dr); const UIDType& getUID() const; void setUID(const UIDType& uid); FOVScopeType getFOVScope() const; void setFOVScope(FOVScopeType scope); - virtual ~SimpleTransformationInfo(); + ~SimpleTransformationInfo() override; SimpleTransformationInfo(); ExecutionInfoType::ConstPointer getAlgorithmExecutionInfo() const; void setAlgorithmExecutionInfo(ExecutionInfoType::Pointer execInfo); /* Clones the content of the info and returns it as * non const pointer. It can be used to alter the transformation info and * update the knowledge base of the ontology. */ Pointer clone() const; protected: /*! Implementation of abstract member. This implementation checks the associated * problem statement for compliance. See also documentation in interface. * @see IProblemComplianceChecker*/ - virtual bool doCheckProblemCompliance(const ProblemComplianceInterface* pProblemCompliance) const override; + bool doCheckProblemCompliance(const ProblemComplianceInterface* pProblemCompliance) const override; ConstISPointer _movingIS; ConstISPointer _targetIS; ConstProblemPointer _associatedProblem; - DataRepresentationType _dataRepresentation; + DataRepresentationType _dataRepresentation{::iro::DataRepresentation::Discrete}; - FOVScopeType _scope; + FOVScopeType _scope{::iro::FOVScope::Local}; UIDType _uid; ExecutionInfoType::Pointer _execInfo; private: SimpleTransformationInfo(const Self&); //not implemented by purpose Self& operator=(const Self&); //not implemented by purpose }; using SimpleTransformationInfoTraits = TransformationInfoTraits; } // end namespace scenario } // end namespace iro #endif diff --git a/Code/Ontology/Simple/source/mapSimpleDemoInstancer.cpp b/Code/Ontology/Simple/source/mapSimpleDemoInstancer.cpp index a33ee3e..d9fee11 100644 --- a/Code/Ontology/Simple/source/mapSimpleDemoInstancer.cpp +++ b/Code/Ontology/Simple/source/mapSimpleDemoInstancer.cpp @@ -1,277 +1,277 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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. // //------------------------------------------------------------------------ #include "mapSimpleDemoInstancer.h" -#include +#include namespace iro { namespace scenario { ::iro::scenario::SimpleInformationSpace::Pointer generateIS(const String& id) { ::iro::scenario::SimpleInformationSpace::Pointer spIS(new ::iro::scenario::SimpleInformationSpace); spIS->setUID(id); return spIS; }; ::iro::scenario::SimpleInformationEntity::Pointer generateEntity(const String& id, ::iro::scenario::SimpleTransformationInfo::DataRepresentationType dataRep = ::iro::DataRepresentation::Discrete) { ::iro::scenario::SimpleInformationEntity::Pointer spEntity(new ::iro::scenario::SimpleInformationEntity); spEntity->setUID(id); spEntity->setDataRepresentation(dataRep); return spEntity; }; ::iro::scenario::SimpleSemanticCorrelation::Pointer generateCorrelation(const std::list<::iro::scenario::SimpleInformationEntity::ConstPointer>& relatedEntities) { ::iro::scenario::SimpleSemanticCorrelation::Pointer spCorr(new ::iro::scenario::SimpleSemanticCorrelation); for (std::list<::iro::scenario::SimpleInformationEntity::ConstPointer>::const_iterator pos = relatedEntities.begin(); pos!=relatedEntities.end(); ++pos) { spCorr->addCorrelatedEntity(*pos); } return spCorr; }; ::iro::scenario::SimpleTransformationInfo::Pointer generateTransInfo(const ::iro::String& id, ::iro::scenario::SimpleInformationSpace::ConstPointer movingIS, ::iro::scenario::SimpleInformationSpace::ConstPointer targetIS,::iro::scenario::SimpleProblemStatement::Pointer statement, ::iro::scenario::SimpleTransformationInfo::DataRepresentationType dataRep) { ::iro::scenario::SimpleTransformationInfo::Pointer spInfo(new ::iro::scenario::SimpleTransformationInfo); spInfo->setUID(id); spInfo->setMovingIS(movingIS); spInfo->setTargetIS(targetIS); spInfo->setAssociatedProblemStatement(statement); spInfo->setSupportedDataRepresentation(dataRep); return spInfo; }; ::iro::scenario::SimpleProblemStatement::Pointer generateStatement(const String& name) { ::iro::scenario::SimpleProblemStatement::Pointer spStat(new ::iro::scenario::SimpleProblemStatement); spStat->setName(name); return spStat; }; ::iro::scenario::SimpleProblemModel::Pointer generateModel(const String& name) { ::iro::scenario::SimpleProblemModel::Pointer spModel(new ::iro::scenario::SimpleProblemModel); spModel->setName(name); return spModel; }; struct OntologyFixture { //entities ::iro::scenario::SimpleInformationEntity::Pointer spIE1; ::iro::scenario::SimpleInformationEntity::Pointer spIE2; ::iro::scenario::SimpleInformationEntity::Pointer spIE3; ::iro::scenario::SimpleInformationEntity::Pointer spIE4; ::iro::scenario::SimpleInformationEntity::Pointer spIE5; ::iro::scenario::SimpleInformationEntity::Pointer spIE6; ::iro::scenario::SimpleInformationEntity::Pointer spIE7; ::iro::scenario::SimpleInformationEntity::Pointer spIE8; //Information spaces ::iro::scenario::SimpleInformationSpace::Pointer spIS1; ::iro::scenario::SimpleInformationSpace::Pointer spIS2; ::iro::scenario::SimpleInformationSpace::Pointer spIS3; ::iro::scenario::SimpleInformationSpace::Pointer spIS4; ::iro::scenario::SimpleInformationSpace::Pointer spIS5; //Problem statements ::iro::scenario::SimpleProblemStatement::Pointer spPS1; ::iro::scenario::SimpleProblemStatement::Pointer spPS2; ::iro::scenario::SimpleProblemStatement::Pointer spPS3; ::iro::scenario::SimpleProblemStatement::Pointer spPS4; ::iro::scenario::SimpleProblemStatement::Pointer spPS5; ::iro::scenario::SimpleProblemStatement::Pointer spPS6; //Problem models ::iro::scenario::SimpleProblemModel::Pointer spPM1; ::iro::scenario::SimpleProblemModel::Pointer spPM2; ::iro::scenario::SimpleProblemModel::Pointer spPM3; ::iro::scenario::SimpleProblemModel::Pointer spPM4; //correlations ::iro::scenario::SimpleSemanticCorrelation::Pointer spCor1; ::iro::scenario::SimpleSemanticCorrelation::Pointer spCor2; ::iro::scenario::SimpleSemanticCorrelation::Pointer spCor3; //transformations ::iro::scenario::SimpleTransformationInfo::Pointer spTrans1_2; ::iro::scenario::SimpleTransformationInfo::Pointer spTrans2_3; ::iro::scenario::SimpleTransformationInfo::Pointer spTrans3_4; ::iro::scenario::SimpleTransformationInfo::Pointer spTrans4_3; ::iro::scenario::SimpleTransformationInfo::Pointer spTrans1_2d; ::iro::scenario::SimpleTransformationInfo::Pointer spTrans3_4d; ::iro::scenario::SimpleTransformationInfo::Pointer spTrans1_3d; ::iro::scenario::SimpleTransformationInfo::Pointer spTrans2_5; ::iro::scenario::SimpleTransformationInfo::Pointer spTrans2_5d; ::iro::scenario::SimpleTransformationInfo::Pointer spTrans5_3; ::iro::scenario::SimpleTransformationInfo::Pointer spTrans5_3d; OntologyFixture(); }; OntologyFixture:: OntologyFixture() { //entities spIE1 = generateEntity("e1"); spIE2 = generateEntity("e2"); spIE3 = generateEntity("e3"); spIE4 = generateEntity("e4"); spIE5 = generateEntity("e5"); spIE6 = generateEntity("e6"); spIE7 = generateEntity("e7"); spIE8 = generateEntity("e8",DataRepresentation::Continuous); //Information spaces spIS1 = generateIS("IS 1"); spIS2 = generateIS("IS 2"); spIS3 = generateIS("IS 3"); spIS4 = generateIS("IS 4"); spIS5 = generateIS("IS 5"); //Problem statements spPS1 = generateStatement("PS 1"); spPS2 = generateStatement("PS 2"); spPS3 = generateStatement("PS 3"); spPS4 = generateStatement("PS 4"); spPS5 = generateStatement("PS 5"); spPS6 = generateStatement("PS 6"); //Problem models spPM1 = generateModel("PM 1"); spPM1->addStatement(spPS1); spPM1->addStatement(spPS2); spPM2 = generateModel("PM 2"); spPM2->addStatement(spPS1); spPM2->addStatement(spPS3); spPM2->addStatement(spPS4); spPM3 = generateModel("PM 3"); spPM3->addStatement(spPS5); spPM4 = generateModel("PM 4"); //correlations - typedef std::list<::iro::scenario::SimpleInformationEntity::ConstPointer> IEListType; + using IEListType = std::list<::iro::scenario::SimpleInformationEntity::ConstPointer>; IEListType ieList1; ieList1.push_back(spIE1); ieList1.push_back(spIE2); ieList1.push_back(spIE3); ieList1.push_back(spIE5); IEListType ieList2; ieList2.push_back(spIE3); ieList2.push_back(spIE4); ieList2.push_back(spIE5); IEListType ieList3; ieList3.push_back(spIE2); ieList3.push_back(spIE7); spCor1 = generateCorrelation(ieList1); spCor2 = generateCorrelation(ieList2); spCor3 = generateCorrelation(ieList3); //transformations spTrans1_2 = generateTransInfo("1->2",spIS1,spIS2,spPS1, ::iro::DataRepresentation::Continuous); spTrans2_3 = generateTransInfo("2->3",spIS2,spIS3,spPS3, ::iro::DataRepresentation::Continuous); spTrans3_4 = generateTransInfo("3->4",spIS3,spIS4,spPS4, ::iro::DataRepresentation::Continuous); spTrans4_3 = generateTransInfo("4->3",spIS4,spIS3,spPS2, ::iro::DataRepresentation::Continuous); spTrans1_2d = generateTransInfo("1->d2",spIS1,spIS2,spPS1, ::iro::DataRepresentation::Discrete); spTrans3_4d = generateTransInfo("3->d4",spIS3,spIS4,spPS4, ::iro::DataRepresentation::Discrete); spTrans1_3d = generateTransInfo("1->d3",spIS1,spIS3,spPS3, ::iro::DataRepresentation::Discrete); spTrans2_5 = generateTransInfo("2->5",spIS2,spIS5,spPS2, ::iro::DataRepresentation::Continuous); spTrans2_5d = generateTransInfo("2->d5",spIS2,spIS5,spPS2, ::iro::DataRepresentation::Discrete); spTrans5_3 = generateTransInfo("5->3",spIS5,spIS3,spPS1, ::iro::DataRepresentation::Continuous); spTrans5_3d = generateTransInfo("5->d3",spIS5,spIS3,spPS1, ::iro::DataRepresentation::Discrete); spTrans3_4->setFOVScope(::iro::FOVScope::Global); spTrans3_4d->setFOVScope(::iro::FOVScope::Global); spTrans1_3d->setFOVScope(::iro::FOVScope::Global); }; void setupSimpleDemoOntoloty(SimpleOntology::Pointer ontology) { OntologyFixture fixture; ontology->reset(); ontology->defineInformationSpace(fixture.spIS1); ontology->defineInformationSpace(fixture.spIS2); ontology->defineInformationSpace(fixture.spIS3); ontology->defineInformationSpace(fixture.spIS4); ontology->defineInformationSpace(fixture.spIS5); ontology->defineEntity(fixture.spIE1, fixture.spIS1); ontology->defineEntity(fixture.spIE2, fixture.spIS2); ontology->defineEntity(fixture.spIE3, fixture.spIS3); ontology->defineEntity(fixture.spIE4, fixture.spIS1); ontology->defineEntity(fixture.spIE5, fixture.spIS2); ontology->defineEntity(fixture.spIE6, fixture.spIS4); ontology->defineEntity(fixture.spIE7, fixture.spIS3); ontology->defineEntity(fixture.spIE8, fixture.spIS2); ontology->defineSemanticCorrelation(fixture.spCor1); ontology->defineSemanticCorrelation(fixture.spCor2); ontology->defineSemanticCorrelation(fixture.spCor3); ontology->defineProblemStatement(fixture.spPS1); ontology->defineProblemStatement(fixture.spPS2); ontology->defineProblemStatement(fixture.spPS3); ontology->defineProblemStatement(fixture.spPS4); ontology->defineProblemStatement(fixture.spPS5); ontology->defineProblemStatement(fixture.spPS6); ontology->defineProblemModel(fixture.spPM1); ontology->defineProblemModel(fixture.spPM2); ontology->defineProblemModel(fixture.spPM3); ontology->defineProblemModel(fixture.spPM4); ontology->defineTransformation(fixture.spTrans1_2); ontology->defineTransformation(fixture.spTrans2_3); ontology->defineTransformation(fixture.spTrans3_4); ontology->defineTransformation(fixture.spTrans4_3); ontology->defineTransformation(fixture.spTrans1_2d); ontology->defineTransformation(fixture.spTrans3_4d); ontology->defineTransformation(fixture.spTrans2_5); ontology->defineTransformation(fixture.spTrans1_3d); ontology->defineTransformation(fixture.spTrans2_5d); ontology->defineTransformation(fixture.spTrans5_3); ontology->defineTransformation(fixture.spTrans5_3d); }; struct SimpleInstantiationHelper { }; } //namespace scenario } //namespace iro diff --git a/Code/Ontology/Simple/source/mapSimpleInformationEntity.cpp b/Code/Ontology/Simple/source/mapSimpleInformationEntity.cpp index 69ae45e..34e2cbd 100644 --- a/Code/Ontology/Simple/source/mapSimpleInformationEntity.cpp +++ b/Code/Ontology/Simple/source/mapSimpleInformationEntity.cpp @@ -1,86 +1,85 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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. // //------------------------------------------------------------------------ #include "mapSimpleTransformationInfo.h" namespace iro { namespace scenario { const SimpleInformationEntity::UIDType& SimpleInformationEntity:: getUID() const { return _uid; }; void SimpleInformationEntity:: setUID(const UIDType& uid) { _uid = uid; }; const SimpleInformationEntity::DataRepresentationType& SimpleInformationEntity:: getDataRepresentation() const { return _dataRep; }; void SimpleInformationEntity:: setDataRepresentation(const DataRepresentationType& rep) { _dataRep = rep; }; bool SimpleInformationEntity:: operator==(const Self& is) const { return is.getUID()==_uid; }; SimpleInformationEntity::Pointer SimpleInformationEntity:: clone() const { Pointer spClone(new Self()); spClone->_dataRep=_dataRep; spClone->_uid=_uid; return spClone; }; SimpleInformationEntity:: ~SimpleInformationEntity() - { - }; + = default; SimpleInformationEntity:: - SimpleInformationEntity() : _uid(""), _dataRep(DataRepresentation::Discrete) + SimpleInformationEntity() : _uid("") { }; } // end namespace scenario } // end namespace iro diff --git a/Code/Ontology/Simple/source/mapSimpleInformationSpace.cpp b/Code/Ontology/Simple/source/mapSimpleInformationSpace.cpp index cabf254..a0aa96b 100644 --- a/Code/Ontology/Simple/source/mapSimpleInformationSpace.cpp +++ b/Code/Ontology/Simple/source/mapSimpleInformationSpace.cpp @@ -1,70 +1,69 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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. // //------------------------------------------------------------------------ #include "mapSimpleTransformationInfo.h" namespace iro { namespace scenario { const SimpleInformationSpace::UIDType& SimpleInformationSpace:: getUID() const { return _uid; }; void SimpleInformationSpace:: setUID(const UIDType& uid) { _uid = uid; }; bool SimpleInformationSpace:: operator==(const Self& is) const { return is.getUID()==_uid; }; SimpleInformationSpace:: ~SimpleInformationSpace() - { - }; + = default; SimpleInformationSpace:: SimpleInformationSpace() : _uid("") { }; SimpleInformationSpace::Pointer SimpleInformationSpace:: clone() const { Pointer spClone(new Self()); spClone->_uid=_uid; return spClone; }; } // end namespace scenario } // end namespace iro diff --git a/Code/Ontology/Simple/source/mapSimpleOntology.cpp b/Code/Ontology/Simple/source/mapSimpleOntology.cpp index 875b06d..fcecc73 100644 --- a/Code/Ontology/Simple/source/mapSimpleOntology.cpp +++ b/Code/Ontology/Simple/source/mapSimpleOntology.cpp @@ -1,1520 +1,1533 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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. // //------------------------------------------------------------------------ #include "mapSimpleOntology.h" + +#include #include "mapSimpleOntologyCore.h" #include "mapISCacheKey.h" namespace iro { namespace scenario { SimpleOntology:: ~SimpleOntology() - { - - }; + = default; SimpleOntology:: SimpleOntology() { - _spCore = std::shared_ptr(new OntologyCoreType); + _spCore = std::make_shared(); }; void SimpleOntology:: reset() { OntologyRevisionTag revision = _spCore->_revision; - _spCore = std::shared_ptr(new OntologyCoreType); + _spCore = std::make_shared(); _spCore->_revision = ++revision; }; /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// // Entity Inference /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// Result SimpleOntology:: doGetContainingIS(InfEntityInferencePointer pEntity) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); ConstInfSpacePointer result; /*INTERNAL-TODO Consistency rule should be added: Entity seems to have no IS*/ OntologyCoreType::EntityISMapType::const_iterator pos = _spCore->_entity2ISMap.find(pEntity->getUID()); if (pos != _spCore->_entity2ISMap.end()) { //there is an entry in the look up map OntologyCoreType::ISMapType::const_iterator posIS = _spCore->_ISMap.find(pos->second); /*INTERNAL-TODO Consistency rule should be added: look up map is inconsistent*/ if (posIS != _spCore->_ISMap.end()) { //there is the fitting IS result = posIS->second; } } return Result(result, _spCore->_revision); }; Result SimpleOntology:: doGetEntitiesInIS(InfSpaceInferencePointer pIS) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); ConstInfEntityVectorType result; for (OntologyCoreType::EntityISMapType::const_iterator pos = _spCore->_entity2ISMap.begin(); pos != _spCore->_entity2ISMap.end(); ++pos) { //search the look up map if (pos->second == pIS->getUID()) { //it is an entity in the IS -> get entity OntologyCoreType::EntityMapType::const_iterator posEntity = _spCore->_entityMap.find(pos->first); /*INTERNAL-TODO Consistency rule should be added: look up map is inconsistent*/ if (posEntity != _spCore->_entityMap.end()) { //the entity realy exists so add it. result.push_back(posEntity->second); } } } return Result(result, _spCore->_revision); }; Result SimpleOntology:: doCheckForSameIS(InfEntityInferencePointer pEntity1, InfEntityInferencePointer pEntity2) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); bool result = false; /*INTERNAL-TODO Consistency rule should be added: Entity seems to have no IS*/ OntologyCoreType::EntityISMapType::const_iterator pos1 = _spCore->_entity2ISMap.find(pEntity1->getUID()); OntologyCoreType::EntityISMapType::const_iterator pos2 = _spCore->_entity2ISMap.find(pEntity2->getUID()); if ((pos1 != _spCore->_entity2ISMap.end()) && (pos2 != _spCore->_entity2ISMap.end())) { result = pos1->second == pos2->second; } return Result(result, _spCore->_revision); }; Result SimpleOntology:: doCheckForSameIS(const ConstInfEntityVectorType& entities) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); bool result = true; if (!entities.empty()) { - ConstInfEntityVectorType::const_iterator firstPos = entities.begin(); + auto firstPos = entities.begin(); OntologyCoreType::EntityISMapType::const_iterator posLook1 = _spCore->_entity2ISMap.find((*firstPos)->getUID()); if (posLook1 != _spCore->_entity2ISMap.end()) { // first element exists in an kown IS - ConstInfEntityVectorType::const_iterator pos = entities.begin()+1; + auto pos = entities.begin()+1; while( pos != entities.end()) { OntologyCoreType::EntityISMapType::const_iterator posLook2 = _spCore->_entity2ISMap.find((*pos)->getUID()); if (posLook1 != _spCore->_entity2ISMap.end()) { // second element exists in an kown IS result = posLook2->second == posLook1->second; - if (!result) break; //at least one element doesn't match, we can stop + if (!result) { break; //at least one element doesn't match, we can stop +} } ++pos; } } else { result = false; } } return Result(result, _spCore->_revision); }; Result SimpleOntology::doGetEntitiesWithSemanticCorrelations(InfEntityInferencePointer pEntity) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); ConstInfEntityVectorType result; //get the correlation OntologyCoreType::ConstCorrelationMapType corrMap; _spCore->getCorrelations(corrMap, pEntity->getUID()); //get the entities OntologyCoreType::EntityUIDSetType uids; uids.insert(pEntity->getUID()); OntologyCoreType::ConstEntityMapType entityMap = OntologyCoreType::getEntitiesByCorrelations(corrMap,uids); //convert entity map into result OntologyCoreType::extracValuesFromMap(entityMap, result); return Result(result, _spCore->_revision); }; Result SimpleOntology::doGetSemanticallyCorrelatedEntities(InfSpaceInferencePointer pSourceIS, InfSpaceInferencePointer pCorrelatedIS) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); ConstInfEntityVectorType result; //get entities ConstInfEntityVectorType entitiesInIS1 = getEntitiesInIS(pSourceIS); ConstInfEntityVectorType entitiesInIS2 = getEntitiesInIS(pCorrelatedIS); //get their UIDs OntologyCoreType::EntityUIDSetType uidsInIS1; OntologyCoreType::extractUIDs(entitiesInIS1,uidsInIS1); OntologyCoreType::EntityUIDSetType uidsInIS2; OntologyCoreType::extractUIDs(entitiesInIS2,uidsInIS2); //get the correlation OntologyCoreType::ConstCorrelationMapType corrMap; _spCore->getCorrelations(corrMap, uidsInIS1, uidsInIS2); //get the entities OntologyCoreType::ConstEntityMapType entityMap = OntologyCoreType::getEntitiesByCorrelations(corrMap,uidsInIS1,false); //convert entity map into result OntologyCoreType::extracValuesFromMap(entityMap, result); return Result(result, _spCore->_revision); }; Result SimpleOntology::doGetSemanticCorrelations(InfSpaceInferencePointer pIS1, InfSpaceInferencePointer pIS2) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); ConstCorrelationVectorType result; //get entities ConstInfEntityVectorType entitiesInIS1 = getEntitiesInIS(pIS1); ConstInfEntityVectorType entitiesInIS2 = getEntitiesInIS(pIS2); //get their UIDs OntologyCoreType::EntityUIDSetType uidsInIS1; OntologyCoreType::extractUIDs(entitiesInIS1,uidsInIS1); OntologyCoreType::EntityUIDSetType uidsInIS2; OntologyCoreType::extractUIDs(entitiesInIS2,uidsInIS2); //get the correlation OntologyCoreType::ConstCorrelationMapType corrMap; _spCore->getCorrelations(corrMap, uidsInIS1,uidsInIS2); //convert corr map into result OntologyCoreType::extracValuesFromMap(corrMap, result); return Result(result, _spCore->_revision); }; Result SimpleOntology::doGetSemanticCorrelations(InfEntityInferencePointer pEntity, InfSpaceInferencePointer pIS) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); ConstCorrelationVectorType result; //get entities ConstInfEntityVectorType entitiesInIS = getEntitiesInIS(pIS); //get their UIDs OntologyCoreType::EntityUIDSetType uidsInIS1; uidsInIS1.insert(pEntity->getUID()); OntologyCoreType::EntityUIDSetType uidsInIS2; OntologyCoreType::extractUIDs(entitiesInIS,uidsInIS2); //get the correlation OntologyCoreType::ConstCorrelationMapType corrMap; _spCore->getCorrelations(corrMap, uidsInIS1,uidsInIS2); //convert corr map into result OntologyCoreType::extracValuesFromMap(corrMap, result); return Result(result, _spCore->_revision); }; Result SimpleOntology::doGetSemanticCorrelations(InfEntityInferencePointer pEntity1, InfEntityInferencePointer pEntity2) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); ConstCorrelationVectorType result; //get the correlation OntologyCoreType::ConstCorrelationMapType corrMap; _spCore->getCorrelations(corrMap, pEntity1->getUID(),pEntity2->getUID()); //convert corr map into result OntologyCoreType::extracValuesFromMap(corrMap, result); return Result(result, _spCore->_revision); }; Result SimpleOntology::doGetDataRepresentationType(InfEntityInferencePointer pEntity) const { assert(_spCore); return Result(pEntity->getDataRepresentation(), _spCore->_revision); }; Result SimpleOntology::doHasDiscreteDataRepresentation(InfEntityInferencePointer pEntity) const { assert(_spCore); return Result(pEntity->getDataRepresentation()==DataRepresentation::Discrete, _spCore->_revision); }; Result SimpleOntology:: doHasContinuousDataRepresentation(InfEntityInferencePointer pEntity) const { assert(_spCore); return Result(pEntity->getDataRepresentation()==DataRepresentation::Continuous, _spCore->_revision); }; Result SimpleOntology:: doGetEntities() const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); ConstInfEntityVectorType result; //convert entity map into result OntologyCoreType::extracValuesFromMap(_spCore->_entityMap, result); return Result(result, _spCore->_revision); }; Result SimpleOntology:: doGetInformationSpaces() const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); ConstInfSpaceVectorType result; //convert is map into result OntologyCoreType::extracValuesFromMap(_spCore->_ISMap, result); return Result(result, _spCore->_revision); }; Result SimpleOntology:: doGetSemanticCorrelations() const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); ConstCorrelationVectorType result; //convert corr map into result OntologyCoreType::extracValuesFromMap(_spCore->_correlationMap, result); return Result(result, _spCore->_revision); }; Result SimpleOntology:: doActualize(InfEntityInferencePointer pEntity) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); ConstInfEntityPointer result; OntologyCoreType::EntityMapType::const_iterator pos = _spCore->_entityMap.find(pEntity->getUID()); if (pos != _spCore->_entityMap.end()) { result = pos->second; } return Result(result, _spCore->_revision); }; Result SimpleOntology:: doActualize(InfSpaceInferencePointer pIS) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); ConstInfSpacePointer result; OntologyCoreType::ISMapType::const_iterator pos = _spCore->_ISMap.find(pIS->getUID()); if (pos != _spCore->_ISMap.end()) { result = pos->second; } return Result(result, _spCore->_revision); }; Result SimpleOntology:: doActualize(CorrelationInferencePointer corr) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); ConstCorrelationPointer result; OntologyCoreType::CorrelationMapType::const_iterator pos = _spCore->_correlationMap.find(corr->getUID()); if (pos != _spCore->_correlationMap.end()) { result = pos->second; } return Result(result, _spCore->_revision); }; /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// // Entity Integration /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// Result SimpleOntology:: doDefineEntity(InfEntityInferencePointer pNewEntity, InfSpaceInferencePointer pContainingIS) { assert(_spCore); OntologyCoreType::LockType lock(_spCore->_mutex); ConstInfEntityPointer result; /*INTERNAL-TODO Consistency rule should be added: Entity already exists*/ OntologyCoreType::EntityMapType::const_iterator pos = _spCore->_entityMap.find(pNewEntity->getUID()); if (pos != _spCore->_entityMap.end()) { //the entity is already there, silent drop in Simple implementierung result = pos->second; } else { // add the clone InfEntityType::Pointer spNew = pNewEntity->clone(); _spCore->_entityMap[spNew->getUID()] = spNew; result = spNew; _spCore->_entity2ISMap[spNew->getUID()] = pContainingIS->getUID(); _spCore->notifyChange(); } return Result(result, _spCore->_revision); }; Result SimpleOntology:: doStoreEntity(InfEntityInferencePointer pEntity) { assert(_spCore); OntologyCoreType::LockType lock(_spCore->_mutex); ConstInfEntityPointer result; /*INTERNAL-TODO Consistency rule should be added: Entity does not exist*/ OntologyCoreType::EntityMapType::const_iterator pos = _spCore->_entityMap.find(pEntity->getUID()); if (pos != _spCore->_entityMap.end()) { //update entity pos->second->setDataRepresentation(pEntity->getDataRepresentation()); result = pos->second; - //TODO check: ist eigentlich nicht n�tig, da hier nur werte ge�ndert + // TODO(floca): check: ist eigentlich nicht n�tig, da hier nur werte ge�ndert //werden und referenzen g�ltig bleiben. Des Weiteren wird bei der correlation //ja validateForCommit aufgerufen um sicher zustellen, dass wenn sie abgespeichert oder //ge�ndert wird, alles auf diese referenz umgebogen wird. //_spCore->actualizeEntityInCorrelations(result->getUID()); } else { // Simple implementation: silent add InfEntityType::Pointer spNew = pEntity->clone(); _spCore->_entityMap[spNew->getUID()] = spNew; result = spNew; } _spCore->notifyChange(); return Result(result, _spCore->_revision); }; SimpleOntology::EntityDeleteReturnType SimpleOntology:: doDeleteEntity(InfEntityInferencePointer pEntity) { assert(_spCore); OntologyCoreType::LockType lock(_spCore->_mutex); EntityDeleteReturnType result = true; //remove from correlations _spCore->removeEntityFromCorrelations(pEntity->getUID()); //remove from lookups _spCore->_entity2ISMap.erase(pEntity->getUID()); _spCore->_entity2CorrelationMap.erase(pEntity->getUID()); //remove entity if (_spCore->_entityMap.erase(pEntity->getUID()) > 0) { _spCore->notifyChange(); } return result; }; Result SimpleOntology:: doDefineInformationSpace(InfSpaceInferencePointer pNewIS) { assert(_spCore); OntologyCoreType::LockType lock(_spCore->_mutex); ConstInfSpacePointer result; /*INTERNAL-TODO Consistency rule should be added: is already exists*/ OntologyCoreType::ISMapType::const_iterator pos = _spCore->_ISMap.find(pNewIS->getUID()); if (pos != _spCore->_ISMap.end()) { //the is is already there, silent drop in Simple implementierung result = pos->second; } else { // add the clone InfSpaceType::Pointer spNew = pNewIS->clone(); _spCore->_ISMap[spNew->getUID()] = spNew; _spCore->addVertex(spNew); result = spNew; _spCore->notifyChange(); } return Result(result, _spCore->_revision); }; Result SimpleOntology:: doStoreInformationSpace(InfSpaceInferencePointer pIS) { assert(_spCore); OntologyCoreType::LockType lock(_spCore->_mutex); ConstInfSpacePointer result; /*INTERNAL-TODO Consistency rule should be added: IS does not exist*/ OntologyCoreType::ISMapType::const_iterator pos = _spCore->_ISMap.find(pIS->getUID()); if (pos != _spCore->_ISMap.end()) { //update entity //no real update because in Simple only has UID result = pos->second; } else { // Simple implementation: silent add InfSpaceType::Pointer spNew = pIS->clone(); _spCore->_ISMap[spNew->getUID()] = spNew; _spCore->addVertex(spNew); result = spNew; _spCore->notifyChange(); } return Result(result, _spCore->_revision); }; SimpleOntology::ISDeleteReturnType SimpleOntology:: doDeleteInformationSpace(InfSpaceInferencePointer pIS) { assert(_spCore); OntologyCoreType::LockType lock(_spCore->_mutex); ISDeleteReturnType result = true; //remark: the removel from _entity2ISMap is missing. //The Simple implementation was wished to keep simple. //the using host will take care to explicitly delete all contained //enitities, so no cascading delete is needed //remove IS if (_spCore->_ISMap.erase(pIS->getUID()) > 0) { _spCore->deleteVertex(pIS); _spCore->notifyChange(); } return result; }; void SimpleOntology:: doSwitchInformationSpace(InfEntityInferencePointer pEntity, InfSpaceInferencePointer pNewIS) { assert(_spCore); OntologyCoreType::LockType lock(_spCore->_mutex); /*INTERNAL-TODO Consistency rule should be added: entity is relevant*/ //Simple just wants simple swith. no dependency analyses _spCore->_entity2ISMap[pEntity->getUID()] = pNewIS->getUID(); _spCore->notifyChange(); }; Result SimpleOntology:: doDefineSemanticCorrelation(CorrelationInferencePointer pNewCorr) { assert(_spCore); OntologyCoreType::LockType lock(_spCore->_mutex); ConstCorrelationPointer result; /*INTERNAL-TODO Consistency rule should be added: corr already exists*/ OntologyCoreType::CorrelationMapType::const_iterator pos = _spCore->_correlationMap.find(pNewCorr->getUID()); if (pos != _spCore->_correlationMap.end()) { //the corr is already there, silent drop in Simple implementierung result = pos->second; } else { // add the clone CorrelationType::Pointer spNew = pNewCorr->clone(); if (_spCore->validateForCommit(spNew)) { _spCore->_correlationMap[spNew->getUID()] = spNew; result = spNew; _spCore->updateEntity2CorrelationMap(spNew); _spCore->notifyChange(); } - else throw exceptions::UndefinedElement("Cannot define semantic correlation, related entities are not defined in the ontology."); + else { throw exceptions::UndefinedElement("Cannot define semantic correlation, related entities are not defined in the ontology."); +} } return Result(result, _spCore->_revision); }; Result SimpleOntology:: doStoreSemanticCorrelation(CorrelationInferencePointer corr) { assert(_spCore); OntologyCoreType::LockType lock(_spCore->_mutex); ConstCorrelationPointer result; /*INTERNAL-TODO Consistency rule should be added: corr does not exist*/ CorrelationType::Pointer spNew = corr->clone(); if (_spCore->validateForCommit(spNew)) { _spCore->_correlationMap[spNew->getUID()] = spNew; _spCore->updateEntity2CorrelationMap(spNew); result = spNew; _spCore->notifyChange(); } - else throw exceptions::UndefinedElement("Cannot store semantic correlation, related entities are not defined in the ontology."); + else { throw exceptions::UndefinedElement("Cannot store semantic correlation, related entities are not defined in the ontology."); +} return Result(result, _spCore->_revision); }; SimpleOntology::CorrelationDeleteReturnType SimpleOntology:: doDeleteSemanticCorrelation(CorrelationInferencePointer corr) { assert(_spCore); OntologyCoreType::LockType lock(_spCore->_mutex); CorrelationDeleteReturnType result = true; bool change = false; //remove from lookup - OntologyCoreType::EntityCorrelationMapType::iterator pos = _spCore->_entity2CorrelationMap.begin(); + auto pos = _spCore->_entity2CorrelationMap.begin(); while( pos != _spCore->_entity2CorrelationMap.end()) { if (pos->second == corr->getUID()) { pos = _spCore->_entity2CorrelationMap.erase(pos); change = true; } else { ++pos; } } //remove corr - if (_spCore->_correlationMap.erase(corr->getUID())) + if (_spCore->_correlationMap.erase(corr->getUID()) != 0u) { change = true; }; if (change) { _spCore->notifyChange(); } return result; }; /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// // Mapping inference /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// Result SimpleOntology:: doGetRegistrationPaths(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); OntologyCoreType::RegistrationGraphType::vertex_descriptor movingV = _spCore->getVertex(pMovingIS); OntologyCoreType::RegistrationGraphType::vertex_descriptor targetV = _spCore->getVertex(pFixedIS); OntologyCoreType::SimpleSearchMapType searchResult; core::simplePathSearch(searchResult, _spCore->_graph, targetV, movingV, DataRepresentationSupport::Arbitrary, pProblemCompliance, OntologyCoreType::EdgeValidatorType()); ConstRegPathOptColPointer result = _spCore->generateRegCollection(searchResult, ConstInfEntityPointer()); return Result(result, _spCore->_revision); }; Result SimpleOntology:: doGetRegistrationPaths(const ConstInfEntityVectorType& movingEntities, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); ConstRegPathOptColVectorType result; typedef std::map, OntologyCoreType::SimpleSearchMapType> SearchCacheType; SearchCacheType cache; - for (ConstInfEntityVectorType::const_iterator pos = movingEntities.begin(); pos != movingEntities.end(); ++pos) + for (const auto & movingEntitie : movingEntities) { - ConstInfSpacePointer spMIS = getContainingIS(*pos); + ConstInfSpacePointer spMIS = getContainingIS(movingEntitie); - core::ISCacheKey key(spMIS->getUID(), convertToSupport((*pos)->getDataRepresentation())); - SearchCacheType::iterator cachePos = cache.find(key); + core::ISCacheKey key(spMIS->getUID(), convertToSupport(movingEntitie->getDataRepresentation())); + auto cachePos = cache.find(key); if (cachePos == cache.end()) { //results are missing so generate them; OntologyCoreType::RegistrationGraphType::vertex_descriptor movingV = _spCore->getVertex(spMIS); OntologyCoreType::RegistrationGraphType::vertex_descriptor targetV = _spCore->getVertex(pFixedIS); OntologyCoreType::SimpleSearchMapType searchResult; - core::simplePathSearch(searchResult, _spCore->_graph, targetV, movingV, convertToSupport((*pos)->getDataRepresentation()),pProblemCompliance , OntologyCoreType::EdgeValidatorType()); + core::simplePathSearch(searchResult, _spCore->_graph, targetV, movingV, convertToSupport(movingEntitie->getDataRepresentation()),pProblemCompliance , OntologyCoreType::EdgeValidatorType()); //store results; cachePos = cache.insert(::std::make_pair(key,searchResult)).first; } - ConstRegPathOptColPointer spCollection = _spCore->generateRegCollection(cachePos->second, *pos); + ConstRegPathOptColPointer spCollection = _spCore->generateRegCollection(cachePos->second, movingEntitie); result.push_back(spCollection); } return Result(result, _spCore->_revision); }; Result SimpleOntology::doGetTransformationPaths(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); OntologyCoreType::RegistrationGraphType::vertex_descriptor movingV = _spCore->getVertex(pMovingIS); OntologyCoreType::RegistrationGraphType::vertex_descriptor targetV = _spCore->getVertex(pFixedIS); OntologyCoreType::SimpleSearchMapType searchResult; core::simplePathSearch(searchResult, _spCore->_graph, targetV, movingV, DataRepresentationSupport::Arbitrary, pProblemCompliance, OntologyCoreType::EdgeValidatorType()); ConstTransPathOptColPointer result = _spCore->generateTransCollection(searchResult, ConstInfEntityPointer()); return Result(result, _spCore->_revision); }; Result SimpleOntology::doGetTransformationPaths(const ConstInfEntityVectorType& movingEntities, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); ConstTransPathOptColVectorType result; typedef std::map, OntologyCoreType::SimpleSearchMapType> SearchCacheType; SearchCacheType cache; - for (ConstInfEntityVectorType::const_iterator pos = movingEntities.begin(); pos != movingEntities.end(); ++pos) + for (const auto & movingEntitie : movingEntities) { - ConstInfSpacePointer spMIS = getContainingIS(*pos); + ConstInfSpacePointer spMIS = getContainingIS(movingEntitie); - core::ISCacheKey key(spMIS->getUID(), convertToSupport((*pos)->getDataRepresentation())); - SearchCacheType::iterator cachePos = cache.find(key); + core::ISCacheKey key(spMIS->getUID(), convertToSupport(movingEntitie->getDataRepresentation())); + auto cachePos = cache.find(key); if (cachePos == cache.end()) { //results are missing so generate them; OntologyCoreType::RegistrationGraphType::vertex_descriptor movingV = _spCore->getVertex(spMIS); OntologyCoreType::RegistrationGraphType::vertex_descriptor targetV = _spCore->getVertex(pFixedIS); OntologyCoreType::SimpleSearchMapType searchResult; - core::simplePathSearch(searchResult, _spCore->_graph, targetV, movingV, convertToSupport((*pos)->getDataRepresentation()), pProblemCompliance, OntologyCoreType::EdgeValidatorType()); + core::simplePathSearch(searchResult, _spCore->_graph, targetV, movingV, convertToSupport(movingEntitie->getDataRepresentation()), pProblemCompliance, OntologyCoreType::EdgeValidatorType()); //store results; cachePos = cache.insert(::std::make_pair(key,searchResult)).first; } - ConstTransPathOptColPointer spCollection = _spCore->generateTransCollection(cachePos->second, *pos); + ConstTransPathOptColPointer spCollection = _spCore->generateTransCollection(cachePos->second, movingEntitie); result.push_back(spCollection); } return Result(result, _spCore->_revision); }; Result SimpleOntology:: doGetOptimalRegistrationPaths(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, DataRepresentationSupport::Type requiredDataSupport, const ProblemComplianceInterface* pProblemCompliance, const RegPathMetricInterface* pMetric) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); RegPathOptCollectionType::Pointer result(new RegPathOptCollectionType); OntologyCoreType::WeightMapType weights = _spCore->generateWeightMap_reg(requiredDataSupport, pProblemCompliance, pMetric); OntologyCoreType::PredecessorMapType predecessors; OntologyCoreType::EdgeMapType edges; _spCore->generateMinimalPathPredecessors(pFixedIS, weights, predecessors, edges); RegistrationPathType::Pointer spPath = _spCore->generateRegPath(pMovingIS, pFixedIS, weights, predecessors, edges); if (spPath) { //there is a path -> so generate an option and add it RegPathOptionType::Pointer spOption(new RegPathOptionType); spOption->setPath(spPath); result->addOption(spOption); } return Result(result, _spCore->_revision); }; Result SimpleOntology:: doGetOptimalRegistrationPaths(const ConstInfEntityVectorType& movingEntities, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance, const RegPathMetricInterface* pMetric) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); ConstRegPathOptColVectorType result; ConstInfEntityVectorType continuousEntities; ConstInfEntityVectorType discreteEntities; OntologyCoreType::spliteEntitiesByData(movingEntities, continuousEntities, discreteEntities); - OntologyCoreType::WeightMapType cWeights, dWeights; - OntologyCoreType::PredecessorMapType cPredecessors, dPredecessors; - OntologyCoreType::EdgeMapType cEdges, dEdges; + OntologyCoreType::WeightMapType cWeights; + OntologyCoreType::WeightMapType dWeights; + OntologyCoreType::PredecessorMapType cPredecessors; + OntologyCoreType::PredecessorMapType dPredecessors; + OntologyCoreType::EdgeMapType cEdges; + OntologyCoreType::EdgeMapType dEdges; if (!continuousEntities.empty()) { //get minaml spanning tree for continuous data cWeights = _spCore->generateWeightMap_reg(DataRepresentationSupport::Continuous, pProblemCompliance, pMetric); _spCore->generateMinimalPathPredecessors(pFixedIS, cWeights, cPredecessors, cEdges); } if (!discreteEntities.empty()) { //get minaml spanning tree for discrete data dWeights = _spCore->generateWeightMap_reg(DataRepresentationSupport::Discrete, pProblemCompliance, pMetric); _spCore->generateMinimalPathPredecessors(pFixedIS, dWeights, dPredecessors, dEdges); } //go throug all entities and get there options - for (ConstInfEntityVectorType::const_iterator pos = movingEntities.begin(); pos!= movingEntities.end(); ++pos) + for (const auto & movingEntitie : movingEntities) { RegPathOptCollectionType::Pointer spOptCol(new RegPathOptCollectionType); - spOptCol->setMovingEntity(*pos); + spOptCol->setMovingEntity(movingEntitie); RegistrationPathType::Pointer spPath; - if ((*pos)->getDataRepresentation()==DataRepresentation::Continuous) + if (movingEntitie->getDataRepresentation()==DataRepresentation::Continuous) { - spPath = _spCore->generateRegPath(getContainingIS(*pos), pFixedIS, cWeights, cPredecessors, cEdges); + spPath = _spCore->generateRegPath(getContainingIS(movingEntitie), pFixedIS, cWeights, cPredecessors, cEdges); } else { - spPath = _spCore->generateRegPath(getContainingIS(*pos), pFixedIS, dWeights, dPredecessors, dEdges); + spPath = _spCore->generateRegPath(getContainingIS(movingEntitie), pFixedIS, dWeights, dPredecessors, dEdges); } if (spPath) { //there is a path -> so generate an option and add it RegPathOptionType::Pointer spOption(new RegPathOptionType); spOption->setPath(spPath); - spOption->setMovingEntity(*pos); + spOption->setMovingEntity(movingEntitie); spOptCol->addOption(spOption); } result.push_back(spOptCol); } return Result(result, _spCore->_revision); }; Result SimpleOntology:: doGetOptimalTransformationPaths(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance, const TransPathMetricInterface* pMetric) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); TransPathOptCollectionType::Pointer result(new TransPathOptCollectionType); OntologyCoreType::WeightMapType weights = _spCore->generateWeightMap_trans(DataRepresentationSupport::Arbitrary, pProblemCompliance, pMetric); OntologyCoreType::PredecessorMapType predecessors; OntologyCoreType::EdgeMapType edges; _spCore->generateMinimalPathPredecessors(pFixedIS, weights, predecessors, edges); TransformationPathType::Pointer spPath = _spCore->generateTransPath(pMovingIS, pFixedIS, DataRepresentation::Continuous, weights, predecessors, edges); if (spPath) { //there is a path -> so generate an option and add it TransPathOptionType::Pointer spOption(new TransPathOptionType); spOption->setPath(spPath); result->addOption(spOption); } spPath = _spCore->generateTransPath(pMovingIS, pFixedIS, DataRepresentation::Discrete, weights, predecessors, edges); if (spPath) { //there is a path -> so generate an option and add it TransPathOptionType::Pointer spOption(new TransPathOptionType); spOption->setPath(spPath); result->addOption(spOption); } return Result(result, _spCore->_revision); }; Result SimpleOntology:: doGetOptimalTransformationPaths(const ConstInfEntityVectorType& movingEntities, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance, const TransPathMetricInterface* pMetric) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); ConstTransPathOptColVectorType result; ConstInfEntityVectorType continuousEntities; ConstInfEntityVectorType discreteEntities; OntologyCoreType::spliteEntitiesByData(movingEntities, continuousEntities, discreteEntities); - OntologyCoreType::WeightMapType cWeights, dWeights; - OntologyCoreType::PredecessorMapType cPredecessors, dPredecessors; - OntologyCoreType::EdgeMapType cEdges, dEdges; + OntologyCoreType::WeightMapType cWeights; + OntologyCoreType::WeightMapType dWeights; + OntologyCoreType::PredecessorMapType cPredecessors; + OntologyCoreType::PredecessorMapType dPredecessors; + OntologyCoreType::EdgeMapType cEdges; + OntologyCoreType::EdgeMapType dEdges; if (!continuousEntities.empty()) { //get minaml spanning tree for continuous data cWeights = _spCore->generateWeightMap_trans(DataRepresentationSupport::Continuous, pProblemCompliance, pMetric); _spCore->generateMinimalPathPredecessors(pFixedIS, cWeights, cPredecessors, cEdges); } if (!discreteEntities.empty()) { //get minaml spanning tree for discrete data dWeights = _spCore->generateWeightMap_trans(DataRepresentationSupport::Discrete, pProblemCompliance, pMetric); _spCore->generateMinimalPathPredecessors(pFixedIS, dWeights, dPredecessors, dEdges); } //go throug all entities and get there options - for (ConstInfEntityVectorType::const_iterator pos = movingEntities.begin(); pos!= movingEntities.end(); ++pos) + for (const auto & movingEntitie : movingEntities) { TransPathOptCollectionType::Pointer spOptCol(new TransPathOptCollectionType); - spOptCol->setMovingEntity(*pos); + spOptCol->setMovingEntity(movingEntitie); TransformationPathType::Pointer spPath; - if ((*pos)->getDataRepresentation()==DataRepresentation::Continuous) + if (movingEntitie->getDataRepresentation()==DataRepresentation::Continuous) { - spPath = _spCore->generateTransPath(getContainingIS(*pos), pFixedIS, DataRepresentation::Continuous, cWeights, cPredecessors, cEdges); + spPath = _spCore->generateTransPath(getContainingIS(movingEntitie), pFixedIS, DataRepresentation::Continuous, cWeights, cPredecessors, cEdges); } else { - spPath = _spCore->generateTransPath(getContainingIS(*pos), pFixedIS, DataRepresentation::Discrete, dWeights, dPredecessors, dEdges); + spPath = _spCore->generateTransPath(getContainingIS(movingEntitie), pFixedIS, DataRepresentation::Discrete, dWeights, dPredecessors, dEdges); } if (spPath) { //there is a path -> so generate an option and add it TransPathOptionType::Pointer spOption(new TransPathOptionType); spOption->setPath(spPath); - spOption->setMovingEntity(*pos); + spOption->setMovingEntity(movingEntitie); spOptCol->addOption(spOption); } result.push_back(spOptCol); } return Result(result, _spCore->_revision); }; Result SimpleOntology:: doGetMappableInformationSpaces(InfSpaceInferencePointer pFixedIS, DataRepresentationSupport::Type requiredDataSupport, const ProblemComplianceInterface* pProblemCompliance, const RegPathMetricInterface* pMetric) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); ConstInfSpaceVectorType result; OntologyCoreType::WeightMapType weights = _spCore->generateWeightMap_reg(requiredDataSupport, pProblemCompliance, pMetric); OntologyCoreType::PredecessorMapType predecessors; OntologyCoreType::EdgeMapType edges; _spCore->generateMinimalPathPredecessors(pFixedIS, weights, predecessors, edges); result = _spCore->generateMapableIS(pFixedIS, weights, predecessors, edges); return Result(result, _spCore->_revision); }; Result SimpleOntology:: doCheckForMappingFailureReason(InfEntityInferencePointer pMovingEntity, InfSpaceInferencePointer pFixedIS, const ProblemComplianceInterface* pProblemCompliance) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); //get path option collection for the passed entity ConstInfEntityVectorType movingIEs; movingIEs.push_back(pMovingEntity); ConstTransPathOptColVectorType cols = getTransformationPaths(movingIEs, pFixedIS, pProblemCompliance); - assert(cols.size()>0); + assert(!cols.empty()); return Result(cols[0]->checkForFailureReason(), _spCore->_revision); }; Result SimpleOntology:: doCheckForMappingFailureReason(InfSpaceInferencePointer pMovingIS, InfSpaceInferencePointer pFixedIS, DataRepresentationSupport::Type requiredDataSupport, const ProblemComplianceInterface* pProblemCompliance) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); OntologyCoreType::RegistrationGraphType::vertex_descriptor movingV = _spCore->getVertex(pMovingIS); OntologyCoreType::RegistrationGraphType::vertex_descriptor targetV = _spCore->getVertex(pFixedIS); OntologyCoreType::SimpleSearchMapType searchResult; core::simplePathSearch(searchResult, _spCore->_graph, targetV, movingV, requiredDataSupport, pProblemCompliance, OntologyCoreType::EdgeValidatorType()); ConstRegPathOptColPointer col = _spCore->generateRegCollection(searchResult, ConstInfEntityPointer()); MappingErrorType result =_spCore->checkOptionCollectionSupport(col, requiredDataSupport); return Result(result, _spCore->_revision); }; Result SimpleOntology:: doCheckForMappingFailureReason(InfEntityInferencePointer pMovingEntity, ConstRegistrationPathPointer pPath) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); MappingErrorType result = RegPathOptionType::PathCheckPolicy::checkForFailureReason(pPath,pMovingEntity); return Result(result, _spCore->_revision); }; Result SimpleOntology:: doCheckForMappingFailureReason(InfEntityInferencePointer pMovingEntity, ConstTransformationPathPointer pPath) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); MappingErrorType result = TransPathOptionType::PathCheckPolicy::checkForFailureReason(pPath,pMovingEntity); return Result(result, _spCore->_revision); }; Result SimpleOntology:: doConvertTransformationToRegistrationPath(ConstTransformationPathPointer pPath) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); RegistrationPathType::Pointer result(new RegistrationPathType()); - for (TransformationPathType::ConstPathElementIterator pos = pPath->getBegin(); pos != pPath->getEnd(); ++pos) + for (auto pos = pPath->getBegin(); pos != pPath->getEnd(); ++pos) { OntologyCoreType::RegistrationGraphType::edge_descriptor edge = _spCore->getAssociatedEdge(*pos); SimpleRegistrationInfo::Pointer spRegInfo(new SimpleRegistrationInfo()); spRegInfo->setTransformations(_spCore->_graph[edge].direct,_spCore->_graph[edge].inverse); result->appendElement(spRegInfo); } return Result(result, _spCore->_revision); }; Result SimpleOntology::doActualize(TransformationInfoInferencePointer pTI) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); ConstTransformationInfoPointer result; OntologyCoreType::TransformationMapType::const_iterator pos = _spCore->_transformationMap.find(pTI->getUID()); if (pos != _spCore->_transformationMap.end()) { result = pos->second; } return Result(result, _spCore->_revision); }; /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// // Mapping Integration /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// Result SimpleOntology:: doDefineTransformation(TransInfoInferencePointer newTransformation) { assert(_spCore); OntologyCoreType::LockType lock(_spCore->_mutex); ConstTransformationInfoPointer result; MappingInferenceInterface::TransformationInfoType::Pointer spNew = newTransformation->clone(); if (_spCore->validateForCommit(spNew)) { /*INTERNAL-TODO Consistency rule should be added: transformation already exists*/ OntologyCoreType::TransformationMapType::const_iterator pos = _spCore->_transformationMap.find(spNew->getUID()); if (pos != _spCore->_transformationMap.end()) { //the info is already there, silent delete of old version in Simple implementation. _spCore->deleteTransformationInfo(spNew); } // add the clone _spCore->storeTransformationInfo(spNew); result = spNew; } - else throw exceptions::UndefinedElement("Cannot define transformation info, associated information spaces or statement are not defined in the ontology."); + else { throw exceptions::UndefinedElement("Cannot define transformation info, associated information spaces or statement are not defined in the ontology."); +} return Result(result, _spCore->_revision); }; Result SimpleOntology:: doStoreTransformation(TransInfoInferencePointer transformation) { assert(_spCore); OntologyCoreType::LockType lock(_spCore->_mutex); ConstTransformationInfoPointer result; /*INTERNAL-TODO Consistency rule should be added: transformation info does not exist*/ // Simple implementation //silent add MappingInferenceInterface::TransformationInfoType::Pointer spNew = transformation->clone(); if (_spCore->validateForCommit(spNew)) { _spCore->storeTransformationInfo(spNew); result = spNew; } - else throw exceptions::UndefinedElement("Cannot store transformation info, associated information spaces or statement are not defined in the ontology."); + else { throw exceptions::UndefinedElement("Cannot store transformation info, associated information spaces or statement are not defined in the ontology."); +} return Result(result, _spCore->_revision); }; SimpleOntology::TransformationDeleteReturnType SimpleOntology:: doDeleteTransformation(TransInfoInferencePointer transformation) { assert(_spCore); OntologyCoreType::LockType lock(_spCore->_mutex); TransformationDeleteReturnType result = true; _spCore->deleteTransformationInfo(transformation); return result; }; /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// // Problem Inference /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// Result SimpleOntology:: doGetAssociatedProblemModels(ProblemStatementInferencePointer ps) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); ConstProblemModelVectorType result; //get the correlation OntologyCoreType::ConstModelMapType modelMap; _spCore->getProblemModels(modelMap, ps->getUID()); //convert entity map into result OntologyCoreType::extracValuesFromMap(modelMap, result); return Result(result, _spCore->_revision); }; Result SimpleOntology:: doGetProblemModels() const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); ConstProblemModelVectorType result; //convert corr map into result OntologyCoreType::extracValuesFromMap(_spCore->_modelMap, result); return Result(result, _spCore->_revision); }; Result SimpleOntology:: doGetProblemStatements() const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); ConstProblemStatementVectorType result; //convert corr map into result OntologyCoreType::extracValuesFromMap(_spCore->_statementMap, result); return Result(result, _spCore->_revision); }; Result SimpleOntology:: doActualize(ProblemStatementInferencePointer ps) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); ConstProblemStatementPointer result; OntologyCoreType::StatementMapType::const_iterator pos = _spCore->_statementMap.find(ps->getUID()); if (pos != _spCore->_statementMap.end()) { result = pos->second; } return Result(result, _spCore->_revision); }; Result SimpleOntology:: doActualize(ProblemModelInferencePointer pm) const { assert(_spCore); OntologyCoreType::SharableLockType lock(_spCore->_mutex); ConstProblemModelPointer result; OntologyCoreType::ModelMapType::const_iterator pos = _spCore->_modelMap.find(pm->getUID()); if (pos != _spCore->_modelMap.end()) { result = pos->second; } return Result(result, _spCore->_revision); }; /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// // Problem Integration /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// Result SimpleOntology:: doDefineProblemStatement(ProblemStatementInferencePointer pNewStatement) { assert(_spCore); OntologyCoreType::LockType lock(_spCore->_mutex); ConstProblemStatementPointer result; /*INTERNAL-TODO Consistency rule should be added: problem statement already exists*/ OntologyCoreType::StatementMapType::const_iterator pos = _spCore->_statementMap.find(pNewStatement->getUID()); if (pos != _spCore->_statementMap.end()) { //the statement is already there, silent drop in Simple implementierung result = pos->second; } else { // add the clone ProblemStatementType::Pointer spNew = pNewStatement->clone(); _spCore->_statementMap[spNew->getUID()] = spNew; result = spNew; _spCore->notifyChange(); } return Result(result, _spCore->_revision); }; Result SimpleOntology:: doStoreProblemStatement(ProblemStatementInferencePointer pStatement) { assert(_spCore); OntologyCoreType::LockType lock(_spCore->_mutex); ConstProblemStatementPointer result; /*INTERNAL-TODO Consistency rule should be added: Entity does not exist*/ OntologyCoreType::StatementMapType::const_iterator pos = _spCore->_statementMap.find(pStatement->getUID()); if (pos != _spCore->_statementMap.end()) { //update entity pos->second->setName(pStatement->getName()); result = pos->second; } else { // Simple implementation: silent add ProblemStatementType::Pointer spNew = pStatement->clone(); _spCore->_statementMap[spNew->getUID()] = spNew; result = spNew; } _spCore->notifyChange(); return Result(result, _spCore->_revision); }; SimpleOntology::StatementDeleteReturnType SimpleOntology:: doDeleteProblemStatement(ProblemStatementInferencePointer pStatement) { assert(_spCore); OntologyCoreType::LockType lock(_spCore->_mutex); StatementDeleteReturnType result = true; //remove from correlations _spCore->removeStatementFromModels(pStatement->getUID()); //remove from lookups _spCore->_stat2ModelMap.erase(pStatement->getUID()); //remove statement if (_spCore->_statementMap.erase(pStatement->getUID()) > 0) { _spCore->notifyChange(); } return result; }; Result SimpleOntology:: doDefineProblemModel(ProblemModelInferencePointer pNewModel) { assert(_spCore); OntologyCoreType::LockType lock(_spCore->_mutex); ConstProblemModelPointer result; /*INTERNAL-TODO Consistency rule should be added: problem model already exists*/ OntologyCoreType::ModelMapType::const_iterator pos = _spCore->_modelMap.find(pNewModel->getUID()); if (pos != _spCore->_modelMap.end()) { //the model is already there, silent drop in Simple implementierung result = pos->second; } else { // add the clone ProblemModelType::Pointer spNew = pNewModel->clone(); if (_spCore->validateForCommit(spNew)) { _spCore->_modelMap[spNew->getUID()] = spNew; result = spNew; _spCore->updateStatement2ModelMap(spNew); _spCore->notifyChange(); } - else throw exceptions::UndefinedElement("Cannot define problem model, associated statements are not defined in the ontology."); + else { throw exceptions::UndefinedElement("Cannot define problem model, associated statements are not defined in the ontology."); +} } return Result(result, _spCore->_revision); }; Result SimpleOntology:: doStoreProblemModel(ProblemModelInferencePointer pModel) { assert(_spCore); OntologyCoreType::LockType lock(_spCore->_mutex); ConstProblemModelPointer result; /*INTERNAL-TODO Consistency rule should be added: model does not exist*/ // Simple implementation ProblemModelType::Pointer spNew = pModel->clone(); if (_spCore->validateForCommit(spNew)) { _spCore->_modelMap[spNew->getUID()] = spNew; _spCore->updateStatement2ModelMap(spNew); result = spNew; _spCore->notifyChange(); } - else throw exceptions::UndefinedElement("Cannot store problem model, associated statements are not defined in the ontology."); + else { throw exceptions::UndefinedElement("Cannot store problem model, associated statements are not defined in the ontology."); +} return Result(result, _spCore->_revision); }; SimpleOntology::ModelDeleteReturnType SimpleOntology:: doDeleteProblemModel(ProblemModelInferencePointer pModel) { assert(_spCore); OntologyCoreType::LockType lock(_spCore->_mutex); ModelDeleteReturnType result = true; bool change = false; //remove from lookup - OntologyCoreType::StatementModelMapType::iterator pos = _spCore->_stat2ModelMap.begin(); + auto pos = _spCore->_stat2ModelMap.begin(); while( pos != _spCore->_stat2ModelMap.end()) { if (pos->second == pModel->getUID()) { pos = _spCore->_stat2ModelMap.erase(pos); change = true; } else { ++pos; } } //remove model - if (_spCore->_modelMap.erase(pModel->getUID())) + if (_spCore->_modelMap.erase(pModel->getUID()) != 0u) { change = true; }; if (change) { _spCore->notifyChange(); } return result; }; } // end namespace scenario } // end namespace iro diff --git a/Code/Ontology/Simple/source/mapSimpleTransformationInfo.cpp b/Code/Ontology/Simple/source/mapSimpleTransformationInfo.cpp index aa1f309..747a9e3 100644 --- a/Code/Ontology/Simple/source/mapSimpleTransformationInfo.cpp +++ b/Code/Ontology/Simple/source/mapSimpleTransformationInfo.cpp @@ -1,169 +1,168 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright c German Cancer Research Center DKFZ, // Software development for Integrated Diagnostics and Therapy SIDT. // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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 __MAP_Simple_TRANSFORMATION_INFO_TPP #define __MAP_Simple_TRANSFORMATION_INFO_TPP #include "mapSimpleTransformationInfo.h" #include "mapOntologyExceptions.h" namespace iro { namespace scenario { SimpleTransformationInfo::ConstISPointer SimpleTransformationInfo:: getMovingIS() const { return _movingIS; }; void SimpleTransformationInfo:: setMovingIS(ConstISPointer movingIS) { _movingIS = movingIS; }; SimpleTransformationInfo::ConstISPointer SimpleTransformationInfo:: getTargetIS() const { return _targetIS; }; void SimpleTransformationInfo:: setTargetIS(ConstISPointer targetIS) { _targetIS = targetIS; }; bool SimpleTransformationInfo:: doCheckProblemCompliance(const ProblemComplianceInterface* pProblemCompliance) const { return pProblemCompliance->checkComplianceOfStatement(this->_associatedProblem.get()); }; SimpleTransformationInfo::ConstProblemPointer SimpleTransformationInfo:: getAssociatedProblemStatement() const { return _associatedProblem; }; void SimpleTransformationInfo:: setAssociatedProblemStatement(ConstProblemPointer problem) { _associatedProblem = problem; }; SimpleTransformationInfo::DataRepresentationType SimpleTransformationInfo:: getSupportedDataRepresentation() const { return _dataRepresentation; }; void SimpleTransformationInfo:: setSupportedDataRepresentation(DataRepresentationType dr) { _dataRepresentation = dr; }; const SimpleTransformationInfo::UIDType& SimpleTransformationInfo:: getUID() const { return _uid; }; void SimpleTransformationInfo:: setUID(const UIDType& uid) { _uid = uid; }; SimpleTransformationInfo::FOVScopeType SimpleTransformationInfo:: getFOVScope() const { return _scope; }; void SimpleTransformationInfo:: setFOVScope(FOVScopeType scope) { _scope = scope; }; SimpleTransformationInfo:: ~SimpleTransformationInfo() - { - }; + = default; SimpleTransformationInfo:: - SimpleTransformationInfo(): _scope(::iro::FOVScope::Local), _dataRepresentation(::iro::DataRepresentation::Discrete), _uid("") + SimpleTransformationInfo(): _uid("") { }; SimpleTransformationInfo::ExecutionInfoType::ConstPointer SimpleTransformationInfo:: getAlgorithmExecutionInfo() const { return _execInfo; }; void SimpleTransformationInfo:: setAlgorithmExecutionInfo(ExecutionInfoType::Pointer execInfo) { _execInfo = execInfo; }; SimpleTransformationInfo::Pointer SimpleTransformationInfo:: clone() const { Pointer spClone(new Self()); spClone->_movingIS = _movingIS; spClone->_targetIS = _targetIS; spClone->_associatedProblem = _associatedProblem; spClone->_dataRepresentation = _dataRepresentation; spClone->_scope = _scope; spClone->_uid = _uid; spClone->_execInfo = _execInfo; return spClone; }; } // end namespace scenario } // end namespace iro #endif diff --git a/Code/Utilities/include/mapProcessExecutor.h b/Code/Utilities/include/mapProcessExecutor.h index 8e4cf4b..7e63aac 100644 --- a/Code/Utilities/include/mapProcessExecutor.h +++ b/Code/Utilities/include/mapProcessExecutor.h @@ -1,112 +1,112 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #ifndef __MAP_PROCESS_EXECUTOR_H #define __MAP_PROCESS_EXECUTOR_H #include #include "itkObject.h" #include "mapString.h" #include "mapMacros.h" #include "mapEvents.h" #include "mapClassMacros.h" #include "mapMAPUtilitiesExports.h" namespace map { namespace events { /*!@class TaskBatchEvent * @brief Base event indicating an output of an external process (e.g. by ProcessExecutor). The output is stored in the comment. * @ingroup Events */ mapEventMacro(ExternalProcessOutputEvent, AnyMatchPointEvent, MAPUtilities_EXPORT); /*!@class TaskBatchEvent * @brief Event indicating an standard output (STDOUT) of an external process (e.g. by ProcessExecutor). The output is stored in the comment. * @ingroup Events */ mapEventMacro(ExternalProcessStdOutEvent, ExternalProcessOutputEvent, MAPUtilities_EXPORT); /*!@class TaskBatchEvent * @brief Event indicating an error output of an external process (e.g. by ProcessExecutor). The output is stored in the comment. * @ingroup Events */ mapEventMacro(ExternalProcessStdErrEvent, ExternalProcessOutputEvent, MAPUtilities_EXPORT); - } + } // namespace events namespace utilities { /*! Helper class that allows to execute an application with arguments. * You may register an observer for an ExternalProcessOutputEvent, ExternalProcessStdOutEvent or ExternalProcessStdErrEvent * in order to get notified of any output. * @remark The events will only be invoked if the pipes are NOT(!) shared. By default the pipes are not shared. */ class MAPUtilities_EXPORT ProcessExecutor : public itk::Object { public: - typedef ProcessExecutor Self; - typedef ::itk::Object Superclass; - typedef ::itk::SmartPointer Pointer; - typedef ::itk::SmartPointer ConstPointer; + using Self = ProcessExecutor; + using Superclass = ::itk::Object; + using Pointer = ::itk::SmartPointer; + using ConstPointer = ::itk::SmartPointer; itkTypeMacro(ProcessExecutor, ::itk::Object); itkFactorylessNewMacro(Self); mapSetMacro(SharedOutputPipes, bool); mapGetConstMacro(SharedOutputPipes, bool); - typedef std::vector< ::map::core::String> ArgumentListType; + using ArgumentListType = std::vector< ::map::core::String>; bool execute(const core::String& executionPath, const core::String& executableName, ArgumentListType argumentList); /**Executes the process. This version assumes that the executable name is the first argument in the argument list * and has already been converted to its OS dependent name via the static convert function of this class.*/ bool execute(const core::String& executionPath, const ArgumentListType& argumentList); int getExitValue(); static core::String getOSDependendExecutableName(const core::String& name); protected: ProcessExecutor(); - virtual ~ProcessExecutor(); + ~ProcessExecutor() override; int _exitValue; /*! specifies if the child process should share the output pipes (true) or not (false). * If pipes are not shared the output will be passed by invoking ExternalProcessOutputEvents * @remark The events will only be invoked if the pipes are NOT(!) shared.*/ bool _SharedOutputPipes; private: - ProcessExecutor(const Self& source); - void operator=(const Self&); //purposely not implemented + ProcessExecutor(const Self& source) = delete; + void operator=(const Self&) = delete; //purposely not implemented }; - } -} + } // namespace utilities +} // namespace map #endif diff --git a/Code/Utilities/include/mapSimpleLandMarkFileReader.h b/Code/Utilities/include/mapSimpleLandMarkFileReader.h index 9c68027..64ea1f4 100644 --- a/Code/Utilities/include/mapSimpleLandMarkFileReader.h +++ b/Code/Utilities/include/mapSimpleLandMarkFileReader.h @@ -1,75 +1,75 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #if defined(_MSC_VER) #pragma warning ( disable : 4786 ) #endif #include "mapString.h" #include namespace map { namespace utilities { /** Loads a simple land mark file (one land mark per line, values of a landmark seperated by space) into the point set type. This function is used for some tests and examples. */ template typename TPointSet::Pointer loadLandMarksFromFile(const core::String& lmFileName) { - typedef TPointSet LandmarksType; + using LandmarksType = TPointSet; std::ifstream pointsFile; pointsFile.open(lmFileName.c_str()); - typename LandmarksType::Pointer spLMs = NULL; + typename LandmarksType::Pointer spLMs = nullptr; if (pointsFile.fail()) { return spLMs; } typename LandmarksType::PointType point; spLMs = LandmarksType::New(); spLMs->SetPoints(LandmarksType::PointsContainer::New()); unsigned int pointId = 0; pointsFile >> point; while (!pointsFile.fail()) { spLMs->SetPoint(pointId, point); pointId++; pointsFile >> point; } pointsFile.close(); return spLMs; } } //namespace utilities } //namespace map diff --git a/Code/Utilities/include/mapSimpleLandMarkFileWriter.h b/Code/Utilities/include/mapSimpleLandMarkFileWriter.h index 7ca9b1f..a7d3c23 100644 --- a/Code/Utilities/include/mapSimpleLandMarkFileWriter.h +++ b/Code/Utilities/include/mapSimpleLandMarkFileWriter.h @@ -1,84 +1,84 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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: 797 $ (last changed revision) // @date $Date: 2014-10-10 11:42:05 +0200 (Fr, 10 Okt 2014) $ (last change date) // @author $Author: floca $ (last changed by) // Subversion HeadURL: $HeadURL: https://svn.inet.dkfz-heidelberg.de/sbr/Sources/SBR-Projects/MatchPoint/trunk/Code/Utilities/include/mapSimpleLandMarkFileReader.h $ */ #if defined(_MSC_VER) #pragma warning ( disable : 4786 ) #endif #include "mapString.h" #include namespace map { namespace utilities { /** Loads a simple land mark file (one land mark per line, values of a landmark seperated by space) into the point set type. This function is used for some tests and examples. It asumes the standard itk coordinate system (LPS) */ template bool saveLandMarksToFile(const core::String& lmFileName, const TPointSet* pointSet) { - typedef TPointSet LandmarksType; + using LandmarksType = TPointSet; std::ofstream pointsFile; pointsFile.open(lmFileName.c_str()); typename LandmarksType::Pointer spLMs = NULL; if (pointsFile.fail()) { return false; } if (pointSet) { typename LandmarksType::PointType point; spLMs = LandmarksType::New(); spLMs->SetPoints(LandmarksType::PointsContainer::New()); typename LandmarksType::PointsContainer::ConstPointer points = pointSet->GetPoints(); typename LandmarksType::PointsContainer::ConstIterator pointIterator = points->Begin(); typename LandmarksType::PointsContainer::ConstIterator end = points->End(); while (pointIterator != end) { typename LandmarksType::PointType p = pointIterator.Value(); for (unsigned int i = 0; i < LandmarksType::PointDimension; ++i) { if (i > 0) { pointsFile << " "; } pointsFile << p[i]; } pointsFile << std::endl; ++pointIterator; } } pointsFile.close(); return true; } } //namespace utilities } //namespace map diff --git a/Code/Utilities/source/mapProcessExecutor.cpp b/Code/Utilities/source/mapProcessExecutor.cpp index 6b14f38..f77e7ad 100644 --- a/Code/Utilities/source/mapProcessExecutor.cpp +++ b/Code/Utilities/source/mapProcessExecutor.cpp @@ -1,170 +1,169 @@ // ----------------------------------------------------------------------- // MatchPoint - DKFZ translational registration framework // // Copyright (c) German Cancer Research Center (DKFZ), // Software development for Integrated Diagnostics and Therapy (SIDT). // ALL RIGHTS RESERVED. // See mapCopyright.txt or // http://www.dkfz.de/en/sidt/projects/MatchPoint/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$ (last changed revision) // @date $Date$ (last change date) // @author $Author$ (last changed by) // Subversion HeadURL: $HeadURL$ */ #include #include #include "itksys/Process.h" #include "itksys/SystemTools.hxx" #include "mapProcessExecutor.h" #include "mapFileDispatch.h" namespace map { namespace utilities { ::map::core::String ProcessExecutor:: getOSDependendExecutableName(const core::String& name) { #if defined(_WIN32) if (::map::core::FileDispatch::getExtension(name).empty()) { return name + ".exe"; } - else - { + + return name; - } + #else if (::map::core::FileDispatch::getPath(name).empty()) { return "./" + name; } else { return name; } #endif }; int ProcessExecutor:: getExitValue() { return this->_exitValue; }; bool ProcessExecutor:: execute(const core::String& executionPath, const ArgumentListType& argumentList) { //convert to char* array with terminating null element; const char** pArguments = new const char*[argumentList.size() + 1]; - pArguments[argumentList.size()] = 0; + pArguments[argumentList.size()] = nullptr; for (ArgumentListType::size_type index = 0; index < argumentList.size(); ++index) { pArguments[index] = argumentList[index].c_str(); } bool normalExit = false; try { itksysProcess* processID = itksysProcess_New(); itksysProcess_SetCommand(processID, pArguments); itksysProcess_SetWorkingDirectory(processID, executionPath.c_str()); if (this->_SharedOutputPipes) { - itksysProcess_SetPipeShared(processID, itksysProcess_Pipe_STDOUT, true); - itksysProcess_SetPipeShared(processID, itksysProcess_Pipe_STDERR, true); + itksysProcess_SetPipeShared(processID, itksysProcess_Pipe_STDOUT, 1); + itksysProcess_SetPipeShared(processID, itksysProcess_Pipe_STDERR, 1); } itksysProcess_Execute(processID); - char* rawOutput = NULL; + char* rawOutput = nullptr; int outputLength = 0; while (true) { - int dataStatus = itksysProcess_WaitForData(processID, &rawOutput, &outputLength, NULL); + int dataStatus = itksysProcess_WaitForData(processID, &rawOutput, &outputLength, nullptr); if (dataStatus == itksysProcess_Pipe_STDOUT) { map::core::String data(rawOutput, outputLength); - this->InvokeEvent(map::events::ExternalProcessStdOutEvent(NULL, data)); + this->InvokeEvent(map::events::ExternalProcessStdOutEvent(nullptr, data)); } else if (dataStatus == itksysProcess_Pipe_STDERR) { map::core::String data(rawOutput, outputLength); - this->InvokeEvent(map::events::ExternalProcessStdErrEvent(NULL, data)); + this->InvokeEvent(map::events::ExternalProcessStdErrEvent(nullptr, data)); } else { break; } } - itksysProcess_WaitForExit(processID, 0); + itksysProcess_WaitForExit(processID, nullptr); - itksysProcess_State_e state = static_cast(itksysProcess_GetState(processID)); + auto state = static_cast(itksysProcess_GetState(processID)); normalExit = (state == itksysProcess_State_Exited); this->_exitValue = itksysProcess_GetExitValue(processID); } catch (...) { delete[] pArguments; throw; } delete[] pArguments; return normalExit; }; bool ProcessExecutor:: execute(const core::String& executionPath, const core::String& executableName, ArgumentListType argumentList) { ::map::core::String executableName_OS = getOSDependendExecutableName(executableName); argumentList.insert(argumentList.begin(), executableName_OS); return execute(executionPath, argumentList); }; ProcessExecutor:: ProcessExecutor() { this->_exitValue = 0; this->_SharedOutputPipes = false; }; ProcessExecutor:: ~ProcessExecutor() - { - }; + = default; - } -} + } // namespace utilities +} // namespace map