XNAT Workshop 2012 - Pipeline Session
Goal:
At the end of this session, attendees should be able to:
- Add pipeline to a XNAT site
- Setup an available pipeline for a project
- Guide XNAT users on launching a pipeline
- Create a new pipeline
Video
Materials:
- Participants will need the workshop VM
- Dicom to Nifti Pipeline
- dcm2nii Resource descriptor
- XnatPipelineWorkshop2012 Powerpoint
- We will be exploring the folder /opt/xnat/pipeline_1_6 on the VM
- We will be looking at the DicomToNifti pipeline located at /opt/xnat/pipeline_1_6/catalog/mricron/DicomToNifti.xml. During the talk, we would add the pipeline to our site and launch the pipeline.
- Participants would be creating a pipeline which would dump the dicom headers into a text file.
- XNAT 2010 Pipeline talk (optional)
Prerequisites:
- Working knowledge of XML and XPATH
- If you have not deployed a XNAT instance, you should have attended talks on Day 1 (Project Intake, Project Configuration) and Day 2 (Data upload and entry)
- Working knowledge of linux commands.
- In a bash shell to redirect stdout of a command to a file, we use redirection character >
- In a XML document, > is a reserved character. To escape, we use > for > and < for <
- In a XML document, & is a reserved character. To escape, we use &
Tasks during the talk:
Step 1: Adding a pipeline to a site
- We would add the pipeline /opt/xnat/pipeline_1_6/catalog/mricron/DicomToNifti.xml to the site
- Login to XNAT as Admin.
- Navigate to Administer -> Pipelines
- Click on Add Pipeline to Repository
- Input
- Enter Path to Pipeline descriptor xml: /opt/xnat/pipeline_1_6/catalog/mricron/DicomToNifti.xml
- Enter Name of the custom webpage to launch this pipeline: LEAVE THIS BLANK
- Click on Add
- You will get a message "... was added successfully
- If you did everything correct, you will see DicomToNifti listed in the pipeline repository.
Step 2: Setting up the pipeline for the project BOGUS_OUA
Navigate to BOGUS_OUA project as project owner
- Click on Pipelines tab.
- Click on Add More Pipelines
- Click on Add (for DicomToNifti pipeline)
- Select Is this pipeline to be launched automatically while archiving?
- Set the value of create_nii to N
- Click on Submit
- Click on Pipelines tab.
Step 3: Setup the datatype
- As Admin, click on Administer -> Data types
- Select xnat:mrSessionData
- Under Available Report Actions, enter
- Name: PipelineScreen_launch_pipeline,
- Display Name: Build,
- Popup: always,
- Secure Access: edit
- (leave other columns empty)
Step 4: Launching the pipeline (via Action -> Build)
Navigate to project BOGUS_OUA
- Select an MRSession
- Click on Action -> Build
- Select DicomToNifti
- Click on Submit
Step 5: Launching the pipeline automatically
- Upload a MR Session
Archive the session
Step 6: Provenance information
- Navigate to /opt/xnat/data/build/BOGUS_OUA/DATESTAMPED_FOLDER/SESSION_ID_HERE
Step 7:Create a new pipeline - DicomDumpToText = HELLO PIPELINE WORLD!
Problem Statement:
Write a pipeline which will create a text file containing the dicom header dump.
Assumptions:
- The input scan files are DICOMs
- The file names are *.dcm
- The generated text file will be a resource at the SCAN level
Executable: You could use any. You could use dcmdump or dcm_dump_file. If you want to use dcm_dump_file, it is at /opt/xnat/workshop2012/d3s1-pipeline/pipeline/DicomDumpToText/resource
Process:
Step a) [Skip this if you are using dcmdump] Copy dcm_dump_file to /bin: sudo cp /opt/xnat/workshop2012/d3s1-pipeline/pipeline/DicomDumpToText/resource/dcm_dump_file /bin
Step b) [Skip this if you are using dcmdump] sudo chmod +x /bin/dcm_dump_file
Step c) Create a resource descriptor for dcm_dump_file/dcmdump
Hints:
- dcm_dump_file *.dcm > scanID.txt OR dcmdump *.dcm > scanID.txt
<pip:argument id="redirect_stdout" prefix="">
<pip:description>Redirect Std Out</pip:description>
</pip:argument>
- Use /opt/xnat/pipeline_1_6/catalog/mricron/resource/dcm2nii.xml as a template
- REST URI: PUT to
/data/archive/projects/PROJECT_ID/subjects/SUBJECT_ID/experiments/XNAT_ID/scans/SCAN_ID/resources/DICOMDUMP/files/SCANID.txt?format=TXT&content=DICOM_DUMP
Step d) Create a pipeline XML. Use /opt/xnat/pipeline_1_6/catalog/mricron/DicomToNifti.xml as a template
Step e) cp -r /opt/xnat/workshop2012/d3s1-pipeline/pipeline/DicomDumpToText /opt/xnat/pipeline_1_6/templates/misc/catalog
Step f) cd /opt/xnat/pipeline_1_6; setup.sh xnat@xnat.org mail.nrg.wustl.edu http://localhost:8080/xnat
Step g) Add pipeline to site
Step h) Add pipeline to project
Step i) Launch the pipeline
Solution: /opt/xnat/workshop2012/d3s1-pipeline/pipeline/DicomDumpToText
More:
- REST URI to look up the archive specification for a project:
http://localhost:8080/xnat/REST/projects/BOGUS_OUA/archive_spec - dcm2nii -
- Location of builddir - /opt/xnat/data/build
- Script to overload to interact with a Grid - /opt/xnat/pipeline_1_6/bin/schedule