Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix temporary uses when ConstAlias needed. #253

Merged
merged 10 commits into from
Mar 13, 2016
Merged
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -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*:
Expand Down
3 changes: 2 additions & 1 deletion converters/vol2slice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<DGtal::Z3i::Space> 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<SliceImageAdapter>::exportFile(outName.str(), sliceImage);
Expand Down
3 changes: 2 additions & 1 deletion estimators/generic3dNormalEstimators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Surface> ptrSurface;
double minsize = dshape.getUpperBound()[0] - dshape.getLowerBound()[0];
Expand Down
3 changes: 2 additions & 1 deletion visualisation/3dCurvatureViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Z3i::Domain> domainPredicate( sampledImage.domain() );
AndBoolFct2 andF;
Expand Down
3 changes: 2 additions & 1 deletion visualisation/3dCurvatureViewerNoise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Z3i::Domain> domainPredicate( sampledImage.domain() );
Expand Down
18 changes: 12 additions & 6 deletions visualisation/sliceViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<DGtal::Z3i::Space> 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));
}
Expand All @@ -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<DGtal::Z3i::Space> 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));
Expand All @@ -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<DGtal::Z3i::Space> 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));
}
Expand All @@ -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<DGtal::Z3i::Space> 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);
Expand Down Expand Up @@ -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<DGtal::Z3i::Space> 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);
Expand Down Expand Up @@ -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<DGtal::Z3i::Space> 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));
Expand Down
12 changes: 7 additions & 5 deletions visualisation/specificClasses/Viewer3DImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ Viewer3DImage< Space, KSpace>::setVolImage(Image3D * an3DImage){


DGtal::functors::SliceRotator2D<DGtal::Z3i::Domain> 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;
Expand All @@ -97,7 +98,7 @@ Viewer3DImage< Space, KSpace>::setVolImage(Image3D * an3DImage){
invFunctorY(my3dImage->domain().upperBound()));

DGtal::functors::Projector<DGtal::Z3i::Space> 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]);

Expand All @@ -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<DGtal::Z3i::Domain> 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);

Expand Down Expand Up @@ -239,8 +240,9 @@ Viewer3DImage< Space, KSpace>::keyPressEvent ( QKeyEvent *e )
DGtal::functors::Projector<DGtal::Z2i::Space> 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<MyRotatorSliceImageAdapter>(myCurrentSliceDim, sliceImage,
(myCurrentSliceDim==0)? dirStep: 0.0,
Expand Down
3 changes: 2 additions & 1 deletion volumetric/homotopicThinning3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ int main( int argc, char** argv )
typedef functors::IntervalForegroundPredicate<Image> Predicate;
Predicate aPredicate(image, vm[ "min" ].as<int>(), vm[ "max" ].as<int>() );

DistanceTransformation<Z3i::Space, Predicate , Z3i::L2Metric> dt(image.domain(),aPredicate, Z3i::L2Metric() );
const Z3i::L2Metric aMetric{};
DistanceTransformation<Z3i::Space, Predicate , Z3i::L2Metric> dt(image.domain(), aPredicate, aMetric );
trace.endBlock();
trace.info() <<image<<std::endl;

Expand Down
4 changes: 3 additions & 1 deletion volumetric/volReSample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ int main( int argc, char** argv )
DGtal::functors::BasicDomainSubSampler< HyperRectDomain<SpaceND<3, int> >,
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<SamplerImageAdapter>::exportFile(outputFileName, sampledImage);


Expand Down
5 changes: 3 additions & 2 deletions volumetric/volShapeMetrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ getStatsFromDistanceMap(Statistic<double> & stats, const Image3D &imageA, int aM


// Applying the distance transform on the digital surface of the set:
typedef DistanceTransformation<Z3i::Space, NegPredicate, Z3i::L2Metric> DTL2;
DTL2 dtL2(&(imageA.domain()), NegPredicate(set3dRef), &Z3i::l2Metric);
typedef DistanceTransformation<Z3i::Space, NegPredicate, Z3i::L2Metric> 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());
Expand Down