home *** CD-ROM | disk | FTP | other *** search
/ ftp.pasteur.org/FAQ/ / ftp-pasteur-org-FAQ.zip / FAQ / medical-image-faq / part3 < prev    next >
Text File  |  2003-12-22  |  86KB  |  2,390 lines

  1. Path: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!newshub.sdsu.edu!elnk-nf2-pas!elnk-pas-nf1!newsfeed.earthlink.net!priapus.visi.com!orange.octanews.net!news.octanews.net!news-out.visi.com!petbe.visi.com!newsfeeds-atl2!c03.atl99!news.webusenet.com!diablo.voicenet.com!news2.epix.net!news1.epix.net!dclunie.com
  2. Newsgroups: alt.image.medical,comp.protocols.dicom,sci.data.formats,alt.answers,comp.answers,sci.answers,news.answers
  3. Message-ID: <20031221091625.3015.3@dclunie.com>
  4. Expires: 21 Jan 2004 00:00:00 GMT
  5. Subject: Medical Image Format FAQ, Part 3/8
  6. From: dclunie@dclunie.com (David A. Clunie)
  7. Followup-To: alt.image.medical
  8. Reply-To: dclunie@dclunie.com (David A. Clunie)
  9. Approved: news-answers-request@MIT.EDU
  10. Summary: This posting contains answers to the most Frequently Asked
  11.          Question on alt.image.medical - how do I convert from image
  12.          format X from vendor Y to something I can use ? In addition
  13.          it contains information about various standard formats.
  14. Lines: 2368
  15. Date: Sun, 21 Dec 2003 14:16:37 GMT
  16. NNTP-Posting-Host: 216.37.230.197
  17. X-Complaints-To: abuse@epix.net
  18. X-Trace: news1.epix.net 1072016197 216.37.230.197 (Sun, 21 Dec 2003 09:16:37 EST)
  19. NNTP-Posting-Date: Sun, 21 Dec 2003 09:16:37 EST
  20. Xref: senator-bedfellow.mit.edu alt.image.medical:12456 comp.protocols.dicom:11712 sci.data.formats:3061 alt.answers:70770 comp.answers:55775 sci.answers:15696 news.answers:263501
  21.  
  22. Archive-name: medical-image-faq/part3
  23. Posting-Frequency: monthly
  24. Last-modified: Sun Dec 21 09:16:34 EST 2003
  25. Version: 4.26
  26.  
  27. 3.  Proprietary Formats
  28.  
  29.     3.1 Proprietary Formats - General Information
  30.  
  31.     3.1.1 SPI (Standard Product Interconnect)
  32.  
  33.           Used for files exported from:
  34.  
  35.  
  36.         - Siemens Somatom Plus - Siemens Magnetom Impact - Siemens
  37.         Magnetom SP - Siemens Magnetom Vision - Philips Gyroscan S5 - ?
  38.         what else ?
  39.  
  40.  
  41.           SPI is a standard based on the old ACR/NEMA 1 standard, devised I
  42.           gather by Siemens and Philips, for use in a PACS environment.  Who
  43.           currently maintains it and whether or not Sienet PACS systems are
  44.           based on it, I am not certain.  Many machines in the workplace use
  45.           it in some shape or form, or can export files in SPI format.  I
  46.           gather it has been around since 1987 or so, but I do not yet have
  47.           access to the reference documents, nor permission to disclose
  48.           their contents, so much of the following is guess work or hearsay
  49.           from Usenet.
  50.  
  51.  
  52.           Like the ACR/NEMA standard, SPI is designed to define
  53.           interconnections between pieces of equipment from the physical
  54.           level through to the application level.  Where appropriate it
  55.           utilized relevant parts of ACR/NEMA.  Unlike ACR/NEMA, I gather
  56.           that SPI is aware of the concept of networks, objects containing
  57.           information, the need to uniquely identify instances of objects,
  58.           and defines an offline file format.  Thus in many ways it sounds
  59.           like the missing link between ACR/NEMA 2.0 and DICOM 3.0.
  60.  
  61.  
  62.           SPI makes use of ACR/NEMA data elements and groups, and in
  63.           addition provides "shadow" private odd-numbered groups as dictated
  64.           by the ACR/NEMA standard for the purpose of storing additional
  65.           items of information, including a means of uniquely identifying
  66.           objects, as well as allowing for enumerated values for elements
  67.           beyond those defined by ACR/NEMA.  SPI also defines a byte order
  68.           for offline storage of data streams.  Integers are stored in
  69.           little endian format (least significant byte first).
  70.  
  71.  
  72.           The private groups mechanism works as follows.  For each odd
  73.           numbered group (other than 0x0001,0x0003,0x0005,0x0007 and
  74.           0xffff), the elements 0x00nn in the range 0x0010 through 0x00ff
  75.           contain a single valued string identification code that identifies
  76.           the creator of the range of elements 0xnn00 through 0xnnff.  Neat
  77.           eh ?  For example:
  78.  
  79.  
  80.     (0x0009,0x0010) PrivateCreatorDataElement (0x0009,0x0011)
  81.     PrivateCreatorDataElement ...  (0x0009,0x1000) DavidElement1
  82.     (0x0009,0x1001) DavidElement2 ...  (0x0009,0x1100) HarryElement1
  83.     (0x0009,0x1101) HarryElement2
  84.  
  85.  
  86.           You get the idea.  The nice thing about this scheme is that each
  87.           creator dictionary considers its elements numbered from 0x0000,
  88.           but these will be remapped to a block of elements depending on
  89.           exactly which PrivateCreatorDataElement is used in the particular
  90.           data set.  Hence multiple groups from different creators can
  91.           co-exist happily in the same data set, and vary in position
  92.           between data sets.
  93.  
  94.  
  95.           Note that the group number IS taken into consideration ...  a
  96.           private element with the same element offset and the same creator
  97.           will have a different meaning depending on which group it is in.
  98.  
  99.  
  100.           SPI uses this concept extensively and defines a large dictionary
  101.           with different creators with convoluted names for different
  102.           modalities and PACS operations.  A few sample elements are
  103.           described here.  Particularly important are those elements for
  104.           purposes that were not envisaged when ACR/NEMA 1 was written, but
  105.           are necessary to create valid DICOM 3 data sets.  Such things as
  106.           FlipAngle for MR scans for example.  Note that the SPI UID is not
  107.           the same as a DICOM UID, but presumably it is unique !  Note also
  108.           that the creator of "SPI RELEASE 1" is the same as "SPI Release 1"
  109.           and "SPI" ...  presumably someone messed up between machines or
  110.           modalities or manufacturers.  For a more extensive SPI data
  111.           dictionary see the DICOM conversion tools.  The value
  112.           representation fields are shown here using the modern DICOM
  113.           equivalents rather than the older, less specific ACR/NEMA names.
  114.           The "owner" is what is used as the string value of the
  115.           PrivateCreatorDataElement when a range of elements in a group is
  116.           claimed.
  117.  
  118.  
  119. Element Owner Name VR VM
  120.  
  121. (0009,0010) SPI Comments LO 1 (0009,0015) SPI UID LO 1 (0009,0010) SIEMENS MED
  122. RecognitionCode LO 1
  123.  
  124. (0011,0010) SPI RELEASE 1 Organ LO 1 (0011,0015) SPI RELEASE 1 AllergyIndication
  125. LO 1 (0011,0020) SPI RELEASE 1 Pregnancy LO 1 (0011,0010) SIEMENS CM VA0 CMS
  126. RegistrationDate DA 1 (0011,0011) SIEMENS CM VA0 CMS RegistrationTime TM 1
  127. (0011,0023) SIEMENS CM VA0 CMS UsedPatientWeight IS 1
  128.  
  129. (0013,0020) SIEMENS CM VA0 CMS PatientName LO 1 (0013,0022) SIEMENS CM VA0 CMS
  130. PatientId LO 1 (0013,0030) SIEMENS CM VA0 CMS PatientBirthdate LO 1 (0013,0031)
  131. SIEMENS CM VA0 CMS PatientWeight DS 1 (0013,0035) SIEMENS CM VA0 CMS PatientSex
  132. LO 1 (0013,0040) SIEMENS CM VA0 CMS ProcedureDescription LO 1 (0013,0042)
  133. SIEMENS CM VA0 CMS RestDirection LO 1 (0013,0044) SIEMENS CM VA0 CMS
  134. PatientPosition LO 1
  135.  
  136. (0019,0010) SIEMENS CM VA0 CMS NetFrequency DS 1 (0019,0011) SIEMENS CM VA0 ACQU
  137. SequenceFileName LO 1 (0019,0021) SIEMENS CT VA0 GEN Exposure DS 1 (0019,0026)
  138. SIEMENS CT VA0 GEN GeneratorVoltage DS 1 (0019,0050) SIEMENS MR VA0 GEN
  139. NumberOfAverages IS 1 (0019,0060) SIEMENS MR VA0 GEN FlipAngle DS 1 (0019,0012)
  140. SIEMENS MR VA0 COAD MagneticFieldStrength DS 1
  141.  
  142. (0021,0010) SIEMENS MED Zoom DS 1 (0021,0011) SIEMENS MED Target DS 2
  143. (0021,0020) SIEMENS CM VA0 CMS FoV DS 2 (0021,0060) SIEMENS CM VA0 CMS
  144. ImagePosition DS 3 (0021,0061) SIEMENS CM VA0 CMS ImageNormal DS 3 (0021,006a)
  145. SIEMENS CM VA0 CMS ImageRow DS 3 (0021,006b) SIEMENS CM VA0 CMS ImageColumn DS 3
  146. (0021,0039) SIEMENS MR VA0 GEN SlabThickness DS 1 (0021,0070) SIEMENS MR VA0 GEN
  147. NumberOfEchoes IS 1
  148.  
  149.  
  150.     3.1.2 Siemens - Features common to multiple families
  151.  
  152.  
  153.           The Numaris (MRI) and Somaris (CT) software contains certain
  154.           common features, especially when running on common platforms.
  155.           This is particularly true of more recent versions that are Sparc
  156.           and SunOS based rather than the older Vax/VMS systems .
  157.  
  158.           3.1.2.1 Siemens Vax/VMS
  159.  
  160.               Under construction.
  161.  
  162.  
  163.           3.1.2.2 Siemens Sparc SunOS
  164.  
  165.               This information is derived mostly from some recent
  166.               experiments with Numaris VB21B on an Open and Somaris on
  167.               an AR-C.  There is a lot of useful information to be found
  168.               in the System Manual for both families, not to mention the
  169.               configuration release notes.  Both use bog standard Sun OS
  170.               4.1.x, and tend to keep the platform/application specific
  171.               information in the /usr/appl tree.  The user interface is
  172.               standard OpenWindows.
  173.  
  174.               3.1.2.2.1 Starting up
  175.  
  176.               This will become apparent when the system is started up.
  177.               The normal SunOS boot procedure is observed.  On somaris,
  178.               the system automatically loads Open Windows and followed
  179.               by the Somaris application.  On Numaris one logs in as the
  180.               "mr" user, usually without any password, and gets
  181.               OpenWindows and the Numaris application.  Interrupting
  182.               this process will be described later.
  183.  
  184.               3.1.2.2.2 Getting a console
  185.  
  186.               The first step in exploring the system is getting a
  187.               console.  On Numaris this is easy.  Running all the way
  188.               down the right hand side of the screen is an information
  189.               area from the Numaris application.  About a third of the
  190.               way down the edge, a little grayed out icon is visible.
  191.               Clicking or dragging on this will expose the fact that
  192.               this is an iconified console window.  On Somaris, the
  193.               console is still iconified but completely hidden by the
  194.               right information area.  The trick to grabbing this is to
  195.               do a System/End (menu with right mouse button down) and
  196.               select Application and Restart, which brings the
  197.               application and the OpenWindows down and back up again.
  198.               While this is happening you can see the iconified console
  199.               and drag it into the middle of the screen, where you can
  200.               open it later.
  201.  
  202.  
  203.               While on the subject of System/End, the various options
  204.               are permuations of normal commands like logout, halt or
  205.               shutdown.
  206.  
  207.  
  208.               Once one has a Unix prompt one can explore the system, and
  209.               create directories in which to save exported images.  The
  210.               Numaris manual's example suggested /usr/appl/external as a
  211.               place to store exported files.  On Numaris this already
  212.               exists and is empty.  On Somaris it doesn't but the normal
  213.               user has the permission to create it with a "mkdir
  214.               /usr/appl/external".  The normal commands like telnet and
  215.               ftp are available if one wants to use these to go outward
  216.               bound on the network, if it is configured (which will be
  217.               discussed later).
  218.  
  219.               3.1.2.2.3 Native images
  220.  
  221.               Images are stored in native form in /usr/appl/data/disk1,
  222.               at least on the systems that I have examined.  They are
  223.               stored one image per file, and named something like
  224.               nnn-ss-iii.ima, where nnn is some sequential number that
  225.               pertains to the patient (or instance of the examination
  226.               ...  I am not sure), ss is the series number (always 1 on
  227.               Somaris), and iii is the sequential image number within
  228.               nnn.  The hard part is figuring out what nnn is for the
  229.               patient you want ...  this number is not displayed in the
  230.               normal Patient Select dialogs or anywhere else I can find.
  231.               Counting back from the latest patient and comparing the
  232.               highest value of iii seems to be a crude but effective
  233.               approach.
  234.  
  235.  
  236.               The native images are stored in the usual Siemens style,
  237.               with a binary header of fixed length (that varies from
  238.               product to product in length and layout) and trailing
  239.               uncompressed image pixel data.  The specifics where known
  240.               are described elsewhere.
  241.  
  242.               3.1.2.2.4 Exporting images
  243.  
  244.               On any of these products one can use the System/External
  245.               Data menu option to bring up a dialog with Import or
  246.               Export choices.  Select Export, enter /usr/appl/external
  247.               or whatever as the destination, and choose the image
  248.               numbers (eg.  "1-6,10,22-24" is quite acceptable) and they
  249.               will be written where you asked.  The patient name must be
  250.               exactly as it is registered.  The catch is that the
  251.               exported SPI files will be named with the patient's name
  252.               and the current date and time of export, not the time of
  253.               acquisition or reconstruction or whatever, so sorting
  254.               through these to determine what they are is a pain.  The
  255.               form of the date and time stamp in the name is
  256.               "yyyymmddhhmmssff".
  257.  
  258.               3.1.2.2.5 Physical connection
  259.  
  260.               So you know where the images are ...  how do you get them
  261.               off.  One way is by ethernet connection.  One doesn't have
  262.               to have the PACSNet or DICOM option to be able to connect
  263.               to the network.  If you haven't paid for the PAL that
  264.               provides hardware protection for these functions, it
  265.               doesn't mean that the ethernet software in Sun OS and the
  266.               ethernet port on the Sparc host is not live.  During
  267.               installation of the Somaris or Numaris software the
  268.               Siemens Field Engineer can configure the interface with a
  269.               IP address of your choice (it defaults to 1.0.0.1 under
  270.               Numaris, and the le0 interface is not configured by
  271.               default under Numaris).
  272.  
  273.  
  274.               If the Siemens FE is unfamiliar with the procedure tell
  275.               them to use the "install" login, choose SSC (Site Specific
  276.               Configuration) then RC (Reset host Configuration),
  277.               accepting the defaults until you get to "Internet
  278.               Address".  If you know the "install" password (or can
  279.               change it as root) you can do this yourself.  I don't
  280.               think the additional layer of Siemens password protection
  281.               applies to this particular tool, though there are many you
  282.               won't be able to run.
  283.  
  284.  
  285.               If you are really desperate you can gain root access and
  286.               manually configure the SunOS network configuration without
  287.               using the Siemens tool, but you need to be pretty familiar
  288.               with SunOS to do this.  You need to put in a real IP
  289.               address in /etc/hosts, create an /etc/hostname.le0, and if
  290.               necessary set up /etc/netmasks if the default is not
  291.               appropriate.  I tried this and it works but it somehow
  292.               messed up camera communications, so doing it with the
  293.               Siemens FE is probably better.  Don't forget to back up
  294.               the critical files first just in case.
  295.  
  296.  
  297.               The standalone configuration on the AR/C had just the
  298.               loopback address (127.0.0.1) in /etc/hosts and no
  299.               /etc/hostname.le0.
  300.  
  301.  
  302.               The physical ethernet connector is normally unused, and is
  303.               located on the Sparc host board and is the usual AUI
  304.               connector (ie.  you need an AUI to 10BaseT or whatever
  305.               transceiver).  On the AR/C I tested it was located under
  306.               the desktop (ie.  lift the desktop off, and then the metal
  307.               cover), sticking up on the left hand side.  On the
  308.               Magnetom Open it was in the computer room in the cabinet
  309.               with the host processor at the bottom on the left hand
  310.               side.  In this installation it was connected to a lead
  311.               going to a breakout panel on the top cover of the cabinet.
  312.               This is unused so just disconnect it and plugin your own.
  313.  
  314.               3.1.2.2.6 Archive devices
  315.  
  316.               Another way to get the images off is to just use the QIC
  317.               streaming tape drive.  This is probably still installed in
  318.               older machines, but the newer software is being
  319.               distributed on CD-ROM so the tape drive is being pulled
  320.               and replaced with a CD.  It is probably still in the
  321.               maintenence closet though and would be easy to swap back
  322.               in.  No configuration is necessary.  It is accessed as
  323.               usual as /dev/rst0 and its rewinding and non-rewinding
  324.               variants, and one can just tar image files off to it.
  325.               Very handy.  No messing with wierd Pioneer WORM's and
  326.               MOD's !
  327.  
  328.  
  329.               The drive is physically located on the front of the
  330.               processor box in the desk models and in the host processor
  331.               cabinet beside the optical drive in the computer room in
  332.               the larger installations.
  333.  
  334.  
  335.               Speaking of WORM's and MOD's, they are the same unreadable
  336.               media as used by GE, but of course have a different
  337.               filesystem.  When used as archive devices these are not
  338.               the standard unix file system, and you will not see any
  339.               evidence of a mounted device doing a "mount" or "df", even
  340.               though when you stick one in the drive the application
  341.               automatically detects it and mounts it.  It is said in the
  342.               release notes that one can actually format and mount one
  343.               of these as a unix filesystem instead (the MOD at least)
  344.               but I don't know how to do it, and haven't discovered, not
  345.               possessing one of them there Pioneer drives to read one
  346.               on.
  347.  
  348.               3.1.2.2.7 Becoming root
  349.  
  350.               If you thought you could mess up a perfectly good scanner
  351.               already, try becoming root.  Why would one need to do this
  352.               ?  To manually reconfigure the network, to change
  353.               passwords for critical logins like install, to create your
  354.               own login some place clean and safe, etc.  Since this is
  355.               standard SunOS, the usual principles apply ...  first try
  356.               rebooting in single user mode.  Do this with a System/End
  357.               choosing System/Norestart and you will get a boot prompt.
  358.               Type "b -s" and it comes up in single user mode, allowing
  359.               you to mess with /etc all you like as root.
  360.  
  361.  
  362.               If this mode has been password protected (and one can do
  363.               this by removing "secure" from "console" in /etc/ttytab
  364.               ...  see "man 5 ttytab") then one is not out of luck yet.
  365.               Now you have to put a SunOS boot disk in the CDROM drive
  366.               (or plugin an external CDROM drive) and boot SunOS
  367.               mini-root, then mount /dev/sd0 as /mount and you are in
  368.               business.  (If you don't have a SunOS CDROM then you
  369.               probably shouldn't be doing this kind of thing in the
  370.               first place).
  371.  
  372.               3.1.2.2.8 Reset
  373.  
  374.               If you are messing about in SunOS, periodically the
  375.               Somatom application will get out of sync with the new
  376.               reality you have created and will complain that an
  377.               Init/Reset is necessary ...  well, do an Init/Reset.  I
  378.               have forgotten exactly where it is in the menus, whether
  379.               under System or Measurement.  It is documented in the
  380.               system manual and seems harmless.
  381.  
  382.  
  383.     3.2 CT - Proprietary Formats
  384.  
  385.     3.2.1 General Electric CT
  386.  
  387.           Now we get to the meaty part.  After years of being faced with the
  388.           problem of either a) hours of detective work, or b) tediously
  389.           tracking down the name of the responsible person and exercising a
  390.           non-disclosure agreement, this is now no longer necessary, as
  391.           General Electric are making their image format description
  392.           documents freely available.  For details see the GEMS image format
  393.           information contacts section later on.  In the meantime, both for
  394.           historical completeness, educational purposes, and for those who
  395.           can't wait for document to come in the mail, a summary of the
  396.           relevant formats and decompression algorithms is provided here.
  397.  
  398.           3.2.1.1 GE CT 9800
  399.  
  400.               References (see the GEMS image format information contacts
  401.               section):
  402.  
  403.  
  404.                 - 46-021855 CT 9800 Image Data Format
  405.  
  406.               3.2.1.1.1 GE CT 9800 Image data
  407.  
  408.                 - "block format" header - perimeter encoding -
  409.                 optional DPCM compression - Data General host
  410.                 (various) - RDOS (yuck !)
  411.  
  412.  
  413.                 Almost everyone in this field has at some stage
  414.                 encountered the dreaded CT 9800 format.  The
  415.                 world is divided into two groups of people ...
  416.                 those who have seen the documents or the
  417.                 critical piece of code in another program or
  418.                 have been given a handy hint, and those who will
  419.                 never figure out the format themselves.
  420.  
  421.  
  422.                 Essentially the format fits into the "block
  423.                 format" described earlier, with pointers to each
  424.                 of the major header components.  Rarely, if
  425.                 ever, does one encounter a file that doesn't
  426.                 have the same size blocks in the same place, so
  427.                 most people treat it as a fixed layout.  I
  428.                 believe that reformatted images may have another
  429.                 header stored in there, but I have never tested
  430.                 for it.
  431.  
  432.  
  433.                 The data itself is stored in one of two forms
  434.                 depending on whether compression is selected or
  435.                 not during archival.  In the uncompressed form,
  436.                 a type of perimeter encoding is used (see later
  437.                 section) in which for an essentially circular
  438.                 object, the outer parts of a rectangular image
  439.                 are discarded (and expected to be filled in with
  440.                 a background pixel value during reconstitution
  441.                 of the image).  In the case of the CT9800 then,
  442.                 the image pixel data is interpreted using a map,
  443.                 which contains an entry for each row of the
  444.                 image (either 256, 320 or 512 entries) which
  445.                 specifies the length of the row that is actually
  446.                 stored, centered about the midline of the image.
  447.                 This obviously saves a lot of space.
  448.  
  449.  
  450.                 If compression is selected on one of the later
  451.                 model machines, then a form of Differential
  452.                 Pulse Code Modulation is used, in which
  453.                 advantage is taken of the fact that not all the
  454.                 bits of a 16 bit word are need to store a CT
  455.                 value.  I gather only 12 bits of data are
  456.                 actually significant, but one can theoretically
  457.                 represent 15 using this scheme.  Essentially,
  458.                 the first 16 bit word is read and used as is.
  459.                 Then another byte is read.  If its most
  460.                 significant bit is set, then the remaining 7
  461.                 bits represent a signed difference value
  462.                 relative to the previous pixel.  If its most
  463.                 significant bit is not set, then the difference
  464.                 must have exceeded the range of 7 bits, and
  465.                 hence the next byte is read to complete a valid
  466.                 16 bit word (15 bits really) which is the actual
  467.                 pixel value.  The really neat thing about this
  468.                 scheme is that the same algorithm can be used
  469.                 for compressed or uncompressed data as an
  470.                 uncompressed stream of words will never have the
  471.                 most significant bit set !
  472.  
  473.  
  474.                 The following piece of C++ code pulled out of a
  475.                 CT9800 to DICOM translator will give you the
  476.                 general idea.  Note that the perimeter encoding
  477.                 map has already been read in.  Note in
  478.                 particular the need to deal with sign extension
  479.                 of the difference value.  Also note that the
  480.                 code doesn't handle the first pixel specially
  481.                 because its high bit will not be set.
  482.  
  483.  
  484. static void copy9800image(ifstream& instream,DC3ofstream& outstream,
  485.           Uint16 resolution,Uint16 *map)
  486. {
  487.     unsigned i; Int16 last_pixel;
  488.  
  489.     last_pixel=0; for (i=0; i<resolution; ++i) {
  490.         unsigned line = map[i]; unsigned start = resolution/2-line;
  491.         unsigned end = start+line*2; unsigned j;
  492.  
  493.         // Pad the first "empty" part of the line ...  for (j=0;
  494.         j<start; j++) outstream.write16(0);
  495.  
  496.         // Copy the middle of the line (compressed or uncompressed)
  497.         while (start<end) {
  498.             unsigned char byte; instream.read(&byte,1); if
  499.             (!instream) break; if (byte & 0x80) {
  500.                 signed char delta; if (byte & 0x40) {
  501.                     delta=byte;
  502.                 } else {
  503.                     delta=byte & 0x3f;
  504.                 } last_pixel+=delta;
  505.             } else {
  506.                 last_pixel=byte << 8; instream.read(&byte,1); if
  507.                 (!instream) break; last_pixel+=byte;
  508.             } outstream.write16((Uint16)last_pixel & 0x0fff);
  509.             ++start;
  510.         }
  511.  
  512.         // Pad the last "empty" part of the line ...  for (j=end;
  513.         j<resolution; j++) outstream.write16(0);
  514.     }
  515. }
  516.  
  517.  
  518.                 What about the rest of the header information
  519.                 and where is this map stored anyway ?  Well, the
  520.                 file is described as a series of 256 by 16 bit
  521.                 word blocks, blocks numbered from 0, words
  522.                 numbered from 1, integers are 16 bit words, as
  523.                 follows:
  524.  
  525.  
  526.     block 0 - global header
  527.  
  528.            word 34 - Int - pointer to global header word 35 - Int - pointer
  529.            to exam header word 36 - Int - pointer to image header word 37 -
  530.            Int - pointer to image header2 word 38 - Int - pointer to image
  531.            map word 39 - Int - pointer to image data word 40 - Int - number
  532.            of blocks in global header word 41 - Int - number of blocks in
  533.            exam header word 42 - Int - number of blocks in image header word
  534.            43 - Int - number of blocks in image header2 word 44 - Int -
  535.            number of blocks in image map word 45 - Int - number of blocks in
  536.            image data
  537.  
  538.  
  539.                 Now almost always the layout is as follows, for
  540.                 non-reformatted images:
  541.  
  542.  
  543.     block 0 - global header block 1 - exam header block 2 - image header
  544.     block 3 - image header 2 block 4 - image map block 6 - image data
  545.  
  546.  
  547.                 For reformatted images the layout is said to be
  548.                 different, but I have never seen a description
  549.                 of the contents of the so-called "arrange
  550.                 header", nor do I know where in the global
  551.                 header the pointer and length are stored:
  552.  
  553.  
  554.     block 0 - global header block 1 - exam header block 2 - image header
  555.     block 3 - image header 2 block 4 - arrange header block 9 - image map
  556.     block 11 - image data
  557.  
  558.  
  559.                 Some of the more important contents of the
  560.                 various headers are listed here.  For more
  561.                 complete information get the documents from GE
  562.                 or study any one of a number of programs kicking
  563.                 around to dump the header of this kind of file
  564.                 (see sources later).  Integers are 16 bit words,
  565.                 ascii strings are Fortran style specifications
  566.                 with two characters per word, and reals are 4
  567.                 bytes long (see Host machines - Data General):
  568.  
  569.  
  570.     block 0 - global header
  571.  
  572.            word 17-23 - 7A2 - file name
  573.  
  574.     block 1 - exam header
  575.  
  576.            word 4 - Int - exam number word 5-11 - 7A2 - exam number word
  577.            12-17 - 6A2 - patient id word 18-32 - 15A2 - patient name
  578.  
  579.     block 2 - image header
  580.  
  581.            word 11 - Int - position (study) number word 13 - Int - group
  582.            type (2=scout,3=standard,4=dynamic) word 14 - Int - group number
  583.            word 47 - Int - scan number word 48 - Int - image number word 50
  584.            - Int - patient orientation (1=head first,2=feet) word 51 - Int -
  585.            AP orientation (1=prone,2=sup,3=lt,4=rt) word 55 - Int - contrast
  586.            (0=no,1=yes) word 93-94 - Real - gantry tilt word 95-96 - Real -
  587.            table height mm word 97-98 - Real - axial table location mm word
  588.            124 - Int - image size (256,320,512) NOT FOR SCOUTS word 132 -
  589.            Int - detectors/view - width for scouts word 137 - Int -
  590.            compressed views/scan - height for scouts word 144-145 - Real - X
  591.            diameter of recon mm word 146-147 - Real - Y diameter of recon mm
  592.            word 155-156 - Real - magnification factor word 157-158 - Real -
  593.            X center word 159-160 - Real - Y center word 175 - Int - image
  594.            map used (1=yes,2=no) word 218 - Int - file type
  595.            (1=prospective,2=scout,
  596.                       3=retrospective,4=segmented, 5=screen
  597.                       save,6=plot)
  598.            word 219 - Int - data range (number of bits) word 236 - Int -
  599.            scout orientation (0=ap,1=lateral)
  600.                       (the 9800 rotates the scout magically)
  601.  
  602.  
  603.                 It is important to check the filetype and image
  604.                 map used entries, particularly if trying to read
  605.                 scouts rather just prospective images.  If the
  606.                 map is not in use, it is filled with zeroes and
  607.                 hence if the flag is not checked a simplistic
  608.                 demapping algorithm will fail.  Furthermore the
  609.                 number of rows and columns in the image is not
  610.                 specified as such.  For prospective images, the
  611.                 imagesize field is valid for both (images are
  612.                 square).  For scouts, one must use the
  613.                 detectors/view field for the width and the
  614.                 compressed views/scan field as the height.
  615.  
  616.  
  617.                 The filename entry is quite useful.  Therein is
  618.                 stored the RDOS filename of the image, which
  619.                 follows the following convention:
  620.  
  621.  
  622.     seeeeeppdd.tt
  623.  
  624.     s = originating scan station id eeeee = exam number pp = prs number
  625.     (position related set) dd = image number tt = file type
  626.         YP = prospective YV = scout YR = retrospective YG = segmented
  627.         recon YS = screen save YL = plot YF = reformatted
  628.  
  629.     eg.  B038500165.YP
  630.  
  631.  
  632.                 Having said this, my GE 9800 stores its scouts
  633.                 on tape at least with no file extension at all,
  634.                 rather than the .YV that it is supposed to use.
  635.  
  636.               3.2.1.1.2 GE CT 9800 Tape format
  637.  
  638.                 Probably more CT images have been exchanged for
  639.                 clinical and research purposes using GE 9800
  640.                 9-track magnetic tapes than any other means.
  641.                 These things are just ubiquitous, particularly
  642.                 considering the proliferation of services
  643.                 providing 3D reconstruction and fabrication a
  644.                 few years ago.  Fortunately the format is easy
  645.                 to deal with.  The tapes are produced on a
  646.                 primitive DG tape drive and hence are never more
  647.                 than 1600bpi.  The first thing on the tape is a
  648.                 directory consisting of two 4096 word (8192
  649.                 byte) records, then two EOF marks, then 20" of
  650.                 blank tape (because the directory keeps getting
  651.                 updated) followed by image files each separated
  652.                 by an EOF mark and finally an additional EOF
  653.                 mark after the last file.
  654.  
  655.  
  656.                 I won't describe the tape directory format here
  657.                 unless someone specifically asks for it, though
  658.                 it is very simple.  I usually just read
  659.                 everything on the tape and sort the files out
  660.                 later.  Remember that their filenames are stored
  661.                 in the global header.
  662.  
  663.  
  664.                 Don't forget to set the input magnetic tape
  665.                 record size to 8192 bytes when you are copying
  666.                 these files.  If you don't do this some systems
  667.                 quietly truncate each record to some default
  668.                 size.  It took me a week to figure out why my
  669.                 files were screwed up the first time I tried
  670.                 this on a DG under AOS/VS (I was desperate and
  671.                 using a networked Signa to read files off a
  672.                 non-networked 9800).
  673.  
  674.  
  675.                 A simple script to read an entire tape from a
  676.                 SCSI tape drive /dev/nrst1 under SunOS, which
  677.                 will peek in each image file to extract the
  678.                 correct filename (simpler than trying to
  679.                 decipher the directory) looks like this:
  680.  
  681.  
  682. #!/bin/sh
  683.  
  684. echo "Rewinding" mt -f /dev/nrst1 rewind
  685.  
  686. echo "Extracting directory ..." dd if=/dev/nrst1 ibs=8192 of=TAPEDIR
  687.  
  688. while dd if=/dev/nrst1 ibs=8192 of=tape.tmp do
  689.     name=`dd if=tape.tmp ibs=16 skip=2 count=1 2>/dev/null` if [ -z "$name"
  690.     ]; then break; fi mv tape.tmp $name echo "Extracted $name"
  691. done
  692.  
  693. echo "Rewinding" mt -f /dev/nrst1 rewind echo "Finished"
  694.  
  695.               3.2.1.1.2 GE CT 9800 Raw data MR
  696.  
  697.                 No idea about this one ...  I have never had the
  698.                 need or seen any documention.  Anyone who does
  699.                 or has please fill in this space.
  700.  
  701.           3.2.1.2 GE CT Advantage - Genesis
  702.  
  703.               References (see the GEMS image format information contacts
  704.               section):
  705.  
  706.  
  707.                 - 46-021861 Image Data Format - 46-021863
  708.                 Optical Disk Raw Partition - 46-021864 Image
  709.                 Extract Tool - 46-021865 DAT Archive Format
  710.  
  711.  
  712.               General Electric now uses the same Sun based architecture
  713.               for its Advantage CT and Signa 5X MR family, referred to
  714.               as Genesis, and hence the general details of this scheme
  715.               will be discussed under the GE MR Signa 5.x - Genesis
  716.               section.  Specifics related to the CT modality will be
  717.               described here.
  718.  
  719.               3.2.1.2.1 GE CT Advantage Image data
  720.  
  721.                 The Image Extract Tool is used in the same way
  722.                 as on the Signa to extract an image from the
  723.                 database into a single file, either asis or
  724.                 using the requested compression and packing
  725.                 mode.  The Genesis file contains headers
  726.                 consisting of several components in common with
  727.                 MR and then a specific CT or MR header.
  728.                 Theroetically, one should be able to use
  729.                 "/usr/g/insite/bin/ximg -g" to extract a
  730.                 prototype C header file describing the file
  731.                 format, as on the Signa, though last time I
  732.                 tried this on a High Speed Advantage this didn't
  733.                 work.  Some of the more interesting fields in
  734.                 the CT image header include:
  735.  
  736.  
  737.     image header - for CT (1020 bytes long):
  738.  
  739.         194 - float - table start Location 198 - float - table end
  740.         Location 202 - float - table speed (mm/sec) 206 - float - table
  741.         height 224 - float - gantry tilt (degrees)
  742.  
  743.               3.2.1.2.2 GE CT Advantage Archive format
  744.  
  745.                 See the GE MR Signa 5.x Archive format.
  746.  
  747.               3.2.1.2.3 GE CT Advantage Raw data
  748.  
  749.                 Again, unknown.  Please fill in this space.
  750.  
  751.           3.2.1.3 GE CT Pace
  752.  
  753.               References (see the GEMS image format information contacts
  754.               section):
  755.  
  756.  
  757.                 - 46-021856 CT Pace Image Data Format -
  758.                 46-021862 MR Max Image Data Format
  759.  
  760.  
  761.               The Pace is a CT scanner made by Yokogawa Medical
  762.               Systems(YMS) in Japan.  The format documents I have for it
  763.               are partially in Japanese and partially in English, but
  764.               they get the job done.  I have only tested the following
  765.               on a few images that were extracted off a nine-track tape,
  766.               so the offsets to the image header fields may not be
  767.               correct in other cases, but here are "eye-catcher" fields
  768.               at the start of each header which should be easy to find.
  769.               The format seems to be shared with the GE MR Max family.
  770.  
  771.  
  772.               The images described in the documents have a 512 byte
  773.               study header that begins with "!STD" and an image header
  774.               of 1024 bytes that begins with "!IMG".  In the image that
  775.               I had to play with, there was a 256 byte header that I am
  776.               not familiar with tacked on the front, presumambly
  777.               something to do with being a mag tape rather than a disk
  778.               image.  Anyway this meant that the offset to the study
  779.               header was 256 bytes, the image header was 768 bytes, and
  780.               the compressed image data began at 1792 bytes.
  781.  
  782.  
  783.               I don't know what kind of host is used on the Pace though
  784.               I have seen some cryptic references to "DOS-68K" in the
  785.               documents.  Regardless, the integers are 16 or 32 bit
  786.               big-endian.  The image data is stored as SIGNED not
  787.               unsigned 16 bit values, same as on the Sytec and
  788.               presumably all the YMS systems.  Most of the useful dates
  789.               and times are provided as string values, however there are
  790.               some dates and times that are 32 bit binary integers.
  791.               Though not specified in the docs it seems that the dates
  792.               are days since an epoch of "0 Jan 1980" and the times are
  793.               in milliseconds.  Floats are 32 bit IEEE format, dfined in
  794.               the Pace documentation as follows:
  795.  
  796.  
  797.     bit 31 sign (s) (0 is +ve)
  798.  
  799.     bits 30-23 exponent (e)
  800.             - unsigned integer - e == 0 for denormalized numbers - 0
  801.             < e < 255 for normalized numbers - e == 255 for other
  802.             reserved operands
  803.  
  804.     bits 22-0 significand (f)
  805.  
  806.     Normalized numbers:
  807.         Exponent:
  808.             - bias 127 - range 0 < e < 255
  809.         Significand:
  810.             - interpreted as 1.f - range 1.0 <= f < 2.0
  811.  
  812.         (-1)^s * 2^(e-127) * 1.f
  813.  
  814.     Denormalized numbers:
  815.         Exponent:
  816.             - e == 0 - bias 126
  817.         Significand:
  818.             - interpreted as 0.f - range f != 0
  819.  
  820.         (-1)^s * 2^(-126) * 0.f
  821.  
  822.     Signed Infinities:
  823.         - e == 255 - f == 0
  824.  
  825.     Not-a-numbers:
  826.         - e == 255 - f != 0
  827.  
  828.  
  829.                The image header has a chunk in the middle where
  830.                different values are defined for CT and MR.  One can use
  831.                the first byte of the model number field to distinuish
  832.                the two modalities.  Some of the more important study and
  833.                image header values are:
  834.  
  835.  
  836.     Study header (offset 256 bytes, length 512 bytes):
  837.  
  838.     Offset Type Length Meaning Units or values
  839.  
  840.     0x0 string 4 Eyecatcher !STD 0x6 byte 1 Modality 1=CT,2=MR 0xa string 5
  841.     Study Number 0x10 datestring Study Date yyyy/mm/dd 0x1a timestring Study
  842.     Time hh/mm/ss.xxx 0x26 string 12 Patient ID 0x36 string 12 Patient Name
  843.     0x50 string 6 Patient Age yyy;mm 0x5c string 2 PatientSex" 'M ','F '
  844.     0xbc string 4 Contrast media 'NO C','+C '
  845.  
  846.     Image header (offset 768 bytes, length 1024 bytes):
  847.  
  848.     Offset Type Length Meaning Units or values
  849.  
  850.     0x0 string 4 Eyecatcher !IMG 0x6 byte 1 Modality 1=CT,2=MR 0xa string 5
  851.     Study Number 0x10 string 2 Series Number 0x12 string 2 Acquisition
  852.     Number 0x14 string 2 Image Number 0x20 datestring Image Date yyyy/mm/dd
  853.     0x2a timestring Image Time hh/mm/ss.xxx 0x40 string 2 'H '=Head First,'F
  854.     '=Feet First 0x42 string 2 'SP'=Supine,'PR'=Prone,
  855.                 'LL'=Left Lateral Decubitus, 'RL'=Right Lateral
  856.                 Decubitus,'OT'=Other
  857.     0x44 string 6 Anatomic location 0x50 string 4 'AX '=Axial,'SAG
  858.     '=Sagittal,'COR '=Coronal 0x54 float32 Slice position by body coords HF
  859.     mm 0x58 float32 Slice position by body coords AP mm 0x5c float32 Slice
  860.     position by body coords LR mm 0x6c string 4 Scan fov cm 0x70 string 4
  861.     Scan thickness mm 0xa0 string 4 Contrast media 'NO C','+C '
  862.  
  863.     0x188 float32 Recon center X mm 0x18c float32 Recon center Y mm 0x190
  864.     string 4 Recon FOV cm [xx.x] 0x1a0 u_int16 Pixels in X-axis 0x1a2
  865.     u_int16 Pixels in Y-axis 0x1a4 float32 Pixel size mm 0x1b0 float32 Mag
  866.     center X mm 0x1b4 float32 Mag center Y mm 0x1b8 float32 Mag factor
  867.  
  868.     For CT only:
  869.  
  870.     0xc8 string 5 Gantry tilt machine coords degrees 0xe0 string 5 Exposure
  871.     time ms 0xe6 string 3 Tube current mA 0xea string 5 Exposure mAS 0xf0
  872.     string 3 KVP 0xf4 string 2 'CW'=Clockwise,'CC'=CounterClockwise
  873.  
  874.     For MR only:
  875.  
  876.     0xc0 string 5 Tilt ordered by user Axis+/-Angle [xx+/-xx] 0x100 string 2
  877.     Echo number 0x102 string 2 Number of echoes 0x104 string 2 Slice number
  878.     0x106 string 2 Number of slices 0x108 string 2 Number of excitations
  879.     0x10a string 5 Repetition time ms 0x110 string 5 Inversion time ms 0x115
  880.     string 5 Echo time ms 0x130 string 4 Magnetic flux density (T)
  881.  
  882.  
  883.                Unlike the Sytec sample images I had, compression was
  884.                used in the Pace images I received.  This is a neat
  885.                scheme that uses both Run Length Encoding and
  886.                Differential Pulse Code Modulation.  Essentially, each
  887.                byte may be a flag value 0x81 which indicates the next
  888.                byte is a run length of the current pixel, or a flag
  889.                value 0x80 which indicates that the current mode should
  890.                be toggled between "reference" mode, in which the
  891.                subsequent 16 bit words are new pixel values, or
  892.                "difference" mode, in which case subsequent bytes are
  893.                signed differences added to the current pixel value.  The
  894.                initial mode is "reference" mode.  Runs do extended
  895.                across horizontal line boundaries.
  896.  
  897.  
  898.                I am not totally clear from the documentation or the
  899.                sample images where in the header is the flag to say
  900.                compression is in use or not.  It is probably bit 5 of
  901.                the Image Attribute field in offset 0x1ac in the image
  902.                header, where a false value specifies DPCM and a true
  903.                value specifies uncompressed or "Original" encoding.  The
  904.                docs say this is for optical disk only, but the
  905.                compressed image from tape I have has this bit false,
  906.                which is correct.
  907.  
  908.  
  909.                The following piece of code will decode such a compressed
  910.                image:
  911.  
  912.  
  913. static void copypaceimage(istream& instream,ostream& outstream,
  914.           Uint16 width,Uint16 height)
  915. { // NB.  the exclusive or with 0x8000 makes the signed Pace values unsigned //
  916. which is what the PGM convention is ...  just omit the ^0x8000 // everywhere if
  917. you want the data left signed.
  918.  
  919.     unsigned i; Int16 pixel=0; enum Mode { Difference, Reference } mode =
  920.     Reference; for (i=0; i<height*width;) {
  921.         unsigned char byte; instream.read(&byte,1); if (!instream)
  922.         break; if (byte == 0x80) { // Mode switch
  923.             if (mode == Difference)
  924.                 mode=Reference;
  925.             else
  926.                 mode=Difference;
  927.         } else if (byte == 0x81) { // Run length flag
  928.             instream.read(&byte,1); if (!instream) break; unsigned
  929.             repeat=byte; i+=repeat; while (repeat--)
  930.             write16little(outstream,pixel^0x8000);
  931.         } else {
  932.             if (mode == Difference) {
  933.                 pixel+=(signed char)byte;
  934.             } else {
  935.                 pixel=byte<<8; instream.read(&byte,1); if
  936.                 (!instream) break; pixel|=byte;
  937.             } write16little(outstream,pixel^0x8000); ++i;
  938.         }
  939.     } if (!instream) cerr << "Premature EOF byte " << i << "\n" << flush;
  940. }
  941.  
  942.           3.2.1.4 GE CT Sytec
  943.  
  944.               I don't have one of these either, and it turns out that
  945.               the format is NOT the same as the Pace as GE Milwaukee
  946.               initially thought.  The format may be shared with the
  947.               Vectra, but this is not known for certain.  I do have a
  948.               few sample images and have worked out many of the values
  949.               in the headers.  The format may be available from Yokogawa
  950.               in Japan.  Milwaukee apparently doesn't have it.
  951.  
  952.  
  953.               The host is an MS-DOS clone using the J-DOS operating
  954.               system, a Japanese version of DOS to handle 16 bit Kanji
  955.               characters.  Alan Rowberg tells me it has a 5.25" drive
  956.               that writes disks that are unreadable by anything else in
  957.               the universe.
  958.  
  959.  
  960.               The images have a header of 3752 bytes and are followed by
  961.               16-bit signed integers.  The surround is -1500 which is
  962.               probably -1500 H.U.  The sample files I had did not use
  963.               any form of compression.
  964.  
  965.  
  966.               The data formats are big-endian.  Fortuitously the
  967.               date/time format is the same as unix ...  a 32 bit
  968.               unsigned integer containing seconds since an epoch of
  969.               00:00:00 GMT 1 Jan 1970.  Floats are 32 bit IEEE format as
  970.               described in the Pace format.
  971.  
  972.  
  973.               The head first/feet first and prone/supine fields in the
  974.               Sytec file are not known.  The sense and identification of
  975.               corners in the Sytec sample files was done by guess work,
  976.               and may be wrong if the samples weren't scanned head first
  977.               supine, and the images are not supposed to be looked at
  978.               from bottom up in the usual convention.
  979.  
  980.  
  981.               The header is 3752 bytes long.  The known header values
  982.               are (byte offsets from 0):
  983.  
  984.  
  985.       Offset Type Meaning Units or values
  986.  
  987.     7 string ModelNumber
  988.  
  989.     126 string Organization 204 string PatientID 217 string PatientName
  990.  
  991.     328 datetime ExamDateTime 402 string ExamDescription 425 string Modality
  992.     444 string ExamStationID
  993.  
  994.     1164 int16 ExamNumber 1166 int16 SeriesNumber 1172 datetime SeriesDate
  995.     1176 string SeriesDescription 1206 string SeriesStationID
  996.  
  997.     1224 int16 ScanType # 1=axial,3=scout 1240 string AnatomicalReference
  998.  
  999.     1280 float32 SeriesStartLocation 1288 float32 SeriesEndLocation
  1000.  
  1001.     2192 u_int16 ImageExamNumber 2194 u_int16 ImageSeriesNumber 2196 u_int16
  1002.     ImageNumber 2204 datetime ScanDateTime 2208 float32 ScanDuration #?
  1003.     secs 2212 float32 SliceThickness # mm 2216 u_int16 XMatrix 2218 u_int16
  1004.     YMatrix 2220 float32 FieldOfView # mm 2224 float32 ScoutLength # mm 2228
  1005.     float32 XDimension # mm 2232 float32 YDimension # mm 2236 float32
  1006.     XPixelSize # mm 2240 float32 YPixelSize # mm
  1007.  
  1008.     2310 u_int16 ScoutOrientation # 0=none,1=ap,2=lateral 2316 float32
  1009.     TablePosition # mm 2320 float32 SliceCenterX # mm 2324 float32
  1010.     SliceCenterY # mm 2328 float32 SliceCenterZ # mm 2332 float32
  1011.     NormalVectorX # unitized 2336 float32 NormalVectorY # unitized 2340
  1012.     float32 NormalVectorZ # unitized 2344 float32 TopRightHandCornerX # mm
  1013.     2348 float32 TopRightHandCornerY # mm 2352 float32 TopRightHandCornerZ #
  1014.     mm 2356 float32 TopLeftHandCornerX # mm 2360 float32 TopLeftHandCornerY
  1015.     # mm 2364 float32 TopLeftHandCornerZ # mm 2368 float32
  1016.     BottomLeftHandCornerX # mm 2372 float32 BottomLeftHandCornerY # mm 2376
  1017.     float32 BottomLeftHandCornerZ # mm 2384 float32 ScoutStartLocation # mm
  1018.     2388 float32 ScoutEndLocation # mm 2408 int32 GeneratorVoltage # kVP
  1019.     2412 int32 TubeCurrent # mA 2416 float32 GantryTilt # degrees
  1020.  
  1021.     2716 float32 XReconOffset # mm 2720 float32 YReconOffset # mm
  1022.  
  1023.     3256 int32 BitsPerSample 3264 int32 DefaultWindowWidth 3268 int32
  1024.     DefaultWindowLevel
  1025.  
  1026.           3.2.1.5 GE CTI
  1027.  
  1028.               The GE CTI family of scanners are based on the IOS
  1029.               platform, but fully
  1030.                       support DICOM both on the network and
  1031.                       on MOD media.  hence it is rarely if
  1032.                       ever desirable or necessary to get
  1033.                       involved with the internal format
  1034.                       within the SGI host that runs these
  1035.                       scanners.  Having said that, it is
  1036.                       worth pointing out that internally
  1037.                       images may be stored in a Genesis like
  1038.                       format, with the same header layout
  1039.                       except that some fields are 32 bit
  1040.                       rather than 16 bit aligned (like on AW
  1041.                       from which the IOS platform was
  1042.                       derived), or in a true DICOM format,
  1043.                       with a Part 10 style meta-header,
  1044.                       except that the meta-header is encoded
  1045.                       in implicit not explicit little endian
  1046.                       (since it was designed and implemented
  1047.                       before the standard Part 10 was
  1048.                       finished and hence used the convention
  1049.                       of early drafts).
  1050.  
  1051.  
  1052.               None of this should be of consequence however, since
  1053.               images should always
  1054.                       be exported from CTI scanners using
  1055.                       network transfer or on DICOM media.
  1056.  
  1057.  
  1058.               There are a few caveats however, both for the network and
  1059.               for media.
  1060.  
  1061.  
  1062.               For network transfers, be absolutely sure that the storage
  1063.               SCP accepts
  1064.                       only DICOM standard SOP classes during
  1065.                       association negotiation, and is not
  1066.                       promiscuous ("I will store anything of
  1067.                       any SOP class").  Otherwise the CTI
  1068.                       will by preference send proprietary GE
  1069.                       SOP Classes of the ID/NET 2.0 variety,
  1070.                       which are very DICOM like but are
  1071.                       sufficiently different from the
  1072.                       standard CT sop class to cause
  1073.                       problems.  The SOP Class UIDs of the
  1074.                       ID/NET 2.0 SOP CLasses are specified
  1075.                       in the conformance statement and if
  1076.                       you absolutely must know what they
  1077.                       contain there is an old service
  1078.                       direction that describes them that is
  1079.                       probably still available.
  1080.  
  1081.  
  1082.               For the DICOM MOD media, the problems are more serious,
  1083.               and some of them
  1084.                       are described in the more recent CTI
  1085.                       conformance statement and are further
  1086.                       explained here.  Note that all these
  1087.                       problems have been fixed, so that more
  1088.                       recent CTI, MR LX and AW 3X devices
  1089.                       should be writing good conformant
  1090.                       media but still be able to read the
  1091.                       old "bad" media".  However since there
  1092.                       may be shelves full of "bad" media one
  1093.                       needs to be aware of the details of
  1094.                       the problem.  There is more bad CT
  1095.                       media around than MR and AW since the
  1096.                       fix came later to the CTI.
  1097.  
  1098.  
  1099.               General details of the encapulsation
  1100.                       and JPEG encoding are defined in DICOM
  1101.                       Part 5 and ISO 10918-1, and explained
  1102.                       in this FAQ in DICOM Compression.
  1103.                       Specific details of the GE bugs are
  1104.                       defined here, as well as being
  1105.                       described in more recent GE CTI
  1106.                       Conformance statements.  See for
  1107.                       example section 3.4.2 of GE Direction
  1108.                       2162114-100 High Speed Advantage 4.1
  1109.                       and 5.3 Conformance Statement.
  1110.  
  1111.  
  1112.                       There are two classes of problem, one
  1113.                       related to the DICOM encapsulation,
  1114.                       and the other to the JPEG encoding
  1115.                       itself.
  1116.  
  1117.  
  1118.               - DICOM encapsulation
  1119.                         - Incorrect byte order of Item
  1120.                         and Sequence Delimiter tags
  1121.               - JPEG Encoding
  1122.  
  1123.                         - Incorrect Huffman Table
  1124.                         selector (11 not 00) - Incorrect
  1125.                         predictor calculation (inverted)
  1126.                         - Incorrect predictor
  1127.                         initialization at end of row
  1128.  
  1129.  
  1130.  
  1131.               Even though all DICOM encapsulated transfer syntaxes
  1132.               specify little endian
  1133.                       byte order for all non-pixel data
  1134.                       values and for all element tags and
  1135.                       value lengths, inadvertantly some of
  1136.                       the delimiter and item tags in GE
  1137.                       encapsulated pixel data are sent in
  1138.                       either big endian for each of the
  1139.                       group and element of the item and
  1140.                       sequence delimited tags, or in little
  1141.                       endian for the concatenated value of
  1142.                       group and element as af they were a 32
  1143.                       bit word.  That is instead of
  1144.                       (FFFE,E000) Item being sent as
  1145.                       FE,FF,00,EO as specified in the
  1146.                       standard, it might be seen as
  1147.                       FF,FE,E0,00 or 00,E0,FE,FF.  Instead
  1148.                       of (FFFE,E0DD) Sequence Delimiter
  1149.                       being sent as FE,FF,DD,EO, it might be
  1150.                       seen as FF,FE,E0,DD or DD,E0,FE,FF.
  1151.                       Note also that if the Item tag is
  1152.                       encoded wrong, then the VL field is
  1153.                       also incorrectly encoded as a big
  1154.                       endian 32 bit word instead of a little
  1155.                       endian 32 bit word.
  1156.  
  1157.  
  1158.               In the GE JPEG codec output, the JPEG 'SOS' header defines
  1159.               the Huffman table selector
  1160.                       codes to find the appropriate Huffman
  1161.                       table.  These are incorrectly coded
  1162.                       these as 0x11.  They should have been
  1163.                       0x00, since those are the values
  1164.                       assigned in the "DHI" header where the
  1165.                       Huffman tables are actually sent.
  1166.                       This bug manifests itself as a
  1167.                       "Huffman table not found" error from
  1168.                       an unpatached decoder.  It also serves
  1169.                       as a useful flag to a patched decoder
  1170.                       that this bug (and others are present)
  1171.                       and allows a single decoder to handle
  1172.                       both good and bad GE compressed bit
  1173.                       streams.
  1174.  
  1175.  
  1176.               The incorrect GE JPEG computation of the difference to be
  1177.               Huffman encoded was computed as (Predictor - value) when
  1178.               it should have been calculated as (value - Predictor).
  1179.               The result is that the decompression with an unpatched
  1180.               decoder results in a "negative" of the original image.
  1181.               Note that GE only uses Selection
  1182.                       Value 1 predication, so there is no
  1183.                       need to patch other predictors.
  1184.  
  1185.  
  1186.               The predictor value used at the beginning of each line
  1187.               used the
  1188.                       last value of the previous line in the
  1189.                       image, instead of the first element of
  1190.                       the line above the current line, and
  1191.                       for the first line, the unsigned value
  1192.                       that is half the full scale range for
  1193.                       the "sample precision".  This
  1194.                       manifests itself as a wierd "banding"
  1195.                       across the image as predictions get
  1196.                       offset by increasing errors.
  1197.  
  1198.  
  1199.               An example of code that copes with both the standard and
  1200.               GE
  1201.                       bugs in JPEG compression can be found
  1202.                       in the patches to the Stanford PVRG
  1203.                       JPEG (see JPEG Sources).
  1204.  
  1205.  
  1206.               An example of code that copes with both the standard
  1207.               encapsluation and GE
  1208.                       bugs in encapsulation can be found in
  1209.                       dicom3tools
  1210.                       "libsrc/include/pixeld/unencap.h".  A
  1211.                       section of that code (with some of the
  1212.                       error handling removed) is reproduced
  1213.                       here.
  1214.  
  1215.  
  1216.     size_t read(void)
  1217.         {
  1218.             // - non-pixel data is always LE, including fragment
  1219.             delimiters and lengths // - 1st item is offset table,
  1220.             may have zero VL // - other items are fragments // -
  1221.             finally sequence delimitation tag (with zero VL) // -
  1222.             each delimiter is 2 byte group,2 byte element, 4 byte
  1223.             VL, little endian // - Item tag is (0xfffe,0xe000) (GE
  1224.             mistake is 0xfeff,0x00e0 or 0xe000,0xfffe) // - Seq
  1225.             delimiter is (0xfffe,0xe0dd) (GE mistake is
  1226.             0xfeff,0xdde0 or 0xe0dd,0xfffe) // - when GE mistake is
  1227.             present, fragment 32 bit VL is also swapped
  1228.  
  1229.             length=0;
  1230.  
  1231.             while (!lefttoreadthisfragment && !finished && !bad) {
  1232.                 Uint16 group=read16(); Uint16 element=read16();
  1233.                 Uint32 vl=read32(); if (group == 0xfffe || group
  1234.                 == 0xfeff || group == 0xe000 || group == 0xe0dd)
  1235.                 {
  1236.                     if (group != 0xfffe) {
  1237.                         cerr <<
  1238.                         "UnencapsulatePixelData::unexpected
  1239.                         group (?  bad byte order)=" <<
  1240.                         hex << group << dec << endl;
  1241.                     } if (element == 0xe0dd || element ==
  1242.                     0xdde0 || group == 0xe0dd) { // Sequence
  1243.                     Delimiter Tag
  1244.                         if (element != 0xe0dd) {
  1245.                             cerr <<
  1246.                             "UnencapsulatePixelData::unexpected
  1247.                             element (?  bad byte
  1248.                             order)=0x" << hex <<
  1249.                             element << dec << endl;
  1250.                         } Assert(vl == 0);
  1251.                         finished=true;
  1252.                     } else /* if (element == 0xe000) */ { //
  1253.                     Item Tag
  1254.                         bool vlbyteorderwrong=false; if
  1255.                         (element != 0xe000) {
  1256.                             cerr <<
  1257.                             "UnencapsulatePixelData::unexpected
  1258.                             element (?  bad byte
  1259.                             order)=0x" << hex <<
  1260.                             element << dec << endl;
  1261.                             vlbyteorderwrong=true;
  1262.                         } if (++fragmentnumber > 0) {
  1263.                             Assert(vl); // Zero
  1264.                             length fragments thought
  1265.                             not to be legal if
  1266.                             (vlbyteorderwrong) {
  1267.                                 lefttoreadthisfragment=
  1268.                                      (((Uint32)vl&0xff000000)>>24)
  1269.                                     +(((Uint32)vl&0x00ff0000)>>8)
  1270.                                     +(((Uint32)vl&0x0000ff00)<<8)
  1271.                                     +(((Uint32)vl&0x000000ff)<<24);
  1272.                                 cerr <<
  1273.                                 "UnencapsulatePixelData::assuming
  1274.                                 VL also had bad
  1275.                                 byte order,
  1276.                                 using 0x" << hex
  1277.                                 <<
  1278.                                 lefttoreadthisfragment
  1279.                                 << dec << endl;
  1280.                             } else {
  1281.                                 lefttoreadthisfragment=vl;
  1282.                             }
  1283.                         } else {
  1284.                             // skip the offset table
  1285.                             Assert(vl%4 == 0);
  1286.                             unsigned i=0; while (vl)
  1287.                             {
  1288.                                 Uint32
  1289.                                 offset=read32();
  1290.                                 vl-=4; ++i;
  1291.                             }
  1292.                         }
  1293.                     }
  1294.                 } else {
  1295.                     // bad tag group in encapsulated data
  1296.                     bad=true;
  1297.                 }
  1298.             }
  1299.  
  1300.             if (lefttoreadthisfragment && !bad) {
  1301.                 length=unsigned(lefttoreadthisfragment >
  1302.                 maxlength ?  maxlength :
  1303.                 lefttoreadthisfragment); if
  1304.                 (istr->read(buffer,length)) {
  1305.                     length=istr->gcount();
  1306.                 } else {
  1307.                     bad=true; length=0;
  1308.                 } lefttoreadthisfragment-=length;
  1309.             }
  1310.  
  1311.             return length;
  1312.         }
  1313.  
  1314.     3.2.2 Siemens CT
  1315.  
  1316.         Some general comments about the way in which Siemens image
  1317.         headers, and the concept of native file formats and exported SPI
  1318.         formats are to be found in the section on Siemens MR.
  1319.  
  1320.           3.2.1.1 Siemens Somatom DR
  1321.  
  1322.               - NOT in SPI format - fixed format - files 133120 bytes
  1323.               (for 256 square images) - image pixel data 256*256*2
  1324.               little endian - image pixel offset 2048 bytes - same for
  1325.               axial images and topograms (scouts)
  1326.  
  1327.  
  1328.               This description pertains to the DR family, and possibly
  1329.               also earlier Siemens CT models, but I have no files from
  1330.               these to test.
  1331.  
  1332.  
  1333.               The files are in fixed format (cf.  the early Magnetom
  1334.               format which is similar, but has block pointers) with
  1335.               three major blocks of entries:
  1336.  
  1337.  
  1338.     - binary data - offset 0 - 512 bytes - text overlay - offset 512 - 960
  1339.     bytes plus 676 bytes free - image pixel data - offset 2048 - 131072
  1340.     bytes
  1341.  
  1342.  
  1343.               The binary data block is filled with the usual cryptic
  1344.               enumerated values and useful parameters.  Some of the more
  1345.               interesting ones are:
  1346.  
  1347.  
  1348.     - binary data block:
  1349.  
  1350.         66 - byte - archive mode (0=raw data,B=256,C=512) 67 - byte -
  1351.         archive mode (0=uncompressed,
  1352.                     2=compressed)
  1353.  
  1354.         72 - short - matrix size (256 or 512)
  1355.  
  1356.         130 - byte - scan mode (P=image data,R=raw data) 131 - byte -
  1357.         scan mode (0=tomogram,Q=quick,S=serial,
  1358.                     C=cardiac,T=topogram,X=test,H=chronogram)
  1359.         132 - short - fov - mm 134 - short - scan time - secs * 10 136 -
  1360.         short - kv 138 - short - dose - maS 140 - short - slice
  1361.         thickness - mm 142 - short - gantry tilt - degrees 144 - short -
  1362.         table position - mm 146 - short - table height - mm 148 - short
  1363.         - scan mode (1=standard(360),
  1364.                     2=quickscan(240),4=topogram)
  1365.  
  1366.         236 - short - view direction (1=cranial,-1=caudal) 238 - byte -
  1367.         head position (0=head first,
  1368.                     1=feet first)
  1369.         239 - byte - patient position (0=supine,
  1370.                     1=prone,2=r lat dec,3=l lat dec)
  1371.  
  1372.         310 - short - window width A 312 - short - window center A 314 -
  1373.         short - window width B 316 - short - window center B
  1374.  
  1375.  
  1376.               Unfortunately, the patient identification information is
  1377.               NOT stored in the binary data block, rather one has to
  1378.               extract it from the image text overlay block, which
  1379.               consists of 960 characters (24 lines of 40 characters
  1380.               WITHOUT carriage control characters) in a fixed format.
  1381.               This is where what you see overlayed on the filmed images
  1382.               is stored.  Some of these values are duplicates of what is
  1383.               in the binary data block, but things like the patient name
  1384.               and so on are here and nowhere else :(
  1385.  
  1386.  
  1387.             0123456789012345678901234567890123456789
  1388.  
  1389.         0 SOMATOM DR2 ST.  ELSEWHERE GEN HOSP 40 999999-9999 JOHN DOE
  1390.         EF2 80 01-JAN-90 FRONT 35B 120 13:31:22 H/SP 160 200 SCAN 60 L
  1391.         240 E 280 F 320 T 360 400 440 480 520 560 600 640 680 720 TI 5
  1392.         760 KV 125 800 AS .35 840 SL 2 880 GT 0 920 TP 144
  1393.  
  1394.     - text overlay block: (some of this is guess work)
  1395.  
  1396.         0 - char[14] - product 15 - char[25] - hospital name 40 -
  1397.         char[12] - patient number 53 - char[22] - patient name 80 -
  1398.         char[2] - date - dd 83 - char[3] - date - mmm 87 - char[2] -
  1399.         date - yy 120 - char[2] - time - hh 123 - char[2] - time - mm
  1400.         126 - char[2] - time - ss 156 - char[1] - H=head first,F=feet
  1401.         first 158 - char[2] - SP=supine,PR=prone,
  1402.                     RP=right lateral decubitus, LP=left lateral
  1403.                     decubitus
  1404.         205 - char[4] - slice number 723 - char[4] - scan time - secs
  1405.         763 - char[4] - kv 803 - char[4] - dose - AmpS 843 - char[4] -
  1406.         slice thickness - mm 883 - char[4] - gantry tilt - degrees 923 -
  1407.         char[4] - table position - mm
  1408.  
  1409.  
  1410.               If anyone knows what "EF2" and "35B" stand for I would
  1411.               love to know - I presume they are something like the
  1412.               filter used, or field of view or something ?
  1413.  
  1414.  
  1415.               Also the DR family don't seem to be aware of the concept
  1416.               of a hierarchy of examination/study and series numbering,
  1417.               which makes it annoying to try to import them into PACS
  1418.               systems :( Correct me if I am wrong but they just seem to
  1419.               keep bumping up the slice number for each patient as each
  1420.               group of scans is done.
  1421.  
  1422.           3.2.2.2 Siemens Somatom Plus
  1423.  
  1424.               There seem to be different formats for different versions
  1425.               of the machine.  Either that or some sites have PACS
  1426.               software and some don't or something.  Anyway, one set of
  1427.               files that were sent to me used a fixed format header much
  1428.               like the DR family, but of different length and with
  1429.               different fields.  I have not yet adequately deciphered
  1430.               this header but will include it here when I have.  This
  1431.               may be what is referred to as the "original header" stored
  1432.               in the SPI format.
  1433.  
  1434.  
  1435.               Another site uses a Siemens version of SPI, containing the
  1436.               following private data elements.  Note that there is
  1437.               overlayed data in the high four bytes of the image pixel
  1438.               data, and that there seems to be a bunch of padding in the
  1439.               middle.  The intent seems to be to store the "original
  1440.               header" and the image pixel data at accessible, presumably
  1441.               standard locations, presumably indexed by the byte offsets
  1442.               and lengths described in group 9.  This is a shame because
  1443.               it seems that none of the really interesting CT attributes
  1444.               have been included in the SPI form, although SPI private
  1445.               tags are available for lots of CT parameters.  I don't
  1446.               have one of these image to test this theory, someone just
  1447.               sent me an output of the attribute dump.
  1448.  
  1449.  
  1450. SPI private tags:
  1451.  
  1452. (0009,0010) <SPI RELEASE 1> (0009,0011) <SIEMENS MED> (0009,1011) SPI RELEASE 1
  1453. UID <049S03CT031995011712072452> (0009,1040) SPI RELEASE 1 DataObjectSubtype
  1454. [0x0000] (0009,1041) SPI RELEASE 1 DataObjectSubtype <IMA TOPO> (0009,1110)
  1455. SIEMENS MED RecognitionCode <CT 1.4> (0009,1130) SIEMENS MED
  1456. ByteOffsetOfOriginalHeader (0009,1131) SIEMENS MED LengthOfOriginalHeader
  1457. (0009,1140) SIEMENS MED ByteOffsetOfPixelmatrix (0009,1141) SIEMENS MED
  1458. LengthOfPixelmatrixInBytes
  1459.  
  1460. (0011,0010) <SPI RELEASE 1>
  1461.  
  1462. (0021,0010) <SIEMENS MED> (0021,1010) SIEMENS MED Zoom <01.0> (0021,1011)
  1463. SIEMENS MED Target <000.000\00.000> (0021,1012) SIEMENS MED TubeAngle <0270>
  1464. (0021,1020) SIEMENS MED ROIMask [0xf000]
  1465.  
  1466. Overlay descriptions (overlays already in image pixel data):
  1467.  
  1468. (6000,0040) ROI <G> (6000,0102) BitPosition [0x000c] (6000,0102) OverlayLocation
  1469. [0x7fe0]
  1470.  
  1471. (6002,0040) ROI <G> (6002,0102) BitPosition [0x000d] (6002,0102) OverlayLocation
  1472. [0x7fe0]
  1473.  
  1474. (6004,0040) ROI <G> (6004,0102) BitPosition [0x000e] (6004,0102) OverlayLocation
  1475. [0x7fe0]
  1476.  
  1477. (6006,0040) ROI <G> (6006,0102) BitPosition [0x000f] (6006,0102) OverlayLocation
  1478. [0x7fe0]
  1479.  
  1480. More SPI private stuff ...  padding and original header ...
  1481.  
  1482. (7001,0010) <SIEMENS MED> (7001,1010) SIEMENS MED Dummy
  1483.  
  1484. (7003,0010) <SIEMENS MED> (7003,1010) SIEMENS MED Header
  1485.  
  1486. (7005,0010) <SIEMENS MED> (7005,1010) SIEMENS MED Dummy
  1487.  
  1488.           3.2.2.3 Siemens Somatom AR
  1489.  
  1490.           Unknown.
  1491.  
  1492.  
  1493.     3.2.3 Philips CT - Big black hole
  1494.  
  1495.     3.2.4 Picker CT
  1496.  
  1497.           Grey hole perhaps.  This information probably pertains to the IQ
  1498.           and PQ CT models, though I have no sample images to experiment
  1499.           with yet.  I am told that:
  1500.  
  1501.  
  1502.           - axial images are 512x512 - pilot images are 1024x1024 -
  1503.           uncompressed images are 12 bits stored in 16 bits - don't know how
  1504.           to handle compression scheme - raster order is as usual, by row,
  1505.           TLHC first - 8k header to be skipped
  1506.  
  1507.     3.2.5 Toshiba CT - another black hole 3.2.6 Hitachi CT - another black
  1508.     hole 3.2.7 Shimadzu CT - another black hole 3.2.8 Elscint CT - another
  1509.     black hole
  1510.  
  1511.     3.2.9 Imatron CT
  1512.  
  1513.           The following information is included verbatim from that kindly
  1514.           supplied by Cameron Ritchie:
  1515.  
  1516. Imatron File Format
  1517.  
  1518. In this document, the Imatron file format is described.  Imatron makes no
  1519. guarantees that future Imatron files will be compatible with the attached
  1520. format.  This format is current as of 2/29/96.
  1521.  
  1522. The format described here is generally true for files produced by all Imatron
  1523. scanners (C-100, C-150L, C-150, C-150XP, C-150LXP); however, some small
  1524. differences may be found.  The file format described below is valid for image
  1525. files on the scanner's RT-11 disks.  What is not described is how to actually
  1526. get one of these files off the RT-11 and on to a workstation or PC for
  1527. conversion.  This procedure is actually almost more difficult than the
  1528. conversion!  There are three options for getting files off the scanner; only one
  1529. does not require additional hardware.  The options are as follows:
  1530.  
  1531.  
  1532.   - Use the RT-11 program "XFR" to transfer the image
  1533.     file from the RT-11 to the VxWorks based VME computer.  XFR can be run from
  1534.     the RT-11 dot prompt.  Following an XFR transfer (provided that the VME
  1535.     computer is on a network), one can ftp to the VME computer and transfer the
  1536.     file to some other computer.  One may or may not need to swap the bytes in
  1537.     the file after the ftp transfer.  The actual procedure for using XFR is
  1538.     relatively complicated, and we recommend that the interested researcher talk
  1539.     to his or her field service engineer to get all the details.
  1540.  
  1541.    - Use the PC-program "UPOW".  The use of this program
  1542.     requires that GPIB interface cards be installed in both the PC and in the
  1543.     scanner console.  Interested researchers should contact Imatron about how to
  1544.     obtain the UPOW software and hardware.
  1545.  
  1546.   - Use the shared memory interface "MEGALINK".  The
  1547.     use of this program requires that shared memory interface boards be
  1548.     installed in the VME computer and in a compatible workstation.  Compatible
  1549.     workstations can be purchased from Siemens, ISG Technologies, or Cemax.
  1550.  
  1551. Two demo image extractors are available for download.  Both are available with
  1552. source code, and Imatron does not guarantee either program's accuracy.  The
  1553. first program converts Imatron format files to headerless files.  The
  1554.  second program
  1555. converts Imatron files to Siemens Somatom, headerless, DICOM, or TIFF.  Command
  1556. line help can be obtained for either program by typing program_name -h.
  1557.  
  1558. Imatron hopes that the information contained here is useful to the research
  1559. community.  Assistance, within reason, can be obtained by contacting:
  1560.  
  1561. Cameron J.  Ritchie, Ph.D.  Applications Scientist Imatron Inc.  389 Oyster
  1562. Point Blvd.  South San Francisco, CA 94080 E-mail: cameron_ritchie@imatron.com
  1563.  
  1564.  
  1565.  
  1566. Disk Data-File Formats
  1567.  
  1568. Scan data collected are stored as raw data in files on the VME disk drive.
  1569. After reconstruction they are stored as image data files on the RT-11 disks.
  1570. These files comprise header information and the acquired data.  An Imatron file
  1571. is a set of information about multiple slices.  Each file contains:
  1572.  
  1573.  
  1574. -A Control Block -A Single File Header -A Slice-Header Position Table, and -One
  1575. Slice Header (for each slice in the file).
  1576.  
  1577.  
  1578.  
  1579. Block 0: Control Block
  1580.  
  1581. The control block is the first block of an Imatron file and contains information
  1582. necessary for interpreting the rest of the file (Table 2-1).
  1583.  
  1584. Table 2-1: Words in a Control Block
  1585.  
  1586.  
  1587.  
  1588.    WORD DESCRIPTION
  1589.  
  1590.      0 Pointer to first block in the file header
  1591.  
  1592.      1 Number of entries in the file header
  1593.  
  1594.      2 Pointer to first block of the file header data
  1595.  
  1596.      3 Pointer to first block in the slice header
  1597.  
  1598.      4 Number of entries in the slice header
  1599.  
  1600.      5 Pointer to first block of the slice header position
  1601.         table
  1602.  
  1603.      6 Number of words in a header table entry
  1604.  
  1605.      7 File type version number
  1606.  
  1607.      8 Number of blocks of detector offset data
  1608.  
  1609.      9 Number of blocks in file header table
  1610.  
  1611.     10 Number of blocks of file header data
  1612.  
  1613.     11 Number of blocks in slice header
  1614.  
  1615.     12 Number of blocks in slice header position table
  1616.  
  1617.     13 Number of blocks for each section of slice header
  1618.         data
  1619.  
  1620.     14 Pointer to start of detector offset blocks
  1621.  
  1622.   15-255 0
  1623.    --->
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630. File and Slice Headers
  1631.  
  1632. Imatron file and slice headers store information about: file organization, the
  1633. patient, scanning, reconstruction, and how to perform image analysis on the
  1634. data.  Information in these headers is not stored in fixed locations in the
  1635. file.  Instead, there is a symbol table that references the header values by
  1636. name.
  1637.  There are two symbol tables in each file: the file-header symbol
  1638. table (referred to as the file header or file-header table), containing names
  1639. and pointers into a single file-header data area; and the slice-header symbol
  1640. table (referred to as the slice header or slice-header table), which uses the
  1641. same format but its pointers are used for all the slice-header data areas (one
  1642. per slice).
  1643.  
  1644. The file header and the slice header are composed of pointer/descriptor units
  1645. which point to variables in the data blocks.  Each unit is 6 words (12 bytes)
  1646. long and organized as shown in Table 2-2.
  1647.  
  1648.  
  1649. Table 2-2: Unit Organization
  1650.  
  1651.  
  1652.    BYTE Contents
  1653.  
  1654.    1-6 ASCII variable name, padded with null bytes
  1655.  
  1656.     7 Null byte (0)
  1657.  
  1658.     8 ASCII variable type (I => Integer, B => Byte, F =>
  1659.        Floating Pt.)
  1660.  
  1661.    9-10 Integer pointer to the word number in the block where
  1662.        the data for this variable starts
  1663.  
  1664.   11-12 Number of data values of the type described in byte 8.
  1665.  
  1666.  
  1667.  
  1668.  
  1669. The integers contained in bytes 9-10 and 11-12 are stored with the least
  1670. significant byte in the first byte, and the most significant byte in the second
  1671. byte.
  1672.  
  1673. The following is an example of how the file-header parameter ICMNTS is defined:
  1674.  
  1675.  
  1676. BYTE: 1-6 7 8 9 10 11 12
  1677.  
  1678.       ICMNTS 0 'B' 37 0 80 0
  1679.  
  1680.  
  1681.  
  1682. Parameter variables:
  1683.  
  1684. -name is ICMNTS (bytes 1-6) -and is a byte variable (byte 8) -and starts at word
  1685. number 37 in the block (bytes 9,10) -and contains 80 bytes of data (bytes
  1686. 11,12).
  1687.  
  1688. One block can contain up to 42 pointer/descriptor units.
  1689.  
  1690.  
  1691.  
  1692. Slice-Header Position Table
  1693.  
  1694. The slice-header position table contains a list of unsigned integer pointers to
  1695. the various slice-header data blocks.  The first word of this table points to
  1696. slice-header data block 1, the second to slice-header data block 2, etc.
  1697.  
  1698.  
  1699.  
  1700. ECG Data
  1701.  
  1702. ECG data is stored in the raw (.VME) and image files for ECG-triggered studies.
  1703. The file header variable ITRTYP, points to the starting block in the file for
  1704. this set of data, which, if present, is 32 blocks long.  There is no slice
  1705. header associated with the data.
  1706.  
  1707. File header parameters are shown in Table 2-3; slice headers are shown in Table
  1708. 2-4.
  1709.  
  1710.  
  1711. Image Data-File Formats
  1712.  
  1713. The C-150 scanner produces axial slices by sweeping an electron beam along one
  1714. of four target rings (Target A, B, C, or D).  X-rays produced by the scanning
  1715. electron beam are detected by a pair of solid-state detector rings (Detector
  1716. Rings 1 and 2).
  1717.  
  1718. In an N-image (Imatron image) file there are N slices, 1 slice per image.  The
  1719. slice-header parameters, NROWS and NCOLS, define the number of rows and columns
  1720. in the stored rectangular image.
  1721.  Data is not compressed.  The first NCOLS words in the
  1722. slice are the first row, the second NCOLS words are the second row, etc.  Image
  1723. data are converted to Hounsfield units by subtracting 1000 (decimal) from each
  1724. word.  The resulting numbers range from -1000 to +3095 inclusive (Imagraph).
  1725.  
  1726. Table 2-3: Data File Header Format
  1727.  
  1728.  
  1729.  INDEX NWDS NAME DESCRIPTION
  1730.  
  1731.    1 1 IFHLEN The number of 256 word blocks in the
  1732.                   file header.
  1733.  
  1734.    2 1 ISHLEN The number of 256 word blocks in the
  1735.                   slice header.
  1736.  
  1737.    3 5 IAFN The ASCII file descriptor.  (6 char.
  1738.                   name,'.',3 char.  extension)
  1739.  
  1740.    8 5 IADATE ASCII date string.  (9 character
  1741.                   string right-padded with a blank.
  1742.  
  1743.   13 4 IATIME ASCII time string.  (8 character
  1744.                   string)
  1745.  
  1746.   17 6 IPATID ASCII patient ID number.  (12 chars.)
  1747.  
  1748.   23 15 IPATNA ASCII patient name.  (30 chars.)
  1749.  
  1750.   38 40 ICMNTS ASCII comments.  (80 chars.)
  1751.  
  1752.   78 1 NDETS The number of detectors.  (432 or
  1753.                   864)
  1754.  
  1755.   79 63 IDEMAP The detector status map for the
  1756.                   file.  All bits defined as 1=working,
  1757.                   0=inoperative.  Channel k's status is indicated in
  1758.                   word IW=1+(k-1)/16, [integer arith.] of IDEMAP, by
  1759.                   bit
  1760.                    IBIT = k - (IW-1)*16 - 1.
  1761.  
  1762.   142 1 ISTOB The starting block for detector
  1763.                   offset measurements.  (0 for no offsets recorded.)
  1764.  
  1765.   143 1 NSLICE The number of slices in the file.
  1766.  
  1767.   144 1 IORGAN The file organization code:
  1768.  
  1769.                   -2 = unsorted raw MM data (AIR, PIN or OFFSET) -1
  1770.                   = unsorted raw MM data (Non-calibration) 0 =
  1771.                   source-fan data 1 = detector-fan data 2 = image
  1772.                   (rectangular) data 3 = tuning point data 4 =
  1773.                   deflection buffer data 5 = processed calibration
  1774.                   data 6 = processed AIR data 7 = processed OFFSET
  1775.                   data
  1776.  
  1777. 145 1 ITTICK The DAS clock period is
  1778.                   microseconds.
  1779.  
  1780. 146 1 NPHVEW The number of phantoms.
  1781.  
  1782. 147 1 IDATYP 0 = DAS output words (All RAW data)
  1783.                   1 = Integer 2 = Floating point (Sinogram,
  1784.                   tuning,offsets) 3 = Scaled 11-bit integer data
  1785.                   (image & screen save) 4 = AP400 block floating
  1786.                   point mantissas 5 = MM address data (calibration
  1787.                   data) 6 = Octal data (deflection buffer files) 7 =
  1788.                   Packed Fast Raw Averaged Data 8 = Scaled 12-bit
  1789.                   integer data (image & screen save)
  1790.  
  1791. 148 1 NDETOM No.  of detector offset measurements
  1792.  
  1793. 149 2 XMMTMU The scale factor to change from mm
  1794.                   to MIP machine units (units are m.u./mm)
  1795.  
  1796. 151 1 IREP The no.  of DAS samples per detector
  1797.                   per source fan.  IREP = 3 for a 50ms scan, IREP =
  1798.                   6 for a 100ms scan.
  1799.  
  1800. 152 2 PIXLEN Length in mm.  of a pixel, from
  1801.                   reconstruction
  1802.  
  1803. 154 1 NLEVEL Number of levels in the file
  1804.  
  1805. 155 1 NPLEVL Number of images per level (valid in
  1806.                   raw image files.  Level number is an integer from
  1807.                   1 to NLEVEL.  Closest to the gun is first.)
  1808.  
  1809. 156 1 IREF 2 Byte ASCII description of the
  1810.                   reference pt.
  1811.  
  1812. 157 1 ISTUDY Study type:
  1813.  
  1814.                   -199 to -100 reserved for test & calibration
  1815.                   "studys" (Not Reconstructable!) -1 =
  1816.                   SCREEN SAVE => No analysis possible.  0 = SPECIAL
  1817.                   STUDY => Anything not covered below.  Atypical
  1818.                   study 1 = LOCALIZATION => single scans, 2 images
  1819.                   per scan, N scans at arbitrary levels (in pairs)
  1820.                   (50 ms) 2 = FLOW STUDY => Typically, a set of
  1821.                   scans triggered periodically.  3 = MOVIE STUDY =>
  1822.                   Typically, many scans taken continuously.  4 =
  1823.                   AVERAGE VOLUME=> Averaged data from a volume study
  1824.                   on a single target ring 5 = VOLUME STUDY =>
  1825.                   various times at lots of levels (table motion) 6 =
  1826.                   AVERAGE FLOW => Averaged data from a flow study on
  1827.                   a single target ring 7 = CONTINUOUS VOLUME (CVS)
  1828.  
  1829.                   51 = IMAGE AVERAGING 52 = REFORMAT 53 to 61
  1830.                   reserved for FUNCTIONAL IMAGE PROC.  53 = FIP
  1831.                   Maximum Difference 54 = FIP Time to Peak 55 = FIP
  1832.                   Area Under the Curve 56 = FIP Center of Mass 102 =
  1833.                   IMAGE SUBTRACTION FLOW 103 = IMAGE SUBTRACTION
  1834.                   MOVIE 105 = IMAGE SUBTRACTION VOLUME 106 = IMAGE
  1835.                   SUBTRACTION AVERAGE FLOW
  1836.  
  1837. 158 10 ICONTR Type of contrast (20 characters)
  1838.  
  1839. 168 2 DOSECN Contrast dose in cc
  1840.  
  1841. 170 10 INJSIT Injection Site (20 characters)
  1842.  
  1843. 180 10 ISTRES Type of stress (20 characters)
  1844.  
  1845. 190 7 IRPHYS Referring physician's last name (14
  1846.                   chars)
  1847.  
  1848. 197 7 IRADIO Radiologist's last name (14 chars)
  1849.  
  1850. 204 2 ITECH Radiation technologist's initials (3
  1851.                   chars)
  1852.  
  1853. 206 5 IBDATE Patient's birthdate (9 chars (ex.
  1854.                   07-jan-17))
  1855.  
  1856. 211 1 ISTHCK Slice thickness, mm.
  1857.  
  1858. 212 1 ICALIB Calibration number
  1859.  
  1860. 213 1 KERNEL Desired kernel flag
  1861.  
  1862. 214 1 ITRTYP trigger type:
  1863.                   1 = manual 2 = timed 3 = ecg with no extra data
  1864.                   else it's a pointer to ecg data in the file
  1865.  
  1866. 215 1 IPATSZ patient size:
  1867.                   1 = small 2 = medium 3 = large 4 = shoulder/pelvis
  1868.                   kluge
  1869.  
  1870. 216 1 IPRLVL regular reconstruction's first level
  1871.                   to recon:0 = none else 1 to nlevel
  1872.  
  1873. 217 20 IDIAG diagnosis comment
  1874.  
  1875. 237 9 IHOSP hospital (actually scanner)
  1876.  
  1877. 246 4 BOLTIM Bolus times
  1878.  
  1879. 250 1 NSPLIT Number of images to be created from
  1880.                   each raw slice
  1881.  
  1882. 251 1 IDLINP Delete raw data flag:
  1883.                   0 = do NOT delete after recon 1 = delete after
  1884.                   complete recon
  1885.  
  1886. 252 2 CDENS Density of contrast
  1887.  
  1888. 254 1 IOFMIN Time since midnight in minutes of
  1889.                   last offsets
  1890.  
  1891. 255 1 IOFDAT Day since dec 31 of last offsets
  1892.  
  1893. 256 1 NRINGS Number of detector rings used.
  1894.  
  1895. 257 1 NTARGT Number of targets used.
  1896.  
  1897. 258 1 ICNREC 0 = not suitable for cone beam
  1898.                   algorithm.  1 = suitable for cone beam algorithm.
  1899.                   2 = suitable and cone beam alg used.
  1900.  
  1901. 259 6 KERNAM ASCII kernel name used.
  1902.  
  1903. 260 1 ISNTYP Sinogram type.
  1904.  
  1905. 261 1 IANTYP Analysis type for ASA
  1906.                   1 = Cone analysis 2 = Air analysis 3 = Pin
  1907.                   analysis
  1908.  
  1909. 262 1 ISTHCF Slice thickness.  LSB = 1/100 mm.
  1910.  
  1911. 263 1 ICOLL Collimator setting (1=1.5mm, 3, 6)
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918. Table 2-4: Data Slice Header Format
  1919.  
  1920.  
  1921.  INDEX NWDS NAME DESCRIPTION
  1922.  
  1923.    1 1 ISDATP Pointer to data for this slice
  1924.                    (Always here!)
  1925.  
  1926.    2 2 R1MU Linear attenuation co-efficient for
  1927.                    water at this energy and current, ring 1.
  1928.  
  1929.    4 1 IROTA = 1 clockwise scan,
  1930.                    or = -1 for counter-clockwise scan.
  1931.  
  1932.    5 2 HVDES Desired high voltage for this scan,
  1933.                    in kV.
  1934.  
  1935.    7 2 HVACT Actual high voltage for this scan,
  1936.                    in kV
  1937.  
  1938.    9 1 ICURNT Actual electron beam current, in
  1939.                    milliamps.
  1940.  
  1941.   10 2 FVDES Desired filament voltage, in volts.
  1942.  
  1943.   12 2 FVACT Actual filament voltage, in volts.
  1944.  
  1945.   14 2 FCACT Actual filament current, in
  1946.                    milliamps.
  1947.  
  1948.   16 1 IRING The detector ring used:
  1949.                    0 = Raw slice with both RINGs interleaved 1 =
  1950.                    RING 1 (closest to gun) 2 = RING 2 (farther from
  1951.                    gun)
  1952.  
  1953.   17 1 ITARGT The target ring used.
  1954.  
  1955.   18 1 NSLAVG The number of scans averaged to
  1956.                    produce this slice.
  1957.  
  1958.   19 2 PICRAD Floating point picture radius in
  1959.                    mm.
  1960.  
  1961.   21 2 XORG Floating point X coordinate of
  1962.                    reconstruction center (0.0 is isocenter) in mm.
  1963.  
  1964.   23 2 YORG Floating point Y coordinate of
  1965.                    reconstruction center (0.0 is isocenter) in mm.
  1966.  
  1967.   25 2 ZOOM Floating point zoom factor (1.0 =
  1968.                    no zoom) for reconstruction
  1969.  
  1970.   27 1 NROWS The number of rows in the
  1971.                    reconstructed image.
  1972.  
  1973.   28 1 NCOLS The number of cols in the
  1974.                    reconstructed image.
  1975.  
  1976.   29 2 VALMAX Maximum value in the slice (in
  1977.                    floating point)
  1978.  
  1979.   31 2 VALMIN Minimum value in the slice (in
  1980.                    floating point)
  1981.  
  1982.   33 2 RSCALE Data has been scaled and biased
  1983.                    such that
  1984.  
  1985.   35 2 RMIN actual data = data/RSCALE + RMIN
  1986.  
  1987.   37 1 IPATH Holding path flag:
  1988.                    0 = path was HOLDING PATH 1 = path was the first
  1989.                    for that pulse 2 = the slice was NOT the first of
  1990.                    that pulse (slices 2-N for a movie or volume)
  1991.  
  1992.   38 2 ELAPSE Time, in seconds, since the first
  1993.                    scan
  1994.  
  1995.   40 1 LEVELN The level number for a given slice
  1996.  
  1997.   41 2 ISTAGE Old:2 word array, 2nd word unused,
  1998.                    1st word is >=0 if data is present and useful.
  1999.  
  2000.   43 1 INOUT In-out table pos.  relative to ref.
  2001.                    (-0.1 mm)
  2002.  
  2003.   44 1 IHITE Up-down table pos.  relative to
  2004.                    reference (mm)
  2005.  
  2006.   45 1 ITILT Table tilt relative to horizontal
  2007.                    (degrees)
  2008.  
  2009.   46 1 ISLEW Table slew relative to straight
  2010.                    (degrees)
  2011.  
  2012.   47 1 ICPHAS Cardiac phase in % R-R-wave
  2013.                    interval
  2014.  
  2015.   48 1 IBEAT Heart beat # for this image
  2016.  
  2017.   49 2 HRATE Heart rate in beats per minute
  2018.  
  2019.   51 1 IPATOR Integer code for patient
  2020.                    orientation: 0 = not applicable or special case 5
  2021.                    = prone head first flipped + 1 = supine
  2022.  
  2023.                 + 2 = prone + 3 = decubitus right + 4 =
  2024.                 decubitus left -5 = supine ff (flipped to match
  2025.                    1)
  2026.                 -6 = prone ff (ditto 2) -7 = decub right (ditto
  2027.                 3) -8 = decub left (ditto 4)
  2028.                    Positive refers to HEAD FIRST (head closest to
  2029.                    gun).  Negative refers to FEET FIRST.
  2030.  
  2031.   52 2 SLSIZE Size of slice in words
  2032.  
  2033.   54 1 ITN Order of Chebychev polynomial
  2034.                    applied to data (only if valid during
  2035.                    calibration, for normal recon ITN = 0).
  2036.  
  2037.   55 2 R2MU Linear attenuation coefficient for
  2038.                    water at this energy and current, ring 2.
  2039.  
  2040.   57 1 IVMFLAG Contains bit-map of flags used by
  2041.                    recon.
  2042.  
  2043.   58 1 NTARGS Number of target sections of this
  2044.                    target ring.
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050. Scanner Operating Modes
  2051.  
  2052. The scanner operates in two different modes: Single-Slice Mode (SSM) and
  2053. Multi-Slice Mode (MSM).
  2054.  
  2055. Single-Slice Mode:
  2056.  
  2057.   The FILE HEADER variable "IREP" defines Single-Slice
  2058. Mode:
  2059.  
  2060. IREP = 6 for SSM
  2061.  
  2062.   The total number of images in the file is the FILE HEADER variable
  2063. NSLICE.
  2064.  
  2065.   The total number of axial slice positions in the file is the
  2066. FILE HEADER variable NLEVEL.
  2067.  
  2068.   In SSM, only Target Ring C and Detector Ring 2 are used.
  2069.  
  2070.   Each sweep of the beam along Target Ring C takes 100 milliseconds.
  2071.  
  2072.   The exposure time (in seconds) is determined by the SLICE HEADER
  2073. variable "NSLAVG":
  2074.  
  2075. Exposure time (seconds) = NSLAVG * 0.1
  2076.  
  2077.   The axial position for each slice is determined by the SLICE
  2078. HEADER variable "INOUT" (which is in tenth mm units):
  2079.  
  2080. Slice position relative to reference (in mm) = INOUT/10
  2081.  
  2082.  
  2083. Multi-Slice Mode:
  2084.  
  2085.   The FILE HEADER variable "IREP" defines Multi-Slice
  2086. Mode:
  2087.  
  2088. IREP = 3 for MSM
  2089.  
  2090.   The total number of images in the file is the FILE HEADER variable
  2091. NSLICE.
  2092.  
  2093.   The total number of axial slice positions in the file is the
  2094. FILE HEADER variable NLEVEL.
  2095.  
  2096.   In MSM Mode, each sweep of the electron beam along a single
  2097. target ring produces a pair of simultaneously acquired, side-by-side axial
  2098. slices (1 from each detector ring).
  2099.  
  2100.   Any combination of target rings (A, B, C, or D) may be used.
  2101.  
  2102.   Each sweep of the beam along any single target ring takes 50
  2103. milliseconds.
  2104.  
  2105.   The exposure time (in seconds) is determined by the SLICE HEADER
  2106. variable "NSLAVG":
  2107.  
  2108. Exposure time (seconds) = NSLAVG * 0.05
  2109.  
  2110.   The axial position for each slice is determined by the SLICE
  2111. HEADER variables "INOUT," "ITARGET," and "IRING"
  2112. and may be calculated as follows:
  2113.  
  2114. KTARGT = ITARGT - 64 /* Convert ascii target to integer */
  2115.  
  2116. TAROFF = -20.0 + (4 - KTARGT)*20.0 /* Distance from C to target */
  2117.  
  2118. DETOFF = mod(IRING,2)*8 /* Distance from detector Ring 2 to detector */
  2119.  
  2120. Slice position relative to reference (in mm) = INOUT/10.  + TAROFF + DETOFF
  2121.  
  2122. Study Types
  2123.  
  2124. The six Imatron study types are described as follows:
  2125.  
  2126.  
  2127. SSM Flow (IREP = 6, ISTUDY = 6)
  2128.  
  2129. Description: For an N-slice SSM Flow Study, the following
  2130.              is repeated NSLICE times: A 100-ms sweep of the beam is
  2131.              performed NSLAVG times along ring C (with 16 ms between
  2132.              sweeps), and the data for the NSLAVG sweeps are summed
  2133.              together to produce a single image.  All of the data are
  2134.              acquired at a single axial slice position, sequentially in
  2135.              time.
  2136.  
  2137. File Organization: Slice 1 in the file is the first "time,"
  2138.              slice 2 is the second "time," ...slice n is the
  2139.              nth "time."
  2140.  
  2141.  
  2142.  
  2143.  
  2144.  
  2145. SSM Cine (IREP = 6, ISTUDY = 3)
  2146.  
  2147. Description: For an N-slice SSM Cine study, NSLICE 100-ms
  2148.              sweeps of the beam are performed along Target Ring C (with
  2149.              16 ms between sweeps).  Each sweep of the beam produces a
  2150.              single image.  All of the data are acquired at a single
  2151.              axial slice position, sequentially in time.
  2152.  
  2153. File Organization: Slice 1 in the file is the first "time,"
  2154.              slice 2 is the second "time," ...  slice n is the
  2155.              nth "time."
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161. SSM Volume (IREP = 6, ISTUDY = 5)
  2162.  
  2163. Description: In an N-slice volume study, the following
  2164.              sequence is repeated NSLICE times in succession: A 100 ms
  2165.              sweep of the beam is performed NSLAVG times along ring C
  2166.              (with 16-ms between sweeps), and the data for the NSLAVG
  2167.              sweeps are summed together to produce a single image.  Then
  2168.              the patient table moves to a new axial position.
  2169.  
  2170. File Organization: Slice 1 in the file is the first "level,"
  2171.              slice 2 is the second "level," ...  slice n is
  2172.              the nth "level."
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178. MSM Volume (IREP = 3, ISTUDY = 5)
  2179.  
  2180. Description: MSM Volume Studies always use Target Ring C
  2181.              (only), and both Detector Rings 1 and 2.  In an MSM VOLUME
  2182.              STUDY, the following sequence is repeated NLEVEL/2 times in
  2183.              succession: A 50-ms sweep of the beam is performed NSLAVG
  2184.              times along ring C (with 8-ms between sweeps) and the data
  2185.              for the NSLAVG sweeps are summed together to produce a pair
  2186.              of side-by-side images acquired at adjacent axial
  2187.              positions.  Then the patient table moves to a new axial
  2188.              position.
  2189.  
  2190. File Organization: Slice 1 in the file is the first "level,"
  2191.              slice 2 is the second "level," ...slice n is the
  2192.              nth "level."
  2193.  
  2194.  
  2195.  
  2196.  
  2197.  
  2198. MSM Flow (IREP = 3, ISTUDY = 1 or 2)
  2199.  
  2200. Description: Refer to the general Multi-Slice Mode
  2201.              description, above.  In an MSM Flow study, the following
  2202.              applies:
  2203.  
  2204.              N_T = The number of times = NSLICE/NLEVEL
  2205.  
  2206.              The following action is repeated N_T times:
  2207.  
  2208.                For a 2-level MSM Flow, the beam sweeps
  2209.              once on a single target ring (A, B, C, or D) to produce a
  2210.              pair of side-by-side images acquired at the same
  2211.              "time."
  2212.  
  2213.                For a 4-level MSM Flow, the beam sweeps
  2214.              once on one target ring, then 8 ms later, sweeps on a
  2215.              second target ring; this produces 4 side-by-side images
  2216.              acquired at the same "time."
  2217.  
  2218.                For a 6-level MSM Flow, the beam sweeps
  2219.              once on one target ring, then 8 ms later, sweeps on a
  2220.              second target ring; followed 8 ms later by another sweep,
  2221.              on a third target ring; this produces 6, side-by-side
  2222.              images acquired at the same "time."
  2223.  
  2224.              For an 8-level MSM Flow, the beam sweeps once on one target
  2225.              ring, then 8 ms later, sweeps on a second target ring;
  2226.              followed 8 ms later by another sweep on a third target
  2227.              ring, and again, 8 ms later on the fourth target ring; this
  2228.              produces 8, side-by-side images acquired at the same
  2229.              "time" (Table 2-5).
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236. Table 2-5: File Organization for MSM Flow
  2237.  
  2238.  
  2239.   Slice in File Time Axial Position
  2240.            Index
  2241.  
  2242.     1 1 use MSM Template info => axial
  2243.                 index i
  2244.  
  2245.     2 1 use MSM Template info => axial
  2246.                 index ii
  2247.  
  2248.     3 1 use MSM Templace info => axial
  2249.                 index iii
  2250.  
  2251.     .  .  .
  2252.  
  2253.     .  .  .
  2254.  
  2255.     .  .  .
  2256.  
  2257.      NLEVEL 1 use MSM Template info => index
  2258.                 nlevel
  2259.  
  2260.     NLEVEL+1 2 axial index i
  2261.  
  2262.     NLEVEL+2 2 axial index ii
  2263.  
  2264.     .  .  .
  2265.  
  2266.     .  .  .
  2267.  
  2268.     .  .  .
  2269.  
  2270.     2*NLEVEL 2 axial index nlevel
  2271.  
  2272.    2*NLEVEL+1 3 axial index i
  2273.  
  2274.     .  .  .
  2275.  
  2276.     .  .  .
  2277.  
  2278.     .  .  .
  2279.  
  2280. (N_T-1)*NLEVEL+1 N_T axial index i
  2281.  
  2282. (N_T-1)*NLEVEL+2 N_T axial index ii
  2283.  
  2284.     .  .  .
  2285.  
  2286.     .  .  .
  2287.  
  2288.     .  .  .
  2289.  
  2290.    N_T*NLEVEL N_T axial index nlevel
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296. MSM Cine (IREP = 3, ISTUDY = 3)
  2297.  
  2298. Description Refer to the general MSM description above.
  2299.              In an MSM Cine study, the following applies:
  2300.  
  2301.  
  2302.              N_T = The number of times = NSLICE/NLEVEL
  2303.  
  2304.              NTARGS = The number of targets used = NLEVEL/2
  2305.  
  2306.  
  2307.  
  2308.  
  2309. The following action is repeated NTARGS times (once for each target):
  2310.  N_T 50-ms sweeps of the beam are performed, with 8-ms between
  2311. sweeps, along a single target ring (A, B, C, or D); this produces a pair of
  2312. images acquired at adjacent axial positions.  (See Table 9, below.)
  2313.  
  2314.  
  2315. Table 2-6: File Organization for MSM Cine
  2316.  
  2317.  
  2318. Slice in File Time Axial Position
  2319.             Index
  2320.  
  2321.       1 1 use MSM Template info => axial index
  2322.                 i
  2323.  
  2324.       2 1 use MSM Template info => axial index
  2325.                 ii
  2326.  
  2327.       3 2 axial index i
  2328.  
  2329.       4 2 axial index ii
  2330.  
  2331.       5 3 axial index i
  2332.  
  2333.       6 3 axial index ii
  2334.  
  2335.       .  .  .
  2336.  
  2337.       .  .  .
  2338.  
  2339.    2*N_T-1 N_T axial index i
  2340.  
  2341.    2*N_T N_T axial index ii
  2342.  
  2343.    2*N_T+1 1 use MSM Template info => axial index
  2344.                 iii
  2345.  
  2346.    2*N_T+2 1 use MSM Template info => axial index
  2347.                 iv
  2348.  
  2349.    2*N_T+3 2 axial index iii
  2350.  
  2351.    2*N_T+4 2 axial index iv
  2352.  
  2353.       .  .  .
  2354.  
  2355.       .  .  .
  2356.  
  2357.    4*N_T-1 N_T axial index iii
  2358.  
  2359.    4*N_T N_T axial index iv
  2360.  
  2361.       .  .  .
  2362.  
  2363.       .  .  .
  2364.  
  2365. (NLEVEL-2)*N_T+1 1 use MSM Template info => axial index
  2366.                 nlevel-1
  2367.  
  2368. (NLEVEL-2)*N_T+2 1 use MSM Template info => axial index
  2369.                 nlevel
  2370.  
  2371. (NLEVEL-2)*N_T+3 2 axial index nlevel-1
  2372.  
  2373. (NLEVEL-2)*N_T+4 2 axial index nlevel
  2374.  
  2375.       .  .  .
  2376.  
  2377.       .  .  .
  2378.  
  2379. NLEVEL*N_T-1 N_T axial index nlevel-1
  2380.  
  2381. NLEVEL*N_T N_T axial index nlevel
  2382.  
  2383.  
  2384.  
  2385.  
  2386.  
  2387. The next part is part4 - proprietary MR formats.
  2388.  
  2389.  
  2390.