Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created offset calculations for Catphan604 #297

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Folders to ignore
.vscode
env/*
**/pylinac.egg-info
#**/demo_files
Expand All @@ -7,3 +8,4 @@ env/*
#Files to ignore
*.old
.directory

5 changes: 5 additions & 0 deletions pylinac/ct.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down