Eidolon
|
Public Member Functions | |
def | init (self, plugid, win, mgr) |
def | getCWD (self) |
def | getNiftiFile (self, name) |
def | getLogFile (self, name) |
def | getLocalFile (self, name) |
def | getUniqueObjName (self, name) |
def | getTrackingDirs (self, root=None) |
def | addObject (self, obj) |
def | loadNiftiFiles (self, filenames, task) |
def | getUniqueShortName (self, comps, kwargs) |
def | getUniqueLocalFile (self, name) |
def | getServerAddrPort (self) |
def | setServerAddrPort (self, addr, port) |
def | saveToNifti (self, objs, setObjArgs=False) |
def | correctNiftiParams (self, sourceobj, destfile, makeProspective=False) |
def | applyImageDof (self, inname, outname, doffile, cwd, correctNifti=True) |
def | load3DTagSeries (self, tagobj, makeProspective, loadPlanes=False, makeDetag=True, spacing=vec3(1), tryFix=True) |
def | createSegObject (self, srcname, segtype) |
def | createTimeRegStack (self, template, stack, trname=None, loadObject=True) |
def | spatialCorrect (self, target, before, after, prefix, extras=[], xyOnly=True, trans=True, logfile=None, cwd=None) |
def | alignShortStack (self, saxname, segname, templatename=None) |
def | alignIntersectImages (self, volume, intersects, tempDir=None, numIters=1, dilation=5, moveScale=0.1, task=None) |
def | rigidRegisterStack (self, subjectname, rtargetname, htargetname, finalname, doffile, paramfile, correctNifti) |
def | rigidRegisterStackList (self, subjectname, intermedname, targetnames) |
def | readPolyNodes (self, filename) |
def | writePolyNodes (self, filename, nodes) |
def | createImageGrid (self, obj, w, h, d) |
def | createIsotropicObject (self, obj, cropEmpty, spacing=1.0, task=None) |
def | setObjectTimestep (self, objname, start, step, task=None) |
def | invertTimesteps (self, sourceobj) |
def | offsetTimesteps (self, sourceobj, suffix, value, makeProspective=False) |
def | resampleObject (self, srcname, templatename, isIsotropic) |
def | extractTimestepsToObject (self, srcname, indices=None, timesteps=None) |
def | reorderMulticycleImage (self, srcname, starttime, timestep, task) |
def | cropMotionObject (self, srcname, threshold, filtersize, task) |
def | emptyCropObject (self, imgobj, loadObj=True) |
def | refImageCrop (self, imgname, refname, mx, my) |
def | extendImageStack (self, stack, mx=0, my=0, mz=0, value=0) |
def | extendImageObject (self, obj, mx=0, my=0, mz=0, value=0, task=None) |
def | registerImage2D (self, src, tgt, tempDir=None, spacing=10, model='BSplineFFD') |
def | interpolateImages2D (self, im0, im1, numImgs, tempDir=None) |
def | interpolateImageObject (self, obj, numAddedSlices, tempDir=None, task=None) |
def | applyMotionTrack (self, obj_or_name, trackname_or_dir, addObject=True) |
def | applyMotionTrackPoints (self, dirname, pts) |
def | isServerAlive (self, serveraddr=None, serverport=None) |
def | sendServerMsg (self, msg, args=(), buffsize=4096, timeout=10.0, serveraddr=None, serverport=None) |
def | startMotionTrackServer (self, addr=None, port=None) |
def | startMotionTrackJob (self, trackname, maskname, dirname, adaptive, chosenparam) |
def | startGPUNRegMotionTrack (self, imgname, maskname, trackname, paramfile) |
def | startRegisterMotionTrack (self, imgname, maskname, trackname, paramfile, model=None, onefile=False, task=None) |
def | checkMotionTrackJobs (self, jids) |
Private Member Functions | |
def | _removeNamedObjs (self, names) |
def | _checkProgramTask (self, result) |
|
private |
|
private |
def addObject | ( | self, | |
obj | |||
) |
Add an object to the current context (ie. project). If the object is already present, this method should still succeed but still do the internal bookkeeping operations needed (ie. save the project).
def alignIntersectImages | ( | self, | |
volume, | |||
intersects, | |||
tempDir = None , |
|||
numIters = 1 , |
|||
dilation = 5 , |
|||
moveScale = 0.1 , |
|||
task = None |
|||
) |
def alignShortStack | ( | self, | |
saxname, | |||
segname, | |||
templatename = None |
|||
) |
def applyImageDof | ( | self, | |
inname, | |||
outname, | |||
doffile, | |||
cwd, | |||
correctNifti = True |
|||
) |
def applyMotionTrack | ( | self, | |
obj_or_name, | |||
trackname_or_dir, | |||
addObject = True |
|||
) |
Apply the motion track data in `trackname_or_dir' to `obj_or_name'. The value `obj_or_name' is either a mesh or image SceneObject, or the name of one in the current context. The value `trackname_or_dir' is the path to a directory containing tracking information or the name of one in the current context. If `addObject' is True then the resulting SceneObject produced by applying the tracking information is added to the current context. Return value is the time-dependent SceneObject containing the tracking information, or a Future containing this object if the method was called outside of the task thread.
def applyMotionTrackPoints | ( | self, | |
dirname, | |||
pts | |||
) |
Simple synchronous method applying the motion track data in `dirname' to the list of vec3 points `pts'. Returns map of timesteps to motion tracked points at those times. This method blocks while the tracking is applied to the points so it shouldn't be expected to be instantaneous.
def checkMotionTrackJobs | ( | self, | |
jids | |||
) |
def correctNiftiParams | ( | self, | |
sourceobj, | |||
destfile, | |||
makeProspective = False |
|||
) |
Corrects the parameters in the NIfTI file `destfile' with those in the ImageSceneObject or filename `sourceobj'. IRTK munges timestep values amongst other things so use this to reset them to what they were in the original. If `makeProspective' is True then half of the average difference between timesteps is added to each time.
def createImageGrid | ( | self, | |
obj, | |||
w, | |||
h, | |||
d | |||
) |
def createIsotropicObject | ( | self, | |
obj, | |||
cropEmpty, | |||
spacing = 1.0 , |
|||
task = None |
|||
) |
def createSegObject | ( | self, | |
srcname, | |||
segtype | |||
) |
def createTimeRegStack | ( | self, | |
template, | |||
stack, | |||
trname = None , |
|||
loadObject = True |
|||
) |
Create a new image series by temporally registering `stack' to `template'. This involves selecting timesteps in `stack' which are closest to the timesteps in `template', then copying the images for these timesteps into the resulting object. Eg. if `template' has timesteps [0,7] and `stack' has [0,4,6,10], the resulting object will have 2 timesteps [0,7] whose images are copied from timesteps 0 and 6 in `stack'. This assumes that `template' has fewer timesteps that `stack'.
def cropMotionObject | ( | self, | |
srcname, | |||
threshold, | |||
filtersize, | |||
task | |||
) |
def emptyCropObject | ( | self, | |
imgobj, | |||
loadObj = True |
|||
) |
def extendImageObject | ( | self, | |
obj, | |||
mx = 0 , |
|||
my = 0 , |
|||
mz = 0 , |
|||
value = 0 , |
|||
task = None |
|||
) |
Given image object or name `obj', extend the images by `mx' and `my' and add `mz' images on the above and below the stack. The new image areas are filled with `value'. This returns a Future containing the object added to the scene. This differs from extendImageStack() by adding the new object to the scene rather than just returning it and saving it to a NIfTI file, as well as being implemented as a task method.
def extendImageStack | ( | self, | |
stack, | |||
mx = 0 , |
|||
my = 0 , |
|||
mz = 0 , |
|||
value = 0 |
|||
) |
Given image stack named by `stack', extend the images by `mx' and `my' and add `mz' images on the above and below the stack. The new image areas are filled with `value'. This returns the extend object and a list with the NIfTI filename it was saved to.
def extractTimestepsToObject | ( | self, | |
srcname, | |||
indices = None , |
|||
timesteps = None |
|||
) |
def getCWD | ( | self | ) |
This method must be overridden to return the current working directory (ie. project directory).
def getLocalFile | ( | self, | |
name | |||
) |
Get a file with name `name' in the current context (ie. project directory).
def getLogFile | ( | self, | |
name | |||
) |
Get the log file in the current context starting with `name', '.log' is appended to the filename if not already present.
def getNiftiFile | ( | self, | |
name | |||
) |
Get the NIfTI file in the current context starting with `name', '.nii' is appended to the filename.
def getServerAddrPort | ( | self | ) |
Returns the server address and port, default is ('localhost',15000).
def getTrackingDirs | ( | self, | |
root = None |
|||
) |
Returns a list of absolute path directory names in the current context or in `root' containing tracking information.
def getUniqueLocalFile | ( | self, | |
name | |||
) |
Get a version of the filename `name' which is guarranteed to be unique in the current context.
def getUniqueObjName | ( | self, | |
name | |||
) |
Get a unique object name which won't cause files to be overwritten.
def getUniqueShortName | ( | self, | |
comps, | |||
kwargs | |||
) |
Create a name guaranteed to be unique in the current context using the given arguments with createShortName().
def init | ( | self, | |
plugid, | |||
win, | |||
mgr | |||
) |
def interpolateImageObject | ( | self, | |
obj, | |||
numAddedSlices, | |||
tempDir = None , |
|||
task = None |
|||
) |
def interpolateImages2D | ( | self, | |
im0, | |||
im1, | |||
numImgs, | |||
tempDir = None |
|||
) |
Generate an interpolation stack between 2D images `im0` and `im1` with `numImgs' total number of images.
def invertTimesteps | ( | self, | |
sourceobj | |||
) |
def isServerAlive | ( | self, | |
serveraddr = None , |
|||
serverport = None |
|||
) |
Attempts to connect to the server, if this fails the server isn't running or isn't accessible so return False. If `serveraddr' or `serverport' are given, these values are used instead of those given by getServerAddrPort().
def load3DTagSeries | ( | self, | |
tagobj, | |||
makeProspective, | |||
loadPlanes = False , |
|||
makeDetag = True , |
|||
spacing = vec3(1) , |
|||
tryFix = True |
|||
) |
Load the 3D TAG image series and process it into a time-dependent volume combining the 3 magnitude orientations. This assumes `tagobj' contains images for 3 orientations in an overlapping volume, with phase and magnitude volumes for each orientation and timestep. This ignores the phase images which are assumed to have negative minimum image values, while the magnitude images should have 0 as the minimum value.
def loadNiftiFiles | ( | self, | |
filenames, | |||
task | |||
) |
Loads the given NIfTI file paths. The argument `filenames' can be a list of paths, or a Future returning such a list. The result value is a Future which eventually will hold the loaded ImageSceneObject instances. Each loaded file is added to the current context by being passed to addObject().
def offsetTimesteps | ( | self, | |
sourceobj, | |||
suffix, | |||
value, | |||
makeProspective = False |
|||
) |
def readPolyNodes | ( | self, | |
filename | |||
) |
def refImageCrop | ( | self, | |
imgname, | |||
refname, | |||
mx, | |||
my | |||
) |
def registerImage2D | ( | self, | |
src, | |||
tgt, | |||
tempDir = None , |
|||
spacing = 10 , |
|||
model = 'BSplineFFD' |
|||
) |
Register the 2D image `src` to `tgt`, returning the X and Y deformation fields to do so. The `tmpdir` directory path is used for temporary information. The `plugin` object is expected to be an IRTK plugin instance. The `spacing` value specifies the spacing between control points. The `model` field is either 'BSplineFFD' or 'Rigid' to specify the deformation model.
def reorderMulticycleImage | ( | self, | |
srcname, | |||
starttime, | |||
timestep, | |||
task | |||
) |
def resampleObject | ( | self, | |
srcname, | |||
templatename, | |||
isIsotropic | |||
) |
def rigidRegisterStack | ( | self, | |
subjectname, | |||
rtargetname, | |||
htargetname, | |||
finalname, | |||
doffile, | |||
paramfile, | |||
correctNifti | |||
) |
Determine the rigid registration dof file to register image series `rtargetname' to series `subjectname' then apply this registration to series `htargetname' to produce series `finalname'. This will create time registered versions of `subjectname' and/or `rtargetname' as needed.
def rigidRegisterStackList | ( | self, | |
subjectname, | |||
intermedname, | |||
targetnames | |||
) |
Rigidly register the images in `targetnames' to the image `subjectname'. If `intermedname' is neither "None" nor None, determine what the deformation is to rreg this to `subjectname' and apply that deformation to the images in `targetnames'. Otherwise determine the deformation for each image in `targetnames' and apply that deformation to the image, ie. rreg each image independently using their own image features.
def saveToNifti | ( | self, | |
objs, | |||
setObjArgs = False |
|||
) |
def sendServerMsg | ( | self, | |
msg, | |||
args = () , |
|||
buffsize = 4096 , |
|||
timeout = 10.0 , |
|||
serveraddr = None , |
|||
serverport = None |
|||
) |
Sends a message to a currently running server.
def setObjectTimestep | ( | self, | |
objname, | |||
start, | |||
step, | |||
task = None |
|||
) |
def setServerAddrPort | ( | self, | |
addr, | |||
port | |||
) |
Set the server address and port, setting a value as None will keep existing value.
def spatialCorrect | ( | self, | |
target, | |||
before, | |||
after, | |||
prefix, | |||
extras = [] , |
|||
xyOnly = True , |
|||
trans = True , |
|||
logfile = None , |
|||
cwd = None |
|||
) |
Determine the correction for `target'.nii necessary to align the images spatially, then apply this correction to `before'.nii to produce `after'.nii, also apply the correction to every i in `extras' which produces and `prefix'`i'.nii for each.
def startGPUNRegMotionTrack | ( | self, | |
imgname, | |||
maskname, | |||
trackname, | |||
paramfile | |||
) |
def startMotionTrackJob | ( | self, | |
trackname, | |||
maskname, | |||
dirname, | |||
adaptive, | |||
chosenparam | |||
) |
def startMotionTrackServer | ( | self, | |
addr = None , |
|||
port = None |
|||
) |
Starts the server on the local machine if it isn't running and returns the process object, does nothing otherwise.
def startRegisterMotionTrack | ( | self, | |
imgname, | |||
maskname, | |||
trackname, | |||
paramfile, | |||
model = None , |
|||
onefile = False , |
|||
task = None |
|||
) |
Motion tracking using MIRTK register program.
def writePolyNodes | ( | self, | |
filename, | |||
nodes | |||
) |
CHeart |
composedofs |
convertdof |
decimatesurf |
Dicom |
editimage |
exesuffix |
ffd_motion |
fixshort |
gpu_nreg |
gpu_nreg_default |
info |
irtkdir |
irtkpath |
Meta |
mirtkdir |
motiontrack |
Nifti |
nreg_default |
patient1e4 |
patient1e6 |
Plot |
register |
rreg |
Segment |
serverdir |
Slice |
spatialcorrect |
transimage |
transpts |
VTK |