def generate_pt_signed_in_short_range(out_dir, patient_id): sb = StudyBuilder(patient_position="HFS", patient_id=patient_id, patients_name="PtSigned^InShortRange", patients_birthdate="20121212") pt = sb.build_pt(num_voxels=[48, 64, 10], voxel_size=[4, 3, 4], # [mm] pixel_representation=get_pixel_representation('unsigned'), rescale_slope=1) pt.clear(stored_value=0) pt.add_box(size=[25, 50, 5], center=[0, 0, 0], stored_value=12345, mode='set') # Smallest stored value is: 0 (in short range) # Largest stored value is: 12345 (in short range). mk_fresh_dir(out_dir) sb.write(out_dir) print out_dir
elif series.modality == "MR": if 'PatientPosition' not in sb.current_study: parser.error("Patient position must be specified when writing MR images!") ib = sb.build_mr( num_voxels=num_voxels, voxel_size=voxel_size, pixel_representation=pixel_representations[series.pixel_representation], center=np.array(series.center)) elif series.modality == "PT": if 'PatientPosition' not in sb.current_study: parser.error("Patient position must be specified when writing MR images!") ib = sb.build_pt( num_voxels=num_voxels, voxel_size=voxel_size, pixel_representation=pixel_representations[series.pixel_representation], rescale_slope=series.rescale_slope, center=np.array(series.center)) elif series.modality == "RTDOSE": ib = sb.build_dose( num_voxels=num_voxels, voxel_size=voxel_size, center=np.array(series.center)) elif series.modality == "RTPLAN": isocenter = [float(b) for b in series.isocenter.lstrip('[').rstrip(']').split(";")] rp = sb.build_static_plan(nominal_beam_energy=series.nominal_energy, isocenter=isocenter, mlc_direction=series.mlc_direction, sad=series.sad) elif series.modality == "RTSTRUCT": rtstruct = sb.build_structure_set()