Skip to content

Commit

Permalink
uses verify_in_list in mibitiff read util
Browse files Browse the repository at this point in the history
  • Loading branch information
ackagel committed Feb 25, 2021
1 parent 83eeab0 commit dd5eda9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions ark/utils/tiff_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import datetime
from itertools import compress

from ark.utils.misc_utils import verify_in_list


def read_mibitiff(file, channels=None):
""" Reads MIBI data from an IonpathMIBI TIFF file.
Expand Down Expand Up @@ -49,13 +51,11 @@ def read_mibitiff(file, channels=None):

# make sure all passed channels were found
if channels is not None:
channel_names = [return_channel[1] for return_channel in return_channels]
found_channels = [channel not in channel_names for channel in channels]
if any(found_channels):
raise IndexError(
f'The following channels could not be found as named: '
f'{list(compress(channels, found_channels))}'
)
try:
channel_names = [return_channel[1] for return_channel in return_channels]
verify_in_list(passed_channels=channels, in_tiff=channel_names)
except ValueError as exc:
raise IndexError('Passed unknown channels...') from exc

return np.stack(img_data, axis=2), return_channels

Expand Down

0 comments on commit dd5eda9

Please sign in to comment.