# LEVER How Tos This page holds step by step instruction for LEVER's more complex features and functionality ### Adding a new Segmentation algorithm A key feature in LEVER is the ability to add new segmentation algorithm made specifically for your dataset. This allows users to take advantage of the Tracking and Lineaging functionality in LEVER. 1. Making a matlab function to preform the segmentation. The function's first two inputs must be a 2d matrix representing the image data of a single frame and a scalar representing the frame number associated with that image. As an output, the function must return the struct containing the hull fields 'time' 'points' and 'indexPixels.' Save this function under the package "Segmentor" as FrameSegmentor_[ChosenName] 2. Add the created function to the listed segmentation bank in Load.GetSupportedCellTypes.m by creating a new entries into the structs "frameSegAlgorthims" and "SupportedTypes" | Field |Values| | -------- |-------| |name |reference name for algorithm or this cell/microscopy type | |segRoutine |function name for the first segmentation call for this cell type | |resegRoutine |function name for the user editing segmentation algorithm for this cell type| |trackParams |constant values used for the tracking algorithm for this cell type| |leverParams |constant values used for the user based tracking algorithm for this cell type| |channelParams|values that designate channel types and order if applicable|| See example below ```ruby function SupportedTypes = GetSupportedCellTypes() segAlgTemplate = struct('func',{}, 'params',{}); frameSegAlgorithms = [struct('func',{@Segmentation.FrameSegmentor}, 'params',{createParam('imageAlpha', 1.5, [1.0 0.5 5])}); struct('func',{@Segmentation.FrameSegmentor_Adult}, 'params',{createParam('imageAlpha', 1.5, [1.0 0.5 5])}); struct('func',{@Segmentation.FrameSegmentor_Embryonic}, 'params',{createParam('imageAlpha', 1.5, [1.0 0.5 5])})]; SupportedTypes = struct('name',{[]}, 'segRoutine',{segAlgTemplate}, 'resegRoutines',{segAlgTemplate}, 'trackParams',{[]}, 'leverParams',{[]}); SupportedTypes(1).name = 'Adult'; SupportedTypes(1).segRoutine = getAlgorithm('Adult', frameSegAlgorithms); SupportedTypes(1).resegRoutines(1) = getAlgorithm('Adult', frameSegAlgorithms); SupportedTypes(1).trackParams = struct('dMaxCenterOfMass',{40}, 'dMaxConnectComponentTracker',{20}); SupportedTypes(1).leverParams = struct('timeResolution',{5}, 'maxPixelDistance',{40}, 'maxCenterOfMassDistance',{40}, 'dMaxConnectComponent',{40}); SupportedTypes(1).channelParams = struct('channelOrder',{[1]}, 'channelColor',{[1 1 1]}, 'channelFluor',{[false]}); SupportedTypes(2).name = 'Embryonic'; SupportedTypes(2).segRoutine = getAlgorithm('Embryonic', frameSegAlgorithms); SupportedTypes(2).resegRoutines(1) = getAlgorithm('Embryonic', frameSegAlgorithms); SupportedTypes(2).trackParams = struct('dMaxCenterOfMass',{80}, 'dMaxConnectComponentTracker',{40}); SupportedTypes(2).leverParams = struct('timeResolution',{10}, 'maxPixelDistance',{80}, 'maxCenterOfMassDistance',{80}, 'dMaxConnectComponent',{40}); SupportedTypes(2).channelParams = struct('channelOrder',{[1]}, 'channelColor',{[1 1 1]}, 'channelFluor',{[false]}); end ```