Imports:
import vtk
from vtk.util import numpy_support
import numpy
Create a vtkDICOMImageReader object, set its directory to the one containing all DICOM files, and Update to read in all data:
Imports:
import vtk
from vtk.util import numpy_support
import numpy
Create a vtkDICOMImageReader object, set its directory to the one containing all DICOM files, and Update to read in all data:
If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.
Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.
If in doubt about what git is doing when you run these commands, just
| import nrrd # pip install pynrrd | |
| import nibabel as nib # pip install nibabel | |
| import numpy as np | |
| # load nrrd | |
| _nrrd = nrrd.read('/path/to/nrrd.nrrd') | |
| data = _nrrd[0] | |
| header = _nrrd[1] | |
| print data.shape, header |
| !pip install fastai | |
| !apt-get -qq install -y libsm6 libxext6 && pip install -q -U opencv-python | |
| import cv2 | |
| from os import path | |
| from wheel.pep425tags import get_abbr_impl, get_impl_ver, get_abi_tag | |
| platform = '{}{}-{}'.format(get_abbr_impl(), get_impl_ver(), get_abi_tag()) | |
| accelerator = 'cu80' if path.exists('/opt/bin/nvidia-smi') else 'cpu' | |
| !pip install -q http://download.pytorch.org/whl/{accelerator}/torch-0.3.0.post4-{platform}-linux_x86_64.whl torchvision |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| """ | |
| nii_to_tif | |
| command line executable to convert 3d nifti images to | |
| individual tiff images along a user-specified axis | |
| call as: python nii_to_tif.py /path/to/nifti /path/to/tif | |
| (append optional arguments to the call as desired) |
| #CODE | |
| #Generate root password | |
| import random, string | |
| password = ''.join(random.choice(string.ascii_letters + string.digits) for i in range(20)) | |
| #Download ngrok | |
| ! wget -q -c -nc https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip | |
| ! unzip -qq -n ngrok-stable-linux-amd64.zip | |
| #Setup sshd |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| """ | |
| tif_to_nii | |
| command line executable to convert a directory of tif images | |
| (from one image) to a nifti image stacked along a user-specified axis | |
| call as: python tif_to_nii.py /path/to/tif/ /path/to/nifti | |
| (append optional arguments to the call as desired) |