Unable to run FieldProfileAnalysis on a .tif image

I am trying to analyze a radiochromic film scan using Pylinac but I am getting a bunch of errors. I have tried both FieldAnalysis and FieldProfileAnalysis to no avail. Please help. If I pass the image directly as an argument in FieldProfileAnalysis, I still get errors.

Input:

from pylinac import FieldProfileAnalysis, Edge

fa = FieldProfileAnalysis(img_path) # nothing special needed as it’s the default

you may also specify the edge smoothing value. This is a gaussian filter applied to the derivative just for the purposes of finding the min/max derivative.

This is to ensure the derivative is not caught by some noise. It is usually not necessary to change this.

fa.analyze(
centering=Centering.BEAM_CENTER,
x_width=0.02,
y_width=0.02,
normalization=Normalization.BEAM_CENTER,
edge_type=Edge.INFLECTION_DERIVATIVE,
ground=True,
metrics=(
PenumbraLeftMetric(),
PenumbraRightMetric(),
SymmetryAreaMetric(),
FlatnessDifferenceMetric(),
),
)

Output:ValueError Traceback (most recent call last)


ValueError Traceback (most recent call last)
Cell In[15], line 7
4 img_path = r’C:/Users/megha/Downloads/Documents/transmitive_10x10_Nimi_Megha_28_03_24.tif’
6 fa = FieldAnalysis(img_path)
----> 7 fa.analyze()

File ~\anaconda3\Lib\site-packages\pylinac\field_analysis.py:578, in FieldAnalysis.analyze(self, protocol, centering, vert_position, horiz_position, vert_width, horiz_width, in_field_ratio, slope_exclusion_ratio, invert, is_FFF, penumbra, interpolation, interpolation_resolution_mm, ground, normalization_method, edge_detection_method, edge_smoothing_ratio, hill_window_ratio, **kwargs)
575 normalization_method = convert_to_enum(normalization_method, Normalization)
576 centering = convert_to_enum(centering, Centering)
→ 578 self._analyze(
579 edge_detection_method,
580 edge_smoothing_ratio,
581 ground,
582 horiz_position,
583 horiz_width,
584 in_field_ratio,
585 interpolation,
586 interpolation_resolution_mm,
587 is_FFF,
588 kwargs,
589 normalization_method,
590 penumbra,
591 protocol,
592 slope_exclusion_ratio,
593 vert_position,
594 vert_width,
595 centering,
596 hill_window_ratio,
597 )

File ~\anaconda3\Lib\site-packages\pylinac\field_analysis.py:693, in FieldAnalysis._analyze(self, edge_detection_method, edge_smoothing_ratio, ground, horiz_position, horiz_width, in_field_ratio, interpolation, interpolation_resolution_mm, is_FFF, kwargs, normalization_method, penumbra, protocol, slope_exclusion_ratio, vert_position, vert_width, centering, hill_window_ratio)
685 self._results[“geometric_center_index_x_y”] = (
686 self.horiz_profile.geometric_center()[“index (exact)”],
687 self.vert_profile.geometric_center()[“index (exact)”],
688 )
689 self._results[“beam_center_index_x_y”] = (
690 self.horiz_profile.beam_center()[“index (exact)”],
691 self.vert_profile.beam_center()[“index (exact)”],
692 )
→ 693 self._results[“field_size_vertical_mm”] = self.vert_profile.field_data(
694 in_field_ratio=1.0, slope_exclusion_ratio=slope_exclusion_ratio
695 )[“width (exact) mm”]
696 self._results[“field_size_horizontal_mm”] = self.horiz_profile.field_data(
697 in_field_ratio=1.0, slope_exclusion_ratio=slope_exclusion_ratio
698 )[“width (exact) mm”]
699 self._results[“beam_center_to_top_mm”] = self.vert_profile.field_data(
700 in_field_ratio=1.0, slope_exclusion_ratio=slope_exclusion_ratio
701 )[“left distance->beam center (exact) mm”]

File ~\anaconda3\Lib\site-packages\argue\argumentative.py:83, in bounds..decorator..wrapper(*args, **kwargs)
80 if start > value or value > stop:
81 raise error_type(message.format(
82 value, func.name, start, stop))
—> 83 return func(*args, **kwargs)

File ~\anaconda3\Lib\site-packages\pylinac\core\profile.py:1320, in SingleProfile.field_data(self, in_field_ratio, slope_exclusion_ratio)
1318 inner_right_idx = beam_center_idx + slope_exclusion_ratio * field_width / 2
1319 inner_right_idx_r = int(round(inner_right_idx))
→ 1320 left_fit = linregress(
1321 range(field_left_idx_r, inner_left_idx_r + 1),
1322 self._y_original_to_interp(
1323 np.arange(field_left_idx_r, inner_left_idx_r + 1)
1324 ),
1325 )
1326 right_fit = linregress(
1327 range(inner_right_idx_r, field_right_idx_r + 1),
1328 self._y_original_to_interp(
1329 np.arange(inner_right_idx_r, field_right_idx_r + 1)
1330 ),
1331 )
1333 # top calc

File ~\anaconda3\Lib\site-packages\scipy\stats_stats_mstats_common.py:154, in linregress(x, y, alternative)
151 y = np.asarray(y)
153 if x.size == 0 or y.size == 0:
→ 154 raise ValueError(“Inputs must not be empty.”)
156 if np.amax(x) == np.amin(x) and len(x) > 1:
157 raise ValueError("Cannot calculate a linear regression "
158 “if all x values are identical”)

ValueError: Inputs must not be empty.