OOF2: The Manual

Name

OOF.Microstructure.Create_From_ImageFile — Load an Image and create a Microstructure from it.

Synopsis

OOF.Microstructure.Create_From_ImageFile(filename,microstructure_name,height,width)

Details

  • Parent Menu: OOF.Microstructure
  • Callback: function createMSFromImageFile in module ooflib.image.IO.imagemenu
  • Parameters:

    filename
    Name of the file. Type: A character string.
    microstructure_name
    Name of the new Microstructure. Type: A character string, or the variable automatic.
    height
    Physical height of image, or 'automatic'. Type: An integer, a real number, or the string 'automatic'.
    width
    Physical width of image, or 'automatic'. Type: An integer, a real number, or the string 'automatic'.

Description

This is probably the most useful way to create a Microstructure. It creates a Microstructure object with the same pixel size as the given Image and then loads the Image into the Microstructure.

The filename parameter specifies the file containing the Image. The image format is deduced from the file name. Almost any standard format is acceptable.

The microstructure_name parameter specifies the name of the new Microstructure. If it is set to automatic, the Microstructure name will be the same as the filename. In either case, if another Microstructure exists with the same name, <x> will be appended to the name, where x is an integer chosen to make the name unique.

The physical size of the Microstructure and Image are taken from the height and width parameters. If one of the parameters is automatic, then its value is computed from the other parameter and the aspect ratio of the image, with the assumption that the pixels are square. If both parameters are automatic, then it is assumed that pixels are of unit width and height, so the physical size of the Microstructure will be numerically equal to its pixel size.

Loading an Image on the command line with

      oof2 --image imagefile
    

is equivalent to the command

      OOF.Microstructure.Create_From_ImageFile(filename='imagefile',
                                               microstructure_name='imagefile',
                                               height=automatic,
                                               width=automatic).