Problem 2102

Summary: Problem reading Pixel Spacing from DICOM file
Product: Examples/Extended Reporter: Ken Sutherland <kensuth>
Component: medical/DICOMAssignee: Jonathan Madsen <jonathan.madsen>
Status: RESOLVED FIXED    
Severity: minor    
Priority: P4    
Version: 10.4   
Hardware: All   
OS: All   

Description Ken Sutherland 2018-11-13 00:45:21 CET
The code as is skips over the first byte of the Y-coordinate. This is not a problem is the pixel spacing is less than one mm because "0.1" will be read as ".1". But if pixel spacing is equal to or greater than 1 mm, it causes the Y pixel spacing to be zero because "1.0" is read as ".0".

I think the code should be like this:

    } else if(tagDictionary == 0x00280030 ) { // Pixel Spacing
        G4String datas(data);
        int iss = datas.find('\\');
        fPixelSpacingX = atof( datas.substr(0,iss).c_str() );
	// NOTE: Skips first character of Y spacing!
        //fPixelSpacingY = atof( datas.substr(iss+2,datas.length()).c_str() );
        fPixelSpacingY = atof( datas.substr(iss+1,datas.length()).c_str() );
Comment 1 Jonathan Madsen 2018-11-13 12:20:44 CET
Thanks, committed the fix.