Skip to content

Instantly share code, notes, and snippets.

View manthey's full-sized avatar

David Manthey manthey

View GitHub Profile
@manthey
manthey / dicom_items.py
Created May 21, 2018 19:57
Identify and preprocess dicom items in Girder
#!/usr/bin/env python
import argparse
import girder_client
import girder_client.cli
import os
import re
def get_girder_client(opts):
@manthey
manthey / Dockerfile-histomicstk-jupyter
Created August 27, 2018 18:29
Minimal Ubuntu 18.04 Dockerfile to run Jupyter examples for HistomicsTK
FROM ubuntu:18.04
# Prerequisites and runtimes
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \
build-essential \
git \
python-dev \
python-pip \
python-setuptools \
python-wheel \
topFolder = Folder().load(id=<id>, force=True)
allFolders = [topFolder]
idx = 0
while idx < len(allFolders):
allFolders.extend(list(Folder().childFolders(allFolders[idx], 'folder', force=True))
idx += 1
@manthey
manthey / tiff_to_uml.py
Last active April 28, 2022 14:45
Use tifftools and plantuml to create an svg diagram.
import argparse
import base64
import io
import json
import math
import os
import subprocess
import sys
import tempfile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@manthey
manthey / jobs_monai.py
Created May 30, 2022 18:05
Tasks to run test jobs comparing MONAI Label pathology with HistomicsTK
import sys
import time
import girder_client
# Your instance of girder with the api/v1 path
apiUrl = 'http://abc.kitware.com:8085/api/v1'
# An authentication token that has permission to run jobs
apiToken = '64characterGirderTokenString'
# This is the directory where all of the images to process are located
#!/usr/bin/env python3
import sys
list1 = set(entry for entry in sys.argv[1].strip().replace('\n', ',').split(',') if '==' in entry)
list2 = set(entry for entry in sys.argv[2].strip().replace('\n', ',').split(',') if '==' in entry)
diff1 = list1 - list2
diff2 = list2 - list1
print(sorted(list1))
print(diff1, diff2)
---
version: '3'
services:
# To use a mongo container, uncomment this block and the links in the girder
# block. In the Dockerfile, disable starting mongo and enable the sysctl and
# iptables commands.
# mongodb:
# image: mongo:4.4
# command: bash -c "mkdir /dev/shm/mongo && mongod --nojournal --dbpath=/dev/shm/mongo --noauth --bind_ip_all --quiet --logpath /var/log/mongodb/mongod.log"
# # command: bash -c "mongod --nojournal --noauth --bind_ip_all --quiet --logpath /var/log/mongodb/mongod.log"
@manthey
manthey / dstest.py
Created December 1, 2022 16:22
This tests reading dicom wsi using the dicomslide library. For files generated with wsi2dcm, this augments and modifies some data to conform to what dicomslide expects. If invalid UIDs are present, it will still fail.
import logging
import sys
import dicomslide
import dicomweb_client
import pydicom
dslog = logging.getLogger('dicomslide')
# dslog.addHandler(logging.StreamHandler(sys.stderr))
# dslog.setLevel(logging.WARN)
import os
from collections import defaultdict
import configurations.importer
import django
from django.apps import apps
from django.db import models
os.environ['DJANGO_SETTINGS_MODULE'] = 'shapeworks_cloud.settings'
os.environ.setdefault('DJANGO_CONFIGURATION', 'DevelopmentConfiguration')