Skip to content

Commit 4dc3d28

Browse files
author
Dan Levitas
committed
[ENH] Update pet2bids version and fix 4D singleton dimension issue
1 parent 153b7e0 commit 4dc3d28

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

handler/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ RUN apt update && \
1010
RUN apt install -y parallel python3 python3-pip tree curl unzip git jq python libgl-dev python-numpy
1111

1212
RUN pip3 install numpy==1.23.0 nibabel==4.0.0 pandas==1.0.1 matplotlib pyyaml==5.4.1 pydicom==2.3.1 natsort pydeface && \
13-
pip3 install quickshear pypet2bids==1.3.2 mne mne-bids
13+
pip3 install quickshear pypet2bids==1.3.5 mne mne-bids
1414

1515
RUN apt-get install -y build-essential pkg-config cmake git pigz rename zstd libopenjp2-7 libgdcm-tools wget libopenblas-dev && \
1616
apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y

handler/ezBIDS_core/createThumbnailsMovies.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,13 @@ def create_thumbnail(img_file, image):
6565
"""
6666

6767
if image.ndim == 4:
68-
object_img_array = image.dataobj[..., 1]
68+
try:
69+
object_img_array = image.dataobj[..., 1]
70+
except:
71+
# weird issue where an improper singleton 4D dimension is added for otherwise 3D data (see with PET)
72+
image = nib.funcs.squeeze_image(image)
73+
object_img_array = image.dataobj[:]
74+
image.to_filename(img_file)
6975
else:
7076
object_img_array = image.dataobj[:]
7177

0 commit comments

Comments
 (0)