Index: Core/Code/Controllers/mitkSliceNavigationController.cpp =================================================================== --- Core/Code/Controllers/mitkSliceNavigationController.cpp (revision 24914) +++ Core/Code/Controllers/mitkSliceNavigationController.cpp (working copy) @@ -664,13 +664,13 @@ std::stringstream stream; - // get the position and gray value from the image and build up status bar text - mitk::Point3D p; + // get the position and gray value from the image and build up status bar text if(image3D.IsNotNull()) { + Index3D p; image3D->GetGeometry()->WorldToIndex(worldposition, p); stream<<"Position: <"< mm"; - stream<<"; Index: <"< "; + stream<<"; Index: <"< "; stream<<"; Time: " << baseRenderer->GetTime() << " ms; Pixelvalue: "<GetPixelValueByIndex(p, baseRenderer->GetTimeStep())<<" "; } else Index: Core/Code/DataManagement/mitkGeometry3D.cpp =================================================================== --- Core/Code/DataManagement/mitkGeometry3D.cpp (revision 24914) +++ Core/Code/DataManagement/mitkGeometry3D.cpp (working copy) @@ -142,15 +142,7 @@ void mitk::Geometry3D::IndexToWorld(const mitk::Point3D &pt_units, mitk::Point3D &pt_mm) const { - mitk::Point3D temp = pt_units; - if(m_ImageGeometry) - { - for (int i = 0; i < 3; i++) - { - temp[i] -= 0.5; - } - } - pt_mm = m_IndexToWorldTransform->TransformPoint(temp); + pt_mm = m_IndexToWorldTransform->TransformPoint(pt_units); } void mitk::Geometry3D::WorldToIndex(const mitk::Point3D &atPt3d_mm, const mitk::Vector3D &vec_mm, mitk::Vector3D &vec_units) const @@ -365,15 +357,6 @@ out[i] += inverse[i][j]*temp[j]; } } - - // Image index coordinates are edge-based - if(m_ImageGeometry) - { - for (i = 0; i < 3; i++) - { - out[i] += 0.5; - } - } } void mitk::Geometry3D::BackTransform(const mitk::Point3D &/*at*/, const mitk::Vector3D &in, mitk::Vector3D& out) const Index: Core/Code/DataManagement/mitkGeometry3D.h =================================================================== --- Core/Code/DataManagement/mitkGeometry3D.h (revision 24914) +++ Core/Code/DataManagement/mitkGeometry3D.h (working copy) @@ -58,16 +58,20 @@ //## GetBoundingBox() //## \li a transform to convert intrinsic coordinates into a //## world-coordinate system with coordinates in millimeters -//## and milliseconds (floating point values), to be accessed -//## by GetIndexToWorldTransform() +//## and milliseconds (all are floating point values), to +//## be accessed by GetIndexToWorldTransform() //## \li a life span, i.e. a bounding box in time in ms (with //## start and end time), to be accessed by GetTimeBounds(). -//## The default is The default is minus infinity to plus infinity. +//## The default is minus infinity to plus infinity. //## //## Geometry3D and its sub-classes allow converting between //## intrinsic coordinates (called index or unit coordinates) -//## and word-coordinates (called world or mm coordinates), +//## and world-coordinates (called world or mm coordinates), //## e.g. WorldToIndex. +//## In case you need integer index coordinates, provide an +//## mitk::Index3D (or itk::Index) as target variable to +//## WorldToIndex, otherwise you will get a continuous index +//## (floating point values). //## //## An important sub-class is SlicedGeometry3D, which descibes //## data objects consisting of slices, e.g., objects of type Image. @@ -248,7 +252,7 @@ //##Documentation //## @brief Translate the origin by a vector //## - virtual void Translate(const Vector3D & vector); + virtual void Translate(const Vector3D& vector); //##Documentation //## @brief Set the transform to identity @@ -291,32 +295,36 @@ } //##Documentation - //## @brief Convert world coordinates (in mm) of a \em point to index coordinates (in units) - void WorldToIndex(const mitk::Point3D &pt_mm, mitk::Point3D &pt_units) const; + //## @brief Convert world coordinates (in mm) of a \em point to (continuous!) index coordinates (in units) + //## \warning If you need integer index coordinates (e.g., for accessing a pixel in an image), + //## use WorldToIndex(const mitk::Point3D& pt_mm, itk::Index &index). + void WorldToIndex(const mitk::Point3D& pt_mm, mitk::Point3D& pt_units) const; //##Documentation //## @brief Convert index coordinates (in units) of a \em point to world coordinates (in mm) - void IndexToWorld(const mitk::Point3D &pt_units, mitk::Point3D &pt_mm) const; + void IndexToWorld(const mitk::Point3D& pt_units, mitk::Point3D& pt_mm) const; //##Documentation //## @brief Convert world coordinates (in mm) of a \em vector - //## \a vec_mm (at the point \a atPt3d_mm) to index coordinates (in units) - void WorldToIndex(const mitk::Point3D &atPt3d_mm, const mitk::Vector3D &vec_mm, mitk::Vector3D &vec_units) const; + //## \a vec_mm (at the point \a atPt3d_mm) to (continuous!) index coordinates (in units) + //## \warning If you need integer index coordinates (e.g., for accessing a pixel in an image), + //## use WorldToIndex(const mitk::Point3D& pt_mm, itk::Index &index). + void WorldToIndex(const mitk::Point3D& atPt3d_mm, const mitk::Vector3D& vec_mm, mitk::Vector3D& vec_units) const; //##Documentation //## @brief Convert index coordinates (in units) of a \em vector //## \a vec_units (at the point \a atPt3d_units) to world coordinates (in mm) - void IndexToWorld(const mitk::Point3D &atPt3d_units, const mitk::Vector3D &vec_units, mitk::Vector3D &vec_mm) const; + void IndexToWorld(const mitk::Point3D& atPt3d_units, const mitk::Vector3D& vec_units, mitk::Vector3D& vec_mm) const; //##Documentation //## @brief Convert world coordinates (in mm) of a \em point to index coordinates (in units). //## This method rounds to integer indices! template - void WorldToIndex(const mitk::Point3D &pt_mm, itk::Index &index) const + void WorldToIndex(const mitk::Point3D& pt_mm, itk::Index &index) const { typedef itk::Index IndexType; mitk::Point3D pt_units; - WorldToIndex(pt_mm, pt_units); + this->WorldToIndex(pt_mm, pt_units); int i, dim=index.GetIndexDimension(); if(dim>3) { @@ -324,17 +332,18 @@ dim=3; } for(i=0;i( pt_units[i] ); } } //##Documentation - //## @brief Convert world coordinates (in mm) of a \em point to + //## @brief Deprecated for use with ITK version 3.10 or newer. + //## Convert world coordinates (in mm) of a \em point to //## ITK physical coordinates (in mm, but without a possible rotation) //## //## This method is useful if you have want to access an mitk::Image - //## via an itk::Image. ITK does not support rotated (tilted) images, - //## i.e., ITK images are always parallel to the coordinate axes. + //## via an itk::Image. ITK v3.8 and older did not support rotated (tilted) + //## images, i.e., ITK images are always parallel to the coordinate axes. //## When accessing a (possibly rotated) mitk::Image via an itk::Image //## the rotational part of the transformation in the Geometry3D is //## simply discarded; in other word: only the origin and spacing is @@ -344,32 +353,41 @@ //## can be used with the ITK image as a ITK physical coordinate //## (excluding the rotation). template - void WorldToItkPhysicalPoint(const mitk::Point3D &pt_mm, + void WorldToItkPhysicalPoint(const mitk::Point3D& pt_mm, itk::Point& itkPhysicalPoint) const { - mitk::Point3D index; - WorldToIndex(pt_mm, index); - for (unsigned int i = 0 ; i < 3 ; i++) - { - itkPhysicalPoint[i] = static_cast( this->m_Spacing[i] * index[i] + this->m_Origin[i] ); - } + #if ((ITK_VERSION_MAJOR > 3) || (ITK_VERSION_MAJOR == 3 && ITK_VERSION_MINOR > 8)) + mitk::vtk2itk(pt_mm, itkPhysicalPoint); + #else + mitk::Point3D index; + WorldToIndex(pt_mm, index); + for (unsigned int i = 0 ; i < 3 ; i++) + { + itkPhysicalPoint[i] = static_cast( this->m_Spacing[i] * index[i] + this->m_Origin[i] ); + } + #endif } //##Documentation - //## @brief Convert ITK physical coordinates of a \em point (in mm, + //## @brief Deprecated for use with ITK version 3.10 or newer. + //## Convert ITK physical coordinates of a \em point (in mm, //## but without a rotation) into MITK world coordinates (in mm) //## - //## For more information, see WorldToItkPhysicalPoint + //## For more information, see WorldToItkPhysicalPoint. template void ItkPhysicalPointToWorld(const itk::Point& itkPhysicalPoint, - mitk::Point3D &pt_mm) const + mitk::Point3D& pt_mm) const { - mitk::Point3D index; - for (unsigned int i = 0 ; i < 3 ; i++) - { - index[i] = static_cast( (itkPhysicalPoint[i]- this->m_Origin[i]) / this->m_Spacing[i] ); - } - IndexToWorld(index, pt_mm); + #if ((ITK_VERSION_MAJOR > 3) || (ITK_VERSION_MAJOR == 3 && ITK_VERSION_MINOR > 8)) + mitk::vtk2itk(itkPhysicalPoint, pt_mm); + #else + mitk::Point3D index; + for (unsigned int i = 0 ; i < 3 ; i++) + { + index[i] = static_cast( (itkPhysicalPoint[i]- this->m_Origin[i]) / this->m_Spacing[i] ); + } + IndexToWorld(index, pt_mm); + #endif } //##Documentation @@ -571,8 +589,8 @@ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; - virtual void BackTransform(const mitk::Point3D &in, mitk::Point3D& out) const; - virtual void BackTransform(const mitk::Point3D &at, const mitk::Vector3D &in, mitk::Vector3D& out) const; + virtual void BackTransform(const mitk::Point3D& in, mitk::Point3D& out) const; + virtual void BackTransform(const mitk::Point3D& at, const mitk::Vector3D& in, mitk::Vector3D& out) const; //##Documentation //## @brief Set the parametric bounds Index: Core/Code/DataManagement/mitkImage.cpp =================================================================== --- Core/Code/DataManagement/mitkImage.cpp (revision 24914) +++ Core/Code/DataManagement/mitkImage.cpp (working copy) @@ -99,7 +99,30 @@ return m_CompleteData->GetData(); } -double mitk::Image::GetPixelValueByIndex(const mitk::Point3D &position, unsigned int timestep) +template +void AccessPixel(mitkIpPicDescriptor* pic, const mitk::Index3D& p, double& value, int timestep) +{ + if ( (p[0]>=0 && p[1] >=0 && p[2]>=0 && timestep>=0) && (unsigned int)p[0] < pic->n[0] && (unsigned int)p[1] < pic->n[1] && (unsigned int)p[2] < pic->n[2] && (unsigned int)timestep < pic->n[3] ) + { + if(pic->bpe!=24) + { + value = (double) (((T*) pic->data)[ p[0] + p[1]*pic->n[0] + p[2]*pic->n[0]*pic->n[1] + timestep*pic->n[0]*pic->n[1]*pic->n[2] ]); + } + else + { + double returnvalue = (((T*) pic->data)[p[0]*3 + 0 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 + timestep*pic->n[0]*pic->n[1]*pic->n[2]*3 ]); + returnvalue += (((T*) pic->data)[p[0]*3 + 1 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 + timestep*pic->n[0]*pic->n[1]*pic->n[2]*3]); + returnvalue += (((T*) pic->data)[p[0]*3 + 2 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 + timestep*pic->n[0]*pic->n[1]*pic->n[2]*3]); + value = returnvalue; + } + } + else + { + value = 0; + } +}; + +double mitk::Image::GetPixelValueByIndex(const mitk::Index3D &position, unsigned int timestep) { mitkIpPicDescriptor* pic = this->GetPic(); double value = 0; @@ -111,7 +134,7 @@ return value; } -double mitk::Image::GetPixelValueByWorldCoordinate(const mitk::Point3D &position, unsigned int timestep) +double mitk::Image::GetPixelValueByWorldCoordinate(const mitk::Point3D& position, unsigned int timestep) { mitkIpPicDescriptor* pic = this->GetPic(); double value = 0; @@ -120,13 +143,10 @@ timestep = this->GetTimeSteps(); } - itk::Index<3> itkIndex; + Index3D itkIndex; this->GetGeometry()->WorldToIndex(position,itkIndex); - Point3D mitkPointIndex; - mitkPointIndex[0]=itkIndex[0]; - mitkPointIndex[1]=itkIndex[1]; - mitkPointIndex[2]=itkIndex[2]; - mitkIpPicTypeMultiplex3(AccessPixel, pic, mitkPointIndex, value, timestep); + mitkIpPicTypeMultiplex3(AccessPixel, pic, itkIndex, value, timestep); + return value; } Index: Core/Code/DataManagement/mitkImage.h =================================================================== --- Core/Code/DataManagement/mitkImage.h (revision 24914) +++ Core/Code/DataManagement/mitkImage.h (working copy) @@ -54,9 +54,9 @@ //## For importing ITK images use of mitk::ITKImageImport is recommended, see //## \ref Adaptor. //## -//## Converting coordinates from the ITK physical coordinate system -//## (which does not support rotated images) to the MITK world coordinate -//## system should be performed via the Geometry3D of the Image, see +//## For ITK v3.8 and older: Converting coordinates from the ITK physical +//## coordinate system (which does not support rotated images) to the MITK world +//## coordinate system should be performed via the Geometry3D of the Image, see //## Geometry3D::WorldToItkPhysicalPoint. //## @ingroup Data class MITK_CORE_EXPORT Image : public SlicedData @@ -113,12 +113,12 @@ //## @brief Get the pixel value at one specific position. //## //## The pixel type is always being converted to double. - double GetPixelValueByIndex(const mitk::Point3D &position, unsigned int timestep = 0); + double GetPixelValueByIndex(const mitk::Index3D& position, unsigned int timestep = 0); //## @brief Get the pixel value at one specific world position. //## //## The pixel type is always being converted to double. - double GetPixelValueByWorldCoordinate(const mitk::Point3D &position, unsigned int timestep = 0); + double GetPixelValueByWorldCoordinate(const mitk::Point3D& position, unsigned int timestep = 0); //##Documentation //## @brief Get a volume at a specific time @a t of channel @a n as a vtkImageData. @@ -540,8 +540,6 @@ friend void _ComputeExtremaInItkImage(ItkImageType* itkImage, mitk::Image * mitkImage, int t); protected: - template - void AccessPixel(mitkIpPicDescriptor* pic, mitk::Point3D p, double& value, int timestep = 0); int GetSliceIndex(int s = 0, int t = 0, int n = 0) const; @@ -600,34 +598,6 @@ }; -//## @brief Get the pixel value at one specific position. -//## -//## The pixel type is always being converted to double. -template -void Image::AccessPixel(mitkIpPicDescriptor* pic, mitk::Point3D p, double& value, int timestep) -{ - itk::Point pi; - mitk::itk2vtk(p, pi); - if ( (pi[0]>=0 && pi[1] >=0 && pi[2]>=0 && timestep>=0) && (unsigned int)pi[0] < pic->n[0] && (unsigned int)pi[1] < pic->n[1] && (unsigned int)pi[2] < pic->n[2] && (unsigned int)timestep < pic->n[3] ) - { - if(pic->bpe!=24) - { - value = (double) (((T*) pic->data)[ pi[0] + pi[1]*pic->n[0] + pi[2]*pic->n[0]*pic->n[1] + timestep*pic->n[0]*pic->n[1]*pic->n[2] ]); - } - else - { - double returnvalue = (((T*) pic->data)[pi[0]*3 + 0 + pi[1]*pic->n[0]*3 + pi[2]*pic->n[0]*pic->n[1]*3 + timestep*pic->n[0]*pic->n[1]*pic->n[2]*3 ]); - returnvalue += (((T*) pic->data)[pi[0]*3 + 1 + pi[1]*pic->n[0]*3 + pi[2]*pic->n[0]*pic->n[1]*3 + timestep*pic->n[0]*pic->n[1]*pic->n[2]*3]); - returnvalue += (((T*) pic->data)[pi[0]*3 + 2 + pi[1]*pic->n[0]*3 + pi[2]*pic->n[0]*pic->n[1]*3 + timestep*pic->n[0]*pic->n[1]*pic->n[2]*3]); - value = returnvalue; - } - } - else - { - value = 0; - } -}; - //##Documentation //## @brief Cast an itk::Image (with a specific type) to an mitk::Image. //## Index: Core/Code/DataManagement/mitkPlaneGeometry.cpp =================================================================== --- Core/Code/DataManagement/mitkPlaneGeometry.cpp (revision 24914) +++ Core/Code/DataManagement/mitkPlaneGeometry.cpp (working copy) @@ -95,12 +95,6 @@ { pt_mm[0]=m_ScaleFactorMMPerUnitX*pt_units[0]; pt_mm[1]=m_ScaleFactorMMPerUnitY*pt_units[1]; - - if (m_ImageGeometry) - { - pt_mm[0]-=0.5; - pt_mm[1]-=0.5; - } } @@ -108,12 +102,6 @@ { pt_units[0]=pt_mm[0]*(1.0/m_ScaleFactorMMPerUnitX); pt_units[1]=pt_mm[1]*(1.0/m_ScaleFactorMMPerUnitY); - - if (m_ImageGeometry) - { - pt_units[0]+=0.5; - pt_units[1]+=0.5; - } } Index: Core/Code/DataManagement/mitkVector.h =================================================================== --- Core/Code/DataManagement/mitkVector.h (revision 24914) +++ Core/Code/DataManagement/mitkVector.h (working copy) @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -48,6 +49,8 @@ typedef itk::Point Point4I; typedef itk::Vector Vector2D; typedef itk::Vector Vector3D; +typedef itk::Index<3> Index3D; +typedef itk::ContinuousIndex ContinuousIndex3D; typedef vnl_quaternion Quaternion; //##Documentation Index: Core/Code/Testing/mitkGeometry3DTest.cpp =================================================================== --- Core/Code/Testing/mitkGeometry3DTest.cpp (revision 24914) +++ Core/Code/Testing/mitkGeometry3DTest.cpp (working copy) @@ -22,9 +22,9 @@ #include "mitkRotationOperation.h" #include "mitkInteractionConst.h" +#include #include "mitkTestingMacros.h" - #include bool testGetAxisVectorVariants(mitk::Geometry3D* geometry) @@ -65,8 +65,128 @@ return true; } -int mitkGeometry3DTest(int /*argc*/, char* /*argv*/[]) +// a part of the test requires axis-parallel coordinates +int testIndexAndWorldConsistency(mitk::Geometry3D* geometry3d) { + MITK_TEST_OUTPUT( << "Testing consistency of index and world coordinate systems: "); + mitk::Point3D origin = geometry3d->GetOrigin(); + mitk::Point3D dummy; + + MITK_TEST_OUTPUT( << " Testing index->world->index conversion consistency"); + geometry3d->WorldToIndex(origin, dummy); + geometry3d->IndexToWorld(dummy, dummy); + MITK_TEST_CONDITION_REQUIRED(dummy == origin, ""); + + MITK_TEST_OUTPUT( << " Testing WorldToIndex(origin, mitk::Point3D)==(0,0,0)"); + mitk::Point3D globalOrigin; + mitk::FillVector3D(globalOrigin, 0,0,0); + + mitk::Point3D originContinuousIndex; + geometry3d->WorldToIndex(origin, originContinuousIndex); + MITK_TEST_CONDITION_REQUIRED(originContinuousIndex == globalOrigin, ""); + + MITK_TEST_OUTPUT( << " Testing WorldToIndex(origin, itk::Index)==(0,0,0)"); + itk::Index<3> itkindex; + geometry3d->WorldToIndex(origin, itkindex); + itk::Index<3> globalOriginIndex; + mitk::vtk2itk(globalOrigin, globalOriginIndex); + MITK_TEST_CONDITION_REQUIRED(itkindex == globalOriginIndex, ""); + + MITK_TEST_OUTPUT( << " Testing WorldToIndex(origin-0.5*spacing, itk::Index)==(0,0,0)"); + mitk::Vector3D halfSpacingStep = geometry3d->GetSpacing()*0.5; + mitk::Matrix3D rotation; + mitk::Point3D originOffCenter = origin-halfSpacingStep; + geometry3d->WorldToIndex(originOffCenter, itkindex); + MITK_TEST_CONDITION_REQUIRED(itkindex == globalOriginIndex, ""); + + MITK_TEST_OUTPUT( << " Testing WorldToIndex(origin+0.5*spacing-eps, itk::Index)==(0,0,0)"); + originOffCenter = origin+halfSpacingStep; + originOffCenter -= 0.0001; + geometry3d->WorldToIndex( originOffCenter, itkindex); + MITK_TEST_CONDITION_REQUIRED(itkindex == globalOriginIndex, ""); + + MITK_TEST_OUTPUT( << " Testing WorldToIndex(origin+0.5*spacing, itk::Index)==(1,1,1)"); + originOffCenter = origin+halfSpacingStep; + itk::Index<3> global111; + mitk::FillVector3D(global111, 1,1,1); + geometry3d->WorldToIndex( originOffCenter, itkindex); + MITK_TEST_CONDITION_REQUIRED(itkindex == global111, ""); + + MITK_TEST_OUTPUT( << " Testing WorldToIndex(GetCenter())==BoundingBox.GetCenter: "); + mitk::Point3D center = geometry3d->GetCenter(); + mitk::Point3D centerContIndex; + geometry3d->WorldToIndex(center, centerContIndex); + mitk::BoundingBox::ConstPointer boundingBox = geometry3d->GetBoundingBox(); + mitk::BoundingBox::PointType centerBounds = boundingBox->GetCenter(); + MITK_TEST_CONDITION_REQUIRED(mitk::Equal(centerContIndex,centerBounds), ""); + + MITK_TEST_OUTPUT( << " Testing GetCenter()==IndexToWorld(BoundingBox.GetCenter): "); + center = geometry3d->GetCenter(); + mitk::Point3D centerBoundsInWorldCoords; + geometry3d->IndexToWorld(centerBounds, centerBoundsInWorldCoords); + MITK_TEST_CONDITION_REQUIRED(mitk::Equal(center,centerBoundsInWorldCoords), ""); + + return EXIT_SUCCESS; +} + +#include + +int testItkImageIsCenterBased() +{ + MITK_TEST_OUTPUT(<< "Testing whether itk::Image coordinates are center-based."); + typedef itk::Image ItkIntImage3D; + ItkIntImage3D::Pointer itkintimage = ItkIntImage3D::New(); + ItkIntImage3D::SizeType size; + size.Fill(10); + mitk::Point3D origin; + mitk::FillVector3D(origin, 2,3,7); + itkintimage->Initialize(); + itkintimage->SetRegions(size); + itkintimage->SetOrigin(origin); + std::cout<<"[PASSED]"< originContinuousIndex; + itkintimage->TransformPhysicalPointToContinuousIndex(origin, originContinuousIndex); + MITK_TEST_CONDITION_REQUIRED(originContinuousIndex == globalOrigin, ""); + + MITK_TEST_OUTPUT( << " Testing itk::Image::TransformPhysicalPointToIndex(origin)==(0,0,0)"); + itk::Index<3> itkindex; + itkintimage->TransformPhysicalPointToIndex(origin, itkindex); + itk::Index<3> globalOriginIndex; + mitk::vtk2itk(globalOrigin, globalOriginIndex); + MITK_TEST_CONDITION_REQUIRED(itkindex == globalOriginIndex, ""); + + MITK_TEST_OUTPUT( << " Testing itk::Image::TransformPhysicalPointToIndex(origin-0.5*spacing)==(0,0,0)"); + mitk::Vector3D halfSpacingStep = itkintimage->GetSpacing()*0.5; + mitk::Matrix3D rotation; + mitk::Point3D originOffCenter = origin-halfSpacingStep; + itkintimage->TransformPhysicalPointToIndex(originOffCenter, itkindex); + MITK_TEST_CONDITION_REQUIRED(itkindex == globalOriginIndex, ""); + + MITK_TEST_OUTPUT( << " Testing itk::Image::TransformPhysicalPointToIndex(origin+0.5*spacing-eps, itk::Index)==(0,0,0)"); + originOffCenter = origin+halfSpacingStep; + originOffCenter -= 0.0001; + itkintimage->TransformPhysicalPointToIndex( originOffCenter, itkindex); + MITK_TEST_CONDITION_REQUIRED(itkindex == globalOriginIndex, ""); + + MITK_TEST_OUTPUT( << " Testing itk::Image::TransformPhysicalPointToIndex(origin+0.5*spacing, itk::Index)==(1,1,1)"); + originOffCenter = origin+halfSpacingStep; + itk::Index<3> global111; + mitk::FillVector3D(global111, 1,1,1); + itkintimage->TransformPhysicalPointToIndex( originOffCenter, itkindex); + MITK_TEST_CONDITION_REQUIRED(itkindex == global111, ""); + + MITK_TEST_OUTPUT( << "=> Yes, itk::Image coordinates are center-based."); + + return EXIT_SUCCESS; +} + +int testGeometry3D(bool imageGeometry) +{ float bounds[ ] = {-10.0, 17.0, -12.0, 188.0, 13.0, 211.0}; mitk::Geometry3D::Pointer geometry3d = mitk::Geometry3D::New(); @@ -75,6 +195,10 @@ geometry3d->Initialize(); std::cout<<"[PASSED]"<SetImageGeometry(imageGeometry); + std::cout<<"[PASSED]"<SetFloatBounds(bounds); std::cout<<"[PASSED]"<SetSpacing(newspacing); + const mitk::Vector3D& spacing3 = geometry3d->GetSpacing(); + if( mitk::Equal(spacing3, newspacing) == false ) + { + std::cout<<"[FAILED]"<ExecuteOperation(op); - // Todo: Find a meaningful way to test rotation success + MITK_TEST_OUTPUT( << " Testing mitk::GetRotation() and success of rotation"); + mitk::Matrix3D rotation; + mitk::GetRotation(geometry3d, rotation); + mitk::Vector3D voxelStep=rotation*newspacing; + mitk::Vector3D voxelStepIndex; + geometry3d->WorldToIndex(geometry3d->GetOrigin(), voxelStep, voxelStepIndex); + mitk::Vector3D expectedVoxelStepIndex; + expectedVoxelStepIndex.Fill(1); + MITK_TEST_CONDITION_REQUIRED(mitk::Equal(voxelStepIndex,expectedVoxelStepIndex), ""); delete op; std::cout<<"[PASSED]"<GetImageGeometry() == imageGeometry, ""); - mitk::Point3D point = geometry3d->GetOrigin(); - mitk::Point3D dummy; + return EXIT_SUCCESS; +} - geometry3d->WorldToIndex(point, dummy); - geometry3d->IndexToWorld(dummy, dummy); - MITK_TEST_CONDITION_REQUIRED(dummy == point, ""); +int mitkGeometry3DTest(int /*argc*/, char* /*argv*/[]) +{ + MITK_TEST_BEGIN(mitkGeometry3DTest); - std::cout<<"[TEST DONE]"< +#include +#include + +#include + #include #include #include @@ -342,17 +346,24 @@ } std::cout<<"[PASSED]"<Initialize(*imgMem->GetPixelType().GetTypeId(), *imgMem->GetGeometry(), 2 /* #channels */, 0 /*tDim*/ ); vecImg->SetImportChannel(imgMem->GetData(), 0, mitk::Image::CopyMemory ); vecImg->SetImportChannel(imgMem->GetData(), 1, mitk::Image::CopyMemory ); - if( !vecImg->IsValidSlice(0,0,1)) - { - std::cout<<"[FAILED]"<IsValidSlice(0,0,1) , ""); + + MITK_TEST_OUTPUT(<< " Testing whether CopyMemory worked"); + MITK_TEST_CONDITION_REQUIRED(imgMem->GetData() != vecImg->GetData(), ""); + + MITK_TEST_OUTPUT(<< " Testing destruction after SetImportChannel"); + vecImg = NULL; + std::cout<<"[PASSED]"<SetFileName("C:/MITK-QT4/mitk_source3m/mitk/Core/Code/Testing/Data/brain.mhd"); + nodeReader->SetFileName("V:/windows/source/mitk/mitk/Core/Code/Testing/Data/brain.mhd"); nodeReader->Update(); node = nodeReader->GetOutput(); } @@ -423,28 +434,49 @@ } mitk::Image::Pointer image = dynamic_cast(node->GetData()); - - mitk::Point3D point; - + // test by index coordinates - mitk::FillVector3D(point, 55, 39, 50); - double val = image->GetPixelValueByIndex(point); - - // there is always a small rounding error - if(abs(112.225 - val) > 1.0){ - std::cout << "[FAILED]"; - return EXIT_FAILURE; - } + mitk::Index3D index; + mitk::FillVector3D(index, 55, 39, 50); + MITK_TEST_OUTPUT(<< "Testing mitk::Image::GetPixelValueByIndex"); + double val = image->GetPixelValueByIndex(index); + MITK_TEST_CONDITION_REQUIRED( mitk::Equal(val,112.22475433349609), ""); //test by world coordinates + MITK_TEST_OUTPUT(<< "Testing mitk::Image::GetPixelValueByWorldCoordinate"); + mitk::Point3D point; mitk::FillVector3D(point, -5.93752, 18.7199, 6.74218); val = image->GetPixelValueByWorldCoordinate(point); + MITK_TEST_CONDITION_REQUIRED( mitk::Equal(val,94.456184387207031), ""); - if(abs(94.4562 - val) > 1.0){ - std::cout << "[FAILED]"; - return EXIT_FAILURE; - } + MITK_TEST_OUTPUT(<< "Convert to index and access value by mitk::Image::GetPixelValueByIndex again"); + mitk::Index3D index2; + image->GetGeometry()->WorldToIndex(point, index2); + float val2 = image->GetPixelValueByWorldCoordinate(point); + MITK_TEST_CONDITION_REQUIRED( mitk::Equal(val,94.456184387207031), ""); + //access via itk + MITK_TEST_OUTPUT(<< "Test conversion to itk::Image"); + typedef itk::Image ItkFloatImage3D; + ItkFloatImage3D::Pointer itkimage; + mitk::CastToItkImage(image, itkimage); + std::cout<<"[PASSED]"<itk-physical->world consistency"); + mitk::Point3D itkPhysicalPoint; + image->GetGeometry()->WorldToItkPhysicalPoint(point, itkPhysicalPoint); + + mitk::Point3D backTransformedPoint; + image->GetGeometry()->ItkPhysicalPointToWorld(itkPhysicalPoint, backTransformedPoint); + MITK_TEST_CONDITION_REQUIRED( mitk::Equal(point,backTransformedPoint), ""); + + MITK_TEST_OUTPUT(<< "Compare value of pixel returned by mitk in comparison to itk"); + itk::Index<3> idx; + itkimage->TransformPhysicalPointToIndex(itkPhysicalPoint, idx); + float valByItk = itkimage->GetPixel(idx); + + MITK_TEST_CONDITION_REQUIRED( mitk::Equal(valByItk,94.456184387207031), ""); + MITK_TEST_END(); return EXIT_SUCCESS; Index: Documentation/Doxygen/Modules/ModuleGeometry.dox =================================================================== --- Documentation/Doxygen/Modules/ModuleGeometry.dox (revision 24914) +++ Documentation/Doxygen/Modules/ModuleGeometry.dox (working copy) @@ -39,8 +39,829 @@ Image has a TimeSlicedGeometry, which contains one or more SlicedGeometry3D instances (one for each time step), all of which contain one or more instances of (sub-classes of) Geometry2D (usually PlaneGeometry2D). -Converting coordinates from the ITK physical coordinate system (which does not support rotated images) to the MITK world coordinate system should be performed via the Geometry3D of the Image, see Geometry3D::WorldToItkPhysicalPoint. + +Special Commands +Introduction +All commands in the documentation start with a backslash (\) or an at-sign (@). If you prefer you can replace all commands starting with a backslash below by their counterparts that start with an at-sign. + +Some commands have one or more arguments. Each argument has a certain range: + + * If braces are used the argument is a single word. + * If (round) braces are used the argument extends until the end of the line on which the command was found. + * If {curly} braces are used the argument extends until the next paragraph. Paragraphs are delimited by a blank line or by a section indicator. + +If [square] brackets are used the argument is optional. + +Here is an alphabetically sorted list of all commands with references to their documentation: + + * \a + * \addindex + * \addtogroup + * \anchor + * \arg + * \attention + * \author + * \b + * \brief + * \bug + * \c + * \callgraph + * \callergraph + * \category + * \class + * \code + * \cond + * \copybrief + * \copydetails + * \copydoc + * \date + * \def + * \defgroup + * \deprecated + * \details + * \dir + * \dontinclude + * \dot + * \dotfile + * \e + * \else + * \elseif + * \em + * \endcode + * \endcond + * \enddot + * \endhtmlonly + * \endif + * \endlatexonly + * \endlink + * \endmanonly + * \endmsc + * \endverbatim + * \endxmlonly + * \enum + * \example + * \exception + * \extends + * \f$ + * \f[ + * \f] + * \f{ + * \f} + * \file + * \fn + * \headerfile + * \hideinitializer + * \htmlinclude + * \htmlonly + * \if + * \ifnot + * \image + * \implements + * \include + * \includelineno + * \ingroup + * \internal + * \invariant + * \interface + * \latexonly + * \li + * \line + * \link + * \mainpage + * \manonly + * \memberof + * \msc + * \n + * \name + * \namespace + * \nosubgrouping + * \note + * \overload + * \p + * \package + * \page + * \par + * \paragraph + * \param + * \post + * \pre + * \private + * \privatesection + * \property + * \protected + * \protectedsection + * \protocol + * \public + * \publicsection + * \ref + * \relates + * \relatesalso + * \remarks + * \return + * \retval + * \sa + * \section + * \see + * \showinitializer + * \since + * \skip + * \skipline + * \struct + * \subpage + * \subsection + * \subsubsection + * \test + * \throw + * \todo + * \tparam + * \typedef + * \union + * \until + * \var + * \verbatim + * \verbinclude + * \version + * \warning + * \weakgroup + * \xmlonly + * \xrefitem + * \$ + * \@ + * \\ + * \& + * \~ + * \< + * \> + * \# + * \% + * \" + +The following subsections provide a list of all commands that are recognized by doxygen. Unrecognized commands are treated as normal text. +--- Structural indicators --- +\addtogroup [(title)] + +Defines a group just like \defgroup, but in contrast to that command using the same more than once will not result in a warning, but rather one group with a merged documentation and the first title found in any of the commands. + +The title is optional, so this command can also be used to add a number of entities to an existing group using @{ and @} like this: + + /*! \addtogroup mygrp + * Additional documentation for group `mygrp' + * @{ + */ + + /*! + * A function + */ + void func1() + { + } + + /*! Another function */ + void func2() + { + } + + /*! @} */ + +See also: + page Grouping, sections \defgroup, \ingroup and \weakgroup. + +\callgraph + +When this command is put in a comment block of a function or method and HAVE_DOT is set to YES, then doxygen will generate a call graph for that function (provided the implementation of the function or method calls other documented functions). The call graph will generated regardless of the value of CALL_GRAPH. + +Note: + The completeness (and correctness) of the call graph depends on the doxygen code parser which is not perfect. + +\callergraph + +When this command is put in a comment block of a function or method and HAVE_DOT is set to YES, then doxygen will generate a caller graph for that function (provided the implementation of the function or method calls other documented functions). The caller graph will generated regardless of the value of CALLER_GRAPH. + +Note: + The completeness (and correctness) of the caller graph depends on the doxygen code parser which is not perfect. + +\category [] [] + +For Objective-C only: Indicates that a comment block contains documentation for a class category with name . The arguments are equal to the \class command. + +See also: + section \class. + +\class [] [] + +Indicates that a comment block contains documentation for a class with name . Optionally a header file and a header name can be specified. If the header-file is specified, a link to a verbatim copy of the header will be included in the HTML documentation. The argument can be used to overwrite the name of the link that is used in the class documentation to something other than . This can be useful if the include name is not located on the default include path (like ). With the argument you can also specify how the include statement should look like, by adding either quotes or sharp brackets around the name. Sharp brackets are used if just the name is given. Note that the last two arguments can also specified using the \headerfile command. + +Example: + + /* A dummy class */ + + class Test + { + }; + + /*! \class Test class.h "inc/class.h" + * \brief This is a test class. + * + * Some details about the Test class + */ + + Click here for the corresponding HTML documentation that is generated by doxygen. + +\def + +Indicates that a comment block contains documentation for a #define macro. + +Example: + + /*! \file define.h + \brief testing defines + + This is to test the documentation of defines. + */ + + /*! + \def MAX(x,y) + Computes the maximum of \a x and \a y. + */ + + /*! + Computes the absolute value of its argument \a x. + */ + #define ABS(x) (((x)>0)?(x):-(x)) + #define MAX(x,y) ((x)>(y)?(x):(y)) + #define MIN(x,y) ((x)>(y)?(y):(x)) + /*!< Computes the minimum of \a x and \a y. */ + + Click here for the corresponding HTML documentation that is generated by doxygen. + +\defgroup (group title) + +Indicates that a comment block contains documentation for a group of classes, files or namespaces. This can be used to categorize classes, files or namespaces, and document those categories. You can also use groups as members of other groups, thus building a hierarchy of groups. + +The argument should be a single-word identifier. + +See also: + page Grouping, sections \ingroup, \addtogroup, \weakgroup. + +\dir [] + +Indicates that a comment block contains documentation for a directory. The "path fragment" argument should include the directory name and enough of the path to be unique w.r.t. the other directories in the project. The SHOW_DIRECTORIES option determines whether or not the directory information is shown and the STRIP_FROM_PATH option determines what is stripped from the full path before it appears in the output. +\enum + +Indicates that a comment block contains documentation for an enumeration, with name . If the enum is a member of a class and the documentation block is located outside the class definition, the scope of the class should be specified as well. If a comment block is located directly in front of an enum declaration, the \enum comment may be omitted. + +Note: + The type of an anonymous enum cannot be documented, but the values of an anonymous enum can. + +Example: + + class Test + { + public: + enum TEnum { Val1, Val2 }; + + /*! Another enum, with inline docs */ + enum AnotherEnum + { + V1, /*!< value 1 */ + V2 /*!< value 2 */ + }; + }; + + /*! \class Test + * The class description. + */ + + /*! \enum Test::TEnum + * A description of the enum type. + */ + + /*! \var Test::TEnum Test::Val1 + * The description of the first enum value. + */ + + Click here for the corresponding HTML documentation that is generated by doxygen. + +\example + +Indicates that a comment block contains documentation for a source code example. The name of the source file is . The text of this file will be included in the documentation, just after the documentation contained in the comment block. All examples are placed in a list. The source code is scanned for documented members and classes. If any are found, the names are cross-referenced with the documentation. Source files or directories can be specified using the EXAMPLE_PATH tag of doxygen's configuration file. + +If itself is not unique for the set of example files specified by the EXAMPLE_PATH tag, you can include part of the absolute path to disambiguate it. + +If more that one source file is needed for the example, the \include command can be used. + +Example: + + /** A Test class. + * More details about this class. + */ + + class Test + { + public: + /** An example member function. + * More details about this function. + */ + void example(); + }; + + void Test::example() {} + + /** \example example_test.cpp + * This is an example of how to use the Test class. + * More details about this example. + */ + + Where the example file example_test.cpp looks as follows: + + void main() + { + Test t; + t.example(); + } + + Click here for the corresponding HTML documentation that is generated by doxygen. + +See also: + section \include. + +\extends + +This command can be used to manually indicate an inheritance relation, when the programming language does not support this concept natively (e.g. C). + +The file manual.c in the example directory shows how to use this command. +Click here for the corresponding HTML documentation that is generated by doxygen. + +See also: + section \implements and section \memberof + +\file [] + +Indicates that a comment block contains documentation for a source or header file with name . The file name may include (part of) the path if the file-name alone is not unique. If the file name is omitted (i.e. the line after \file is left blank) then the documentation block that contains the \file command will belong to the file it is located in. + +Important: + The documentation of global functions, variables, typedefs, and enums will only be included in the output if the file they are in is documented as well. + +Example: + + /** \file file.h + * A brief file description. + * A more elaborated file description. + */ + + /** + * A global integer value. + * More details about this value. + */ + extern int globalValue; + + Click here for the corresponding HTML documentation that is generated by doxygen. + +Note: + In the above example JAVADOC_AUTOBRIEF has been set to YES in the configuration file. + +\fn (function declaration) + +Indicates that a comment block contains documentation for a function (either global or as a member of a class). This command is only needed if a comment block is not placed in front (or behind) the function declaration or definition. + +If your comment block is in front of the function declaration or definition this command can (and to avoid redundancy should) be omitted. + +A full function declaration including arguments should be specified after the \fn command on a single line, since the argument ends at the end of the line! + +Warning: + Do not use this command if it is not absolutely needed, since it will lead to duplication of information and thus to errors. + +Example: + + class Test + { + public: + const char *member(char,int) throw(std::out_of_range); + }; + + const char *Test::member(char c,int n) throw(std::out_of_range) {} + + /*! \class Test + * \brief Test class. + * + * Details about Test. + */ + + /*! \fn const char *Test::member(char c,int n) + * \brief A member function. + * \param c a character. + * \param n an integer. + * \exception std::out_of_range parameter is out of range. + * \return a character pointer. + */ + + Click here for the corresponding HTML documentation that is generated by doxygen. + +See also: + section \var and \typedef. + +\headerfile [] + +Intended to be used for class, struct, or union documentation, where the documentation is in front of the definition. The arguments of this command are the same as the second and third argument of \cmdclass. The header-file name refers to the file that should by included by the application to obtain the definition of the class, struct, or union. The argument can be used to overwrite the name of the link that is used in the class documentation to something other than . This can be useful if the include name is not located on the default include path (like ). + +With the argument you can also specify how the include statement should look like, by adding either double quotes or sharp brackets around the name. By default sharp brackets are used if just the name is given. + +If a pair of double quotes is given for either the header-file or header-name argument, the current file (in which the command was found) will be used but with quotes. So for a comment block with a \headerfile command inside a file test.h, the following three commands are equivalent: + + \headerfile test.h "test.h" + \headerfile test.h "" + \headerfile "" + +To get sharp brackets you do not need to specify anything, but if you want to be explicit you could use any of the following: + + \headerfile test.h + \headerfile test.h <> + \headerfile <> + +To globally reverse the default include representation to local includes you can set FORCE_LOCAL_INCLUDES to YES. + +To disable the include information altogether set SHOW_INCLUDE_FILES to NO. +\hideinitializer + +By default the value of a define and the initializer of a variable are displayed unless they are longer than 30 lines. By putting this command in a comment block of a define or variable, the initializer is always hidden. + +See also: + section \showinitializer. + +\implements + +This command can be used to manually indicate an inheritance relation, when the programming language does not support this concept natively (e.g. C). + +The file manual.c in the example directory shows how to use this command. +Click here for the corresponding HTML documentation that is generated by doxygen. + +See also: + section \extends and section \memberof + +\ingroup ( [ ]) + +If the \ingroup command is placed in a comment block of a class, file or namespace, then it will be added to the group or groups identified by . + +See also: + page Grouping, sections \defgroup, \addtogroup and \weakgroup + +\interface [] [] + +Indicates that a comment block contains documentation for an interface with name . The arguments are equal to the \class command. + +See also: + section \class. + +\internal + +This command writes the message `For internal use only' to the output and all text after an \internal command until the end of the comment block or the end of the section (whichever comes first) is marked as "internal". + +If the \internal command is put inside a section (see for example \section) all subsection after the command are considered to be internal as well. Only a new section at the same level will be visible again. + +You can use INTERNAL_DOCS in the config file to show or hide the internal documentation. +\mainpage [(title)] + +If the \mainpage command is placed in a comment block the block is used to customize the index page (in HTML) or the first chapter (in $\mbox{\LaTeX}$). + +The title argument is optional and replaces the default title that doxygen normally generates. If you do not want any title you can specify notitle as the argument of \mainpage. + +Here is an example: + +/*! \mainpage My Personal Index Page + * + * \section intro_sec Introduction + * + * This is the introduction. + * + * \section install_sec Installation + * + * \subsection step1 Step 1: Opening the box + * + * etc... + */ + +You can refer to the main page using \ref index (if the treeview is disabled, otherwise you should use \ref main). + +See also: + section \section, section \subsection and section \page. + +\memberof + +This command make a function a member of a class in a similar way as \relates does, only with this command the function is represented as a real member of the class. This can be useful when the programming language does not support the concept of member functions natively (e.g. C). + +It is also possible to use this command together with \public, \protected or \private. + +The file manual.c in the example directory shows how to use this command. +Click here for the corresponding HTML documentation that is generated by doxygen. + +See also: + sections \extends, \implements, \public, \protected and \private. + +\name (header) + +This command turns a comment block into a header definition of a member group. The comment block should be followed by a //@{ ... //@} block containing the members of the group. + +See section Member Groups for an example. +\namespace + +Indicates that a comment block contains documentation for a namespace with name . +\nosubgrouping + +This command can be put in the documentation of a class. It can be used in combination with member grouping to avoid that doxygen puts a member group as a subgroup of a Public/Protected/Private/... section. +\overload [(function declaration)] + +This command can be used to generate the following standard text for an overloaded member function: + +`This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.' + +If the documentation for the overloaded member function is not located in front of the function declaration or definition, the optional argument should be used to specify the correct function. + +Any other documentation that is inside the documentation block will by appended after the generated message. + +Note 1: + You are responsible that there is indeed an earlier documented member that is overloaded by this one. To prevent that document reorders the documentation you should set SORT_MEMBER_DOCS to NO in this case. + +Note 2: + The \overload command does not work inside a one-line comment. + +Example: + + class Test + { + public: + void drawRect(int,int,int,int); + void drawRect(const Rect &r); + }; + + void Test::drawRect(int x,int y,int w,int h) {} + void Test::drawRect(const Rect &r) {} + + /*! \class Test + * \brief A short description. + * + * More text. + */ + + /*! \fn void Test::drawRect(int x,int y,int w,int h) + * This command draws a rectangle with a left upper corner at ( \a x , \a y ), + * width \a w and height \a h. + */ + + /*! + * \overload void Test::drawRect(const Rect &r) + */ + + + Click here for the corresponding HTML documentation that is generated by doxygen. + +\package + +Indicates that a comment block contains documentation for a Java package with name . +\page (title) + +Indicates that a comment block contains a piece of documentation that is not directly related to one specific class, file or member. The HTML generator creates a page containing the documentation. The $\mbox{\LaTeX}$ generator starts a new section in the chapter `Page documentation'. + +Example: + + /*! \page page1 A documentation page + Leading text. + \section sec An example section + This page contains the subsections \ref subsection1 and \ref subsection2. + For more info see page \ref page2. + \subsection subsection1 The first subsection + Text. + \subsection subsection2 The second subsection + More text. + */ + + /*! \page page2 Another page + Even more info. + */ + + Click here for the corresponding HTML documentation that is generated by doxygen. + +Note: + The argument consists of a combination of letters and number digits. If you wish to use upper case letters (e.g. MYPAGE1), or mixed case letters (e.g. MyPage1) in the argument, you should set CASE_SENSE_NAMES to YES. However, this is advisable only if your file system is case sensitive. Otherwise (and for better portability) you should use all lower case letters (e.g. mypage1) for in all references to the page. + +See also: + section \section, section \subsection, and section \ref. + +\private + +Indicates that the member documented in the comment block is private, i.e., should only be accessed by other members in the same class. + +Note that Doxygen automatically detects the protection level of members in object-oriented languages. This command is intended for use only when the language does not support the concept of protection level natively (e.g. C, PHP 4). + +For starting a section of private members, in a way similar to the "private:" class marker in C++, use \privatesection. + +See also: + sections \memberof, \public, and \protected. + +\property (qualified property name) + +Indicates that a comment block contains documentation for a property (either global or as a member of a class). This command is equivalent to \var and \fn. + +See also: + section \fn and \var. + +\protected + +Indicates that the member documented in the comment block is protected, i.e., should only be accessed by other members in the same or derived classes. + +Note that Doxygen automatically detects the protection level of members in object-oriented languages. This command is intended for use only when the language does not support the concept of protection level natively (e.g. C, PHP 4). + +For starting a section of protected members, in a way similar to the "protected:" class marker in C++, use \protectedsection. + +See also: + sections \memberof, \public, and \private. + +\protocol [] [] + +Indicates that a comment block contains documentation for a protocol in Objective-C with name . The arguments are equal to the \class command. + +See also: + section \class. + +\public + +Indicates that the member documented in the comment block is public, i.e., can be accessed by any other class or function. + +Note that Doxygen automatically detects the protection level of members in object-oriented languages. This command is intended for use only when the language does not support the concept of protection level natively (e.g. C, PHP 4). + +For starting a section of public members, in a way similar to the "public:" class marker in C++, use \publicsection. + +See also: + sections \memberof, \protected and \private. + +\relates + +This command can be used in the documentation of a non-member function . It puts the function inside the `related function' section of the class documentation. This command is useful for documenting non-friend functions that are nevertheless strongly coupled to a certain class. It prevents the need of having to document a file, but only works for functions. + +Example: + + /*! + * A String class. + */ + + class String + { + friend int strcmp(const String &,const String &); + }; + + /*! + * Compares two strings. + */ + + int strcmp(const String &s1,const String &s2) + { + } + + /*! \relates String + * A string debug function. + */ + void stringDebug() + { + } + + Click here for the corresponding HTML documentation that is generated by doxygen. + +\relatesalso + +This command can be used in the documentation of a non-member function . It puts the function both inside the `related function' section of the class documentation as well as leaving its normal file documentation location. This command is useful for documenting non-friend functions that are nevertheless strongly coupled to a certain class. It only works for functions. +\showinitializer + +By default the value of a define and the initializer of a variable are only displayed if they are less than 30 lines long. By putting this command in a comment block of a define or variable, the initializer is shown unconditionally. + +See also: + section \hideinitializer. + +\struct [] [] + +Indicates that a comment block contains documentation for a struct with name . The arguments are equal to the \class command. + +See also: + section \class. + +\typedef (typedef declaration) + +Indicates that a comment block contains documentation for a typedef (either global or as a member of a class). This command is equivalent to \var and \fn. + +See also: + section \fn and \var. + +\union [] [] + +Indicates that a comment block contains documentation for a union with name . The arguments are equal to the \class command. + +See also: + section \class. + +\var (variable declaration) + +Indicates that a comment block contains documentation for a variable or enum value (either global or as a member of a class). This command is equivalent to \typedef and \fn. + +See also: + section \fn and \typedef. + +\weakgroup [(title)] + +Can be used exactly like \addtogroup, but has a lower priority when it comes to resolving conflicting grouping definitions. + +See also: + page Grouping and \addtogroup. + +--- Section indicators --- +\attention { attention text } + +Starts a paragraph where a message that needs attention may be entered. The paragraph will be indented. The text of the paragraph has no special internal structure. All visual enhancement commands may be used inside the paragraph. Multiple adjacent \attention commands will be joined into a single paragraph. The \attention command ends when a blank line or some other sectioning command is encountered. +\author { list of authors } + +Starts a paragraph where one or more author names may be entered. The paragraph will be indented. The text of the paragraph has no special internal structure. All visual enhancement commands may be used inside the paragraph. Multiple adjacent \author commands will be joined into a single paragraph. Each author description will start a new line. Alternatively, one \author command may mention several authors. The \author command ends when a blank line or some other sectioning command is encountered. + +Example: + + /*! \class WindowsNT + * \brief Windows Nice Try. + * \author Bill Gates + * \author Several species of small furry animals gathered together + * in a cave and grooving with a pict. + * \version 4.0 + * \date 1996-1998 + * \bug It crashes a lot and requires huge amounts of memory. + * \bug The class introduces the more bugs, the longer it is used. + * \warning This class may explode in your face. + * \warning If you inherit anything from this class, you're doomed. + */ + + class WindowsNT {}; + + Click here for the corresponding HTML documentation that is generated by doxygen. + +\brief {brief description} + +Starts a paragraph that serves as a brief description. For classes and files the brief description will be used in lists and at the start of the documentation page. For class and file members, the brief description will be placed at the declaration of the member and prepended to the detailed description. A brief description may span several lines (although it is advised to keep it brief!). A brief description ends when a blank line or another sectioning command is encountered. If multiple \brief commands are present they will be joined. See section \author for an example. + +Synonymous to \short. +\bug { bug description } + +Starts a paragraph where one or more bugs may be reported. The paragraph will be indented. The text of the paragraph has no special internal structure. All visual enhancement commands may be used inside the paragraph. Multiple adjacent \bug commands will be joined into a single paragraph. Each bug description will start on a new line. Alternatively, one \bug command may mention several bugs. The \bug command ends when a blank line or some other sectioning command is encountered. See section \author for an example. +\cond [] + +Starts a conditional section that ends with a corresponding \endcond command, which is typically found in another comment block. The main purpose of this pair of commands is to (conditionally) exclude part of a file from processing (in older version of doxygen this could only be achieved using C preprocessor commands). + +The section between \cond and \endcond commands can be included by adding its section label to the ENABLED_SECTIONS configuration option. If the section label is omitted, the section will be excluded from processing unconditionally. + +For conditional sections within a comment block one should use a \if ... \endif block. + +Conditional sections can be nested. In this case a nested section will only be shown if it and its containing section are included. + +Here is an example showing the commands in action: + +/** An interface */ +class Intf +{ + public: + /** A method */ + virtual void func() = 0; + + /// @cond TEST + + /** A method used for testing */ + virtual void test() = 0; + + /// @endcond +}; + +/// @cond DEV +/* + * The implementation of the interface + */ +class Implementation : public Intf +{ + public: + void func(); + + /// @cond TEST + void test(); + /// @endcond + + /// @cond + /** This method is obsolete and does + * not show up in the documentation. + */ + void obsolete(); + /// @endcond +}; + +/// @endcond + +The output will be different depending on whether or not ENABLED_SECTIONS contains TEST, or DEV +\date { date description } + +Starts a paragraph where one or more dates may be entered. The paragraph will be indented. The text of the paragraph has no special internal structure. All visual enhancement commands may be used inside the paragraph. Multiple adjacent \date commands will be joined into a single paragraph. Each date description will start on a new line. Alternatively, one \date command may mention several dates. The \date command ends when a blank line or some other sectioning command is encountered. See section \author for an example. +\deprecated{For ITK v3.8 and older: Converting coordinates from the ITK physical coordinate system (which did not support rotated images in v3.8 and older) to the MITK world coordinate system should be performed via the Geometry3D of the Image, see Geometry3D::WorldToItkPhysicalPoint.} + As a reminder: Geometry instances referring to images need a slightly different definition of corners, see Geometry3D::SetImageGeometry. This is usualy automatically called by Image. */ //\f$-\infty\f$ to \f$+\infty\f$. Index: Modules/MitkExt/DataManagement/mitkBoundingObject.cpp =================================================================== --- Modules/MitkExt/DataManagement/mitkBoundingObject.cpp (revision 24914) +++ Modules/MitkExt/DataManagement/mitkBoundingObject.cpp (working copy) @@ -43,7 +43,17 @@ { GetGeometry()->SetIdentity(); GetGeometry()->Compose(aGeometry3D->GetIndexToWorldTransform()); - GetGeometry()->SetOrigin(aGeometry3D->GetCenter()); + + if(aGeometry3D->GetImageGeometry()) + { + mitk::Vector3D halfSpacingStep = aGeometry3D->GetSpacing()*0.5; + GetGeometry()->SetOrigin(aGeometry3D->GetCenter()-halfSpacingStep); + } + else + { + GetGeometry()->SetOrigin(aGeometry3D->GetCenter()); + } + mitk::Vector3D size; for(unsigned int i=0; i < 3; ++i) size[i] = aGeometry3D->GetExtentInMM(i)/2.0; Index: Modules/QmitkExt/QmitkVtkLineProfileWidget.cpp =================================================================== --- Modules/QmitkExt/QmitkVtkLineProfileWidget.cpp (revision 24914) +++ Modules/QmitkExt/QmitkVtkLineProfileWidget.cpp (working copy) @@ -144,13 +144,8 @@ { const PathType::OutputType &continuousIndex = m_DerivedPath->Evaluate( t ); - mitk::Point3D indexPoint; - indexPoint[0] = continuousIndex[0]; - indexPoint[1] = continuousIndex[1]; - indexPoint[2] = continuousIndex[2]; - mitk::Point3D worldPoint; - imageGeometry->IndexToWorld( indexPoint, worldPoint ); + imageGeometry->IndexToWorld( continuousIndex, worldPoint ); if ( i == 0 ) { @@ -158,6 +153,9 @@ } distance += currentWorldPoint.EuclideanDistanceTo( worldPoint ); + + mitk::Index3D indexPoint; + imageGeometry->WorldToIndex( worldPoint, worldPoint ); double intensity = m_Image->GetPixelValueByIndex( indexPoint ); MITK_INFO << t << "/" << distance << ": " << indexPoint << " (" << intensity << ")";