Skip to content
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

Fixed problems processing Mulit-Echo images #103

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#flywheel/fmriprep

FROM python:3.7
#FROM python:3.7
FROM python:3.10
MAINTAINER Tinashe Tapera <[email protected]>

# Make directory for flywheel spec (v0)
Expand All @@ -13,14 +14,15 @@ ENTRYPOINT ["/flywheel/v0/fw_heudiconv_run.py"]

# Copy over python scripts that generate the BIDS hierarchy
RUN apt-get -y update && apt-get install -y curl
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - &&\
#RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - &&\
RUN curl -fsSL https://deb.nodesource.com/setup_21.x | bash - &&\
apt-get -y install nodejs &&\
ln -s /usr/bin/nodejs /usr/local/bin/node
RUN curl -L https://www.npmjs.com/install.sh | sh
RUN npm install -g bids-validator
RUN python3 -m pip install --upgrade pip
RUN pip install --no-cache nipype pathvalidate
RUN pip install --no-cache flywheel-sdk~=14.6.5
RUN pip install --no-cache flywheel-sdk

COPY . /src

Expand Down
1 change: 0 additions & 1 deletion docs/source/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ dependencies:
- sphinx_rtd_theme
- mock
- future
- nibabel
- statsmodels
- xvfbwrapper
- configparser
Expand Down
34 changes: 24 additions & 10 deletions fw_heudiconv/backend_funcs/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import warnings
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=UserWarning)
from nibabel.nicom.dicomwrappers import wrapper_from_data


CONVERTABLE_TYPES = ("bvec", "bval", "nifti")
Expand Down Expand Up @@ -63,15 +62,30 @@ def acquisition_to_heudiconv(client, acq, context):
zip_info = None
dcm_info = {}
# Make it a nicom wrapper to handle all sorts of different dicom styles
mw = wrapper_from_data(dcm_info)
#mw = wrapper_from_data(dcm_info)
#log.info("mw.image_shape = '{}'".format(mw.image_shape))
num_dicoms = len(zip_info.members) if zip_info else -1
image_shape = mw.image_shape
if image_shape is None:
image_shape = (-1, -1, -1, -1)
else:
image_shape = mw.image_shape + (num_dicoms,)
while len(image_shape) < 4:
image_shape = image_shape + (-1,)
#image_shape = mw.image_shape
#if image_shape is None:
# image_shape = (-1, -1, -1, -1)
#else:
#image_shape = mw.image_shape + (num_dicoms,)
# while len(image_shape) < 4:
# image_shape = image_shape + (-1,)

Rows = -1
if "Rows" in dcm_info:
Rows = dcm_info["Rows"]

Columns = -1
if ("Columns" in dcm_info):
Columns = dcm_info["Columns"]

image_shape = (-1, -1, -1, -1)
if (Rows > 0 and Columns > 0):
image_shape = (Rows, Columns, num_dicoms, -1)

log.info("{}: Image Shape = '{}', num_dicoms = '{}'".format(acq.label,image_shape,num_dicoms))

for fileobj in acq.files:
log.debug('filename: %s', fileobj.name)
Expand All @@ -80,7 +94,7 @@ def acquisition_to_heudiconv(client, acq, context):
info = fileobj.info

# Make it a nicom wrapper to handle all sorts of different dicom styles
mw = wrapper_from_data(info)
#mw = wrapper_from_data(info)

