Public Member Functions | List of all members
mirtk.atlas.spatiotemporal.SpatioTemporalAtlas Class Reference

Spatio-temporal atlas. More...

Inherits object.

Collaboration diagram for mirtk.atlas.spatiotemporal.SpatioTemporalAtlas:
Collaboration graph

Public Member Functions

def __getitem__ (self, i)
 
def __init__ (self, config, root=None, step=-1, verbose=1, threads=-1, exit_on_error=False)
 
def __len__ (self)
 
def affdof (self, imgid)
 
def age (self, imgid)
 
def ages (self)
 
def avgdof (self, t, path=None, step=-1, force=False, create=True, batch=False)
 
def avgdofs (self, step=-1, force=False, create=True, queue=None, batchname="avgdofs")
 
def avgimg (self, t, channel=None, label=0, path=None, sharpen=True, outdir=None, step=-1, decomposed=True, force=False, create=True, batch=False)
 
def avgimgs (self, step=-1, ages=[], channels=[], labels={}, sharpen=True, outdir=None, decomposed=True, force=False, create=True, queue=None, batchname="avgimgs")
 
def compose (self, step=-1, ages=[], allpairs=False, force=False, create=True, queue=None, batchname="compose")
 
def construct (self, start=-1, niter=10, outdir=None, force=False, queue=None)
 
def defimg (self, imgid, t, channel=None, path=None, step=-1, decomposed=True, force=False, create=True, batch=False)
 
def defimgs (self, ages=[], channels=[], step=-1, decomposed=True, force=False, create=True, queue=None, batchname="defimgs")
 
def deform (self, i, t, path=None, channel=None, force=False, create=True)
 
def deformation (self, i, t=None, force=False, create=True)
 
def doftable (self, t, step=-1, force=False, create=True, batch=False)
 
def evaluate (self, ages=[], step=-1, force=False, queue=None)
 
def growth (self, t1, t2, step=-1, force=False, create=True, batch=False)
 
def image (self, imgid, channel=None, label=0, force=False, create=True)
 
def imgdof (self, imgid, t, step=-1, decomposed=False, force=False, create=True, batch=False)
 
def imgdofs (self, ages=[], step=-1, force=False, create=True, queue=None, batchname="imgdofs")
 
def imgtable (self, t, channel=None, step=-1, decomposed=True, force=False, create=True, batch=False)
 
def info (self, msg, step=-1)
 
def interpolate (self, t, path=None, channel=None, interp="default", deform=False, sigma=0, force=False, create=True)
 
def normtime (self, t)
 
def parin (self, step=-1, force=False, create=True)
 
def regcfg (self, step=-1)
 
def regdof (self, imgid, t=None, step=-1, path=None, force=False, create=True, batch=False)
 
def regdofs (self, step=-1, force=False, create=True, queue=None, batchname="register")
 
def rmtemp (self)
 
def splitchannel (self, channel=None)
 
def stdev (self, t)
 
def subdir (self, step=-1)
 
def template (self, i, channel=None)
 
def timeindex (self, t)
 
def timename (self, t1, t2=None)
 
def view (self, i=None, channel=None)
 
def wait (self, jobs, interval=60, verbose=5)
 
def weight (self, t, mean, sigma=0, normalize=True, epsilon=None)
 
def weights (self, mean=None, sigma=0, zero=False)
 

Detailed Description

Spatio-temporal atlas.

Spatio-temporal image and deformation atlas

Configuration entries such as file and directory paths, final atlas time
points (means) and corresponding temporal kernel width/standard deviation
(sigma) are read from a JSON configuration file.

The `construct` function performs the group-wise atlas construction.
Template images for each atlas time point specified in the configuration
are written to the configured `outdir`. At intermediate steps, an average
image is created for each time point associated with an image in the
dataset from which the atlas is created. These can be found in the `img`
subdirectory of each iteration underneath the configured `tmpdir`.

After atlas construction, average images and longitudinal deformations
for every continuous time (within the atlas precision/max. resolution)
can be computed as long as the required deformations are stored.

Definition at line 40 of file spatiotemporal.py.

Constructor & Destructor Documentation

§ __init__()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.__init__ (   self,
  config,
  root = None,
  step = -1,
  verbose = 1,
  threads = -1,
  exit_on_error = False 
)
Load spatio-temporal atlas configuration.

Definition at line 65 of file spatiotemporal.py.

Member Function Documentation

§ __getitem__()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.__getitem__ (   self,
  i 
)
Absolute file path of i-th atlas template.

Definition at line 1374 of file spatiotemporal.py.

§ __len__()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.__len__ (   self)
Length of the atlas is the number of templates at discrete time points.

Definition at line 1370 of file spatiotemporal.py.

§ affdof()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.affdof (   self,
  imgid 
)
Get absolute path of affine transformation of global normalization.

