mdt.visualization package¶
Subpackages¶
Submodules¶
mdt.visualization.dict_conversion module¶
-
class
mdt.visualization.dict_conversion.
BooleanConversion
(allow_null=True)[source]¶ Bases:
mdt.visualization.dict_conversion.SimpleFunctionConversion
-
class
mdt.visualization.dict_conversion.
ConversionSpecification
[source]¶ Bases:
object
Specifies how the content of an object is to be converted from and to a dictionary.
-
class
mdt.visualization.dict_conversion.
ConvertDictElements
(conversion_type)[source]¶ Bases:
mdt.visualization.dict_conversion.ConversionSpecification
Converts all the elements in the value (a dictionary) using the given conversion type.
-
class
mdt.visualization.dict_conversion.
ConvertDynamicFromModule
(module)[source]¶ Bases:
mdt.visualization.dict_conversion.ConversionSpecification
Performs dynamic lookup by loading the class from the given module.
This requires that the class we are dynamically loading has a get_conversion_info() class method that returns the conversion specification for that class.
Parameters: module (module) – the python module to use for loading the data from dict
-
class
mdt.visualization.dict_conversion.
ConvertListElements
(conversion_type)[source]¶ Bases:
mdt.visualization.dict_conversion.ConversionSpecification
Converts all the elements in the value (a list) using the given conversion type.
-
class
mdt.visualization.dict_conversion.
FloatConversion
(allow_null=True)[source]¶ Bases:
mdt.visualization.dict_conversion.SimpleFunctionConversion
-
class
mdt.visualization.dict_conversion.
IntConversion
(allow_null=True)[source]¶ Bases:
mdt.visualization.dict_conversion.SimpleFunctionConversion
-
class
mdt.visualization.dict_conversion.
OptionalConversionDecorator
(conversion_specification)[source]¶ Bases:
mdt.visualization.dict_conversion.ConversionSpecification
Makes the conversion optional by testing against None.
If the element to convert is None, we will return None as a conversion. If the element to convert is not None we will convert it according to the conversion specified.
This holds for both to- and from- dict.
Parameters: conversion_specification (ConversionSpecification) – the conversion specification to use if the element to convert is not None.
-
class
mdt.visualization.dict_conversion.
SimpleClassConversion
(class_type, attribute_conversions)[source]¶ Bases:
mdt.visualization.dict_conversion.ConversionSpecification
Converts a dictionary to and from the specified class.
Parameters: - class_type (type) – the type of class to convert to
- attribute_conversions (List[ConversionSpecification]) – attributes
-
class
mdt.visualization.dict_conversion.
SimpleDictConversion
(conversion_func=None, allow_null=True, set_null_to_value=None)[source]¶ Bases:
mdt.visualization.dict_conversion.SimpleFunctionConversion
Converts all the objects in the given dict.
Parameters: - conversion_func (Func) – if not None we cast the from_dict value to the given type
- allow_null (bool) – if True we allow None during type casting
- set_null_to_value (obj) – the value to set null entries to. If this is None and allow_null is False we raise an error.
-
class
mdt.visualization.dict_conversion.
SimpleFunctionConversion
(conversion_func=None, allow_null=True, set_null_to_value=None)[source]¶ Bases:
mdt.visualization.dict_conversion.ConversionSpecification
Performs identity conversion between simple types.
Parameters: - conversion_func (Func) – if not None we apply the given function before converting to and from the
dictionary. Can also be a type like
int
. - allow_null (bool) – if True we allow None during type casting
- set_null_to_value (obj) – the value to set null entries to. If this is None and allow_null is False we raise an error.
- conversion_func (Func) – if not None we apply the given function before converting to and from the
dictionary. Can also be a type like
-
class
mdt.visualization.dict_conversion.
SimpleListConversion
(conversion_func=None, allow_null=True, set_null_to_value=None)[source]¶ Bases:
mdt.visualization.dict_conversion.SimpleFunctionConversion
Converts all the objects in the given list.
Parameters: - conversion_func (Func) – if not None we cast the from_dict value to the given type
- allow_null (bool) – if True we allow None during type casting
- set_null_to_value (obj) – the value to set null entries to. If this is None and allow_null is False we raise an error.
-
class
mdt.visualization.dict_conversion.
StringConversion
(allow_null=True)[source]¶ Bases:
mdt.visualization.dict_conversion.SimpleFunctionConversion
-
class
mdt.visualization.dict_conversion.
WhiteListConversion
(white_list, default)[source]¶ Bases:
mdt.visualization.dict_conversion.ConversionSpecification
Allow only elements from the given white list. If the element is not one of them, revert to the default.
Parameters: - white_list (list of object) – list of allowable objects
- default – the default fallback object
mdt.visualization.layouts module¶
-
class
mdt.visualization.layouts.
AutoGridLayout
(spacings=None)[source]¶
-
class
mdt.visualization.layouts.
GridLayout
(spacings=None)[source]¶ Bases:
object
-
class
mdt.visualization.layouts.
GridLayoutSpecifier
(gridspec, figure, positions=None)[source]¶ Bases:
object
Create a grid layout specifier using the given gridspec and the given figure.
Parameters: - gridspec (GridSpec) – the gridspec to use
- figure (Figure) – the figure to generate subplots for
- positions (
list
) – if given, a list with grid spec indices for every requested axis can be logical indices or (x, y) coordinate indices (choose one and stick with it).
-
class
mdt.visualization.layouts.
LowerTriangular
(padding=0, spacings=None)[source]¶ Bases:
mdt.visualization.layouts.GridLayout
Create a lower triangular plot layout.
Parameters: - padding (int) –
normally we will construct the lower triangle from the top, like:
* * * * * *
If padding is enabled, we will pad as many images from the top as specified. For example, a padding of 1, with 5 images yields:
* * * * *
Or a padding of 2 with 4 images:
* * * *
- spacings (dict) – the spacings around each plot
- padding (int) –
-
class
mdt.visualization.layouts.
Rectangular
(rows=None, cols=None, spacings=None)[source]¶
-
class
mdt.visualization.layouts.
SingleColumn
(spacings=None)[source]¶
-
class
mdt.visualization.layouts.
SingleRow
(spacings=None)[source]¶
mdt.visualization.samples module¶
-
class
mdt.visualization.samples.
SampleVisualizer
(voxels)[source]¶ Bases:
object
-
show
(voxel_ind=0, names=None, maps_to_show=None, to_file=None, block=True, maximize=False, show_trace=True, nmr_bins=20, window_title=None, show_sliders=True, fit_gaussian=True, figure_options=None, sample_indices=None)[source]¶ Show the samples per voxel.
Parameters: - voxel_ind (int) – the voxel to show the samples from.
- names (dict) – A list of names for the different maps. Use as
{map_name: display_name}
that is, the key is the name of the map in the volumes dictionary and the display name is the string that will be used as title for that map. - maps_to_show (
list
) – A list of maps to show. The items in this list must correspond to the keys in the volumes dictionary. - to_file (string, optional, default None) – If to_file is not None it is supposed to be a filename where the image will be saved. If not set to None, nothing will be displayed, the results will directly be saved. Already existing items will be overwritten.
- block (boolean) – If we want to block after calling the plots or not. Set this to False if you do not want the routine to block after drawing. In doing so you manually need to block.
- maximize (boolean) – if we want to display the window maximized or not
- show_trace (boolean) – if we show the trace of each map or not
- nmr_bins (dict or int) – either a single value or one per map name
- show_sliders (boolean) – if we show the slider or not
- fit_gaussian (boolean) – if we fit and show a normal distribution (Gaussian) to the histogram or not
- window_title (str) – the title of the window. If None, the default title is used
- figure_options (dict) –
- sample_indices (list) – the list of sample indices to use
-