Microscopy Image Browser  1.233
All Classes Files Functions Variables Pages
imageData Class Reference

class is resposnible to keep and visualize datasets More...

Inheritance diagram for imageData:
Collaboration diagram for imageData:

Public Member Functions

function
handles = 
addColorChannel (img, handles, channelId, lutColors)
 Add a new color channel to the existing dataset. More...
 
function  clearContents (handles)
 Set all elements of the class to default values. More...
 
function  clearMask (height, width, z, t)
 Clear the Mask layer. It is also possible to specify the area where the Mask layer should be cleared. More...
 
function [
handles , status ] = 
convertImage (format, handles)
 Convert image to specified format: grayscale, truecolor, indexed and uint8, uint16, uint32 class. More...
 
function [ x ,
y ,
z ,
t ] = 
convertMouseToDataCoordinates (x, y, mode, permuteSw)
 Convert coordinates under the mouse cursor to the coordinates of the dataset. More...
 
function [ x ,
y ] = 
convertDataToMouseCoordinates (x, y, mode, magFactor)
 Convert coordinates of a pixel in the dataset to the coordinates of the imageView axes. More...
 
function  convertModel (type)
 Convert model from uint6 to uint8 and other way around. More...
 
function  copyColorChannel (channel1, channel2)
 Copy intensity from the first color channel (channel1) to the position of the second color channel (channel2). More...
 
function  createModel (model_type)
 Create an empty model: allocate memory for a new model. More...
 
function  cropDataset (cropF)
 Crop image and all corresponding layers of the opened dataset. More...
 
function  deleteColorChannel (channel1)
 Delete specified color channel from the dataset. More...
 
function result = deleteSlice (sliceNumber, orient)
 Delete specified slice from the dataset. More...
 
function bb = getBoundingBox ()
 Get Bounding box info as a vector [xmin, width, ymin, height, zmin, thickness]. More...
 
function slice = getCurrentSlice (type, countour_id)
 Get currently shown slice. More...
 
function
slice_no = 
getCurrentSliceNumber ()
 Get slice number of the currently shown image. More...
 
function
timePnt = 
getCurrentTimePoint ()
 Get time point of the currently shown image. More...
 
function slice = getData2D (type, slice_no, orient, col_channel, custom_img, options)
 Get the 3D slice: height:width:colors. More...
 
function
dataset = 
getData3D (type, time, orient, col_channel, options, custom_img)
 Get the 4D dataset: height:width:colors:depth. More...
 
function
dataset = 
getData4D (type, orient, col_channel, options, custom_img)
 Get complete 4D dataset. More...
 
function
dataset = 
getDataset (type, permuteSw, col_channel, options)
 Get 4D dataset, [height, width, color, depth], LEGACY function, please use imageData.getData3D instead! More...
 
function imgRGB = getRGBimage (handles, options, sImgIn)
 Generate RGB image from all layers that have to be shown on the screen. More...
 
function  invertColorChannel (channel1)
 Invert color channel of the dataset. More...
 
function  generateModelColors ()
 Generate list of colors for materials of a model. More...
 
function [ height ,
width ,
color ,
thick ,
time ] = 
getDatasetDimensions (type, orient, color, options)
 Get dimensions of the dataset. More...
 
function slice = getFullSlice (type, slice_no, orient, col_channel, custom_img, options)
 Get the whole, uncropped 3D slice. More...
 
function [
totalSize , imSize ] = 
getDatasetSizeInBytes ()
 Get size of the loaded dataset in bytes. More...
 
function
modelMaterialNames
getMaterialNames ()
 Get names of materials of the model. More...
 
function imgOut = getRoiCrop (type, handles, roiNo, options, col_channel)
 Get a 3D dataset from the defined ROI regions. More...
 
function imgOut = getRoiCropSlice (type, handles, roiNo, sliceNo, orient, options, col_channel)
 Get a 2D slice of the ROI regions only. More...
 
function [ yMin ,
yMax ,
xMin ,
xMax ] = 
getCoordinatesOfShownImage ()
 Return minimal and maximal coordinates (XY) of the image that is currently shown. More...
 
function slice = getSlice (type, slice_no, orient, col_channel, custom_img, options)
 Get the 2D slice. More...
 
function slice = getSliceToShow (type, slice_no, orient, col_channel, custom_img, options)
 Get a part of the 3D slice that fits into the viewing window of the handles.imageAxes, Note! the image will be cropped. More...
 
function  insertEmptyColorChannel (channel1)
 Insert an empty color channel to the specified position. More...
 
function
handles = 
insertSlice (img, handles, insertPosition, img_info)
 Insert a slice or a dataset into the existing volume. More...
 
function  mark2selection (layer_id, type, str_type, xy_vec)
 Add a marker/pointer to the selection layer. More...
 
function  moveMaskToSelectionDataset (action_type, options)
 Move the Mask layer to the Selection layer. More...
 
function  moveModelToMaskDataset (action_type, options)
 Move the selected Material to the Mask layer. More...
 
function  moveModelToSelectionDataset (action_type, options)
 Move the selected Material to the Selection layer. More...
 
function  moveSelectionToMaskDataset (action_type, options)
 Move the Selection layer to the Mask layer. More...
 
function  moveSelectionToModelDataset (action_type, options)
 Move selection layer to the model layer. More...
 
function  moveView (x, y, orient)
 Center the image view at the provided coordinates: x, y. More...
 
function
handles = 
plotImage (axes, handles, resize, sImgIn)
 Plot image to the axes. The main drawing function. More...
 
function
handles = 
replaceDataset (img, handles, img_info, modelImg, maskImg, selectionImg)
 Replace existing dataset with a new one. More...
 
function
handles = 
replaceImageColor (handles, type)
 Replace image intensities in the Masked or Selected areas with new intensity value. More...
 
function  resizeImage (new_width, new_height, method)
 Resize all layers using specified method. More...
 
function  rotateColorChannel (channel1)
 Rotate color channel of the dataset. More...
 
function  clearSelection (height, width, z, t)
 Clear the Selection layer. It is also possible to specify the area where the Selection layer should be cleared. More...
 
function  setCurrentSlice (type, slice, color_id)
 Update the currently shown slice of the dataset. More...
 
function result = setData2D (type, slice, slice_no, orient, col_channel, custom_img, options)
 set the 3D slice: height:width:colors to the dataset More...
 
function result = setData3D (type, dataset, time, orient, col_channel, options, custom_img)
 Set the 4D dataset (height:width:colors:depth) into the 5D dataset. More...
 
function result = setData4D (type, dataset, orient, col_channel, options)
 result = setData4D(obj, type, dataset, orient, col_channel, options) Set complete 5D dataset More...
 
function result = setDataset (type, dataset, permuteSw, col_channel, options)
 Update complete 4D dataset, LEGACY function, please use imageData.setData3D instead! More...
 
function
custom_img = 
setFullSlice (type, slice, slice_no, orient, col_channel, custom_img, options)
 Update the full 2D slice of the dataset. More...
 
function
handles = 
setMaterialNames (modelMaterialNames, handles)
 Set names for materials of the model. More...
 
function  setRoiCrop (type, imgIn, handles, roiNo, options, col_channel)
 Update a full 3D dataset from the defined ROI regions. More...
 
function  setRoiCropSlice (type, imgIn, handles, roiNo, sliceNo, orient, options, col_channel)
 Update a 2D slice of the ROI regions of the dataset. More...
 
function
custom_img = 
setSlice (type, slice, slice_no, orient, col_channel, custom_img, options)
 Update the 2D slice of the dataset. More...
 
function
custom_img = 
setSliceToShow (type, slice, slice_no, orient, col_channel, custom_img, options)
 Update the croped to the viewing window 2D slice of the dataset. More...
 
function  swapColorChannels (channel1, channel2)
 Swap two color channels of the dataset. More...
 
function  transpose (new_orient)
 Change orientation of the image to the XY, XZ, or YZ plane. More...
 
function
handles = 
updateAxesLimits (handles, mode, newMagFactor)
 Updates the imageData.axesX and imageData.axesY during fit screen, resize, or new dataset drawing. More...
 
function  updateBoundingBox (newBB, xyzShift, imgDims)
 Update the bounding box info of the dataset. More...
 
function  updateDisplayParameters ()
 Update display parameters for visualization. More...
 
function  updateImgInfo (addText, action, entryIndex)
 Update action log. More...
 
function result = updateParameters (pixSize)
 Update imageData.pixelSize, imageData.img_info('XResolution') and imageData.img_info('XResolution') More...
 
 imageData (handles, model_type, img)
 Constructor for the imageData class. More...
 

Public Attributes

 axesX
 a vector [min, max] with minimal and maximal coordinates of the axes X of the imageAxes axes More...
 
 axesY
 a vector [min max] with minimal and maximal coordinates of the axes Y of the imageAxes axes More...
 
 blockModeSwitch
 defines whether to get the whole dataset or only the shown part of it, either 0 or 1 More...
 
 brush_prev_xy
 coordinates of the previous pixel for the Brush tool, More...
 
 brush_selection
 selection layer during the brush tool movement, More...
 
 colors
 number of color channels More...
 
 current_yxz
 a vector to remember last selected slice number of each yx, zx, zy planes, More...
 
 height
 image height, px More...
 
 hLabels
 a handle to class to keep labels More...
 
 hMeasure
 a handle to class to keep measurements More...
 
 hROI
 handle to ROI class, roiImage More...
 
 img
 a property to keep the Image layer. More...
 
 img_info
 information about the dataset, an instance of the containers.Map class Default keys: More...
 
 imh
 handle for the currently shown image More...
 
 Ishown
 a property to keep the currently displayed image in RGB format More...
 
 lutColors
 a matrix with LUT colors [1:colorChannel, R G B], (0-1) More...
 
 magFactor
 magnification factor for the currently shown image, 1=100%, 1.5 = 150% More...
 
 maskExist
 a switch to indicate presense of the Mask layer. Can be 0 (no model) or 1 (model exist) More...
 
 maskImg
 a property to keep the Mask layer More...
 
 maskImgFilename
 file name of the Mask layer image More...
 
 maskStat
 Statistics for the Mask layer with the PixelList info returned by regionprops Matlab function. More...
 
 model
 model is a property to keep the Model layer More...
 
 model_fn
 model_fn is a property to keep filename of the Model layer More...
 
 model_type
 The type of a model. More...
 
 model_var
 model_var is a variable name in the mat-file to keep the Model layer More...
 
 model_diff_max
 maximal absolute value in the image model of the diff_map type More...
 
 modelMaterialColors
 a matrix of colors [0-1] for materials of the Model, [materialIndex, R G B] More...
 
 modelMaterialNames
 an array of strings to define names of materials of the Model More...
 
 modelExist
 a switch to indicate presense of the Model layer. Can be 0 (no model) or 1 (model exist) More...
 
 no_stacks
 number of stacks in the dataset More...
 
 orientation
 Orientation of the currently shown dataset,. More...
 
 pixSize
 a structure with diminsions of voxels, More...
 
 selection
 a property to keep the Selection layer More...
 
 slices
 coordinates of the shown slice borders More...
 
 storedSelection
 a buffer to store selection with press of Ctrl+C button, and restore with Ctrl+V More...
 
 time
 number of time points in the dataset More...
 
 trackerYXZ
 starting point for the Membrane Click-tracer tool More...
 
 viewPort
 a structure More...
 
 volren
 a structure with parameters for the volume rendering the fields are More...
 
 width
 image width, px More...
 
EVENT none
 

Description of events

when selected two or more curves More...

 

Detailed Description

class is resposnible to keep and visualize datasets

Constructor & Destructor Documentation

imageData.imageData (   handles,
  model_type,
  img 
)

Constructor for the imageData class.

Create a new instance of the class with default parameters.

Parameters
handles- [optional] handles structure of im_browser model_type - [optional], parameter to setup the model type img - [optional], image to use to initialize imageData class
Required fields of handles:

References model_type.

Member Function Documentation

function handles = imageData.addColorChannel (   img,
  handles,
  channelId,
  lutColors 
)

Add a new color channel to the existing dataset.

Parameters
imgnew 2D/3D image stack to add
handleshandles structure from im_browser
channelId[optional] number (single!) of the channel to add, if NaN a new color channel is created
lutColors[optional] a matrix (channelNumber, R G B) for the colors. The colors should be in range between 0 and 1
Return values
handleshandles structure from im_browser

