def load_pixel_data(dcm)
      raise ArgumentError, "Invalid argument 'dcm'. Expected DObject, got #{dcm.class}." unless dcm.is_a?(DICOM::DObject)
      raise ArgumentError, "Invalid argument 'dcm'. Expected modality 'RTIMAGE', got #{dcm.value(MODALITY)}." unless dcm.value(MODALITY) == 'RTIMAGE'
      # Set attributes common for all image modalities, i.e. CT, MR, RTDOSE & RTIMAGE:
      @dcm = dcm
      @narray = dcm.narray
      @date = dcm.value(IMAGE_DATE)
      @time = dcm.value(IMAGE_TIME)
      @columns = dcm.value(COLUMNS)
      @rows = dcm.value(ROWS)
      # Some difference in where we pick our values depending on if we have an
      # RTIMAGE or another type (e.g. CR):
      if @series.modality == 'RTIMAGE'
        image_position = dcm.value(RT_IMAGE_POSITION).split("\\")
        raise "Invalid DICOM image: 2 basckslash-separated values expected for RT Image Position (Patient), got: #{image_position}" unless image_position.length == 2
        @pos_x = image_position[0].to_f
        @pos_y = image_position[1].to_f
        spacing = dcm.value(IMAGE_PLANE_SPACING).split("\\")
        raise "Invalid DICOM image: 2 basckslash-separated values expected for Image Plane Pixel Spacing, got: #{spacing}" unless spacing.length == 2
        @col_spacing = spacing[1].to_f
        @row_spacing = spacing[0].to_f
      else
        image_position = dcm.value(IMAGE_POSITION).split("\\")
        raise "Invalid DICOM image: 3 basckslash-separated values expected for Image Position (Patient), got: #{image_position}" unless image_position.length == 3
        @pos_x = image_position[0].to_f
        @pos_y = image_position[1].to_f
        spacing = dcm.value(SPACING).split("\\")
        raise "Invalid DICOM image: 2 basckslash-separated values expected for Pixel Spacing, got: #{spacing}" unless spacing.length == 2
        @col_spacing = spacing[1].to_f
        @row_spacing = spacing[0].to_f
      end
    end
def load_pixel_data(dcm)
      raise ArgumentError, "Invalid argument 'dcm'. Expected DObject, got #{dcm.class}." unless dcm.is_a?(DICOM::DObject)
      raise ArgumentError, "Invalid argument 'dcm'. Expected modality 'RTIMAGE', got #{dcm.value(MODALITY)}." unless dcm.value(MODALITY) == 'RTIMAGE'
      # Set attributes common for all image modalities, i.e. CT, MR, RTDOSE & RTIMAGE:
      @dcm = dcm
      @narray = dcm.narray
      @date = dcm.value(IMAGE_DATE)
      @time = dcm.value(IMAGE_TIME)
      @columns = dcm.value(COLUMNS)
      @rows = dcm.value(ROWS)
      # Some difference in where we pick our values depending on if we have an
      # RTIMAGE or another type (e.g. CR):
      if @series.modality == 'RTIMAGE'
        image_position = dcm.value(RT_IMAGE_POSITION).split("\\")
        raise "Invalid DICOM image: 2 basckslash-separated values expected for RT Image Position (Patient), got: #{image_position}" unless image_position.length == 2
        @pos_x = image_position[0].to_f
        @pos_y = image_position[1].to_f
        spacing = dcm.value(IMAGE_PLANE_SPACING).split("\\")
        raise "Invalid DICOM image: 2 basckslash-separated values expected for Image Plane Pixel Spacing, got: #{spacing}" unless spacing.length == 2
        @col_spacing = spacing[1].to_f
        @row_spacing = spacing[0].to_f
      else
        image_position = dcm.value(IMAGE_POSITION).split("\\")
        raise "Invalid DICOM image: 3 basckslash-separated values expected for Image Position (Patient), got: #{image_position}" unless image_position.length == 3
        @pos_x = image_position[0].to_f
        @pos_y = image_position[1].to_f
        spacing = dcm.value(SPACING).split("\\")
        raise "Invalid DICOM image: 2 basckslash-separated values expected for Pixel Spacing, got: #{spacing}" unless spacing.length == 2
        @col_spacing = spacing[1].to_f
        @row_spacing = spacing[0].to_f
      end
    end
Transfers the pixel data, as well as the related image properties and the
 DObject instance itself, to the image instance.

 @param [DICOM::DObject] dcm  an instance of a DICOM object
 @raise [ArgumentError] if the given dicom object doesn't have a projection image type modality