Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

BIDS extract JSON data

import nibabel as nb
import bids
layout = bids.BIDSLayout('/data/bids/ds003130-download/')
imgs = layout.get(extension='.nii.gz', datatype=['fmap', 'func'])
dirs = {"A": {"j": "PA", "j-": "AP"}}  # Truncated for simplicity
for bfile in imgs:
     img = bfile.get_image() 
     ornt = ''.join(nb.aff2axcodes(img.affine)) 
     md = bfile.get_metadata() 
     peaxis = md['PhaseEncodingDirection'] 
     pedir = dirs[ornt[1]][peaxis] 
     print(f"{bfile.filename:<46} {ornt} {peaxis:<3} {pedir}")
Comment

PREVIOUS NEXT
Code Example
Python :: how to join bot into voice channel python 
Python :: Find Factors of a Number Using for Loop 
Python :: Code Example of Comparing None with empty string 
Python :: link prettify in beautifulsoup 
Python :: Using python permutations function on a list with extra function 
Python :: List Comprehension simple example 
Python :: python finding mead 
Python :: numpy random sin 
Python :: sorted string dict approach 
Python :: Add 1 to loops 
Python :: passing list vs int in python important 
Python :: python convert dataframe target to numbers 
Python :: docstring return list of tuple 
Python :: generate pycryptodome salt 
Python :: pandas iloc stack overflow 
Python :: Python NumPy atleast_2d Function Syntax 
Python :: in django drowpdown list shown in database tables 
Python :: kaggle replace 
Python :: Python NumPy require Function Example with requirements attribute 
Python :: vocal remover source code python 
Python :: mid point line drawing 
Python :: python interpreter after running a python file 
Python :: funcs_and_args for loop python 
Python :: Convertion of number into binary using NumPy binary_repr 
Python :: python override inherited method class model constructor 
Python :: config.ini list not string 
Python :: python dependency injection 
Python :: parsing output from ping - python 
Python :: matrix implement 
Python :: django assign authenticated user to foreign user 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =