Skip to content

Commit

Permalink
PIXI-155: Use technician perspective field to rotate image if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
andylassiter committed Nov 18, 2024
1 parent 8d92381 commit 49592d5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- [PIXI-155] - Technician perspective field added to the hotel scan record form. The front/back perspectives can be
selected for the hotel scan record. The image will be rotated accordingly during the splitting process
if the perspective is set to back.

### Fixed

- [PIXI-148] - Fix issue with Inveon CT sessions splitting not detecting enough regions. Will now adjust the threshold
Expand Down Expand Up @@ -60,4 +66,5 @@ Initial release of the PIXI Mice Image Splitter and Docker image.
[PIXI-136]: https://radiologics.atlassian.net/browse/PIXI-136
[PIXI-146]: https://radiologics.atlassian.net/browse/PIXI-146
[PIXI-148]: https://radiologics.atlassian.net/browse/PIXI-148
[PIXI-149]: https://radiologics.atlassian.net/browse/PIXI-149
[PIXI-149]: https://radiologics.atlassian.net/browse/PIXI-149
[PIXI-155]: https://radiologics.atlassian.net/browse/PIXI-155
7 changes: 7 additions & 0 deletions splitter_of_mice/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ def run(username: str, password: str, server: str,
# Convert hotel scan record to metadata dictionary format expected by splitter of mice
metadata = convert_hotel_scan_record(hotel_scan_record, dicom=isDicomSession, mpet=not isDicomSession)

# Get Technicians Perspective and rotate image if needed
technicians_perspective = hotel_scan_record.get('technicianPerspective', 'Front')
technicians_perspective = technicians_perspective.lower()

for i, (splitter, output_dir) in enumerate(zip(splitters, output_dirs)):
# custom code to handle wustl scanners
pet_img_size = None
Expand All @@ -88,6 +92,9 @@ def run(username: str, password: str, server: str,
pet_img_size = (43, 43)
ct_img_size = (172, 172)

if technicians_perspective == 'back':
splitter.pi.rotate_on_axis('y')

exit_code = splitter.split_mice(output_dir, num_anim=num_anim, remove_bed=True,
zip=True, dicom_metadata=metadata, output_qc=True,
pet_img_size=pet_img_size, ct_img_size=ct_img_size)
Expand Down
6 changes: 0 additions & 6 deletions splitter_of_mice/splitter_of_mice/image_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ def read_chunks(ifr):
self.img_data = imgmat.reshape(nplanes, ps.y_dimension, ps.x_dimension, nframes)
self.scaled = True

self.rotate_on_axis('x')
return

def save_cut(self, index, path, zip=False):
Expand Down Expand Up @@ -455,9 +454,6 @@ def write_chunks(data, dfile):
cut_img = self.cuts[index]
metadata = cut_img.metadata

# did this when reading image data, flip it back now
cut_img.rotate_on_axis('x')

# update header variables
cut_hdr_lines = hdr_lines
vars_to_update = ['x_dimension', 'y_dimension', 'z_dimension', 'subject_weight']
Expand Down Expand Up @@ -551,8 +547,6 @@ def write_chunks(data, dfile):
logger.error('PatientID not found in metadata. Unable to add to zip_outputs.')
raise Exception('PatientID not found in metadata. Unable to add to zip_outputs.')

# clean up after myself.
cut_img.rotate_on_axis('x')
out_data = None
gc.collect()

Expand Down

0 comments on commit 49592d5

Please sign in to comment.