jfcabana / omg_dosimetry

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

Dev analysis #48

Closed jfcabana closed 1 month ago

jfcabana commented 2 months ago

Several impovements and functionnality additions to the analysis module. The code still lacks proper documentation, but the addition made are useful, thus the pull request.

Update analysis.py

Update imageRGB.py

LuisOlivaresJ commented 2 months ago

Looks great! This weekend I going to read the modifications on imageRGB.py

LuisOlivaresJ commented 2 months ago

Looks great! This weekend I going to read the modifications on imageRGB.py

plot_isodoses works on the demo file "A1A_Multi_6cm_001.tif" :smiley:

Contour_example

This is the code to reproduce:

from omg_dosimetry.tiff2dose import Gaf
from omg_dosimetry import tiff2dose
import matplotlib.pyplot as plt

# Load demo LUT
path_to_lut_file = tiff2dose.from_demo_lut()

# Load folder to demo tif file
path_to_tif_folder = tiff2dose.from_demo_image()

# Gaf init.
fit_type = 'rational'
clip = 500
gaf = Gaf(
    path_to_tif_folder,
    lut_file=path_to_lut_file,
    fit_type=fit_type,
    clip=clip,
    img_filt=3,
    crop_edges=0.1,
)

# Plotting
fig, axes = plt.subplots(1, 2)
gaf.dose_opt.plot(ax=axes[0], show=False, colorbar=True, title="Dose")
gaf.dose_opt.plot_isodoses(levels=[350], inline=True, ax=axes[1], show=False, title="Contour")

plt.show()
LuisOlivaresJ commented 2 months ago

Could it be useful to have a method to remove clusters with an area below a given value? Using this can be a solution. I am working on it.

jfcabana commented 2 months ago

Could it be useful to have a method to remove clusters with an area below a given value? Using this can be a solution. I am working on it.

Yes I think it's a good idea!

LuisOlivaresJ commented 1 month ago

Note: I have made a few changes (review my recent commit to analysis.py): mostly formatting changes. Tested and it's functional on my side, but should verify on your side that nothing breaks.

Clusters I have not tested as I haven't dived too deep on this at our center. Perhaps @LuisOlivaresJ could redo the test/example case with the updated "remove small clusters" implementation.

"remove_small_clusters" runs without errors :thumbsup:. Thanks @petruong