Returns 1 if the point x, y is inside or on the polygon (contour) whose vertices are in ptX, ptY, where np is the number of points, otherwise returns 0.
Fortran wrapper to InsideContour . But it is more convenient to call
logical function inside(ptX, ptY, np, x, y)
Finds the smallest convex boundary around an arbitrary set of points in sx, sy. npnts is the total number of points. If fracomit is nonzero, it omits that fraction of points from consideration completely, choosing the points that are farthest from the centroid of all the points. (If fracomit is negative, the Y coordinates of the points will be temporarily scaled to have the same standard deviation as the X range in order to determine the farthest points; it then eliminates -fracomit points.) It returns the centroid of the points under consideration in xcen, ycen. It returns the set of boundary points in bx, by and the number of points in nvert. The size of bx and by is specified by maxverts. If pad is nonzero, it makes the boundary points be that distance away from the outermost sx, sy points. It uses Graham's scan algorithm. nvert is returned with -1 for an error allocating temporary arrays, or -2 for the boundary arrays not large enough.
Fortran wrapper for convexBound
Sets one parameter for surfaceSort .
Fortran wrapper for setSurfSortParam
Sorts a set of points in 3D onto two surfaces. The X, Y, and Z coordinates of the numPts points are packed sequentially into the array xyz. If markersInGroup is nonzero, then the group array should be passed in with 0 for points eligible to be included in the pairs of points that are used to initiate a cluster, or with a -1 for points that should not be used to initiate clusters. The surface numbers, 1 for the bottom one and 2 for the top one, are returned in group. The return value is 1 for a memory allocation error.
Fortran wrapper for surfaceSort, where xyz is dimensioned to (3,*)
/* Spacing of squares for sorting points and accessing rings of points */ static float sGridSpacing = 50.; /* 0 */ /* Maximum neighbors to evaluate for finding neighbor with steepest angle */ static int sMaxAngleNeigh = 50; /* 1 */ /* Use pairs with angle more than this fraction of very steepest angle */ static float sSteepestRatio = 0.5f; /* 2 */ /* If there are fewer than this number of pairs, take pairs down to sAngleMax */ static int sNumMinForAmax = 10; /* 3 */ /* Angle to go down to if sSteepestRatio doesn't give enough pairs */ static float sAngleMax = 20.; /* 4 */ /* If fewer than this number of pairs, take pairs down to sAngleRelax */ static int sNumMinForArelax = 3; /* 5 */ /* Angle to go down to if sAngleMax doesn't give enough pairs */ static float sAngleRelax = 5.; /* 6 */ /* Criterion for MAD-Median outlier elimination based on delta Z of a pair */ static float sOutlierCrit = 3.; /* 7 */ /* Maximum distance to search for neighboring points in plane fits */ static float sMaxFitDist = 2048.; /* 8 */ /* Maximum number of points in plane fits */ static int sMaxNumFit = 15; /* 9 */ /* Minimum # of points for fitting parallel planes */ static int sBiplaneMinFit = 5; /* 10 */ /* Minimum # of points for fitting one plane */ static int sPlaneMinFit = 4; /* 11 */ /* Maximum % distance of Z value between nearest and other plane for deferring to 2nd round: values > 50 disable deferring points */ static float sMaxRound1Dist = 100.; /* 12 */ /* 1 for minimal output, 2 for exhaustive output */ static int sDebugLevel = 0; /* 13 */
Converts a list entry in the string line into a set of integers, returns a pointer to the list of numbers, and returns the number of values in nlist. An example of a list is 1-5,7,9,11,15-20. Numbers separated by dashes are replaced by all of the numbers in the range. Numbers need not be in any order, and backward ranges (10-5) are handled. Any characters besides digits are valid separators. A / at the beginning of the string will return a NULL and a value of -1 in nlist; memory allocation errors return a NULL and -2 in nlist. Parsing stops and the list is returned when a anything besides space, tab, comma, dash, or a digit occurs after a space or tab; otherwise other characters (as well as comma or dash right after the last number) make it return NULL and -3 in nlist. Negative numbers can be entered provided that the minus sign immediately precedes the number. E.g.: -3 - -1 or -3--1 will give -3,-2,-1; -3, -1,1 or -3,-1,1 will give -3,-1,1.
Fortran wrapper to parselist, called by the Fortran parselist2 subroutine. The list is returned into array list and limlist is the size of that array, or 0 if unknown. The return value is 1 for a memory allocation error, 2 for a bad character in the entry, and -1 for the list too big for the array; in the latter case the portion of the list that fits is returned but parselist2 will exit with an error. If a slash is entered, the input list is returned unchanged.
Prints a list of comma-separated ranges for the numList values in list, breaking the list into multiple lines of maximum length lineLen if necessary. Only ranges in increasing order are recognized. Returns 1 for memory error.
Fortran wrapper for writeList
Fortran wrapper for old wrlist subroutine that used a line length of 80
Converts the numList values in list into a string of comma-separated ranges, where only ranges in increasing order are recognized. The returned string is allocated with malloc() and should be freed with free(). Returns NULL for memory error.
Computes a standard or kernel histogram from the numVals values in the
array values. The histogram is placed in the array
bins, and occupies numBins between firstVal and lastVal.
The kernel half-width is set by h, where a triweight kernel equal to
(1-(x/h)
2)
3 / (0.9143 * h) is added at each point. Use 0 for a standard binned
histogram. Set verbose to 1 for a list of values, or 2 for a list of bin values.
Fortran wrapper for kernelHistogram
Scans a histogram for peaks and a dip. The histogram is in numBins elements of bins, extending from firstVal to lastVal. It will be scanned between values scanBot and scanTop. If findPeaks is nonzero, it will find the two highest peaks and return their values in peakBelow and peakAbove, then find the dip between them and returns its value in dip; otherwise it just scans the range for the lowest point and returns the value in dip. The return value is 1 if it fails to find two peaks.
Fortran wrapper for scanHistogram
Finds a histogram dip by starting with a high smoothing and dropping to a
lower one.
values - Array of values to form histogram from
numVals - Number of values in the array
bins - Array to build histogram in
numBins - Number of bins to divide histogram into
firstVal, lastVal - Starting and ending value for histogram range
minGuess - If non-zero, it specifies an estimate of the minimum number of
items above the dip
verbose - Verbose output flag, passed to kernelHistogram
histDip - Returned with the location of the dip
peakBelow, peakAbove - Returned with the peak values below and above
the dip
The return value is 1 if a dip cannot be found after 4 trial H values.
Fortran wrapper for findHistogramDip
Makes a model bead of radius beadSize in array with dimensions boxSize by boxSize.
Fortran wrapper for makeModelbead.
Finds integral above background of a bead located at xcen, ycen in array, an image nx by ny with X dimension nxdim. rCenter, rInner, and rOuter are radii of the center and the inner and outer radii of the background annulus. Returns the center and annular means in cenmean and annmean, and if annPct is supplied with a fractional percentile, returns the percentile value in median, using temp as a temporary array. temp is not used if annPct is 0. The return value is center minus annular mean.
Estimates mean and, optionally, the SD and the minimum and maximum values from a
sample of an image. Returns nonzero for errors.
image = array of pointers to each line of data
type = data type, 0 for bytes, 2 for unsigned shorts, 3 for signed shorts, 6 for
floats, 7 for 4-byte integers, 8 for RGB triples of bytes or 9 for RGBA bytes;
RGB values are weighted with NTSC weighting
nx, ny = X and Y dimensions of image
sample = fraction of pixels to sample
ixStart, iyStart = starting X and Y index to include
nxUse, nyUse = number of pixels in X and Y to include
mean = returned value of mean
sd = returned value of SD; call with NULL to skip the SD computation
amin, amax = returned values of estimate minimum and maximum; call with both
NULL to skip the min and max.
Estimates mean only from a sample of an image by calling sampleMinMaxMeanSD. Returns nonzero for errors.
Estimates mean and SD from a sample of an image by calling sampleMinMaxMeanSD. Returns nonzero for errors.
Estimates mean, minimum and maximum from a sample of an image by calling sampleMinMaxMeanSD. Returns nonzero for errors.
Fortran wrapper for sampleMinMaxMeanSD with a floating point array in image. Set which to 1 for mean only, 2 for mean and SD, 3 for mean, min, and max, and 4 for all 4 values.
Fortran wrapper for sampleMeanSD with a floating point array in image
Returns the type needed for calling the sampleMean routines if mrcMode is one of the MRC_MODE_... (or SLICE_MODE_...) values supported by the routines, otherwise returns -1.
Fortran wrapper for typeForSampleMean
Estimates percentile limits for contrast strecthing an image by building a histogram
of a sample.
image = line pointers to image
mode = data type, a SLICE_MODE_ value; BYTE, USHORT, SHORT, or FLOAT are allowed
nx, ny = X and Y dimensions of image
sample = fraction of pixels to sample
ixStart, iyStart = starting X and Y coordinates to sample
nxUse, nyUse = extent of image to sample in X and Y
pctLo, pctHi = Percentile levels to find on the low and high end of range
(1.0 is 1%)
scaleLo, scaleHi = returned values of those percentile levels
Returns 1 for inadequate number of pixels, 2 for invalid mode, or 3 for memory error.
Does initial setup for determining the local mean and standard deviation in an array of
boxes within an image volume at a series of binnings (scales). For all of the
array variables showing a dimension of 3, the index in the dimension is 0 for the X,
1 for the Y, and 2 for the Z value.
Inputs:
binning - Binning in X, Y, and Z for each scale
boxSize - Size of box to analyze in X, Y, and Z for each scale, in binned
pixels
boxSpacing - Spacing between adjacent boxes in X, Y, and Z for each scale, in
binned pixels
numScales - Number of binnings to analyze
startCoord - Starting unbinned coordinate of volume to analyze in X, Y, and Z
endCoord - Ending coordinate of volume to analyze in X, Y, and Z (inclusive)
Outputs:
boxStart - Starting coordinate in binned slices of first box in X, Y, and Z
for each scale (equals 0 at start of slice, not startCoord)
numBoxes - Number of boxes i nX, Y, and Z for each scale
bufferStartInds - Array to receive starting index of the binned slice for each scale;
must be dimensioned to at least numScales + 1. The size of a floating point array to
allocate for the loaded and binned slices is returned in the extra element.
statStartInds - Array to receive starting index of the box mean and SD values for
each scale; must be dimensioned to at least numScales + 1. The size of floating
point arrays to allocate for the means and SDs is returned in the extra element.
Returns 1 for inappropriate coordinate limits, 2 for more than the number of scales
defined by MAX_MBS_SCALES, 3 for box size bigger than the binned size of the volume at
some scale, or 4 for boxSpacing less than 1.
Fortran wrapper for multiBinSetup. In Fortran, the 2-D arrays would all be dimensioned (3,*), with the X/Y/Z index in the first dimension.
Computes the local mean and standard deviation in an array of boxes within an image volume at a series of binnings. binning, boxSize, boxSpacing, numScales, startCoord, endCoord, boxStart, numBoxes, bufferStartInds, and statStartInds must be the same variables supplied to multiBinSetup. buffer is an array allocated to the size given by the value after numScales values in bufferStartInds. Mean and standard deviation values are returned in means and SDs, which must be allocated to the value after numScales values in statStartInds. The callback function getSliceFunc is called to get the one slice of data within the given coordinate range by getSliceFunc(&iz, funcData, buffer), where iz is the Z coordinate and funcData is filled with whatever the loading function requires (i.e., if it needs the starting and ending X and Y coordinates, they must be passed in funcData). Returns an error code from getSliceFunc.
Fortran wrapper to getSliceFunc
Examines a list of npclist piece coordinates in pclist for one dimension (x or y) at a spacing of stride between successive values, applies a reduction factor redfac, and given the frame size nframe, it finds the minimum coordinate minpiece, the # of pieces npieces, and the overlap noverlap. It also checks that ALL coordinates on the list are multiples of frame size minus overlap. Upon failure, it returns the line number at which that check fails, and also return -1 in npieces.
Fortran wrapper for checkPieceList which assumes the stride is 1. Upon error, it prints a message, and still returns -1 in npieces.
Adjusts a list of npclist piece coordinates in pclist for one dimension (x or y), at a spacing of stride between successive values, changing the overlap from noverlap to newOverlap, given the frame size nframe and the minimum coordinate minpiece (which is retained).
Fortran wrapper for adjustPieceOverlap that assumes a stride of 1.
Sets up most of the sizes for the overlap zone correlations. Inputs:
ixy - 0 for X edge, 1 for Y edge
nbin - Binning
indentXC - Border from edge of image
nxyPiece - Size of pieces in X and Y
nxyOverlap - Overlap between pieces in X and Y
aspectMax - Maximum aspect ratio to correlate
extraWidth - Fraction of overlap zone width to add for extra extent
padFrac - Fraction of box size to pad on each edge
niceLimit - Largest prime factor for FFT sizes
Outputs:
indentUse - Actual border being used
nxyBox - Binned size in X and Y of boxes to be extracted from images
numExtra - Number of extra pixels in X and Y
nxPad - Size of padded image in X
nyPad - Size of padded image in Y
maxLongShift - Maximum shift along the long axis of the overlap zone
Fortran wrapper for montXCBasicSizes. ixy should be 1 or 2.
Sets up indices for extracting boxes, and the filter function. Inputs:
ixy - 0 for X edge, 1 for Y edge
nxyPiece - Size of pieces in X and Y
nxyOverlap - Overlap between pieces in X and Y
nxyBox - Binned size in X and Y of boxes to be extracted from images
nbin - Binning
indentUse - Border from edge of image
numExtra - Number of extra pixels in X and Y
nxPad - Size of padded image in X
nyPad - Size of padded image in Y
numSmooth - Number of pixels of smoothing if possible
sigma1 - Sigma for inverted gaussian at low frequency
sigma2 - Sigma for high frequency filter
radius1 - Radius out to which low frequency filter is 0
radius2 - Radius for high frequency filter
evalCCC - 1 to evaluate correlation coefficients
Outputs:
ind0Lower - Starting index to extract in X and Y for lower piece
ind1Lower - Ending index to extract in X and Y for lower piece
ind0Upper - Starting index to extract in the ixy dimension for uppoer piece
ind1Upper - Ending index to extract in the ixy dimension for uppoer piece
nxSmooth - Size of edge-smoothed image in X
nySmooth - Size of edge-smoothed image in Y
ctf - Array of filter values; must be dimensioned at least 8193
delta - Change in radius per index in the ctf array
Fortran wrapper for montXCIndsAndCTF. ixy should be 1 or 2.
Finds binning needed to keep boxed out area smaller than a target size. Inputs:
maxBin - Maximum binning to select
targetSize - Target size to make the number of boxed pixels be less than the
square of
indentXC - Border from edge of image to assume
nxyPiece - Size of pieces in X and Y
nxyOverlap - Overlap between pieces in X and Y
aspectMax - Maximum aspect ratio to correlate
extraWidth - Fraction of overlap zone width to add for extra extent
padFrac - Fraction of box size to pad on each edge
niceLimit - Largest prime factor for FFT sizes
Outputs:
numPaddedPix - Total number of pixels for padded images, with extra allowance
numBoxedPix - Total number of pixels for boxed images, with extra allowance
The return value is the binning.
Fortran wrapper for montXCFindBinning.
Performs Fourier correlations and evaluation of real-space correlations to find
displacement on an edge. Whether the CCC's are evaluated depends on the value of
numXcorrPeaks. If it is 1, they are not computed, but 16 peaks are found and the
first peak is taken that does not exceed the lateral shift in maxLongShift. If
it is greater than 1, at least 16 peaks are still found and checked against
maxLongShift, then the CC is evaluated at the given number of peaks. Inputs:
lowerIn - Boxed, possibly binned image extracted from lower piece
upperIn - Boxed, possibly binned image extracted from upper piece
nxyBox - Size of boxed input images in X and Y
nxyPiece - Size of full pieces in X and Y
nxyOverlap - Overlap between pieces in X and Y
nxSmooth - Size of edge-smoothed image in X
nySmooth - Size of edge-smoothed image in Y
nxPad - Size of padded image in X
nyPad - Size of padded image in Y
lowerPad - Temporary array for lower padded piece
upperPad - Temporary array for upper padded piece
lowerCopy - Temporary array for copy of lower padded piece, needed only if
evaluating CCC's at multiple peaks
numXcorrPeaks - Number of correlation peaks to examine
legacy - Non-zero to do legacy correlations
ctf - Array with filter function
delta - Change in radius per index in the ctf array
numExtra - Number of extra pixels in X and Y
nbin - Binning
ixy - 0 for X edge, 1 for Y edge
maxLongShift - Maximum shift along the long axis of the overlap zone
weightCCC - Non-zero to weight CCC by power function of overlap area
Outputs, functions, debugging variables:
xDisplace - Displacement in X: amount to shift upper piece to align to lower
yDisplace - Displacement in Y
CCC - Value of CCC at the chosen peak, if computed
twoDfft - 2-D FFT function to receive array, nxPad, nyPad, and 0 for
forward or 1 for inverse
dumpEdge - If non-null, a function for writing images to file. Its arguments
are the image array, X dimension, X size, Y size, ixy + 1, and 0 for an image or
1 for a correlation
debugStr - String to receive debugging text. To hold all text with full output,
it should be numXcorrPeaks + 1 times MONTXC_MAX_DEBUG_LINE
debugLen - Length of debugLen
debugLevel - 1 for summary of selected peak and the displacement, 2 for full
output about each peak, 3 to include eliminated peaks
Fortran wrapper for montXCorrEdge. The wrapper will collect and print the debug strings if debugLevel is non-zero.
Compares images in two arrays array and brray (dimensioned nx, ny, with image dimensions nx by ny), and finds the displacements between the two images with the minimum standard deviation of the pixel-by-pixel difference. ixBox0, iyBox0, ixBox1, and iyBox1 (numbered from 0) define the array index limits of the box to be compared in ARRAY. dxMin and dyMin, upon entering, should have the starting displacement between the box position in array and the position to be compared in brray. Initially it will search with a step size of 1, up to a distance of limStep from the initial displacements. It will do numIter iterations, cutting the step size by a factor of 2 on each iteration. sxMin and dyMin will be returned with the displacement that has the minimum standard deviation sdMin, and ddenMin is the difference in density at that displacement (B-A).
Fortran wrapper to montBigSearch, where the array index limits are numbered from 1.
Compares positions in two image arrays array and brray (each dimensioned to nx, ny, the image dimensions as well), and within a defined box, calculates the standard deviation sd of the pixel-by-pixel difference (B minus A). ixBox0, iyBox0, ixBox1, and iyBox1 (numbered from 0) define the array index limits of the box in array, and dx and dy define the displacement between that position and the desired position in brray. If dx and dy are integers, the computation is done rapidly between corresponding pixels; otherwise, quadratic interpolation is used to find the pixel value in brray for a given pixel in array.
Fortran wrapper to montSdCalc, where the array index limits are numbered from 1.
Solves for positions of overlapping pieces by adjusting them iteratively to
minimize the difference between measured displacement between pairs of
pieces and the difference in their positions.
ivarpc: index from included variables (pieces) to overall piece number
nvar: Number of variables
indvar: index from piece number to variable number; must be set to less
than the minimum variable number (0 for C, 1 for Fortran) for all pieces
potentially connected to the ones included as variables.
ixpclist, iypclist: X and Y piece coordinates.
dxedge, dyedge: the measured difference from the nominal displacement
between pieces at an edge
idir: 1 if those values are the amount that the upper piece is displaced
from being in register with the lower; -1 if they are the amount that the
upper piece needs to be shifted to be in register.
pieceLower, pieceUpper: index of pieces below and above an edge
ifskipEdge: A number indicating whether the edge should be skipped
edgeStep: Stride between X and Y edges at the same edge index in the edge
arrays dxedge, dyedge, pieceLower, pieceUpper, ifskipEdge. If the arrays
are accessed in Fortran as array(edge,ixy), then this value is the first
dimension of the array. If they are accessed in C as array[edge][ixy] or
array[2*edge+ixy] then the value is 1.
dxyvar: array into which the piece shifts in X and Y are returned for
each piece in the variable list
varStep: Stride between X and Y shifts for a given piece in dxyvar; as
for edgeStep, this is either 1 or the long dimension of the array.
edgeLower, edgeUpper: edge index of edge below or edge above a given piece
in X or Y.
pcStep: Stride between X and Y edges at the same piece in those arrays;
again, this is either 1 or the long dimension of the array
work: Array for temporary storage, must be at least 20.25 times the number
of variables plus 1.
fort: A nonzero value indicates that the indexes in
ivarpc, indvar, pieceLower, pieceUpper, edgeLower, edgeUpper are numbered
from 1 instead 0.
leaveInd: Absolute edge index in edge arrays of edge to leave out
skipCrit: An edge is skipped if ifskipEdge is >= this value
critMaxMove: Terminate if the maximum move of any piece in X or Y is less
than this criterion.
robustCrit: Use robust fitting to eliminate or down-weight outlying
edge displacements; multiply outlier criterion by given factor.
critMoveDiff: Terminate if the average move changes by less than this
amount between samples
maxIter: Maximum number of iterations
numAvgForTest: Number of iterations over which to average the average
moves in X and Y for the test based on critMoveDiff
intervalForTest: Number of iterations between such tests
numIter is returned with the number of iteratation.
wErrMean and wErrMax are returned with the mean and maximum of weighted
errors.
Returns 1 if the strides are not all 1 or all different from 1.
Called from Fortran with identical arguments and name.
Computes a symmetrical power spectrum of the image in image, with slice type in
type and size in nx and ny. The image will padded to the square size in
padSize, which should be a good size for taking a FFT, and tapered down to its mean
inside the edges. If the negative of padSize is passed, there will be no tapering.
The FFT will be taken, the logarithm of the magnitudes will be
computed and scaled to occupy a range of 0 to 32000, and this spectrum will be
mirrored through the origin. If finalSize is less than padSize, the spectrum will
be reduced with antialiased reduction, using the filter type in filtType. If
bkgdGray is less than or equal to 0, the result will be placed in spectrum as
an array of shorts. If bkgdGray is greater than 0, the spectrum
will be scaled to range from 0 to 255, with the mean near the edges scaled to
a value of bkgdGray, and the mean of pixels in a ring with diameter truncDiam as a
fraction finalSize scaled to 255. This result will be returned in spectrum as an
array of bytes. twoDfft must be supplied with the name of a 2-D FFT function with
that calling sequence, (todfft if using libifft in IMOD).
The behavior is quite different if filtType is negative: 1) Reduction, if any, will
be done by Fourier cropping with fourierReduceImage; 2) No logarithm
is taken and amplitudes are not scaled; 3) spectrum is returned as floats with the
X dimension still padded by 2 from the FFTs, and must be allocated accordingly.
Returns -1 or -2 for the negative of an error in calling
selectZoomFilter, 1 to 5 for an error in calling
zoomWithFilter, -3 for a memory error, or -4 for finalSize greater
than padSize, bkgdGray more than 192, truncDiam negative or more than 0.75, or
filtType less than 0 and bkgdGray positive.
Makes a centered amplitude spectrum from an FFT of a square image in fftArray and puts it in spectrum. The absolute value of padSize is the real-space size of the image and outXdim is the X dimension for the output array. Set padSize positive if an FFT is passed in fftArray (with an assumed X dimension of padSize + 2), or negative if fftArray already contains amplitudes (with an assumed X dimension of (padSize + 2) / 2).
Performs any combination of rotation and Y flipping for the image in array with the MRC mode given in mode (byte, signed/unsigned short, or float) and the size in nx and ny. Set operation to 0-3 for counter-clockwise rotation by 90 * operation, plus 4 for flipping around the Y axis before the rotation or 8 for flipping around Y after. Set leftHanded 0 for right-handed data (IMOD) or 1 for data stored inverted in Y (SerialEM). Set invertAfter to include a final inversion in Y, thus making left-handed data ready to write with IMOD routines. For short data only, invertCon can be set non-zero to invert the contrast between the existing minimum and maximum. The number of threads to use is controlled by numThreads; pass 0 to use the default, which is 2 threads for images between 1.5 and 3K in size or for larger images when the operation does not include a rotation, or 3 threads for larger images with a rotation. The output image is returned in brray and its size in nxout, nyout. The function is relatively fast for rotations because it operates on 8 lines of input data at a time. Returns 1 for an unsupported data mode, 2 for trying to invert contrast with non-short image, or 2 for an operation out of range.
Fortran wrapper for rotateFlipImage that assumes array is a floating point, right-handed image.
Reads values from one or more lines of the file pointed to by fp and places them repeatedly into the successive variables listed in .... The types of the variables are provided by a corresponding set of letters in types: "i" for int, "f" for float, or "d" for double. valSize is the size of the value arrays. A value of numToGetP greater than zero specifies the number of sets of values to get; otherwise the function will try to get all lines in the file. Pass in 0 to get all lines in the file, with an error return if they do not fit in the supplied arrays; pass in -1 to get all values up to whatever fits in the arrays, without an error. The actual number of values obtained is returned in numToGetP. Lines are read into line, whose size is specified by maxLine. If the bit flag RLFV_SEPARATE_LINES is set in flags, it will read one set of data per line, ignoring any entries past that and generating an error if a line has fewer values than the number of arguments. Returns -1 for an error reading the file, -2 for end of file before the specified numToGetP values are found, -3 for the whole file not fitting in the arrays, -4 for an error parsing the data or a failure to find all values on a line when reading as separate lines, -5 for a value read for an integer argument that is not close enough to an integer, -6 for a memory error, -7 for programming error. When multiple value arguments are passed, it allocates a temporary array big enough to fit all the data before sorting it into the different arrays.
Returns a pointer to the color ramp specification for the standard false color table used in 3dmod.
Returns a pointer to a color ramp specification for an false color table inverted from the one used in 3dmod.
Converts a color ramp specification in rampData to a full 256-color table in table. The first value in the rampData array is the number of color specifications; each set of 4 numbers after that is a red, green, and blue value (range 0-255) and a relative position along the color table.
Reads a color map specification from the file specified by filename and converts it to a complete color table in table. The file starts with the number of lines of color data. If there are 256 lines they must be red, green, blue triplets (range 0-255); otherwise each line has a red, green, and blue followed by a relative position in the color table. Returns 1 for error opening a file, 2 for errors reading the file, 3 for an invalid number of lines, or 4 for a memory allocation error.
static int standardRampData[] = { 14, 100, 75, 200, -530, 60, 96, 255, -469, 0, 175, 177, -400, 0, 191, 143, -383, 0, 207, 78, -361, 90, 255, 60, -305, 191, 255, 0, -259, 239, 255, 0, -240, 255, 255, 0, -229, 255, 175, 0, -172, 255, 105, 0, -122, 255, 45, 55, -60, 255, 0, 90, -40, 255, 0, 192, 10 }; /* An inverted color ramp specification, used in model view for mesh normals */ static int invertedRampData[] = { 14, 255, 0, 192, -10, 255, 0, 90, 40, 255, 45, 55, 60, 255, 105, 0, 122, 255, 175, 0, 172, 255, 255, 0, 229, 239, 255, 0, 240, 191, 255, 0, 259, 90, 255, 60, 305, 0, 207, 78, 361, 0, 191, 143, 383, 0, 175, 177, 400, 60, 96, 255, 469, 100, 75, 200, 530 };