Example:

handles = imageData.addColorChannel(img, handles, channelId); // replace the color channel (channelId) with new img
handles = addColorChannel(obj, img); // Call within the class; add img as a new color channel

References img, and lutColors.

function imageData.clearContents (   img)

Set all elements of the class to default values.

Parameters
img- [optional], image to use to initialize imageData class

Examples:

clearContents(obj); // Call within the class

References img, and makeViewMatrix().

Here is the call graph for this function:

function imageData.clearMask (   height,
  width,
  z,
  t 
)

Clear the Mask layer. It is also possible to specify the area where the Mask layer should be cleared.

Parameters
height[optional] vector of heights, for example [1:imageData.height] or 0 - to initialize space for the new Mask
width[optional] vector of width, for example [1:imageData.width]
z[optional] vector of z-values, for example [1:imageData.no_stacks]
t[optional] vector of t-values, for example [1:imageData.time]

Examples:

imageData.clearMask(); // clear the mask layer
clearMask(obj); // Call within the class; clear the mask layer
function imageData.clearSelection (   height,
  width,
  z,
  t 
)

Clear the Selection layer. It is also possible to specify the area where the Selection layer should be cleared.

Parameters
height[optional], can be NaN, a vector of heights(for example [1:imageData.height]) or a string with the mode (2D, 3D, 4D)
width[optional], can be NaN, a vector of width, for example [1:imageData.width]
z[optional] a vector of z-values, for example [1:imageData.no_stacks]
t[optional] a vector of t-values, for example [1:imageData.time]

Examples:

imageData.clearSelection(); // Clear the Selection layer completely
imageData.clearSelection(1:imageData.height, 1:imageData.width, 1:3); // Clear the Selection layer only in 3 first slices
clearSelection(obj); // Call within the class to clear the Selection layer completely

References height, img, and width.

function [ xOut , yOut ] = imageData.convertDataToMouseCoordinates (   x,
  y,
  mode,
  magFactor 
)

Convert coordinates of a pixel in the dataset to the coordinates of the imageView axes.

Parameters
xx - coordinate
yy - coordinate
modea string that defines a mode of the shown image: shown (in most cases), or full (for panning)
magFactor[optional], used to force magFactor, default obj.magFactor
Return values
xOutx - coordinate with the dataset
yOuty - coordinate with the dataset

Examples:

[xOut,yOut] = imageData.convertDataToMouseCoordinates(x, y); // do conversion'
[xOut,yOut] = convertDataToMouseCoordinates(obj,x, y); // Call within the class; do conversion
function [ handles , status ] = imageData.convertImage (   format,
  handles 
)

Convert image to specified format: grayscale, truecolor, indexed and uint8, uint16, uint32 class.

Parameters
formatdescription of the new image format
  • 'grayscale' - grayscale image, 1 color channel
  • 'truecolor' - truecolor image, 2 or 3 color channels (red, green, blue)
  • 'hsvcolor' - hsv color image, 3 color channels (hue, saturation, value)
  • 'indexed' - indexed colors, the color map is stored in imageData.img_info. Colormap
  • 'uint8' - 8-bit unsinged integer, [0 - 255] levels
  • 'uint16' - 16-bit unsinged integer, [0 - 65535] levels;
  • 'uint32' - 32-bit unsinged integer, [0 - 4294967295] levels; Note! Not Really tested...
handleshandles of im_browser.m
Return values
handleshandles of im_browser.m
status1 -success, 0 -fail
Required fields of handles:

Examples:

handles = imageData.convertImage(handles, 'uint8'); // convert dataset to the uint8 class
[handles, status] = convertImage(obj, handles, 'grayscale'); // Call within the class; convert dataset to the grayscale type

References img, mib_inputdlg(), and updateGuiWidgets().

Here is the call graph for this function:

function imageData.convertModel (   type)

Convert model from uint6 to uint8 and other way around.

Note
The current type is defined with imageData.model_type
Parameters
type[optional] a type of a new model: uint8 or uint6

Examples:

imageData.convertModel('uint8'); // convert model to the uint8 type
convertModel(obj, 'uint8'); // Call within the class; convert model to the uint8 type
function [ xOut , yOut , zOut , tOut ] = imageData.convertMouseToDataCoordinates (   x,
  y,
  mode,
  permuteSw 
)

Convert coordinates under the mouse cursor to the coordinates of the dataset.

Parameters
xx - coordinate
yy - coordinate
mode[optional] a string that defines a mode of the shown image, default is shown
  • shown - the most common one, convert coordinates of the mouse above the image to the coordinates of the dataset
  • full - suppose to do the conversion for the situation when the full image is rendered in the handles.imageAxes, never used...?
  • blockmode - when the blockface mode is switched on the function returns coordinates under the mouse for the Block
permuteSw[optional], can be empty
  • when 0 returns the coordinates for the dataset in the original xy-orientation;
  • when 1 (default) returns coordinates for the dataset so that the currently selected orientation becomes xy
Return values
xOutx - coordinate with the dataset
yOuty - coordinate with the dataset
zOutz - coordinate with the dataset
tOutt - time coordinate

Examples:

[xOut,yOut] = imageData.convertMouseToDataCoordinates(x, y); // do conversion'
[xOut,yOut] = convertMouseToDataCoordinates(obj,x, y); // Call within the class; do conversion
function imageData.copyColorChannel (   channel1,
  channel2 
)

Copy intensity from the first color channel (channel1) to the position of the second color channel (channel2).

The first color channel will be copied to the position of the second color channel

Parameters
channel1[optional] index of the first color channel
channel2[optional] index of the second color channel

Examples:

handles = imageData.copyColorChannel(1, 3); // copy intensities from channel 1 to channel 3
handles = copyColorChannel(obj, 1, 3); // Call within the class; copy intensities from channel 1 to channel 3

References updateImgInfo().

Here is the call graph for this function:

function imageData.createModel (   model_type)

Create an empty model: allocate memory for a new model.

Reinitialize imageData.model variable (NaN when no model present) with an empty matrix [imageData.height, imageData.width, imageData.no_stacks] of the defined type class

Parameters
model_typetype of the model,
  • uint6 - a segmentation model with up to 63 materials; the Model, Mask and Selection layers stored in the same matrix, to decrease memory consumption;
  • uint8 - a segmentation model with up to 255 materials; the Model, Mask and Selection layers stored in separate matrices;
  • int8 - a model layer that has intensities from -128 to 128.%

Examples:

imageData.createModel('uint6'); // allocate space for a new Model layer, type 'uint6'
createModel(obj,'uint6'); // Call within the class; allocate space for a new Model layer, type 'uint6

References model_type.

function imageData.cropDataset (   cropF)

Crop image and all corresponding layers of the opened dataset.

Parameters
cropFa vector [x1, y1, dx, dy, z1, dz, t1, dt] with parameters of the crop. Note! The units are pixels!

Examples:

cropF = [100 512 200 512 5 20]; // define parameters of the crop.
imageData.cropDataset(cropF); // do the crop
cropDataset(obj, cropF); // Call within the class; do the crop
function imageData.deleteColorChannel (   channel1)

Delete specified color channel from the dataset.

Parameters
channel1[optional] the index of color channel to delete.

Examples:

imageData.deleteColorChannel(3); // delete color channel 3 from the obj.img
deleteColorChannel(obj, 1); // Call within the class; delete color channel 1 from the obj.img

References mib_inputdlg(), and updateImgInfo().

Here is the call graph for this function:

function result = imageData.deleteSlice (   sliceNumber,
  orient 
)

Delete specified slice from the dataset.

Parameters
sliceNumberthe number of the slice to delete
orient[optional], can be NaN (in this case removes the currently shown)
  • when 0 (default) remove slice from the current orientation (obj.orientation)
  • when 1 remove slice from the zx configuration: [x,z,c,y,t] -> [y,x,c,z,t]
  • when 2 remove slice from the zy configuration: [y,z,c,y,t] -> [y,x,c,z,t]
  • when 3 not used
  • when 4 remove slice from the yx configuration: [y,x,c,z,t]
  • when 5 remove slice from the t configuration
Return values
resultresult of the function, 0 fail, 1 success

Examples:

imageData.deleteSlice(3); // delete the 3rd slice from the dataset
deleteSlice(obj, 3); // Call within the class; delete the 3rd slice from the dataset
function imageData.generateModelColors ( )

Generate list of colors for materials of a model.

When a new material is added to a model, this function generates a random color for it.

Examples:

imageData.generateModelColors(); // generate colors
generateModelColors(obj); // Call within the class; generate colors
function bb = imageData.getBoundingBox ( )

Get Bounding box info as a vector [xmin, width, ymin, height, zmin, thickness].

The bounding box info is needed to properly put the dataset in the 3D space. It is stored in the header of the Amira mesh file, or in the beginning of the ImageDescription field of the TIF file.

Return values
bb- bounding box info
  • bb(1) = Xmin
  • bb(2) = Width
  • bb(3) = Ymin
  • bb(4) = Height
  • bb(5) = Zmin
  • bb(6) = Thickness

Examples:

bb = imageData.getBoundingBox(); // get bounding box info
bb = getBoundingBox(obj); // Call within the class; get bounding box info
function [ yMin , yMax , xMin , xMax ] = imageData.getCoordinatesOfShownImage ( )

Return minimal and maximal coordinates (XY) of the image that is currently shown.

Return values
yMin- minimal Y coordinate
yMax- maximal Y coordinate
xMin- minimal Y coordinate
xMax- maximal Y coordinate

Examples:

[yMin, yMax, xMin, xMax] = imageData.getCoordinatesOfShownImage(); // get coordinates
[yMin, yMax, xMin, xMax] = getCoordinatesOfShownImage(obj); // Call within the class; get coordinates
function slice = imageData.getCurrentSlice (   type,
  countour_id 
)

Get currently shown slice.

Parameters
typea string with type of the dataset to retrieve, image, model, mask, selection
countour_id- [optional],
  • when type is image, countour_id is a vector with color numbers to take, otherwise will take the colors selected in the imageData.slices{3} variable
  • when type is model countour_id may be NaN - to take all material of the model or an integer to take specific material. In the later case the selected material in slice will have index = 1.
Return values
slice3D image with dimensions [1:height, 1:width, 1:color]

Examples

slice = handles.Img{handles.Id}.I.getCurrentSlice('image'); // take the currently shown image
slice = handles.Img{handles.Id}.I.getCurrentSlice('model', 4); // Get object 4 from the model
slice = obj.getCurrentSlice('image'); // Call within the class
Attention
sensitive to the imageData.blockModeSwitch
not sensitive to the shown ROI
for normal calls it is recommended to use ib_getSlice.m wrapper function, as
slice = ib_getSlice('image', handles)
function slice_no = imageData.getCurrentSliceNumber ( )

Get slice number of the currently shown image.

Return values
slice_noindex of the currently shown slice

Examples:

slice_no = imageData.getCurrentSliceNumber(); // take the currently shown image
slice_no = getCurrentSliceNumber(obj); // Call within the class
function timePnt = imageData.getCurrentTimePoint ( )

Get time point of the currently shown image.

Return values
timePntindex of the currently shown slice

Examples:

timePnt = imageData.getCurrentTimePoint(); // get the time point
timePnt = getCurrentTimePoint(obj); // Call within the class, get the time point
function slice = imageData.getData2D (   type,
  slice_no,
  orient,
  col_channel,
  custom_img,
  options 
)

Get the 3D slice: height:width:colors.

Parameters
typetype of the slice to retrieve, image, model,mask, selection, custom (custom indicates to use custom_img as the dataset), everything(model,mask and selection for imageData.model_type=='uint6' only)
slice_no[optional], an index of the slice to show, when NaN will show the current slice
orient[optional], can be NaN
  • when 0 (default) updates the dataset transposed from the current orientation (obj.orientation)
  • when 1 returns transposed dataset from the zx configuration: [x,z,c,y,t] -> [y,x,c,z,t]
  • when 2 returns transposed dataset from the zy configuration: [y,z,c,y,t] -> [y,x,c,z,t]
  • when 3 not used
  • when 4 returns original dataset from the yx configuration: [y,x,c,z,t]
  • when 5 not used
col_channel[optional], can be NaN
  • when type is image, col_channel is a vector with color numbers to take, when NaN [default] take the colors selected in the imageData.slices{3} variable, when 0 - take all colors of the dataset.
  • when type is model col_channel may be NaN - to take all materials of the model or an integer to take specific material. In the later case the selected material in slice will have index = 1.
