-
Notifications
You must be signed in to change notification settings - Fork 305
ENH: Add option to exclude projecting high variance voxels to surface #2855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
26eb6e1
adding goodvoxels freesurfer branch
0e52bf3
added workflow connectors for next stages -- one more needs to be added
ericfeczko e06c412
Create init workflow for masking medial wall outliers
anders-perrone 64e61e7
output "goodvoxels"-masked BOLD surfs in bold_surf_wf (+1 squashed co…
madisoth 260c7a6
goodvoxels_gifti work
madisoth 3041e25
progress on workbench / gifti surface wf
madisoth 30ae531
revert work on workbench-based surface sampling wf (to be continued i…
madisoth c555283
revert work on workench-based surface sampling wf (to be continued in…
madisoth ba7f699
volume.py docstring import fix
madisoth a680447
remove CreateSignedDistanceVolume doctest for now (needs anatomical s…
madisoth 17fba92
remove unused itk_bold_to_t1 from bold_surf_wf inputnode
madisoth ca9d5d4
Untested 1st draft integrating madisoth/nibabies:enh/project-goodvoxels
GregConan 8bf03e2
refactor to handle anat_ribbon_wf moving to sMRIPrep
madisoth 97e2b79
refactor to handle anat_ribbon_wf moving to sMRIPrep
madisoth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
# -*- coding: utf-8 -*- | ||
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- | ||
# vi: set ft=python sts=4 ts=4 sw=4 et: | ||
"""This module provides interfaces for workbench volume commands""" | ||
import os | ||
|
||
from nipype.interfaces.base import TraitedSpec, File, traits, CommandLineInputSpec | ||
from nipype.interfaces.workbench.base import WBCommand | ||
from nipype import logging | ||
|
||
iflogger = logging.getLogger("nipype.interface") | ||
|
||
|
||
class CreateSignedDistanceVolumeInputSpec(CommandLineInputSpec): | ||
surf_file = File( | ||
exists=True, | ||
mandatory=True, | ||
argstr="%s", | ||
position=0, | ||
desc="Input surface GIFTI file (.surf.gii)", | ||
) | ||
ref_file = File( | ||
exists=True, | ||
mandatory=True, | ||
argstr="%s", | ||
position=1, | ||
desc="NIfTI volume in the desired output space (dims, spacing, origin)", | ||
) | ||
out_file = File( | ||
name_source=["surface"], | ||
name_template="%s_distvol.nii.gz", | ||
argstr="%s", | ||
position=2, | ||
desc="Name of output volume containing signed distances", | ||
) | ||
out_mask = File( | ||
name_source=["surface"], | ||
name_template="%s_distmask.nii.gz", | ||
argstr="-roi-out %s", | ||
desc="Name of file to store a mask where the ``out_file`` has a computed value", | ||
) | ||
fill_value = traits.Float( | ||
mandatory=False, | ||
default=0., | ||
usedefault=True, | ||
argstr="-fill-value %f", | ||
desc="value to put in all voxels that don't get assigned a distance", | ||
) | ||
exact_limit = traits.Float( | ||
default=5., | ||
usedefault=True, | ||
argstr="-exact-limit %f", | ||
desc="distance for exact output in mm", | ||
) | ||
approx_limit = traits.Float( | ||
default=20., | ||
usedefault=True, | ||
argstr="-approx-limit %f", | ||
desc="distance for approximate output in mm", | ||
) | ||
approx_neighborhood = traits.Int( | ||
default=2, | ||
usedefault=True, | ||
argstr="-approx-neighborhood %d", | ||
desc="size of neighborhood cube measured from center to face in voxels, default 2 = 5x5x5", | ||
) | ||
winding_method = traits.Enum( | ||
"EVEN_ODD", | ||
"NEGATIVE", | ||
"NONZERO", | ||
"NORMALS", | ||
argstr="-winding %s", | ||
usedefault=True, | ||
desc="winding method for point inside surface test" | ||
) | ||
|
||
class CreateSignedDistanceVolumeOutputSpec(TraitedSpec): | ||
out_file = File(desc="Name of output volume containing signed distances") | ||
out_mask = File(desc="Name of file to store a mask where the ``out_file`` has a computed value") | ||
|
||
|
||
class CreateSignedDistanceVolume(WBCommand): | ||
"""CREATE SIGNED DISTANCE VOLUME FROM SURFACE | ||
wb_command -create-signed-distance-volume | ||
<surface> - the input surface | ||
<refspace> - a volume in the desired output space (dims, spacing, origin) | ||
<outvol> - output - the output volume | ||
|
||
[-roi-out] - output an roi volume of where the output has a computed | ||
value | ||
<roi-vol> - output - the output roi volume | ||
|
||
[-fill-value] - specify a value to put in all voxels that don't get | ||
assigned a distance | ||
<value> - value to fill with (default 0) | ||
|
||
[-exact-limit] - specify distance for exact output | ||
<dist> - distance in mm (default 5) | ||
|
||
[-approx-limit] - specify distance for approximate output | ||
<dist> - distance in mm (default 20) | ||
|
||
[-approx-neighborhood] - voxel neighborhood for approximate calculation | ||
<num> - size of neighborhood cube measured from center to face, in | ||
voxels (default 2 = 5x5x5) | ||
|
||
[-winding] - winding method for point inside surface test | ||
<method> - name of the method (default EVEN_ODD) | ||
|
||
Computes the signed distance function of the surface. Exact distance is | ||
calculated by finding the closest point on any surface triangle to the | ||
center of the voxel. Approximate distance is calculated starting with | ||
these distances, using dijkstra's method with a neighborhood of voxels. | ||
Specifying too small of an exact distance may produce unexpected results. | ||
Valid specifiers for winding methods are as follows: | ||
|
||
EVEN_ODD (default) | ||
NEGATIVE | ||
NONZERO | ||
NORMALS | ||
|
||
The NORMALS method uses the normals of triangles and edges, or the | ||
closest triangle hit by a ray from the point. This method may be | ||
slightly faster, but is only reliable for a closed surface that does not | ||
cross through itself. All other methods count entry (positive) and exit | ||
(negative) crossings of a vertical ray from the point, then counts as | ||
inside if the total is odd, negative, or nonzero, respectively. | ||
|
||
""" | ||
|
||
input_spec = CreateSignedDistanceVolumeInputSpec | ||
output_spec = CreateSignedDistanceVolumeOutputSpec | ||
_cmd = "wb_command -create-signed-distance-volume" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.