Hello Kate,
I’ve been working on BIDS support—in fact you asked at just the right time, I just checked in the 1.7 plugin component a few minutes ago. J I have two components planned for BIDS in XNAT—one is a pipeline that uses dcm2niix to convert the data to NIFTI with BIDS sidecar, naming them according to a lookup table, and generates rudimentary session-level BIDS files, and the other is a plugin that will allow you to package a download in the BIDS format. The downloader is probably still a couple of weeks away from availability at this point, and will only be a 1.7 plugin. I’m also working on a script to import existing BIDS data into an XNAT instance via the REST API.
You can find the pipeline here:
https://bitbucket.org/nrg_customizations/nrg_pipeline_dicomtobids (Pipeline, both 1.6 and 1.7)
https://bitbucket.org/nrg_customizations/nrg_webapp_dicomtobids (Webapp screens, 1.6 module version)
https://bitbucket.org/nrg_customizations/nrg_plugin_dicomtobids (Webapp screens, 1.7 plugin version)
Because this is still in development and hasn’t been integrated into XNAT, you will also need to manually add a launcher method to the BuildAction.java class:
public void doDicomtobids(RunData data, Context context){
try {
DicomToBIDSLauncher dcm = new DicomToBIDSLauncher();
boolean success = dcm.launch(data, context);
if (success ) {
data.setMessage("<p><b>The build process was successfully launched. Status email will be sent upon its completion.</b></p>");
}else {
data.setMessage("<p><b>The build process could not be launched. </b></p>");
}
data.setScreenTemplate("ClosePage.vm");
}catch(Exception e) {
logger.error(e);
}
}
For XNAT 1.7, you can (very soon! it’s not available in the Maven repo quite yet but should be by the end of day today) add the module to your build.gradle directly:
def vDicomToBids = '1.0.0-SNAPSHOT'
…
compile ("org.nrg.xnat.plugin:dicom-to-bids:${vDicomToBids}") {
transitive = false
}
The pipeline requires Python, so after you install it make sure that you have setup scripts for dcm2niix and Python 2 (epd-python) pointing to the proper location in PIPELINE_HOME/scripts - a sample setup script for dcm2niix is included in the pipeline repository, I think the python one comes with XNAT. Make sure that your version of dcm2niix includes BIDS support (offers option -b).
To add the pipeline to your XNAT, use the following:
Enter Path to Pipeline descriptor xml: (Pipeline home here)/catalog/DicomToBIDS/DicomToBIDS.xml
Enter Name of the custom webpage to launch this pipeline: PipelineScreen_DicomToBIDS.vm
For configuration, the pipeline uses a simple sitewide JSON mapping file that is stored with the config service at this URI:
https://(your XNAT here)/REST/config/bids/bidsmap
The mapping file is simple JSON that takes a series description (will fall back on scan type if series description is not populated) and a “bids name”, which can include the task for functional MRI or the acquisition etc:
[
{ "series_description": "3DT2", "bidsname": "T2w" },
{ "series_description": "BOLD", "bidsname": "task-rest_bold" },
{ "series_description": "ep2d_bold_connect", "bidsname": "task-rest_bold" },
{ "series_description": "MPRAGE", "bidsname": "T1w" },
{ "series_description": "MPRAGE GRAPPA2", "bidsname": "T1w" },
{ "series_description": "t1_mpr_1mm_p2", "bidsname": "T1w" },
{ "series_description": "t2_spc_1mm_p2", "bidsname": "T2w" },
{ "series_description": "T2_SPC_1MM_P2", "bidsname": "T2w" },
{ "series_description": "t2_spc_sag_p2_isoWU", "bidsname": "T2w" },
]
You will want to include “task” or “acq” as appropriate for your BIDS names in the “bidsname” field in this file, but the converter will automatically detect and correctly name multiple runs/occurrences of a sequence and multiple echoes within in a series for you.
I believe this is everything! I will be out of
the office next week through Wednesday, returning Thursday, but after I return
I will be happy to answer any questions you have :)
Thanks,
Lauren Wallace
NRG Developer
--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussion+unsubscribe@googlegroups.com.
To post to this group, send email to xnat_discussion@googlegroups.com.
Visit this group at https://groups.google.com/group/xnat_discussion.
For more options, visit https://groups.google.com/d/optout.
The downloader uses a simple sitewide JSON mapping file that is stored with the config service at this URI:
https://(your XNAT here)/REST/config/downloader/rulesets/BIDS
The downloader ruleset is simple JSON that takes a list of series descriptions and for each one selects resources (for BIDS download, use NIFTI,BIDS to get both the images and the additional metadata) and puts them in an output directory (one of the BIDS subdirectories)- here is an excerpt from ours that you can extend and modify as needed:
Dear Kate,
--
Hi Kamil,Thanks - how does this compare to Lauren’s pipeline (https://bitbucket.org/nrg_customizations/nrg_pipeline_dicomtobids)?Kate
On Fri, Sep 1, 2017 at 10:47 AM, <lipinski...@gmail.com> wrote:
Dear Kate,me and my colleague were working on bids-xnat support on 2nd CRN Coding Sprint, maybe you would like to check it out? https://github.com/kamillipi/2bidsBest,Kamil
--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.
To post to this group, send email to xnat_di...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussion+unsubscribe@googlegroups.com.
To post to this group, send email to xnat_discussion@googlegroups.com.
"/data/archive/projects/"
For example, on line 358 of xnat_bids_importer /
src /
main /
java /
com /
radiologics /
bids /
dataimport /
ImportProject.java:
String url_postfix = "/data/archive/projects/" + _projectId + "/subjects/" + mr.getSubjectId() + "/experiments/" +mr.getLabel() + "/scans/" + scan.getId() + "/resources/" + resource + "/files?overwrite=true&extract=true&format="+format+"&content="+content+"&tags=BIDS"; response = _manager.importResource(connection, url_postfix , zipFile);Would it be possible to add to the jar you provided a variable path_to_xnat_projects (= "/data/archive/projects/" by default, by that maybe user defined?)
whereas my architecture is
"/data/xnat/archive"
with projectId following directly (no directory named projects/ after archive).
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussion+unsubscribe@googlegroups.com.
To post to this group, send email to xnat_discussion@googlegroups.com.
Actually after several tests, it seems the issue is that the json and .nii.gz have the same name (before the extension); if I remove all .json, I skip the Zip error; In this case I get a directory called NIFTI that is created (but no BIDS, as it seems the other files should be stored - from the comment in source code FileZipUtils.java). Do you have any ideas what may be wrong in my json? Did you have associated .json in your example datasets?
--
--