Installing Amide

Amide compilation

Amide is a nice visualization tool, and also free. However, this means one has to put some effort in installing it. First, to get the source, you need to have Mercurial version control software installed, because amide is maintained using it. Then go to your software directory, and clone the software tree

#>hg clone http://hg.code.sf.net/p/amide/code amide

There is a nice README file in the created amide/amide-current directory, which is helpful in guidance of the installation procedure.

Dependencies

XMEDCON

Download the code from (X)MedCon, which is a tgz packet. Untaring it, you have to run configure script:

#>./configure --prefix=/something/useful

and complete the installation with:

#>make
#>make install

DCMTK

DCMTK is useful for DICOM file formats. Download latest snapshot from download site. Extract. For me, this looks like:

#>tar xvzf [core]/packages/dcmtkX.X.X_YYYYMMDD.tar.gz [core]/src/

Create install directory

#>mkdir [core]/install/dcmtkX.X.X_YYYYMMDD

where X.X.X is dcmtk version (3.6.1) and YYYYMMDD is the date. To build libraries, I used cmake, which requires yet another directory:

#>mkdir [core]/build/dcmtkX.X.X_YYYYMMDD
#>cd [core]/build/dcmtkX.X.X_YYYYMMDD
#>ccmake ../../src/dcmtkX.X.X_YYYYMMDD

In ccmake windows I set BUILD_BINARIES to OFF and BUILD_SHARED_LIBRARIES to ON. With [g], the makefiles are generated, and software is compiled using:

#>make
#>make install

Although not strictly neccesary, the binaries were created via the old automake way:

#>./configure --prefix=/something/useful

During compilation, these warnings are quite frequent:

# warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"

The Linux Programming Interface has a nice explanation on why that happens and how to resolve it, should it be desired.

Compiling amide

Amide is getting old. The problem is, that source code is not keeping up with changes in supporting tools, like autotools. So compiling it is starting to become a problem.

The most challenging part is to include dcmtk, whose location is hardwired in the configuration code. So one has to replace AMIDE_LIBDCMDATA_LIBS and AMIDE_LIBDCMDATA_CFLAGS with appropriate locations within the configure.ac file. So, first there is a script which assembles include paths and libraries:

DCMTK_PATH=/path/to/dcmtk/installation

DCMTK_LIBPATH=${DCMTK_PATH}/lib
CFLAGS="-I${DCMTK_PATH}/include
LIBS="-L${DCMTK_LIBPATH}"

for f in `ls ${DCMTK_LIBPATH}/*.so` ; do
    lb=`basename $f | sed 's%lib\(.*\).so%\1%'`;
    LIBS="${LIBS} -l${lb}"
done;

Then, those paths (I call them 'LIBS' and 'CFLAGS') must be replaced in configure.ac:

mv configure.ac configure.ac.orig

LIB_TAG="AMIDE_LIBDCMDATA_LIBS";
CFG_TAG="AMIDE_LIBDCMDATA_CFLAGS";

cat configure.ac.orig | sed 's%'"${LIB_TAG}"'=\(.*\)$%'"${LIB_TAG}"'="'"${LIBS}"'"%' |\
        sed 's%'"${CFG_TAG}"'=\(.*\)$%'"${CFG_TAG}"'="'"${CFLAGS}"'"%' > configure.ac

Because of changes to configure.ac, configure must be recreated using autoconf. But since autoconf has moved forward from 1.14 used for generation of aclocal.m4, also aclocal.m4 must be remade through aclocal. However, the amide creators were incosistent enough to leave some of the macro definitions in aclocal.m4. To be consistent, however, this pieces must be moved to separate files under m4 directory. So move:

 dnl AM_PATH_XMEDCON([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
    ...
    rm -f conf.xmedcontest
 ])

to a file named xmedcon.m4 under m4 directory. There is only one more definition that has to be moved, the script GTK_DOC_CHECK, and:

 dnl   GTK_DOC_CHECK([minimum-gtk-doc-version])
    ...
    AM_CONDITIONAL([GTK_DOC_USE_REBASE], [test -n "$GTKDOC_REBASE"])
 ])

goes to gtkdoccheck.m4 in m4.

Then, aclocal can be run to match autotools version, and change in AMIDE_LIBDCMDATA variables can be propagated to Makefiles. Full commands are

#> aclocal -I m4
#> autoconf
#> XMEDCON_CONFIG=/path/to/xmedcon/xmedcon-config\
   LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/path/to/xmedcon/lib\
   ./configure --enable-libdcmdata --disable-doc --prefix=/something/useful/amide
#> make
#> make install

links

social