DGtal-team / DGtal

Digital Geometry Tools and Algorithm Library
https://dgtal.org
GNU Lesser General Public License v3.0
370 stars 115 forks source link

ConstImageAdapter Bug or ??? #605

Closed kerautret closed 11 years ago

kerautret commented 11 years ago

I have some issues while doing a small tools volCrop (see my branch on DGtalTools: https://github.com/kerautret/DGtalTools/tree/volCropBug

I just apply a ConstImageAdapter on subdomain, which looks ok but in exporting it looks like that the iterator is in other direction/order.

Here is some visu of the sample that you obtain by using: ] ./volumetric/voltools/volCrop -i ../../DGtal/examples/samples/lobster.vol --xMin 150 --yMin 150 --zMin 20 --xMax 200 --yMax 220 --zMax 50 -o lobsterCroped.vol

capture decran 2013-05-05 a 11 36 12 capture decran 2013-05-05 a 11 35 34

troussil commented 11 years ago

Something weird: VolWriter calls a method named 'extent' (from an instance of an image), but this method seems to be not defined in ConstImageAdapter. Moreover, any HyperRectDomain has such a method. Hence, in my opinion it should be called from the domain (instead of the image), provided that the domain is hyper-rectangular.

dcoeurjo commented 11 years ago

Agree... We discussed about the "extent()" stuff with @kerautret for another PR and this will be cleaned up. (extent() is not in the image concept nor the domain one).

kerautret commented 11 years ago

Yes, no indeed I see the bug (my) I put a small error a "-1' missing in the extent change! `const typename I::Domain::Point &upBound = aImage.domain().upperBound(); const typename I::Domain::Point &lowBound = aImage.domain().lowerBound(); size[0]=upBound[0]-lowBound[0]; size[1]=upBound[1]-lowBound[1]; size[2]=upBound[2]-lowBound[2];

Sorry ;( I correct it now

kerautret commented 11 years ago

thank you for the reply ;)

kerautret commented 11 years ago

All fine with the corrected "+1'" ...