log.debug('uid: %s', info.get("SeriesInstanceUID"))
to_convert.append(SeqInfo(
Expand Down
3 changes: 3 additions & 0 deletions fw_heudiconv_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

# start up inputs
invocation = json.loads(open('config.json').read())

logger.info(json.dumps(invoication, indent=2))

config = invocation['config']
inputs = invocation['inputs']
destination = invocation['destination']
Expand Down
104 changes: 62 additions & 42 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,63 @@
{
"name": "fw-heudiconv",
"label": "Flywheel HeuDiConv",
"description": "HeuDiConv-style BIDS curation on Flywheel. Flywheel HeuDiConv (or fw-heudiconv, pronounced /fwuː di kɑː n(v)/) is a Python-based toolkit that leverages the flexibility and comprehensiveness of HeuDiConv to curate neuroimaging data on Flywheel into a BIDS-valid format.",
"version": "0.2.15_0.4.3",
"inputs": {
"api_key": {
"base": "api-key"
},
"heuristic": {
"base": "file",
"description": "Python file implementing a heudiconv heuristic",
"optional": true
}
},
"config": {
"action": {
"default": "Curate",
"description": "Curate: Apply heuristic to project. Export: Create zip of BIDS tree. Tabulate: Create a table of sequence information in a project. Clear: Clear BIDS data from project. Reproin Check: Apply the reproin heuristic to a list of reproin names to check for validity. Meta: Autogenerate BIDS metadata for project.",
"type": "string",
"enum": ["Curate", "Export", "Tabulate", "Clear", "Reproin", "Validate"]
},
"dry_run": {
"default": true,
"description": "Run without applying changes",
"type": "boolean"
}
},
"command": "./fw_heudiconv_run.py",
"author": "Tinashe Michael Tapera",
"maintainer": "Tinashe Michael Tapera",
"cite": "",
"license": "Other",
"source": "",
"url": "https://github.com/PennBBL/fw-heudiconv",
"custom": {
"gear-builder": {
"category": "analysis",
"image": "pennbbl/fw-heudiconv:0.2.15_0.4.3"
},
"flywheel":{"suite": "PennBBL"}
}
}
"name": "dev-fw-heudiconv",
"label": "Dev Flywheel HeuDiConv",
"description": "HeuDiConv-style BIDS curation on Flywheel. Flywheel HeuDiConv (or fw-heudiconv, pronounced /fwu\u02d0 di k\u0251\u02d0 n(v)/) is a Python-based toolkit that leverages the flexibility and comprehensiveness of HeuDiConv to curate neuroimaging data on Flywheel into a BIDS-valid format.",
"version": "0.2.15_1.0.1-dev-001",
"inputs": {
"api_key": {
"base": "api-key"
},
"heuristic": {
"base": "file",
"description": "Python file implementing a heudiconv heuristic",
"optional": true
}
},
"config": {
"action": {
"default": "Curate",
"description": "Curate: Apply heuristic to project. Export: Create zip of BIDS tree. Tabulate: Create a table of sequence information in a project. Clear: Clear BIDS data from project. Reproin Check: Apply the reproin heuristic to a list of reproin names to check for validity. Meta: Autogenerate BIDS metadata for project.",
"type": "string",
"enum": [
"Curate",
"Export",
"Tabulate",
"Clear",
"Reproin",
"Validate"
]
},
"dry_run": {
"default": true,
"description": "Run without applying changes",
"type": "boolean"
}
},
"command": "./fw_heudiconv_run.py",
"author": "Tinashe Michael Tapera",
"maintainer": "Tinashe Michael Tapera",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you be interested in being listed as maintainer here? Tinashe has left

"cite": "",
"license": "Other",
"source": "",
"url": "https://github.com/PennBBL/fw-heudiconv",
"custom": {
"gear-builder": {
"category": "analysis",
"image": "pennbbl/fw-heudiconv:0.2.15_1.0.1-dev-001"
},
"flywheel": {
"suite": "PennBBL"
}
},
"environment": {
"PATH": "/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"LANG": "C.UTF-8",
"GPG_KEY": "A035C8C19219BA821ECEA86B64E628F8D684696D",
"PYTHON_VERSION": "3.10.14",
"PYTHON_PIP_VERSION": "23.0.1",
"PYTHON_SETUPTOOLS_VERSION": "65.5.1",
"PYTHON_GET_PIP_URL": "https://github.com/pypa/get-pip/raw/dbf0c85f76fb6e1ab42aa672ffca6f0a675d9ee4/public/get-pip.py",
"PYTHON_GET_PIP_SHA256": "dfe9fd5c28dc98b5ac17979a953ea550cec37ae1b47a5116007395bfacff2ab9",
"FLYWHEEL": "/flywheel/v0"
}
}
8 changes: 4 additions & 4 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ fi
echo Uploading to pip...

python setup.py sdist
<<<<<<< HEAD
#<<<<<<< HEAD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#<<<<<<< HEAD
#<<<<<<< HEAD

twine upload dist/* --skip-existing
=======
twine upload --skip-existing dist/*
>>>>>>> 451d0170cd190ca6cceb86def6dc51bc45a73802
#=======
#twine upload --skip-existing dist/*
#>>>>>>> 451d0170cd190ca6cceb86def6dc51bc45a73802

Comment on lines +34 to 37
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#=======
#twine upload --skip-existing dist/*
#>>>>>>> 451d0170cd190ca6cceb86def6dc51bc45a73802

echo Uploading gear...

Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
flywheel-sdk ~= 14.6.5
flywheel-sdk
pandas
bids-validator
validators
sphinx-argparse
commonmark
pathvalidate
pytest
nibabel
pytest-cov
heudiconv
4 changes: 1 addition & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ classifiers =

[options]
install_requires =
flywheel-sdk ~= 14.6.5
flywheel-sdk ~= 18.1.1
bids-validator
nibabel >=3.0.0
indexed_gzip >=0.8.8
nilearn !=0.5.0, !=0.5.1
nipype >=1.3.1
Expand All @@ -47,7 +46,6 @@ install_requires =
scikit-learn >=0.20.2
scikit-image
statsmodels
nibabel
heudiconv
test_requires =
coverage
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@
url="https://github.com/PennBBL/fw_heudiconv",
packages=setuptools.find_packages(),
install_requires=[
"flywheel-sdk~=14.6.5",
"flywheel-sdk~=18.1.1",
"pandas",
"bids-validator",
"validators",
"pathvalidate",
"pytest",
"pytest-cov",
"nibabel",
"heudiconv"
],
classifiers=[
Expand Down