Skip to content

Commit

Permalink
rename segment subfields to subregions
Browse files Browse the repository at this point in the history
  • Loading branch information
ahoopes committed Feb 15, 2022
1 parent 95c3673 commit 1cc6646
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ if(NOT MINIMAL)
qdec_glmfit
resurf
spline3
subfields
subregions
stat_normalize
stim_polar
mri_synthseg
Expand Down
4 changes: 0 additions & 4 deletions python/freesurfer/subfields/__init__.py

This file was deleted.

4 changes: 4 additions & 0 deletions python/freesurfer/subregions/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from freesurfer.subregions.process import structure_names
from freesurfer.subregions.process import run_cross_sectional
from freesurfer.subregions.process import run_longitudinal
from freesurfer.samseg.gemsbindings import setGlobalDefaultNumberOfThreads as set_thread_count
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import freesurfer as fs

from freesurfer import samseg
from freesurfer.subfields import utils
from freesurfer.subfields.core import MeshModel
from freesurfer.subregions import utils
from freesurfer.subregions.core import MeshModel


class BrainstemSubstructures(MeshModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import freesurfer as fs

from freesurfer import samseg
from freesurfer.subfields import utils
from freesurfer.subregions import utils


class MeshModel:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import freesurfer as fs

from freesurfer import samseg
from freesurfer.subfields import utils
from freesurfer.subfields.core import MeshModel
from freesurfer.subregions import utils
from freesurfer.subregions.core import MeshModel


class HippoAmygdalaSubfields(MeshModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import freesurfer as fs

from freesurfer import samseg
from freesurfer.subfields import utils
from freesurfer.subfields.thalamus import ThalamicNuclei
from freesurfer.subfields.brainstem import BrainstemSubstructures
from freesurfer.subfields.hippocampus import HippoAmygdalaSubfields
from freesurfer.subregions import utils
from freesurfer.subregions.thalamus import ThalamicNuclei
from freesurfer.subregions.brainstem import BrainstemSubstructures
from freesurfer.subregions.hippocampus import HippoAmygdalaSubfields


model_lookup = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import freesurfer as fs

from freesurfer import samseg
from freesurfer.subfields import utils
from freesurfer.subfields.core import MeshModel
from freesurfer.subregions import utils
from freesurfer.subregions.core import MeshModel


class ThalamicNuclei(MeshModel):
Expand Down
File renamed without changes.
3 changes: 0 additions & 3 deletions subfields/CMakeLists.txt

This file was deleted.

3 changes: 3 additions & 0 deletions subregions/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
project(subregions)

install_pyscript(segment_subregions)
20 changes: 10 additions & 10 deletions subfields/segment_subfields → subregions/segment_subregions
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@

import os
import freesurfer as fs
from freesurfer import subfields
from freesurfer import subregions


description = f'''
Cross-sectional and longitudinal segmentation for the following
structures: {", ".join(subfields.structure_names)}. To segment
structures: {", ".join(subregions.structure_names)}. To segment
the thalamic nuclei, for example, in a cross-sectional analysis:
segment_subfields thalamus --cross subj
segment_subregions thalamus --cross subj
Similarly, for a longitudinal analysis, run:
segment_subfields thalamus --long-base base \\
--long-tps m00.long.base m24.long.base
segment_subregions thalamus --long-base base \\
--long-tps m00.long.base m24.long.base
where each argument to --long-tps represents a subject timepoint.
Output segmentations and computed structure volumes will be
saved to the subject's `mri` subdirectory.
'''

parser = fs.utils.ArgumentParser(description=description)
parser.add_argument('structure', help=f'Structure to segment. Options are: {", ".join(subfields.structure_names)}.')
parser.add_argument('structure', help=f'Structure to segment. Options are: {", ".join(subregions.structure_names)}.')
parser.add_argument('--cross', help='Subject to segment in cross-sectional analysis.')
parser.add_argument('--long-tps', nargs='+', help='Subject timepoints to segment in longitudinal analysis.')
parser.add_argument('--long-base', help='Base subject for longitudinal analysis.')
Expand All @@ -40,7 +40,7 @@ if not fs.fshome():
fs.fatal('FREESURFER_HOME must be set!')

# Specify the maximum number of threads the GEMS code will use
subfields.set_thread_count(args.threads)
subregions.set_thread_count(args.threads)

# Sanity check on process type
if args.cross and (args.long_base or args.long_tps):
Expand Down Expand Up @@ -92,16 +92,16 @@ for side in sides:
'tempDir': args.temp_dir,
})
if args.structure == 'hippo-amygdala':
# Provide some extra data for hippocampal subfields
# Provide some extra data for hippocampal subregions
subjParameters['wmParcFileName'] = os.path.join(subjdir, 'mri', 'wmparc.mgz')
return subjParameters

if args.cross:
# Cross-sectional analysis
parameters = config_subj_params(args.cross, out_dir=args.out_dir)
subfields.run_cross_sectional(args.structure, parameters)
subregions.run_cross_sectional(args.structure, parameters)
else:
# Longitudinal analysis
baseParameters = config_subj_params(args.long_base, temp_subdir=f'base')
tpParameters = [config_subj_params(subj, temp_subdir=f'tp{t:02d}') for t, subj in enumerate(args.long_tps)]
subfields.run_longitudinal(args.structure, baseParameters, tpParameters)
subregions.run_longitudinal(args.structure, baseParameters, tpParameters)

0 comments on commit 1cc6646

Please sign in to comment.