Edit Images

Transformation Conventions

  • For our rotation matrices we follow the conventions used by wikipedia:




  • Order of operations:
    • We start with the “Initial Vertex Coordinates” specified in the Vertex Coordinates tab which is inside the Image tab.

    • By default these “Initial Vertex Coordinates” are set to the image pixels and stack. E.g. the 5th image in a stack with 256×256 images would be:
      •                x    y  z
        Lower Left:    1,   1, 5
        Lower Right: 256,   1, 5
        Upper Left:    1, 256, 5
        Upper Right: 256, 256, 5
        

         

    • Next we perform registration starting with translations (X Translation, Y Translation, Perpindicular Offset from Initial) followed by rotation.
    • The “Calculate” button should perform an automatic image registration, although this is still being implemented.
    • Following image registration, we perform stack transformations on each image in the stack. These are performed in the order:
      • Translation
      • Scale
      • Rotate Z, Rotate Y, then Rotate X (i.e. newmatrix = oldMatrix * rotx * roty * rotz)
    • This results in the “Final vertex coordinates” also listed in the Vertex Coordinates tab.

  • EditImages.py contains a method GetCurCoords() which controls the order of these operations

  • The operations themselves are implemented in vertexMath.py

Transformation Tools

  • To assist with transformation some automatic tools are provided in the Transformations tab. We currently have the following working:

    • Set Origin > Using Point

    • Rotate About X (to make Y = 0 at point, to make Z = 0 at point)
    • Rotate About Y (to make X = 0 at point, to make Z = 0 at point)
    • Rotate About Z (to make X = 0 at point, to make Y = 0 at point)
  • Additional automatic transformation tools (such as alignment to intersection points and automatic SVD based rotations are currently be worked on)

Loading Image Stacks

  • File > Open Stack

  • Select a directory with images named with this convention: <myimagename>_<image_num>.extension. For example:

    • myimage_01.png
    • myimage_02.png
    • myimage_03.png
  • If the directory contains an XML file named stackindex.xml it will be used to determine which images to load and the images initial vertex coordinates, registration, translation, and intensity.

  • Here’s an example stackindex.xml file:

    • <?xml version="1.0" encoding="UTF-8"?>
          <stackindex xmlns:stackindex="http://www.continuity.ucsd.edu/Continuity/Documentation">
              <stack name="astack" minval = "-1.0" maxval = "1.0">
                  <transformations>
                      <translate x="0.0" y="0.0" z="0.0"/>
                      <rotate x="0.0" y="0.0" z="0.0"/>
                      <scale x="1.0" y="1.0" z="1.0"/>
                  </transformations>
                  <images size="5">
                      <image index="0" name="output_17.bmp">
                          <lowerright x="1.0" y="1.0" z="1.0" />
                          <lowerleft x="256.0" y="1.0" z="1.0" />
                          <upperright x="1.0" y="256.0" z="1.0" />
                          <upperleft x="256.0" y="256.0" z="1.0" />
                          <registration perpoffset = "0.0" xtrans = "0.0" ytrans = "0.0" rot = "0.0"/>
                      </image>
                      <image index="1" name="output_18.bmp">
                          <lowerright x="1.0" y="1.0" z="2.0" />
                          <lowerleft x="256.0" y="1.0" z="2.0" />
                          <upperright x="1.0" y="256.0" z="2.0" />
                          <upperleft x="256.0" y="256.0" z="2.0" />
                          <registration perpoffset = "0.0" xtrans = "0.0" ytrans = "0.0" rot = "0.0"/>
                      </image>
                      <image index="2" name="output_19.bmp" >
                          <lowerright x="1.0" y="1.0" z="3.0" />
                          <lowerleft x="256.0" y="1.0" z="3.0" />
                          <upperright x="1.0" y="256.0" z="3.0" />
                          <upperleft x="256.0" y="256.0" z="3.0" />
                          <registration perpoffset = "0.0" xtrans = "0.0" ytrans = "0.0" rot = "0.0"/>
                      </image>
                      <image index="3" name="output_20.bmp" >
                          <lowerright x="1.0" y="1.0" z="4.0" />
                          <lowerleft x="256.0" y="1.0" z="4.0" />
                          <upperright x="1.0" y="256.0" z="4.0" />
                          <upperleft x="256.0" y="256.0" z="4.0" />
                          <registration perpoffset = "0.0" xtrans = "0.0" ytrans = "0.0" rot = "0.0"/>
                      </image>
                      <image index="4" name="output_21.bmp" >
                          <lowerright x="1.0" y="1.0" z="5.0" />
                          <lowerleft x="256.0" y="1.0" z="5.0" />
                          <upperright x="1.0" y="256.0" z="5.0" />
                          <upperleft x="256.0" y="256.0" z="5.0" />
                          <registration perpoffset = "0.0" xtrans = "0.0" ytrans = "0.0" rot = "0.0"/>
                      </image>
                  </images>
              </stack>
          </stackindex>
      

       

Tutorials

  • An out of date tutorial can be found here