Skip to content

Commit abd3694

Browse files
committed
fixed some bugs for CL image (QC) and alignment bugs
1 parent ccbcc28 commit abd3694

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

amypet/align.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,12 @@ def align_frames(
133133
mniidir = opth / 'mash-n-align'
134134
rsmpl_opth = mniidir / 'aligned'
135135
com_opth = mniidir / 'com_modified'
136+
137+
# > proceed only if there is any work to be done otherwise return None
136138
if nfrm>0:
137139
nimpa.create_dir(rsmpl_opth)
140+
else:
141+
return None
138142

139143
# > output dictionary
140144
outdct = {}

amypet/backend_centiloid.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ def run(fpets, fmris, Cnt, tracer='pib', flip_pet=None, bias_corr=True, cmass_co
178178
and CL ,`csv_metrics`='long'
179179
"""
180180

181+
if not voxsz in [1, 2]:
182+
raise ValueError('Voxel size can only be integer and 1 or 2 mm')
181183

182184
# > the processing stage must be one of registration 'r',
183185
# > normalisation 'n', CL scaling 'c' or full 'f':
@@ -593,7 +595,8 @@ def run(fpets, fmris, Cnt, tracer='pib', flip_pet=None, bias_corr=True, cmass_co
593595
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
594596
# transaxial tiling for QC
595597
# choose the shape of the mosaic/tiled image
596-
izs = np.array([[30, 40, 50], [60, 70, 80]])
598+
#izs = np.array([[30, 40, 50], [60, 70, 80]])
599+
izs = np.array([[60, 80, 100], [120, 140, 160]]) // voxsz
597600

598601
# get the shape of the mosaic
599602
shp = izs.shape
@@ -618,7 +621,8 @@ def run(fpets, fmris, Cnt, tracer='pib', flip_pet=None, bias_corr=True, cmass_co
618621
# Sagittal tiling for QC
619622

620623
# choose the shape of the mosaic/tiled image
621-
ixs = np.array([[20, 30, 40], [50, 60, 70]])
624+
# ixs = np.array([[20, 30, 40], [50, 60, 70]])
625+
ixs = np.array([[40, 60, 80], [100, 120, 140]]) // voxsz
622626

623627
# get the shape of the mosaic
624628
shp = ixs.shape
@@ -657,13 +661,13 @@ def run(fpets, fmris, Cnt, tracer='pib', flip_pet=None, bias_corr=True, cmass_co
657661
urstr = ", ".join([
658662
f"PiB transformed: $UR_{{WC}}=${ur['wc']:.3f}", f"$UR_{{GMC}}=${ur['cg']:.3f}",
659663
f"$UR_{{CBS}}=${ur['wcb']:.3f}", f"$UR_{{PNS}}=${ur['pns']:.3f}"])
660-
ax[1].text(0, 190, urstr, fontsize=12)
664+
ax[1].text(0, 380/voxsz, urstr, fontsize=12)
661665

662666
if tracer != 'new':
663667
clstr = ", ".join([
664668
f"$CL_{{WC}}=${cl['wc']:.1f}", f"$CL_{{GMC}}=${cl['cg']:.1f}",
665669
f"$CL_{{CBS}}=${cl['wcb']:.1f}", f"$CL_{{PNS}}=${cl['pns']:.1f}"])
666-
ax[1].text(0, 205, clstr, fontsize=12)
670+
ax[1].text(0, 410/voxsz, clstr, fontsize=12)
667671

668672
plt.tight_layout()
669673
fig.subplots_adjust(left=0.05, right=0.95, bottom=0.05, top=0.95, hspace=0.1, wspace=0.1)

amypet/preproc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def get_t1(input_fldr, Cnt, ignore_derived=False, rem_prev_conv=True):
5050
if f.is_file() and hasext(f,
5151
('nii', 'nii.gz')) and any(p in fname for p in Cnt['pttrn_t1']):
5252
fniit1 = f
53-
elif f.is_dir() and any(p in fname for p in Cnt['pttrn_t1']):
53+
elif f.is_dir() and any([p in fname for p in Cnt['pttrn_t1']]):
5454
t1dcm = nimpa.dcmsort(f)
5555
if not t1dcm:
5656
niilist = list(f.glob('*.nii*'))

0 commit comments

Comments
 (0)