diff --git a/CMakeExternals/OpenIGTLink-54df50de.patch b/CMakeExternals/OpenIGTLink-54df50de.patch deleted file mode 100644 index 22e1964f13..0000000000 --- a/CMakeExternals/OpenIGTLink-54df50de.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff -burN OpenIGTLink-master/OpenIGTLinkConfig.cmake.in OpenIGTLink/OpenIGTLinkConfig.cmake.in ---- OpenIGTLink-master/OpenIGTLinkConfig.cmake.in 2014-08-21 18:53:57.000000000 +0200 -+++ OpenIGTLink/OpenIGTLinkConfig.cmake.in 2015-02-05 01:08:29.885874473 +0100 -@@ -48,7 +48,7 @@ - # A list of all libraries for OpenIGTLink. Those listed here should - # automatically pull in their dependencies. - #SET(OpenIGTLink_LIBRARIES OpenIGTLinkAlgorithms OpenIGTLinkStatistics OpenIGTLinkFEM) --SET(OpenIGTLink_LIBRARIES OpenIGTLink) -+SET(OpenIGTLink_LIBRARIES optimized;OpenIGTLink;debug;OpenIGTLink@CMAKE_DEBUG_POSTFIX@) - - # The OpenIGTLink library dependencies. - IF(NOT OpenIGTLink_NO_LIBRARY_DEPENDS AND -diff -burN OpenIGTLink-master/Source/CMakeLists.txt OpenIGTLink/Source/CMakeLists.txt ---- OpenIGTLink-master/Source/CMakeLists.txt 2014-08-21 18:53:57.000000000 +0200 -+++ OpenIGTLink/Source/CMakeLists.txt 2015-02-05 00:34:34.086991641 +0100 -@@ -65,6 +65,7 @@ - igtlutil/igtl_image.h - igtlutil/igtl_position.h - igtlutil/igtl_transform.h -+ igtlutil/igtl_status.h - igtlutil/igtl_types.h - igtlutil/igtl_util.h - igtlutil/igtl_capability.h - -diff -burN OpenIGTLink-master/Source/igtlSocket.cxx OpenIGTLink/Source/igtlSocket.cxx ---- OpenIGTLink-master/Source/igtlSocket.cxx 2014-08-21 18:53:57.000000000 +0200 -+++ OpenIGTLink/Source/igtlSocket.cxx 2015-02-05 00:34:34.086991641 +0100 -@@ -51,7 +51,7 @@ - #define WSA_VERSION MAKEWORD(1,1) - #define igtlCloseSocketMacro(sock) (closesocket(sock)) - #else --#define igtlCloseSocketMacro(sock) (shutdown(sock, 2)) -+#define igtlCloseSocketMacro(sock) ({shutdown(sock, 2); close(sock);}) - #endif - - namespace igtl diff --git a/CMakeExternals/OpenIGTLink-92bc3d7b.patch b/CMakeExternals/OpenIGTLink-92bc3d7b.patch new file mode 100644 index 0000000000..314b33090e --- /dev/null +++ b/CMakeExternals/OpenIGTLink-92bc3d7b.patch @@ -0,0 +1,65 @@ +--- OpenIGTLink/Source/CMakeLists.txt.original 2017-06-28 12:28:12.000000000 +0200 ++++ OpenIGTLink/Source/CMakeLists.txt 2019-03-31 04:04:46.392945177 +0200 +@@ -71,12 +71,11 @@ + igtlTransformMessage.cxx + ) + +-SET(OpenIGTLink_INCLUDE_FILES) +-IF( MSVC OR ${CMAKE_GENERATOR} MATCHES "Xcode" ) +- LIST(APPEND OpenIGTLink_INCLUDE_FILES ++SET(OpenIGTLink_INCLUDE_FILES + igtlutil/igtl_header.h + igtlutil/igtl_image.h + igtlutil/igtl_position.h ++ igtlutil/igtl_status.h + igtlutil/igtl_transform.h + igtlutil/igtl_types.h + igtlutil/igtl_util.h +@@ -117,7 +116,6 @@ + igtlWindows.h + igtlCommon.h + ) +-ENDIF() + + # Add support for OpenIGTLink version 2 + IF (${OpenIGTLink_PROTOCOL_VERSION} GREATER "1" ) +@@ -150,7 +148,7 @@ + igtlBindMessage.cxx + igtlNDArrayMessage.cxx + ) +- IF( MSVC OR ${CMAKE_GENERATOR} MATCHES "Xcode" ) ++ + LIST(APPEND OpenIGTLink_INCLUDE_FILES + igtlutil/igtl_colortable.h + igtlutil/igtl_imgmeta.h +@@ -180,7 +178,6 @@ + igtlBindMessage.h + igtlNDArrayMessage.h + ) +- ENDIF() + ENDIF() + + # Add support for OpenIGTLink version 3 +@@ -191,14 +188,13 @@ + igtlutil/igtl_command.c + igtlutil/igtl_query.c + ) +- IF( MSVC OR ${CMAKE_GENERATOR} MATCHES "Xcode" ) ++ + LIST(APPEND OpenIGTLink_INCLUDE_FILES + igtlCommandMessage.h + igtlQueryMessage.h + igtlutil/igtl_command.h + igtlutil/igtl_query.h + ) +- ENDIF() + ENDIF() + + ADD_LIBRARY(OpenIGTLink ${OpenIGTLink_SOURCES} ${OpenIGTLink_INCLUDE_FILES}) +@@ -227,4 +223,4 @@ + INSTALL(TARGETS OpenIGTLink EXPORT OpenIGTLink + RUNTIME DESTINATION ${OpenIGTLink_INSTALL_BIN_DIR} COMPONENT RuntimeLibraries + LIBRARY DESTINATION ${OpenIGTLink_INSTALL_LIB_DIR} COMPONENT RuntimeLibraries +- ARCHIVE DESTINATION ${OpenIGTLink_INSTALL_LIB_DIR} COMPONENT Development) +\ No newline at end of file ++ ARCHIVE DESTINATION ${OpenIGTLink_INSTALL_LIB_DIR} COMPONENT Development) diff --git a/CMakeExternals/OpenIGTLink.cmake b/CMakeExternals/OpenIGTLink.cmake index 691f4c706c..c879f124d3 100644 --- a/CMakeExternals/OpenIGTLink.cmake +++ b/CMakeExternals/OpenIGTLink.cmake @@ -1,53 +1,53 @@ #----------------------------------------------------------------------------- # OpenIGTLink #----------------------------------------------------------------------------- if(MITK_USE_OpenIGTLink) # Sanity checks if(DEFINED OpenIGTLink_DIR AND NOT EXISTS ${OpenIGTLink_DIR}) message(FATAL_ERROR "OpenIGTLink_DIR variable is defined but corresponds to non-existing directory") endif() set(proj OpenIGTLink) set(proj_DEPENDENCIES ) set(${proj}_DEPENDS ${proj}) if(NOT DEFINED OpenIGTLink_DIR) set(additional_cmake_args ) if(CTEST_USE_LAUNCHERS) set(additional_cmake_args "-DCMAKE_PROJECT_${proj}_INCLUDE:FILEPATH=${CMAKE_ROOT}/Modules/CTestUseLaunchers.cmake" ) endif() ExternalProject_Add(${proj} - URL ${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/OpenIGTLink-54df50de.tar.gz - URL_MD5 b9fd8351b059f4ec615f2dfd74ab2458 - PATCH_COMMAND ${PATCH_COMMAND} -N -p1 -i ${CMAKE_CURRENT_LIST_DIR}/OpenIGTLink-54df50de.patch + URL ${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/OpenIGTLink-release-3.0.tar.gz + URL_MD5 0a759655da037f6df2087dd2690d1ae2 + PATCH_COMMAND ${PATCH_COMMAND} -N -p1 -i ${CMAKE_CURRENT_LIST_DIR}/OpenIGTLink-92bc3d7b.patch CMAKE_GENERATOR ${gen} CMAKE_GENERATOR_PLATFORM ${gen_platform} CMAKE_ARGS ${ep_common_args} ${additional_cmake_args} -DBUILD_EXAMPLES:BOOL=OFF -DOpenIGTLink_PROTOCOL_VERSION_2:BOOL=ON -DOpenIGTLink_INSTALL_LIB_DIR:STRING=lib -DOpenIGTLink_INSTALL_PACKAGE_DIR:STRING=lib/cmake/OpenIGTLink -DOpenIGTLink_INSTALL_NO_DOCUMENTATION:BOOL=ON CMAKE_CACHE_ARGS ${ep_common_cache_args} CMAKE_CACHE_DEFAULT_ARGS ${ep_common_cache_default_args} DEPENDS ${proj_DEPENDENCIES} ) set(OpenIGTLink_DIR "${ep_prefix}/lib/cmake/OpenIGTLink") else() mitkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}") endif() endif() diff --git a/Modules/OpenIGTLink/mitkIGTLDummyMessage.cpp b/Modules/OpenIGTLink/mitkIGTLDummyMessage.cpp index 0414cc41bd..6dff7d53c4 100644 --- a/Modules/OpenIGTLink/mitkIGTLDummyMessage.cpp +++ b/Modules/OpenIGTLink/mitkIGTLDummyMessage.cpp @@ -1,66 +1,65 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkIGTLDummyMessage.h" #include "igtl_header.h" #include "igtl_util.h" mitk::IGTLDummyMessage::IGTLDummyMessage() : StringMessage() { - this->m_DefaultBodyType = "DUMMY"; } mitk::IGTLDummyMessage::~IGTLDummyMessage() { } void mitk::IGTLDummyMessage::SetDummyString( const std::string& dummyString ) { this->m_dummyString = dummyString; this->m_String = "This is a dummy string"; } std::string mitk::IGTLDummyMessage::GetDummyString() { return this->m_dummyString; } igtl::MessageBase::Pointer mitk::IGTLDummyMessage::Clone() { //initialize the clone mitk::IGTLDummyMessage::Pointer clone = mitk::IGTLDummyMessage::New(); //copy the data clone->SetString(this->GetString()); clone->SetDummyString(this->GetDummyString()); return igtl::MessageBase::Pointer(clone.GetPointer()); } /** * \brief Clones the original message interpreted as transform message * \param original_ The original message that will be interpreted as transform * message * \return The clone of the input message */ igtl::MessageBase::Pointer mitk::DummyMsgCloneHandler::Clone(igtl::MessageBase* original_) { mitk::IGTLDummyMessage* original = (mitk::IGTLDummyMessage*)original_; return original->Clone(); } diff --git a/Modules/OpenIGTLink/mitkIGTLDummyMessage.h b/Modules/OpenIGTLink/mitkIGTLDummyMessage.h index 5a28cebf96..2f99e1e58a 100644 --- a/Modules/OpenIGTLink/mitkIGTLDummyMessage.h +++ b/Modules/OpenIGTLink/mitkIGTLDummyMessage.h @@ -1,74 +1,71 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef MITKIGTLDUMMYMESSAGE_H #define MITKIGTLDUMMYMESSAGE_H #include "MitkOpenIGTLinkExports.h" #include "igtlObject.h" #include "igtlStringMessage.h" #include "mitkIGTLMessageCloneHandler.h" namespace mitk { -/** Documentation -* \class IGTLDummyMessage -* \brief This class is a dummy message to show the how to implement a new message -* type +/** + * \class IGTLDummyMessage + * \brief This class is a dummy message to show how to implement a new message type */ -class MITKOPENIGTLINK_EXPORT IGTLDummyMessage: public igtl::StringMessage +class MITKOPENIGTLINK_EXPORT IGTLDummyMessage : public igtl::StringMessage { public: typedef IGTLDummyMessage Self; typedef StringMessage Superclass; typedef igtl::SmartPointer Pointer; typedef igtl::SmartPointer ConstPointer; - igtlTypeMacro( mitk::IGTLDummyMessage, igtl::StringMessage ); - igtlNewMacro( mitk::IGTLDummyMessage ); + igtlTypeMacro( mitk::IGTLDummyMessage, igtl::StringMessage ) + igtlNewMacro( mitk::IGTLDummyMessage ) public: /** * Set dummy string - */ + */ void SetDummyString( const std::string& dummyString ); /** * Get dummy string - */ + */ std::string GetDummyString(); /** * Returns a clone of itself - */ - igtl::MessageBase::Pointer Clone(); + */ + igtl::MessageBase::Pointer Clone() override; protected: IGTLDummyMessage(); ~IGTLDummyMessage() override; std::string m_dummyString; }; - -mitkIGTMessageCloneClassMacro(IGTLDummyMessage, DummyMsgCloneHandler); - +mitkIGTMessageCloneClassMacro(IGTLDummyMessage, DummyMsgCloneHandler) } // namespace mitk #endif diff --git a/Modules/OpenIGTLink/mitkIGTLMessageFactory.cpp b/Modules/OpenIGTLink/mitkIGTLMessageFactory.cpp index fcf45364ec..79cdfad769 100644 --- a/Modules/OpenIGTLink/mitkIGTLMessageFactory.cpp +++ b/Modules/OpenIGTLink/mitkIGTLMessageFactory.cpp @@ -1,295 +1,294 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkIGTLMessageFactory.h" // IGT message types #include "igtlImageMessage.h" #include "igtlTransformMessage.h" #include "igtlPositionMessage.h" #include "igtlStatusMessage.h" #include "igtlImageMetaMessage.h" #include "igtlPointMessage.h" #include "igtlTrajectoryMessage.h" #include "igtlStringMessage.h" #include "igtlSensorMessage.h" #include "igtlBindMessage.h" #include "igtlPolyDataMessage.h" #include "igtlQuaternionTrackingDataMessage.h" #include "igtlCapabilityMessage.h" #include "igtlNDArrayMessage.h" #include "igtlTrackingDataMessage.h" #include "igtlColorTableMessage.h" #include "igtlLabelMetaMessage.h" //own types #include "mitkIGTLDummyMessage.h" #include "mitkIGTLMessageCommon.h" #include "itksys/SystemTools.hxx" //------------------------------------------------------------ // Define message clone classes // igtlMessageHandlerClassMacro() defines a child class of // igtl::MessageHandler to handle OpenIGTLink messages for // the message type specified as the first argument. The // second argument will be used for the name of this // message handler class, while the third argument specifies // a type of data that will be shared with the message functions // of this handler class. -mitkIGTMessageCloneClassMacro(igtl::TransformMessage, TransformMsgCloneHandler); +mitkIGTMessageCloneClassMacro(igtl::TransformMessage, TransformMsgCloneHandler) /** * \brief Clones the original message interpreted as transform message * \param original_ The original message that will be interpreted as transform * message * \return The clone of the input message */ igtl::MessageBase::Pointer TransformMsgCloneHandler::Clone(igtl::MessageBase* original_) { bool copySuccess = false; igtl::TransformMessage::Pointer clone_ = igtl::TransformMessage::New(); //initialize the clone // clone = igtl::MessageBase::New(); igtl::TransformMessage* original = (igtl::TransformMessage*)original_; //copy all meta data copySuccess = clone_->Copy(original); if (!copySuccess) return nullptr; //copy all data that is important for this class //copy the matrix igtl::Matrix4x4 mat; original->GetMatrix(mat); clone_->SetMatrix(mat); //copy the normals float normals[3][3]; original->GetNormals(normals); clone_->SetNormals(normals); //copy the position float position[3]; original->GetPosition(position); clone_->SetPosition(position); return igtl::MessageBase::Pointer(clone_.GetPointer()); } mitk::IGTLMessageFactory::IGTLMessageFactory() { //create clone handlers // mitk::IGTLMessageCloneHandler::Pointer tmch = ; this->AddMessageNewMethod("NONE", nullptr); - //OpenIGTLink Types V1 + // OpenIGTLink Types V1 this->AddMessageNewMethod("IMAGE", (PointerToMessageBaseNew)&igtl::ImageMessage::New); this->AddMessageNewMethod("TRANSFORM", (PointerToMessageBaseNew)&igtl::TransformMessage::New); this->AddMessageNewMethod("POSITION", (PointerToMessageBaseNew)&igtl::PositionMessage::New); this->AddMessageNewMethod("STATUS", (PointerToMessageBaseNew)&igtl::StatusMessage::New); this->AddMessageNewMethod("CAPABILITY", (PointerToMessageBaseNew)&igtl::CapabilityMessage::New); this->AddMessageNewMethod("GET_IMAGE", (PointerToMessageBaseNew)&igtl::GetImageMessage::New); this->AddMessageNewMethod("GET_TRANS", (PointerToMessageBaseNew)&igtl::GetTransformMessage::New); //this->AddMessageNewMethod("GET_POS", (PointerToMessageBaseNew)&igtl::GetPositionMessage::New); //not available??? this->AddMessageNewMethod("GET_STATUS", (PointerToMessageBaseNew)&igtl::GetStatusMessage::New); - this->AddMessageNewMethod("GET_CAPABIL", (PointerToMessageBaseNew)&igtl::GetCapabilityMessage::New); - // //OpenIGTLink Types V2 + // OpenIGTLink Types V2 this->AddMessageNewMethod("IMGMETA", (PointerToMessageBaseNew)&igtl::ImageMetaMessage::New); this->AddMessageNewMethod("LBMETA", (PointerToMessageBaseNew)&igtl::LabelMetaMessage::New); this->AddMessageNewMethod("COLORT", (PointerToMessageBaseNew)&igtl::ColorTableMessage::New); this->AddMessageNewMethod("POINT", (PointerToMessageBaseNew)&igtl::PointMessage::New); this->AddMessageNewMethod("TRAJ", (PointerToMessageBaseNew)&igtl::TrajectoryMessage::New); this->AddMessageNewMethod("TDATA", (PointerToMessageBaseNew)&igtl::TrackingDataMessage::New); this->AddMessageNewMethod("QTDATA", (PointerToMessageBaseNew)&igtl::QuaternionTrackingDataMessage::New); this->AddMessageNewMethod("SENSOR", (PointerToMessageBaseNew)&igtl::SensorMessage::New); this->AddMessageNewMethod("STRING", (PointerToMessageBaseNew)&igtl::StringMessage::New); this->AddMessageNewMethod("NDARRAY", (PointerToMessageBaseNew)&igtl::NDArrayMessage::New); this->AddMessageNewMethod("BIND", (PointerToMessageBaseNew)&igtl::BindMessage::New); this->AddMessageNewMethod("POLYDATA", (PointerToMessageBaseNew)&igtl::PolyDataMessage::New); this->AddMessageNewMethod("GET_IMGMETA", (PointerToMessageBaseNew)&igtl::GetImageMetaMessage::New); this->AddMessageNewMethod("GET_LBMETA", (PointerToMessageBaseNew)&igtl::GetLabelMetaMessage::New); this->AddMessageNewMethod("GET_COLORT", (PointerToMessageBaseNew)&igtl::GetColorTableMessage::New); this->AddMessageNewMethod("GET_POINT", (PointerToMessageBaseNew)&igtl::GetPointMessage::New); this->AddMessageNewMethod("GET_TRAJ", (PointerToMessageBaseNew)&igtl::GetTrajectoryMessage::New); // this->AddMessageNewMethod("GET_TDATA", (PointerToMessageBaseNew)&igtl::GetTrackingDataMessage::New); //not available??? // this->AddMessageNewMethod("GET_QTDATA", (PointerToMessageBaseNew)&igtl::GetQuaternionTrackingDataMessage::New); //not available??? // this->AddMessageNewMethod("GET_SENSOR", (PointerToMessageBaseNew)&igtl::GetSensorMessage::New); //not available??? // this->AddMessageNewMethod("GET_STRING", (PointerToMessageBaseNew)&igtl::GetStringMessage::New); //not available??? // this->AddMessageNewMethod("GET_NDARRAY", (PointerToMessageBaseNew)&igtl::GetNDArrayMessage::New); //not available??? this->AddMessageNewMethod("GET_BIND", (PointerToMessageBaseNew)&igtl::GetBindMessage::New); this->AddMessageNewMethod("GET_POLYDATA", (PointerToMessageBaseNew)&igtl::GetPolyDataMessage::New); this->AddMessageNewMethod("RTS_BIND", (PointerToMessageBaseNew)&igtl::RTSBindMessage::New); this->AddMessageNewMethod("RTS_QTDATA", (PointerToMessageBaseNew)&igtl::RTSQuaternionTrackingDataMessage::New); this->AddMessageNewMethod("RTS_TDATA", (PointerToMessageBaseNew)&igtl::RTSTrackingDataMessage::New); //todo: check if there are more RTS messages this->AddMessageNewMethod("STT_BIND", (PointerToMessageBaseNew)&igtl::StartBindMessage::New); this->AddMessageNewMethod("STT_TDATA", (PointerToMessageBaseNew)&igtl::StartTrackingDataMessage::New); this->AddMessageNewMethod("STT_QTDATA", (PointerToMessageBaseNew)&igtl::StartQuaternionTrackingDataMessage::New); //todo: check if there are more STT messages this->AddMessageNewMethod("STP_BIND", (PointerToMessageBaseNew)&igtl::StopBindMessage::New); this->AddMessageNewMethod("STP_TDATA", (PointerToMessageBaseNew)&igtl::StopTrackingDataMessage::New); this->AddMessageNewMethod("STP_QTDATA", (PointerToMessageBaseNew)&igtl::StopQuaternionTrackingDataMessage::New); //todo: check if there are more STP messages //Own Types this->AddMessageNewMethod("DUMMY", (PointerToMessageBaseNew)&mitk::IGTLDummyMessage::New); } mitk::IGTLMessageFactory::~IGTLMessageFactory() { } void mitk::IGTLMessageFactory::AddMessageType(std::string messageTypeName, IGTLMessageFactory::PointerToMessageBaseNew messageTypeNewPointer, mitk::IGTLMessageCloneHandler::Pointer cloneHandler) { this->AddMessageNewMethod(messageTypeName, messageTypeNewPointer); this->AddMessageCloneHandler(messageTypeName, cloneHandler); } void mitk::IGTLMessageFactory::AddMessageNewMethod(std::string messageTypeName, IGTLMessageFactory::PointerToMessageBaseNew messageTypeNewPointer) { this->m_NewMethods[messageTypeName] = messageTypeNewPointer; } void mitk::IGTLMessageFactory::AddMessageCloneHandler(std::string msgTypeName, mitk::IGTLMessageCloneHandler::Pointer cloneHandler) { this->m_CloneHandlers[msgTypeName] = cloneHandler; } mitk::IGTLMessageCloneHandler::Pointer mitk::IGTLMessageFactory::GetCloneHandler(std::string messageTypeName) { if (this->m_CloneHandlers.find(messageTypeName) != this->m_CloneHandlers.end()) { return m_CloneHandlers[messageTypeName]; } MITK_ERROR("IGTLMessageFactory") << messageTypeName << " message type is not registered to factory!"; mitkThrow() << messageTypeName << " message type is not registered to factory!"; return nullptr; } igtl::MessageBase::Pointer mitk::IGTLMessageFactory::Clone(igtl::MessageBase::Pointer msg) { return this->GetCloneHandler(msg->GetDeviceType())->Clone(msg); } mitk::IGTLMessageFactory::PointerToMessageBaseNew mitk::IGTLMessageFactory::GetMessageTypeNewPointer(std::string messageTypeName) { if (this->m_NewMethods.find(messageTypeName) != this->m_NewMethods.end()) { return m_NewMethods[messageTypeName]; } MITK_ERROR("IGTLMessageFactory") << messageTypeName << " message type is not registered to factory!"; return nullptr; } igtl::MessageBase::Pointer mitk::IGTLMessageFactory::CreateInstance(std::string messageTypeName) { mitk::IGTLMessageFactory::PointerToMessageBaseNew newPointer = this->GetMessageTypeNewPointer(messageTypeName); if (newPointer != nullptr) { return newPointer(); } else { return nullptr; } } std::list mitk::IGTLMessageFactory::GetAvailableMessageRequestTypes() { std::list allGetMessages; for (std::map::const_iterator it = this->m_NewMethods.begin(); it != this->m_NewMethods.end(); ++it) { if (it->first.find("GET_") != std::string::npos || it->first.find("STT_") != std::string::npos || it->first.find("STP_") != std::string::npos || it->first.find("RTS_") != std::string::npos) { allGetMessages.push_back(it->first); } } return allGetMessages; } igtl::MessageBase::Pointer mitk::IGTLMessageFactory::CreateInstance(igtl::MessageHeader::Pointer msgHeader) { std::string messageType; //check the header if (msgHeader.IsNull()) { messageType = "NONE"; } else { messageType = msgHeader->GetDeviceType(); } //make message type uppercase messageType = itksys::SystemTools::UpperCase(messageType); //find the according new method if (this->m_NewMethods.find(messageType) != this->m_NewMethods.end()) { if (this->m_NewMethods[messageType] != nullptr) { // Call tracker New() function if tracker not nullptr return (*this->m_NewMethods[messageType])(); } else return nullptr; } else { MITK_ERROR("IGTLMessageFactory") << "Unknown IGT message type: " << messageType; return nullptr; } }