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
#! /usr/bin/env python | |
""" | |
Split a 4D NIFTI file into separate volumes. | |
Dec 11, 2023 | |
David Gobbi | |
""" | |
usage=""" |
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
#! /usr/bin/env python | |
import sys | |
import os | |
import mmap | |
import vtk | |
usage = """ | |
Usage: "ViewImage2D [options] image |
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
#! /usr/bin/env python | |
""" | |
This program reads the output from "dicomdump" and converts it to json. | |
The latest version of this code can be found at gist.github.com/dgobbi | |
Note that this code is incomplete, incorrect, and may destroy your data. | |
It comes with absolutely no warranties. Use at your own risk. | |
""" |
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
# coding=utf-8 | |
""" | |
A simple VTK widget for PyQt or PySide. | |
See http://www.trolltech.com for Qt documentation, | |
http://www.riverbankcomputing.co.uk for PyQt, and | |
http://pyside.github.io for PySide. | |
This class is based on the vtkGenericRenderWindowInteractor and is | |
therefore fairly powerful. It should also play nicely with the | |
vtk3DWidget code. |
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
# coding=utf-8 | |
""" | |
Example of displaying an image with VTK/Qt/Python. | |
Original author: David Gobbi | |
This example does not include proper image orientation or interaction. | |
""" | |
import sys |
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
""" | |
Module: dicom_to_nifti.py | |
Nov 28, 2019 | |
David Gobbi | |
""" | |
import pydicom | |
import nibabel as nib | |
import numpy as np |
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
""" | |
Program nifti_readwrite.py | |
Sep 16, 2019 | |
David Gobbi | |
""" | |
import sys | |
import argparse | |
import nibabel as nib |
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
""" | |
Program vtk_augment_nifti.py | |
Sep 25, 2018 | |
David Gobbi | |
[email protected] | |
""" | |
import vtk | |
import sys |
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 numpy | |
Kb = 0.114 | |
Kr = 0.299 | |
full = numpy.array([ | |
[1.0, 0.0, 2.0*(1.0-Kr) ], | |
[1.0, -2.0*Kb*(1.0-Kb)/(1.0-Kr-Kb), -2.0*Kr*(1.0-Kr)/(1.0-Kr-Kb) ], | |
[1.0, 2.0*(1.0-Kb), 0.0 ] | |
]) |
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 numpy as np | |
def ellipsoid(radii, dtype='d'): | |
"""Generate an ellipsoid with the specified radii. | |
The ellipsoid will be centered in the output, which will always | |
have odd dimensions. The surface of the sphere will be antialiased, | |
that is, a linear ramp is applied at the surface instead of a hard | |
edge. The size of the ramp is exactly one sample spacing, i.e. points | |
right on the surface will have a value of 0.5 while points that are |
NewerOlder