custom_img[optional], can be NaN; the function return a slice not from the imageData class but from this custom_img, requires to specify the custom type. custom_img should be a 3D dataset.
options[optional], a structure with extra parameters
  • .blockModeSwitch -> override the imageData.blockModeSwitch (0 - return full dataset, 1 - return only the shown part)
  • .y -> [optional], [ymin, ymax] of the part of the slice to take
  • .x -> [optional], [xmin, xmax] of the part of the slice to take
  • .t -> [optional], [tmin, tmax] indicate the time point to take, when missing return the currently selected time point
Return values
slice3D image. For the image type: [1:height, 1:width, 1:colors]; for all other types: [1:height, 1:width]
Required fields of options:

Examples:

slice = handles.Img{handles.Id}.I.getData2D('image', 5); // get the 5-th slice of the current stack orientation
slice = handles.Img{handles.Id}.I.getData2D('image', 5, 4, 2); // get the 5-th slice of the XY-orientation, color channel=2
slice = handles.Img{handles.Id}.I.getData2D('custom', 5, 1, 2, custom_img); // get the 5-th slice of the YZ-orientation, color channel=2 from the custom_image
slice = obj.getData2D(img, 'image', 5); // Call within the class; get the 5-th slice of the current stack orientation
Attention
sensitive to the
not sensitive to the shown ROI
for normal calls it is recommended to use ib_getSlice.m wrapper function, as
slice = ib_getSlice('image', handles);
function dataset = imageData.getData3D (   type,
  time,
  orient,
  col_channel,
  options,
  custom_img 
)

Get the 4D dataset: height:width:colors:depth.

Parameters
typetype of the slice to retrieve, image, model,mask, selection, custom (custom indicates to use custom_img as the dataset), everything(model,mask and selection for imageData.model_type=='uint6' only)
time[optional], an index of the time point to show, when NaN gets the dataset for the current time point
orient[optional], can be NaN
  • when 0 (default) returns the dataset transposed to the current orientation (obj.orientation)
  • when 1 returns transposed dataset to the zx configuration: [y,x,c,z] -> [x,z,c,y]
  • when 2 returns transposed dataset to the zy configuration: [y,x,c,z] -> [y,z,c,y]
  • when 3 not used
  • when 4 returns original dataset to the yx configuration: [y,x,c,z]
  • when 5 not used
col_channel[optional], can be NaN
  • when type is image, col_channel is a vector with color numbers to take, when NaN [default] take the colors selected in the imageData.slices{3} variable, when 0 - take all colors of the dataset.
  • when type is model col_channel may be NaN - to take all materials of the model or an integer to take specific material. In the later case the selected material in slice will have index = 1.
options[optional], a structure with extra parameters
  • .blockModeSwitch -> override the imageData.blockModeSwitch (0 - return full dataset, 1 - return only the shown part)
  • .y -> [optional], [ymin, ymax] of the part of the dataset to take
  • .x -> [optional], [xmin, xmax] of the part of the dataset to take
  • .z -> [optional], [zmin, zmax] of the part of the dataset to take
custom_img[optional], can be NaN; the function return a slice not from the imageData class but from this custom_img, requires to specify the custom type. custom_img should be a 3D dataset.
Return values
dataset4D image. For the image type: [1:height, 1:width, 1:colors, 1:depth]; for all other types: [1:height, 1:width, 1:depth]

Examples:

dataset = handles.Img{handles.Id}.I.getData3D('image'); // get the 4D dataset for the current time point, in the shown orientation
dataset = handles.Img{handles.Id}.I..getData3D('image', 5, 4, 2); // get the 4D dataset for the 5-th time point in the XY orientation
dataset = handles.Img{handles.Id}.I..getData3D('selection', 5, 1, 2, custom_img); // get the 5-th timepoint in the the XZ-orientation, color channel=2
dataset = obj.getData3D(img, 'image', [], 4); // Call within the class; get the 4D dataset for the current time point in the XY orientation
Attention
sensitive to the
not sensitive to the shown ROI
for normal calls it is recommended to use ib_getDataset.m wrapper function, as
dataset = ib_getDataset('image', handles);
function dataset = imageData.getData4D (   type,
  orient,
  col_channel,
  options,
  custom_img 
)

Get complete 4D dataset.

Parameters
typetype of the dataset to retrieve, image, model,mask, selection, or everything (model,mask and selection for imageData.model_type=='uint6' only)
orient[optional], can be NaN
  • when 0 (default) returns the dataset transposed to the current orientation (obj.orientation)
  • when 1 returns transposed dataset to the zx configuration: [y,x,c,z,t] -> [x,z,c,y,t]
  • when 2 returns transposed dataset to the zy configuration: [y,x,c,z,t] -> [y,z,c,y,t]
  • when 3 not used
  • when 4 returns original dataset to the yx configuration: [y,x,c,z,t]
  • when 5 not used
col_channel[optional],
  • when type is image, col_channel is a vector with color numbers to take, when NaN [default] take the colors selected in the imageData.slices{3} variable, when 0 - take all colors of the dataset.
  • when type is model col_channel may be NaN - to take all materials of the model or an integer to take specific material. In the later case the selected material will have index = 1.
options[optional], a structure with extra parameters
  • .blockModeSwitch -> override the imageData.blockModeSwitch (0 - return full dataset, 1 - return only the shown part)
  • .y -> [optional], [ymin, ymax] coordinates of the dataset to take after transpose, height
  • .x -> [optional], [xmin, xmax] coordinates of the dataset to take after transpose, width
  • .z -> [optional], [zmin, zmax] coordinates of the dataset to take after transpose, depth
  • .t -> [optional], [tmin, tmax] coordinates of the dataset to take after transpose, time
Return values
dataset4D or 5D stack. For the image type: [1:height, 1:width, 1:colors, 1:depth, 1:time]; for all other types: [1:height, 1:width, 1:thickness, 1:time]
Required fields of options:

Examples:

dataset = handles.Img{handles.Id}.I.getData4D('image'); // get the complete dataset in the shown orientation
dataset = handles.Img{handles.Id}.I.getData4D('image', NaN, NaN, options.blockModeSwitch=1); // get the croped to the viewing window dataset, with shown colors
dataset = handles.Img{handles.Id}.I.getData4D('image', 4, 2); // get complete dataset in the XY orientation with only second color channel
dataset = obj.getData4D('image'); // Call within the class, get the complete dataset
Attention
sensitive to the imageData.blockModeSwitch
not sensitive to the shown ROI
for normal calls it is recommended to use ib_getDataset.m wrapper function, as
dataset = ib_getDataset('image', handles);
function dataset = imageData.getDataset (   type,
  orient,
  col_channel,
  options 
)

Get 4D dataset, [height, width, color, depth], LEGACY function, please use imageData.getData3D instead!

Parameters
typetype of the dataset to retrieve, image, model,mask, selection, or everything (model,mask and selection for imageData.model_type=='uint6' only)
orient[optional], can be NaN or empty
  • when 0 (default) returns the dataset transposed to the current orientation (obj.orientation)
  • when 1 returns transposed dataset to the zx configuration: [y,x,c,z] -> [x,z,c,y]
  • when 2 returns transposed dataset to the zy configuration: [y,x,c,z] -> [y,z,c,y]
  • when 3 not used
  • when 4 returns original dataset to the yx configuration: [y,x,c,z]
  • when 5 not used
col_channel[optional],
  • when type is image, col_channel is a vector with color numbers to take, when NaN [default] take the colors selected in the imageData.slices{3} variable, when 0 - take all colors of the dataset.
  • when type is model col_channel may be NaN - to take all materials of the model or an integer to take specific material. In the later case the selected material will have index = 1.
options[optional], a structure with extra parameters
  • .blockModeSwitch -> override the imageData.blockModeSwitch (0 - return full dataset, 1 - return only the shown part)
  • .y -> [optional], [ymin, ymax] of the part of the dataset to take
  • .x -> [optional], [xmin, xmax] of the part of the dataset to take
  • .z -> [optional], [zmin, zmax] of the part of the dataset to take
Return values
dataset4D stack. For the image type: [1:height, 1:width, 1:colors, 1:thickness]; for all other types: [1:height, 1:width, 1:thickness]

Examples:

dataset = handles.Img{handles.Id}.I.getDataset('image'); // get the complete 4D dataset in the shown orientation
dataset = handles.Img{handles.Id}.I.getDataset('image', 0, NaN, options.blockModeSwitch=1); // get the croped to the viewing window dataset, with the shown colors
dataset = handles.Img{handles.Id}.I.getDataset('image', 4, 2); // get transposed to the XY orientation dataset with only second color channel
dataset = obj.getDataset('image'); // Call within the class, get the complete dataset
Attention
sensitive to the imageData.blockModeSwitch
not sensitive to the shown ROI
legacy function, use imageData.getData3D insead!
for normal calls it is recommended to use ib_getDataset.m wrapper function, as
dataset = ib_getDataset('image', handles);

References time.

function [ height , width , color , depth , time ] = imageData.getDatasetDimensions (   type,
  orient,
  color,
  options 
)

Get dimensions of the dataset.

Parameters
typetype of the dataset to retrieve dimensions, image (default), model, mask, selection
orient[optional], can be NaN
  • when 0 (default) returns the dataset transposed to the current orientation (obj.orientation)
  • when 1 returns dimensions of the transposed dataset to the zx configuration: [y,x,c,z,t] -> [x,z,c,y,t]
  • when 2 returns dimensions of the transposed dataset to the zy configuration: [y,x,c,z,t] -> [y,z,c,y,t]
  • when 3 not used
  • when 4 returns dimensions of the original dataset to the yx configuration: [y,x,c,z,t]
  • when 5 not used
color[optional], can be NaN
  • when type is image, color is a vector with color numbers to take, otherwise take the colors selected in the imageData.slices{3} variable
  • when type is model color may be 0 - to take all materials of the model or an integer to take specific material.
options[optional], a structure with extra parameters
Return values
heightheight of the dataset
widthwidth of the dataset
colorvector of colors of the dataset
depthnumber of z-layers of the dataset
timenumber of time points
Required fields of options:

Examples:

[height width color depth] = imageData.getDatasetDimensions('image') // get dimensions of the complete dataset
[height width color depth] = imageData.getDatasetDimensions('image', 1); // get dimensions of the transposed dataset
[height width color depth] = getDatasetDimensions(obj, 'image', NaN, NaN, options.blockModeSwitch=1) // Call within the class; get dimensions of the cropped not transposed, with shown colors dataset
Attention
sensitive to the imageData.blockModeSwitch
not sensitive to the shown ROI

References height, time, and width.

function [ totalSize , imSize ] = imageData.getDatasetSizeInBytes ( )

Get size of the loaded dataset in bytes.

For checking memory requirements when working with some functions (only for windows!). The amounts of physical memory used by Matlab and total memory available on the computer can be obtained with the following code
[userview, systemview] = memory;
systemview.PhysicalMemory.Available // total memory
userview.MemUsedMATLAB // memory used by Matlab
Return values
totalSize- total size of all layers in bytes
imSize- size of the image layer in bytes

Examples:

[totalSize, imSize] = imageData.getDatasetSizeInBytes(); // get both total and matlab memory amounts
[totalSize, imSize] = getDatasetSizeInBytes(obj); // Call within the class; get both total and matlab memory amounts
function slice = imageData.getFullSlice (   type,
  slice_no,
  orient,
  col_channel,
  custom_img,
  options 
)

Get the whole, uncropped 3D slice.

Parameters
typetype of the slice to retrieve, image, model,mask, selection, custom (custom indicates to use custom_img as the dataset), everything(model,mask and selection for imageData.model_type=='uint6' only)
slice_no[optional], an index of the slice to show, when NaN show the current slice
orient[optional], can be NaN
  • when 0 (default) returns the dataset transposed to the current orientation (obj.orientation)
  • when 1 returns transposed dataset to the zx configuration: [y,x,c,z,t] -> [x,z,c,y,t]
  • when 2 returns transposed dataset to the zy configuration: [y,x,c,z,t] -> [y,z,c,y,t]
  • when 3 not used
  • when 4 returns original dataset to the yx configuration: [y,x,c,z,t]
  • when 5 not used
col_channel[optional], can be NaN
  • when type is image, col_channel is a vector with color numbers to take, when NaN [default] take the colors selected in the imageData.slices{3} variable, when 0 - take all colors of the dataset.
  • when type is model col_channel may be NaN - to take all materials of the model or an integer to take specific material. In the later case the selected material in slice will have index = 1.
custom_imgthe function return a slice not from the imageData class but from this custom_img, requires to specify the custom type. custom_img should be a 3D dataset.
options[optional], a structure with extra parameters
  • .y -> [optional], [ymin, ymax] of the part of the slice to take
  • .x -> [optional], [xmin, xmax] of the part of the slice to take
  • .t -> [optional], [tmin, tmax] the time point of the dataset; default is the currently shown time point
Return values
slice2D image. For the image type: [1:height, 1:width, 1:colors]; for all other types: [1:height, 1:width]
Required fields of options:

Examples:

slice = handles.Img{handles.Id}.I.getFullSlice('image', 5); // get the 5-th slice of the current stack orientation
slice = handles.Img{handles.Id}.I.getFullSlice('image', 5, 4, 2); // get the 5-th slice of the XY-orientation, color channel=2
slice = handles.Img{handles.Id}.I.getFullSlice('custom', 5, 1, 2, custom_img); // get the 5-th slice of the YZ-orientation, color channel=2 from the custom_image
slice = obj.getFullSlice('image', 5, NaN, 2); // Call within the class; get the 5-th slice of the current orientation, color channel=2 from the custom_image
Attention
not sensitive to the imageData.blockModeSwitch
not sensitive to the shown ROI
for normal calls it is recommended to use ib_getSlice.m wrapper function, as
slice = ib_getSlice('image', handles, NaN, NaN, NaN, options.blockModeSwitch=0);

References height, and width.

function modelMaterialNames = imageData.getMaterialNames ( )

Get names of materials of the model.

Return values
modelMaterialNamesa cell array with names of materials

Example:

modelMaterialNames = imageData.getMaterialNames(); // get list of materials
modelMaterialNames = getMaterialNames(obj); // Call within the class; get list of materials

References modelMaterialNames.

function imgRGB = imageData.getRGBimage (   handles,
  options,
  sImgIn 
)

Generate RGB image from all layers that have to be shown on the screen.

| Examples
options.mode = 'shown';
imageData.Ishown = imageData.getRGBimage(handles, options); // to get cropped 2D RGB image of the shown area
imageData.Ishown = getRGBimage(obj, handles, options);// Call within the class; to get cropped 2D RGB image of the shown area
Parameters
handleshandles structure from im_browser
optionsa structure with extra parameters:
  • .mode -> full -> return RGB image of the whole slice; shown -> return RGB image of the shown area only
  • .resize -> yes -> resize RGB image to the current magnification value [default]; no -> return the image in the original resolution
  • .sliceNo [optional] -> index of a slice to show
  • .markerType [optional] -> default NaN, type of annotations: when both show a label next to the position marker, when marker - show only the marker without the label, when text - show only text without marker
  • .t -> [optional], [tmin, tmax] the time point of the dataset; default is the currently shown time point
sImgIna custom 3D stack to grab a single 2D slice from
Return values
imgRGB- RGB image with combined layers, [1:height, 1:width, 1:3]
Required fields of options:
Required fields of handles:

References ib_addText2Img().

Referenced by plotImage().

Here is the call graph for this function:

Here is the caller graph for this function:

function imgOut = imageData.getRoiCrop (   type,
  handles,
  roiNo,
  options,
  col_channel 
)

Get a 3D dataset from the defined ROI regions.

Returns a cell(s) imgOut 3D stacks of the shown ROIs

Parameters
typetype of the dataset to retrieve, image, model, mask, selection, or everything (model,mask and selection for imageData.model_type=='uint6' only)
handleshandles of im_browser.m
roiNo[optional] number of ROI to get, when omitted or NaN (default) take the currently selected ROIs. When 0 take all ROIs. Also it is possible to define ROI by its label as string of chars.
options[optional], a structure with extra parameters
  • .fillBg -> when NaN (default) -> crops the dataset as a rectangle; when a number fills the areas out of the ROI area with this intensity number
  • .t -> current, time point to get a 3D dataset
col_channel[optional],
  • when type is image, col_channel is a vector with color numbers to take, , when NaN [default] take the colors selected in the imageData.slices{3} variable, when 0 - take all colors of the dataset.
  • when type is model col_channel may be NaN - to take all materials of the model or an integer to take specific material. In the later case the selected material will have index = 1.
Return values
imgOuta cell array with 3D datasets from each selected ROI
Required fields of handles:
Required fields of options:

Examples:

imgOut = imageData.getRoiCrop('image', handles, 2); // get the whole dataset under ROI 2 as rectangle image
imgOut = imageData.getRoiCrop('image', handles, 2, options.fillBg=255); // get the whole dataset under ROI 2 as rectangle image with areas outside the roi filled with 255 intensity
imgOut = getRoiCrop(obj, 'model', handles, 0); // Call within the class; get all ROIs from the Model layer
Attention
imgOut - is a cell object that can be accessed as
imgOut{index}(1:height,1:width,1:color,1:z)
Implemented only for the XY plane
It is possible to use ib_getDataset.m wrapper function that takes into account shown ROIs
function imgOut = imageData.getRoiCropSlice (   type,
  handles,
  roiNo,
  sliceNo,
  orient,
  options,
  col_channel 
)

Get a 2D slice of the ROI regions only.

Returns a cell(s) imgOut with 2D stacks of the shown ROIs.

Parameters
typetype of the dataset to retrieve, image, model, mask, selection, or everything (model,mask and selection for imageData.model_type=='uint6' only)
handleshandles of im_browser.m
roiNo[optional] number of ROI to get, when omitted or NaN (default) take the currently selected ROIs. When 0 take all ROIs. Also it is possible to define ROI by its label as string of chars.
sliceNo[optional], number of the slice to get, when omitted or NaN returns the current slice
orient[optional], get a slice in the desired orientation
  • 1 - xz
  • 2 - yz
  • 4 - xy
  • NaN - currently selected orientation
options[optional], a structure with extra parameters
  • .fillBg -> when NaN (default) -> crops the dataset as a rectangle; when a number fills the areas out of the ROI area with this intensity number.
col_channel[optional],
  • when type is image, col_channel is a vector with color numbers to take, when NaN [default] take the colors selected in the imageData.slices{3} variable, when 0 - take all colors of the dataset.
  • when type is model col_channel may be NaN - to take all materials of the model or an integer to take specific material. In the later case the selected material will have index = 1.
Return values
imgOuta cell array containing 3D images of ROIs. For the image type: [1:height, 1:width, 1:colors]; for all other types: [1:height, 1:width]
Required fields of handles:
Required fields of options:

Examples:

imgOut = handles.Img{handles.Id}.I.getRoiCropSlice('image', handles, 2); // get ROI 2 as rectangle image, from the current slice.
imgOut = handles.Img{handles.Id}.I.getRoiCropSlice('image', handles, 2, NaN, NaN, options.fillBg=255); // get ROI 2 as rectangle image with areas outside the roi filled with 255 intensity, from the current slice.
imgOut = obj.getRoiCropSlice('model', handles, 0); // Call within the class; get all ROIs from the currently shown Model layer
Attention
imgOut - is a cell object that can be accessed as
imgOut{index}(1:height,1:width,1:color)
It is possible to use ib_getSlice.m wrapper function that takes into account shown ROIs
function slice = imageData.getSlice (   type,
  slice_no,
  orient,
  col_channel,
  custom_img,
  options 
)

Get the 2D slice.

Parameters
typetype of the slice to retrieve, image, model,mask, selection, custom (custom indicates to use custom_img as the dataset), everything(model,mask and selection for imageData.model_type=='uint6' only)
slice_no[optional], an index of the slice to show, when NaN will show the current slice
orient[optional], can be NaN
  • when 0 (default) returns the dataset transposed to the current orientation (obj.orientation)
  • when 1 returns transposed dataset to the zx configuration: [y,x,c,z,t] -> [x,z,c,y,t]
  • when 2 returns transposed dataset to the zy configuration: [y,x,c,z,t] -> [y,z,c,y,t]
  • when 3 not used
  • when 4 returns original dataset to the yx configuration: [y,x,c,z,t]
  • when 5 not used
col_channel[optional], can be NaN
  • when type is image, col_channel is a vector with color numbers to take, when NaN [default] take the colors selected in the imageData.slices{3} variable, when 0 - take all colors of the dataset.
  • when type is model col_channel may be NaN - to take all materials of the model or an integer to take specific material. In the later case the selected material in slice will have index = 1.
custom_img[optional], can be NaN; the function return a slice not from the imageData class but from this custom_img, requires to specify the custom type. custom_img should be a 3D dataset.
options[optional], a structure with extra parameters
  • .y -> [optional], [ymin, ymax] of the part of the slice to take
  • .x -> [optional], [xmin, xmax] of the part of the slice to take
  • .t -> [optional], [tmin, tmax] indicate the time point to take, when missing return the currently selected time point
Return values
slice2D image. For the image type: [1:height, 1:width, 1:colors]; for all other types: [1:height, 1:width]

Examples:

slice = handles.Img{handles.Id}.I.getSlice('image', 5); // get the 5-th slice of the current stack orientation
slice = handles.Img{handles.Id}.I.getSlice('image', 5, 4, 2); // get the 5-th slice of the XY-orientation, color channel=2
slice = handles.Img{handles.Id}.I.getSlice('custom', 5, 1, 2, custom_img); // get the 5-th slice of the YZ-orientation, color channel=2 from the custom_image
slice = obj.getSlice(img, 'image', 5); // Call within the class; get the 5-th slice of the current stack orientation
Attention
sensitive to the
not sensitive to the shown ROI
for normal calls it is recommended to use ib_getSlice.m wrapper function, as
slice = ib_getSlice('image', handles) or imageData.getData2D
function slice = imageData.getSliceToShow (   type,
  slice_no,
  orient,
  col_channel,
  custom_img,
  options 
)

Get a part of the 3D slice that fits into the viewing window of the handles.imageAxes, Note! the image will be cropped.

Parameters
typetype of the slice to retrieve, image, model,mask, selection, custom (custom indicates to use custom_img as the dataset), everything(model,mask and selection for imageData.model_type=='uint6' only)
slice_no[optional], an index of the slice to show, when empty or NaN will show the current slice
orient[optional], define orientation of the slice in the dataset
  • when 1 - xz
  • when 2 - yz
  • when 4 - xy
  • when NaN - current orientation
col_channel[optional], can be NaN
  • when type is image, col_channel is a vector with color numbers to take, when NaN [default] take the colors selected in the imageData.slices{3} variable, when 0 - take all colors of the dataset.
  • when type is model col_channel may be NaN - to take all materials of the model or an integer to take specific material. In the later case the selected material in slice will have index = 1.
custom_img[optional], can be NaN; the function return a slice not from the imageData class but from this custom_img, requires to specify the custom type. custom_img should be a 3D dataset.
options[optional], a structure with extra parameters
  • .y -> [optional], [ymin, ymax] of the part of the slice to take
  • .x -> [optional], [xmin, xmax] of the part of the slice to take
  • .t -> [optional], [tmin, tmax] the time point of the dataset; default is the currently shown time point
Return values
slicecropped 2D image. For the image type: [1:height, 1:width, 1:colors]; for all other types: [1:height, 1:width]
Required fields of options:

Examples:

slice = handles.Img{handles.Id}.I.getSliceToShow('image', 5); // get the 5-th slice of the current stack orientation
slice = handles.Img{handles.Id}.I.getSliceToShow('image', 5, 4, 2); // get the 5-th slice of the XY-orientation, color channel=2
slice = handles.Img{handles.Id}.I.getSliceToShow('custom', 5, 1, 2, custom_img); // get the 5-th slice of the YZ-orientation, color channel=2 from the custom_image
slice = getSliceToShow(obj, 'image', 5); // Call within the class; get the 5-th slice of the current stack orientation
Attention
not sensitive to the
not sensitive to the shown ROI

References height, and width.

function imageData.insertEmptyColorChannel (   channel1)

Insert an empty color channel to the specified position.

Parameters
channel1[optional] the index of color channel to insert.

Examples:

imageData.insertEmptyColorChannel(1); // insert empty color channel to position 1
insertEmptyColorChannel(obj, 1); // Call within the class; insert empty color channel to position 1

