diff --git a/testing/masks/rttbMaskRectStructTester.cpp b/testing/masks/rttbMaskRectStructTester.cpp deleted file mode 100644 index 2748519..0000000 --- a/testing/masks/rttbMaskRectStructTester.cpp +++ /dev/null @@ -1,185 +0,0 @@ -// ----------------------------------------------------------------------- -// RTToolbox - DKFZ radiotherapy quantitative evaluation library -// -// Copyright (c) German Cancer Research Center (DKFZ), -// Software development for Integrated Diagnostics and Therapy (SIDT). -// ALL RIGHTS RESERVED. -// See rttbCopyright.txt or -// http://www.dkfz.de/en/sidt/projects/rttb/copyright.html -// -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notices for more information. -// -//------------------------------------------------------------------------ -/*! -// @file -// @version $Revision $ (last changed revision) -// @date $Date $ (last change date) -// @author $Author $ (last changed by) -*/ -#include - -#include "rttbMaskRectStructTester.h" -#include "rttbGeometricInfo.h" - -namespace rttb -{ - - namespace testing - { - - MaskRectStructTester::MaskRectStructTester(MaskAccessorPointer aMaskAccessor, GridIndexType z) - { - _maskAccessor = aMaskAccessor; - _referenceList = _maskAccessor->getRelevantVoxelVector(); - - _differentSlice = false; - _outsideStructure = false; - _wrongRVF = false; - _conversionFailed = false; - - _zIndex = z; - } - - void MaskRectStructTester::setAccessor(const MaskAccessorPointer aMaskAccessor) - { - _maskAccessor = aMaskAccessor; - _referenceList = _maskAccessor->getRelevantVoxelVector(); - } - void MaskRectStructTester::setZ(const GridIndexType z) - { - _zIndex = z; - } - - lit::StringType MaskRectStructTester::getTestDescription(void) const - { - return "Check if generated MaskVoxelList corresponds to the given rectangular structure."; - }; - - bool MaskRectStructTester::doCheck(void) const - { - _pResults->onTestStart(getCurrentTestLabel()); - - _differentSlice = false; - _outsideStructure = false; - _wrongRVF = false; - _conversionFailed = false; - - VoxelGridIndex3D indexOTB; - MaskVoxelList::iterator iterR; - VoxelGridID index = 0; - - for (iterR = _referenceList->begin(); iterR != _referenceList->end(); ++iterR, ++index) - { - if (!(_maskAccessor->getGeometricInfo().convert(iterR->getVoxelGridID(), indexOTB))) - { - _conversionFailed = true; - _failedListIndex = index; - break; - } - - if (indexOTB.z() != _zIndex) - { - _differentSlice = true; - _failedListIndex = index; - _wrongVal = indexOTB.z(); - break; - } - //corners are [2,1],[5,1],[5,5],[2,5], relevant voxels need to lie inside - else if ((indexOTB.x() < 2) || (indexOTB.x() > 5)) - { - _outsideStructure = true; - _failedListIndex = index; - break; - } - else if ((indexOTB.y() < 1) || (indexOTB.y() > 5)) - { - _outsideStructure = true; - _failedListIndex = index; - break; - } - //check corners - else if ((indexOTB.x() == 2 && indexOTB.y() == 1) || (indexOTB.x() == 2 && indexOTB.y() == 5) || - (indexOTB.x() == 5 && indexOTB.y() == 1) || (indexOTB.x() == 5 && indexOTB.y() == 5)) - { - if (0.25 != iterR->getRelevantVolumeFraction()) - { - _wrongRVF = true; - _failedListIndex = index; - _wrongVal = iterR->getRelevantVolumeFraction(); - break; - } - } - else if ((indexOTB.x() == 2) || (indexOTB.y() == 5) || (indexOTB.y() == 1) || (indexOTB.x() == 5)) - { - if (0.5 != iterR->getRelevantVolumeFraction()) - { - _wrongRVF = true; - _failedListIndex = index; - _wrongVal = iterR->getRelevantVolumeFraction(); - break; - } - } - //check sides - else //should be inside - { - if (1 != iterR->getRelevantVolumeFraction()) - { - _wrongRVF = true; - _failedListIndex = index; - _wrongVal = iterR->getRelevantVolumeFraction(); - break; - } - } - }//end for(iterR = _referenceList->begin(); iterR != _referenceLi... - - if (_conversionFailed || _differentSlice || _outsideStructure || _wrongRVF) - { - return false; - } - - return true; - } - - void MaskRectStructTester::handleSuccess(void) const - { - std::ostringstream stream; - stream << "The Voxelization is inside the given rectangle" << std::endl; - - _pResults->onTestSuccess(getCurrentTestLabel(), stream.str()); - } - - void MaskRectStructTester::handleFailure(void) const - { - std::ostringstream stream; - stream << "Voxelization was not correct" << std::endl; - - if (_conversionFailed) - { - stream << std::endl << "The conversion failed at position" << _failedListIndex << std::endl; - } - - if (_differentSlice) - { - stream << std::endl << "The voxelisation was not in plane " << _zIndex << " at position " << - _failedListIndex << " was in " << _wrongVal << std::endl; - } - - if (_outsideStructure) - { - stream << std::endl << "The voxelisation was outside the rectangle at position " << _failedListIndex - << std::endl; - } - - if (_wrongRVF) - { - stream << std::endl << "The voxelisation had the wrong relevant volume fraction at position " << - _failedListIndex << " was in " << _wrongVal << std::endl; - } - - _pResults->onTestFailure(getCurrentTestLabel(), stream.str()); - } - - } -} \ No newline at end of file diff --git a/testing/masks/rttbMaskRectStructTester.h b/testing/masks/rttbMaskRectStructTester.h deleted file mode 100644 index 4b11ac3..0000000 --- a/testing/masks/rttbMaskRectStructTester.h +++ /dev/null @@ -1,102 +0,0 @@ -// ----------------------------------------------------------------------- -// RTToolbox - DKFZ radiotherapy quantitative evaluation library -// -// Copyright (c) German Cancer Research Center (DKFZ), -// Software development for Integrated Diagnostics and Therapy (SIDT). -// ALL RIGHTS RESERVED. -// See rttbCopyright.txt or -// http://www.dkfz.de/en/sidt/projects/rttb/copyright.html [^] -// -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notices for more information. -// -//------------------------------------------------------------------------ -/*! -// @file -// @version $Revision$ (last changed revision) -// @date $Date$ (last change date) -// @author $Author$ (last changed by) -*/ - -#ifndef __MASK_RECT_TESTER_H -#define __MASK_RECT_TESTER_H - -#include - -#include "litTesterBase.h" -#include "litString.h" - -#include "rttbBaseType.h" -#include "../../code/core/rttbMaskAccessorInterface.h" - -namespace rttb -{ - - namespace testing - { - /*! class MaskRectStructTester - @brief Tests if masked voxel are all inside the given boundaries - The boundaries are defined in DummyStructure::CreateRectangularStructureCentered - @see DummyStructure - */ - class MaskRectStructTester: public lit::TesterBase - { - - private: - typedef core::MaskAccessorInterface::MaskVoxelListPointer MaskVoxelListPointer; - typedef core::MaskAccessorInterface::MaskVoxelList MaskVoxelList; - typedef core::MaskAccessorInterface::MaskAccessorPointer MaskAccessorPointer; - - MaskVoxelListPointer _referenceList; - MaskAccessorPointer _maskAccessor; - - GridIndexType _zIndex; - - mutable bool _conversionFailed; - mutable bool _differentSlice; - mutable bool _outsideStructure; - mutable bool _wrongRVF; - - mutable VoxelGridID _failedListIndex; - mutable double _wrongVal; - - public: - MaskRectStructTester(MaskAccessorPointer aMaskAccessor, GridIndexType z); - - /*! Set the mask accessor pointer for the dose comparison. - */ - void setAccessor(const MaskAccessorPointer aMaskAccessor); - - /*! Set index of slice containing the dummy structure. - */ - void setZ(const GridIndexType z); - - /*! Returns a string that specifies the test the tester currently performs. - */ - lit::StringType getTestDescription(void) const; - lit::StringType getTestName(void) const - { - return "MaskRectStructTester"; - }; - - protected: - /*! performes the test and checks the results. - @result Indicates if the test was successfull (true) or if it failed (false) - */ - bool doCheck(void) const; - - /*! Function will be called be check() if test was succesfull. - */ - void handleSuccess(void) const; - - /*! Function will be called be check() if test was a failure. - */ - void handleFailure(void) const; - - }; - - } -} - -#endif \ No newline at end of file diff --git a/testing/masks/rttbMaskVoxelListTester.cpp b/testing/masks/rttbMaskVoxelListTester.cpp deleted file mode 100644 index be7533b..0000000 --- a/testing/masks/rttbMaskVoxelListTester.cpp +++ /dev/null @@ -1,150 +0,0 @@ -// ----------------------------------------------------------------------- -// RTToolbox - DKFZ radiotherapy quantitative evaluation library -// -// Copyright (c) German Cancer Research Center (DKFZ), -// Software development for Integrated Diagnostics and Therapy (SIDT). -// ALL RIGHTS RESERVED. -// See rttbCopyright.txt or -// http://www.dkfz.de/en/sidt/projects/rttb/copyright.html -// -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notices for more information. -// -//------------------------------------------------------------------------ -/*! -// @file -// @version $Revision $ (last changed revision) -// @date $Date $ (last change date) -// @author $Author $ (last changed by) -*/ -#include - -#include "rttbMaskVoxelListTester.h" - -namespace rttb -{ - - namespace testing - { - - MaskVoxelListTester::MaskVoxelListTester(MaskVoxelListPointer aReferenceList, - MaskVoxelListPointer aCompareList) - { - _referenceList = aReferenceList; - _compareList = aCompareList; - - _sameSize = false; - _masVoxelsDiffer = false; - _numDifference = 0; - } - - void MaskVoxelListTester::setReferenceList(const MaskVoxelListPointer aReferenceList) - { - _referenceList = aReferenceList; - } - void MaskVoxelListTester::setCompareList(const MaskVoxelListPointer aCompareList) - { - _compareList = aCompareList; - } - - lit::StringType MaskVoxelListTester::getTestDescription(void) const - { - return "Compare two MaskVoxelLists and determine if the contained content is equal."; - }; - - bool MaskVoxelListTester::doCheck(void) const - { - _pResults->onTestStart(getCurrentTestLabel()); - - _masVoxelsDiffer = false; - - if (_referenceList->size() == _compareList->size()) - { - _sameSize = true; - } - else - { - _sameSize = false; - return false; - } - - _numDifference = 0; - _maxDifference = 0; - - MaskVoxelList::iterator iterR, iterC; - iterC = _compareList->begin(); - VoxelGridID index = 0; - - for (iterR = _referenceList->begin(); iterR != _referenceList->end(); ++iterR, ++iterC, ++index) - { - if (iterR->getVoxelGridID() == iterC->getVoxelGridID()) - { - if (iterR->getRelevantVolumeFraction() == iterC->getRelevantVolumeFraction()) - { - continue; - } - else - { - double diff = iterR->getRelevantVolumeFraction() - iterC->getRelevantVolumeFraction(); - - if (diff > _maxDifference) - { - _maxDifference = diff; - } - - _numDifference++; - } - } - else - { - _failedListIndex = index; - _masVoxelsDiffer = true; - return false; - } - } - - if (_numDifference > 0) - { - return false; - } - - return true; - } - - void MaskVoxelListTester::handleSuccess(void) const - { - std::ostringstream stream; - stream << "Both Lists are equal" << std::endl; - - _pResults->onTestSuccess(getCurrentTestLabel(), stream.str()); - } - - void MaskVoxelListTester::handleFailure(void) const - { - std::ostringstream stream; - stream << "Lists were different" << std::endl; - - if (_sameSize) - { - stream << std::endl << "Error of volume fraction voxel count: " << _numDifference << std::endl; - stream << std::endl << "Maximum difference in volume fraction: " << _maxDifference << std::endl; - - if (_masVoxelsDiffer) - { - stream << std::endl << "Mask points to different grid position in: " << _failedListIndex << - std::endl; - } - } - else - { - stream << "Lists have different size" << std::endl; - stream << "Reference List is " << _referenceList->size() << " voxels long and comparison List " << - _compareList->size() << std::endl; - } - - _pResults->onTestFailure(getCurrentTestLabel(), stream.str()); - } - - } -} \ No newline at end of file diff --git a/testing/masks/rttbMaskVoxelListTester.h b/testing/masks/rttbMaskVoxelListTester.h deleted file mode 100644 index b07d312..0000000 --- a/testing/masks/rttbMaskVoxelListTester.h +++ /dev/null @@ -1,95 +0,0 @@ -// ----------------------------------------------------------------------- -// RTToolbox - DKFZ radiotherapy quantitative evaluation library -// -// Copyright (c) German Cancer Research Center (DKFZ), -// Software development for Integrated Diagnostics and Therapy (SIDT). -// ALL RIGHTS RESERVED. -// See rttbCopyright.txt or -// http://www.dkfz.de/en/sidt/projects/rttb/copyright.html [^] -// -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notices for more information. -// -//------------------------------------------------------------------------ -/*! -// @file -// @version $Revision$ (last changed revision) -// @date $Date$ (last change date) -// @author $Author$ (last changed by) -*/ - -#ifndef __MASK_VL_TESTER_H -#define __MASK_VL_TESTER_H - -#include - -#include "litTesterBase.h" -#include "litString.h" - -#include "rttbBaseType.h" -#include "../../code/core/rttbMaskAccessorInterface.h" - -namespace rttb -{ - - namespace testing - { - /*! class MaskVoxelListTester - @brief Tester class for lists. Compares two given lists for similarity. - Both lists need to have the same length and have equal values in each element to be considered similar. - */ - class MaskVoxelListTester: public lit::TesterBase - { - - private: - typedef core::MaskAccessorInterface::MaskVoxelListPointer MaskVoxelListPointer; - typedef core::MaskAccessorInterface::MaskVoxelList MaskVoxelList; - - MaskVoxelListPointer _referenceList; - MaskVoxelListPointer _compareList; - - mutable double _maxDifference; - mutable double _numDifference; - - mutable bool _sameSize; - mutable bool _masVoxelsDiffer; - - mutable VoxelGridID _failedListIndex; - - public: - MaskVoxelListTester(MaskVoxelListPointer aReferenceList, MaskVoxelListPointer aCompareList); - - /*! Set the dose accessor pointer for the dose comparison. - */ - void setReferenceList(const MaskVoxelListPointer aReferenceList); - void setCompareList(const MaskVoxelListPointer aCompareList); - - /*! Returns a string that specifies the test the tester currently performs. - */ - lit::StringType getTestDescription(void) const; - lit::StringType getTestName(void) const - { - return "MaskVoxelListTester"; - }; - - protected: - /*! performes the test and checks the results. - @result Indicates if the test was successfull (true) or if it failed (false) - */ - bool doCheck(void) const; - - /*! Function will be called be check() if test was succesfull. - */ - void handleSuccess(void) const; - - /*! Function will be called be check() if test was a failure. - */ - void handleFailure(void) const; - - }; - - } -} - -#endif \ No newline at end of file