~ubuntu-branches/ubuntu/quantal/imagemagick/quantal

« back to all changes in this revision

Viewing changes to coders/dcm.c

  • Committer: Package Import Robot
  • Author(s): Michael Terry
  • Date: 2012-07-10 11:21:50 UTC
  • mfrom: (6.2.24 sid)
  • Revision ID: package-import@ubuntu.com-20120710112150-liko2z4agqah3n5t
Tags: 8:6.7.7.10-2ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - Make ufraw-batch (universe) a suggestion instead of a recommendation.
  - Don't set MAKEFLAGS in debian/rules; just pass it to the build.
* debian/control:
  - Build-Depend on libtiff5-dev instead of libtiff-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
%                                 July 1992                                   %
18
18
%                                                                             %
19
19
%                                                                             %
20
 
%  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization      %
 
20
%  Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization      %
21
21
%  dedicated to making software imaging solutions freely available.           %
22
22
%                                                                             %
23
23
%  You may not use this file except in compliance with the License.  You may  %
3025
3025
          if ((group == (ssize_t) dicom_info[i].group) &&
3026
3026
              (element == (ssize_t) dicom_info[i].element))
3027
3027
            break;
3028
 
        (void) fprintf(stdout,"0x%04lX %4ld %s-%s (0x%04lx,0x%04lx)",
 
3028
        (void) FormatLocaleFile(stdout,"0x%04lX %4ld %s-%s (0x%04lx,0x%04lx)",
3029
3029
          (unsigned long) image->offset,(long) length,implicit_vr,
3030
3030
          explicit_vr,(unsigned long) group,(unsigned long) element);
3031
3031
        if (dicom_info[i].description != (char *) NULL)
3032
 
          (void) fprintf(stdout," %s",dicom_info[i].description);
3033
 
        (void) fprintf(stdout,": ");
 
3032
          (void) FormatLocaleFile(stdout," %s",dicom_info[i].description);
 
3033
        (void) FormatLocaleFile(stdout,": ");
3034
3034
      }
3035
3035
    if ((group == 0x7FE0) && (element == 0x0010))
3036
3036
      {
3037
3037
        if (image_info->verbose != MagickFalse)
3038
 
          (void) fprintf(stdout,"\n");
 
3038
          (void) FormatLocaleFile(stdout,"\n");
3039
3039
        break;
3040
3040
      }
