```remapmodel(1)               General Commands Manual              remapmodel(1)

NAME
remapmodel - to remap Z values and shift coordinates of a model

SYNOPSIS
remapmodel  [options]  input_file  output_file

DESCRIPTION
This program allows one to remap coordinates in a model, in two ways:
1) The set of Z values may be mapped, one-to-one, to any arbitrary new
set of Z values; and 2) The X, Y or Z coordinates may be shifted by a
constant.

Also, a mapping can be set up easily for the case where serial section
tomograms are being rejoined with different spacings.

The program works by mapping from an old list of Z values to a new list
of Z values.  The old list is, by default, the list of actual Z values
in the file, although you can enter a different list to map from.  The
mapping of Z values is done by first converting each Z value to the
nearest integer, looking up the new integral Z value that you wish to
map that integer to, then shifting the actual Z value by the difference
between the new and the original integral value.

The new list of Z values should have the following form.  Use ranges
(e.g. 0-3,5-7,10-8) to specify a list of integers with the same number
of Z values as in the list of values being mapped.  The latter Z values
will be mapped one-to-one onto the new list.  Enter numbers between
-999 and -990 to delete points with a particular Z value; e.g. if the
input model has Z values from 0 to 9, entering 0-4,-999,5-8 will delete
all points with Z between 4.5 and 5.5, and shift the Z of points with Z
greater then 5.5 down by 1.  If the input model has Z from 0-19, enter-
ing 0-9,-999--990 will remove all points with Z from 10 to 19.  Enter
the single value -1 to replace each Z value by its negative.

Contour points in all kinds of objects will be remapped, but meshes
will not, so any meshed object will need to be remeshed after remapping
the contours.  If the Z value of a point is fractional, it will be
shifted by the remapping of the nearest integer Z value; this will
retain the fractional value correctly as long as the mapping does not
produce an inversion in Z.

OPTIONS
Remapmodel uses the PIP package for input (see the manual page for
pip) and can take input interactively for a basic mapping of exist-
ing Z values in the model.  The following options can be specified
either as command line arguments (with the -) or one per line in a com-
mand file or parameter file (without the -).  Options can be abbrevi-
ated to unique letters; the currently valid abbreviations for short
names are shown in parentheses.

-input (-i) OR -InputFile      File name
Input model file.  If this option is not entered, the first non-
optional argument will be used.

-output (-ou) OR -OutputFile   File name
Output model file.  If this option is not entered, the second
non-optional argument will be used.

-old (-ol) OR -OldZList   List of integer ranges
List of Z values in the input model that are to be remapped.
The default is the actual list of Z values, which could have
gaps that make it difficult to compose the list of values to map
to.

-full (-fu) OR -FullRangeInZ
For the list of values to remap, use the complete range from 0
to NZ-1, where NZ is the Z size of the image file that the model

-new (-n) OR -NewZList    List of integer ranges
List of Z values to map old list to.  There must be as many val-
ues in this list as in the list of Z values to remap.  See notes
above on the contents of this list.

Amount to add to all coordinates in X, Y, and Z, after remapping

-reorder (-r) OR -ReorderPointsInZ       Integer
Go through each contour and reorder the points so that they are
monotonically increasing in Z (for an input value of 1) or mono-
tonically decreasing (for a value of -1)

-fromchunks (-fr) OR -FromChunkLimits    Multiple integers
To remap Z values after changing the spacing between sections in
a joined set of serial section tomograms, enter the original
starting and ending slice for each tomogram in the join (start1,
end1, start2, end2, etc).  If a tomogram was inverted in the
join, be sure that the high Z number is listed as the start and
the low Z number is listed as the end.

-tochunks (-t) OR -ToChunkLimits    Multiple integers
The new starting and ending slices for each tomogram in a serial
section join, in the same format as for -fromchunks.  When these
two options are entered, none of the other mapping options
(-old, -new, -full) can be used.

-help (-h) OR -usage
Print help output.

-StandardInput
Read parameter entries from standard input.

INTERACTIVE INPUT
The program will accept input interactively if started with no command
line arguments; the interactive entries to the program are:

Name of input model file

Name of output model file

New list of Z values.  See notes above on the format of this list.  In
addition, you can enter "/" to take the input list without modifica-
tion.

Amounts to add to all X, Y, and Z coordinates.  These values will be
added after the remapping of Z values, if any.  Values should be
in units of pixels (image index coordinates).

IF your new list of Z values is not in monotonic order, enter 1 to
have the program reorder the points within each object so that
they occur with monotonically changing Z.  This option would be
used if you wanted to switch two sections within a stack.

HISTORY
Written by David Mastronarde, 5/8/89
DNM 7/20/89  changes for new model format
DNM 2/20/90  changes to negate Z and reorder by Z
DNM 10/27/06: Convert to PIP and provide new options for tomogram joins

BUGS
Email bug reports to mast at colorado dot edu.

IMOD                                4.10.22                      remapmodel(1)
```