References mib_inputdlg(), and updateImgInfo().

Here is the call graph for this function:

function handles = imageData.insertSlice (   img,
  handles,
  insertPosition,
  img_info 
)

Insert a slice or a dataset into the existing volume.

Parameters
imgnew 2D-4D image stack to insert
handleshandles structure from im_browser
insertPosition[optional] position where to insert the new slice/volume starting from 1. When omitted or NaN add img to the end of the dataset
img_info[optional] containers Map with parameters of the dataset to insert
Return values
handleshandles structure from im_browser
Required fields of handles:

Examples:

handles = imageData.insertSlice(img, handles, 1); // insert img to the beginning of the opened dataset
handles = insertSlice(obj, img); // Call within the class; add img to the end of the opened dataset

References img, img_info, mib_inputdlg(), and updateGuiWidgets().

Here is the call graph for this function:

function imageData.invertColorChannel (   channel1)

Invert color channel of the dataset.

The specified channel1 will be inverted

Parameters
channel1[optional] index of the color channel to invert

Examples:

handles = imageData.invertColorChannels(1); // invert color channel 1
handles = invertColorChannels(obj, 1); // Call within the class; invert color channel 1

References mib_inputdlg(), and updateImgInfo().

Here is the call graph for this function:

function imageData.mark2selection (   layer_id,
  type,
  str_type,
  xy_vec 
)

Add a marker/pointer to the selection layer.

Parameters
layer_idIndex of the z-slice, for example (1)
typea type of the marker:
  • 'retract' - a minus sign,
  • 'growth' - a plus sign
  • 'sliding' - the x sign
  • 'cross' - a cross sign
  • 'large cross' - a larger cross sign
str_typean additional identifier:
  • 'tube' - draw a line on the left side of the marker
  • 'sheet' - draw a line of the right side of the marker
  • 'unknown' - keep the marker without line
xy_vec- coordinates of the markers, [1:number of points, [x, y]]

Examples:

xy_vec(1, :) = [50 75];
imageData.mark2selection(1, 'cross', '', xy_vec); // Draw a small cross at X=50 Y=75
mark2selection(obj, 1, 'cross', '', xy_vec); // Call within the class
Attention
Implemented only for the XY-orientation
function imageData.moveMaskToSelectionDataset (   action_type,
  options 
)

Move the Mask layer to the Selection layer.

This is one of the specific functions to move datasets between the layers. Allows faster move of complete datasets between the layers than using of ib_getDataset.m / ib_setDataset.m functions.

Parameters
action_typea type of the desired action
  • 'add' - add mask to selection
  • 'remove' - remove mask from selection
  • 'replace' - replace selection with mask
optionsa structure with additional paramters
  • .contSelIndex - index of the Select from material
  • .contAddIndex - index of the Add to material
  • .selected_sw - [0 / 1] switch to limit actions to the selected Select from material only
  • .maskedAreaSw - [0 / 1] switch to limit actions to the masked areas
Required fields of options:

Examples:

options.contSelIndex = get(handles.segmSelList,'Value')-2; // index of the selected material
options.contAddIndex = get(handles.segmAddList,'Value')-2; // index of the target material
options.selected_sw = get(handles.segmSelectedOnlyCheck,'value'); // when 1- limit selection to the selected material
options.maskedAreaSw = get(handles.maskedAreaCheck,'Value');
imageData.moveMaskToSelectionDataset('add', options); // add mask to selection
moveMaskToSelectionDataset(obj, 'add', options); // call from the imageData class, add mask to selection
Attention
NOT sensitive to the imageData.blockModeSwitch
NOT sensitive to the shown ROI
See Also
imageData.moveMaskToSelectionDataset imageData.moveModelToMaskDataset imageData.moveModelToSelectionDataset imageData.moveSelectionToMaskDataset imageData.moveSelectionToModelDataset
function imageData.moveModelToMaskDataset (   action_type,
  options 
)

Move the selected Material to the Mask layer.

This is one of the specific functions to move datasets between the layers. Allows faster move of complete datasets between the layers than using of ib_getDataset.m / ib_setDataset.m functions.

Parameters
action_typea type of the desired action
  • 'add' - add the selected material (Select from) to mask
  • 'remove' - remove the selected material (Select from) from mask
  • 'replace' - replace mask with the selected (Select from) material
optionsa structure with additional paramters
  • .contSelIndex - index of the Select from material
  • .contAddIndex - index of the Add to material
  • .selected_sw - [0 / 1] switch to limit actions to the selected Select from material only
  • .maskedAreaSw - [0 / 1] switch to limit actions to the masked areas
Required fields of options:

Examples:

options.contSelIndex = get(handles.segmSelList,'Value')-2; // index of the selected material
options.contAddIndex = get(handles.segmAddList,'Value')-2; // index of the target material
options.selected_sw = get(handles.segmSelectedOnlyCheck,'value'); // when 1- limit selection to the selected material
options.maskedAreaSw = get(handles.maskedAreaCheck,'Value');
imageData.moveModelToMaskDataset('add', options); // add material to mask
moveModelToMaskDataset(obj, 'add', options); // call from the imageData class, add material to mask
Attention
NOT sensitive to the imageData.blockModeSwitch
NOT sensitive to the shown ROI
See Also
imageData.moveMaskToSelectionDataset imageData.moveModelToMaskDataset imageData.moveModelToSelectionDataset imageData.moveSelectionToMaskDataset imageData.moveSelectionToModelDataset
function imageData.moveModelToSelectionDataset (   action_type,
  options 
)

Move the selected Material to the Selection layer.

This is one of the specific functions to move datasets between the layers. Allows faster move of complete datasets between the layers than using of ib_getDataset.m / ib_setDataset.m functions.

Parameters
action_typea type of the desired action
  • 'add' - add the selected material (Select from) to selection
  • 'remove' - remove the selected material (Select from) from selection
  • 'replace' - replace selection with the selected (Select from) material
optionsa structure with additional paramters
  • .contSelIndex - index of the Select from material
  • .contAddIndex - index of the Add to material
  • .selected_sw - [0 / 1] switch to limit actions to the selected Select from material only
  • .maskedAreaSw - [0 / 1] switch to limit actions to the masked areas
Required fields of options:

Examples:

options.contSelIndex = get(handles.segmSelList,'Value')-2; // index of the selected material
options.contAddIndex = get(handles.segmAddList,'Value')-2; // index of the target material
options.selected_sw = get(handles.segmSelectedOnlyCheck,'value'); // when 1- limit selection to the selected material
options.maskedAreaSw = get(handles.maskedAreaCheck,'Value');
imageData.moveModelToSelectionDataset('add', options); // add material to selection
moveModelToSelectionDataset(obj, 'add', options); // call from the imageData class, add material to selection
Attention
NOT sensitive to the imageData.blockModeSwitch
NOT sensitive to the shown ROI
See Also
imageData.moveMaskToSelectionDataset imageData.moveModelToMaskDataset imageData.moveModelToSelectionDataset imageData.moveSelectionToMaskDataset imageData.moveSelectionToModelDataset
function imageData.moveSelectionToMaskDataset (   action_type,
  options 
)

Move the Selection layer to the Mask layer.

This is one of the specific function to move datasets between the layers. Allows faster move of complete datasets between the layers than using of ib_getDataset.m / ib_setDataset.m functions.

Parameters
action_typea type of the desired action
  • 'add' - add selection to mask
  • 'remove' - remove selection from mask
  • 'replace' - replace mask with selection
optionsa structure with additional paramters
  • .contSelIndex - index of the Select from material
  • .contAddIndex - index of the Add to material
  • .selected_sw - [0 / 1] switch to limit actions to the selected Select from material only
  • .maskedAreaSw - [0 / 1] switch to limit actions to the masked areas
Required fields of options:

Examples:

options.contSelIndex = get(handles.segmSelList,'Value')-2; // index of the selected material
options.contAddIndex = get(handles.segmAddList,'Value')-2; // index of the target material
options.selected_sw = get(handles.segmSelectedOnlyCheck,'value'); // when 1- limit selection to the selected material
options.maskedAreaSw = get(handles.maskedAreaCheck,'Value');
imageData.moveSelectionToMaskDataset('add', options); // add selection to mask
moveSelectionToMaskDataset(obj, 'add', options); // call from the imageData class, add selection to mask
Attention
NOT sensitive to the imageData.blockModeSwitch
NOT sensitive to the shown ROI
See Also
imageData.moveMaskToSelectionDataset imageData.moveModelToMaskDataset imageData.moveModelToSelectionDataset imageData.moveSelectionToMaskDataset imageData.moveSelectionToModelDataset
function imageData.moveSelectionToModelDataset (   action_type,
  options 
)

Move selection layer to the model layer.

This is one of the specific functions to move datasets between the layers. Allows faster move of complete datasets between the layers than using of ib_getDataset.m / ib_setDataset.m functions.

Parameters
action_typea type of the desired action
  • 'add' - add selection to the selected material (Add to)
  • 'remove' - remove selection from the model
  • 'replace' - replace the selected (Add to) material with selection
optionsa structure with additional paramters
  • .contSelIndex - index of the Select from material
  • .contAddIndex - index of the Add to material
  • .selected_sw - [0 / 1] switch to limit actions to the selected Select from material only
  • .maskedAreaSw - [0 / 1] switch to limit actions to the masked areas
Required fields of options:

Examples:

options.contSelIndex = get(handles.segmSelList,'Value')-2; // index of the selected material
options.contAddIndex = get(handles.segmAddList,'Value')-2; // index of the target material
options.selected_sw = get(handles.segmSelectedOnlyCheck,'value'); // when 1- limit selection to the selected material
options.maskedAreaSw = get(handles.maskedAreaCheck,'Value');
imageData.moveSelectionToModelDataset('add', options); // add selection to model
moveSelectionToModelDataset(obj, 'add', options); // call from the imageData class, add selection to model
Attention
NOT sensitive to the imageData.blockModeSwitch
NOT sensitive to the shown ROI
See Also
imageData.moveMaskToSelectionDataset imageData.moveModelToMaskDataset imageData.moveModelToSelectionDataset imageData.moveSelectionToMaskDataset imageData.moveSelectionToModelDataset
function imageData.moveView (   x,
  y,
  orient 
)

Center the image view at the provided coordinates: x, y.

Parameters
x- X coordinate of the window center, or index of the point
y- [optional] Y coordinate of the window center, can be NaN
orient- [optional] define orientation of the point, default is the currently shown orientation
  • when 0 (default) assumes that the points are taken at the current orientation (obj.orientation)
  • when 1 assumes that the points are taken at the zx orientation
  • when 2 assumes that the points are taken at the zy orientation
  • when 3 not used
  • when 4 assumes that the points are taken at the yx orientation
  • when 5 not used

Examples:

imageData.moveView(50, 75); // center the view at the pixel 50, 75
moveView(obj, 75);// Call within the class; center the view at the pixel with index 75
function handles = imageData.plotImage (   axes,
  handles,
  resize,
  sImgIn 
)

Plot image to the axes. The main drawing function.

Parameters
axeshandle to axes, use handles.imageAxes
handleshandles structure from im_browser
resize
  • when 1 resize image to fit the screen
  • when 0 keep the current vieweing settings
sImgIna custom 2D image to show in the axes that should be targeted to the axes. Use resize=0 to show sImgIn in the same scale/position as the currently shown dataset, or resize=1 to show sImgIn in full resolution
Return values
handles- handles of im_browser.m
Required fields of handles:

Examples:

imageData.plotImage(handles.imageAxes, handles, 1); // plot image in the handles.imageAxes axes and resize it
handles = plotImage(obj, handles.imageAxes, handles, 1);// Call within the class; plot image in the handles.imageAxes axes and resize it

References getRGBimage(), getRGBvolume(), and ib_updateCursor().

Here is the call graph for this function:

function handles = imageData.replaceDataset (   img,
  handles,
  img_info,
  modelImg,
  maskImg,
  selectionImg 
)

Replace existing dataset with a new one.

Parameters
imga new 2D/3D image stack
handleshandles structure from im_browser
img_info[optional] a containers.Map class with parameters of the dataset, can be NaN
modelImg[optional] the Model layer, can be NaN
maskImg[optional] the Mask layer, can be NaN
selectionImg[optional] the Selection layer
Return values
handleshandles structure from im_browser
Required fields of handles:
Generated fields of handles:

Examples:

