diff --git a/.gitignore b/.gitignore index 1e8b660e8..5271920e4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ # Folders to ignore +.vscode env/* **/pylinac.egg-info #**/demo_files @@ -7,3 +8,4 @@ env/* #Files to ignore *.old .directory + diff --git a/pylinac/ct.py b/pylinac/ct.py index e9a4fd6e2..f8396a737 100644 --- a/pylinac/ct.py +++ b/pylinac/ct.py @@ -19,6 +19,7 @@ import webbrowser import zipfile from typing import Optional +from math import ceil, floor import matplotlib.pyplot as plt import numpy as np @@ -1023,6 +1024,10 @@ def find_origin_slice(self): if not hu_slices: raise ValueError("No slices were found that resembled the HU linearity module") + if isinstance(self, CatPhan604): + _604_hu_offset_index_front = int(ceil(5 / self.dicom_stack.metadata.SliceThickness)) + _604_hu_offset_index_back = int(ceil(2 / self.dicom_stack.metadata.SliceThickness)) + hu_slices = hu_slices[_604_hu_offset_index_front:-_604_hu_offset_index_back] hu_slices = np.array(hu_slices) c = int(round(np.median(hu_slices))) ln = len(hu_slices)