Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 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.
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
# 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 |
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
package main | |
import ( | |
"fmt" | |
"runtime" | |
"sort" | |
"sync" | |
) | |
var cores = runtime.NumCPU() |
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
package main | |
import ( | |
"fmt" | |
"runtime" | |
"sort" | |
"sync" | |
) | |
var cores = runtime.NumCPU() |
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 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]), |
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 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) |