Problem 2102 - Problem reading Pixel Spacing from DICOM file
Summary: Problem reading Pixel Spacing from DICOM file
Status: RESOLVED FIXED
Alias: None
Product: Examples/Extended
Classification: Unclassified
Component: medical/DICOM (show other problems)
Version: 10.4
Hardware: All All
: P4 minor
Assignee: Jonathan Madsen
URL:
Depends on:
Blocks:
 
Reported: 2018-11-13 00:45 CET by Ken Sutherland
Modified: 2018-11-13 12:20 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
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.