Difference between revisions of "BMPRegion Command"
Jump to navigation
Jump to search
Line 41: | Line 41: | ||
=== Image Width and Height === | === Image Width and Height === | ||
The <tt>(width)</tt> and <tt>(height</tt> parameters specify the width and height of the image, but they can be specified using different styles. The options are: | The <tt>(width)</tt> and <tt>(height)</tt> parameters specify the width and height of the image, but they can be specified using different styles. The options are: | ||
# Give both as positive numbers - if both numbers are provided and are positive, they give width and height of image in mm (or determined by a [[Units Attribute|units attribute]] in <tt>XML</tt> files). They need not match the actual image, but if they are different, the image will be scaled. | |||
# Use a negative number - if either <tt>(width)</tt> and <tt>(height)</tt> is negative, the absolute value is taken as the number of mm per pixel (or other units per pixel as determined by a [[Units Attribute|units attribute]] in <tt>XML</tt> files). The total width or height is calculated from the size of the BMP image. | |||
# Give only one dimension - if only <tt>(width)</tt> or only <tt>(height)</tt> are given, the entered parameter gives that dimension of the image in mm, if positive, or mm per pixel, if negative (or other unit as determined by a [[Units Attribute|units attribute]] in <tt>XML</tt> files). The other dimension is calculated from the aspect ratio of the BMP file. To specify only <tt>(height)</tt> in scripted files, the <tt>(width)</tt> parameter has to be more negative than -1e8; in <tt>XML</tt> files, simple omit one of the attribute. | |||
(note: when a second file is specified in scripted files, both <tt>(width)</tt> and <tt>(height)</tt> must be entered to preserve argument numbering, but either one can be -1 to preserve aspect ratio). | (note: when a second file is specified in scripted files, both <tt>(width)</tt> and <tt>(height)</tt> must be entered to preserve argument numbering, but either one can be -1 to preserve aspect ratio). | ||
Revision as of 07:59, 1 January 2014
An advanced feature of NairnMPM is that you can create material property directly from images.
Introduction
BMPRegion Commands
In scripted files, an image is converted into material points using:
BMPRegion (bmpPath),(width),<(height)>,<(anglesPath)> Origin (xO),(yO),<(zO>,<(flip)> Intensity (matID),(grayMin),(grayMax),<(prop),(value)>,... . . . Intensity "angles",(gray1),(gray2),(angle1),(angle2) (optional rotation command) EndRegion
In XML files, the command block is
<BMP name="(bmpPath)" width="(width)" height="(height) angles="(anglesPath)> <Origin x="(xO)" y="yO" z="zO" flipped="(flip)"/> <Intensity mat="(matID)" imin="(gramMin)" imax="(grayMax)"> (property command options) </Intensity> . . . <Intensity imin="(gray1)" imax="(gray2)" minAngle="(angle1)" maxAngle="(angle2)"/> (optional rotation commands) </BMP>
where
- (bmpPath) is the full or relative path name to the BMP file. The file must be an uncompressed, gray-scale, BMP file with 8 or less bits per pixel. The most useful is an 8-bit file with 256 levels of gray.
- (width) and (height) specify the width and height for the image, but there are several ways to specify them.
- (anglesPath) is an optional full or relative path name to a mask BMP file whose intensities determine the material angle for rotation about eh z axis when setting anisotropic material points. The file must be an uncompressed, gray-scale, BMP file with 8 or less bits per pixel. The file must be exactly the same size (horizontal and vertical pixels) as the image file in (bmpPath).
Inside BMPRegion block, you include various commands to determine how the pixels are converted into material points. The possible subordinate commands are:
- Origin command - used to connected the image coordaintes the the MPM grid coordinates.
- Intensity command - used to determined conversion of gray scale values in the images into material points or rotation angles
- (optional rotation commands) - these optional commands provide alternative methods for setting initial material orientation when modeling with anisotropic materials.
Image Width and Height
The (width) and (height) parameters specify the width and height of the image, but they can be specified using different styles. The options are:
- Give both as positive numbers - if both numbers are provided and are positive, they give width and height of image in mm (or determined by a units attribute in XML files). They need not match the actual image, but if they are different, the image will be scaled.
- Use a negative number - if either (width) and (height) is negative, the absolute value is taken as the number of mm per pixel (or other units per pixel as determined by a units attribute in XML files). The total width or height is calculated from the size of the BMP image.
- Give only one dimension - if only (width) or only (height) are given, the entered parameter gives that dimension of the image in mm, if positive, or mm per pixel, if negative (or other unit as determined by a units attribute in XML files). The other dimension is calculated from the aspect ratio of the BMP file. To specify only (height) in scripted files, the (width) parameter has to be more negative than -1e8; in XML files, simple omit one of the attribute.
(note: when a second file is specified in scripted files, both (width) and (height) must be entered to preserve argument numbering, but either one can be -1 to preserve aspect ratio).