diff --git a/ChangeLog.md b/ChangeLog.md index 66cd4e0d..81999cdd 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,9 @@ # DGtalTools 0.9.2 +- *global*: + - fix uses of temporaries when ConstAlias is needed. + (Roland Denis, [#253](https://github.com/DGtal-team/DGtalTools/pull/253)) + # DGtalTools 0.9.1 - *converters*: diff --git a/converters/vol2slice.cpp b/converters/vol2slice.cpp index 51f9e37e..4b2163c4 100644 --- a/converters/vol2slice.cpp +++ b/converters/vol2slice.cpp @@ -128,7 +128,8 @@ int main( int argc, char** argv ) DGtal::Z2i::Domain domain2D(invFunctor(input3dImage.domain().lowerBound()), invFunctor(input3dImage.domain().upperBound())); DGtal::functors::Projector aSliceFunctor(i); aSliceFunctor.initAddOneDim(sliceOrientation); - SliceImageAdapter sliceImage(input3dImage, domain2D, aSliceFunctor, DGtal::functors::Identity()); + const DGtal::functors::Identity identityFunctor{}; + SliceImageAdapter sliceImage( input3dImage, domain2D, aSliceFunctor, identityFunctor ); stringstream outName; outName << outputBasename << "_" << boost::format("%|05|")% i <<"."<< outputExt ; trace.info() << ": "<< outName.str() ; GenericWriter::exportFile(outName.str(), sliceImage); diff --git a/estimators/generic3dNormalEstimators.cpp b/estimators/generic3dNormalEstimators.cpp index 69759a1f..52b2e59c 100644 --- a/estimators/generic3dNormalEstimators.cpp +++ b/estimators/generic3dNormalEstimators.cpp @@ -516,7 +516,8 @@ int chooseSurface typedef typename Surface::Surfel Surfel; SurfelAdjacency< KSpace::dimension > surfAdj( true ); Surfel bel; - KanungoPredicate* noisified_dshape = new KanungoPredicate( dshape, dshape.getDomain(), noiseLevel ); + const Domain shapeDomain = dshape.getDomain(); + KanungoPredicate* noisified_dshape = new KanungoPredicate( dshape, shapeDomain, noiseLevel ); // We have to search for a big connected component. CountedPtr ptrSurface; double minsize = dshape.getUpperBound()[0] - dshape.getLowerBound()[0]; diff --git a/visualisation/3dCurvatureViewer.cpp b/visualisation/3dCurvatureViewer.cpp index 09a5476a..674084ee 100644 --- a/visualisation/3dCurvatureViewer.cpp +++ b/visualisation/3dCurvatureViewer.cpp @@ -265,7 +265,8 @@ int main( int argc, char** argv ) DGtal::functors::BasicDomainSubSampler< HyperRectDomain< SpaceND< 3, int > >, DGtal::int32_t, double > reSampler(image.domain(), aGridSizeReSample, shiftVector3D); - SamplerImageAdapter sampledImage (image, reSampler.getSubSampledDomain(), reSampler, functors::Identity()); + const functors::Identity identityFunctor{}; + SamplerImageAdapter sampledImage ( image, reSampler.getSubSampledDomain(), reSampler, identityFunctor ); ImagePredicate predicateIMG = ImagePredicate( sampledImage, minImageThreshold, maxImageThreshold ); DomainPredicate domainPredicate( sampledImage.domain() ); AndBoolFct2 andF; diff --git a/visualisation/3dCurvatureViewerNoise.cpp b/visualisation/3dCurvatureViewerNoise.cpp index b4b1ce14..5974a5c4 100644 --- a/visualisation/3dCurvatureViewerNoise.cpp +++ b/visualisation/3dCurvatureViewerNoise.cpp @@ -277,7 +277,8 @@ int main( int argc, char** argv ) DGtal::functors::BasicDomainSubSampler< HyperRectDomain< SpaceND< 3, int > >, DGtal::int32_t, double > reSampler(image.domain(), aGridSizeReSample, shiftVector3D); - SamplerImageAdapter sampledImage (image, reSampler.getSubSampledDomain(), reSampler, functors::Identity()); + const functors::Identity identityFunctor{}; + SamplerImageAdapter sampledImage ( image, reSampler.getSubSampledDomain(), reSampler, identityFunctor ); ImagePredicate predicateIMG = ImagePredicate( sampledImage, minImageThreshold, maxImageThreshold ); KanungoPredicate noisifiedPredicateIMG( predicateIMG, sampledImage.domain(), noiseLevel ); DomainPredicate domainPredicate( sampledImage.domain() ); diff --git a/visualisation/sliceViewer.cpp b/visualisation/sliceViewer.cpp index 668aabed..26c96e49 100644 --- a/visualisation/sliceViewer.cpp +++ b/visualisation/sliceViewer.cpp @@ -253,7 +253,8 @@ void MainWindow::updateZoomImageX(unsigned int sliceNumber, double gridSize){ DGtal::Z2i::Domain domain2D(invFunctor(myImage3D->domain().lowerBound()), invFunctor(myImage3D->domain().upperBound())); DGtal::functors::Projector aSliceFunctor(sliceNumber); aSliceFunctor.initAddOneDim(0); - SliceImageAdapter sliceImage(*myImage3D, domain2D, aSliceFunctor, functors::Identity()); + const functors::Identity identityFunctor{}; + SliceImageAdapter sliceImage( *myImage3D, domain2D, aSliceFunctor, identityFunctor ); QImage anImage = getImage(sliceImage, gridSize, myColorMap); setImageProjX(QPixmap::fromImage(anImage)); } @@ -263,7 +264,8 @@ void MainWindow::updateZoomImageY(unsigned int sliceNumber, double gridSize){ DGtal::Z2i::Domain domain2D(invFunctor(myImage3D->domain().lowerBound()), invFunctor(myImage3D->domain().upperBound())); DGtal::functors::Projector aSliceFunctor(sliceNumber); aSliceFunctor.initAddOneDim(1); - SliceImageAdapter sliceImage(*myImage3D, domain2D, aSliceFunctor, functors::Identity()); + const functors::Identity identityFunctor{}; + SliceImageAdapter sliceImage( *myImage3D, domain2D, aSliceFunctor, identityFunctor ); QImage anImage = getImage(sliceImage, gridSize, myColorMap); setImageProjY(QPixmap::fromImage(anImage)); @@ -275,7 +277,8 @@ void MainWindow::updateZoomImageZ(unsigned int sliceNumber, double gridSize){ DGtal::Z2i::Domain domain2D(invFunctor(myImage3D->domain().lowerBound()), invFunctor(myImage3D->domain().upperBound())); DGtal::functors::Projector aSliceFunctor(sliceNumber); aSliceFunctor.initAddOneDim(2); - SliceImageAdapter sliceImage(*myImage3D, domain2D, aSliceFunctor, functors::Identity()); + const functors::Identity identityFunctor{}; + SliceImageAdapter sliceImage( *myImage3D, domain2D, aSliceFunctor, identityFunctor ); QImage anImage = getImage(sliceImage, gridSize, myColorMap ); setImageProjZ(QPixmap::fromImage(anImage)); } @@ -286,7 +289,8 @@ void MainWindow::updateSliceImageX(int sliceNumber, bool init){ DGtal::Z2i::Domain domain2D(invFunctor(myImage3D->domain().lowerBound()), invFunctor(myImage3D->domain().upperBound())); DGtal::functors::Projector aSliceFunctor(sliceNumber); aSliceFunctor.initAddOneDim(0); - SliceImageAdapter sliceImage (*myImage3D, domain2D, aSliceFunctor, functors::Identity()); + const functors::Identity identityFunctor{}; + SliceImageAdapter sliceImage ( *myImage3D, domain2D, aSliceFunctor, identityFunctor ); double gridSize = ((double)INIT_SCALE1_ZOOM_FACTOR)/ui->_zoomXSlider->value(); QImage anImage = getImage(sliceImage, gridSize,myColorMap); @@ -316,7 +320,8 @@ void MainWindow::updateSliceImageY( int sliceNumber, bool init){ DGtal::Z2i::Domain domain2D(invFunctor(myImage3D->domain().lowerBound()), invFunctor(myImage3D->domain().upperBound())); DGtal::functors::Projector aSliceFunctor(sliceNumber); aSliceFunctor.initAddOneDim(1); - SliceImageAdapter sliceImage(*myImage3D, domain2D, aSliceFunctor, functors::Identity()); + const functors::Identity identityFunctor{}; + SliceImageAdapter sliceImage( *myImage3D, domain2D, aSliceFunctor, identityFunctor ); double gridSize = ((double)INIT_SCALE1_ZOOM_FACTOR)/ui->_zoomYSlider->value(); QImage anImage = getImage(sliceImage, gridSize, myColorMap); @@ -344,7 +349,8 @@ void MainWindow::updateSliceImageZ(int sliceNumber, bool init){ DGtal::Z2i::Domain domain2D(invFunctor(myImage3D->domain().lowerBound()), invFunctor(myImage3D->domain().upperBound())); DGtal::functors::Projector aSliceFunctor(sliceNumber); aSliceFunctor.initAddOneDim(2); - SliceImageAdapter sliceImage(*myImage3D, domain2D, aSliceFunctor, functors::Identity()); + const functors::Identity identityFunctor{}; + SliceImageAdapter sliceImage( *myImage3D, domain2D, aSliceFunctor, identityFunctor ); double gridSize = (double)INIT_SCALE1_ZOOM_FACTOR/ui->_zoomZSlider->value(); QImage anImage = getImage(sliceImage, gridSize, myColorMap); setImageProjZ(QPixmap::fromImage(anImage)); diff --git a/visualisation/specificClasses/Viewer3DImage.cpp b/visualisation/specificClasses/Viewer3DImage.cpp index 75b7cb9a..4b04f94d 100644 --- a/visualisation/specificClasses/Viewer3DImage.cpp +++ b/visualisation/specificClasses/Viewer3DImage.cpp @@ -84,7 +84,8 @@ Viewer3DImage< Space, KSpace>::setVolImage(Image3D * an3DImage){ DGtal::functors::SliceRotator2D aSliceFunctorX(0, my3dImage->domain(), mySliceXPos,2, myAngleRotation ); - MyRotatorSliceImageAdapter sliceImageX(*my3dImage, domain2DX, aSliceFunctorX, DGtal::functors::Identity()); + const DGtal::functors::Identity identityFunctor{}; + MyRotatorSliceImageAdapter sliceImageX( *my3dImage, domain2DX, aSliceFunctorX, identityFunctor ); std::cout << "image:" << sliceImageX.className(); (*this) << sliceImageX; @@ -97,7 +98,7 @@ Viewer3DImage< Space, KSpace>::setVolImage(Image3D * an3DImage){ invFunctorY(my3dImage->domain().upperBound())); DGtal::functors::Projector aSliceFunctorY(mySliceYPos); aSliceFunctorY.initAddOneDim(1); - SliceImageAdapter sliceImageY(*my3dImage, domain2DY, aSliceFunctorY, DGtal::functors::Identity()); + SliceImageAdapter sliceImageY(*my3dImage, domain2DY, aSliceFunctorY, identityFunctor ); (*this) << sliceImageY; (*this) << DGtal::UpdateImagePosition< Space, KSpace >(1, DGtal::Viewer3D<>::yDirection, myImageOrigin[0], mySliceYPos, myImageOrigin[2]); @@ -113,7 +114,7 @@ Viewer3DImage< Space, KSpace>::setVolImage(Image3D * an3DImage){ DGtal::Z3i::Point centerZ((my3dImage->domain().upperBound())[0]/2, (my3dImage->domain().upperBound())[1]/2, mySliceZPos); DGtal::functors::SliceRotator2D aSliceFunctorZ(2, my3dImage->domain(), mySliceZPos, 2, myAngleRotation, centerZ ); - MyRotatorSliceImageAdapter sliceImageZ(*my3dImage, domain2DZ, aSliceFunctorZ, DGtal::functors::Identity()); + MyRotatorSliceImageAdapter sliceImageZ( *my3dImage, domain2DZ, aSliceFunctorZ, identityFunctor ); (*this) << sliceImageZ; (*this) << DGtal::UpdateImagePosition< Space, KSpace > (2, DGtal::Viewer3D<>::zDirection, myImageOrigin[0], myImageOrigin[1], mySliceZPos); @@ -239,8 +240,9 @@ Viewer3DImage< Space, KSpace>::keyPressEvent ( QKeyEvent *e ) DGtal::functors::Projector invFunctor; invFunctor.initRemoveOneDim(myCurrentSliceDim); DGtal::Z2i::Domain domain2D(invFunctor(my3dImage->domain().lowerBound()), invFunctor(my3dImage->domain().upperBound())); - - MyRotatorSliceImageAdapter sliceImage(*my3dImage, domain2D, aSliceFunctor, DGtal::functors::Identity()); + + const DGtal::functors::Identity identityFunctor{}; + MyRotatorSliceImageAdapter sliceImage( *my3dImage, domain2D, aSliceFunctor, identityFunctor ); (*this) << DGtal::UpdateImageData(myCurrentSliceDim, sliceImage, (myCurrentSliceDim==0)? dirStep: 0.0, diff --git a/volumetric/homotopicThinning3D.cpp b/volumetric/homotopicThinning3D.cpp index 449ee70c..164b27a1 100644 --- a/volumetric/homotopicThinning3D.cpp +++ b/volumetric/homotopicThinning3D.cpp @@ -124,7 +124,8 @@ int main( int argc, char** argv ) typedef functors::IntervalForegroundPredicate Predicate; Predicate aPredicate(image, vm[ "min" ].as(), vm[ "max" ].as() ); - DistanceTransformation dt(image.domain(),aPredicate, Z3i::L2Metric() ); + const Z3i::L2Metric aMetric{}; + DistanceTransformation dt(image.domain(), aPredicate, aMetric ); trace.endBlock(); trace.info() < >, DGtal::int32_t, double > reSampler(input3dImage.domain(), aGridSizeReSample, shiftVector3D); - SamplerImageAdapter sampledImage (input3dImage,reSampler.getSubSampledDomain(), reSampler, functors::Identity()); + + const functors::Identity aFunctor{}; + SamplerImageAdapter sampledImage ( input3dImage, reSampler.getSubSampledDomain(), reSampler, aFunctor ); GenericWriter::exportFile(outputFileName, sampledImage); diff --git a/volumetric/volShapeMetrics.cpp b/volumetric/volShapeMetrics.cpp index f7f8b87b..97f5c953 100644 --- a/volumetric/volShapeMetrics.cpp +++ b/volumetric/volShapeMetrics.cpp @@ -75,8 +75,9 @@ getStatsFromDistanceMap(Statistic & stats, const Image3D &imageA, int aM // Applying the distance transform on the digital surface of the set: - typedef DistanceTransformation DTL2; - DTL2 dtL2(&(imageA.domain()), NegPredicate(set3dRef), &Z3i::l2Metric); + typedef DistanceTransformation DTL2; + const NegPredicate aPredicate( set3dRef ); + DTL2 dtL2( imageA.domain(), aPredicate, Z3i::l2Metric ); // Get the set of point of imageB: (use -1 and +1 since the interval of append function are open) Z3i::DigitalSet set3dComp (imageB.domain());