Open pilchat opened 3 years ago
Hi! We are planning to release several example usage scripts shortly.
But have you tried running any of the scripts in test/manual_tests? That is a good place to start.
Hi,
I have problems too. I tryed to get started with the test files but for example using
/manual_test_all_modes.py' leads to
saving static dosemaps: 0%| | 0/4 [00:00<?, ?it/s]
and nothing happens anymore. Can you create a step-by-step guide on how to import your own RDSR and create 2 and 3D maps? What adjustments are necessary? What corrections need to be created etc.
For which systems does the import of the RDSR work? Thanks
Hi @Witty159 We're still working on the user manual with, e.g., info on how to go about running it with custom RDSR-parsing.
PySkinDose is, at the moment, tested for Siemens Axiom Artis and Phillips Allura CLarity. Please correct me if I'm wrong @MaxHellstrom
A couple of questions about your problem.
manual_test_all_modes.py
that you could include here to help us find out what's going wrong?Hi again @BwKodex & @MaxHellstrom ,
there is no error code, it seems that the code hangs at this point. I'm using windows 10 with the newest python anaconda package. I tried using Spyder, jupyter lab, and PyCharm. So far i have not read in my own rdsr and use the ones that came with the installation.
We have Siemens Artis Zee and Philips Allura Xper. Thank you for your help and all the work that went into this beautiful project!
Hi @Witty159
Thank you for notifying us about this issue. Information like this is very appreciated. I'll get back to you after some testing. @BwKodex , yes, PySkinDose supports Siemens Axiom Artis and Phillips Allura Clarity at the moment, but there is currently a bug in Allura compliance that I am addressing now.
I'll get back to you,
Max
Hi @MaxHellstrom,
it's been a while. Have you been able to find out anything so far?
Greetings
Witty159
Hi all (@MaxHellstrom, @BwKodex ),
again a short error report.
The error mentioned above is still present: /manual_test_all_modes.py' leads to saving static dosemaps: 0%| | 0/4 [00:00<?, ?it/s]
Now the following code workes for the S1.dcm but not for philips allura RDSR The code:
from base_dev_settings import DEVELOPMENT_PARAMETERS from pyskindose import constants from pyskindose.main import main from pyskindose.settings_pyskindose import PyskindoseSettings
settings = PyskindoseSettings(settings=DEVELOPMENT_PARAMETERS) settings.mode = constants.MODE_CALCULATE_DOSE settings.plot.interactivity = True settings.plot.plot_dosemap = True
settings.rdsr_filename='philips_allura_clarity_u104.dcm' main(settings=settings)
Error:
Traceback (most recent call last):
File "C:\Users\NTBO203\Downloads\PySkinDose-master2\PySkinDose-master\tests\manualtests\test.py", line 13, in
Process finished with exit code 1
with settings.estimate_k_tab=True it works. So whats up here? Also, the calculated skin dose for an Allura clarity (Xper) system seems very low to me. With 80% multiple overlap and a DFP of 100 000 cGycm² (approx. 19x19 cm² field size @ Detector, corrected for entrence filde ~ 200 cm²), 0.3 Gy is displayed as PSD. However, a short estimation leads me to believe that it should be more in the direction of 6-8 Gy.
And: How can I optimize the geometrie: I can shift the phantome settings.phantom.patient_offset.d_ver=0 settings.phantom.patient_offset.d_lat=0 settings.phantom.patient_offset.d_lon=0
but in most times, I have to shift the beam.
Here, the phantome must be shifted to the center (which i can do with patient_offset) but than the beam does not hit the head.
Perhapse you can help me.
Greetings
Witty159
Hi @Witty159, I've tried to look into your problem a bit. The first error seems to me as it might have to do with the filesystem. At the moment, the code tries to save the images into the same folder as the one where you run your code, when I did my test run this was the _manualtests directory of my cloned copy of PySkinDose. Perhaps the plotly function used to save the static dose map freezes here. I'll look into adding a setting for where the output file should be directed so that one can make sure that the runner has write/modify permissions to that directory
Regarding the second error (TypeError: 'NoneType' object is not subscriptable), I've checked it and it seems to be a mismatch between how the Allura Clarity model is specified in the corrections database and in the DICOM file, which leads to no data being found for the parameters sent to the query. We will add a fix for this as soon as possible.
Regarding the PSD level/value, are you referring to a calculation done on the example file _philips_allura_calrityu104.dcm?
As for the last question. I'm not sure I understand in what way you want to optimize the geometry. In what way do you want to shift the beam?
PySkinDose utilizes a geometry PySkinDose relative to the source (or the iso-centre). Any translations performed are made relative to the iso-centre. So you can add translations to the table by the normalization settings and can move the patient relative the table.
Hi @BwKodex,
thank you for your quick response. Concerning the first error: I have installed all packages for plotly, now it works :).
conda install "jupyterlab>=3" "ipywidgets>=7.6" pip install "notebook>=5.3" "ipywidgets>=7.5" conda install -c conda-forge python-kaleido ... (see https://pypi.org/project/plotly/5.6.0/)
Regarding the PSD level: Sorry for that, I checked again and accidentally used the wrong rdsr.
What I actually meant is that in the top picture, the table is not completely in the beam path. Is it possible to move the table so that the beam is completely weakened by the table?
two further questions: The test code plot_event always results in the same image, also when i change the event_index to different numbers
settings.mode = constants.MODE_PLOT_EVENT settings.plot_event_index = 9 settings.print_parameters() main(settings=settings)
The output of print_parameters is: plot dark_mode : True notebook_mode : False plot_dosemap : False colorscale : jet max_events_for_patient_inclusion : 0 plot_event_index : 12 plot_event_index : 20
And is there an option to save the interactive plot?
Thanks a lot for your support. I love your project :)
Again, a new problem:
The code:
from base_dev_settings import DEVELOPMENT_PARAMETERS from pyskindose import constants from pyskindose.main import main from pyskindose.settings_pyskindose import PyskindoseSettings
settings = PyskindoseSettings(settings=DEVELOPMENT_PARAMETERS) settings.mode = constants.MODE_CALCULATE_DOSE settings.plot.interactivity = True settings.plot.plot_dosemap = True settings.estimate_k_tab=True settings.rdsr_filename='philips_allura_clarity_u601.dcm' settings.phantom.patient_offset.d_lat=0
main(settings=settings)
and the error:
Traceback (most recent call last):
File "C:\Users\NTBO203\Downloads\PySkinDose-master2\PySkinDose-master\tests\manual_tests\manual_test_calculate_dosestatic.py", line 15, in
Process finished with exit code 1
perhapse you can help me again, sorry for all the questions
Hi @MaxHellstrom @BwKodex ,
it's been a while. Have you been able to find out anything so far?
Greetings
Witty159
Hi @Witty159, I'm sorry about the delay. I've been on parental leave for a while. I'll try to look into your new error as soon as possible. I have a suspicion on what might have caused the error but I'll have to investigate it further.
I've just created a release (v22.5.1) with a fix for a previous error you reported with the Allura Clarity system
@Witty159 As for your questions that were not concerning the error, which I've now identified as being caused by the kVp for some exposures in the RDSR being outside of the tabulated values fro HVL
Moving the table relative to the beam You should be able to move the table relative to the beam by modifying the changing the normalization settings for your machine. I think the settings you're looking for is the translation offset.
Changing plot_event_index settings
The plot event index setting is located in the attribute settings.plot.plot_event_index
so you need to change the value there to "make it stick"
Hi @BwKodex i need help with pyskindose . I tryed to get started with the test files and send me error pandas.errors.DatabaseError: Execution failed on sql 'SELECT * FROM hvl_combined': no such table: hvl_combined
Hi @gustavega, That seems like an error I've encountered recently where the actual, that should be created the first run, is not found so that an empty SQLite database is queried instead. I'm looking into fixing this bug.
Hi @gustavega, That seems like an error I've encountered recently where the actual, that should be created the first run, is not found so that an empty SQLite database is queried instead. I'm looking into fixing this bug.
Hello @BwKodex, I am also new to using PySkinDose, and have run into a similar problem. Currently I am using the DEVELOPMENT_PARAMETERS (slightly tweaked) for the PyskindoseSettings and the most basic commands. I just wanted to see if there is a temporary work-around or alternative way to do a dose calculation while this bug is addressed? Is there some setting I can turn off or hard-coded number/file I can use in place of this lookup? I have tried digging around without much luk yet and wanted to ask here as well. Thank you!
Hi @gustavega and @hgrover44
There is now a PR (#56) for fixing the problem with the path of the corrections db-file being wrong when running the script.
The workaround before this is merged would be to find the path of the db-file and the path where PySkinDose expects to find it later on (when it crashes) and copy the database file to that location. A bit cumbersome but doable. I've used that myself as a temporary fix for our dose monitoring systems (REMbox) integration with PySkinDose.
Hi again @gustavega and @hgrover44, Now, there is a new release of PySkinDose (24.10.0) in which you can specify the path to the corrections db in the settings.
A getting-started usage instruction is also imminent.
Hi @BwKodex , this release work !!! thanks , in another question i try use for my locals RDSR, modified the file "base_dev_settings" but only modified in file name line. The question is about if i need modified another settings in the file or another step in other file ? thanks
@gustavega: Great! Nice to know that it's working now :)
Depending on which vendor and model the machine that your file comes from you might have to modify the normalization settings to match the correct values for that machine. The normalization settings are used for telling PySkinDose any translation offset that needs to be applied to the table position and in which direction the table moves when the table position values change.
Yes!! the model machine is AXIOM-Artis in RDSR file, but in the commercial name is Artis Q. For me is the same model.. another hint ? thanks!
Hi @gustavega,
We are currently working on normalization and compliance for additional models beyond the AXIOM Artis and Allura Clarity systems. We’ve encountered some normalization bugs, but they should be resolved and merged into the main branch soon (PR #60).
We haven’t had the chance to review an Artis Q model yet. Would it be possible for you to anonymize your Artis Q RDSR file and send it via email so I can take a look?
Thanks in advance!
Hi Max, would shared your email ? i think i would shared my another two models Artis Zee and Artis One. I send you SR for Artis Q IM-0001-1124-0001.dcm.zip
Hi again, thanks so much! I’ll take a look later tonight and get back to you as soon as I can.
The RDSR file you provided has ManufacturerModelName set to AXIOM-Artis, and it works just fine. Are you sure that it is the Artis Q model? Also, did you get any error messages?
Yes, the commercial name in my country is Artis Q, Artis Zee and Artis One. I think all models is one family for Siemens "Axiom-Artis" . I dont have errors, the results for this models is in the position, for example position X Y Z the patient. In the script "base_dev_settings.py" i modified the line "c.OFFSET_LATERAL_KEY" for value i think is correct for ubication for the antomical region, another option is in the "normalization_settings.json" line "Z" translation. But i i dont know what is the correct value depend for my SR file. shared the other model "artis One" IM-0001-1124-0001.dcm.zip
Thanks for your reply!
Could you please try the following script? Just add a new test under test/manual tests.
This script adjusts the patient’s position by moving them 10 cm down from the table top and 10 cm to the right of the table’s center line:
from base_dev_settings import DEVELOPMENT_PARAMETERS
from pyskindose import constants
from pyskindose.main import main
from pyskindose.settings import PyskindoseSettings
from pathlib import Path
settings = PyskindoseSettings(settings=DEVELOPMENT_PARAMETERS)
settings.mode = constants.MODE_PLOT_SETUP
file_path = Path(r'PATH_TO_YOUR_RDSR_FILE')
# move patient position upon the table:
settings.phantom.patient_offset.d_lat = -10 # move patient in Z - lat dir
settings.phantom.patient_offset.d_lon = -10 # move patient in x - lon dir
main(settings=settings, file_path=file_path)
Regarding normalization:
We just fixed a bug (#60) that prevented the user to manually adding their own normalization. You can change the normalization tags by adding the following to the code above ( and run it with settings.mode = constants.MODE_PLOT_PROCEDURE) to confirm correct results.
# this section will change the origin a cm in all three directions.
settings.normalization_settings.trans_offset.x = a
settings.normalization_settings.trans_offset.y = a
settings.normalization_settings.trans_offset.z = a
# this section will change positive direction in direction x (similarity for y and z)
settings.normalization_settings.trans_dir.x = 1 or -1
Please try running the code above and let me know if it works for you. I hope it brings more clarity to the process.
Additionally, you can adjust the patient’s orientation by setting settings.phantom.patient_orientation
to either "head_first_supine" or "feet_first_supine".
some clarifications:
The issue with some machines is that the table position tags are referenced relative to an unknown origin. To resolve this, we use a normalization_json file in PySkinDose to map the origin (i.e., the head end of the patient support table) to the origin of the table position tags in the RDSR file.
For certain models, like AXIOM-Artis, the origin in the DICOM tags aligns perfectly with the expected origin, which is why the translation offset tags for AXIOM-Artis are set to (0, 0, 0).
However, this isn’t the case for all models. For example, with the Allura Clarity, the offset must be set to (-0.3, 105.5, -173.35) to correctly align the table’s actual position (0, 0, 0) with the corresponding point in PySkinDose.
If these values don’t match your system, you can measure and determine the correct offsets yourself, then adjust the normalization as outlined in my previous post.
We’re working on improving the clarity of the normalization process for skin dose mapping in future documentation, including upcoming guides and use cases. Additionally, we plan to release a new “Getting Started” notebook later this week.
Best regards, Max
Great! @MaxHellstrom , the script run good! i run for the other models and fix the position. The other code for normalization is not necessary in this time. I run correctly pyskindose. Thanks From the Costa Rica...
Hi,
I have succesfully installed PySkinDose in my windows machine. Now I would like to run it: is there any user manual with some example code?
Thanks