DGtal-team / DGtal

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

Bug when importing Image with ImageContainerBySTLMap and DicomReader #779

Closed kerautret closed 8 years ago

kerautret commented 10 years ago

When applying: typedef DGtal::ImageContainerBySTLMap<DGtal::Z3i::Domain, unsigned char> Image3D; typedef DGtal::RescalingFunctor<int ,unsigned char > RescalFCT;

Image3D imageVol = DicomReader< Image3D, RescalFCT >::importDicom(inputFilename, RescalFCT(-900, 530, 0, 255));

The resulting domain is totally wrong!... While replacing ImageContainerBySTLMap by ImageContainerBySTLVector it is ok !....

dcoeurjo commented 10 years ago

Hi @kerautret, does this bug still exist ? If it does, could you please add a test file demonstrating the wrong behavior ? Thanks

kerautret commented 10 years ago

hello @dcoeurjo, I check it again ;) thank

kerautret commented 10 years ago

Yes I confirm, the pb is always present, I don't remember where I get it, but I check it for instance on dicom2vol, on the master it works: kerautre:~/EnCours/DGtalTools/build[debugErr⚡]$ ./converters/dicom2vol -i ../../DGtal/tests/samples/dicomSample/1629.dcm -o tmp.vol Reading input dicom file ../../DGtal/tests/samples/dicomSample/1629.dcm [done] converting into vol file... [done] and by changing STLVector to STLMap: kerautre:~/EnCours/DGtalTools/build[debugErr⚡]$ 3dImageViewer -i tmp.vol Image loaded: [Image - STLVector] size=1 valuetype=1bytes Domain=[HyperRectDomain] = [[PointVector] {0, 0, 0}]x[[PointVector] {0, 0, 0}]

I put it to this branch if you want to test: https://github.com/kerautret/DGtalTools/tree/BugSTLMapDicomReader

isivigno commented 9 years ago

I just encountered the same kind of problem with the importPGM reader :

typedef ImageContainerBySTLMap<Z2i::Domain, unsigned char> Image; Image image = DGtal::PGMReader::importPGM("../circleR10modif.pgm");
Board2D board; typedef GrayscaleColorMap Gray; Display2DFactory::drawImage(board, image, (unsigned int)0, (unsigned int)129);
---> assertion fails

The good news is that it works if you use the GenericReader: Image image = DGtal::GenericReader::import("../circleR10modif.pgm");

JacquesOlivierLachaud commented 8 years ago

Should be fixed by #1151. Is it the case ?

kerautret commented 8 years ago

I look it ;)

JacquesOlivierLachaud commented 8 years ago

Thanks!

kerautret commented 8 years ago

yes all looks fine ! With dicom2vol compiled with STLMap:

./converters/dicom2vol -i ../../DGtal/tests/samples/dicomSample/1629.dcm -o tmp.vol Reading input dicom file ../../DGtal/tests/samples/dicomSample/1629.dcm [done] converting into vol file... [done] And the vol looks fine: ./visualisation/3dImageViewer -i tmp.vol --thresholdImage -m 0 -M 63 Image loaded: [Image - STLVector] size=2130048 valuetype=1bytes Domain=[HyperRectDomain] = [[PointVector] {0, 0, 0}]x[[PointVector] {128, 127, 128}]

JacquesOlivierLachaud commented 8 years ago

Perfect. Merging.

JacquesOlivierLachaud commented 8 years ago

Closing issue