Learn R Programming

StereoMorph (version 1.4)

readShapes: Reads a StereoMorph shape file

Description

This function reads digitized shape and scaling data from a StereoMorph shape file or files into a list structure.

Usage

readShapes(file, fields=NULL)

Arguments

file
A shape file, a vector of shape files or a folder containing shape files to be read.
fields
Objects to be returned from the shape file. If NULL, all objects in the file will be returned.

Value

  • a list of class "shapes" containing any number of the following elements:
  • image.nameA vector of image names.
  • image.idA vector of image IDs.
  • scalingA vector of the scaling (real-world units per pixel) of the image.
  • scaling.unitsA vector of the units of scaling.
  • ruler.pixelA vector of the interval of the digitized ruler points in pixels.
  • ruler.intervalA vector of the interval of the digitized ruler points in real-world units.
  • checkerboard.nxA vector of the number of internal corners of a checkerboard pattern along one dimension.
  • checkerboard.nyA vector of the number of internal corners of a checkerboard pattern along the other dimension.
  • square.pixelA vector of the best-fit checkerboard square size in pixels.
  • square.sizeA vector of the best-fit checkerboard square size in real-world units.
  • landmarks.pixelA matrix or array of landmark coordinates in pixels.
  • landmarks.scaledA matrix or array of scaled landmark coordinates.
  • ruler.pointsA matrix or array of ruler points in pixels.
  • checker.pixelA matrix or array of checkerboard points in pixels.
  • curves.controlA list of Bezier curve control points in pixels.
  • curves.pixelA list of Bezier curve points in pixels.
  • curves.scaledA list of scaled Bezier curve points.
  • If any of the above objects are absent from the shape file they will be NULL.

Details

The digitizeImage function makes it possible to save shape and scaling data into a single shape file. This shape file has an XML-like format that allows the readShapes() function to read multiple object types (including vectors, matrices and lists) into a list structure using a generalized routine. All these objects are saved to a list as several elements. The particular elements in the output list will depend on which objects are present in the file. If the object is not present in the file, a call to that object will return NULL. The contents will also differ if multiple files are input. For instance, if one file is input landmarks.pixel will be a matrix but if multiple files are input it will be an array.

The output of print() on the entire output list is formatted for readability given the potentially large matrices contained within the list.

References

See http://home.uchicago.edu/~aolsen/software/digitizing.shtml{StereoMorph Digitizing App} for a tutorial on digitizing and reading shape data.

See Also

digitizeImage