The source code is distributed in a tar archive named cpsm.tar.
This
tar file contains its own extraction script. By default it will extract all 22
of the subdirectories into your HOME directory. To define another destination
subdirectory for the files, first define the environment variable
PSM_HOME
to be the new destination. For example, setenv
PSM_HOME /usr/local/src/psm
or PSM_HOME=/usr/local/src/psm ;
export PSM_HOME
Copy cpsm.tar into whatever directory you have chosen for PSM_HOME. Then
cd $PSM_HOME tar xvf cpsm.tar bin/ctarx.sh bin/ctarx.sh
Additional software is required for Windows to extract files from cpsm.tar such as 7-Zip, WinRAR, WinZIP, or PowerArchiver.
Extract the contents of cpsm.tar to a folder, e.g.,
C:\c\psm
The first time the source code is unpacked, a configuration file must be generated to specify compilation flags for the particular system.
In the psmlib subdirectory, copy and rename the file psmlocalflags_default.mk to psmlocalflags
Edit psmlocalflags and read through the file. The main points are -
gcc --version
to display the version).
In the psmlib subdirectory, select either psmlocalflags_mc_default.mak if using Microsoft Visual Studio C++, or psmlocalflags_bc_default.mak if using Borland C++. Copy and rename this file to psmlocalflags_mc or psmlocalflags_bc respectively.
To created compressed NIFTI images, the zlib static library is required. By default, zlib support is switched off in psmlocalflags_mc. However, the file contains brief instructions regarding how to compile zlib. Once the zlib library has been created, the four lines in psmlocalflags_mc starting ZLIB_... can be uncommented which will allow zlib support to be included during future compilations. The unzipped zlib folder should be renamed just zlib and placed in the ext subdirectory. After compiling, the required library file should be ext\zlib\zlib.lib
Older versions of Microsoft Visual C++ can give an internal compiler error when trying to compile and optimise certain files. To avoid this compiler error, edit the psmlocalflags_mc file and change the optimisation flag from /O2 to /Ot in the bottom two lines of this file.
If the configuration file has been editted appropriately, above, then compilation should be straightforward.
Either change into each subdirectory in turn and type make
or
change into the bin subdirectory and type ./makeall
If the Openwindows/xview headers and libraries are not installed, the graphical programs will fail to compile. However, the command line programs should still compile fine.
To allow compilation with different architectures in the same directory structure, the object and executable files are suffixed with the name of the operating system. For example, compiling ptoa under Linux will produce an executable named ptoa_Linux and under MacOS 10.5 an executable named ptoa_Darwin. The shell script ptoa in the bin subdirectory should call the correct binary for the current architecture, and so the recommendation is that both the general shell script and architecture-specific binary be included in the PATH.
The file dicom3.tpl in ext should also be available in the PATH.
Open a Command Window. Ensure that the compiler has been set in the PATH. For example, in recent versions of Microsoft Visual Studio, open a Visual Studio Command Prompt from the Visual Studio Tools submenu.
Change into each subdirectory in turn (e.g., cd
\c\psm\utils
) and type
nmake /f makefile_mc.mak
make -f makefile_bc.mak
The executables are created in the same subdirectory as the source code, and should be copied into the appropriate Windows PATH manually.
The file dicom3.tpl in ext should also be copied to the same location as the executables in the PATH.