Definition at line 396 of file spatiotemporal.py.

§ age()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.age (   self,
  imgid 
)
Get time associated with the specified image, i.e., mean of temporal Gaussian kernel.

Definition at line 298 of file spatiotemporal.py.

§ ages()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.ages (   self)
Get set of all ages associated with the images from which atlas is constructed.

Definition at line 302 of file spatiotemporal.py.

§ avgdof()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.avgdof (   self,
  t,
  path = None,
  step = -1,
  force = False,
  create = True,
  batch = False 
)
Get mean cross-sectional SV FFD transformation at given time.

Definition at line 660 of file spatiotemporal.py.

§ avgdofs()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.avgdofs (   self,
  step = -1,
  force = False,
  create = True,
  queue = None,
  batchname = "avgdofs" 
)
Compute all average SV FFDs needed for (parallel) atlas construction.

Definition at line 681 of file spatiotemporal.py.

§ avgimg()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.avgimg (   self,
  t,
  channel = None,
  label = 0,
  path = None,
  sharpen = True,
  outdir = None,
  step = -1,
  decomposed = True,
  force = False,
  create = True,
  batch = False 
)
Create average image for a given time point.

Definition at line 920 of file spatiotemporal.py.

§ avgimgs()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.avgimgs (   self,
  step = -1,
  ages = [],
  channels = [],
  labels = {},
  sharpen = True,
  outdir = None,
  decomposed = True,
  force = False,
  create = True,
  queue = None,
  batchname = "avgimgs" 
)
Create all average images required for (parallel) atlas construction.

Definition at line 989 of file spatiotemporal.py.

§ compose()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.compose (   self,
  step = -1,
  ages = [],
  allpairs = False,
  force = False,
  create = True,
  queue = None,
  batchname = "compose" 
)
Compose longitudinal deformations with residual average deformations.

Definition at line 729 of file spatiotemporal.py.

§ construct()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.construct (   self,
  start = -1,
  niter = 10,
  outdir = None,
  force = False,
  queue = None 
)
Perform atlas construction.

Args:
    start (int): Last completed iteration. (default: step)
    niter (int, optional): Number of atlas construction iterations. (default: 10)
    outdir (str, optional): Directory for final templates. (default: config.paths.outdir)
    force (bool, optional): Force re-creation of already existing files. (default: False)
    queue (str, dict, optional): Name of queues of batch queuing system.
When not specified, the atlas construction runs on the local machine
using the number of threads specified during construction. When a single `str`
is given, both short and long running jobs are submitted to the same queue.
Otherwise, separate environments can be specified for "short" or "long" running
jobs using the respective dictionary keys. The supported environments are:
- "local": Multi-threaded execution on host machine
- "condor": Batch execution using HTCondor
- "<other>": Batch execution using named SLURM partition
(default: config.environment.queue)

Definition at line 1054 of file spatiotemporal.py.

§ defimg()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.defimg (   self,
  imgid,
  t,
  channel = None,
  path = None,
  step = -1,
  decomposed = True,
  force = False,
  create = True,
  batch = False 
)
Transform sample image to atlas space at given time point.

Definition at line 823 of file spatiotemporal.py.

§ defimgs()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.defimgs (   self,
  ages = [],
  channels = [],
  step = -1,
  decomposed = True,
  force = False,
  create = True,
  queue = None,
  batchname = "defimgs" 
)
Transform all images to discrete set of atlas time points.

Definition at line 849 of file spatiotemporal.py.

§ deform()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.deform (   self,
  i,
  t,
  path = None,
  channel = None,
  force = False,
  create = True 
)
Deform i-th template using longitudinal deformations to time point t.

Definition at line 1386 of file spatiotemporal.py.

§ deformation()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.deformation (   self,
  i,
  t = None,
  force = False,
  create = True 
)
Get absolute path of longitudinal deformation from template i.

Definition at line 1378 of file spatiotemporal.py.

§ doftable()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.doftable (   self,
  t,
  step = -1,
  force = False,
  create = True,
  batch = False 
)
Write table with image to atlas deformations of images with non-zero weight.

Definition at line 628 of file spatiotemporal.py.

§ evaluate()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.evaluate (   self,
  ages = [],
  step = -1,
  force = False,
  queue = None 
)
Evaluate atlas sharpness measures.

Definition at line 1153 of file spatiotemporal.py.

§ growth()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.growth (   self,
  t1,
  t2,
  step = -1,
  force = False,
  create = True,
  batch = False 
)
Make composite SV FFD corresponding to longitudinal change from t1 to t2.

Definition at line 706 of file spatiotemporal.py.

§ image()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.image (   self,
  imgid,
  channel = None,
  label = 0,
  force = False,
  create = True 
)
Get absolute path of requested input image.