3041
3041
    /*
3063
3063
              count=ReadBlob(image,(size_t) quantum*length,data);
3064
3064
              if (count != (ssize_t) (quantum*length))
3065
3065
                {
3066
 
                  (void) fprintf(stdout,"count=%d quantum=%d length=%d "
3067
 
                    "group=%d\n",(int) count,(int) quantum,(int) length,(int)
3068
 
                    group);
 
3066
                  (void) FormatLocaleFile(stdout,"count=%d quantum=%d "
 
3067
                    "length=%d group=%d\n",(int) count,(int) quantum,(int)
 
3068
                    length,(int) group);
3069
3069
                   ThrowReaderException(CorruptImageError,
3070
3070
                     "InsufficientImageDataInFile");
3071
3071
                }
3092
3092
                group=0;
3093
3093
                element=0;
3094
3094
                if (image_info->verbose != MagickFalse)
3095
 
                  (void) fprintf(stdout,
 
3095
                  (void) FormatLocaleFile(stdout,
3096
3096
                    "Corrupted image - trying explicit format\n");
3097
3097
                break;
3098
3098
              }
3101
3101
              (void) CopyMagickString(transfer_syntax,(char *) data,
3102
3102
                MaxTextExtent);
3103
3103
            if (image_info->verbose != MagickFalse)
3104
 
              (void) fprintf(stdout,"transfer_syntax=%s\n",(const char*)
3105
 
                transfer_syntax);
 
3104
              (void) FormatLocaleFile(stdout,"transfer_syntax=%s\n",
 
3105
                (const char*) transfer_syntax);
3106
3106
            if (strncmp(transfer_syntax,"1.2.840.10008.1.2",17) == 0)
3107
3107
              {
3108
3108
                int
3421
3421
    if (image_info->verbose != MagickFalse)
3422
3422
      {
3423
3423
        if (data == (unsigned char *) NULL)
3424
 
          (void) fprintf(stdout,"%d\n",datum);
 
3424
          (void) FormatLocaleFile(stdout,"%d\n",datum);
3425
3425
        else
3426
3426
          {
3427
3427
            /*
3438
3438
                datum=0;
3439
3439
                for (j=(ssize_t) length-1; j >= 0; j--)
3440
3440
                  datum=(256*datum+data[j]);
3441
 
                (void) fprintf(stdout,"%d",datum);
 
3441
                (void) FormatLocaleFile(stdout,"%d",datum);
3442
3442
              }
3443
3443
            else
3444
3444
              for (i=0; i < (ssize_t) length; i++)
3445
3445
                if (isprint((int) data[i]) != MagickFalse)
3446
 
                  (void) fprintf(stdout,"%c",data[i]);
 
3446
                  (void) FormatLocaleFile(stdout,"%c",data[i]);
3447
3447
                else
3448
 
                  (void) fprintf(stdout,"%c",'.');
3449
 
            (void) fprintf(stdout,"\n");
 
3448
                  (void) FormatLocaleFile(stdout,"%c",'.');
 
3449
            (void) FormatLocaleFile(stdout,"\n");
3450
3450
          }
3451
3451
      }
3452
3452
    if (data != (unsigned char *) NULL)
3557
3557
          (void) fputc(c,file);
3558
3558
        }
3559
3559
        (void) fclose(file);
3560
 
        (void) FormatMagickString(read_info->filename,MaxTextExtent,
 
3560
        (void) FormatLocaleString(read_info->filename,MaxTextExtent,
3561
3561
          "jpeg:%s",filename);
3562
3562
        if (image->compression == JPEG2000Compression)
3563
 
          (void) FormatMagickString(read_info->filename,MaxTextExtent,
 
3563
          (void) FormatLocaleString(read_info->filename,MaxTextExtent,
3564
3564
            "jp2:%s",filename);
3565
3565
        jpeg_image=ReadImage(read_info,exception);
3566
3566
        if (jpeg_image != (Image *) NULL)
3648
3648
        one=1;
3649
3649
        if (colors == 0)
3650
3650
          colors=one << depth;
3651
 
        if (AcquireImageColormap(image,colors) == MagickFalse)
 
3651
        if (AcquireImageColormap(image,one << depth) == MagickFalse)
3652
3652
          ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
3653
3653
        if (redmap != (int *) NULL)
3654
3654
          for (i=0; i < (ssize_t) colors; i++)
3729
3729
              {
3730
3730
                case 0:
3731
3731
                {
3732
 
                  SetRedPixelComponent(q,ScaleCharToQuantum((unsigned char)
 
3732
                  SetPixelRed(q,ScaleCharToQuantum((unsigned char)
3733
3733
                    ReadDCMByte(stream_info,image)));
3734
3734
                  break;
3735
3735
                }
3736
3736
                case 1:
3737
3737
                {
3738
 
                  SetGreenPixelComponent(q,ScaleCharToQuantum((unsigned char)
 
3738
                  SetPixelGreen(q,ScaleCharToQuantum((unsigned char)
3739
3739
                    ReadDCMByte(stream_info,image)));
3740
3740
                  break;
3741
3741
                }
3742
3742
                case 2:
3743
3743
                {
3744
 
                  SetBluePixelComponent(q,ScaleCharToQuantum((unsigned char)
 
3744
                  SetPixelBlue(q,ScaleCharToQuantum((unsigned char)
3745
3745
                    ReadDCMByte(stream_info,image)));
3746
3746
                  break;
3747
3747
                }
3748
3748
                case 3:
3749
3749
                {
3750
 
                  SetOpacityPixelComponent(q,(QuantumRange-
3751
 
                    ScaleCharToQuantum((unsigned char) ReadDCMByte(stream_info,
3752
 
                    image))));
 
3750
                  SetPixelAlpha(q,ScaleCharToQuantum((unsigned char)
 
3751
                    ReadDCMByte(stream_info,image)));
3753
3752
                  break;
3754
3753
                }
3755
3754
                default:
3822
3821
                        pixel_value=(int) (polarity != MagickFalse ? (max_value-
3823
3822
                          ReadDCMLSBShort(stream_info,image)) :
3824
3823
                          ReadDCMLSBShort(stream_info,image));
3825
 
                      if (signed_data == 1)
3826
 
                        pixel_value=((signed short) pixel_value);
3827
3824
                    }
3828
3825
                  else
3829
3826
                    {
3870
3867
                  }
3871
3868
                index&=mask;
3872
3869
                index=(int) ConstrainColormapIndex(image,(size_t) index);
3873
 
                SetIndexPixelComponent(indexes+x,index);
 
3870
                SetPixelIndex(indexes+x,index);
3874
3871
                pixel.red=1UL*image->colormap[index].red;
3875
3872
                pixel.green=1UL*image->colormap[index].green;
3876
3873
                pixel.blue=1UL*image->colormap[index].blue;
3908
3905
                    pixel.blue=scale[pixel.blue];
3909
3906
                  }
3910
3907
              }
3911
 
            SetRedPixelComponent(q,pixel.red);
3912
 
            SetGreenPixelComponent(q,pixel.green);
3913
 
            SetBluePixelComponent(q,pixel.blue);
 
3908
            SetPixelRed(q,pixel.red);
 
3909
            SetPixelGreen(q,pixel.green);
 
3910
            SetPixelBlue(q,pixel.blue);
3914
3911
            q++;
3915
3912
          }
3916
3913
          if (SyncAuthenticPixels(image,exception) == MagickFalse)
4000
3997
                    }
4001
3998
                  index&=mask;
4002
3999
                  index=(int) ConstrainColormapIndex(image,(size_t) index);
4003
 
                  SetIndexPixelComponent(indexes+x,(((size_t)
4004
 
                    GetIndexPixelComponent(indexes+x)) | (((size_t) index) <<
 
4000
                  SetPixelIndex(indexes+x,(((size_t)
 
4001
                    GetPixelIndex(indexes+x)) | (((size_t) index) <<
4005
4002
                    8)));
4006
4003
                  pixel.red=1UL*image->colormap[index].red;
4007
4004
                  pixel.green=1UL*image->colormap[index].green;
4040
4037
                      pixel.blue=scale[pixel.blue];
4041
4038
                    }
4042
4039
                }
4043
 
              SetRedPixelComponent(q,(((size_t) GetRedPixelComponent(q)) |
 
4040
              SetPixelRed(q,(((size_t) GetPixelRed(q)) |
4044
4041
                (((size_t) pixel.red) << 8)));
4045
 
              SetGreenPixelComponent(q,(((size_t) GetGreenPixelComponent(q)) |
 
4042
              SetPixelGreen(q,(((size_t) GetPixelGreen(q)) |
4046
4043
                (((size_t) pixel.green) << 8)));
4047
 
              SetBluePixelComponent(q,(((size_t) GetBluePixelComponent(q)) |
 
4044
              SetPixelBlue(q,(((size_t) GetPixelBlue(q)) |
4048
4045
                (((size_t) pixel.blue) << 8)));
4049
4046
              q++;
4050
4047
            }