Skip to content

Instantly share code, notes, and snippets.

View jasonklotzer's full-sized avatar

Jason Klotzer jasonklotzer

View GitHub Profile
@jasonklotzer
jasonklotzer / set_dicom_storage_class.sh
Created March 21, 2024 23:07
This example script allows a Google Cloud Healthcare API DICOM Store user to change the StorageClass across all studies. The script reads all StudyUIDs from a metadata BigQuery table, assuming the study metadata has been streamed to BigQuery, then creates a CloudStorage list with those study resources, and finally makes a call to a Healthare API…
#!/bin/bash
# set -x
# This example script allows a Google Cloud Healthcare API DICOM Store user to change the StorageClass across all studies.
# High level instructions can be found at the following:
# https://cloud.google.com/healthcare-api/docs/dicom-storage-class#use_filters
STUDIES_FILE=studies.lst
REQUEST_FILE=request.json
# example dcmtk findscu query, to retrieve study level info (studyinstanceuid and instance count)
findscu -v -S -k QueryRetrieveLevel=STUDY -k StudyDate="20201101" -k NumberOfStudyRelatedInstances -aec AE_PACS -aet AE_MYSELF <ipPacs> <portPacs>
# example dcmtk movescu to retrieve study to self from pacs
movescu -v -S -k QueryRetrieveLevel=STUDY -k StudyInstanceUID="<studyUid>" -aec AE_PACS -aet AE_MYSELF -aem AE_MYSELF <ipPacs> <portPacs>
@jasonklotzer
jasonklotzer / ccli.sh
Created February 16, 2022 23:40
Wrapper script for docker based invocation of DCMTK and DCM4CHE for DICOM tool usage
#!/bin/bash
[ $# -lt 2 ] && { echo "Usage: $0 dcmtk|dcm4che arguments"; exit 1; }
IMAGE_ALIAS=$1
case $IMAGE_ALIAS in
dcmtk)
IMAGE="imbio/dcmtk"
;;
@jasonklotzer
jasonklotzer / makestudy.sh
Last active May 4, 2024 17:00
Bash script to create new DICOM studies based on an existing template (uses dcmtk tools).
#!/bin/bash
# Make sure you have dcmtk installed (sudo apt install dcmtk).
DCMODIFY=dcmodify
if [ $# -ne 4 ]
then
echo "Usage : $0 inputfile outputdir #series #instances"
exit
fi
@jasonklotzer
jasonklotzer / perf.js
Created March 10, 2020 22:56
Simple and compact NodeJS performance marking class.
const util = require('util');
const HOT_SPOT_MIN = 100; // amount in ms to determine if there's a hot spot
function getStackLine(rewind) {
const stackRewind = rewind || 0;
const stack = new Error().stack;
const line0 = stack.split('\n')[stackRewind + 1];
const sub0 = line0.indexOf('/');
const sub1 = line0.lastIndexOf(':');