Skip to content

Instantly share code, notes, and snippets.

View jphdotam's full-sized avatar

James jphdotam

View GitHub Profile
import os
import cv2
import glob
import pydicom
from pydicom.dicomdir import DicomDir
from pydicom.errors import InvalidDicomError
## EDIT THESE TWO LINES IF NEEDED:
FOLDER_PATH = "./dicom_study/" # Path to your folder of DICOMS; default assumes they're in a folder called 'dicom_study' in the same folder as this file
BLANK_PROPORTION = 0.05 # Set this to 0.1 to blank out top 10% of video (and therefore anonymise)
@jphdotam
jphdotam / main.nim
Last active December 25, 2021 23:30
import nimgl/[glfw, opengl]
import shader
type Vertex {.packed.} = object
color: array[4, GLfloat]
position: array[3, GLfloat]
proc initVertex(color: array[4, GLfloat], position: array[3, GLfloat]): Vertex = Vertex(color: color, position: position)
var verts: array[4, Vertex] = [
initVertex([0.11f, 0.8f, 0.76f, 1.0f], [-0.5f, -0.5f, 0.0f]),
@jphdotam
jphdotam / wordle_firstword.go
Created January 25, 2022 11:16
Best starter word for wordle
package main
import (
"fmt"
"runtime"
"sort"
"sync"
)
var cores = runtime.NumCPU()
@jphdotam
jphdotam / wordle_first_two_words.go
Created January 25, 2022 11:39
Best first and second words in Wordle
package main
import (
"fmt"
"runtime"
"sort"
"sync"
)
var cores = runtime.NumCPU()
@jphdotam
jphdotam / migrate_orthanc.py
Last active November 1, 2024 15:32
Migrate one Orthanc server to another using multiple threads
# this is inspired by the official ImportDicomFiles.py - however, this is MUCH faster because
# it uses multiple workers to dramatically reduce IO bottlenecks
# it doesn't re-instantiate the Http() and headers for every file, rather every folder
# it does assume the input folders are structured in the orthanc format, e.g. /00/00/0000a8768bd86...
# and expects PATH_TO_SYNC to be something like:
## "/path/to/orthanc/root/*" for all root folders
## "/path/to/orthanc/root/1*" for all folders beginning with 1
## "/path/to/orthanc/root/23" for root folder 23 only
@jphdotam
jphdotam / copy-of-onnx-to-tf-to-tfjs-colab.ipynb
Created June 27, 2024 18:55
Copy of ONNX-to-TF-to-TFJS-Colab.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import os
import math
from glob import glob
import pydicom
import numpy as np
import onnxruntime
from loguru import logger
from matplotlib import pyplot as plt
from skimage.transform import resize
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.