jfcabana / omg_dosimetry

Optimized Multichannel Gafchromic Dosimetry
https://omg-dosimetry.readthedocs.io/en/latest/
MIT License
7 stars 2 forks source link

Unable to see a complete report from omg_calibration_demo.py #6

Closed LuisOlivaresJ closed 9 months ago

LuisOlivaresJ commented 1 year ago

The steps I followed to install OMG_D were:

$ conda create --name omg_d python=3.10
$ pip install omg-dosimetry

These are the output figures and pdf, after I run the file. I am going to try figure out the problem.

Captura1

Captura2

Captura3

jfcabana commented 1 year ago

I am running OMG-D in Spyder (distributed with Anaconda). I don't know if it's related, but I need to change the preferences for graphics backend to Automatic instead of the default (inline).

image

LuisOlivaresJ commented 1 year ago

Thanks Jean, it works. In the corresponding documentation I'll add that spyder is another requirement. I just wanted to run the script in Visual Studio Code, or Anaconda PowerShell.

jfcabana commented 1 year ago

Great, I'm glad you got it working! I always used OMG in Spyder, but it would be nice if we could get it to work in other IDEs too.

LuisOlivaresJ commented 11 months ago

The problem seems to be the use of plt.show() in non-interactive mode before all plots are done.

The first call to show a Figure starts on line L351 (from imageRGB.py), when we want to show the gafchromic image:

https://github.com/jfcabana/omg_dosimetry/blob/f6bfc948960f5a59be8138fe8b45b24970cf4226/src/omg_dosimetry/imageRGB.py#L336-L352

Seems that once the figure is displayed, it stops acepting new plots or draws. We can see that behaviour after line L615, because the next plots methods (L616 self.plot_profile,L617 self.plot_calibration_curves, ....) do not work (the gafchromic films is the only image showed in the pdf report). https://github.com/jfcabana/omg_dosimetry/blob/f6bfc948960f5a59be8138fe8b45b24970cf4226/src/omg_dosimetry/calibration.py#L603-L619

As an attempt to solve that, I added a plt.ion just after the creation of the Figure object: https://github.com/jfcabana/omg_dosimetry/blob/f6bfc948960f5a59be8138fe8b45b24970cf4226/src/omg_dosimetry/calibration.py#L603-L607

When I run omg_calibration_demo.py file in Visual Studio Code, the pdf report is correctly generated! :smiley:

I have the modification on Branch plt_ion, but before a Pull Request, I am also considering to change the default parameter show to False, in the plot method of BaseImage class:

https://github.com/jfcabana/omg_dosimetry/blob/f6bfc948960f5a59be8138fe8b45b24970cf4226/src/omg_dosimetry/imageRGB.py#L336

In the next days I am going to analyze what could be the implication of that approach, particularly if the user choose a manual ROI selection.

jfcabana commented 11 months ago

Looks promising! I always wanted to make the software flexible and not dependant on a specific IDE. There will probably be other issues along the way, notably with the analysis module that relies heavily on interactive plots. Thanks for working on this :)

LuisOlivaresJ commented 9 months ago

Fixed in #16, If it is ok, I will close this issue.