Skip to content

Commit

Permalink
Merge branch 'CatPhan604HURegistration' of github.com:crcrewso/pylina…
Browse files Browse the repository at this point in the history
…c into CatPhan604HURegistration
  • Loading branch information
crcrewso committed Jun 10, 2020
2 parents b173259 + 8509511 commit eca9821
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,4 +1,5 @@
# Folders to ignore
.vscode
env/*
**/pylinac.egg-info
#**/demo_files
Expand Down
9 changes: 8 additions & 1 deletion pylinac/ct.py
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 @@ -1002,7 +1003,8 @@ def find_origin_slice(self):
The middle slice of the HU linearity module.
"""
hu_slices = []
for image_number in range(0, self.num_images, 2):
step_size = 2
for image_number in range(0, self.num_images, step_size):
slice = Slice(self, image_number, combine=False)
#print(image_number)
# slice.image.plot()
Expand All @@ -1023,6 +1025,11 @@ 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):
# remove the detected slices without the wire ramp
rois_without_ramp_mm = 10
_604_hu_offset_index_front = int(round((rois_without_ramp_mm / step_size) / self.dicom_stack.metadata.SliceThickness))
hu_slices = hu_slices[_604_hu_offset_index_front:]
hu_slices = np.array(hu_slices)
c = int(round(np.median(hu_slices)))
ln = len(hu_slices)
Expand Down

0 comments on commit eca9821

Please sign in to comment.