handles = imageData.replaceDataset(img, handles, img_info); // replace the imageData.img with new stack from img
handles = replaceDataset(obj, img, handles, img_info); // Call within the class; replace the imageData.img with new stack from img

References ib_updatePixSizeAndResolution(), img, img_info, makeViewMatrix(), maskImg, updateAxesLimits(), and updateGuiWidgets().

Here is the call graph for this function:

function handles = imageData.replaceImageColor (   handles,
  type 
)

Replace image intensities in the Masked or Selected areas with new intensity value.

The function starts a dialog that asks for a new intensity values to replace either the Masked or Selected areas.

Parameters
handleshandles of im_browser.m
typespecifies which layer to use for color replacement: 'mask' or 'selection'
Return values
handleshandles of im_browser.m
Required fields of handles:

Examples:

handles = imageData.replaceImageColor(handles, 'mask'); // to replace the Masked areas with new color
handles = replaceImageColor(obj, handles, 'selection'); // Call within the class; to replace the Selected areas with new color

References ib_do_backup().

Here is the call graph for this function:

function imageData.resizeImage (   new_width,
  new_height,
  method 
)

Resize all layers using specified method.

Parameters
new_widthnew width of the dataset
new_heightnew height of the dataset
methoda method to use during resizing: 'nearest', 'bilinear', 'bicubic'
Note
The Model, Mask, Selection layers will be resized using the 'nearest' method.

Examples:

imageData.resizeImage(512, 1024); // resize image to 512 width and 1024 height
resizeImage(obj, 512, 1024);// Call within the class; resize image to 512 width and 1024 height
function imageData.rotateColorChannel (   channel1)

Rotate color channel of the dataset.

The specified channel1 will be rotated

Parameters
channel1[optional] index of the color channel to invert

Examples:

handles = imageData.rotateColorChannel(1); // rotate color channel 1
handles = handles.Img{handles.Id}.I.rotateColorChannel(1); // rotate color channel 1

handles.Img{handles.Id}.I.

handles = rotateColorChannel(obj, 1); // Call within the class; rotate color channel 1

References mib_inputdlg().

Here is the call graph for this function:

function imageData.setCurrentSlice (   type,
  slice,
  color_id 
)

Update the currently shown slice of the dataset.

Parameters
typetype of the dataset to update, image, model, mask, selection, everything(model,mask and selection for imageData.model_type=='uint6' only)
slicea new 2D slice, for the 'image' type [1:height,1:width, 1:color], for other latyers [1:height,1:width]
color_id[optional],
  • when type is image, color_id is a vector with color numbers to set, otherwise will update the colors selected in the imageData.slices{3} variable
  • when type is model color_id may be 0 - to update all materials of the model or an integer to update specific material.

Examples:

imageData.setCurrentSlice('image', slice); // update the currently shown image with data in slice
imageData.setCurrentSlice('model', slice, 4); // replace material 4 with contents of slice
slice = imageData.getCurrentSlice('model', 4); // get material 4
imageData.setCurrentSlice('model', slice, 1); // set it as material 1
setCurrentSlice(obj, 'model', slice, 1); // Call within the class; set it as material 1
Attention
sensitive to the
not sensitive to the shown ROI
for normal calls it is recommended to use ib_setSlice.m wrapper function, as
ib_setSlice('image', slice, handles);

References setSlice().

Here is the call graph for this function:

function result = imageData.setData2D (   type,
  slice,
  slice_no,
  orient,
  col_channel,
  custom_img,
  options 
)

set the 3D slice: height:width:colors to the dataset

Parameters
typetype of the slice to set, image, model,mask, selection, custom (custom indicates to use custom_img as the dataset), everything(model,mask and selection for imageData.model_type=='uint6' only)
slice3D image. For the image type: [1:height, 1:width, 1:colors]; for all other types: [1:height, 1:width]
slice_no[optional], an index of the slice to update, when NaN updates the current slice
orient[optional], can be NaN
  • when 0 (default) updates the dataset transposed from the current orientation (obj.orientation)
  • when 1 returns transposed dataset from the zx configuration: [x,z,c,y,t] -> [y,x,c,z,t]
  • when 2 returns transposed dataset from the zy configuration: [y,z,c,y,t] -> [y,x,c,z,t]
  • when 3 not used
  • when 4 returns original dataset from the yx configuration: [y,x,c,z,t]
  • when 5 not used
col_channel[optional], can be NaN
  • when type is image, col_channel is a vector with color numbers to take, when NaN [default] take the colors selected in the imageData.slices{3} variable, when 0 - take all colors of the dataset.
  • when type is model col_channel may be NaN - to take all materials of the model or an integer to take specific material. In the later case the selected material in slice will have index = 1.
custom_img[optional], can be NaN; the function return a slice not from the imageData class but from this custom_img, requires to specify the custom type. custom_img should be a 3D dataset.
options[optional], a structure with extra parameters
  • .blockModeSwitch -> override the imageData.blockModeSwitch (0 - update the full dataset, 1 - update only the shown part)
  • .y -> [optional], [ymin, ymax] of the part of the slice to set
  • .x -> [optional], [xmin, xmax] of the part of the slice to set
  • .t -> [optional], [tmin, tmax] indicate the time point to set, when missing return the currently selected time point
Return values
slice3D image. For the image type: [1:height, 1:width, 1:colors]; for all other types: [1:height, 1:width]
Required fields of options:

Examples:

slice = handles.Img{handles.Id}.I.setData2D('image', slice, 5); // set the 5-th slice of the current stack orientation
slice = handles.Img{handles.Id}.I.setData2D('image', slice, 5, 4, 2); // set the 5-th slice of the XY-orientation, color channel=2
slice = handles.Img{handles.Id}.I.setData2D('custom', slice, 5, 1, 2, custom_img); // set the 5-th slice of the YZ-orientation, color channel=2 from the custom_image
slice = obj.setData2D(img, 'image', slice, 5); // Call within the class; set the 5-th slice of the current stack orientation
Attention
sensitive to the
not sensitive to the shown ROI
for normal calls it is recommended to use ib_getSlice.m wrapper function, as
slice = ib_getSlice('image', handles);
function result = imageData.setData3D (   type,
  dataset,
  time,
  orient,
  col_channel,
  options,
  custom_img 
)

Set the 4D dataset (height:width:colors:depth) into the 5D dataset.

Parameters
typetype of the dataset to set, image, model,mask, selection, custom (custom indicates to use custom_img as the dataset), everything(model,mask and selection for imageData.model_type=='uint6' only)
dataset3D or 4D stack. For the image type: [1:height, 1:width, 1:colors, 1:depth]; for all other types: [1:height, 1:width, 1:thickness]
time[optional], an index of the time point to show, when NaN gets the dataset for the current time point
orient[optional], can be NaN
  • when 0 (default) updates the dataset transposed from the current orientation (obj.orientation)
  • when 1 returns transposed dataset from the zx configuration: [x,z,c,y,t] -> [y,x,c,z,t]
  • when 2 returns transposed dataset from the zy configuration: [y,z,c,y,t] -> [y,x,c,z,t]
  • when 3 not used
  • when 4 returns original dataset from the yx configuration: [y,x,c,z,t]
  • when 5 not used
col_channel[optional], can be NaN
  • when type is image, col_channel is a vector with color numbers to take, when NaN [default] take the colors selected in the imageData.slices{3} variable, when 0 - take all colors of the dataset.
  • when type is model col_channel may be NaN - to take all materials of the model or an integer to take specific material. In the later case the selected material in slice will have index = 1.
options[optional], a structure with extra parameters
  • .blockModeSwitch -> override the imageData.blockModeSwitch (0 - update the full dataset, 1 - update only the shown part)
  • .y -> [optional], [ymin, ymax] of the part of the dataset to take
  • .x -> [optional], [xmin, xmax] of the part of the dataset to take
  • .z -> [optional], [zmin, zmax] of the part of the dataset to take
custom_img[optional], can be NaN; the function return a slice not from the imageData class but from this custom_img, requires to specify the custom type. custom_img should be a 3D/4D dataset.
Return values
result-> 1 - success, 0 - error

Examples:

dataset = handles.Img{handles.Id}.I.setData3D('image', dataset); // set the 4D dataset for the current time point, in the shown orientation
dataset = handles.Img{handles.Id}.I.setData3D('image', dataset, 5, 4); // set the 4D dataset for the 5-th time point in the XY orientation
dataset = handles.Img{handles.Id}.I.setData3D('selection', dataset, 5, 1, 2); // set the 5-th timepoint in the the XZ-orientation, color channel=2
dataset = obj.setData3D(img, 'image', dataset, [], 4); // Call within the class; set the 4D dataset for the current time point in the XY orientation
Attention
sensitive to the
not sensitive to the shown ROI
for normal calls it is recommended to use ib_setDataset.m wrapper function, as
dataset = ib_setDataset('image', handles);
function result = imageData.setData4D (   type,
  dataset,
  orient,
  col_channel,
  options 
)

result = setData4D(obj, type, dataset, orient, col_channel, options) Set complete 5D dataset

Parameters
typetype of the dataset to update, image, model,mask, selection, or everything (model,mask and selection for imageData.model_type=='uint6' only)
dataset4D or 5D stack. For the image type: [1:height, 1:width, 1:colors, 1:depth, 1:time]; for all other types: [1:height, 1:width, 1:thickness, 1:time]
orient[optional], can be NaN
  • when 0 (default) updates the dataset transposed from the current orientation (obj.orientation)
  • when 1 returns transposed dataset from the zx configuration: [x,z,c,y,t] -> [y,x,c,z,t]
  • when 2 returns transposed dataset from the zy configuration: [y,z,c,y,t] -> [y,x,c,z,t]
  • when 3 not used
  • when 4 returns original dataset from the yx configuration: [y,x,c,z,t]
  • when 5 not used
col_channel[optional],
  • when type is image, col_channel is a vector with color numbers to take, when NaN [default] take the colors selected in the imageData.slices{3} variable, when 0 - take all colors of the dataset.
  • when type is model col_channel may be NaN - to take all materials of the model or an integer to take specific material. In the later case the selected material will have index = 1.
options[optional], a structure with extra parameters
  • .blockModeSwitch -> override the imageData.blockModeSwitch (0 - update the full dataset, 1 - update only the shown part)
  • .y -> [optional], [ymin, ymax] coordinates of the dataset to take after transpose, height
  • .x -> [optional], [xmin, xmax] coordinates of the dataset to take after transpose, width
  • .z -> [optional], [zmin, zmax] coordinates of the dataset to take after transpose, depth
  • .t -> [optional], [tmin, tmax] coordinates of the dataset to take after transpose, time
Return values
result-> 1 - success, 0 - error
Required fields of options:

Examples:

handles.Img{handles.Id}.I.setData4D('image', dataset); // update the complete dataset in the shown orientation
handles.Img{handles.Id}.I.setData4D('image', dataset, NaN, NaN, options.blockModeSwitch=1); // update the croped to the viewing window dataset, with shown colors
handles.Img{handles.Id}.I.setData4D('image', dataset, 4, 2); // update complete dataset in the XY orientation with only second color channel
obj.setData4D('image', dataset); // Call within the class, update the complete dataset
Attention
sensitive to the imageData.blockModeSwitch
not sensitive to the shown ROI
for normal calls it is recommended to use ib_getDataset.m wrapper function, as
dataset = ib_getDataset('image', handles);
function result = imageData.setDataset (   type,
  dataset,
  orient,
  col_channel,
  options 
)

Update complete 4D dataset, LEGACY function, please use imageData.setData3D instead!

Parameters
typetype of the dataset to update, image, model, mask, selection, everything (model,mask and selection for imageData.model_type=='uint6' only)
dataseta 4D stack with images
orient[optional], can be NaN
  • when 0 (default) returns the dataset transposed to the current orientation (obj.orientation)
  • when 1 returns transposed dataset to the zx configuration: [y,x,c,z] -> [x,z,c,y]
  • when 2 returns transposed dataset to the zy configuration: [y,x,c,z] -> [y,z,c,y]
  • when 3 not used
  • when 4 returns original dataset to the yx configuration: [y,x,c,z]
  • when 5 not used
col_channel[optional], can be NaN;
  • when type is image, col_channel is a vector with color numbers to set, when NaN [default] update set the colors selected in the imageData.slices{3} variable; when 0 - update all colors of the dataset.
  • when type is model col_channel may be NaN - to update all materials of the model or an integer to update specific material.
