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 nibabel as nib | |
import numpy as np | |
# set paths and params | |
in_path = 'case.nii.gz' | |
out_path = 'case_out.nii.gz' | |
interspace = 2 | |
# load data | |
img = nib.load(in_path) |
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
# By Ashkan Pakzad (ashkanpakzad.github.io) 2021 | |
# This is a python script to batch rip several CD/DVD optical disks. | |
# It should only require you to change the disk when ejected and the rest is automated. | |
# Only works on mac as it uses mac's drutil commands to trigger the systems optical | |
# disk tray. | |
# Only runs on mac, dependent on pypi package progress, | |
# pip install progress |
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 nibabel as nib | |
import dicom_numpy | |
import os | |
import numpy as np | |
pathtodicom = '/path/to/dicom/' | |
# get list of dicom images from directory that make up the 3D image | |
dicomlist = [pathtodicom + f for f in os.listdir(pathtodicom)] | |
# load dicom volume |
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 pydicom | |
# paths to data and save location | |
filepath = './data/' # directory containing the dicom series | |
dcmprefix = 'Image_' # Individual dicom file prefix before number | |
firstdcm = dcmprefix + '%04d.DICOM' %1 # first dicom image to inspect metadata fields | |
newdir = './data-edited/' # directory to save new metadata fields | |
# Find total number of dicom files in series |
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 pydicom | |
# paths to data and save location | |
filepath = './data/' # directory containing the dicom series | |
dcmprefix = 'Image_' # Individual dicom file prefix before number | |
firstdcm = dcmprefix + '%04d.DICOM' %1 # first dicom image to inspect metadata fields | |
newdir = './data-edited/' # directory to save new metadata fields | |
# Find total number of dicom files in series |
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 pydicom | |
# paths to data and save location | |
filepath = './data/' # directory containing the dicom series | |
dcmprefix = 'Image_' # Individual dicom file prefix before number | |
firstdcm = dcmprefix + '%04d.DICOM' %1 # first dicom image to inspect metadata fields | |
newdir = './data-edited/' # directory to save new metadata fields | |
# Find total number of dicom files in series |