diff --git a/Core/Code/DataManagement/mitkTimeSlicedGeometry.cpp b/Core/Code/DataManagement/mitkTimeSlicedGeometry.cpp deleted file mode 100644 index 6a628ac6e2..0000000000 --- a/Core/Code/DataManagement/mitkTimeSlicedGeometry.cpp +++ /dev/null @@ -1,422 +0,0 @@ -/*=================================================================== - -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 "mitkTimeSlicedGeometry.h" - -void mitk::TimeSlicedGeometry::UpdateInformation() -{ - if(m_TimeSteps==0) return; - - unsigned long maxModifiedTime = 0, curModifiedTime; - - mitk::ScalarType stmin, stmax; - stmin= ScalarTypeNumericTraits::NonpositiveMin(); - stmax= ScalarTypeNumericTraits::max(); - - TimeBounds timeBounds; - timeBounds[0]=stmax; timeBounds[1]=stmin; - - mitk::BoundingBox::Pointer boundingBox=mitk::BoundingBox::New(); - - mitk::BoundingBox::PointsContainer::Pointer pointscontainer=mitk::BoundingBox::PointsContainer::New(); - - unsigned int t; - - mitk::Geometry3D* geometry3d; - mitk::BoundingBox::ConstPointer nextBoundingBox; - mitk::BoundingBox::PointIdentifier pointid=0; - - // Need to check for zero bounding boxes - mitk::ScalarType zeropoint[]={0,0,0,0,0,0}; - BoundingBox::BoundsArrayType itkBoundsZero(zeropoint); - - for(t=0; t < m_TimeSteps; ++t) - { - geometry3d = GetGeometry3D(t); - assert(geometry3d!=NULL); - - curModifiedTime = geometry3d->GetMTime(); - if(maxModifiedTime < curModifiedTime) - maxModifiedTime = curModifiedTime; - - const TimeBounds & curTimeBounds = geometry3d->GetTimeBounds(); - if((curTimeBounds[0] > stmin) && (curTimeBounds[0] < timeBounds[0])) - timeBounds[0] = curTimeBounds[0]; - if((curTimeBounds[1] < stmax) && (curTimeBounds[1] > timeBounds[1])) - timeBounds[1] = curTimeBounds[1]; - - nextBoundingBox = geometry3d->GetBoundingBox(); - assert(nextBoundingBox.IsNotNull()); - - // Only respect non-zero BBes - if (nextBoundingBox->GetBounds() == itkBoundsZero) - { - continue; - } - - const mitk::BoundingBox::PointsContainer * nextPoints = nextBoundingBox->GetPoints(); - if(nextPoints!=NULL) - { - mitk::BoundingBox::PointsContainer::ConstIterator pointsIt = nextPoints->Begin(); - - while (pointsIt != nextPoints->End() ) - { - pointscontainer->InsertElement( pointid++, pointsIt->Value()); - ++pointsIt; - } - } - } - - if(!(timeBounds[0] < stmax)) - { - timeBounds[0] = stmin; - timeBounds[1] = stmax; - } - - m_TimeBounds = timeBounds; - assert(timeBounds[0]<=timeBounds[1]); - - boundingBox->SetPoints(pointscontainer); - - boundingBox->ComputeBoundingBox(); - - m_BoundingBox = boundingBox; - - SetIndexToWorldTransform(GetGeometry3D(0)->GetIndexToWorldTransform()); - - if(this->GetMTime() < maxModifiedTime) - Modified(); -} - -mitk::Geometry3D* mitk::TimeSlicedGeometry::GetGeometry3D(int t) const -{ - mitk::Geometry3D::Pointer geometry3d = NULL; - if(IsValidTime(t)) - { - geometry3d = m_Geometry3Ds[t]; - //if (a) we don't have a Geometry3D stored for the requested time, - //(b) m_EvenlyTimed is activated and (c) the first geometry (t=0) - //is set, then we clone the geometry and set the m_TimeBounds accordingly. - if((m_EvenlyTimed) && (geometry3d.IsNull())) - { - const Geometry3D* firstgeometry=m_Geometry3Ds[0].GetPointer(); - - assert(firstgeometry != NULL); - - mitk::Geometry3D::Pointer requestedgeometry; - requestedgeometry = dynamic_cast(firstgeometry->Clone().GetPointer()); - if ( requestedgeometry.IsNull() ) itkExceptionMacro("Geometry is NULL!"); - - TimeBounds timebounds = requestedgeometry->GetTimeBounds(); - if(timebounds[1]SetTimeBounds(timebounds); - } - - geometry3d = requestedgeometry; - m_Geometry3Ds[t] = geometry3d; - } - } - else - return NULL; - return geometry3d; -} - -bool mitk::TimeSlicedGeometry::SetGeometry3D(mitk::Geometry3D* geometry3D, int t) -{ - if(IsValidTime(t)) - { - m_Geometry3Ds[t]=geometry3D; - return true; - } - return false; -} - -int mitk::TimeSlicedGeometry::MSToTimeStep(mitk::ScalarType time_in_ms) const -{ - if(time_in_ms < m_TimeBounds[0]) - return -1; - if(time_in_ms >= m_TimeBounds[1]) - return m_TimeSteps; - if(m_EvenlyTimed) - { - if(m_TimeBounds[0] == m_TimeBounds[1]) - return 0; - if((m_TimeBounds[0]>ScalarTypeNumericTraits::NonpositiveMin()) && (m_TimeBounds[1]GetTimeBounds(); - if( (timeBounds[0] <= time_in_ms) && (time_in_ms <= timeBounds[1]) ) - { - return t; - } - } - } - return 0; -} - -mitk::ScalarType mitk::TimeSlicedGeometry::TimeStepToMS(int timestep) const -{ - if(IsValidTime(timestep)==false) - return ScalarTypeNumericTraits::max(); - if(m_EvenlyTimed) - { - if ( timestep == 0 ) - return m_TimeBounds[0]; - else - { - assert( ! (m_TimeBounds[0] == ScalarTypeNumericTraits::NonpositiveMin() && m_TimeBounds[1] == ScalarTypeNumericTraits::max() ) ); - return ((mitk::ScalarType)timestep)/m_TimeSteps*(m_TimeBounds[1]-m_TimeBounds[0])+m_TimeBounds[0]; - } - } - else - { - return GetGeometry3D(timestep)->GetTimeBounds()[0]; - } -} - -int mitk::TimeSlicedGeometry::TimeStepToTimeStep( - const mitk::TimeSlicedGeometry *referenceGeometry, int t) const -{ - int timeStep; - if ( referenceGeometry->GetTimeSteps() > 1 ) - { - // referenceGeometry is nD+t - timeStep = this->MSToTimeStep( referenceGeometry->TimeStepToMS( t ) ); - } - else - { - // referenceGEometry is nD (only one time step) - timeStep = 0; - } - - return timeStep; -} - - -void mitk::TimeSlicedGeometry::InitializeEvenlyTimed(unsigned int timeSteps) -{ - Geometry3D::Pointer geometry3D = Geometry3D::New(); - geometry3D->Initialize(); - InitializeEvenlyTimed(geometry3D, timeSteps); -} - -void mitk::TimeSlicedGeometry::InitializeEvenlyTimed(mitk::Geometry3D* geometry3D, unsigned int timeSteps) -{ - assert(geometry3D!=NULL); - - geometry3D->Register(); - - InitializeEmpty(timeSteps); - - AffineTransform3D::Pointer transform = AffineTransform3D::New(); - transform->SetMatrix(geometry3D->GetIndexToWorldTransform()->GetMatrix()); - transform->SetOffset(geometry3D->GetIndexToWorldTransform()->GetOffset()); - SetIndexToWorldTransform(transform); - - SetBounds(geometry3D->GetBounds()); - SetGeometry3D(geometry3D, 0); - SetEvenlyTimed(); - - UpdateInformation(); - - SetFrameOfReferenceID(geometry3D->GetFrameOfReferenceID()); - SetImageGeometry(geometry3D->GetImageGeometry()); - - geometry3D->UnRegister(); -} - -void mitk::TimeSlicedGeometry::InitializeEmpty(unsigned int timeSteps) -{ - m_IndexToWorldTransform = NULL; - - Superclass::Initialize(); - - m_TimeSteps = timeSteps; - - // initialize with empty geometries - Geometry3D::Pointer gnull=NULL; - m_Geometry3Ds.assign(m_TimeSteps, gnull); -} - -void mitk::TimeSlicedGeometry::ExpandToNumberOfTimeSteps( unsigned int timeSteps ) -{ - if( timeSteps <= m_TimeSteps ) return; - - if(m_TimeSteps == 1) - { - Geometry3D* g3d = m_Geometry3Ds[0]; - const TimeBounds & timeBounds = g3d->GetTimeBounds(); - if( (timeBounds[0] == ScalarTypeNumericTraits::NonpositiveMin()) || - (timeBounds[1]==ScalarTypeNumericTraits::max()) - ) - { - mitk::ScalarType timeBounds[] = {0.0, 1.0}; - m_Geometry3Ds[0]->SetTimeBounds( timeBounds ); - } - } - - // Expand to Number of time steps; initialize with empty geometries - Geometry3D::Pointer gnull=NULL; - m_Geometry3Ds.resize(timeSteps, gnull); - - m_TimeSteps = timeSteps; - - UpdateInformation(); -} - -mitk::TimeSlicedGeometry::TimeSlicedGeometry() : m_TimeSteps(0), m_EvenlyTimed(false) -{ -} - -mitk::TimeSlicedGeometry::TimeSlicedGeometry(const TimeSlicedGeometry& other) : Geometry3D(other), m_TimeSteps(other.m_TimeSteps), m_EvenlyTimed(other.m_EvenlyTimed) -{ - m_Geometry3Ds.resize(m_TimeSteps); - unsigned int t; - for(t=0; t(other.m_Geometry3Ds[t]->Clone().GetPointer()), t); - } - } -} - -mitk::TimeSlicedGeometry::~TimeSlicedGeometry() -{ - -} - -void mitk::TimeSlicedGeometry::SetImageGeometry(const bool isAnImageGeometry) -{ - Superclass::SetImageGeometry(isAnImageGeometry); - - mitk::Geometry3D* geometry3d; - unsigned int t; - for(t=0; tSetImageGeometry(isAnImageGeometry); - } -} - - -void mitk::TimeSlicedGeometry::ChangeImageGeometryConsideringOriginOffset(const bool isAnImageGeometry) -{ - mitk::Geometry3D* geometry3d; - unsigned int t; - for(t=0; tChangeImageGeometryConsideringOriginOffset(isAnImageGeometry); - } - - Superclass::ChangeImageGeometryConsideringOriginOffset(isAnImageGeometry); -} - - -void mitk::TimeSlicedGeometry::SetEvenlyTimed(bool on) -{ - m_EvenlyTimed = on; - Modified(); -} - -bool mitk::TimeSlicedGeometry::IsValidTime(int t) const -{ - return (t>=0) && (t< (int)m_TimeSteps); -} - -bool mitk::TimeSlicedGeometry::IsValid() const -{ - return Superclass::IsValid() && (m_TimeSteps > 0); -} - - -void mitk::TimeSlicedGeometry::CopyTimes(const mitk::TimeSlicedGeometry* timeslicedgeometry, unsigned int t, unsigned int endtimeindex) -{ - if(endtimeindex >= timeslicedgeometry->GetTimeSteps()) - endtimeindex = timeslicedgeometry->GetTimeSteps()-1; - if(endtimeindex >= this->GetTimeSteps()) - endtimeindex = this->GetTimeSteps()-1; - for(; t <= endtimeindex; ++t) - { - mitk::Geometry3D* geometry3d = GetGeometry3D(t); - mitk::Geometry3D* othergeometry3d = timeslicedgeometry->GetGeometry3D(t); - assert((geometry3d!=NULL) && (othergeometry3d!=NULL)); - - geometry3d->SetTimeBounds(othergeometry3d->GetTimeBounds()); - - } - - UpdateInformation(); -} - -mitk::AffineGeometryFrame3D::Pointer mitk::TimeSlicedGeometry::Clone() const -{ - Self::Pointer newGeometry = new TimeSlicedGeometry(*this); - newGeometry->UnRegister(); - return newGeometry.GetPointer(); -} - - - -void mitk::TimeSlicedGeometry::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - //Superclass::PrintSelf(os,indent); - os << indent << " EvenlyTimed: " << m_EvenlyTimed << std::endl; - os << indent << " TimeSteps: " << m_TimeSteps << std::endl; - - os << std::endl; - os << indent << " GetGeometry3D(0): "; - if(GetGeometry3D(0)==NULL) - os << "NULL" << std::endl; - else - GetGeometry3D(0)->Print(os, indent); -} - -void mitk::TimeSlicedGeometry::ExecuteOperation(Operation* operation) -{ - // reach through to all time steps - for (std::vector::iterator iter = m_Geometry3Ds.begin(); - iter != m_Geometry3Ds.end(); - ++iter) - { - (*iter)->ExecuteOperation(operation); - } - - Geometry3D::ExecuteOperation(operation); - - this->Modified(); -} - diff --git a/Core/Code/DataManagement/mitkTimeSlicedGeometry.h b/Core/Code/DataManagement/mitkTimeSlicedGeometry.h deleted file mode 100644 index 1de4988cf4..0000000000 --- a/Core/Code/DataManagement/mitkTimeSlicedGeometry.h +++ /dev/null @@ -1,182 +0,0 @@ -/*=================================================================== - -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 TIMESLICEDGEOMETRY_H_HEADER_INCLUDED_C1EBD0AD -#define TIMESLICEDGEOMETRY_H_HEADER_INCLUDED_C1EBD0AD - -#include "mitkGeometry3D.h" - -namespace mitk { - -//##Documentation -//## @brief Describes a geometry consisting of several geometries which -//## exist at different times. -//## -//## The geometry contains m_TimeSteps geometries, which can be accessed -//## using GetGeometry3D(int t). To convert between world-time in -//## milliseconds and the integer timestep-number use MSToTimeStep. -//## The hull (in space and time) of the TimeSlicedGeometry contains all -//## contained geometries. -//## @warning The hull (i.e., transform, bounding-box and -//## time-bounds) is only guaranteed to be up-to-date after calling -//## UpdateInformation(). -//## -//## TimeSlicedGeometry and the associated Geometry3Ds have to be -//## initialized in the method GenerateOutputInformation() of BaseProcess (or -//## CopyInformation/ UpdateOutputInformation of BaseData, if possible, e.g., -//## by analyzing pic tags in Image) subclasses. See also -//## itk::ProcessObject::GenerateOutputInformation(), -//## itk::DataObject::CopyInformation() and -//## itk::DataObject::UpdateOutputInformation(). -//## -//## @ingroup Geometry -class MITK_CORE_EXPORT TimeSlicedGeometry : public Geometry3D -{ -public: - mitkClassMacro(TimeSlicedGeometry, Geometry3D); - - itkNewMacro(Self); - - //##Documentation - //## @brief Re-calculate the hull of the contained geometries. - //## - //## The transforms, bounding-box and time-bounds of this - //## geometry (stored in members of the super-class Geometry3D) - //## are re-calculated from the contained geometries. - void UpdateInformation(); - - //##Documentation - //## @brief Get the number of time-steps - itkGetConstMacro(TimeSteps, unsigned int); - - //##Documentation - //## @brief Set/Get whether the TimeSlicedGeometry is evenly-timed (m_EvenlyTimed) - //## - //## If (a) we don't have a Geometry3D stored for the requested time, - //## (b) m_EvenlyTimed is activated and (c) the first geometry (t=0) - //## is set, then we clone the geometry and set the m_TimeBounds accordingly. - //## \sa GetGeometry3D - itkGetConstMacro(EvenlyTimed, bool); - virtual void SetEvenlyTimed(bool on = true); - - //##Documentation - //## @brief Set the Geometry3D for time @a t - virtual bool SetGeometry3D(mitk::Geometry3D* geometry3D, int t); - - //##Documentation - //## @brief When switching from an Image Geometry to a normal Geometry (and the other way around), you have to change the origin as well (See Geometry Documentation)! This function will change the "isImageGeometry" bool flag and changes the origin respectively. - virtual void ChangeImageGeometryConsideringOriginOffset( const bool isAnImageGeometry ); - - //##Documentation - //## @brief Get the Geometry3D at time @a t - virtual mitk::Geometry3D* GetGeometry3D(int t) const; - - //##Documentation - //## @brief Test whether @a t is a valid time step - virtual bool IsValidTime(int t) const; - - //##Documentation - //## @brief Returns true if TimeSliceGeometry is valid - virtual bool IsValid() const; - - //##Documentation - //## @brief Convert time in ms to a time step - virtual int MSToTimeStep(mitk::ScalarType time_in_ms) const; - - //##Documentation - //## @brief Convert time step to time in ms - virtual mitk::ScalarType TimeStepToMS(int timestep) const; - - //##Documentation - //## @brief Convert time step in the reference TimeSlicedGeometry to time step - //## in this TimeSlicedGeometry. - virtual int TimeStepToTimeStep(const mitk::TimeSlicedGeometry *referenceGeometry, int t) const; - - //##Documentation - //## @brief Completely initialize this instance as evenly-timed with - //## \a timeSteps geometries of type Geometry3D, each initialized by - //## Geometry3D::Initialize(). - virtual void InitializeEvenlyTimed(unsigned int timeSteps); - - //##Documentation - //## @brief Completely initialize this instance as evenly-timed with - //## \a timeSteps geometries identical to the provided Geometry3D - //## except for the time bounds - virtual void InitializeEvenlyTimed(mitk::Geometry3D* geometry3D, unsigned int timeSteps); - - //##Documentation - //## @brief Initialize this instance to contain \a timeSteps - //## geometries, but without setting them yet - virtual void InitializeEmpty(unsigned int timeSteps); - - //##Documentation - //## @brief Expand the number of time steps contained - //## to \a timeSteps. - //## - //## New, additional time steps will be initialized empty. - //## Only enlargement of the time steps vector is intended and possible. - virtual void ExpandToNumberOfTimeSteps( unsigned int timeSteps ); - - virtual void SetImageGeometry(const bool isAnImageGeometry); - - //##Documentation - //## @brief Copy the m_TimeBounds of the geometries contained - //## in timeslicedgeometry into the geometries contained in this - //## TimeSlicedGeometry object. - //## - //## Useful for initialization of the TimeSlicedGeometry of the - //## output in GenerateOutputInformation() methods of process objects, - //## see for example BoundingObjectCutter::GenerateOutputInformation(). - //## @param t start time index - //## @param endtimeindex (endtimeindex) is the time index of - //## the last geometry whose time-bounds are copied. If - //## timeslicedgeometry or this TimeSlicedGeometry object does - //## not contain enough geometries, endtimeindex is reduced - //## appropriately. - void CopyTimes(const mitk::TimeSlicedGeometry* timeslicedgeometry, unsigned int t=0, unsigned int endtimeindex = itk::NumericTraits::max()); - - //##Documentation - //## @brief duplicates the geometry - virtual AffineGeometryFrame3D::Pointer Clone() const; - // muellerm, 18.1.13, method not implemented - //TimeSlicedGeometry::Pointer CloneCopy() const; - virtual void ExecuteOperation(Operation* operation); -protected: - TimeSlicedGeometry(); - TimeSlicedGeometry(const TimeSlicedGeometry& other); - - virtual ~TimeSlicedGeometry(); - - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; - - mutable std::vector m_Geometry3Ds; - - //##Documentation - //## @brief Number of time steps - unsigned int m_TimeSteps; - - //##Documentation - //## @brief \a true in case the time steps have equal length - bool m_EvenlyTimed; - - static const std::string EVENLY_TIMED; - static const std::string TIME_STEPS; -}; - -} // namespace mitk - -#endif /* TIMESLICEDGEOMETRY_H_HEADER_INCLUDED_C1EBD0AD */ diff --git a/Core/Code/Testing/files.cmake b/Core/Code/Testing/files.cmake index 6ce2f66ba9..b23972a029 100644 --- a/Core/Code/Testing/files.cmake +++ b/Core/Code/Testing/files.cmake @@ -1,145 +1,144 @@ # tests with no extra command line parameter set(MODULE_TESTS mitkAccessByItkTest.cpp mitkCoreObjectFactoryTest.cpp mitkMaterialTest.cpp mitkActionTest.cpp mitkDispatcherTest.cpp mitkEnumerationPropertyTest.cpp mitkEventTest.cpp #mitkEventConfigTest.cpp ## needs to be re-written, test indirect since EventConfig is no longer exported as interface Bug 14529 mitkFocusManagerTest.cpp mitkGenericPropertyTest.cpp mitkGeometry3DTest.cpp mitkGeometryDataToSurfaceFilterTest.cpp mitkGlobalInteractionTest.cpp mitkImageDataItemTest.cpp #mitkImageMapper2DTest.cpp mitkImageGeneratorTest.cpp mitkBaseDataTest.cpp #mitkImageToItkTest.cpp mitkInstantiateAccessFunctionTest.cpp mitkInteractorTest.cpp mitkInteractionEventTest.cpp mitkITKThreadingTest.cpp mitkLevelWindowTest.cpp mitkMessageTest.cpp #mitkPipelineSmartPointerCorrectnessTest.cpp mitkPixelTypeTest.cpp mitkPlaneGeometryTest.cpp mitkPointSetFileIOTest.cpp mitkPointSetTest.cpp mitkPointSetWriterTest.cpp mitkPointSetReaderTest.cpp mitkPointSetInteractorTest.cpp mitkPropertyTest.cpp mitkPropertyListTest.cpp #mitkRegistrationBaseTest.cpp #mitkSegmentationInterpolationTest.cpp mitkSlicedGeometry3DTest.cpp mitkSliceNavigationControllerTest.cpp mitkStateMachineTest.cpp ##mitkStateMachineContainerTest.cpp ## rewrite test, indirect since no longer exported Bug 14529 mitkStateTest.cpp mitkSurfaceTest.cpp mitkSurfaceToSurfaceFilterTest.cpp - mitkTimeSlicedGeometryTest.cpp mitkTransitionTest.cpp mitkUndoControllerTest.cpp mitkVtkWidgetRenderingTest.cpp mitkVerboseLimitedLinearUndoTest.cpp mitkWeakPointerTest.cpp mitkTransferFunctionTest.cpp #mitkAbstractTransformGeometryTest.cpp mitkStepperTest.cpp itkTotalVariationDenoisingImageFilterTest.cpp mitkRenderingManagerTest.cpp vtkMitkThickSlicesFilterTest.cpp mitkNodePredicateSourceTest.cpp mitkVectorTest.cpp mitkClippedSurfaceBoundsCalculatorTest.cpp #QmitkRenderingTestHelper.cpp mitkExceptionTest.cpp mitkExtractSliceFilterTest.cpp mitkLogTest.cpp mitkImageDimensionConverterTest.cpp mitkLoggingAdapterTest.cpp mitkUIDGeneratorTest.cpp mitkShaderRepositoryTest.cpp ) # test with image filename as an extra command line parameter set(MODULE_IMAGE_TESTS mitkPlanePositionManagerTest.cpp mitkSurfaceVtkWriterTest.cpp #mitkImageSliceSelectorTest.cpp mitkImageTimeSelectorTest.cpp # mitkVtkPropRendererTest.cpp mitkDataNodeFactoryTest.cpp #mitkSTLFileReaderTest.cpp mitkImageAccessorTest.cpp ) # list of images for which the tests are run set(MODULE_TESTIMAGES # Pic-Factory no more available in Core, test images now in .nrrd format US4DCyl.nrrd Pic3D.nrrd Pic2DplusT.nrrd BallBinary30x30x30.nrrd binary.stl ball.stl ) set(MODULE_CUSTOM_TESTS #mitkLabeledImageToSurfaceFilterTest.cpp #mitkExternalToolsTest.cpp mitkDataStorageTest.cpp mitkDataNodeTest.cpp mitkDicomSeriesReaderTest.cpp mitkDICOMLocaleTest.cpp mitkEventMapperTest.cpp mitkNodeDependentPointSetInteractorTest.cpp mitkStateMachineFactoryTest.cpp mitkPointSetLocaleTest.cpp mitkImageTest.cpp mitkImageWriterTest.cpp mitkImageVtkMapper2DTest.cpp mitkImageVtkMapper2DLevelWindowTest.cpp mitkImageVtkMapper2DOpacityTest.cpp mitkImageVtkMapper2DColorTest.cpp mitkImageVtkMapper2DSwivelTest.cpp mitkImageVtkMapper2DTransferFunctionTest.cpp mitkIOUtilTest.cpp mitkSurfaceVtkMapper3DTest mitkSurfaceVtkMapper3DTexturedSphereTest.cpp mitkVolumeCalculatorTest.cpp mitkLevelWindowManagerTest.cpp ) set(MODULE_RESOURCE_FILES Interactions/AddAndRemovePoints.xml Interactions/globalConfig.xml Interactions/StatemachineTest.xml Interactions/StatemachineConfigTest.xml ) # Create an artificial module initializing class for # the usServiceListenerTest.cpp usFunctionGenerateModuleInit(testdriver_init_file NAME ${MODULE_NAME}TestDriver DEPENDS "Mitk" VERSION "0.1.0" EXECUTABLE ) # Embed the resources set(testdriver_resources ) usFunctionEmbedResources(testdriver_resources EXECUTABLE_NAME ${MODULE_NAME}TestDriver ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Resources FILES ${MODULE_RESOURCE_FILES} ) set(TEST_CPP_FILES ${testdriver_init_file} ${testdriver_resources}) diff --git a/Core/Code/Testing/mitkTimeSlicedGeometryTest.cpp b/Core/Code/Testing/mitkTimeSlicedGeometryTest.cpp deleted file mode 100644 index 2c619ab331..0000000000 --- a/Core/Code/Testing/mitkTimeSlicedGeometryTest.cpp +++ /dev/null @@ -1,453 +0,0 @@ -/*=================================================================== - -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 "mitkImage.h" -#include "mitkPlaneGeometry.h" -#include "mitkTimeSlicedGeometry.h" -#include "mitkSlicedGeometry3D.h" -#include "mitkGeometry2D.h" -#include "mitkTestingMacros.h" - -#include -#include - -#include - - -void mitkTimeSlicedGeometry_ChangeImageGeometryConsideringOriginOffset_Test() -{ - // additional tests to check the function ChangeImageGeometryConsideringOriginOffset(..) - - //first create a new timeslicedgeometry - mitk::TimeSlicedGeometry::Pointer geoTime = mitk::TimeSlicedGeometry::New(); - mitk::Geometry3D::Pointer geo3d = mitk::Geometry3D::New(); - geo3d->Initialize(); - int numOfTimeSteps = 5; - geoTime->InitializeEvenlyTimed(geo3d, numOfTimeSteps); - - for (int i=0; i < numOfTimeSteps; i++) - { - mitk::Geometry3D::Pointer geo3d_sub = mitk::Geometry3D::New(); - geo3d_sub->Initialize(); - geoTime->SetGeometry3D(geo3d_sub, i); - } - - MITK_TEST_OUTPUT( << "Testing whether geoTime->GetImageGeometry() is false by default"); - MITK_TEST_CONDITION_REQUIRED( geoTime->GetImageGeometry()==false, ""); - MITK_TEST_OUTPUT( << "Testing whether first and last geometry in the geoTime have GetImageGeometry()==false by default"); - mitk::Geometry3D* subSliceGeo3D_first = geoTime->GetGeometry3D(0); - mitk::Geometry3D* subSliceGeo3D_last = geoTime->GetGeometry3D(numOfTimeSteps-1); - MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_first->GetImageGeometry()==false, ""); - MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_last->GetImageGeometry()==false, ""); - - // Save some Origins and cornerpoints - mitk::Point3D OriginTimeGeo( geoTime->GetOrigin() ); - mitk::Point3D OriginFirstGeo( subSliceGeo3D_first->GetOrigin() ); - mitk::Point3D OriginLastGeo( subSliceGeo3D_last->GetOrigin() ); - mitk::Point3D CornerPoint0TimeGeo(geoTime->GetCornerPoint(0)); - mitk::Point3D CornerPoint1FirstGeo(subSliceGeo3D_first->GetCornerPoint(1)); - mitk::Point3D CornerPoint2LastGeo(subSliceGeo3D_last->GetCornerPoint(2)); - - //std::cout << "vorher Origin: " << subSliceGeo3D_first->GetOrigin() << std::endl; - //std::cout << "vorher Corner: " << subSliceGeo3D_first->GetCornerPoint(0) << std::endl; - MITK_TEST_OUTPUT( << "Calling geoTime->ChangeImageGeometryConsideringOriginOffset(true)"); - geoTime->ChangeImageGeometryConsideringOriginOffset(true); - //std::cout << "nachher Origin: " << subSliceGeo3D_first->GetOrigin() << std::endl; - //std::cout << "nachher Corner: " << subSliceGeo3D_first->GetCornerPoint(0) << std::endl; - - MITK_TEST_OUTPUT( << "Testing whether geoTime->GetImageGeometry() is now true"); - MITK_TEST_CONDITION_REQUIRED( geoTime->GetImageGeometry()==true, ""); - MITK_TEST_OUTPUT( << "Testing whether first and last geometry in the SlicedGeometry3D have GetImageGeometry()==true now"); - MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_first->GetImageGeometry()==true, ""); - MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_last->GetImageGeometry()==true, ""); - - MITK_TEST_OUTPUT( << "Testing wether offset has been added to origins"); - // Manually adding Offset. - OriginTimeGeo[0] += (geoTime->GetSpacing()[0]) / 2; - OriginTimeGeo[1] += (geoTime->GetSpacing()[1]) / 2; - OriginTimeGeo[2] += (geoTime->GetSpacing()[2]) / 2; - OriginFirstGeo[0] += (subSliceGeo3D_first->GetSpacing()[0]) / 2; - OriginFirstGeo[1] += (subSliceGeo3D_first->GetSpacing()[1]) / 2; - OriginFirstGeo[2] += (subSliceGeo3D_first->GetSpacing()[2]) / 2; - OriginLastGeo[0] += (subSliceGeo3D_last->GetSpacing()[0]) / 2; - OriginLastGeo[1] += (subSliceGeo3D_last->GetSpacing()[1]) / 2; - OriginLastGeo[2] += (subSliceGeo3D_last->GetSpacing()[2]) / 2; - MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_first->GetCornerPoint(1)==CornerPoint1FirstGeo, ""); - MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_last->GetCornerPoint(2)==CornerPoint2LastGeo, ""); - MITK_TEST_CONDITION_REQUIRED( geoTime->GetCornerPoint(0)==CornerPoint0TimeGeo, ""); - MITK_TEST_CONDITION_REQUIRED( geoTime->GetOrigin()==OriginTimeGeo, ""); - MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_first->GetOrigin()==OriginFirstGeo, ""); - MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_last->GetOrigin()==OriginLastGeo, ""); - - - MITK_TEST_OUTPUT( << "Calling geoTime->ChangeImageGeometryConsideringOriginOffset(false)"); - geoTime->ChangeImageGeometryConsideringOriginOffset(false); - MITK_TEST_OUTPUT( << "Testing whether geoTime->GetImageGeometry() is now false"); - MITK_TEST_CONDITION_REQUIRED( geoTime->GetImageGeometry()==false, ""); - MITK_TEST_OUTPUT( << "Testing whether first and last geometry in the geoTime have GetImageGeometry()==false now"); - MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_first->GetImageGeometry()==false, ""); - MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_last->GetImageGeometry()==false, ""); - - MITK_TEST_OUTPUT( << "Testing wether offset has been added to origins"); - // Manually substracting Offset. - OriginTimeGeo[0] -= (geoTime->GetSpacing()[0]) / 2; - OriginTimeGeo[1] -= (geoTime->GetSpacing()[1]) / 2; - OriginTimeGeo[2] -= (geoTime->GetSpacing()[2]) / 2; - OriginFirstGeo[0] -= (subSliceGeo3D_first->GetSpacing()[0]) / 2; - OriginFirstGeo[1] -= (subSliceGeo3D_first->GetSpacing()[1]) / 2; - OriginFirstGeo[2] -= (subSliceGeo3D_first->GetSpacing()[2]) / 2; - OriginLastGeo[0] -= (subSliceGeo3D_last->GetSpacing()[0]) / 2; - OriginLastGeo[1] -= (subSliceGeo3D_last->GetSpacing()[1]) / 2; - OriginLastGeo[2] -= (subSliceGeo3D_last->GetSpacing()[2]) / 2; - MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_first->GetCornerPoint(1)==CornerPoint1FirstGeo, ""); - MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_last->GetCornerPoint(2)==CornerPoint2LastGeo, ""); - MITK_TEST_CONDITION_REQUIRED( geoTime->GetCornerPoint(0)==CornerPoint0TimeGeo, ""); - MITK_TEST_CONDITION_REQUIRED( geoTime->GetOrigin()==OriginTimeGeo, ""); - MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_first->GetOrigin()==OriginFirstGeo, ""); - MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_last->GetOrigin()==OriginLastGeo, ""); - -} - - -int mitkTimeSlicedGeometryTest(int /*argc*/, char* /*argv*/[]) -{ - mitk::PlaneGeometry::Pointer planegeometry = mitk::PlaneGeometry::New(); - - mitk::Point3D origin; - mitk::Vector3D right, bottom, normal; - mitk::ScalarType width, height; - mitk::ScalarType widthInMM, heightInMM, thicknessInMM; - - width = 100; widthInMM = width*0.5; - height = 200; heightInMM = height*1.2; - thicknessInMM = 1.5; - mitk::FillVector3D(origin, 2.5, -3.3, 17.2); - mitk::FillVector3D(right, widthInMM, 0, 0); - mitk::FillVector3D(bottom, 0, heightInMM, 0); - mitk::FillVector3D(normal, 0, 0, thicknessInMM); - - - std::cout << "Creating TimeSlicedGeometry" <InitializeEvenlyTimed(numOfTimeSteps); - std::cout<<"[PASSED]"<GetTimeSteps()!=numOfTimeSteps) - { - std::cout<<"[FAILED]"<GetEvenlyTimed()!=true) - { - std::cout<<"[FAILED]"<InitializeStandardPlane(right.Get_vnl_vector(), bottom.Get_vnl_vector()); - std::cout<<"[PASSED]"<SetTimeBounds(timeBounds1); - std::cout<<"[PASSED]"<GetTimeBounds() != timeBounds1) - { - std::cout<<"[FAILED]"<InitializeEvenlyTimed(planegeometry, numOfTimeSteps); - std::cout<<"[PASSED]"<GetTimeSteps() != numOfTimeSteps) - { - std::cout<<"[FAILED]"<GetEvenlyTimed()!=true) - { - std::cout<<"[FAILED]"<TimeStepToMS( 2 ) - 3.5) > mitk::eps) - { - std::cout<<"[FAILED]"<MSToTimeStep( 3.6 ) != 2) - { - std::cout<<"[FAILED]"<Initialize(); - geometry->SetTimeBounds( timeBounds ); - timeSlicedGeometry->InitializeEvenlyTimed( geometry, numOfTimeSteps+1 ); - - if(timeSlicedGeometry2->TimeStepToTimeStep( timeSlicedGeometry, 4 ) != 2) - { - std::cout<<"[FAILED]"<(timeSlicedGeometry2->GetGeometry3D(0)); - if(accessedplanegeometry==NULL) - { - std::cout<<"[FAILED]"<GetAxisVector(0), planegeometry->GetAxisVector(0))==false) || - (mitk::Equal(accessedplanegeometry->GetAxisVector(1), planegeometry->GetAxisVector(1))==false) || - (mitk::Equal(accessedplanegeometry->GetAxisVector(2), planegeometry->GetAxisVector(2))==false) || - (mitk::Equal(accessedplanegeometry->GetOrigin(), planegeometry->GetOrigin())==false)) - { - std::cout<<"[FAILED]"<GetTimeBounds() ) - { - std::cout<<"[FAILED]"<(timeSlicedGeometry2->GetGeometry3D(1)); - if(secondplanegeometry==NULL) - { - std::cout<<"[FAILED]"<GetTimeBounds(); - if( (timeBounds1[1] != secondtimebounds[0]) || (secondtimebounds[1] != secondtimebounds[0] + timeBounds1[1]-timeBounds1[0]) ) - { - std::cout<<"[FAILED]"<GetAxisVector(0), planegeometry->GetAxisVector(0))==false) || - (mitk::Equal(secondplanegeometry->GetAxisVector(1), planegeometry->GetAxisVector(1))==false) || - (mitk::Equal(secondplanegeometry->GetAxisVector(2), planegeometry->GetAxisVector(2))==false) || - (mitk::Equal(secondplanegeometry->GetOrigin(), planegeometry->GetOrigin())==false)) - { - std::cout<<"[FAILED]"<InitializeEmpty(numOfTimeSteps); - - std::cout << "Testing TimeSlicedGeometry::GetEvenlyTimed():" <GetEvenlyTimed()!=false) - { - std::cout<<"[FAILED]"<SetEvenlyTimed(false); - std::cout<<"[PASSED]"<GetEvenlyTimed()!=false) - { - std::cout<<"[FAILED]"<GetTimeSteps() != numOfTimeSteps) - { - std::cout<<"[FAILED]"<GetGeometry3D(0); - if(accessedgeometry!=NULL) - { - std::cout<<"[FAILED]"<SetGeometry3D(planegeometry, 0); - std::cout<<"[PASSED]"<(timeSlicedGeometry2->GetGeometry3D(0)); - if(accessedplanegeometry==NULL) - { - std::cout<<"[FAILED]"<GetGeometry3D(1); - if(accessedgeometry!=NULL) - { - std::cout<<"[FAILED]"<(planegeometry->Clone().GetPointer());; - std::cout<<"[PASSED]"<SetTimeBounds(timeBounds3); - std::cout<<"[PASSED]"<SetGeometry3D(planegeometry2, 1); - std::cout<<"[PASSED]"<(timeSlicedGeometry2->GetGeometry3D(1)); - if(accessedplanegeometry==NULL) - { - std::cout<<"[FAILED]"<GetTimeBounds() ) - { - std::cout<<"[FAILED]"<