Data Transformations

The Gds_rip user may need to apply certain transformations to the data during rasterization. The sample application, gds2tiff, supports the following transformations by passing the correct arguments to the library:

    Mirror

    it is possible to mirror in X, Y or both directions simultaneously. This transform is applied before any other.

    Scale

    it is possible to scale X and Y independently. Scaling is applied after mirroring but before rotation.

    Rotate

    it is possible to rotate the data in increments of 90 degrees. This is the last vector transformation.

    Polarity Reversal

    it is possible to reverse the polarity of the pixels.



Examples - Command Line and Images

We will illustrate the behavior of the transforms using a simple GDSII file as shown below:


  the test GDSII file to be transformed.  

This file has data extents from 7, 3 to 49, 72.5 (42 x 69.5) and units of mm with database resolution of 10000. If rasterized at 50 um per pixel the resulting bitmap is 840 x 1390.

trans_test.gds 4KB



Case 1: No Transformation

gds2tiff
 trans_test.gds 
  = 
   +0 
    -out:trans_test_m0_s1_r0_
     -pixelsize:50 
      -ram:8  
       -thrnum:2 
        -rotate:0
          -scale:1 
  bitmap: no mirror, scale 1, rotation 0



Case 2: Polarity Inversion

gds2tiff
 trans_test.gds 
  = 
   +0 
    -out:trans_test_complement
     -pixelsize:50 
      -ram:8  
       -thrnum:2 
        -rotate:0
          -scale:1 
             -complement

Notes:

-complement actually reverses the values of the bits in the raster buffer.

there is no extra margin in the bitmap produced during the reversal.

  bitmap: no mirror, scale 1, rotation 0 invert data



Case 3: Polarity Inversion (TIFF header)

gds2tiff
 trans_test.gds 
  = 
   +0 
    -out:trans_test_invert
     -pixelsize:50 
      -ram:8  
       -thrnum:2 
        -rotate:0
          -scale:1 
             -invert 

Notes:

-invert does not change the value of the bits in the raster image buffer. Instead, when the TIFF file is written out, a flag is placed into the TIFF file header indicating that the polarity should be reversed. This only is useful for those writing TIFF output.

  bitmap: no mirror, scale 1, rotation 0



Case 4: Mirror in X Direction

gds2tiff
 trans_test.gds 
  = 
   +0 
    -out:trans_test_mx_s2_r0
     -pixelsize:50 
      -ram:8  
       -thrnum:2 
       -mirror:x
        -rotate:0
          -scale:2 
              

Notes:

-mirror:x means mirror in the X direction; not mirror along the X-axis. Same for mirror:Y.

The bitmap is twice as large but that cannot be shown here due to space restrictions.

  bitmap: mirror along x, scale 2, rotation 0



Case 5: Mirror in Y Direction

gds2tiff
 trans_test.gds 
  = 
   +0 
    -out:trans_test_my_s2_r0
     -pixelsize:50 
      -ram:8  
       -thrnum:2 
       -mirror:y
        -rotate:0
          -scale:2 
              
  bitmap: mirror along x, scale 2, rotation 0



Case 6:
Mirror in X and Rotate 90 Degrees

gds2tiff
 trans_test.gds 
  = 
   +0 
    -out:trans_test_mx_s2_r1
     -pixelsize:50 
      -ram:8  
       -thrnum:2 
       -mirror:x
        -rotate:1
          -scale:2 
              
 

bitmap: mirror along x, scale 2, rotation 90 deg


Notes

Mirroring is performed before rotation

-rotate directive takes 1,2,3,4.... as arguments with 1=90, 2=180, 3=270 4=360 and so on. Rotation is CCW.




Case 7:
Mirror in Y and Rotate 90 Degrees

gds2tiff
 trans_test.gds 
  = 
   +0 
    -out:trans_test_my_s2_r1
     -pixelsize:50 
      -ram:8  
       -thrnum:2 
       -mirror:y
        -rotate:1
          -scale:2 
              
 

bitmap: mirror along x, scale 2, rotation 90 deg


Notes

Mirroring is performed before rotation

-rotate directive takes 1,2,3,4.... as arguments with 1=90, 2=180, 3=270 4=360 and so on. Rotation is CCW.




Case 8: Mirror in X and Rotate 180

gds2tiff
 trans_test.gds 
  = 
   +0 
    -out:trans_test_mx_s2_r2
     -pixelsize:50 
      -ram:8  
       -thrnum:2 
       -mirror:x
        -rotate:2
          -scale:2 
              
  bitmap: mirror along x, scale 2, rotation 0