OOF2: The Manual


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




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

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


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