lancelevine / SlicerDRRGenerator

A 3D Slicer extension that generates Digitally Reconstructed Radiographs
12 stars 5 forks source link

Using the module in a python script #10

Open YassinAbdelrahman opened 7 months ago

YassinAbdelrahman commented 7 months ago

Hi Lance/anyone who can help,

How would you use this in a python script to automate the generation of DRRs? I have tried it the following way but it does not work:



# Set parameters
parameters = {}
parameters["InputVolume"] = ct_volume.GetID()
parameters["OutputResolution"] = [512, 512]
parameters["SourceSid"] = 1000  # Source to Isocenter Distance (mm)
parameters["SourceToAxisDistance"] = 1000  # Source to Detector Distance (mm)
parameters["GantryAngle"] = 0  # Gantry angle (degrees)
parameters["CollimatorAngle"] = 0  # Collimator angle (degrees)
parameters["CouchAngle"] = 0  # Couch angle (degrees)

# Generate DRR
slicer.cli.runSync(drr_generator, None, parameters)```

Is this not a CLI module? If so, what would work instead? Thank you in advance for the help!

Kind Regards,
Yassin
YassinAbdelrahman commented 7 months ago

Hi all,

Now that I have looked into it further, it seems the functions SetInputVolume and SetOutputVolume are not able to be called with python, but the rest of the widget functions are (like SetRotationX). Is this supposed to be the case? If so, how could I change this?

Thank you, Yassin