ImageJ macro for deinterleaving and merging colors - merge

I'm trying to write a macro in Fiji that would deinterleave my original tif file, and then merge the two channels.
name=getTitle();
subname = substring(name, 0,14);
selectWindow(name);
dir = getDirectory("image");
fullname2 = name + " #2";
fullname1 = name + " #1";
run("Deinterleave", "how=2 keep");
selectWindow(name + " #2");
run("8-bit");
selectWindow(name + " #1");
run("8-bit");
run("Merge Channels...", "c1=["fullname2"] c2=["fullname1"] create");
saveAs("Tiff", dir + subname + "_composite.tif");
But there seems to be an error in the 12. line with Merge channels.
I don't get why.
I also tried writing that line like this:
run("Merge Channels...", "c1=[fullname2] c2=[fullname1] create");
But it also doesn't work.
Any ideas on what I'm doing wrong?
Thanks a lot!!

Ok! I figured it out! This is the solution, in case anyone has the same problem.
run("Merge Channels...", "c1=["+fullname2+"] c2=["+fullname1+"] create");

Related

Create a radio group in pdflib with perl

I am trying to create a radio group with pdflib.
This code works:
my $optlist = "required buttonstyle=circle bordercolor={gray 0.8} backgroundcolor={white}";
$p->create_field($llx, $lly, $llx + $width, $lly + $height,"colors.standard", "radiobutton", $optlist);
$p->create_field($llx + 115, $lly, $llx + $width + 115, $lly + $height,"colors.yellow", "radiobutton", $optlist);
$p->create_field($llx + 230, $lly, $llx + $width + 230, $lly + $height,"colors.blue", "radiobutton", $optlist);
When I try to make it as required by Adobe Sign, it gives me errors with either path error or the name does not show up right.
{{Color_es_:signer1:radio(Red)}}
{{Color_es_:signer1:radio(Blue)}}
{{Color_es_:signer1:radio(Green)}}
If we have to use a different perl module we could.
The problem was not with pdflib but with Adobe Sign documentation.
to them
{{Color_es_:signer1:radio(Red)}}
means to put the group names as Color_es_:signer1:radio and the value as Red.
Once we figured that out pdflib worked fine. Hopes this helps someone else.

ultisnips: How to "freeze" vim.current.window.cursor value for snippet

I had a snippet that used to work well (neovim 0.2.0)
snippet #= "comment ===" b
# `!p snip.rv = '=' * (78 - vim.current.window.cursor[1])`
# ${1:comments}
# `!p snip.rv = '=' * (78 - vim.current.window.cursor[1])`
endsnippet
This snippet is basically writing python comments block when triggered,
where the length of "=" depends on the position of the cursor.
For a few days now (I don't know which update makes it failing), the length of "=" is decreasing as long as I type my comment.
It looks like vim.current.window.cursor[1] is constantly re-evaluated.
Any idea how to "freeze" the value?
I finally found:
snippet #= "comment ===" b
`!p
if not snip.c:
width = int(vim.eval("78 - virtcol('.')"))
snip.rv = '# ' + '=' * width`
# ${1:comments}
`!p snip.rv = '# ' + '=' * width`
endsnippet

How to run program with variable command line arguments?

I have the following script:
For $alpha = 1 to 10
For $beta = 1 to 10
Run('"C:\Users\MyProg.exe ' & alpha/10 & ' ' & beta/10 & ' 200 2 0.5'
;some other actions follow
Next
Next
I have checked many times that the string is well-formed, thus I have no idea why the script wouldn't run the program. Could you help me please?
Just replace the ending ' with "') and use proper variable names including the $... like $alpha instead of just alpha. Your syntax check in SciTE should have told you.
For $alpha = 1 to 10
For $beta = 1 to 10
Run('"C:\Users\MyProg.exe ' & $alpha/10 & ' ' & $beta/10 & ' 200 2 0.5"')
;some other actions follow
Next
Next

Scala Process for Linux is stuck

I'm trying to use Scala Process in order to concate two files and send the result to a new file.
The code works fine, but when i remove the permissions to the folder, it seems to be stuck.
Here is the code:
val copyCommand = Seq("bash", "-c", "cat \"" + headerPath + "\" \"" + FilePath + "\"")
Process(copyCommand).#>>(new File(FileWithHeader)).!
Maybe something like this can help (without invoking bash)?
import sys.process._
(Seq("cat", "file-1.txt", "file-2.txt") #>> new java.io.File("files-1n2.txt")).!
I preformed the concatination in the same comend without creating new file and it's work fine:
val copyCommand = Seq("bash", "-c", "cat \"" + headerPath + "\" \"" + FilePath + "\">FileWithHeader")
Process(copyCommand).#!

as400 crtcmd command not created in library

I am making my own command, and so far the cl code that processes the .cmd code works just fine on its own. I can call it and send in the parameters and it does exactly what it needs to do, so I'm assuming that the error must be with the .cmd:
CMD 'DISPLAY SYSTEM LEVEL (DSPSYSLVL) NADIA S.C.'
PARM KWD(OUTPUT)
MIN(1)
TYPE(*CHAR) LEN(8)
RSTD(*YES)
VALUES(*MSGLINE *DISPLAY)
PROMPT('OUTPUT FOR SYSTEM LEVEL')
PARM KWD(SOLUTION)
TYPE(*CHAR) LEN(4)
RSTD(*YES)
VALUES(*YES *NO)
DFT(*NO)
PROMPT('TELL ME HOW YOU DID IT')
PARM KWD(SHOWCMD)
TYPE(*CHAR) LEN(4)
RSTD(*YES)
VALUES(*YES *NO)
DFT(*NO)
PROMPT('SHOW COMMAND')
when I run crtcmd and give the appropriate filenames, I get the message "Command DSPSYSLVL not created in library [library name]." with a CPF0201 message.
I'm still fairly new to the whole system, and I'm really not sure what the problem could be. The job log doesn't provide any new information either...
It may just be a transcription issue but the first thing that stands out is the multi-line format without the continuation character (+):
CMD 'DISPLAY SYSTEM LEVEL (DSPSYSL'
PARM KWD(OUTPUT) +
MIN(1) +
TYPE(*CHAR) LEN(8) +
RSTD(*YES) +
VALUES(*MSGLINE *DISPLAY) +
PROMPT('OUTPUT FOR SYSTEM LEVEL')
PARM KWD(SOLUTION) +
TYPE(*CHAR) LEN(4) +
RSTD(*YES) +
VALUES(*YES *NO) +
DFT(*NO) +
PROMPT('TELL ME HOW YOU DID IT')
PARM KWD(SHOWCMD) +
TYPE(*CHAR) LEN(4) +
RSTD(*YES) +
VALUES(*YES *NO) +
DFT(*NO) +
PROMPT('SHOW COMMAND')
Each PARM is a single entity and must be 'continued' if split onto multiple lines.
The CRTCMD command should generate a spooled file containing more details about the errors.
EDIT: Also the maximum length of the CMD prompt is 30 characters.