This file contains 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
import pyxnat | |
import os | |
import time | |
# A python 2.7 / pyxnat script for downloading the resources from an xnat project | |
# gather source xnat details | |
print '** DOWNLOAD XNAT PROJECT RESOURCES **' | |
xnat_url=raw_input("Enter the xnat url: ") | |
project_name=raw_input("Enter the xnat project id: ") |
This file contains 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
#!/bin/bash | |
# bash script to remove unwanted files in xnat using the XnatDataClient | |
# iterates through all sessions looking for particular scan types with particular file types and file name patterns | |
# CLI parameters: | |
# 1. url - xnat url | |
# 2. username - xnat username | |
# 3. project - xnat project | |
# 4. scan type - e.g. "STRUCTURAL", "FLAIR" |
This file contains 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
#!/bin/bash | |
# creates subject / experiment ids if they dont already exist | |
# 1. url - xnat url | |
# 2. session - tomcat session_id (instead of username / password) | |
# 3. project - project id | |
# 4. subject - subject_id | |
# 5. experiment - experiment id | |
# 6. date - experiment_date | |
# 7. verbosity - 0 = surpress, 1 = log (default), 2 = debug |
This file contains 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
class exports.Ticker | |
constructor: (timeout) -> | |
@timeout = timeout || 1000 | |
_nextTick: => | |
@tick = setTimeout(@_nextTick, @timeout) | |
console.log 'tick' | |
start: -> | |
@_nextTick() |
This file contains 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
# Renames every MR experiment, thus kicking off the anonymisation script. | |
# see https://groups.google.com/d/msg/xnat_discussion/vvLyLvyo2uQ/yMPHgkrOEwAJ | |
# used in XNAT 1.6.5 | |
# also see https://groups.google.com/d/msg/xnat_discussion/fBI33j36D3Y/VEwh-HWez70J for discussion about changing experiment label | |
import xnat # see https://xnat.readthedocs.io/en/latest/ | |
url = raw_input("Enter XNAT url: ") | |
user = raw_input("Enter username: ") | |
with xnat.connect(url, user=user) as session: | |
name = raw_input("Enter project: ") |
This file contains 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
# outputs a summary of the data in an xnat project, e.g.: | |
# 55 subjects, 65 scans, 400 sequences (SNAPSHOTS: 400, DICOM: 400, NIFTI: 200) | |
# Note that in our lab we talk about "scans" and "sequences" which correspond | |
# to xnat's "MR Sessions" and "Scans" respectively. | |
# Parameters: | |
# 1. url - xnat url | |
# 2. username - xnat username |
This file contains 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
# prints the subject_id and experiment_id of XNAT experiments where a scan is missing a snapshot | |
# used against XNAT 1.6.5 by python 2.7 | |
import xnat # see https://xnat.readthedocs.io/en/latest/ | |
url = raw_input("Enter XNAT url: ") | |
user = raw_input("Enter username: ") | |
session = xnat.connect(url, user=user) | |
name = raw_input("Enter project: ") | |
project = session.projects[name] |
This file contains 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
# prints the subject_id and experiment_id of XNAT experiments whose scans are all missing snapshots | |
# used against XNAT 1.6.5 by python 2.7 | |
import xnat # see https://xnat.readthedocs.io/en/latest/ | |
url = raw_input("Enter XNAT url: ") | |
user = raw_input("Enter username: ") | |
session = xnat.connect(url, user=user) | |
name = raw_input("Enter project: ") | |
project = session.projects[name] |
This file contains 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
#!/bin/bash | |
# upload pre-processed niftii images to xnat 1.6.5 | |
# 1. xnat - xnat url, e.g. https://central.xnat.org | |
# 2. username - xnat username | |
# 3. password - xnat password | |
# 4. project - project id | |
# 5. subject - subject id | |
# 6. session - session id | |
# 7. scan - scan id | |
# 8. nifti - filepath of nifti image |
This file contains 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
import pyxnat | |
import os | |
import shutil | |
import requests | |
import zipfile | |
import requests | |
import time | |
# A python 2.7 / pyxnat script for copying an xnat project which consists of | |
# subjects with multiple MRSession experiments |
NewerOlder