Definition at line 373 of file spatiotemporal.py.

§ imgdof()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.imgdof (   self,
  imgid,
  t,
  step = -1,
  decomposed = False,
  force = False,
  create = True,
  batch = False 
)
Compute composite image to atlas transformation.

Definition at line 759 of file spatiotemporal.py.

§ imgdofs()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.imgdofs (   self,
  ages = [],
  step = -1,
  force = False,
  create = True,
  queue = None,
  batchname = "imgdofs" 
)
Compute all composite image to atlas transformations.

Definition at line 786 of file spatiotemporal.py.

§ imgtable()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.imgtable (   self,
  t,
  channel = None,
  step = -1,
  decomposed = True,
  force = False,
  create = True,
  batch = False 
)
Write image table with weights for average-images, and deform images to given time point.

Definition at line 898 of file spatiotemporal.py.

§ info()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.info (   self,
  msg,
  step = -1 
)
Print status message.

Definition at line 258 of file spatiotemporal.py.

§ interpolate()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.interpolate (   self,
  t,
  path = None,
  channel = None,
  interp = "default",
  deform = False,
  sigma = 0,
  force = False,
  create = True 
)
Interpolate atlas volume for specified time from finite set of templates.

Unlike avgimg, this function does not evaluate the continuous spatio-temporal function
to construct a template image for the given age. Instead, it uses the specified
interpolation kernel and computes the corresponding weighted average of previously
constructed template images.

Args:
    interp (str): Temporal interpolation kernel (weights). (default: 'gaussian')
    sigma (float): Standard deviation used for Gaussian interpolation. (default: adaptive)
    deform (bool): Whether to deform each template using the longitudinal deformation.

Definition at line 1407 of file spatiotemporal.py.

§ normtime()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.normtime (   self,
  t 
)
Clamp time to be within atlas domain.

Definition at line 267 of file spatiotemporal.py.

§ parin()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.parin (   self,
  step = -1,
  force = False,
  create = True 
)
Write registration configuration file and return path.

Definition at line 415 of file spatiotemporal.py.

§ regcfg()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.regcfg (   self,
  step = -1 
)
Get registration configuration entries.

Definition at line 405 of file spatiotemporal.py.

§ regdof()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.regdof (   self,
  imgid,
  t = None,
  step = -1,
  path = None,
  force = False,
  create = True,
  batch = False 
)
Register atlas to specified image and return path of transformation file.

Definition at line 547 of file spatiotemporal.py.

§ regdofs()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.regdofs (   self,
  step = -1,
  force = False,
  create = True,
  queue = None,
  batchname = "register" 
)
Register all images to their age-specific template.

Definition at line 602 of file spatiotemporal.py.

§ rmtemp()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.rmtemp (   self)
Delete temporary files.

This function removes all temporary files which can be recomputed
without the need for performing the more costly registrations.
Intermediate template images, auxiliary CSV files, and composite
transformations are among these temporary files to be deleted.

Definition at line 1470 of file spatiotemporal.py.

§ splitchannel()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.splitchannel (   self,
  channel = None 
)
Split channel specification into name and label specification.

Definition at line 358 of file spatiotemporal.py.

§ stdev()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.stdev (   self,
  t 
)
Get standard deviation of temporal Gaussian kernel centered at time t.

Definition at line 309 of file spatiotemporal.py.

§ subdir()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.subdir (   self,
  step = -1 
)
Get absolute path of directory of current iteration.

Definition at line 349 of file spatiotemporal.py.

§ template()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.template (   self,
  i,
  channel = None 
)
Get absolute path of i-th template image.

Definition at line 1357 of file spatiotemporal.py.

§ timeindex()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.timeindex (   self,
  t 
)
Get discrete time point index.

Definition at line 271 of file spatiotemporal.py.

§ timename()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.timename (   self,
  t1,
  t2 = None 
)
Get time point string used in file names.

Definition at line 284 of file spatiotemporal.py.

§ view()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.view (   self,
  i = None,
  channel = None 
)
View template image at specified time point(s).

Definition at line 1459 of file spatiotemporal.py.

§ wait()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.wait (   self,
  jobs,
  interval = 60,
  verbose = 5 
)
Wait for batch jobs to complete.

Definition at line 241 of file spatiotemporal.py.

§ weight()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.weight (   self,
  t,
  mean,
  sigma = 0,
  normalize = True,
  epsilon = None 
)
Evaluate temporal kernel weight for specified image.

Definition at line 318 of file spatiotemporal.py.

§ weights()

def mirtk.atlas.spatiotemporal.SpatioTemporalAtlas.weights (   self,
  mean = None,
  sigma = 0,
  zero = False 
)
Get weights of images within local support of given temporal kernel.

Definition at line 329 of file spatiotemporal.py.


The documentation for this class was generated from the following file: