Created
September 25, 2012 18:23
-
-
Save chrisgorgo/3783557 to your computer and use it in GitHub Desktop.
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
def plot_coregistration(): | |
anat_file = "/Users/filo/data/rs_pipeline/GSDT/anat/mprage.nii" | |
func_file = "/Users/filo/workdir/rs_preprocessing/preprocess/preproc/take_mean_art/weighted_mean/corr_rest_roi_dtype.nii.gz" | |
affine_file = '/Users/filo/workdir/rs_preprocessing/preprocess/preproc/getmask/register/mapflow/_register0/corr_rest_roi_dtype_bbreg_recon_all.mat' | |
from nipy.labs import viz | |
from nipy.labs.viz_tools import anat_cache | |
import nibabel as nb | |
anat = nb.load(anat_file).get_data() | |
anat_affine = nb.load(anat_file).get_affine() | |
reference = nb.load(func_file).get_data() | |
reference_affine = nb.load(func_file).get_affine() | |
import numpy as np | |
slicer = viz.plot_anat(anat, anat_affine, dim=.2, black_bg=True) | |
slicer.edge_map(reference, reference_affine |
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
fatal: No names found, cannot describe anything. | |
Traceback (most recent call last): | |
File "/Users/filo/Documents/workspace/pipelines/src/resting_state_preprocessing.py", line 69, in <module> | |
plot_coregistration() | |
File "/Users/filo/Documents/workspace/pipelines/src/resting_state_preprocessing.py", line 64, in plot_coregistration | |
slicer = viz.plot_anat(anat, anat_affine, dim=.2, black_bg=True) | |
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nipy/labs/viz_tools/activation_maps.py", line 335, in plot_anat | |
black_bg=black_bg) | |
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nipy/labs/viz_tools/slicers.py", line 246, in init_with_figure | |
cut_coords) | |
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nipy/labs/viz_tools/slicers.py", line 492, in find_cut_coords | |
activation_threshold=threshold) | |
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nipy/labs/viz_tools/coord_tools.py", line 117, in find_cut_coords | |
cut_coords = ndimage.center_of_mass(np.abs(my_map)) | |
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/ndimage/measurements.py", line 1151, in center_of_mass | |
return [tuple(v) for v in numpy.array(results).T] | |
TypeError: 'numpy.float64' object is not iterable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment