def create_projection_image_dicom_scaffold
      # Some tags are created/updated only if no DICOM object already exists:
      unless @dcm
        # Setup general image attributes:
        create_general_dicom_image_scaffold
        # Group 3002:
        @dcm.add_element(RT_IMAGE_LABEL, @beam.description)
        @dcm.add_element(RT_IMAGE_NAME, @beam.name)
        @dcm.add_element(RT_IMAGE_DESCRIPTION, @beam.plan.name)
        # Note: If support for image plane type 'NON_NORMAL' is added at some
        # point, the RT Image Orientation tag (3002,0010) has to be added as well.
        @dcm.add_element(RT_IMAGE_PLANE, 'NORMAL')
        @dcm.add_element(X_RAY_IMAGE_RECEPTOR_TRANSLATION, '')
        @dcm.add_element(X_RAY_IMAGE_RECEPTOR_ANGLE, '')
        @dcm.add_element(RADIATION_MACHINE_NAME, @beam.machine)
        @dcm.add_element(RADIATION_MACHINE_SAD, @beam.sad)
        @dcm.add_element(RADIATION_MACHINE_SSD, @beam.sad)
        @dcm.add_element(RT_IMAGE_SID, @beam.sad)
        # FIXME: Add Exposure sequence as well (with Jaw and MLC position information)
        # Group 300A:
        @dcm.add_element(DOSIMETER_UNIT, @beam.unit)
        @dcm.add_element(GANTRY_ANGLE, @beam.control_points[0].gantry_angle)
        @dcm.add_element(COLL_ANGLE, @beam.control_points[0].collimator_angle)
        @dcm.add_element(PEDESTAL_ANGLE, @beam.control_points[0].pedestal_angle)
        @dcm.add_element(TABLE_TOP_ANGLE, @beam.control_points[0].table_top_angle)
        @dcm.add_element(ISO_POS, @beam.control_points[0].iso.to_s)
        @dcm.add_element(GANTRY_PITCH_ANGLE, '0.0')
        # Group 300C:
        s = @dcm.add_sequence(REF_PLAN_SQ)
        i = s.add_item
        i.add_element(REF_SOP_CLASS_UID, @beam.plan.class_uid)
        i.add_element(REF_SOP_UID, @beam.plan.sop_uid)
        @dcm.add_element(REF_BEAM_NUMBER, @beam.number)
      end
    end
def create_projection_image_dicom_scaffold
      # Some tags are created/updated only if no DICOM object already exists:
      unless @dcm
        # Setup general image attributes:
        create_general_dicom_image_scaffold
        # Group 3002:
        @dcm.add_element(RT_IMAGE_LABEL, @beam.description)
        @dcm.add_element(RT_IMAGE_NAME, @beam.name)
        @dcm.add_element(RT_IMAGE_DESCRIPTION, @beam.plan.name)
        # Note: If support for image plane type 'NON_NORMAL' is added at some
        # point, the RT Image Orientation tag (3002,0010) has to be added as well.
        @dcm.add_element(RT_IMAGE_PLANE, 'NORMAL')
        @dcm.add_element(X_RAY_IMAGE_RECEPTOR_TRANSLATION, '')
        @dcm.add_element(X_RAY_IMAGE_RECEPTOR_ANGLE, '')
        @dcm.add_element(RADIATION_MACHINE_NAME, @beam.machine)
        @dcm.add_element(RADIATION_MACHINE_SAD, @beam.sad)
        @dcm.add_element(RADIATION_MACHINE_SSD, @beam.sad)
        @dcm.add_element(RT_IMAGE_SID, @beam.sad)
        # FIXME: Add Exposure sequence as well (with Jaw and MLC position information)
        # Group 300A:
        @dcm.add_element(DOSIMETER_UNIT, @beam.unit)
        @dcm.add_element(GANTRY_ANGLE, @beam.control_points[0].gantry_angle)
        @dcm.add_element(COLL_ANGLE, @beam.control_points[0].collimator_angle)
        @dcm.add_element(PEDESTAL_ANGLE, @beam.control_points[0].pedestal_angle)
        @dcm.add_element(TABLE_TOP_ANGLE, @beam.control_points[0].table_top_angle)
        @dcm.add_element(ISO_POS, @beam.control_points[0].iso.to_s)
        @dcm.add_element(GANTRY_PITCH_ANGLE, '0.0')
        # Group 300C:
        s = @dcm.add_sequence(REF_PLAN_SQ)
        i = s.add_item
        i.add_element(REF_SOP_CLASS_UID, @beam.plan.class_uid)
        i.add_element(REF_SOP_UID, @beam.plan.sop_uid)
        @dcm.add_element(REF_BEAM_NUMBER, @beam.number)
      end
    end
Creates a new DICOM object with a set of basic attributes needed
 for a valid DICOM file of modality RTIMAGE.