Search is not available for this dataset
text stringlengths 75 104k |
|---|
def boundary_maximum_power(graph, xxx_todo_changeme7):
"""
Boundary term processing adjacent voxels maximum value using a power relationship.
An implementation of a boundary term, suitable to be used with the
`~medpy.graphcut.generate.graph_from_voxels` function.
The same as `boundary_dif... |
def boundary_difference_power(graph, xxx_todo_changeme8):
r"""
Boundary term processing adjacent voxels difference value using a power relationship.
An implementation of a boundary term, suitable to be used with the
`~medpy.graphcut.generate.graph_from_voxels` function.
Finds all edges be... |
def __skeleton_maximum(graph, image, boundary_term, spacing):
"""
A skeleton for the calculation of maximum intensity based boundary terms.
This function is equivalent to energy_voxel.__skeleton_difference(), but uses the
maximum intensity rather than the intensity difference of neighbouring voxels... |
def __skeleton_difference(graph, image, boundary_term, spacing):
"""
A skeleton for the calculation of intensity difference based boundary terms.
Iterates over the images dimensions and generates for each an array of absolute
neighbouring voxel :math:`(p, q)` intensity differences :math:`|I_p, I_q|... |
def __skeleton_base(graph, image, boundary_term, neighbourhood_function, spacing):
"""
Base of the skeleton for voxel based boundary term calculation.
This function holds the low level procedures shared by nearly all boundary terms.
@param graph An initialized graph.GCGraph object
@type gr... |
def __flatten_index(pos, shape):
"""
Takes a three dimensional index (x,y,z) and computes the index required to access the
same element in the flattened version of the array.
"""
res = 0
acc = 1
for pi, si in zip(reversed(pos), reversed(shape)):
res += pi * acc
acc *= si
... |
def mutual_information(i1, i2, bins=256):
r"""
Computes the mutual information (MI) (a measure of entropy) between two images.
MI is not real metric, but a symmetric and nonnegative similarity measures that
takes high values for similar images. Negative values are also possible.
Intuitively, m... |
def __range(a, bins):
'''Compute the histogram range of the values in the array a according to
scipy.stats.histogram.'''
a = numpy.asarray(a)
a_max = a.max()
a_min = a.min()
s = 0.5 * (a_max - a_min) / float(bins - 1)
return (a_min - s, a_max + s) |
def __entropy(data):
'''Compute entropy of the flattened data set (e.g. a density distribution).'''
# normalize and convert to float
data = data/float(numpy.sum(data))
# for each grey-value g with a probability p(g) = 0, the entropy is defined as 0, therefore we remove these values and also flatten the ... |
def getArguments(parser):
"Provides additional validation of the arguments collected by argparse."
args = parser.parse_args()
if not '{}' in args.output:
raise argparse.ArgumentError(args.output, 'The output argument string must contain the sequence "{}".')
return args |
def centerdistance(image, voxelspacing = None, mask = slice(None)):
r"""
Takes a simple or multi-spectral image and returns its voxel-wise center distance in
mm. A multi-spectral image must be supplied as a list or tuple of its spectra.
Optionally a binary mask can be supplied to select the voxels ... |
def centerdistance_xdminus1(image, dim, voxelspacing = None, mask = slice(None)):
r"""
Implementation of `centerdistance` that allows to compute sub-volume wise
centerdistances.
The same notes as for `centerdistance` apply.
Parameters
----------
image : array_like or list/tuple of ... |
def indices(image, voxelspacing = None, mask = slice(None)):
r"""
Takes an image and returns the voxels ndim-indices as voxel-wise feature. The voxel
spacing is taken into account, i.e. the indices are not array indices, but millimeter
indices.
This is a multi-element feature where each element... |
def shifted_mean_gauss(image, offset = None, sigma = 5, voxelspacing = None, mask = slice(None)):
r"""
The approximate mean over a small region at an offset from each voxel.
Functions like `local_mean_gauss`, but instead of computing the average over a small
patch around the current voxel, the regi... |
def mask_distance(image, voxelspacing = None, mask = slice(None)):
r"""
Computes the distance of each point under the mask to the mask border taking the
voxel-spacing into account.
Note that this feature is independent of the actual image content, but depends
solely the mask image. Therefore al... |
def local_mean_gauss(image, sigma = 5, voxelspacing = None, mask = slice(None)):
r"""
Takes a simple or multi-spectral image and returns the approximate mean over a small
region around each voxel. A multi-spectral image must be supplied as a list or tuple
of its spectra.
Optionally a binary mas... |
def gaussian_gradient_magnitude(image, sigma = 5, voxelspacing = None, mask = slice(None)):
r"""
Computes the gradient magnitude (edge-detection) of the supplied image using gaussian
derivates and returns the intensity values.
Optionally a binary mask can be supplied to select the voxels for which ... |
def median(image, size = 5, voxelspacing = None, mask = slice(None)):
"""
Computes the multi-dimensional median filter and returns the resulting values per
voxel.
Optionally a binary mask can be supplied to select the voxels for which the feature
should be extracted.
Parameters
---... |
def local_histogram(image, bins=19, rang="image", cutoffp=(0.0, 100.0), size=None, footprint=None, output=None, mode="ignore", origin=0, mask=slice(None)):
r"""
Computes multi-dimensional histograms over a region around each voxel.
Supply an image and (optionally) a mask and get the local histogram of ... |
def hemispheric_difference(image, sigma_active = 7, sigma_reference = 7, cut_plane = 0, voxelspacing = None, mask = slice(None)):
r"""
Computes the hemispheric intensity difference between the brain hemispheres of an brain image.
Cuts the image along the middle of the supplied cut-plane. This results i... |
def _extract_hemispheric_difference(image, mask = slice(None), sigma_active = 7, sigma_reference = 7, cut_plane = 0, voxelspacing = None):
"""
Internal, single-image version of `hemispheric_difference`.
"""
# constants
INTERPOLATION_RANGE = int(10) # how many neighbouring values to take into account... |
def _extract_local_histogram(image, mask=slice(None), bins=19, rang="image", cutoffp=(0.0, 100.0), size=None, footprint=None, output=None, mode="ignore", origin=0):
"""
Internal, single-image version of @see local_histogram
Note: Values outside of the histograms range are not considered.
Note: Mode... |
def _extract_median(image, mask = slice(None), size = 1, voxelspacing = None):
"""
Internal, single-image version of `median`.
"""
# set voxel spacing
if voxelspacing is None:
voxelspacing = [1.] * image.ndim
# determine structure element size in voxel units
size = _create_s... |
def _extract_gaussian_gradient_magnitude(image, mask = slice(None), sigma = 1, voxelspacing = None):
"""
Internal, single-image version of `gaussian_gradient_magnitude`.
"""
# set voxel spacing
if voxelspacing is None:
voxelspacing = [1.] * image.ndim
# determine gaussian kernel... |
def _extract_shifted_mean_gauss(image, mask = slice(None), offset = None, sigma = 1, voxelspacing = None):
"""
Internal, single-image version of `shifted_mean_gauss`.
"""
# set voxel spacing
if voxelspacing is None:
voxelspacing = [1.] * image.ndim
# set offset
if offset is None:... |
def _extract_mask_distance(image, mask = slice(None), voxelspacing = None):
"""
Internal, single-image version of `mask_distance`.
"""
if isinstance(mask, slice):
mask = numpy.ones(image.shape, numpy.bool)
distance_map = distance_transform_edt(mask, sampling=voxelspacing)
retur... |
def _extract_local_mean_gauss(image, mask = slice(None), sigma = 1, voxelspacing = None):
"""
Internal, single-image version of `local_mean_gauss`.
"""
# set voxel spacing
if voxelspacing is None:
voxelspacing = [1.] * image.ndim
# determine gaussian kernel size in voxel units
... |
def _extract_centerdistance(image, mask = slice(None), voxelspacing = None):
"""
Internal, single-image version of `centerdistance`.
"""
image = numpy.array(image, copy=False)
if None == voxelspacing:
voxelspacing = [1.] * image.ndim
# get image center and an array holding ... |
def _extract_intensities(image, mask = slice(None)):
"""
Internal, single-image version of `intensities`.
"""
return numpy.array(image, copy=True)[mask].ravel() |
def _substract_hemispheres(active, reference, active_sigma, reference_sigma, voxel_spacing):
"""
Helper function for `_extract_hemispheric_difference`.
Smoothes both images and then substracts the reference from the active image.
"""
active_kernel = _create_structure_array(active_sigma, voxel_spacin... |
def _create_structure_array(structure_array, voxelspacing):
"""
Convenient function to take a structure array (single number valid for all dimensions
or a sequence with a distinct number for each dimension) assumed to be in mm and
returns a structure array (a sequence) adapted to the image space using t... |
def _extract_feature(fun, image, mask = slice(None), **kwargs):
"""
Convenient function to cope with multi-spectral images and feature normalization.
Parameters
----------
fun : function
The feature extraction function to call
image : array_like or list/tuple of array_like
... |
def getArguments(parser):
"Provides additional validation of the arguments collected by argparse."
args = parser.parse_args()
# check output image exists if override not forced
if not args.force:
if os.path.exists(args.output + args.image[-4:]):
raise ArgumentError('The supplied ... |
def _fill(self, text = ""):
"Indent a piece of text, according to the current indentation level"
if self._do_indent:
self._write("\n"+" "*self._indent + text)
else:
self._write(text) |
def _dispatch(self, tree):
"_dispatcher function, _dispatching tree type T to method _T."
if isinstance(tree, list):
for t in tree:
self._dispatch(t)
return
meth = getattr(self, "_"+tree.__class__.__name__)
if tree.__class__.__name__ == 'NoneType' ... |
def _AssAttr(self, t):
""" Handle assigning an attribute of an object
"""
self._dispatch(t.expr)
self._write('.'+t.attrname) |
def _Assign(self, t):
""" Expression Assignment such as "a = 1".
This only handles assignment in expressions. Keyword assignment
is handled separately.
"""
self._fill()
for target in t.nodes:
self._dispatch(target)
self._write(" = ")
... |
def _AssTuple(self, t):
""" Tuple on left hand side of an expression.
"""
# _write each elements, separated by a comma.
for element in t.nodes[:-1]:
self._dispatch(element)
self._write(", ")
# Handle the last one without writing comma
last_elemen... |
def _AugAssign(self, t):
""" +=,-=,*=,/=,**=, etc. operations
"""
self._fill()
self._dispatch(t.node)
self._write(' '+t.op+' ')
self._dispatch(t.expr)
if not self._do_indent:
self._write(';') |
def _CallFunc(self, t):
""" Function call.
"""
self._dispatch(t.node)
self._write("(")
comma = False
for e in t.args:
if comma: self._write(", ")
else: comma = True
self._dispatch(e)
if t.star_args:
if comma: self._w... |
def _From(self, t):
""" Handle "from xyz import foo, bar as baz".
"""
# fixme: Are From and ImportFrom handled differently?
self._fill("from ")
self._write(t.modname)
self._write(" import ")
for i, (name,asname) in enumerate(t.names):
if i != 0:
... |
def _Function(self, t):
""" Handle function definitions
"""
if t.decorators is not None:
self._fill("@")
self._dispatch(t.decorators)
self._fill("def "+t.name + "(")
defaults = [None] * (len(t.argnames) - len(t.defaults)) + list(t.defaults)
for i, ... |
def _Getattr(self, t):
""" Handle getting an attribute of an object
"""
if isinstance(t.expr, (Div, Mul, Sub, Add)):
self._write('(')
self._dispatch(t.expr)
self._write(')')
else:
self._dispatch(t.expr)
self._write('.'+... |
def _Import(self, t):
""" Handle "import xyz.foo".
"""
self._fill("import ")
for i, (name,asname) in enumerate(t.names):
if i != 0:
self._write(", ")
self._write(name)
if asname is not None:
self._write(" as "+a... |
def _Keyword(self, t):
""" Keyword value assignment within function calls and definitions.
"""
self._write(t.name)
self._write("=")
self._dispatch(t.expr) |
def existingDirectory(string):
"""
A custom type for the argparse commandline parser.
Check whether the supplied string points to a valid directory.
Examples
--------
>>> parser.add_argument('argname', type=existingDirectory, help='help')
"""
if not os.path.isdir(string):
... |
def __sequenceAscendingStrict(l):
"Test a sequences values to be in strictly ascending order."
it = iter(l)
next(it)
if not all(b > a for a, b in zip(l, it)):
raise argparse.ArgumentTypeError('All values must be given in strictly ascending order.')
return l |
def train(self, images):
r"""
Train a standard intensity space and an associated transformation model.
Note that the passed images should be masked to contain only the foreground.
Parameters
----------
images : sequence of array_likes
A numbe... |
def transform(self, image, surpress_mapping_check = False):
r"""
Transform an images intensity values to the learned standard intensity space.
Note that the passed image should be masked to contain only the foreground.
The transformation is guaranteed to be lossless i.e... |
def train_transform(self, images, surpress_mapping_check = False):
r"""
See also
--------
train, transform
"""
ret = self.train(images)
outputs = [self.transform(i, surpress_mapping_check) for i in images]
return ret, outputs |
def __compute_stdrange(self, images):
r"""
Computes a common standard intensity range over a number of images.
Depending on the settings of the internal self.__stdrange variable,
either (1) the already fixed values are returned, (2) a complete standard
intensity range is... |
def __check_mapping(self, landmarks):
"""
Checks whether the image, from which the supplied landmarks were extracted, can
be transformed to the learned standard intensity space without loss of
information.
"""
sc_udiff = numpy.asarray(self.__sc_umaxs)[1:] - numpy.asarray(... |
def is_in_interval(n, l, r, border = 'included'):
"""
Checks whether a number is inside the interval l, r.
"""
if 'included' == border:
return (n >= l) and (n <= r)
elif 'excluded' == border:
return (n > l) and (n < r)
else:
raise Value... |
def are_in_interval(s, l, r, border = 'included'):
"""
Checks whether all number in the sequence s lie inside the interval formed by
l and r.
"""
return numpy.all([IntensityRangeStandardization.is_in_interval(x, l, r, border) for x in s]) |
def linear_model(x, y):
"""
Returns a linear model transformation function fitted on the two supplied points.
y = m*x + b
Note: Assumes that slope > 0, otherwise division through zero might occur.
"""
x1, x2 = x
y1, y2 = y
m = (y2 - y1) / (x2 - x1)
... |
def ght_alternative (img, template, indices):
"""
Alternative implementation of the general hough transform, which uses iteration over
indices rather than broadcasting rules like `ght`.
It is therefore considerably slower, especially for large, multi-dimensional arrays.
The only application are... |
def ght(img, template):
r"""
Implementation of the general hough transform for all dimensions.
Providing a template, this method searches in the image for structures similar to the
one depicted by the template. The returned hough image denotes how well the structure
fit in each index.
... |
def template_sphere (radius, dimensions):
r"""
Returns a spherical binary structure of a of the supplied radius that can be used as
template input to the generalized hough transform.
Parameters
----------
radius : integer
The circles radius in voxels.
dimensions : integer
Th... |
def template_ellipsoid(shape):
r"""
Returns an ellipsoid binary structure of a of the supplied radius that can be used as
template input to the generalized hough transform.
Parameters
----------
shape : tuple of integers
The main axes of the ellipsoid in voxel units.
Return... |
def graph_to_dimacs(g, f):
"""
Persists the supplied graph in valid dimacs format into the file.
Parameters
----------
g : `~medpy.graphcut.graph.Graph`
A graph object to persist.
f : file
A file-like object.
"""
# write comments
f.write('c Created by medpy\n')
... |
def looks_like_issubclass(obj, classname):
""" Return True if the object has a class or superclass with the given class
name.
Ignores old-style classes.
"""
t = obj
if t.__name__ == classname:
return True
for klass in t.__mro__:
if klass.__name__ == classname:
re... |
def mkneighbors_graph(observations, n_neighbours, metric, mode='connectivity', metric_params = None):
"""
Computes the (weighted) graph of mutual k-Neighbors for observations.
Notes
-----
The distance between an observation and itself is never computed and instead set to
``numpy.inf``. I.e.... |
def pdist(objects, dmeasure, diagval = numpy.inf):
"""
Compute the pair-wise distances between arbitrary objects.
Notes
-----
``dmeasure`` is assumed to be *symmetry* i.e. between object *a* and object *b* the
function will be called only ones.
Parameters
----------
objects... |
def setHandler(self, hdlr):
r"""Replace the current handler with a new one.
Parameters
----------
hdlr : logging.Handler
A subclass of Handler that should used to handle the logging output.
Notes
-----
If none should be replaces, but... |
def setLevel(self, level):
r"""Overrides the parent method to adapt the formatting string to the level.
Parameters
----------
level : int
The new log level to set. See the logging levels in the logging module for details.
Examples
-------... |
def xminus1d(img, fun, dim, *args, **kwargs):
r"""
Applies the function fun along all X-1D dimensional volumes of the images img
dimension dim.
E.g. you want to apply a gauss filter to each slice of a 3D MRI brain image,
simply supply the function as fun, the image as img and the dimension alon... |
def pad(input, size=None, footprint=None, output=None, mode="reflect", cval=0.0):
r"""
Returns a copy of the input, padded by the supplied structuring element.
In the case of odd dimensionality, the structure element will be centered as
following on the currently processed position::
[... |
def intersection(i1, h1, i2, h2):
r"""
Returns the intersecting parts of two images in real world coordinates.
Takes both, voxelspacing and image offset into account.
Note that the returned new offset might be inaccurate up to 1/2 voxel size for
each dimension due to ave... |
def __make_footprint(input, size, footprint):
"Creates a standard footprint element ala scipy.ndimage."
if footprint is None:
if size is None:
raise RuntimeError("no footprint or filter size provided")
sizes = _ni_support._normalize_sequence(size, input.ndim)
footprint = nump... |
def boundary_difference_of_means(graph, label_image, original_image): # label image is not required to hold continuous ids or to start from 1
r"""
Boundary term based on the difference of means between adjacent image regions.
An implementation of the boundary term, suitable to be used with the `~medpy.... |
def boundary_stawiaski(graph, label_image, gradient_image): # label image is not required to hold continuous ids or to start from 1
r"""
Boundary term based on the sum of border voxel pairs differences.
An implementation of the boundary term in [1]_, suitable to be used with the `~medpy.graphcut.gener... |
def boundary_stawiaski_directed(graph, label_image, xxx_todo_changeme): # label image is not required to hold continuous ids or to start from 1
r"""
Boundary term based on the sum of border voxel pairs differences, directed version.
An implementation of the boundary term in [1]_, suitable to be used wi... |
def regional_atlas(graph, label_image, xxx_todo_changeme1): # label image is required to hold continuous ids starting from 1
r"""
Regional term based on a probability atlas.
An implementation of a regional term, suitable to be used with the
`~medpy.graphcut.generate.graph_from_labels` function.
... |
def __compute_edges_nd(label_image):
"""
Computes the region neighbourhood defined by a star shaped n-dimensional structuring
element (as returned by scipy.ndimage.generate_binary_structure(ndim, 1)) for the
supplied region/label image.
Note The returned set contains neither duplicates, nor self-ref... |
def __check_label_image(label_image):
"""Check the label image for consistent labelling starting from 1."""
encountered_indices = scipy.unique(label_image)
expected_indices = scipy.arange(1, label_image.max() + 1)
if not encountered_indices.size == expected_indices.size or \
not (encountered_indi... |
def getParser():
"Creates and returns the argparse parser object."
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,
description=__description__)
parser.add_argument('output', help='Target volume.')
parser.add_argument('inputs', n... |
def _str_member_list(self, name):
"""
Generate a member listing, autosummary:: table where possible,
and a table where not.
"""
out = []
if self[name]:
out += ['.. rubric:: %s' % name, '']
prefix = getattr(self, '_name', '')
if prefix... |
def relabel_map(label_image, mapping, key=lambda x, y: x[y]):
r"""
Relabel an image using the supplied mapping.
The ``mapping`` can be any kind of subscriptable object. The respective region id is used
to access the new value from the ``mapping``. The ``key`` keyword parameter can be used to
su... |
def relabel(label_image, start = 1):
r"""
Relabel the regions of a label image.
Re-processes the labels to make them consecutively and starting from start.
Parameters
----------
label_image : array_like
A nD label map.
start : integer
The id of the first label to assign
... |
def relabel_non_zero(label_image, start = 1):
r"""
Relabel the regions of a label image.
Re-processes the labels to make them consecutively and starting from start.
Keeps all zero (0) labels, as they are considered background.
Parameters
----------
label_image : array_like
A nD... |
def fit_labels_to_mask(label_image, mask):
r"""
Reduces a label images by overlaying it with a binary mask and assign the labels
either to the mask or to the background. The resulting binary mask is the nearest
expression the label image can form of the supplied binary mask.
Parameters
----... |
def __xd_iterator_pass_on(arr, view, fun):
"""
Like xd_iterator, but the fun return values are always passed on to the next and only the last returned.
"""
# create list of iterations
iterations = [[None] if dim in view else list(range(arr.shape[dim])) for dim in range(arr.ndim)]
# iterate... |
def __extract_bbox(arr, bb_old):
"Extracts the bounding box of an binary objects hole (assuming only one in existence)."
hole = ndimage.binary_fill_holes(arr)- arr
bb_list = ndimage.find_objects(ndimage.binary_dilation(hole, iterations = 1))
if 0 == len(bb_list): return bb_old
else: bb = bb_list[0]
... |
def load(image):
r"""
Loads the ``image`` and returns a ndarray with the image's pixel content as well as
a header object.
The header can, with restrictions, be used to extract additional meta-information
about the image (e.g. using the methods in `~medpy.io.Header`). Additionally
it serves... |
def set_source_nodes(self, source_nodes):
r"""
Set the source nodes and compute their t-weights.
Parameters
----------
source_nodes : sequence of integers
Declare the source nodes via their ids.
Notes
-----
It does not get che... |
def set_sink_nodes(self, sink_nodes):
r"""
Set the sink nodes and compute their t-weights.
Parameters
----------
sink_nodes : sequence of integers
Declare the sink nodes via their ids.
Notes
-----
It does not get checked if on... |
def inconsistent(self):
r"""
Perform some consistency tests on the graph represented by this object
Returns
-------
consistent : bool or list
False if consistent, else a list of inconsistency messages.
Notes
-----
This check i... |
def set_source_nodes(self, source_nodes):
r"""
Set multiple source nodes and compute their t-weights.
Parameters
----------
source_nodes : sequence of integers
Declare the source nodes via their ids.
Raises
------
ValueError
... |
def set_sink_nodes(self, sink_nodes):
r"""
Set multiple sink nodes and compute their t-weights.
Parameters
----------
sink_nodes : sequence of integers
Declare the sink nodes via their ids.
Raises
------
ValueError
... |
def set_nweight(self, node_from, node_to, weight_there, weight_back):
r"""
Set a single n-weight / edge-weight.
Parameters
----------
node_from : int
Node-id from the first node of the edge.
node_to : int
Node-id from the second node of th... |
def set_nweights(self, nweights):
r"""
Set multiple n-weights / edge-weights.
Parameters
----------
nweights : dict
A dictionary with (node-id, node-id) tuples as keys and (weight-a-to-b, weight-b-to-a) as values.
Notes
-----
... |
def set_tweight(self, node, weight_source, weight_sink):
r"""
Set a single t-weight / terminal-weight.
Parameters
----------
node : int
Node-id for which to set the terminal weights.
weight_source : float
Weight to source terminal.
... |
def set_tweights(self, tweights):
r"""
Set multiple t-weights to the current collection of t-weights, overwriting
already existing ones.
Parameters
----------
tweights : dict
A dictionary with node_ids as keys and (weight-to-source, weight-to-sink) tu... |
def set_tweights_all(self, tweights):
r"""
Set all t-weights at once.
Parameters
----------
tweights : iterable
Containing a pair of numeric values for each of the graphs nodes.
Notes
-----
Since this method overrides already ... |
def getArguments(parser):
"Provides additional validation of the arguments collected by argparse."
args = parser.parse_args()
if args.width <= 0:
raise argparse.ArgumentError(args.width, 'The contour width must be a positive number.')
return args |
def set_pixel_spacing(hdr, spacing):
r"""Depreciated synonym of `~medpy.io.header.set_voxel_spacing`."""
warnings.warn('get_pixel_spacing() is depreciated, use set_voxel_spacing() instead', category=DeprecationWarning)
set_voxel_spacing(hdr, spacing) |
def copy_meta_data(hdr_to, hdr_from):
r"""
Copy image meta data (voxel spacing and offset) from one header to another.
Parameters
----------
hdr_to : object
An image header as returned by `load`.
hdr_from : object
An image header as returned by `load`.
"""
warnings.w... |
def copy_to(self, sitkimage):
"""
Copy all stored meta information info to an sitk Image.
Note that only the spacing and the offset/origin information
are guaranteed to be preserved, although the method also
tries to copy other meta information such as DICOM tags.
Param... |
def get_info_consistent(self, ndim):
"""
Returns the main meta-data information adapted to the supplied
image dimensionality.
It will try to resolve inconsistencies and other conflicts,
altering the information avilable int he most plausible way.
Parameters
----... |
def dc(result, reference):
r"""
Dice coefficient
Computes the Dice coefficient (also known as Sorensen index) between the binary
objects in two images.
The metric is defined as
.. math::
DC=\frac{2|A\cap B|}{|A|+|B|}
, where :math:`A` is the first and... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.