# HG changeset patch # User bert # Date 1115652632 0 # Node ID 276ef0f8dc06c1a3d6f9b64fa883288468118648 # Parent 358991a05510211fc6982b7c669cbd869199acc8 Don't allow a rescale slope value of zero diff --git a/conversion/dcm2mnc/dicom_read.c b/conversion/dcm2mnc/dicom_read.c --- a/conversion/dcm2mnc/dicom_read.c +++ b/conversion/dcm2mnc/dicom_read.c @@ -7,7 +7,10 @@ @CREATED : January 28, 1997 (Peter Neelin) @MODIFIED : * $Log: dicom_read.c,v $ - * Revision 1.15 2005-04-28 17:17:57 bert + * Revision 1.16 2005-05-09 15:30:32 bert + * Don't allow a rescale slope value of zero + * + * Revision 1.15 2005/04/28 17:17:57 bert * Set and update new width information fields in a manner analogous to the coordinate fields in the General_Info and File_Info structures * * Revision 1.14 2005/04/20 23:14:04 bert @@ -827,6 +830,14 @@ rescale_intercept = acr_find_double(group_list, ACR_Rescale_intercept, 0); rescale_slope = acr_find_double(group_list, ACR_Rescale_slope, 1); + /* If the rescale slope is set to zero, force the default value of + * one and issue a warning. + */ + if (rescale_slope == 0.0) { + printf("WARNING: File contains a rescale slope value of zero.\n"); + rescale_slope = 1.0; + } + fi_ptr->slice_min = fi_ptr->pixel_min * rescale_slope + rescale_intercept; fi_ptr->slice_max = fi_ptr->pixel_max * rescale_slope + rescale_intercept;