-
Notifications
You must be signed in to change notification settings - Fork 2
HowTo
EasyXT is intended to 'feel' more like classical Matlab when communicating with Imaris. A problem when we use the provided ImarisLib.jar file as-is is that it looks more like Java Syntax than Matlab Syntax. For example:
object = parent.GetChild(i-1);
objName = char(object.GetName);
See the char()
cast? We should not have to care that GetName returns a String and not a Char, like Matlab expects. This is why we want to hide such things to get a result closer to this
objName = XT.GetName(object);
Note the XT here is a variable that was initialized by calling:
XT = EasyXT;
Which handled the connection to a currently opened Imaris Session directly.
The idea is to make things Matlab-like. This means that compulsory inputs are hard coded and optional ones are entered 'Property' value pairs.
This means that instead of having explicit inputs that need to be put in a particular order like
my_spots = XT.GetObject('Spots', 1); %(Which won't work, btw)
you can enter something like:
my_spots = XT.GetObject('Type', 'Spots', 'Number', 1);
This selects the first 'Spots'. As such. 'Type' is a Property and 'Spots' is the value of that property. The fact that it is first and before the 'Number' property is a choice, but you could just as easily write
my_spots = XT.GetObject('Number', 1, 'Type', 'Spots');
The first time you start EasyXT, you should use the following command
XT = EasyXT('setup');
This will prompt you to provide the path to the Imaris Executable. This way EasyXT can locate ImarisLib and the XTensions folder. This is then saved to a .txt file for further use.
Next time, all you need to do is run
XT = EasyXT;
If there are no error messages, you're good to go. Don't forget that Imaris needs to be running for it to work.
Suppose you have two Spots objects, Spots 1 and Spots 2 and Spots 2 is currently selected. You can do the following
mySpot = XT.GetObject(); % Returns the current object (Spots 2)
mySpot = XT.GetObject('Type', 'Spots'); % Returns the first Spots object (Spots 1)
mySpot = XT.GetObject('Type', 'Spots', 'Number', 2); % Returns the second Spots object (Spots 2)
If you'd like to ask the user to pick an object, there's the SelectDialog function
name = XT.SelectDialog('Spots'); % This will prompt the user to pick one spots object from a list and return the name
mySpot = XT.GetObject('Type', 'Spots', 'Name', name); % Note that you could omit the type and just get it by name.
If your spots are inside a folder called 'Spots Group', you can define that folder as a parent and grab the objects inside.
theFolder = XT.GetObject('Name', 'Spots Group'); % Grabs the folder in which the spots are
mySpot = XT.GetObject('Number', 2, 'Parent', theFolder); % Selects the second object inside the folder.