]> granicus.if.org Git - imagemagick/blobdiff - coders/dcm.c
...
[imagemagick] / coders / dcm.c
index 55377c4f9cc1ffe20f14809c6e04d8d7e21531c2..94e8e6a8b1ce89f1dbc99aa29f9ba1f2ca468793 100644 (file)
@@ -17,7 +17,7 @@
 %                                 July 1992                                   %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2017 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2018 ImageMagick Studio LLC, a non-profit organization      %
 %  dedicated to making software imaging solutions freely available.           %
 %                                                                             %
 %  You may not use this file except in compliance with the License.  You may  %
@@ -2876,18 +2876,16 @@ static MagickBooleanType ReadDCMPixels(Image *image,DCMInfo *info,
               }
           if (info->signed_data == 1)
             pixel_value-=32767;
-          if (info->rescale)
+          index=pixel_value;
+          if (info->rescale != MagickFalse)
             {
               double
                 scaled_value;
 
               scaled_value=pixel_value*info->rescale_slope+
                 info->rescale_intercept;
-              if (info->window_width == 0)
-                {
-                  index=(int) scaled_value;
-                }
-              else
+              index=(int) scaled_value;
+              if (info->window_width != 0)
                 {
                   double
                     window_max,
@@ -2907,10 +2905,6 @@ static MagickBooleanType ReadDCMPixels(Image *image,DCMInfo *info,
                         info->window_center-0.5)/(info->window_width-1))+0.5));
                 }
             }
-          else
-            {
-              index=pixel_value;
-            }
           index&=info->mask;
           index=(int) ConstrainColormapIndex(image,(ssize_t) index,exception);
           if (first_segment)
@@ -3295,7 +3289,6 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception)
                 sequence=MagickTrue;
                 continue;
               }
-
     if ((unsigned int) ((group << 16) | element) == 0xFFFEE0DD)
       {
         if (data != (unsigned char *) NULL)
@@ -3303,14 +3296,12 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception)
         sequence=MagickFalse;
         continue;
       }
-
     if (sequence != MagickFalse)
       {
         if (data != (unsigned char *) NULL)
           data=(unsigned char *) RelinquishMagickMemory(data);
         continue;
       }
-
     switch (group)
     {
       case 0x0002: