Skip to content

Commit

Permalink
Merge pull request #23 from physimals/tk
Browse files Browse the repository at this point in the history
Remove surf-pvcorr
  • Loading branch information
mcraig-ibme authored Jan 3, 2024
2 parents ac587b5 + 7aa0d12 commit f09eac7
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 32 deletions.
2 changes: 0 additions & 2 deletions oxasl/basil/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ def groups(self, parser):

g = OptionGroup(parser, "BASIL partial volume correction (PVEc)")
g.add_option("--pvcorr", help="Apply PVEc using FAST estimates taken from --fslanat dir", action="store_true", default=False)
g.add_option("--surf-pvcorr", help="Apply PVEc using surface PV estimates taken from --fslanat dir w/ surfaces (not mutually exclusive with --pvcorr)", action="store_true", default=False)
g.add_option('--cores', help="Number of processor cores to use for --surf-pvcorr", type=int)
g.add_option("--pvgm", help="GM PV estimates in ASL space (apply PVEc only, don't estimate PVs)", type="image", default=None)
g.add_option("--pvwm", help="As above, WM PV estimates in ASL space", type="image", default=None)
g.add_option("--pvcsf", help="As above, CSF PV estimates in ASL space", type="image", default=None)
Expand Down
25 changes: 1 addition & 24 deletions oxasl/basil/fabber_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
from oxasl import mask, reg
from . import multistep_fit

try:
import oxasl_surfpvc
except ImportError:
oxasl_surfpvc = None

def run(wsp):
# Basic non-PVC run
Expand All @@ -38,7 +34,7 @@ def run(wsp):
# If the user has provided manual PV maps (pvgm and pvgm) then do PVEc, even if they
# have not explicitly given the --pvcorr option
wsp.user_pv_flag = ((wsp.pvwm is not None) and (wsp.pvgm is not None))
if wsp.pvcorr or wsp.surf_pvcorr or wsp.user_pv_flag:
if wsp.pvcorr or wsp.user_pv_flag:
# Partial volume correction is very sensitive to the mask, so recreate it
# if it came from the structural image as this requires accurate ASL->Struc registration
if wsp.rois.mask_src == "struc":
Expand All @@ -49,9 +45,6 @@ def run(wsp):
if wsp.pvcorr or wsp.user_pv_flag:
_default_pvcorr(wsp)

if wsp.surf_pvcorr:
_surf_pvcorr

def _default_pvcorr(wsp):
# Do partial volume correction fitting
#
Expand All @@ -75,19 +68,3 @@ def _default_pvcorr(wsp):
multistep_fit.run(wsp.sub("basil_pvcorr"), prefit=False)
wsp.quantify_wsps.append("basil_pvcorr")

def _surf_pvcorr(wsp):
if oxasl_surfpvc is None:
raise RuntimeError("Surface-based PVC requested but oxasl_surfpvc is not installed")
if wsp.user_pv_flag:
wsp.log.write(" - WARNING: Performing surface based PVC ignores user-specified PV maps\n")
# Prepare GM and WM partial volume maps from surface using Toblerone plugin
# Then reform the ASL ROI mask - Toblerone does not handle the cerebellum so need
# to mask it out
oxasl_surfpvc.prepare_surf_pvs(wsp)
wsp.rois.mask_pvcorr = wsp.rois.mask
min_pv = 0.01
new_roi = (wsp.basil_options["pwm"].data > min_pv) | (wsp.basil_options["pgm"].data > min_pv)
wsp.rois.mask = Image(new_roi.astype(np.int8), header=wsp.rois.mask_pvcorr.header)

multistep_fit.run(wsp.sub("basil_surf_pvcorr"), prefit=False)
wsp.quantify_wsps.append("basil_surf_pvcorr")
7 changes: 1 addition & 6 deletions oxasl/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@
except ImportError:
oxasl_enable = None

try:
import oxasl_surfpvc
except ImportError:
oxasl_surfpvc = None

try:
import oxasl_multite
except ImportError:
Expand Down Expand Up @@ -192,7 +187,7 @@ def oxasl(wsp):
Main oxasl pipeline script
"""
wsp.log.write("OXASL version: %s\n" % __version__)
for plugin in (oxasl_ve, oxasl_mp, oxasl_deblur, oxasl_enable, oxasl_surfpvc, oxasl_multite):
for plugin in (oxasl_ve, oxasl_mp, oxasl_deblur, oxasl_enable, oxasl_multite):
if plugin is not None:
wsp.log.write(" - Found plugin: %s (version %s)\n" % (plugin.__name__, getattr(plugin, "__version__", "unknown")))

Expand Down

0 comments on commit f09eac7

Please sign in to comment.