Skip to content

Commit

Permalink
Merge branch 'master' of github.com:pylidc/pylidc
Browse files Browse the repository at this point in the history
  • Loading branch information
notmatthancock committed Apr 22, 2020
2 parents 72e1f0b + f54d6d9 commit 5320a42
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions pylidc/Annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ def visualize_in_scan(self, verbose=True):
)
# Remove the cell borders.
# It Seems like there should be an easier way to do this...
for cell in scan_info_table.properties()['child_artists']:
for cell in scan_info_table.properties()['children']:
cell.set_color('w')

ax_scan_info.set_title('Scan Info')
Expand Down Expand Up @@ -873,7 +873,7 @@ def visualize_in_scan(self, verbose=True):
)

# Again, remove cell borders.
for cell in annotation_info_table.properties()['child_artists']:
for cell in annotation_info_table.properties()['children']:
cell.set_color('w')

ax_annotation_info.set_title('Annotation Info')
Expand Down
18 changes: 11 additions & 7 deletions pylidc/Scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,9 @@ def load_all_dicom_images(self, verbose=True):
images = scan.load_all_dicom_images()
zs = [float(img.ImagePositionPatient[2]) for img in images]
print(zs[1] - zs[0], img.SliceThickness, scan.slice_thickness)
print(zs[1] - zs[0], images[0].SliceThickness, scan.slice_thickness)
plt.imshow( images[0].pixel_array, cmap=plt.cm.gray )
plt.imshow(images[0].pixel_array, cmap=plt.cm.gray)
plt.show()
"""
Expand Down Expand Up @@ -539,7 +539,7 @@ def visualize(self, annotation_groups=None):
loc='center', cellLoc='left'
)
# Remove the table cell borders.
for cell in scan_info_table.properties()['child_artists']:
for cell in scan_info_table.properties()['children']:
cell.set_color('w')
# Add title, remove ticks from scan info.
ax_scan_info.set_title('Scan Info')
Expand All @@ -561,7 +561,7 @@ def visualize(self, annotation_groups=None):
ann_grps_table = ax_ann_grps.table(cellText=txt, loc='center',
cellLoc='left')
# Remove cell borders.
for cell in ann_grps_table.properties()['child_artists']:
for cell in ann_grps_table.properties()['children']:
cell.set_color('w')
# Add title, remove ticks from scan info.
ax_ann_grps.set_title('Nodule Info')
Expand Down Expand Up @@ -638,7 +638,11 @@ def to_volume(self, verbose=True):
"""
images = self.load_all_dicom_images(verbose=verbose)

volume = np.zeros((512,512,len(images)))
for i in range(len(images)):
volume[:,:,i] = images[i].pixel_array
volume = np.stack(
[
x.pixel_array * x.RescaleSlope + x.RescaleIntercept
for x in images
],
axis=-1,
).astype(np.int16)
return volume

0 comments on commit 5320a42

Please sign in to comment.