Added discard_small_clusters() method in BaseImage class to remove small clusters.
Additionally, I have noticed that plot() method form BaseImage now uses origin='upper', but plot_clusters() does not. Below is an example of the output figure when plot_clusters() is called. As can be seen, the image and the scatter are inverted.
Script example:
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,
)
clusters = gaf.dose_opt.detect_clusters()
print(len(gaf.dose_opt.clusters)) # 388
gaf.dose_opt.discard_small_clusters(minimum_length=2)
print(len(gaf.dose_opt.clusters)) # 13
gaf.dose_opt.plot_clusters()
Added
discard_small_clusters()
method in BaseImage class to remove small clusters.Additionally, I have noticed that
plot()
method form BaseImage now uses origin='upper', butplot_clusters()
does not. Below is an example of the output figure when plot_clusters() is called. As can be seen, the image and the scatter are inverted.Script example: