autooptions.napari_util module
- class autooptions.napari_util.NapariUtil(viewer)[source]
Bases:
objectUtility methods for the napari image viewer.
- static copyOriginalPath(srcLayer, destLayer)[source]
Copy the orignal path from one layer to another. This should be used by operations that create images derived from an input image.
- Parameters:
srcLayer – The layer from which the original path is copied.
destLayer – The layer to which the original path is copied.
- getDataAndScaleOfLayerWithName(name)[source]
Answer the data, the scale and the unit of the layer with the given name.
- Parameters:
name – The name of a layer
- Returns:
A tupel with the data, the scale and the unit of the layer with the given name. The unit is the unit of the first dimension. The unit is supposed to be the same for all dimensions.
- getDataOfLayerWithName(name)[source]
Return the data of the layer with the given name.
- Parameters:
name (str) – The name of the layer
- Returns:
The layer with the given name if it exists and None otherwise
- getFFTLayers()[source]
Return all fft layers
- Returns:
A list of the fft layers in the viewer
- Return type:
[napari.layers.image.Image.Image]
- getImageLayers()[source]
Return all image layers
- Returns:
A list of the image layers in the viewer
- Return type:
[napari.layers.image.Image.Image]
- getLabelLayers()[source]
Return all label layers
- Returns:
A list of the label layers in the viewer
- Return type:
[napari.layers.labels.labels.Labels]
- getLayerWithName(name)[source]
Answer the layer with the given name, if it exists and None otherwise.
- Parameters:
name – The name of a layer
- Returns:
The layer from napari’s layer list that has the given name
- getLayersOfType(layerType)[source]
Return all layers of type layerType in the viewer
- Parameters:
layerType – A napari layer type like Labels or Points.
- Returns:
A list of the layers with the given type
- static getOriginalPath(layer)[source]
Answer the source path of the layer if it represents an image opened from the filesystem and the original path from the metadata if it is a derived image. If it is neither an image opened from a file nor derived from one (for example an image programmatically created) answer None. For the metadata information to be present, the image operations must set it.
- Parameters:
layer – The input layer
- Returns:
The path of the image in the filesystem if it is known