DMフォーマット

提供: Eospedia
2015年4月18日 (土) 00:23時点におけるTacyas (トーク | 投稿記録)による版

移動: 案内検索

GATAN DIgital Micrographのフォーマットです。 開発の際に、[http://www.er-c.org/cbb/info/dmformat/] にある情報を理解するためにこちらにまとめました。

DM3

 画像は、ヘッダー、タグディレクトリ、ファイルの最後を示したNULL(8文字)からなっている。 タグディレクトリは、タグか複数のタグディレクトリを階層構造として持つ事ができる。

 画像は、"ImageList"と名付けられたtag directoryに格納されている。一つ以上の画像を格納できる。

全体構造

ヘッダー
ルートタグディレクトリ
タグ or タグディレクトリ
ファイルの最後を示すタグ(8*null)
タグ:単独の情報
タグディレクトリ:タグもしくはタグディレクトリを複数含む情報
ルートタグディレクトリ:最上位のディレクトリ。/に対応すると思えばよい。

Header

 version   i4be    DM version = 3
 rootlen   i4be    Size of root tag directory in bytes = file length - 16
 byteord   i4be    Byte order, 0 = big endian (Mac) order,
                               1 = little endian (PC) order

Root tag directory

タグディレクトリがもつヘッダーに対応します。

 sortf     i1      Sorted, 1 = sorted (normally = 1)
 closef    i1      Closed, 1 = open (normally = 0)
 ntags     i4be    Number of tags in root directory (12h = 18) 内部にあるタグ(もしくはタグディレクトリの数)

Tags and tag directories in root tag directory

下記が繰り返される

 tag       i1      tag, 14h or 15h or 0 for end of file (0x14, 0x15, 0x00)
 ltname    i2be    tag name length in bytes, may be 0
 tname     a       tag name (length ltname), may be absent
 ...               tag directory or tag data

ファイルの最後

 8*00     End of file is marked with 8 nulls
   tag      00
   ltname 00 00
   tname  00 00 00 00 00

ファイル全体の構造(例)

(例)

 00 00 00 03  バージョン                                          dmFileHeaderTailRead
 00 22 59 b9    ファイルサイズ - 16                            dmFile3HeaderRead
 00 00 00 00  バイトオーダー
 01                      Root tag: Stored                                dmFile3TagDirectoryHeaderRead
 00                      Root tag: Closed
 00 00 00 12  Root tagの数
 15       TagID                                                  dmFile3TagHeaderRead
 00 11                TagNameのバイト数  
 41 70 70  6c 69 63 61  74 69 6f 6e 
                          TagName("Application")                    --> Tags
 ......
 14       TagID                                                  dmFile3TagHeaderRead 
 00 11                TagNameのバイト数  
 41 70 70  6c 69 63 61  74 69 6f 6e 
                          TagName("Application")                     --> Tag Directories
 ......

00 00 00 00 00 00 00 00  ファイルの終わり              dmFileHeaderTailRead

Tag directories と Tags

Root tag directoryや下位層のtag directoriesにおいて、その内部構造としてタグ、もしくは、タグディレクトリがあることの判断をする部分

 0x14 = 20 : タグディレクトリ(更に下位にタグディレクトリがある)
 0x15 = 21 : タグ
 0x00 = 00 : ファイルの終了

Tag directories

タグディレクトリである場合には、下記の形式となる。

 14   00 12   44 6f 63 75 6d 65 6e 74 4f 62 6a 65 63 74 4c 69 73 74
 00   00   00 00 00 01
 ......
 14             i1      identifies tag directory (14h = 20) タグディレクトリであれば、0x14である。 
 00 12        i2be    bytes in tag name (ltname), may be 0
 44 6f 63 75  6d 65 6e 74  4f 62 6a 65  63 74 4c 69  73 74
                  a       tag name, length ltname "DocumentObjectList"  ここまでは、タグもタグディレクトリも共通
 00             i1      1 = sorted? (can be 0 or 1) タグディレクトリの場合にはここからが入ってくる
 00             i1      0 = closed?, 1 = open (normally = 0)
 00 00 00 01    i4be    number of tags in tag directory (01h = 1). Can be 0

タグ(Tags)

タグの場合には下記の様になる。

i1                  identifies tag (15h = 21)
i2be              ltname, bytes in tag name, may be 0 
a                   tag name, length ltname           ここまでは共通
a4                 string "%%%%"               タグの場合のセパレータ
i4be              ninfo, size of info array following (=1)  ここは、単純なタグか、配列か、構造体かによって, ninfoが異なってくる。
i4be*ninfo     info(ninfo), array of ninfo integers contains tag data type(s) for tag values 
xx* * ninfo     tag values (byte order set by byte order flag) byte lengths specified in info(ninfo)

(例)

 15   00 0e   41 6e 6e 6f 74 61 74 69 6f 6e 54 79 70 65
 25 25 25 25   00 00 00 01   00 00 00 03   00 00 00 14


 15             i1      identifies tag (15h = 21)
 00 0e          i2be    bytes in tag name (ltname), may be 0
 41 6e 6e 6f  74 61 74 69  6f 6e 54 79  70 65
                a       tag name, length ltname "AnnotationType" ここまでは共通
 25 25 25 25    a4      "%%%%"                              セパレータ
 00 00 00 01    i4be    ninfo, size of info array following (=1) infoの個数をチェック(次の型に応じて、情報の個数が異なる)
 00 00 00 03    i4be    info(ninfo), array of ninfo i4 integers, in this case just 1
                        contains tag data type (3 = signed i4*)    此処がデータの型、単純な型、配列、構造体によって値が異なる。
 00 00 00 14    i4*     tag value, 14h = 20

一つだけデータを持つ場合には

 ninfo = 1
 info(1) = tag data type(データの型)

構造体として指定

 15 0006 4f6666736574  25252525 00000007 0000000f 00000000 00000002
                       00000000 00000006 00000000 00000006
                       00000000 00000000


 15             i1      identifies tag (15h = 21)
 00 06          i2be    bytes in tag name (ltname), may be 0
 4f 66 66 73 65 74
                a       tag name, length ltname "Offset" ここまでは一緒
 25 25 25 25    a4      "%%%%"
 00 00 00 07    i4be    ninfo, size of info array following (=7)         このタグの情報の数              
                        info(ninfo):
 00 00 00 0f    i4be    info(1) tag data type (0fh = group of data)       データ型:0xF (構造体) 0
 00 00 00 00    i4be    info(2) length of groupname? (always = 0)                    
 00 00 00 02    i4be    info(3) ngroup, number of entries in group (=2)               構造体の要素数                  2
 00 00 00 00    i4be    info(4) length of fieldname? (always = 0)
 00 00 00 06    i4be    info(5) tag data type for value 1 (06h = f4)        型          4
 00 00 00 00    i4be    info(6) length of fieldname? (always = 0)
 00 00 00 06    i4be    info(7) tag data type for value 2 (06h = f4)        型
                        tag values:
 00 00 00 00    f4*     value(1)
 00 00 00 00    f4*     value(2)

For group tags

ninfo = size of info array info(1) = 0fh info(2) = 0 normally info(3) = ngroup, number of members in group info(2*i+3) = tag data type for value i Other info entries are always zero

配列を含むタグ

Example, an image tag

15 0004 44617461 25252525 00000003 00000014 00000002 00000024

                fdff feff ffff 0000 0100 0200 0300 0400 0500
                fdff feff ffff 0000 0100 0200 0300 0400 0500
                fdff feff ffff 0000 0100 0200 0300 0400 0500
                fdff feff ffff 0000 0100 0200 0300 0400 0500


 15             i1      identifies tag (15h = 21)
 00 04          i2be    bytes in tag name (ltname)
 44 61 74 61    a       tag name, length ltname "Data" ここまでは共通
 25 25 25 25    a4      "%%%%" セパレータ
 00 00 00 03    i4be    ninfo, size of info array following (=3)
                        info(ninfo):
 00 00 00 14    i4be    info(1), tag data type (14h = array)            配列か構造体か、単純なタグかの判断
 00 00 00 02    i4be    info(2), tag data type for array members (02h = i2 signed)
 00 00 00 24    i4be    info(3) = info(ninfo), narray, size of array (=36)
                        tag values:
 fd ff          i2*     value(1)
 fe ff          i2*     value(2)
 ....                   etc to value(36)

For array tags

ninfo = 3 info(1) = 14h info(2) = tag data type for all array members info(3) = info(ninfo), narray, size of array


構造体の配列を含むタグ

15 0004 434c5554 25252525 0000000b 00000014 0000000f 00000000 00000003

                00000000 00000002 00000000 00000002 00000000 00000002
                00000100
                0000 0000 0000
                0101 0101 0101
                0202 0202 0202
                0303 0303 0303
                .....
 15             i1      identifies tag (15h = 21)
 00 04          i2be    bytes in tag name (ltname)
 43 4c 55 54    a       tag name, length ltname "CLUT"
 25 25 25 25    a4      "%%%%"
 00 00 00 0b    i4be    ninfo, size of info array following (=11)
                        info(ninfo):
 00 00 00 14    i4be    info(1), tag data type (14h = array)            ここで配列であることが分かる
 00 00 00 0f    i4be    info(2), tag data type for array members (0fh = group) ここで、構造体の配列であることが分かる
 00 00 00 00    i4be    info(3), length of groupname? (always = 0)
 00 00 00 03    i4be    info(4), ngroup, number of entries in group (=3)
 00 00 00 00    i4be    info(5), length of fieldname? (always = 0)
 00 00 00 02    i4be    info(6), tag data type for value 1 (02h = i2)
 00 00 00 00    i4be    info(7), length of fieldname? (always = 0)
 00 00 00 02    i4be    info(8), tag data type for value 2 (02h = i2)
 00 00 00 00    i4be    info(9), length of fieldname? (always = 0)
 00 00 00 02    i4be    info(10), tag data type for value 3 (02h = i2)
 00 00 01 00    i4be    info(11) = info(ninfo), narray, size of array (=256)
                        tag values:
 0000 0000 0000 3i2*    3 values for first element of array
 0101 0101 0101 3i2*    3 values for second element of array
 ....

構造体の配列に関する情報

ninfo = size of info array
info(1) = 14h
info(2) = 0fh
info(3) = 0 normally
info(4) = ngroup, number of values in group
info(2*i+4) = tag data type for value i
info(ninfo) = narray, size of info array

タグのデータ型

Tag data types

 02h =  2  i2* signed    (short)
 03h =  3  i4* signed    (long)
 04h =  4  i2* unsigned  (ushort) or unicode string
 05h =  5  i4* unsigned  (ulong)
 06h =  6  f4*           (float)
 07h =  7  f8*           (double)
 08h =  8  i1            (boolean)
 09h =  9  a1            (char)
 0ah = 10  i1
 0bh = 11  i8* ?         (long long) not sure if signed or unsigned
 0fh = 15  group of data (struct)
           info(2) = 0
           info(3) = ngroup, number in group
           info(2*n+4) = 0
           info(2*n+5) data type for each value in group
 12h = 18  a             (string)
 14h = 20  配列であることを示している。array of numbers or groups
           info(ninfo) = narray, number of array members
           info(2) is then treated as info(1) above
 15h = 21  構造体であることを示している。array of groups (struct)

一般的な説明

構造体(type-15)の長さを知る簡単な方法はなく、その構造体を理解して、それぞれのデータ型に併せてバイト数を明らかにする必要がある。

画像自身は、"Data"という名前のtype-15の構造体の中に存在しており、画像を長さと数のタグとして見出してくることは難しい。一つの可能性としては、 "15h 0004h Data%%%%"という文字列を探し出すと、この16バイト後ろから画像の情報が始まっているということである。

ファイルの中には、一つ以上の画像が入っているかも知れない。それぞれの画像毎に"Data"タグをもっている。画像は、0からナンバリングされている。

サムネイル画像が、画像の前後に含まれている場合がある。サムネール"Data"タグの画像の数は、Thumbnails::ImageIndexタグで与えられている。

下記のタグが有効なタグである。

Description        info in the notes box (not always present) 
Data               画像データ、若しくは、サムネール

DataType        DM2の画像データフォーマットと同じ

注意:像のデータ型を示したものである。タグデータの型とは異なるので注意が必要である。

                  Note this is different from the tag data type above.
                  These values are only for the image data and must be
                  consistent with the tag data type for the Data tag.
                  There are a number of other DataTypes defined that I've
                  never seen in images
  0            null
  1     i2     2 byte integer signed ("short")
  2     f4     4 byte real (IEEE 754)
  3     c8     8 byte complex (real, imaginary)
  4            obsolete
  5     c4     4 byte packed complex (see DM2)
  6    ui1     1 byte integer unsigned ("byte")
  7     i4     4 byte integer signed ("long")
  8  4*ui1     rgb, 4 bytes/pixel, unused, red, green, blue
  9     i1     1 byte integer signed
 10    ui2     2 byte integer unsigned
 11    ui4     4 byte integer unsigned
 12     f8     8 byte real
 13     c16   16 byte complex
 14     i1     1 byte binary (ie 0 or 1)
 23  4*ui1     rgba, 4 bytes/pixel, 0, red, green, blue. Used for thumbnail images


Dimensions a type 14 tag containing 2 type 15s with no names

                  (irritatingly) which are image width and height

PixelDepth bytes/pixel

For CCD images (these follow the tags above)

Acquisition Date image acquisition date and time, unfortunatley both Acquisition Time as strings. Worse still, the date string can be

                  in either UK/international or US order depending on the
                  date settings on the mac or PC. It is thus impossible
                  to unambiguously determine the date from the date string.

ImageIndex Image number of thumbnail image Unfortunately the tags describing the image are after the image itself, this is particularly annoying for the image dimensions.

DM4

 DM4フォーマットは、DM3フォーマットに非常によく似ている。4バイト整数ではなく、8バイト整数を用い、2Gバイトを超えたファイルにも対応している。それぞれのタグのバイト数をもつことにより、知らないタグに関しても無視することができる。タグ毎にそれぞれのタグのバイト数をもつようになったので、知らない、あるいは、必要ない情報はスキップすることが容易になった。


全体構造 

DM3ファイルと同様に、ヘッダー、ルートタグディレクトリ、タグ・タグディレクトリ、そして、最後に8つのNULL(ファイルの終了記号)からなっている。タグの名前はDM3と同じである。

ヘッダー(Header)

 version   i4be    DM version = 4
 rootlen   i8be    Size of root tag directory in bytes = file length - 24 (このバイト数が異なる。16(Header) + 8(NULL End)を引いたもの)
 byteord   i4be    Byte order, 1 = little endian (PC) order


ルートタグディレクトリ(Root tag directory)

 sortf     i1      Sorted, 1 = sorted (normally = 1)
 closef    i1      Closed, 1 = open (normally = 0)
 ntags     i8be    Number of tags in root directory (このバイト数が異なる)


Tags and tag directories in root tag directory

下記は、それぞれのタグディレクトリやタグで繰り返される(詳細は後述)

 tag       i1      tag, 14h or 15h or 0 for end of file
 ltname    i2be    tag name length in bytes, may be 0
 tname     a       tag name (length ltname), may be absent
 tlen      i8be    tag data size in bytes (new for dm4) (これが加わった)

       これにより、中身をみないでスキップすることができる。

 ...               tag directory or tag data

ファイルの最後(End of file)

           8*00     End of file is marked with 8 nulls

DM4ファイルの例

(例)全体

 00 00 00 04  00 00 00 00 01 09 58 7e  00 00 00 01
 01 00  00 00 00 00 00 00 00 0f
 15  00 11
 41 70 70 6c 69 63 61 74 69 6f 6e 42 6f 75 6e 64 73
 00 00 00 00 00 00 00 84  25 25  25 25
 ......
 00 00 00 00 00 00 00 00

Header

 00 00 00 04              i4be    DM version = 4
 00 00 00 00 01 09 58 7e  i8be    file length - 24 (このバイト数がDM3と異なる)
 00 00 00 01              i4be    byte order, 1 = little endian (PC) order

Root tag directory

 01                       i1      1 = sorted (normally = 1)
 00                       i1      0 = closed, 1 = open (normally = 0)
 00 00 00 00 00 00 00 0f  i8be    number of tags in root directory (0fh = 15)

                (このバイト数が異なる)

Tag in root tag directory

 15  00 11  41 70 70 6c ...       Tag directories and tags, see below

End of file

 00 00 00 00 00 00 00 00          End of file appears to be marked with 8 nulls


Tag directories and tags

タグかタグディレクトリかは、最初のバイトで区別される

 14h = 20      tag directory
 15h = 21      tag
 00            end of file

Tag directories

タグディレクトリは、0個以上のタグかタグディレクトリを含む。

Tag directoryの構造
 tag       i1      tag = 14h (20), identifies tag directory
 ltname    i2be    tag name length in bytes, may be 0
 tname     a       tag name (length ltname), may be absent
 tlen      i8be    total bytes in tag directory including all sub-directories (new for DM4)   
        (新しく加わった。ここからこの値だけスキップすると次のtagIDを読み込むことになる)
 sortf     i1      Sorted, 1 = sorted (mostly = 1)
 closef    i1      Closed, 1 = open (normally = 0)
 ntags     i8be    Number of tags in tag directory. Can be 0 (in which case tlen = 10)
         (バイト数が異なる)

 例 

 14                                                 20
 00 12                                              18
 44 6f 63 75 6d 65 6e 74  4f 62 6a 65 63 74 4c 69
 73 74                                              DocumentObjectList
 00 00 00 00 00 00 15 36                            5430
 00                                                 0
 00                                                 0
 00 00 00 00 00 00 00 01                            1

Tags

タグ内部のデータは配列によって定義されており、そのタグが示す情報の要素の個数や個々の要素のデータ型などを含んでいる。情報列の最初の項はデータ型を表し、その後はデータ型に応じて、残りの情報を示している。

DM3との大きな違いは、タグをスキップすることができるように、タグ情報やデータ型などの情報を知ること無しに、タグの長さ(バイト数)を知ることができる点である。

タグは、一つだけの値を含むもの(single entry)、多くの異なるデータ型の値を含むことができるもの(group tag/struct)、同じデータ型(group/strcut型も含む)の配列(Array)のいずれかである。

タグの全体構造

基本的に、全て4バイト整数ではなく、8バイト整数に変更になっているので、注意が必要である。

 tag         i1           tag = 15h (21), identifies tag
 ltname      i2be         tag name length in bytes, may be 0
 tname       a            tag name (length ltname), may be absent
 tlen        i8be         total bytes in tag including %%%% (new for DM4)
                              (新しく加わった。ここからこの値だけスキップすると次のtagIDを読み込むことになる)
 %%%%        a4           string "%%%%"
 ninfo       i8be         size of info array following
 info(ninfo) ninfo*i8be   array of ninfo integers,
                          contains tag data type(s) for tag values
                          info(1) = tag data type (see tag data types below)
 <values>    xx*          tag values (byte order set by byte order flag)
                          byte lengths specified in info(ninfo)
単独のエントリ(Single entry tag)

値が一つの場合は以下の通り タグの情報数、データ型も8バイト整数になっているので、注意が必要である。

 ...
 ninfo       i8be         ninfo = 1
 info(1)     i8be         tag data type (any value except 0fh and 14h)
 <value>     xx*          tag value, length defined by tag data type in info(1)
構造体型(Tag containing a group of data (struct))

データ型の異なりうる一つ以上の値を含むデータグループ(構造体)(場合に寄っては同じ型)の場合は、以下の通り。

 ...
 ninfo       i8be         number of elements in info array (タグ情報の要素数)
 info(1)     i8be         = 0fh, tag data type       (構造体であることを示す:0xf)
 info(2)     i8be         = 0
 info(3)     i8be         ngroup, number of elements in group (構造体の要素数)
 info(2*i+2) i8be         = 0
 info(2*i+3) i8be       tag data type for element i      (i番目の要素のデータ型)
                          above repeated for i = 1 to ngroup
 <value>     xx*          tag values, length defined by tag data type in info(2*i+3)
                          above repeated for i = 1 to ngroup
 15                                                               21
 00 11                                                          17
 41 70 70 6c 69 63 61 74  69 6f 6e 42 6f 75 6e 64  73  ApplicationBounds
 00 00 00 00 00 00 00 84                           132
 25 25 25 25                                         %%%%
 00 00 00 00 00 00 00 0b                             11 (タグの要素数)
 00 00 00 00 00 00 00 0f                              15 (構造体型)
 00 00 00 00 00 00 00 00                               0
 00 00 00 00 00 00 00 04                               4 (構造体の要素数)
 00 00 00 00 00 00 00 00                               0
 00 00 00 00 00 00 00 0b                             12 (要素1データ型:8バイト整数)
 00 00 00 00 00 00 00 00                               0
 00 00 00 00 00 00 00 0b                             12 (要素2データ型:8バイト整数)
 00 00 00 00 00 00 00 00                               0
 00 00 00 00 00 00 00 0b                             12 (要素3データ型:8バイト整数)
 00 00 00 00 00 00 00 00                               0
 00 00 00 00 00 00 00 0b                             12 (要素4データ型:8バイト整数)
 00 00 00 00 00 00 00 00                               0     (要素1:データ)
 00 00 00 00 00 00 00 00                               0     (要素2:データ)
 29 04 00 00 00 00 00 00                               1065    (要素3:データ)
 3c 06 00 00 00 00 00 00                               1596    (要素4:データ)


配列(Tag containing an array)
 ...
 ninfo       i8be         = 3, number of elements in info array  (タグの要素数)
 info(1)     i8be         = 14h, array data type         (0x14: 配列(データ型))
 info(2)     i8be         tag data type for all array elements   (データ型)
 info(3)     i8be         narray, number of elements in array    (配列の個数)
 <value>     xx*          tag values, length defined by tag data type in info(2)
                          above repeated narray times                         (データ)


構造体をデータ型として含む配列(Tag containing an array of groups)

配列のデータ型が構造体である場合には、構造体の配列として取り扱う。

 ...
 ninfo       i8be         number of elements in info array    (タグの要素数)
 info(1)     i8be         = 14h, array data type         (0x14: 配列(データ型))
 info(2)     i8be         = 0fh, tag data type for all array elements(配列のデータ型:0xf(構造体))
 info(3)     i8be         = 0
 info(4)     i8be         ngroup, number of elements in group  (構造体の要素数)
 info(2*i+3) i8be         = 0
 info(2*i+4) i8be         tag data type for element i of group  (構造体の要素の型)
                          above repeated for i = 1 to ngroup
 info(ninfo) i8be         narray, number of elements in array  (配列の個数)
 <value>     xx*          tag values, length defined by tag data type in info(2*i+4)
                          above repeated narray*ngroup times


Tag data types

データ型は、8バイト整数が加わった以外はDM3と同じ

 02h =  2  i2* signed    (short)
 03h =  3  i4* signed    (long)
 04h =  4  i2* unsigned  (ushort) or unicode string
 05h =  5  i4* unsigned  (ulong)
 06h =  6  f4*           (float)
 07h =  7  f8*           (double)
 08h =  8  i1            (boolean)
 09h =  9  a1            (char)
 0ah = 10  i1
 0bh = 11  i8*  (long long) 
 0ch = 12  i8*  (unsigned)
 0fh = 15                group of data (struct)
 12h = 18  a             (string)
 14h = 20                array of data or groups of data

イメージデータタイプ

 DataType:  
                    1  2 byte integer signed ("short")
                    2  4 byte real (IEEE 754)
                    3  8 byte complex (real, imaginary)
                    4  ?
                    5  4 byte packed complex (see below)
                    6  1 byte integer unsigned ("byte")
                    7  4 byte integer signed ("long")
                    8  rgb view, 4 bytes/pixel, unused, red, green, blue?
                    9  1 byte integer signed
                   10  2 byte integer unsigned
                   11  4 byte integer unsigned
                   12  8 byte real
                   13 16 byte complex
                   14  1 byte binary (ie 0 or 1)
     The first 3 multiplied together should give the total number of bytes in
     the picture.
     The rest (ie all but first 8 bytes) is the image.
     Packed complex (data type 5)
     This is used for the Fourier transform of real images, which have
     symmetric real parts and antisymmetric imaginary parts and thus can
     be stored in half the number of bytes that the equivalent complex
     picture would take. The format is somewhat strange.
     I have confused things further by using semper's coordinate system.
     If the equivalent full complex picture of size n by n would look like
     x1 = -n/2,          x2 = int((n-1)/2)
     y1 = -int((n-1)/2), y2 = n/2
     real part
           x1         ...         -1       0       1      ...      x2
     y1   rx1,y1                          r0,y1                   rx2,y1
     ...
     -1                           r-1,-1  r0,-1   r1,-1
      0   rx1,0                   r-1,0   r0,0    r1,-1           rx2,0
      1                           r-1,1   r0,0    r1,-1
     ...
     y2   rx1,y2                          r0,y2                   rx2,y2
     imaginary part likewise but i-1,-1 etc
     packed complex
           x1     x1+1  ... -2      -1       0       1    ...  x2-1    x2
     y1   rx1,0  *rx1,y1    r1,y1   i1,y1   r2,y1   i2,y1     rx2,y1  ix2,y1
     ...
      1   rx1,y2  ix1,y2    r1,1    i1,1    r2,1    i2,1      rx2,1   ix2,1
      0   r0,0   *r0,y1     r1,0    i1,0    r2,0    i2,0      rx2,0   ix2,0
     -1   r0,-1   i0,-1     r1,-1   i1,-1   r2,-1   i2,-1     rx2,-1  ix2,-1
     ...
     y2   r0,y2   i0,y2     r1,y2   i1,y2   r2,y2   i2,y2     rx2,y2  ix2,y2
     The top of the x1 and x1+1 columns contain what would be in the bottom
     of the x1 column, with two imaginary parts containing real parts (marked
     with *)