Using CLI software in TPC

These instructions apply to in-house programs which are used by typing commands in command-prompt window (shell). Also some programs with GUI can be used from command prompt (including Carimas™).

Using CLI programs may be awkward for an average computer user, but in frequent use it is more productive than using GUI. It is easy to do file format conversion and other simple tasks quickly for all files with one command. If you need to enter more than just a few commands, or if you are allergic to command prompt, then you should consider executing command-line programs via batch files. It is also possible to develop a simple GUI to command-line software.

CLI in Windows

Windows command prompt window is available in all Windows versions, but it may be found in different places. Up to Windows 7 it can be started by opening Windows Start menu, clicking 'Run', and typing cmd and pressing Enter.

Change the default disk from C: to the disk drive where your data is stored by writing the drive letter (for example S:) and press Enter. Change the working directory to the path where your data is stored with command cd:

S:
cd Research\Neurologia\myname

Then start typing commands as instructed in the analysis guides and by program user help texts. Note that user help texts contain optional and obligatory command line text inside [ ] and < > marks, which are not to be written in command-line.

bash

The Windows command prompt windows can only be used to execute programs that are compiled for Windows. However, in Windows 10 Store, Windows Subsystem for Linux (WSL) is available for free; this adds Bash on Ubuntu on Windows terminal to your Windows 10 platform, enabling you to execute and even compile Linux CLI programs in it.

In Windows 7 you can install Git for Windows, which provides Git bash, that can be used to execute scripts made for Linux; in Git for Windows, applications can and must be compiled for Windows.

CLI in Linux

Command-line programs can of course be used in Linux as well (or better) than in MS Windows. Command prompt window (terminal) can be started from Linux menus.

Linux also has a lot of built-in tools for data handling, for example for processing text files.

CLI in macOS

Command-line programs could be used in macOS, if they were compiled for it. Applications in TPCCLIB are compiled for macOS (in addition to Windows and Ubuntu Linux), but all applications are not yet included in the library. See the instructions for installing TPCCLIB applications on macOS.

Frequently asked questions

Q: How do I run the software on PC/Windows? When I click the program icon, I see only a flashing window and nothing else happens.

A: Most software are designed to run on all platforms (PC and SUN, Windows, Solaris, Linux, and macOS). Therefore the user-interface is very simple, and they must be operated from CLI (command line).

S: Open the "Command prompt" window. On Windows XP it is found in Start > Programs > Accessories > Command Prompt. If used frequently, make a shortcut (Send to Desktop). Then you can write the program name there and press Enter.

Q: I am working on my PC/Windows and try to run the software in command prompt window. It prints an error message "'XXX' is not recognized as an internal or external command, operable program or batch file."

A: You have not installed that program on your PC. In PET Centre and hospital network the software are automatically installed (on mapped network drive S: in folder petsoftware\bin), but if they are not, then contact the IT group.

S: Outside PET Centre you have to download and install the software by yourself.

Q: I am working on my PC/Windows and try to run a program in command prompt window. The program does not work as the instructions say that it should do.

A: Check that you have the correct software version. Run the program with command-line option -v, and check that the version matches with the number that you can see in the documentation and in your analysis instructions. Check again that you have given correct command line parameters, without the [ ] and < > marks.

S: Download and install the latest version from http://www.turkupetcentre.net/petanalysis/sw_pet.html, or, in TPC, enter the command with appropriate program version, e.g. imgflow_0_7_4.

Q: Can I run the analysis programs in Linux?

A: Yes, most in-house software is compiled for Linux.

S: Compiling the C codes is actually easier in Linux than in Windows. No modification of source codes or makefiles is necessary. Please see the instructions for SW development for Linux in TPC. Debian Linux 64-bit executables can be downloaded from our SW download page.

Q: I get a nasty Windows error message when I try to run a .NET 2.0 program before it even starts.

A: Your computer may be set up to prevent running programs from network.

S: Give this command as administrator (modifying the path if necessary) to increase the permissions: C:\"WINDOWS\Microsoft.NET\Framework\v2.0.50727"\CasPol.exe -quiet -m -cg 1.2. FullTrust.

Q: Can I use file names with spaces?

A: Space character in file or path names is not recommended, because it may complicate analysis, backup and sending data to elsewhere.

S1: Rename files to have for example _ instead of spaces.

S2: Write file name inside double quotation marks "", and use analysis programs with version number (for example: taclist "Jaska Jokunen.dft").

Q: Can I use file names including patients name with scandinavian characters (ä, ö, å)?

A: Preferably not, because names must not be seen outside hospital, and because special characters may not work with certain programs, and especially with scripts.

S: You may need to enter command chcp 1252 once in every command prompt window before using file or path names with ä, ö, or å, and you may need to write file names inside double quotes, and give analysis program name with version number.

Q: How to avoid "out of memory" error when working with large image data?

A: Image files may take memory twice as much as is the size of image data. This can cause the memory to run out in computers meant for regular office work.



See also:



References:

Blum R, Bresnahan C. Linux Command Line and Shell Scripting Bible. 3rd ed., Wiley, 2015, ISBN 978-1-118-98384-3.

Janssens J. Data Science at the Command Line. O'Reilly, 2014. ISBN 978-1-491-94785-2.

van Vugt S: Beginning the Linux Command Line, 2nd edition. Apress, 2015. ISBN 978-1-4302-6829-1.

Vossen JP, Albing C: bash Cookbook, 2nd edition. O'Reilly Media, 2017. ISBN 9781491975329.


ThePracticalDev ThePracticalDev


Tags: , , , ,


Updated at: 2023-09-11
Created at: 2009-05-22
Written by: Vesa Oikonen