fiji macro how to use given luts and plugin - macros

I need to write a macro in Fiji.
First I record a macro to do what I wanted. The result was the following:
run("Size...", "width=512 height=512 depth=497 average interpolation=None");
run("Rotate 90 Degrees Right");
run("Flip Horizontally", "stack");
run("Make Substack...", " slices=5-300");
run("isolum_cbs_strict");
run("Z Code Stack", "depth=Current");
run("Z Project...", "start=1 stop=296 projection=[Standard Deviation]");
I would like to do it in a batch mode. So I write a macro myself:
file = getArgument;
if (file=="") exit ("No argument!");
setBatchMode(true);
file_vasc = file;
open(file_vasc);
run("Size...", "width=512 height=512 depth=497 average interpolation=None");
run("Rotate 90 Degrees Right");
run("Flip Horizontally", "stack");
run("Make Substack...", " slices=5-200");
run("isolum_cbs_strict");
run("Z Code Stack", "depth=Current");
run("Z Project...", "start=1 stop=196 projection=[Max Intensity]");
file_vasc_out = replace(file, "\\_pvar-8bit_combined.tif", "_maxZprojection.tif");
saveAs("Tiff", file_vasc);
However I got macro errors as undefined variable for run("isolum_cbs_strict") and a unrecognized command for run("Z Code Stack", "depth=Current").
How can I access to this lut which is in:
C:\Program Files\Fiji.app\luts\isolum_cbs.lut
and to the plugin which is in:
C:\Program Files\Fiji.app\plugins\Stacks - Z-functions
Thanks for your help,
Corinne

A solution is to provide -ijpathpath as argument to Fiji. Then, luts, plugins, etc. are all derived relatively to this path. In other words, pass the following argument:
-ijpathpath "C:\Program Files\Fiji.app"
Note that, importantly, you must not have a backslash at the end of the path.

Instead of using the java runtime to start Fiji/ImageJ, use the provided launcher execuable to run your macro:
fiji-win64.exe D:\your_macro.ijm D:\your_image.tif
or (which is essentially the same):
ImageJ-win64.exe D:\your_macro.ijm D:\your_image.tif
The ImageJ launcher takes care to provide all the necessary environment to run macros and scripts from the command line. It even provides a --headless option to run your script without even showing the user interface. See Fiji's Headless documentation.

Related

LOAD_GLOBAL(dispatcher) appearing when I "Step Into" in VSCode

I am on a Windows 10 computer running a simple tensorflow 2.1 script in VSCode. For some reason when I step into a function the IDE takes me to an odd file with the following written in it:
LOAD_GLOBAL(dispatcher), LOAD_FAST(args), LOAD_FAST(kwargs), CALL_FUNCTION_EX{1}, STORE_FAST(relevant_args)
return implement_array_function(
implementation, dot, relevant_args, args, kwargs)
Here is the line I'm trying to step into (standard tensorflow/keras, so I didn't think it was worth adding more context):
history = model.fit(training_data, epochs=num_epochs, validation_data=validation_data)
If I step through the file bit by bit, it sometimes changes to say this:
LOAD_GLOBAL(dispatcher), LOAD_FAST(args), LOAD_FAST(kwargs), CALL_FUNCTION_EX{1}, STORE_FAST(relevant_args)
return implement_array_function(
implementation, iscomplexobj, relevant_args, args, kwargs)
Or this:
LOAD_GLOBAL(dispatcher), LOAD_FAST(args), LOAD_FAST(kwargs), CALL_FUNCTION_EX{1}, STORE_FAST(relevant_args)
return implement_array_function(
implementation, stack, relevant_args, args, kwargs)
This happens with both VSCode and VSCode - Insiders. What is this and how can I avoid it? I don't know where to start with this so I don't know what other information to provide, so please let me know. In case it's relevant, I haven't changed the "justMyCode" flag, so I assume it is still set to True.

Debugging test cases when they are combination of Robot framework and python selenium

Currently I'm using Eclipse with Nokia/Red plugin which allows me to write robot framework test suites. Support is Python 3.6 and Selenium for it.
My project is called "Automation" and Test suites are in .robot files.
Test suites have test cases which are called "Keywords".
Test Cases
Create New Vehicle
Create new vehicle with next ${registrationno} and ${description}
Navigate to data section
Those "Keywords" are imported from python library and look like:
#keyword("Create new vehicle with next ${registrationno} and ${description}")
def create_new_vehicle_Simple(self,registrationno, description):
headerPage = HeaderPage(TestCaseKeywords.driver)
sideBarPage = headerPage.selectDaten()
basicVehicleCreation = sideBarPage.createNewVehicle()
basicVehicleCreation.setKennzeichen(registrationno)
basicVehicleCreation.setBeschreibung(description)
TestCaseKeywords.carnumber = basicVehicleCreation.save()
The problem is that when I run test cases, in log I only get result of this whole python function, pass or failed. I can't see at which step it failed- is it at first or second step of this function.
Is there any plugin or other solution for this case to be able to see which exact python function pass or fail? (of course, workaround is to use in TC for every function a keyword but that is not what I prefer)
If you need to "step into" a python defined keyword you need to use python debugger together with RED.
This can be done with any python debugger,if you like to have everything in one application, PyDev can be used with RED.
Follow below help document, if you will face any problems leave a comment here.
RED Debug with PyDev
If you are wanting to know which statement in the python-based keyword failed, you simply need to have it throw an appropriate error. Robot won't do this for you, however. From a reporting standpoint, a python based keyword is a black box. You will have to explicitly add logging messages, and return useful errors.
For example, the call to sideBarPage.createNewVehicle() should throw an exception such as "unable to create new vehicle". Likewise, the call to basicVehicleCreation.setKennzeichen(registrationno) should raise an error like "failed to register the vehicle".
If you don't have control over those methods, you can do the error handling from within your keyword:
#keyword("Create new vehicle with next ${registrationno} and ${description}")
def create_new_vehicle_Simple(self,registrationno, description):
headerPage = HeaderPage(TestCaseKeywords.driver)
sideBarPage = headerPage.selectDaten()
try:
basicVehicleCreation = sideBarPage.createNewVehicle()
except:
raise Exception("unable to create new vehicle")
try:
basicVehicleCreation.setKennzeichen(registrationno)
except:
raise exception("unable to register new vehicle")
...

Check if a command exists using qmake

I am working on a project which incorporates C code, as well as (MASM-like) assembly. I want to be able to compile it on Linux, as well as Windows, thus I am using a third-party assembler (jwasm) as follows:
QMAKE_PRE_LINK += jwasm -coff -Fo$$assembly_obj $$PWD/assembly.asm
(here, assembly_obj holds the directory I want jwasm to save the output. Oh, by the way: when using jwasm it is critical to first specify all the parameters, and only at the end the input files, otherwise it will ignore the parameters)
To make it easier for other people to compile the project, I would like to be able to check if jwasm is in their path, and if not, emit an error() telling them how to fix this. However, I am not sure if this is even possible using qmake. I have tried:
exists("jwasm") { # Always false
message("jwasm found!")
}
as well as:
packagesExist(jwasm) { # Always true
message("jwasm found!")
}
I have looked around in the qmake docs, but couldn't find any other alternatives...

Creating an instance of a class

Trying to create my first class in MATLAB but obviously am missing something.
So here is my class below.
classdef MyBank
properties
Balance;
CustName;
end
methods
function BA = MyBank()
BA.Balance = 0;
BA.CustName = 'Mr Blogs'
end
end
end
In the same path I have a m file. In this file I try to create an object from my class like so,
bank = MyBank;
I get the error message 'undefined function or variabel 'MyBank'? Not sure what I'm missing as the examples I have seen appear to do the same thing?
Also when typing BA in my constructor should there be any intellisense? Find it quite painful coding in Matlab.
Matlab doesn't understand ".
You shuold use BA.CustName = 'Mr Blogs'
Are you using Matlab or Octave? Octave understands ", but last time I checked classdef is not working.
To find the constructor with "intellisense", you should type "My" and then press tab. At least for me this works.
If this doesn't work for you, check that your file is named MyBank.m and double check if it is in your current working folder. Open the file in your edior window and execute it by pressing F5. Then a dialog should pop up, if your in another working directory.

Windows Automation with Matlab

Hello I'm trying to control FastHenry2 via Windows automation with Matlab.
I'm new to that topic. If I understood everything right I have to open it:
ax=actxserver('FastHenry2.Document');
and than run the function I want with the handle?
ax.Run('coils1.inp')
but that doesn't work. Matlab can't find Run and uses run instead, which is some build in Function not related at all with the problem. Also all other Function this UI should support don't work either. For Example FastHenry2.IsRunning or FastHenry2.GetInductance. So I guess I do something wrong with the whole UI handling. FastHenry provides an example script using VBS which I attached bellow and since it works fine FastHenry should be installed right on computer. I'm thankful for every hint I can get.
so long
eactor
The following VBS example works fine
Dim FastHenry2
pathPos = InstrRev(Wscript.ScriptFullName, Wscript.ScriptName)
path = left(Wscript.ScriptFullName, pathPos-1)
Set FastHenry2 = CreateObject("FastHenry2.Document")
couldRun = FastHenry2.Run("""" + path + "coils1.inp""")
Do While FastHenry2.IsRunning = True
Wscript.Sleep 500
Loop
inductance = FastHenry2.GetInductance()
WScript.Echo "Coils1 mutual inductance is " + CStr(inductance(0, 0, 1))
FastHenry2.Quit
Set FastHenry2 = Nothing
You might need to use an alternate syntax. Instead of
FastHenry2.Run('coils1.inp')
try this.
invoke(FastHenry2, 'Run', 'coils2.inp')
I've had to do this for some methods on the Excel.Application ActiveX control. I'm not clear why the first syntax doesn't work in some cases.