예제 #1
0
    def test_exec(self):
        """ Prepare and execute a dry-run test using the Executer.
        """
        logger.info("Test norun TRiP98 execution")

        logger.debug("Load CtxCube {:s}".format(self.ctx_path))
        c = pt.CtxCube()
        c.read(self.ctx_path)

        logger.debug("Load VdxCube {:s}".format(self.vdx_path))
        v = pt.VdxCube(c)
        v.read(self.vdx_path)

        print(v.voi_names())

        projectile = pte.Projectile('H')
        kernel = pte.KernelModel(projectile)
        kernel.ddd_path = "/opt/TRiP98/base/DATA/DDD/12C/RF3MM/*"
        kernel.spc_path = "/opt/TRiP98/base/DATA/SPC/12C/RF3MM/*"
        kernel.sis_path = "/opt/TRiP98/base/DATA/SIS/12C.sis"
        kernel.rifi_thickness = 3.0
        plan = pte.Plan(default_kernel=kernel, basename=self.patient_name)
        self.assertIsNotNone(plan)

        plan.hlut_path = "/opt/TRiP98/base/DATA/HLUT/19990218.hlut"
        plan.dedx_path = "/opt/TRiP98/base/DATA/DEDX/20040607.dedx"
        plan.working_dir = "."  # working dir must exist.

        # add the target voi to the plan
        plan.voi_target = v.get_voi_by_name('target')

        plan.bolus = 0.0
        plan.offh2o = 1.873

        # create a field and add it to the plan
        field = pte.Field(kernel)
        self.assertIsNotNone(field)
        field.basename = self.patient_name
        field.gantry = 10.0
        field.couch = 90.0  # degrees
        field.fwhm = 4.0  # spot size in [mm]

        plan.fields.append(field)

        # flags for what output should be generated
        plan.want_phys_dose = True
        plan.want_bio_dose = False
        plan.want_dlet = True
        plan.want_rst = False

        t = pte.Execute(c, v)
        self.assertIsNotNone(t)
        t.trip_bin_path = self.trip_path
        print(self.trip_path)
        if os.name != 'nt':  # skip running fake TRiP98 on Windows as it is not supported there
            t.execute(
                plan, False
            )  # setup and make a dry-run, since TRiP98 is not installed.

        executer_str = str(t)
        self.assertGreater(len(executer_str), 1)
예제 #2
0
# Next we load the CT cube:
c = pt.CtxCube()
c.read(ctx_path)

# And load the contours
v = pt.VdxCube(c)
v.read(vdx_path)

# we may print all contours found in the Vdx file, if we want to
print(v.voi_names())

# We need to specify where the kernel files can be found. The location may depend on the ion we
# want to treat with. This example sets up a kernel model for C-12 ions with a 3 mm Ripple Filter.
mykernel = pte.KernelModel()
mykernel.projectile = pte.Projectile("C", a=12)
mykernel.ddd_path = trip_path + "/DATA/DDD/12C/RF3MM/*"
mykernel.spc_path = trip_path + "/DATA/SPC/12C/RF3MM/*"
mykernel.sis_path = trip_path + "/DATA/SIS/19981218.sis"
mykernel.rifi_thickness = 3.0  # 3 mm ripple filter. (Only for documentaiton, will not affect dose optimization.)
mykernel.rifi_name = "GSI_1D_3mm"  # Additional free text for documentation.
mykernel.comment = "Carbon-12 ions with 3 mm 1D Ripple Filter"

# Ok, we have the Contours, the CT cube and dose kernels ready. Next we must prepare a plan.
# We may choose any basename for the patient. All output files will be named using
# this basename.
plan = pte.Plan(basename=patient_name, default_kernel=mykernel)

# Plan specific data:
plan.hlut_path = trip_path + "/DATA/HLUT/19990218.hlut"  # Hounsfield lookup table location
plan.dedx_path = trip_path + "/DATA/DEDX/20000830.dedx"  # Stopping power tables