options[optional], a structure with extra parameters
  • .blockModeSwitch -> override the imageData.blockModeSwitch (0 - update full dataset, 1 - update only the shown area)
  • .y -> [optional], [ymin, ymax] of the part of the dataset to set;
  • .x -> [optional], [xmin, xmax] of the part of the dataset to set
  • .z -> [optional], [zmin, zmax] of the part of the dataset to set
Return values
result-> 1 - success, 0 - error

Examples:

result = handles.Img{handles.Id}.I.setDataset('image', dataset); // set the 4D dataset into 5D at the current time point
result = handles.Img{handles.Id}.I.setDataset('image', dataset, 0, NaN, options.blockModeSwitch=1); // set the croped to the viewing window part of the dataset, with shown colors
result = handles.Img{handles.Id}.I.setDataset('image', dataset, 1, 2); // set complete transposed (XZ) dataset with only second color channel
result = obj.setDataset('image', dataset); // Call within the class; set the complete dataset
Attention
sensitive to the
not sensitive to the shown ROI
for normal calls it is recommended to use ib_setDataset.m wrapper function, as
ib_setDataset('image', dataset, handles);

References time.

function custom_img = imageData.setFullSlice (   type,
  slice,
  slice_no,
  orient,
  col_channel,
  custom_img,
  options 
)

Update the full 2D slice of the dataset.

Parameters
typetype of the image to update, image, model, mask, selection, custom, 'everything (get model, selection and mask, when imageData.model_type==uint6')
slice2D image, for image type: [1:height, 1:width, 1:color], and [1:height, 1:width] for all other layers
slice_no[optional], number of the slice to set, when empty or NaN update the current slice
orient[optional], update the slice in the desired orientation
  • 1 - xz
  • 2 - yz
  • 4 - xy
  • NaN - the current orientation
col_channel[optional], can be NaN
  • when type is image, col_channel is a vector with color numbers to set, when NaN [default] update set the colors selected in the imageData.slices{3} variable; when 0 - update all colors of the dataset.
  • when type is model col_channel may be NaN - to update all materials of the model or an integer to update specific material.
custom_img[optional], can be NaN; update a slice not from the imageData class but from this custom_img (3D dataset), requires the custom type
options[optional], a structure with extra parameters
  • .y -> [optional], [ymin, ymax] of the part of the slice to take
  • .x -> [optional], [xmin, xmax] of the part of the slice to take
  • .t -> [optional], [tmin, tmax] the time point of the dataset; default is the currently shown time point
Return values
custom_img
  • a modified 3D stack, for the 'custom' type, or 1 for success and 0 for an error of the function run
Required fields of options:

Examples:

imageData.setFullSlice('image', slice, 5); // assign slice to the 5-th slice of the current stack orientation
imageData.setFullSlice('image', slice, 5, 4, 2); // assign slice to the 5-th slice of the XY-orientation, color channel=2
custom_img = imageData.setFullSlice('custom', slice, 5, 1, 2, custom_img); // assign slice to the 5-th slice of the YZ-orientation, color channel=2 to the custom_image
setFullSlice(obj,'image', slice, NaN, NaN, 2); // Call within the class; assign slice to the current slice of the current orientation, color channel=2
Attention
not sensitive to the
not sensitive to the shown ROI
see also im_setSlice.m a wrapper function.

References height, and width.

Referenced by setSlice().

Here is the caller graph for this function:

function handles = imageData.setMaterialNames (   modelMaterialNames,
  handles 
)

Set names for materials of the model.

Parameters
modelMaterialNamesa cell array with names for materials
handleshandles structure from im_browser
Return values
handleshandles structure from im_browser
Required fields of handles:

Example:

modelMaterialNames = {'Material 1','Material 2', 'Material 3'}; // define names for materials
handles = imageData.setMaterialNames(modelMaterialNames); // set material names
handles = setMaterialNames(obj, modelMaterialNames); // Call within the class; set material names

References model, modelMaterialNames, and updateSegmentationLists().

Here is the call graph for this function:

function imageData.setRoiCrop (   type,
  imgIn,
  handles,
  roiNo,
  options,
  col_channel 
)

Update a full 3D dataset from the defined ROI regions.

Note! Requires an array of cells as imgIn

Parameters
typetype of the image to update, image, model, mask, selection, or everything (model,mask and selection for imageData.model_type=='uint6' only)
imgIna cell array with ROIs 3D volumes,
imgIn{roiNo}(1:height,1:width,1:color,1:thickness)
handleshandles of im_browser.m
roiNo[optional] number of ROI to update, when omitted or NaN take the currently selected. When 0 update all ROIs. Also it is possible to define ROI by its label as string of chars.
options[optional], a structure with extra parameters
  • .fillBg -> when 1 -> keep the background from imgIn; when NaN [default] -> crop imgIn with respect to the ROI shape
  • .t -> current, time point to get a 3D dataset
col_channel[optional], can be NaN;
  • when type is image, col_channel is a vector with color numbers to update, when NaN [default] update set the colors selected in the imageData.slices{3} variable; when 0 - update all colors of the dataset.
  • when type is model col_channel may be NaN - to update all materials of the model or an integer to update specific material.
Required fields of handles:
Required fields of options:

Examples:

imageData.setRoiCrop('image', imgIn, handles, 2); // update whole dataset under ROI 2 as shaped ROI image.
imageData.setRoiCrop('image', imgIn, handles, 2, NaN, NaN, options.fillBg=1); // update whole dataset under ROI 2 as rectangle image with areas outside the roi filled with image intensity of imgIn.
setRoiCrop(obj, 'model', imgIn, handles, 0); // Call within the class; update whole Model dataset under all ROIs
Attention
imgIn - is a cell object:
imgIn{index}(1:height,1:width,1:color,1:z)
Implemented only for the XY plane
consider to use ib_setDataset.m wrapper function
function imageData.setRoiCropSlice (   type,
  imgIn,
  handles,
  roiNo,
  sliceNo,
  orient,
  options,
  col_channel 
)

Update a 2D slice of the ROI regions of the dataset.

Note! Requires an array of cells as imgIn

Parameters
typetype of the image to update, image, model, mask, selection, or everything (model,mask and selection for imageData.model_type=='uint6' only)
imgIna cell array with ROIs 2D slices,
imgIn{roiNo}(1:height,1:width,1:color)
handleshandles of im_browser.m
roiNo[optional] number of ROI to update, when omitted or NaN take the currently selected. When 0 take all ROIs. Also it is possible to define ROI by its label as string of chars.
sliceNo[optional], a number of the slice to update, when omitted or NaN update the current slice
orient[optional], update a slice in the desired orientation
  • 1 - xz
  • 2 - yz
  • 4 - xy
  • NaN - use the current orientation
options[optional], a structure with extra parameters
  • .fillBg -> when 1 -> keep the background from imgIn; when NaN [default] -> crop imgIn with respect to the ROI shape
col_channel[optional], can be NaN
  • when type is image, col_channel is a vector with color numbers to update, when NaN [default] update set the colors selected in the imageData.slices{3} variable; when 0 - update all colors of the dataset.
  • when type is model col_channel may be NaN - to update all materials of the model or an integer to update specific material.
Required fields of handles:
Required fields of options:

Examples:

handles.Img{handles.Id}.I.setRoiCropSlice('image', imgIn, handles, 2); // update ROI 2 of the current slice as shaped ROI image.
handles.Img{handles.Id}.I.setRoiCropSlice('image', imgIn, handles, 2, NaN, NaN, options.fillBg=1); // update ROI 2 of the current slice as rectangle image with areas outside the roi filled with image intensity of imgIn.
obj.setRoiCropSlice('model', imgIn, handles, 0); // Call within the class; update all ROIs of the current Model layer
Attention
imgIn - is a cell object: imgIn{index}(1:height,1:width,1:color)
consider to use ib_setSlice.m wrapper function
function custom_img = imageData.setSlice (   type,
  slice,
  slice_no,
  orient,
  col_channel,
  custom_img,
  options 
)

Update the 2D slice of the dataset.

Parameters
typetype of the image to update, image, model, mask, selection, or everything (model,mask and selection for imageData.model_type=='uint6' only)
slice2D image, for image as [1:height,1:width,1:color]; for other layers as [1:height,1:width]
slice_no[optional] an index of the slice to update, when empty or NaN updates the current slice
orient[optional] update a slice in the desired orientation
  • 1 - xz
  • 2 - yz
  • 4 - xy
  • NaN - use the current orientation
col_channel[optional], can be NaN
  • when type is image, col_channel is a vector with color numbers to update, when NaN [default] update set the colors selected in the imageData.slices{3} variable; when 0 - update all colors of the dataset.
  • when type is model col_channel may be NaN - to update all materials of the model or an integer to update specific material.
custom_img[optional], can be NaN; update a slice not from the imageData class but from this custom_img (3D stack), requires the custom type
options[optional], a structure with extra parameters
  • .y -> [optional], [ymin, ymax] of the part of the slice to take
  • .x -> [optional], [xmin, xmax] of the part of the slice to take
  • .t -> [optional], [tmin, tmax] indicate the time point to take, when missing update the currently selected time point
Return values
custom_imga modified 3D stack, for the custom type; or a status of the function run: - success, - fail.

Examples:

imageData.setSlice('image', slice, 5); // set the 5-th slice of the current stack orientation
imageData.setSlice('image', slice, 5, 4, 2); // set the 5-th slice of the XY-orientation, color channel=2
custom_img = imageData.setSlice('custom', slice, 5, 1, 2, custom_img); // set the 5-th slice of the YZ-orientation, color channel=2 to the custom_image
setSlice(obj, 'model', slice, 5, NaN, 2); // Call within the class; set the 5-th slice of the current orientation as the material 2
Attention
sensitive to the
not sensitive to the shown ROI
consider to use ib_setSlice.m wrapper function

References setFullSlice(), and setSliceToShow().

Referenced by setCurrentSlice().

Here is the call graph for this function:

Here is the caller graph for this function:

function custom_img = imageData.setSliceToShow (   type,
  slice,
  slice_no,
  orient,
  col_channel,
  custom_img,
  options 
)

Update the croped to the viewing window 2D slice of the dataset.

Parameters
typetype of the image to update, image, model, mask, selection, or everything (model,mask and selection for imageData.model_type=='uint6' only)
slice2D image, for image as [1:height,1:width,1:color]; for other layers as [1:height,1:width]
slice_no[optional] an index of the slice to update, when empty or NaN updates the current slice
orient[optional] update a slice in the desired orientation
  • 1 - xz
  • 2 - yz
  • 4 - xy
  • NaN - use the current orientation
col_channel[optional], can be NaN
  • when type is image, col_channel is a vector with color numbers to update, when NaN [default] update set the colors selected in the imageData.slices{3} variable; when 0 - update all colors of the dataset.
  • when type is model col_channel may be NaN - to update all materials of the model or an integer to update specific material.
custom_img[optional], can be NaN; update a slice not from the imageData class but from this custom_img (3D stack), requires the custom type
options[optional], a structure with extra parameters
  • .y -> [optional], [ymin, ymax] of the part of the slice to update
  • .x -> [optional], [xmin, xmax] of the part of the slice to update
  • .t -> [optional], [tmin, tmax] the time point of the dataset; default is the currently shown time point
Return values
custom_imga modified 3D stack, for the custom type; or a status of the function run: - success, - fail.
Required fields of options:

Examples:

imageData.setSliceToShow('image', slice, 5); // assign slice to the 5-th slice of the current stack orientation
imageData.setSliceToShow('image', slice, 5, 4, 2); // assign slice to the 5-th slice of the XY-orientation, color channel=2
custom_img = imageData.setSliceToShow('custom', slice, 5, 1, 2, custom_img); // assign slice to the 5-th slice of the YZ-orientation, color channel=2 to the custom_image
setSliceToShow(obj, 'image', slice, NaN, NaN, 2); // Call within the class; assign slice to the current slice of the current orientation to color channel=2
Attention
not sensitive to the
not sensitive to the shown ROI
consider to use ib_setSlice.m wrapper function

References height, and width.

Referenced by setSlice().

Here is the caller graph for this function:

function imageData.swapColorChannels (   channel1,
  channel2 
)

Swap two color channels of the dataset.

The first color channel will be moved to the position of the second color channel, and the second color channel to the position of the first one

