Removal of hu_roi_vals

Hi,

I notice in versions > 2.3.2 the hu_roi_vals property has been removed and replaced with the roi_vals_as_str property as way to access this data.
This breaks some tests for us as we like to compare the HU values to a reference value in QATrack (means we can plot changes and trend etc) and we were extracting them from the dict generated by hu_roi_vals , which was fairly clean.
With the roi_vals_as_str property it’s possible to get the values but no longer as a dict, they all come as one long string e.g. “Air: -1000.0, PMP: -199.0, LDPE: -107.0, Poly: -42.5, Acrylic: 168.0, Delrin: 426.0, Teflon: 1183.0”, which is a bit more fiddly to work with for the end user, for example:

Version 2.3.2:
huvals = myct.ctp404.hu_roi_vals

air_hu = huvals[“Air”]

Version 2.4+:

huvals = myct.ctp404.roi_vals_as_str
huvals = huvals.split(“,”)
huvals = dict(map(lambda s: s.split(“:”), huvals))

air_hu = huvals[“Air”]

I’m I accessing this the right way, or is there an easier way now that I’m missing?

Many thanks,

Ben

You can get the pixel values through the rois attr. I tested on v2.5 which is what I had handy at the moment.

myct.ctp404.rois[‘Air’].pixel_value

the rois attr is a dict of HU disk ROIs so that you can access all/relevant properties: CatPhan module documentation — pylinac 2.4.0 documentation.

In the next major version (3.0) there will be a specific return dataclass that will be more stable than grabbing attrs directly so this should improve this type of scenario.

Thanks for clarrifying James, that’s much easier!

Thanks,

Ben