Skip to content

Instantly share code, notes, and snippets.

View rherrick's full-sized avatar

Rick Herrick rherrick

  • Flywheel
  • St. Louis, Missouri
View GitHub Profile
@rherrick
rherrick / drop_xnat_views.sql
Created January 24, 2017 23:02
Find and Drop XNAT views
-- Change 'xnat' to the database user that owns the XNAT tables.
-- You need to stop Tomcat before running this query.
SELECT drop_user_views('xnat');
@rherrick
rherrick / create_recon.sh
Last active July 24, 2017 17:09
Create XNAT image reconstruction then update to include manually added files
# Get a session
http --auth admin:minda --session=admin xnat164.xnat.org/data/projects
# Create the reconstruction and resource folder
http --session=admin PUT xnat164.xnat.org/data/archive/projects/prj001/subjects/prj001_001/experiments/prj001_001_MR2/reconstructions/prj001_001_MR2_recon_001 xnat:reconstructedImageData/type==RECON_A
http --session=admin PUT xnat164.xnat.org/data/archive/projects/prj001/subjects/prj001_001/experiments/prj001_001_MR2/reconstructions/prj001_001_MR2_recon_001/resources/NIFTI format==NIFTI
# Upload NIFTI and JSON to the reconstruction resource
for SERIES in t1_mpr_1mm_p2_pos50_20061214091206_4 t1_mpr_1mm_p2_pos50_20061214091206_5 t2_spc_1mm_p2_20061214091206_6; do
http --session=admin PUT xnat164.xnat.org/data/archive/projects/prj001/subjects/prj001_001/experiments/prj001_001_MR2/reconstructions/prj001_001_MR2_recon_001/resources/NIFTI/files/${SERIES}.nii.gz inbody==true < ${SERIES}.nii.gz
@rherrick
rherrick / xnat-ext-1.7.4-SNAPSHOT.gradle
Last active August 17, 2017 18:06
External Gradle configuration
apply plugin: "jacoco"
ext.propertyWithDefault = { String name, def value ->
hasProperty(name) ? property(name) : value
}
dependencyManagement.imports {
mavenBom "org.nrg:parent:${vXnat}"
}
@rherrick
rherrick / build.gradle
Created December 8, 2017 01:07
Simple configuration of Javadoc coverage doclet for Gradle
configurations {
// Other configuration lines might be in here
javadocCoverage
}
dependencies {
// Your application's other dependencies go here.
javadocCoverage "com.manoelcampos:javadoc-coverage:1.1.0"
}
@rherrick
rherrick / build.gradle
Last active February 27, 2018 18:58
Repositories element without dcm4che repo for XNAT pom.xml and build.gradle files. Note that the repositories block in build.gradle should _not_ be applied to a repositories block inside a buildscript block, only to the standard repositories block.
repositories {
mavenLocal()
maven {
url "http://maven.imagej.net/content/groups/public"
name "ImageJ Maven Repository"
}
jcenter()
mavenCentral()
maven {
url "https://nrgxnat.jfrog.io/nrgxnat/libs-release"
@rherrick
rherrick / add-to-java-cacerts.sh
Created May 10, 2018 01:29
Shows failure to install Charles proxy cert on Java 10 JDK on OS X
decker:Internet Plug-Ins root# JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home $(find /Applications/Charles.app/Contents/ -name "*.command")
############################################
Charles Root Certificate Java VM Import Tool
############################################
This tool imports your Charles Root Certificate into the Java VMs that it finds on
your computer, so that Java applications trust your Charles Root Certificate for
SSL Proxying.
@rherrick
rherrick / Main.java
Created December 19, 2018 21:59
Refactor of advent day 1 code
package com.nerdnetworks;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
public class Main {
@rherrick
rherrick / 2019-03-28T18_22_05_888Z-debug.log
Created March 28, 2019 18:48
Failure when launching test node app
0 info it worked if it ends with ok
1 verbose cli [ '/Users/username/.nvm/versions/node/v10.15.3/bin/node',
1 verbose cli '/Users/username/.nvm/versions/node/v10.15.3/bin/npm',
1 verbose cli 'run',
1 verbose cli 'dev' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle @~predev: @
6 info lifecycle @~dev: @
@rherrick
rherrick / get-resources.sh
Created September 20, 2020 21:49
Get resource files from XNAT dataset collection
#!/usr/bin/env bash
showHelp() {
echo
echo "Usage: ${0} --server <URL> --username <USER> --password <PASSWORD> --project <PROJECT> --collection <COLLECTION_ID>"
echo
echo "Note: all options are required, with the exception of --password. If --password"
echo " is omitted, you must enter your password when the script runs."
echo
exit 255
@rherrick
rherrick / Anonymizer.groovy
Created September 21, 2020 18:00
A script that pulls in the XNAT Mizer library and DicomEdit 4 and 6 and applies an anonymization script to DICOM files. Requires Groovy installation. Save this file as Anonymizer.groovy, make it executable (e.g. chmod +x Anonymizer.groovy), then run it.
#!/usr/bin/env groovy
@GrabConfig(systemClassLoader = true)
@GrabResolver(name = "NRG Release Repo", root = "https://nrgxnat.jfrog.io/nrgxnat/libs-release")
@GrabResolver(name = "NRG Snapshot Repo", root = "https://nrgxnat.jfrog.io/nrgxnat/libs-snapshot")
@Grapes([
@GrabExclude("org.slf4j:slf4j-simple"),
@GrabExclude("org.slf4j:slf4j-log4j12"),
@Grab("info.picocli:picocli:4.5.1"),
@Grab("ch.qos.logback:logback-classic:1.2.3"),
@Grab("org.nrg.dicom:mizer:1.2.0-SNAPSHOT"),