M-ANLZ(4)

πŸ“¦
version 0.26.1-gtk3 Β· 2 versions
, in debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ NAME ✨

m-anlz β€” the Analyze (SPM) medical image format, analyzed for (X)MedCon. This page lives in the Kernel Interfaces Manual, bestie, and it's giving "actually kind of simple, don't panic" πŸ’–


πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so this format is a very simple one, no cap. The basic headers get written into one file with the extension .hdr, and the image data goes into a whole separate file with the extension .img. Two files, one vibe. 🫢

Here are the basic defines for the format, verbatim, because I would never do you dirty like that:

typedef struct Header_Key_t{
        Int32  sizeof_hdr;               /* 348 or 148                 */
        char data_type[10];              /* "dsr"                      */
        char db_name[18];                /* filename without extension */
        Int32 extents;                   /* 16384                      */
        Int16 session_error;
        char regular;                    /* 'r'                        */
        char hkey_un0;
} MDC_ANLZ_HEADER_KEY;

#define MDC_ANLZ_HK_SIZE 40
typedef struct Image_Dimensions_t{
        Int16 dim[8];                    /* [0] = # of dimensions      */
                                         /* [1] = X-dim                */
                                         /* [2] = Y-dim                */
                                         /* [3] = Z-dim                */
                                         /* [4] = t-dim                */
                                         /* ...                        */
        Int16 unused[7];
        Int16 datatype;                  /* pixel type                 */
                                         /*  0 = Unknown   1 = one-bit */
                                         /*  2 = Uint8     4 = Int16   */
                                         /*  8 = Int32    16 = float   */
                                         /* 32 = complex  64 = double  */
                                         /*128 = RGB     255 = all     */

        Int16 bitpix;                    /* bits per pixel             */
        Int16 dim_un0;
        float pixdim[8];                 /* [0] = # of dimensions      */
                                         /* [1] = X-dim (mm)           */
                                         /* [2] = Y-dim (mm)           */
                                         /* [3] = Z-dim (mm)           */
                                         /* [4] = t-dim (ms)           */
                                         /* ...                        */
        float funused[6];
        float compressed;
        float verified;
        Int32 glmax,glmin;
} MDC_ANLZ_IMAGE_DIMS;

#define MDC_ANLZ_IMD_SIZE 108
typedef struct Data_History_t{
        char descrip[80];
        char aux_file[24];
        char orient;                     /* patient orientation        */
                                         /* 0 = transverse unflipped   */
                                         /* 1 = coronal unflipped      */
                                         /* 2 = sagittal unflipped     */
                                         /* 3 = transverse flipped     */
                                         /* 4 = coronal flipped        */
                                         /* 5 = sagittal flipped       */

        char originator[10];
        char generated[10];
        char scannum[10];
        char patient_id[10];
        char exp_date[10];
        char exp_time[10];
        char hist_un0[3];
        Int32 views;
        Int32 vols_added;
        Int32 start_field;
        Int32 field_skip;
        Int32 omax, omin;
        Int32 smax, smin;
} MDC_ANLZ_DATA_HIST;

#define MDC_ANLZ_DH_SIZE 200

The way that these structures are defined in the order as they should be found in the file β€” that part is important, don't shuffle them like a playlist. And heads up: the Data_History header is not obliged (it can just... not show up, and that's fine). Also, the SPM Analyze format β€” the one intended for the SPM software β€” differs a little from the normal Analyze format, so don't @ me if you're expecting vanilla.


πŸ”₯ What does this format support (and what does it absolutely not)

  • Color Map β€” grayscale βœ… β€” nothing else ❌
  • File Endian β€” little & big βœ… β€” nothing listed as unsupported ❌
  • Pixeltypes β€” 1-bit, Uint8, Int16, Int32, float, double, (complex) βœ… β€” Int8, Uint16, Uint32, Int64, Uint64 ❌

  • Scaling factors β€” quantify & calibrate factors/image are NOT supported. Periodt.
  • Dimensions/Image β€” different dimensions for each image are NOT supported.
  • Pixeltypes/Image β€” different pixeltypes for each image are NOT supported.

🌸 SPM remarks (iykyk)

  1. imd.funused[0] = the offset
  2. imd.funused[1] = one global scaling factor
  3. The origin (X, Y, Z), read like this:
(Int16)dh.originator[0...1] \
(Int16)dh.originator[2...3]  } =  origin (X, Y, Z)
(Int16)dh.originator[4...5] /

πŸ’œ NOTES πŸ’œ

A note about the image (patient) orientation in SPM, because axes are lowkey the whole plot:

  • X-axis β€” increases from leftside (hand) to rightside (hand).
  • Y-axis β€” increases from posterior (back) to anterior (front).
  • Z-axis β€” increases from inferior (feet) to superior (head).

Like, feet to head, back to front, left hand to right hand. Iconic. πŸ‘‘


πŸ’– FILES πŸ’–

  • /usr/local/xmedcon/source/m-anlz.h β€” The header file.
  • /usr/local/xmedcon/source/m-anlz.c β€” The source file.

πŸ‘‘ SEE ALSO πŸ‘‘

medcon(1), xmedcon(1), xmedcon-config(1)

m-acr(4), m-gif(4), m-inw(4), m-intf(4), m-ecat(4)

medcon(3)


πŸŽ€ AUTHOR πŸŽ€

The (X)MedCon project was originally written by Erik Nolf (eNlf) for the former PET-Centre at Ghent University (Belgium). Absolute legend behavior. 🫢

e-mail: enlf-at-users.sourceforge.net www: http://xmedcon.sourceforge.net


And that's the whole page, bestie! ✨ This was M-ANLZ(4) from the Kernel Interfaces Manual β€” go forth and read those .hdr and .img files, you got this πŸ’…πŸŒˆ

πŸ“¦ where this page comes from