Parameters
channel1[optional] index of the first color channel
channel2[optional] index of the second color channel

Examples:

handles = imageData.swapColorChannels(1, 3); // swap color channel 1 and 3
handles = swapColorChannels(obj, 1, 3); // Call within the class; swap color channel 1 and 3

References updateImgInfo().

Here is the call graph for this function:

function imageData.transpose (   new_orient)

Change orientation of the image to the XY, XZ, or YZ plane.

Note
This function updates only the imageData.slices and imageData.orientation variables and do not rearrange the actual datasets.
Parameters
new_orienta desired orientation:
  • 1 -> XZ plane
  • 2 -> YZ plane
  • 3 -> YX plane

Examples:

imageData.transpose(1); // transpose to the XZ plane
transpose(obj, 1); // Call within the class; transpose to the XZ plane
function handles = imageData.updateAxesLimits (   handles,
  mode,
  newMagFactor 
)

Updates the imageData.axesX and imageData.axesY during fit screen, resize, or new dataset drawing.

Parameters
handleshandles structure from im_browser handles structure from im_browser
modeupdate mode,
  • resize -> scale to width/height
  • zoom -> scale during the zoom
newMagFactora value of the new magnification factor, only for the zoom mode Return values:
Required fields of handles:

Examples:

handles = imageData.updateAxesLimits(handles, 'zoom', newMagFactor); // update the axes using new magnification value
handles = updateAxesLimits(obj, handles, 'resize'); // Call within the class; to fit the screen

Referenced by replaceDataset().

Here is the caller graph for this function:

function imageData.updateBoundingBox (   newBB,
  xyzShift,
  imgDims 
)

Update the bounding box info of the dataset.

The bounding box info is needed to properly put the dataset in the 3D space. It is encoded in the header of the Amira mesh file, or in the beginning of the ImageDescription field of the TIF file.

Parameters
newBB- new Bounding Box parameters, Note! when NaN the dataset will be shifted with using xyzShift
  • bb(1) = Xmin
  • bb(2) = Width
  • bb(3) = Ymin
  • bb(4) = Height
  • bb(5) = Zmin
  • bb(6) = Thickness
xyzShift[optional] a vector [height, width, z-stacks] with shifts of the bounding box; when omitted the function will use minimal parameters of the existing boinding box for the shitfs. Note! the units here are the image units: imageData.pixSize.units.
imgDims[optional] a vector [height, width, z-stacks] with dimensions of the image; when omitted the function will use imageData.height, imageData.width and imageData.no_stacks variables. Note! the units here are the image units: imageData.pixSize.units.

Examples:

xyzShift = [10 5 0]; // shift the bounging box by 10 units in X, by 10 units in Y, and by 0 units in Z
imageData.updateBoundingBox(NaN, xyzShift); // get bounding box info
updateBoundingBox(obj, NaN, xyzShift); // Call within the class; get bounding box info
newBB = [15 50 10 150 1 15]; // define new bounding box in imageData.pixSize.units
imageData.updateBoundingBox(newBB); // get bounding box info

References no_stacks.

function imageData.updateDisplayParameters ( )

Update display parameters for visualization.

The function updates imageData.viewPort structure. It is called from the imageAdjustment.m dialog.

Examples:

updateDisplayParameters(obj); // Call within the class; do update
function imageData.updateImgInfo (   addText,
  action,
  entryIndex 
)

Update action log.

This function updates the image log with recent events done to the dataset; it updates the contents of imageData.img_info('ImageDescription') key.

Parameters
addTexta string that should be added to the log
action[optional] - defines additional actions that may be performed with the log:
  • 'delete' - delete entry defined with entryIndex
  • 'insert' - insert new entry after the one defined with entryIndex
  • 'modify' - modify entry with entryIndex
entryIndex[optional] - index of the entry to delete, modify or insert

Examples:

slice = imageData.updateImgInfo('Image was filtered'); // Add 'Image was filtered' text into the imageData.img_info('ImageDescriotion')
slice = imageData.updateImgInfo('','delete',4); // Delete entry number 4 from the log
slice = imageData.updateImgInfo('New entry inserted','insert',4); // Insert new entry into the log at position 4
slice = imageData.updateImgInfo('Updated text','modify',4); // Modify text at position 4
slice = updateImgInfo(obj, 'Image was filtered'); // Call within the class; Add 'Image was filtered' text into the imageData.img_info('ImageDescriotion')

Referenced by copyColorChannel(), deleteColorChannel(), insertEmptyColorChannel(), invertColorChannel(), and swapColorChannels().

Here is the caller graph for this function:

function result = imageData.updateParameters (   pixSize)

Update imageData.pixelSize, imageData.img_info('XResolution') and imageData.img_info('XResolution')

The function starts a dialog to update voxel size and the units of the dataset. As result the voxel dimensions will be updated; in addition imageData.img_info('XResolution') and imageData.img_info('YResolution') keys will be recalculated.

Parameters
pixSize- [optional], a structure with new parameters, may have the following fields
  • .x - physical voxel size in X, a number
  • .y - physical voxel size in Y, a number
  • .z - physical voxel size in Z, a number
  • .t - time difference between the frames, a number
  • .units - physical units for voxels, (m, cm, mm, um, nm)
  • .tunits - time unit
Required fields of pixSize:

Examples:

pixSize.x = 10;
pixSize.y = 10;
pixSize.z = 50;
pixSize.units = 'nm';
imageData.updateParameters(pixSize); // update parameters using voxels: 10x10x50nm in size
imageData.updateParameters(); // update parameters of the dataset
updateParameters(obj); // Call within the class; update parameters of the dataset

References ib_calculateResolution(), and makeViewMatrix().

Here is the call graph for this function:

Member Data Documentation

imageData.axesX

a vector [min, max] with minimal and maximal coordinates of the axes X of the imageAxes axes

imageData.axesY

a vector [min max] with minimal and maximal coordinates of the axes Y of the imageAxes axes

imageData.blockModeSwitch

defines whether to get the whole dataset or only the shown part of it, either 0 or 1

imageData.brush_prev_xy

coordinates of the previous pixel for the Brush tool,

Note
dimensions: [x, y] or NaN
imageData.brush_selection

selection layer during the brush tool movement,

{1:2}[1:height,1:width] or NaN

brush_selection{1} - contains brush selection during drawing brush_selection{2} - contains labels of the supervoxels and some additional information .slic - a label image with superpixels .selectedSlic - a bitmap image of the selected with the Brush tool superpixels .selectedSlicIndices - indices of the selected Slic superpixels .selectedSlicIndicesNew - a list of freshly selected Slic indices when moving the brush, used for the undo with Ctrl+Z .CData - a copy of the shown in the imageAxes image, to be used for the undo brush_selection{3} - a structure that contains information for the adaptive mode: .meanVals - array of mean intensity values for each superpixels .mean - mean intensity value for the initial selection .std - standard deviation of intensities for the initial selection .factor - factor that defines variation of STD variation

Note
the brush_selection is modified with respect to and crop of the image within the viewing window
imageData.colors

number of color channels

imageData.current_yxz

a vector to remember last selected slice number of each yx, zx, zy planes,

Note
dimensions:
[1 1 1]
imageData.hLabels

a handle to class to keep labels

imageData.hMeasure

a handle to class to keep measurements

imageData.hROI

handle to ROI class, roiImage

imageData.img

a property to keep the Image layer.

Note
The Image layer dimensions:.

Referenced by addColorChannel(), clearContents(), clearSelection(), convertImage(), insertSlice(), and replaceDataset().

imageData.img_info

information about the dataset, an instance of the containers.Map class Default keys:

  • ColorType - 'grayscale'
  • ImageDescription - ''
  • Height - 1
  • Width - 1
  • Stacks - 1
  • XResolution - 1
  • YResolution - 1
  • ResolutionUnit - 'Inch'
  • Filename - 'none.tif'
  • SliceName - [optional] a cell array with names of the slices; for combined Z-stack, it is a name of the file that corresponds to the slice. Dimensions of the array should be equal to the obj.no_stacks

Referenced by insertSlice(), and replaceDataset().

imageData.imh

handle for the currently shown image

imageData.Ishown

a property to keep the currently displayed image in RGB format

Note
Ishown dimensions:
[1:height, 1:width, 1:colors] %
imageData.lutColors

a matrix with LUT colors [1:colorChannel, R G B], (0-1)

Referenced by addColorChannel().

imageData.magFactor

magnification factor for the currently shown image, 1=100%, 1.5 = 150%

imageData.maskExist

a switch to indicate presense of the Mask layer. Can be 0 (no model) or 1 (model exist)

imageData.maskImg

a property to keep the Mask layer

Note
The Mask dimensions are:
When the imageData.model_type == 'uint6', imageData.maskImg = NaN

Referenced by replaceDataset().

imageData.maskImgFilename

file name of the Mask layer image

imageData.maskStat

Statistics for the Mask layer with the PixelList info returned by regionprops Matlab function.

imageData.model

model is a property to keep the Model layer

Note
The model dimensions are

Referenced by setMaterialNames().

imageData.model_diff_max

maximal absolute value in the image model of the diff_map type

imageData.model_fn

model_fn is a property to keep filename of the Model layer

imageData.model_type

The type of a model.

  • uint6 - a segmentation model with upto 63 materials; the Model, Mask and Selection layers stored in the same matrix, to decrease memory consumption;
    Note
    • 10000000 - bit responsible for the Selection layer
    • 01000000 - bit responsible for the Mask layer
    • 00111111 - bits responsible for the Model layer, the maximal number of Materials in this type of model is 63.
  • uint8 - a segmentation model with upto 255 materials; the Model, Mask and Selection layers stored in separate matrices;
  • int8 - a model layer that has intensities from -128 to 128.
  • segm - segmentation, uint8 class
  • diffmap - difference maps, int8 class

Referenced by createModel(), and imageData().

imageData.model_var

model_var is a variable name in the mat-file to keep the Model layer

imageData.modelExist

a switch to indicate presense of the Model layer. Can be 0 (no model) or 1 (model exist)

imageData.modelMaterialColors

a matrix of colors [0-1] for materials of the Model, [materialIndex, R G B]

imageData.modelMaterialNames

an array of strings to define names of materials of the Model

Referenced by getMaterialNames(), and setMaterialNames().

imageData.no_stacks

number of stacks in the dataset

Referenced by updateBoundingBox().

imageData.none

Description of events

when selected two or more curves

Events:
none
imageData.orientation

Orientation of the currently shown dataset,.

  • 4 = the yz plane, default
  • 1 = the zx plane
  • 2 = the zy plane
imageData.pixSize

a structure with diminsions of voxels,

.x .y .z .t .tunits .units

the fields are

  • .x - physical width of a pixel
  • .y - physical height of a pixel
  • .z - physical thickness of a pixel
  • .t - time between the frames for 2D movies
  • .tunits - time units
  • .units - physical units for x, y, z. Possible values: [m, cm, mm, um, nm]
imageData.selection

a property to keep the Selection layer

Note
The selection dimensions:
When the imageData.model_type == 'uint6', imageData.selection = NaN
imageData.slices

coordinates of the shown slice borders

Note
dimensions are
([height, width, color, z],[min max])
  • (1,[min max]) - height
  • (2,[min max]) - width
  • (3,[min max]) - colors , array of color channels to show, for example [1, 3, 4]
  • (4,[min max]) - z - value
  • (5,[min max]) - t - time point
imageData.storedSelection

a buffer to store selection with press of Ctrl+C button, and restore with Ctrl+V

Note
dimensions are
[1:height, 1:width] or NaN
imageData.time

number of time points in the dataset

Referenced by getDataset(), getDatasetDimensions(), and setDataset().

imageData.trackerYXZ

starting point for the Membrane Click-tracer tool

imageData.viewPort

a structure

.min .max .gamma

for image adjustment the fields are

  • .min - a vector with minimal intensities for contrast adjustment
  • .max - a vector with maximal intensities for contrast adjustment
  • .gamma - a vector with gamma factor for contrast adjustment
    Note
    Dimensions of each field is
    [1:colors]
imageData.volren

a structure with parameters for the volume rendering the fields are

  • .viewer_matrix - a viewer matrix generated from the Rotation, Translation and Scaling vectors using makeViewMatrix function
  • .previewScale - scaledown factor for dataset preview during volren
  • .previewIng - scaled down image
  • .showFullRes - switch whether or not render image in full resolution or just preview

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