diff --git a/Modules/IGTBase/CMakeLists.txt b/Modules/IGTBase/CMakeLists.txt index abb7877502..141f912903 100644 --- a/Modules/IGTBase/CMakeLists.txt +++ b/Modules/IGTBase/CMakeLists.txt @@ -1,4 +1,6 @@ -MITK_CREATE_MODULE(DEPENDS MitkCore - ) +MITK_CREATE_MODULE( + DEPENDS MitkCore + WARNINGS_AS_ERRORS +) add_subdirectory(autoload) diff --git a/Modules/IGTBase/include/mitkNavigationDataSet.h b/Modules/IGTBase/include/mitkNavigationDataSet.h index 2c987eb012..be1ab96b09 100644 --- a/Modules/IGTBase/include/mitkNavigationDataSet.h +++ b/Modules/IGTBase/include/mitkNavigationDataSet.h @@ -1,171 +1,171 @@ /*=================================================================== 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 MITKNAVIGATIONDATASET_H_HEADER_INCLUDED_ #define MITKNAVIGATIONDATASET_H_HEADER_INCLUDED_ #include #include "mitkBaseData.h" #include "mitkNavigationData.h" namespace mitk { /** * \brief Data structure which stores streams of mitk::NavigationData for * multiple tools. * * Use mitk::NavigationDataRecorder to create these sets easily from pipelines. * Use mitk::NavigationDataPlayer to stream from these sets easily. * */ class MITKIGTBASE_EXPORT NavigationDataSet : public BaseData { public: /** * \brief This iterator iterates over the distinct time steps in this set. * * It returns an array of the length equal to GetNumberOfTools(), containing a * mitk::NavigationData for each tool.. */ typedef std::vector< std::vector >::iterator NavigationDataSetIterator; /** * \brief This iterator iterates over the distinct time steps in this set. And is const. * * It returns an array of the length equal to GetNumberOfTools(), containing a * mitk::NavigationData for each tool.. */ typedef std::vector< std::vector >::const_iterator NavigationDataSetConstIterator; mitkClassMacro(NavigationDataSet, BaseData); mitkNewMacro1Param(Self, unsigned int); /** * \brief Add mitk::NavigationData of the given tool to the Set. * * @param navigationDatas vector of mitk::NavigationData objects to be added. Make sure that the size of the * vector equals the number of tools given in the constructor * @return true if object was be added to the set successfully, false otherwise */ bool AddNavigationDatas( std::vector navigationDatas ); /** * \brief Get mitk::NavigationData from the given tool at given index. * * @param toolIndex Index of the tool from which mitk::NavigationData should be returned. * @param index Index of the mitk::NavigationData object that should be returned. * @return mitk::NavigationData at the specified indices, 0 if there is no object at the indices. */ NavigationData::Pointer GetNavigationDataForIndex( unsigned int index, unsigned int toolIndex ) const; ///** //* \brief Get last mitk::Navigation object for given tool whose timestamp is less than the given timestamp. //* @param toolIndex Index of the tool from which mitk::NavigationData should be returned. //* @param timestamp Timestamp for selecting last object before. //* @return Last mitk::NavigationData with timestamp less than given timestamp, 0 if there is no adequate object. //*/ // Method not yet supported! //NavigationData::Pointer GetNavigationDataBeforeTimestamp( mitk::NavigationData::TimeStampType timestamp , unsigned int toolIndex ) const; /** * \brief Returns a vector that contains all tracking data for a given tool. * * This is a relatively expensive operation, as it requires the construction of a new vector. * * @param toolIndex Index of the tool for which the stream should be returned. * @return Returns a vector that contains all tracking data for a given tool. */ virtual std::vector< mitk::NavigationData::Pointer > GetDataStreamForTool(unsigned int toolIndex); /** * \brief Returns a vector that contains NavigationDatas for each tool for a given timestep. * * If GetNumberOFTools() equals four, then 4 NavigationDatas will be returned. * * @param index Index of the timeStep for which the datas should be returned. cannot be larger than mitk::NavigationDataSet::Size() * @return Returns a vector that contains all tracking data for a given tool. */ virtual std::vector< mitk::NavigationData::Pointer > GetTimeStep(unsigned int index) const; /** * \brief Returns the number of tools for which NavigationDatas are stored in this set. * * This is always equal to the number given in the constructor of this class. * * @return the number of tools for which NavigationDatas are stored in this set. */ unsigned int GetNumberOfTools() const; /** * \brief Returns the number of time steps stored in this NavigationDataSet. * * This is not the total number of Navigation Datas stored in this set, but the number stored for each tool. * i.e. the total number of NavigationDatas equals Size() * GetNumberOfTools(); * * @return Returns the number of time steps stored in this NavigationDataSet. */ unsigned int Size() const; /** * \brief Returns an iterator pointing to the first TimeStep. * * @return Returns an iterator pointing to the first TimeStep. */ virtual NavigationDataSetConstIterator Begin() const; /** * \brief Returns an iterator pointing behind to the last TimeStep. * * @return Returns an iterator pointing behind to the last TimeStep. */ virtual NavigationDataSetConstIterator End() const; // virtual methods, that need to be implemented, but aren't reasonable for NavigationData virtual void SetRequestedRegionToLargestPossibleRegion( ) override; virtual bool RequestedRegionIsOutsideOfTheBufferedRegion( ) override; virtual bool VerifyRequestedRegion( ) override; virtual void SetRequestedRegion( const itk::DataObject *data ) override; /** * \brief This overrid is probably a little hacky. See Bug 19086. */ virtual bool IsEmpty() const override; protected: /** * \brief Constructs set with fixed number of tools. * @param numTools How many tools are used with this mitk::NavigationDataSet. */ NavigationDataSet( unsigned int numTools ); virtual ~NavigationDataSet( ); /** * \brief Holds all the mitk::NavigationData objects managed by this class. * * The first dimension is the index of the navigation data, the second is the * tool to which this data belongs. i.e. the first dimension is usually the longer one. */ std::vector > m_NavigationDataVectors; /** * \brief The Number of Tools that this class is going to support. */ - int m_NumberOfTools; + unsigned int m_NumberOfTools; }; } #endif // MITKNAVIGATIONDATASET_H_HEADER_INCLUDED_ diff --git a/Modules/IGTBase/include/mitkQuaternionAveraging.h b/Modules/IGTBase/include/mitkQuaternionAveraging.h index da8f5a4859..76edad654e 100644 --- a/Modules/IGTBase/include/mitkQuaternionAveraging.h +++ b/Modules/IGTBase/include/mitkQuaternionAveraging.h @@ -1,56 +1,56 @@ /*=================================================================== 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 QUATERNIONAVERAGING_H_HEADER_INCLUDED_ #define QUATERNIONAVERAGING_H_HEADER_INCLUDED_ #include "MitkIGTBaseExports.h" #include #include #include #include #include #include namespace mitk { /**Documentation * \brief This class offers methods to average quaternions. * \ingroup IGT Base */ class MITKIGTBASE_EXPORT QuaternionAveraging : public itk::Object { public: mitkClassMacroItkParent(QuaternionAveraging, itk::Object); itkNewMacro(Self); enum Mode { SimpleMean, //simple averaging over all components of the quaternion, only valid for small differences. Slerp //more advanced algorithm for averaging (spherical linear interpolation), may also be used for huge differences }; - static mitk::Quaternion CalcAverage(const std::vector quaternions, Mode mode = SimpleMean); + static mitk::Quaternion CalcAverage(const std::vector& quaternions, Mode mode = SimpleMean); protected: QuaternionAveraging(); virtual ~QuaternionAveraging(); }; } // Ende Namespace #endif diff --git a/Modules/IGTBase/src/mitkNavigationDataSet.cpp b/Modules/IGTBase/src/mitkNavigationDataSet.cpp index 10b596ba56..4424ec9fc1 100644 --- a/Modules/IGTBase/src/mitkNavigationDataSet.cpp +++ b/Modules/IGTBase/src/mitkNavigationDataSet.cpp @@ -1,167 +1,167 @@ /*=================================================================== 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 "mitkNavigationDataSet.h" mitk::NavigationDataSet::NavigationDataSet( unsigned int numberOfTools ) : m_NavigationDataVectors(std::vector >()), m_NumberOfTools(numberOfTools) { } mitk::NavigationDataSet::~NavigationDataSet( ) { } bool mitk::NavigationDataSet::AddNavigationDatas( std::vector navigationDatas ) { // test if tool with given index exist if ( navigationDatas.size() != m_NumberOfTools ) { MITK_WARN("NavigationDataSet") << "Tried to add too many or too few navigation Datas to NavigationDataSet. " << m_NumberOfTools << " required, tried to add " << navigationDatas.size() << "."; return false; } // test for consistent timestamp if ( m_NavigationDataVectors.size() > 0) { - for (int i = 0; i < navigationDatas.size(); i++) + for (std::vector::size_type i = 0; i < navigationDatas.size(); i++) if (navigationDatas[i]->GetIGTTimeStamp() <= m_NavigationDataVectors.back()[i]->GetIGTTimeStamp()) { MITK_WARN("NavigationDataSet") << "IGTTimeStamp of new NavigationData should be newer than timestamp of last NavigationData."; return false; } } m_NavigationDataVectors.push_back(navigationDatas); return true; } mitk::NavigationData::Pointer mitk::NavigationDataSet::GetNavigationDataForIndex( unsigned int index, unsigned int toolIndex ) const { if ( index >= m_NavigationDataVectors.size() ) { MITK_WARN("NavigationDataSet") << "There is no NavigationData available at index " << index << "."; return nullptr; } if ( toolIndex >= m_NavigationDataVectors.at(index).size() ) { MITK_WARN("NavigationDataSet") << "There is NavigatitionData available at index " << index << " for tool " << toolIndex << "."; return nullptr; } return m_NavigationDataVectors.at(index).at(toolIndex); } // Method not yet supported, code below compiles but delivers wrong results //mitk::NavigationData::Pointer mitk::NavigationDataSet::GetNavigationDataBeforeTimestamp( // mitk::NavigationData::TimeStampType timestamp, unsigned int toolIndex) const //{ // if ( toolIndex >= m_NavigationDataVectors.size() ) // { // MITK_WARN("NavigationDataSet") << "There is no tool with index " << toolIndex << "."; // return NULL; // } // // std::vector::const_iterator it; // // // iterate through all NavigationData objects of the given tool index // // till the timestamp of the NavigationData is greater then the given timestamp // for (it = m_NavigationDataVectors.at(toolIndex).begin(); // it != m_NavigationDataVectors.at(toolIndex).end(); ++it) // { // if ( (*it)->GetIGTTimeStamp() > timestamp) { break; } // } // // // first element was greater than timestamp -> return null // if ( it == m_NavigationDataVectors.at(toolIndex).begin() ) // { // MITK_WARN("NavigationDataSet") << "No NavigationData was recorded before given timestamp."; // return NULL; // } // // // return last element smaller than the given timestamp // return *(it-1); //} std::vector< mitk::NavigationData::Pointer > mitk::NavigationDataSet::GetDataStreamForTool(unsigned int toolIndex) { if (toolIndex >= m_NumberOfTools ) { MITK_WARN("NavigationDataSet") << "Invalid toolIndex: " << m_NumberOfTools << " Tools known, requested index " << toolIndex << ""; return std::vector(); } std::vector< mitk::NavigationData::Pointer > result; - for(int i = 0; i < m_NavigationDataVectors.size(); i++) + for(std::vector >::size_type i = 0; i < m_NavigationDataVectors.size(); i++) result.push_back(m_NavigationDataVectors[i][toolIndex]); return result; } std::vector< mitk::NavigationData::Pointer > mitk::NavigationDataSet::GetTimeStep(unsigned int index) const { return m_NavigationDataVectors[index]; } unsigned int mitk::NavigationDataSet::GetNumberOfTools() const { return m_NumberOfTools; } unsigned int mitk::NavigationDataSet::Size() const { return m_NavigationDataVectors.size(); } // ---> methods necessary for BaseData void mitk::NavigationDataSet::SetRequestedRegionToLargestPossibleRegion() { } bool mitk::NavigationDataSet::RequestedRegionIsOutsideOfTheBufferedRegion() { return false; } bool mitk::NavigationDataSet::VerifyRequestedRegion() { return true; } void mitk::NavigationDataSet::SetRequestedRegion(const DataObject * ) { } bool mitk::NavigationDataSet::IsEmpty() const { return (Size() == 0); } // <--- methods necessary for BaseData // ---> methods for Iterators mitk::NavigationDataSet::NavigationDataSetConstIterator mitk::NavigationDataSet::Begin() const { return m_NavigationDataVectors.cbegin(); } mitk::NavigationDataSet::NavigationDataSetConstIterator mitk::NavigationDataSet::End() const { return m_NavigationDataVectors.cend(); } diff --git a/Modules/IGTBase/src/mitkQuaternionAveraging.cpp b/Modules/IGTBase/src/mitkQuaternionAveraging.cpp index 275920a45e..3a6cc9ff91 100644 --- a/Modules/IGTBase/src/mitkQuaternionAveraging.cpp +++ b/Modules/IGTBase/src/mitkQuaternionAveraging.cpp @@ -1,69 +1,69 @@ /*=================================================================== 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 "mitkQuaternionAveraging.h" //#include "bussvrmath/Quaternion.h" //#include "SphereMean.h" mitk::QuaternionAveraging::QuaternionAveraging() { } mitk::QuaternionAveraging::~QuaternionAveraging() { } -mitk::Quaternion mitk::QuaternionAveraging::CalcAverage(const std::vector quaternions, Mode mode) +mitk::Quaternion mitk::QuaternionAveraging::CalcAverage(const std::vector& quaternions, Mode mode) { mitk::Quaternion result; switch (mode) { case SimpleMean: - for (int i=0; i::size_type i=0; i