MantisBT - VTK
View Issue Details
0008665VTK(No Category)public2009-03-04 02:112016-08-12 09:55
Carlos Barrales Ruiz 
Kitware Robot 
normaltweakalways
closedmoved 
Linux x86/x86_64Ubuntu8.10 (ES.UTF-8)
 
 
0008665: Locale-dependant internal parsers (ej: sscanf/strtod) fails to interpret correctly float fields.
Specifically in vtkDICOMParser, float parsing functions (sscanf) are unable to interpret correctly float values due locale-dependant decimal separator.

This behavior makes DICOMParser to generate a unorderer voxel without measurement and wrong calculations, causing ugly warnings like:

ERROR: In /usr/devel/lib/VTK-5.2.1/Filtering/vtkImageData.cxx, line 1473
vtkImageData (0x4b9e930): GetScalarPointer: Pixel (0, 0, -2147483648) not in memory.
 Current extent= (0, 255, 0, 255, 0, 59)

ERROR: In /usr/devel/lib/VTK-5.2.1/Filtering/vtkImageData.cxx, line 1473
vtkImageData (0x4b9e930): GetScalarPointer: Pixel (0, 0, -2147483648) not in memory.
 Current extent= (0, 255, 0, 255, 0, 59)
Code:

vtkImageData* img = vtkImageData::New();
char *oldLocale = setlocale (LC_NUMERIC, "C");
vtkDICOMImageReader* reader= vtkDICOMImageReader::New();
reader->SetDirectoryName(thePath);
reader->Update();
img->DeepCopy(reader->GetOutput());
setlocale (LC_NUMERIC, old)
viewer->SetImage(img);

Trivial Fix:

vtkImageData* img = vtkImageData::New();
char *oldLocale = setlocale (LC_NUMERIC, "C");
vtkDICOMImageReader* reader= vtkDICOMImageReader::New();
reader->SetDirectoryName(thePath);
reader->Update();
img->DeepCopy(reader->GetOutput());
setlocale (LC_NUMERIC, old)
viewer->SetImage(img);

or launching with LC_NUMERIC setted.
No tags attached.
Issue History
2009-03-04 02:11Carlos Barrales RuizNew Issue
2009-03-04 02:16Carlos Barrales RuizNote Added: 0015528
2011-06-16 13:11Zack GalbreathCategory => (No Category)
2016-08-12 09:55Kitware RobotNote Added: 0037061
2016-08-12 09:55Kitware RobotStatusexpired => closed
2016-08-12 09:55Kitware RobotResolutionopen => moved
2016-08-12 09:55Kitware RobotAssigned To => Kitware Robot

Notes
(0015528)
Carlos Barrales Ruiz   
2009-03-04 02:16   
Code to reproduce is obviusly wrong, so LC_NUMERIC should be, by example: es_ES.UTF-8
(0037061)
Kitware Robot   
2016-08-12 09:55   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current VTK Issues page linked in the banner at the top of this page.