This is an automated email from the git hooks/post-receive script. gewo pushed a commit to branch master in repository insighttoolkit.
commit d48db90daf97b10bc5f4fb53c85dcfd858a21101 Author: Gert Wollny <[email protected]> Date: Thu Oct 5 09:18:58 2017 +0000 New upstream version 4.12.2-dfsg1 --- CMakeLists.txt | 2 +- Modules/Core/GPUCommon/include/itkGPUImage.h | 3 +- Modules/Core/GPUCommon/include/itkGPUImage.hxx | 25 +----- .../include/itkEllipseSpatialObject.hxx | 6 -- .../src/itkCylinderSpatialObject.cxx | 96 ++++++++-------------- .../test/itkCylinderSpatialObjectTest.cxx | 35 ++++++-- .../GPUSmoothing/include/itkGPUMeanImageFilter.h | 10 +-- .../GPUSmoothing/include/itkGPUMeanImageFilter.hxx | 3 - Modules/IO/NIFTI/include/itkNiftiImageIO.h | 25 +++++- Modules/IO/NIFTI/itk-module.cmake | 3 +- Modules/IO/NIFTI/src/itkNiftiImageIO.cxx | 44 +++++++++- .../include/itkGPUDemonsRegistrationFunction.hxx | 4 +- .../Remote/AnisotropicDiffusionLBR.remote.cmake | 2 +- Modules/ThirdParty/KWSys/src/CMakeLists.txt | 6 +- 14 files changed, 150 insertions(+), 114 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b2bd80..5b0a67e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,7 +74,7 @@ set(main_project_name ${_ITKModuleMacros_DEFAULT_LABEL}) # ITK version number. set(ITK_VERSION_MAJOR "4") set(ITK_VERSION_MINOR "12") -set(ITK_VERSION_PATCH "1") +set(ITK_VERSION_PATCH "2") if(NOT ITK_INSTALL_RUNTIME_DIR) set(ITK_INSTALL_RUNTIME_DIR bin) diff --git a/Modules/Core/GPUCommon/include/itkGPUImage.h b/Modules/Core/GPUCommon/include/itkGPUImage.h index d238875..117fc31 100644 --- a/Modules/Core/GPUCommon/include/itkGPUImage.h +++ b/Modules/Core/GPUCommon/include/itkGPUImage.h @@ -156,8 +156,7 @@ public: } itkGetModifiableObjectMacro(DataManager, GPUImageDataManager< GPUImage >); - - GPUDataManager::Pointer GetGPUDataManager() const; + GPUDataManager * GetGPUDataManager(); /* Override DataHasBeenGenerated() in DataObject class. * We need this because CPU time stamp is always bigger diff --git a/Modules/Core/GPUCommon/include/itkGPUImage.hxx b/Modules/Core/GPUCommon/include/itkGPUImage.hxx index 83bd4d7..ac75957 100644 --- a/Modules/Core/GPUCommon/include/itkGPUImage.hxx +++ b/Modules/Core/GPUCommon/include/itkGPUImage.hxx @@ -161,15 +161,10 @@ const TPixel * GPUImage< TPixel, VImageDimension >::GetBufferPointer() const } template <typename TPixel, unsigned int VImageDimension> -GPUDataManager::Pointer -GPUImage< TPixel, VImageDimension >::GetGPUDataManager() const +GPUDataManager * +GPUImage< TPixel, VImageDimension >::GetGPUDataManager() { - typedef typename GPUImageDataManager< GPUImage >::Superclass GPUImageDataSuperclass; - typedef typename GPUImageDataSuperclass::Pointer GPUImageDataSuperclassPointer; - - return static_cast< GPUImageDataSuperclassPointer >( m_DataManager.GetPointer() ); - - //return m_DataManager.GetPointer(); + return m_DataManager.GetPointer(); } template <typename TPixel, unsigned int VImageDimension> @@ -178,29 +173,17 @@ GPUImage< TPixel, VImageDimension >::Graft(const Self *data) { typedef GPUImageDataManager< GPUImage > GPUImageDataManagerType; - // Pass regular pointer to Graft() instead of smart pointer due to type - // casting problem - GPUImageDataManagerType* ptr = static_cast<GPUImageDataManagerType*>( - ( data->GetGPUDataManager() ).GetPointer() ); + GPUImageDataManagerType* ptr = const_cast<GPUImageDataManagerType*>( data->GetDataManager() ); // call the superclass' implementation Superclass::Graft(ptr->GetImagePointer()); - // Debug - //std::cout << "GPU timestamp : " << m_DataManager->GetMTime() << ", CPU - // timestamp : " << this->GetMTime() << std::endl; - // call GPU data graft function m_DataManager->SetImagePointer( this ); m_DataManager->Graft( ptr ); // Synchronize timestamp of GPUImage and GPUDataManager m_DataManager->SetTimeStamp( this->GetTimeStamp() ); - - // Debug - //std::cout << "GPU timestamp : " << m_DataManager->GetMTime() << ", CPU - // timestamp : " << this->GetMTime() << std::endl; - } template <typename TPixel, unsigned int VImageDimension> diff --git a/Modules/Core/SpatialObjects/include/itkEllipseSpatialObject.hxx b/Modules/Core/SpatialObjects/include/itkEllipseSpatialObject.hxx index a8cd96b..def4e54 100644 --- a/Modules/Core/SpatialObjects/include/itkEllipseSpatialObject.hxx +++ b/Modules/Core/SpatialObjects/include/itkEllipseSpatialObject.hxx @@ -59,12 +59,6 @@ bool EllipseSpatialObject< TDimension > ::IsInside(const PointType & point) const { - this->ComputeLocalBoundingBox(); - if ( !this->GetBounds()->IsInside(point) ) - { - return false; - } - if ( !this->SetInternalInverseTransformToWorldToIndexTransform() ) { return false; diff --git a/Modules/Core/SpatialObjects/src/itkCylinderSpatialObject.cxx b/Modules/Core/SpatialObjects/src/itkCylinderSpatialObject.cxx index 97ae629..99f750c 100644 --- a/Modules/Core/SpatialObjects/src/itkCylinderSpatialObject.cxx +++ b/Modules/Core/SpatialObjects/src/itkCylinderSpatialObject.cxx @@ -46,55 +46,20 @@ bool CylinderSpatialObject PointType transformedPoint = this->GetInternalInverseTransform()->TransformPoint(point); - this->ComputeLocalBoundingBox(); - - if ( this->GetBounds()->IsInside(point) ) + // Does the point lie above or below the cylinder (y-axis)? + if ( transformedPoint[1] < -0.5 * m_Height || + transformedPoint[1] > 0.5 * m_Height ) { - // Check if the point is on the normal plane - PointType a, b; - a[0] = 0; - a[1] = -m_Height / 2; - a[2] = 0; - - b[0] = 0; - b[1] = m_Height / 2; - b[2] = 0; - - double A = 0; - double B = 0; - - for ( unsigned int i = 0; i < 3; i++ ) - { - A += ( b[i] - a[i] ) * ( transformedPoint[i] - a[i] ); - B += ( b[i] - a[i] ) * ( b[i] - a[i] ); - } - - double lambda = A / B; - - if ( ( - ( lambda > -( m_Radius / ( 2 * std::sqrt(B) ) ) ) - && ( lambda < 0 ) ) - || ( ( lambda <= 1.0 ) && ( lambda >= 0.0 ) ) - ) - { - PointType p; - - for ( unsigned int i = 0; i < 3; i++ ) - { - p[i] = a[i] + lambda * ( b[i] - a[i] ); - } - - double tempSquareDist = transformedPoint.EuclideanDistanceTo(p); - - double R = m_Radius; + return false; + } - if ( tempSquareDist <= R ) - { - return true; - } - } + // Does the point lie outside the radius of the cylinder? + if ( Math::sqr(transformedPoint[0]) + Math::sqr(transformedPoint[2]) > Math::sqr(m_Radius) ) + { + return false; } - return false; + + return true; } /** Test if the given point is inside the Cylinder */ @@ -130,28 +95,37 @@ bool CylinderSpatialObject if ( this->GetBoundingBoxChildrenName().empty() || strstr( typeid( Self ).name(), this->GetBoundingBoxChildrenName().c_str() ) ) { - // First point + // First we compute the bounding box in the index space + BoundingBoxType::Pointer bb = BoundingBoxType::New(); PointType ptMin, ptMax; ptMin[0] = -m_Radius; ptMin[1] = -m_Height / 2; ptMin[2] = -m_Radius; + ptMax[0] = m_Radius; + ptMax[1] = m_Height / 2; + ptMax[2] = m_Radius; + bb->SetMinimum(ptMin); + bb->SetMaximum(ptMax); + + // Initialize the final bounding box by setting the min and max to the + // transformed ptMin and ptMax. ptMin = this->GetIndexToWorldTransform()->TransformPoint(ptMin); - ptMax[0] = +m_Radius; - ptMax[1] = -m_Height / 2; - ptMax[2] = +m_Radius; - ptMax = this->GetIndexToWorldTransform()->TransformPoint(ptMax); const_cast< BoundingBoxType * >( this->GetBounds() )->SetMinimum(ptMin); - const_cast< BoundingBoxType * >( this->GetBounds() )->SetMaximum(ptMax); - ptMin[0] = -m_Radius; - ptMin[1] = +m_Height / 2; - ptMin[2] = -m_Radius; - ptMin = this->GetIndexToWorldTransform()->TransformPoint(ptMin); - ptMax[0] = +m_Radius; - ptMax[1] = +m_Height / 2; - ptMax[2] = +m_Radius; ptMax = this->GetIndexToWorldTransform()->TransformPoint(ptMax); - const_cast< BoundingBoxType * >( this->GetBounds() )->ConsiderPoint(ptMin); - const_cast< BoundingBoxType * >( this->GetBounds() )->ConsiderPoint(ptMax); + const_cast< BoundingBoxType * >( this->GetBounds() )->SetMaximum(ptMax); + + // Transform all corners of the bounding box in index space to world space, + // and make sure that the final bounding box includes these. + const BoundingBoxType::PointsContainer *corners = bb->GetCorners(); + BoundingBoxType::PointsContainer::const_iterator + itBB = corners->begin(); + while ( itBB != corners->end() ) + { + PointType pnt = + this->GetIndexToWorldTransform()->TransformPoint(*itBB); + const_cast< BoundingBoxType * >( this->GetBounds() )->ConsiderPoint(pnt); + ++itBB; + } } return true; } diff --git a/Modules/Core/SpatialObjects/test/itkCylinderSpatialObjectTest.cxx b/Modules/Core/SpatialObjects/test/itkCylinderSpatialObjectTest.cxx index 70028b5..d5694da 100644 --- a/Modules/Core/SpatialObjects/test/itkCylinderSpatialObjectTest.cxx +++ b/Modules/Core/SpatialObjects/test/itkCylinderSpatialObjectTest.cxx @@ -29,6 +29,7 @@ int itkCylinderSpatialObjectTest(int, char* []) CylinderType::Pointer myCylinder = CylinderType::New(); double radius = 3.0; double height = 12.0; + itk::Vector<double, 3> axis; std::cout << "Testing Print after construction " << std::endl; myCylinder->Print( std::cout ); @@ -79,15 +80,39 @@ int itkCylinderSpatialObjectTest(int, char* []) || itk::Math::NotAlmostEquals(boundingBox->GetBounds()[4], -3.0 ) || itk::Math::NotAlmostEquals(boundingBox->GetBounds()[5], 3.0 ) ) - { - std::cout<<"[FAILED]"<<std::endl; - return EXIT_FAILURE; - } + { + std::cout<<"[FAILED]"<<std::endl; + return EXIT_FAILURE; + } + std::cout << "[PASSED]" << std::endl; + + // ComputeBoundingBox after 45 degree rotation. + std::cout << "ComputeBoundingBox after 45 degree rotation: "; + axis.Fill(0); + axis[0] = 1; + double angle = itk::Math::pi_over_4; + myCylinder->GetObjectToParentTransform()->Rotate3D(axis, angle); + myCylinder->ComputeObjectToWorldTransform(); + myCylinder->ComputeBoundingBox(); + boundingBox = myCylinder->GetBoundingBox(); + + if( itk::Math::NotAlmostEquals(boundingBox->GetBounds()[0], -3.0 ) + || itk::Math::NotAlmostEquals(boundingBox->GetBounds()[1], 3.0 ) + || itk::Math::NotAlmostEquals(boundingBox->GetBounds()[2], -9.0 * itk::Math::sqrt1_2 ) + || itk::Math::NotAlmostEquals(boundingBox->GetBounds()[3], 9.0 * itk::Math::sqrt1_2 ) + || itk::Math::NotAlmostEquals(boundingBox->GetBounds()[4], -9.0 * itk::Math::sqrt1_2 ) + || itk::Math::NotAlmostEquals(boundingBox->GetBounds()[5], 9.0 * itk::Math::sqrt1_2 ) + ) + { + std::cout<<"[FAILED]"<<std::endl; + return EXIT_FAILURE; + } + std::cout << "[PASSED]" << std::endl; std::cout << "Testing Print after all modifications " << std::endl; myCylinder->Print( std::cout ); - std::cout<<"[PASSED]"<<std::endl; + std::cout<<"[DONE]"<<std::endl; return EXIT_SUCCESS; } diff --git a/Modules/Filtering/GPUSmoothing/include/itkGPUMeanImageFilter.h b/Modules/Filtering/GPUSmoothing/include/itkGPUMeanImageFilter.h index 0e82167..a6729a2 100644 --- a/Modules/Filtering/GPUSmoothing/include/itkGPUMeanImageFilter.h +++ b/Modules/Filtering/GPUSmoothing/include/itkGPUMeanImageFilter.h @@ -47,15 +47,15 @@ class ITK_TEMPLATE_EXPORT GPUMeanImageFilter : //public GPUImageToImageFilter< { public: /** Standard class typedefs. */ - typedef GPUMeanImageFilter Self; - typedef GPUImageToImageFilter< TInputImage, TOutputImage, MeanImageFilter< TInputImage, TOutputImage > > Superclass; - typedef SmartPointer< Self > Pointer; - typedef SmartPointer< const Self > ConstPointer; + typedef GPUMeanImageFilter Self; + typedef GPUBoxImageFilter< TInputImage, TOutputImage, MeanImageFilter< TInputImage, TOutputImage > > Superclass; + typedef SmartPointer< Self > Pointer; + typedef SmartPointer< const Self > ConstPointer; itkNewMacro(Self); /** Run-time type information (and related methods). */ - itkTypeMacro(GPUMeanImageFilter, Superclass); + itkTypeMacro(GPUMeanImageFilter, GPUBoxImageFilter); /** Superclass typedefs. */ typedef typename Superclass::OutputImageRegionType OutputImageRegionType; diff --git a/Modules/Filtering/GPUSmoothing/include/itkGPUMeanImageFilter.hxx b/Modules/Filtering/GPUSmoothing/include/itkGPUMeanImageFilter.hxx index 1607d4a..dca35c4 100644 --- a/Modules/Filtering/GPUSmoothing/include/itkGPUMeanImageFilter.hxx +++ b/Modules/Filtering/GPUSmoothing/include/itkGPUMeanImageFilter.hxx @@ -36,7 +36,6 @@ GPUMeanImageFilter< TInputImage, TOutputImage >::GPUMeanImageFilter() defines << "#define DIM_" << TInputImage::ImageDimension << "\n"; defines << "#define PIXELTYPE "; GetTypenameInString( typeid ( typename TInputImage::PixelType ), defines ); - std::cout << "Defines: " << defines.str() << std::endl; const char* GPUSource = GPUMeanImageFilter::GetOpenCLSource(); @@ -58,8 +57,6 @@ void GPUMeanImageFilter< TInputImage, TOutputImage >::PrintSelf(std::ostream & os, Indent indent) const { Superclass::PrintSelf(os, indent); - //os << indent << "GPU: " << ( m_GPUEnabled ? "Enabled" : "Disabled" ) << - // std::endl; } template< typename TInputImage, typename TOutputImage > diff --git a/Modules/IO/NIFTI/include/itkNiftiImageIO.h b/Modules/IO/NIFTI/include/itkNiftiImageIO.h index 2a7f949..002b874 100644 --- a/Modules/IO/NIFTI/include/itkNiftiImageIO.h +++ b/Modules/IO/NIFTI/include/itkNiftiImageIO.h @@ -23,7 +23,6 @@ #include <fstream> #include "itkImageIOBase.h" -#include <nifti1_io.h> namespace itk { @@ -128,7 +127,29 @@ private: void SetImageIOMetadataFromNIfTI(); - nifti_image *m_NiftiImage; + //This proxy class provides a nifti_image pointer interface to the internal implementation + //of itk::NiftiImageIO, while hiding the niftilib interface from the external ITK interface. + class NiftiImageProxy; + + //This class has ownership of the proxy and is thereby holder of the nifti_image pointer. + class NiftiImageHolder + { + private: + NiftiImageProxy* const m_NiftiImageProxy; + public: + NiftiImageHolder(); + ~NiftiImageHolder(); + NiftiImageProxy& GetNiftiImageProxy(); + + private: + NiftiImageHolder(const NiftiImageHolder&) ITK_DELETED_FUNCTION; + NiftiImageHolder& operator=(const NiftiImageHolder &) ITK_DELETED_FUNCTION; + }; + + //Note that it is essential that m_NiftiImageHolder is defined before m_NiftiImage, to ensure that + //m_NiftiImage can directly get a proxy from m_NiftiImageHolder during NiftiImageIO construction. + NiftiImageHolder m_NiftiImageHolder; + NiftiImageProxy& m_NiftiImage; double m_RescaleSlope; double m_RescaleIntercept; diff --git a/Modules/IO/NIFTI/itk-module.cmake b/Modules/IO/NIFTI/itk-module.cmake index 09a752f..114cb91 100644 --- a/Modules/IO/NIFTI/itk-module.cmake +++ b/Modules/IO/NIFTI/itk-module.cmake @@ -3,11 +3,10 @@ set(DOCUMENTATION "This modules contains an ImageIO class to read or write the itk_module(ITKIONIFTI ENABLE_SHARED - DEPENDS - ITKNIFTI PRIVATE_DEPENDS ITKIOImageBase ITKTransform + ITKNIFTI TEST_DEPENDS ITKTestKernel ITKNIFTI diff --git a/Modules/IO/NIFTI/src/itkNiftiImageIO.cxx b/Modules/IO/NIFTI/src/itkNiftiImageIO.cxx index 85b98de..f6c9682 100644 --- a/Modules/IO/NIFTI/src/itkNiftiImageIO.cxx +++ b/Modules/IO/NIFTI/src/itkNiftiImageIO.cxx @@ -19,6 +19,7 @@ #include "itkIOCommon.h" #include "itkMetaDataObject.h" #include "itkSpatialOrientationAdapter.h" +#include <nifti1_io.h> namespace itk { @@ -389,8 +390,47 @@ NiftiImageIO return requestedRegion; } -NiftiImageIO::NiftiImageIO(): - m_NiftiImage(ITK_NULLPTR), + +//This internal proxy class provides a pointer-like interface to a nifti_image*, by supporting +//conversions between proxy and nifti_image pointer and arrow syntax (e.g., m_NiftiImage->data). +class NiftiImageIO::NiftiImageProxy +{ + nifti_image* m_ptr; +public: + NiftiImageProxy(nifti_image* ptr) : + m_ptr(ptr) + { + } + + operator nifti_image*() + { + return m_ptr; + } + + nifti_image* operator->() + { + return m_ptr; + } +}; + +NiftiImageIO::NiftiImageHolder::NiftiImageHolder() : +m_NiftiImageProxy(new NiftiImageProxy(ITK_NULLPTR)) +{ +} + +NiftiImageIO::NiftiImageHolder::~NiftiImageHolder() +{ + delete m_NiftiImageProxy; +} + +NiftiImageIO::NiftiImageProxy& NiftiImageIO::NiftiImageHolder::GetNiftiImageProxy() +{ + return *m_NiftiImageProxy; +} + + +NiftiImageIO::NiftiImageIO() : + m_NiftiImage(m_NiftiImageHolder.GetNiftiImageProxy()), m_RescaleSlope(1.0), m_RescaleIntercept(0.0), m_OnDiskComponentType(UNKNOWNCOMPONENTTYPE), diff --git a/Modules/Registration/GPUPDEDeformable/include/itkGPUDemonsRegistrationFunction.hxx b/Modules/Registration/GPUPDEDeformable/include/itkGPUDemonsRegistrationFunction.hxx index 61707fb..9af727c 100644 --- a/Modules/Registration/GPUPDEDeformable/include/itkGPUDemonsRegistrationFunction.hxx +++ b/Modules/Registration/GPUPDEDeformable/include/itkGPUDemonsRegistrationFunction.hxx @@ -241,8 +241,8 @@ GPUDemonsRegistrationFunction< TFixedImage, TMovingImage, TDisplacementField > void *itkNotUsed(gd) ) { - typename TFixedImage::ConstPointer fixedImage = dynamic_cast< const TFixedImage * >( this->GetFixedImage() ); - typename TMovingImage::ConstPointer movingImage = dynamic_cast< const TMovingImage * >( this->GetMovingImage() ); + TFixedImage * fixedImage = const_cast< TFixedImage * >( this->GetFixedImage() ); + TMovingImage * movingImage = const_cast< TMovingImage * >( this->GetMovingImage() ); typename DisplacementFieldType::SizeType outSize = output->GetLargestPossibleRegion().GetSize(); int imgSize[3]; diff --git a/Modules/Remote/AnisotropicDiffusionLBR.remote.cmake b/Modules/Remote/AnisotropicDiffusionLBR.remote.cmake index 7faccff..ebb228d 100644 --- a/Modules/Remote/AnisotropicDiffusionLBR.remote.cmake +++ b/Modules/Remote/AnisotropicDiffusionLBR.remote.cmake @@ -20,5 +20,5 @@ itk_fetch_module(AnisotropicDiffusionLBR http://insight-journal.org/browse/publication/953 " GIT_REPOSITORY ${git_protocol}://github.com/InsightSoftwareConsortium/ITKAnisotropicDiffusionLBR.git - GIT_TAG 5bd898cb781685d26686b153d33ee484107163c8 + GIT_TAG 50acf46da9fa1480eb502a0bb550c36d518893eb ) diff --git a/Modules/ThirdParty/KWSys/src/CMakeLists.txt b/Modules/ThirdParty/KWSys/src/CMakeLists.txt index 026ad4f..3c806d8 100644 --- a/Modules/ThirdParty/KWSys/src/CMakeLists.txt +++ b/Modules/ThirdParty/KWSys/src/CMakeLists.txt @@ -22,7 +22,11 @@ set(KWSYS_INSTALL_EXPORT_NAME ${ITKKWSys-targets}) set(KWSYS_INSTALL_COMPONENT_NAME_RUNTIME RuntimeLibraries) set(KWSYS_INSTALL_COMPONENT_NAME_DEVELOPMENT Development) set(KWSYS_PROPERTIES_C WINDOWS_EXPORT_ALL_SYMBOLS FALSE) -set(KWSYS_PROPERTIES_CXX MACOSX_RPATH 1 WINDOWS_EXPORT_ALL_SYMBOLS FALSE) +set( _macosx_rpath 1) +if(DEFINED CMAKE_MACOSX_RPATH AND NOT "${CMAKE_MACOSX_RPATH}" STREQUAL "") + set(_macosx_rpath ${CMAKE_MACOSX_RPATH}) +endif() +set(KWSYS_PROPERTIES_CXX MACOSX_RPATH ${_macosx_rpath} WINDOWS_EXPORT_ALL_SYMBOLS FALSE) add_subdirectory(KWSys) itk_module_target(${KWSYS_NAMESPACE} NO_INSTALL) -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/insighttoolkit.git _______________________________________________ debian-med-commit mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit
