Run Fiji from command line? - command-line

Here is what I want to do:
I want to run Fiji from command-line, to do something like batch image processing. I imagine by typing some command at some console, some batch file can be launched to execute some macro. In this case, the Fiji GUI will not show up, but the processing will be running behind the scene.
Here is what I have done:
I simply tried the FIji headless , but when I tried ./Build.sh misc/headless.jar as the web suggested, the console prompt returns could not find project for artifactID 'headless';
I also tried Javassist,pretty much just built it, but have not figure out how to use it.
Here is the problem I am encountering:
When I type fiji --headless HelloWorldMacro.ijm, nothing happened, where inside the HelloWorldMacro.ijm is printf("Hello world!");
I am wondering, how should I run FIji from command line? Is what I have tried on the right track? If so, what additional work/changes needed to make it work? Thanks a lot.

For the record:
Johannes Schindelin answered this question on the ImageJ mailing list (additionally pointing out why the ImageJ mailing list is the most suitable place for this kind of discussions).
In short, either of the following should work:
fiji --headless --console HelloWorldMacro.ijm
or
fiji --headless HelloWorldMacro.ijm > output.txt
cat output.txt

Related

Can you take terminal commands and use them in a Python program?

In another thread, there is an excellent step by step to completely uninstall VSCode off my Mac so I could truly start over. The steps work perfectly. In my question to try a lot of configurations and extensions, I mess up VSCode pretty often.
Is there a way to build Python file so when I need to uninstall, I can open a terminal window and run a program and be ready to try again? It is not the end of the world to have to type one line at a time, I'm just assuming this is common and been fixed. I'm just not able to find the how.
After doing some studying of Python, I found the OS module. Once you import it, most, if not all the commands to clean up directories, delete files, etc. are in there. I took the list of commands that ran in a ZSH terminal and converted them to os.[relevantcommand] and it worked fine. Now, I can easily clean out a VSCode install by running my VSCleanup.py and start over.

Emacs term pastes strange line into terminal when changing directories

I am using fish terminal inside of Emacs term
My normal prompt on load looks like the following
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
$>
Ok, when I load fish term inside of term.el it looks like this
Welcome to fish, the friendly interactive shell
Type helpB for instructions on how to use fish
7;file://Collins-MacBook-Air.local/Users/collinbell/Programs/riddley⏎
$>
A cd command in my normal terminal looks like this
$> cd ~/
$>
However in the emacs term.el it looks like this
$> cd ~/
7;file://Collins-MacBook-Air.local/Users/collinbell⏎
$>
I have no idea why it is pasting the cwd into the buffer, but it does it every time a directory changes. Emacs also makes the system sound after this, while other commands like ls do not make the system sound.
This is obviously not the biggest issue in the world, but I do run clear as a pre-command to keep my terminal looking clean (although I turned it off for this example) and Emacs pasting this line into the buffer really messes with sublime usage.
You seem to be experiencing a known issue.
Try this fix:
In your fish config file ~/.config/fish/config.fish add the following:
function fish_title
true
end
Also, see this from the fish documentation, though according to the github issue, the fix suggested in the docs might not work, while the above function does.
According to the fish documentation, this is what's going on:
Fish is trying to set the titlebar message of your terminal. While
screen itself supports this feature, your terminal does not.
Unfortunately, when the underlying terminal doesn't support setting
the titlebar, screen simply passes through the escape codes and text
to the underlying terminal instead of ignoring them. It is impossible
detect and resolve this problem from inside fish since fish has no way
of knowing what the underlying terminal type is. For now, the only way
to fix this is to unset the titlebar message, as suggested above.

Script in PATH Mac OSX terminal not working

I have the following script in my /path/to/startupscripts directory, so I can open the emacs GUI with the command 'emacs':
#!/bin/sh
/Applications/Emacs.app/Contents/MacOS/Emacs "$#"
I edited my ~/.bash_profile and added the following line
export PATH=/path/to/startupscripts/emacs:$PATH
However, the script is not working because when I type in 'emacs' into the command line emacs still opens within terminal and not the GUI like I want. Also, when I am in the /path/to/startupscripts directory and I can execute and run the script with
chmod +x emacs
./emacs
but even when I type 'emacs' afterwards it still opens within terminal. I am a bit of a beginner, and I think I am missing something painfully obvious.
The PATH should contain a directory name where your script(s) can be found, not the name of your individual script.
You probably need to source your .bash_profile:
source ~/.bash_profile
No changes made in your profile will be applied unless you source the profile or log out and back in.
Aside from that every looks like it should work.
However you may want to consider just using an alias instead of a script for this. This can be done by adding this to your profile:
alias emacs=/Applications/Emacs.app/Contents/MacOS/Emacs
That's probably a cleaner way to get the functionality you want without adding more to your PATH variable.
I hope that helps! [insert obligatory comment about how you should be using vim and not emacs :P]

Notepad++ using "Run" command in a macro

Is it possible to create a macro in Notepad++ that is able to utilize the "Run" command so that I may call an external .exe to operate on the file specified? I am able to do it manually, but when I create a macro that includes the run (F5) and give it a specified command it fails to execute. Is this because the run command isn't supported when creating macros? If so, is there a work-around method?
Thanks
edit: to add context -- I've written a couple ruby scripts to facilitate data-entry that's done using notepad++, and would like to integrate them to the editor. Having them run by a shortcut method created by recording a macro seems to be the best way to do this, unless it's not possible to utilize the run command.
FWIW The Zeus and Zeus Lite editors can do this.
You can do it with the NppExec plugin (available in the Notepad++ wiki ). It allows you to create mini-scripts with keywords that perform commands.
You will also be able to add your script in the contextual (right-click) menu, or assign a shortcut to it.
I personaly uses it to saves a sql file, place myself in the current directory, and then executes isql.exe (external executable) on that file. That simple script transforms my Notepad++ into a rather handy SQL IDE.
I don't think you do it using only Notepad++.
Please see this thread:
http://sourceforge.net/projects/notepad-plus/forums/forum/331754/topic/4805532
If I understood you correctly, you have it all set up but are having issues with running it through Notepad++'s run command?
If so, try what I mentioned here.
I had similar issues with running php compiler and resolved it with the "cmd /c" added like in that mentioned example. And a "& pause" at the end, just so I see what goes on.

eclipse sh edit and run

What would be the best way to run and edit a .sh script within Eclipse?
Regarding the editing part, I've found the ShellEd plugin, but it seems very minimalistic, is there no alternative?
Regarding the running part, I've found that there's a built in console that can be accessed by right clicking the .sh, then clicking 'remote system view', then clicking 'local'. But it's very minimalistic, there is not even tab completion. I would like something that could be as close to Bash as possible.
You may find these two hyperlinks to be useful:
http://www.linuxforums.org/forum/applications/132034-running-shellscripts-eclipse.html
Bash script plugin for Eclipse?
I do not know much about Eclipse. I prefer Geany; however, it does not execute shell scripts.