patch2imod(1)                                                    patch2imod(1)

       patch2imod - makes model from patch displacement, warping, or residual

       patch2imod  [options]  patch_file  IMOD_model_file

       patch2imod creates an IMOD model from a file containing 3-D displace-
       ments at a series of positions, such as the patch file generated by
       corrsearch3d.  Each displacement will be represented by a vector
       starting at the position of the patch, and whose magnitude and direc-
       tion are determined by the 3-D displacement multiplied by a scale fac-
       tor.  These vectors are simply open contours consisting of two points.
       In addition, if the patch file contains correlation coefficients or
       residual values, these values will be stored in the model.

       The resulting model can be viewed to determine the location of patches
       with aberrant displacements and even edited to remove such patches.
       The easiest way to do this is to start 3dmod with just the model file
       and no image file, open the model view window, and use the right mouse
       button in the model view window to select vectors that differ greatly
       from their neighbors.  The currently selected vector(s) will be high-
       lighted by being thicker.  They may then be deleted with the D hot key.
       The edited model can be converted back to a patch file with

       The correlation or residual values can be visualized by opening the
       "Values" panel in the model view Object Edit window and selecting "Show
       stored values".  The color display can be manipulated and subsets of
       vectors can be selected.

       If the patch file contains a column of numbers after the correlation
       coefficient or residual values, these will also be stored as secondary
       values in the model but cannot be visualized.  They will be output to a
       new patch file by imod2patch.  In fact, there can be up to six
       columns of numbers, and any two can be chosen to be stored in the model
       file with the -v option.

       One can also read the model in on top of a tomogram; by default it is
       marked as flipped so that it will display correctly on tomograms in
       their original orientations.

       The scaling is stored as the pixel size in the model header.  Do not
       change this value, or imod2patch will not be able to convert the dis-
       placements back correctly.

       The program will also convert a list of 2-D residuals produced by
       Tiltalign.  In this case, the model is not marked as flipped, so
       that it can be displayed on top of the original image file.  A file of
       warping transformations can also be converted to vectors, and again the
       model is not marked as flipped.

       -s value
              Change the vector length scaling to the given value; the default
              is 10.

       -f     Do not flip Y and Z coordinates in the model.  Use this option
              to display the model on a tomogram that has been flipped or
              rotated from its original orientation.  The option is not needed
              with a Tiltalign residual file or with a warping
              transformation file.

       -c size
              Include four clipping planes in the model to enclose a square
              area of the given size in the center of the model.  These planes
              will not be on by default, but can be turned on and manipulated
              together in the model view Object Edit window.  These planes
              could be helpful for seeing a subset of vectors when the model
              is rotated.

       -n name>
              Give this name to the model object.  The name is useful for
              indicating what kind of values are stored with the vectors.

       -d     Set the flag to display stored values in false color in 3dmod.
              This option has the same effect as turning on the "Show stored
              values" button in the Values panel of the Edit-Objects dialog of
              the Model View window.

       -z     Ignore zero values when computing the mean and SD of values.
              The program computes the actual maximum value and the mean and
              SD, and then stores a maximum value that is limited to 10 SDs
              above the mean.  This stored value determines the maximum that
              is shown in the model view object edit window of 3dmod.  This
              option is needed when there are a very large numbers of zero

       -v ID/-col
              Store the value column with the given ID number, or with the
              negative of the given column number, as the primary values in
              the model.  Value columns are numbered from 1 and there can be
              up to 6 of them.  Programs that create patch vector output files
              (Corrsearch3d(1), Refinematch, Findwarp), now assign an ID
              number to each type of data; these ID numbers are listed in
              order in first line of the file.  The default is to store the
              first value column as primary (corresponding to an entry of

       -l     Read all lines in the file as lines with vectors.  By default,
              the program reads the first line to determine the number of
              lines, then reads that number of lines as vectors.

       -w     Read the input file as a warping transformation file like those
              produced by Midas and Tiltxcorr.  Both control point and
              warping grid files can be converted.  The negative of the warp-
              ing vector values will be displayed because those values are
              inverse transform values.

       -t     Assign a time to each contour, equal to its Z value plus 1.
              This option may be useful when examining vector models from a
              warping transformation file or from the edge function output of
              Blendmont, because it would allow one to examine vectors for
              one section or edge function at a time in the Model View window
              instead of in the Zap window.  One can step through times with
              the 1 and 2 hot keys, but there may be no good way to select a
              specific time out of many.

       Unless the -l option or the -w option is given, the first line of the
       file must have the number of vectors in the file.  If this line con-
       tains "residuals", then each succeeding line should have five values:
       X, Y, Z, delta X and delta Y.  X and Y may be floating point values in
       this case, and Z must be an integer.  Other than the residual case,
       each line may have 6 to 8 values, where the first 6 are X, Y, Z, delta
       X, delta Y, and delta Z.  X, Y, and Z must all be integers in this
       case.  A seventh value is stored at a general value displayable in
       3dmod, and an eighth value is stored as the second type of general

       If the model file already exists, it becomes a backup file with ~ added
       to its name.

       David Mastronarde

       imod2patch, patchcrawl3d, patchcorr3d, 3dmod, 3dmodv,
       findwarp, refinematch, tiltalign, tiltxcorr, midas

       Email bug reports to mast at colorado dot edu.

IMOD                                 4.9.3                       patch2imod(1)