mrc2tif(1) General Commands Manual mrc2tif(1) NAME mrc2tif - Create TIFF, JPEG, or PNG files from an MRC image file. SYNOPSIS mrc2tif [options] mrc_input_file tiff_file_root_name DESCRIPTION mrc2tif usually creates a series of TIFF files with the prefix tiff_file_root_name and with the suffix .nnn.tif, where nnn is the z number. Byte, signed and unsigned 16-bit integer, float, and RGB color files (modes 0, 1, 6, 2, 16) can be converted. The input file need not be an MRC file; it can be any kind of file readable by other IMOD pro- grams, plus the image file types readable by 3dmod using Qt libraries, of which the most useful are PNG, JPEG, and BMP. There are options to create JPEG or PNG output files instead of TIFF. The data will be written to a TIFF file in the same mode as in the input file by default, but there are options that allow the integer and float modes to be scaled to bytes; the same options allow scaling of byte and RGB values. If the input file has only one section, then the output file will simply be the tiff_file_root_name with no suffix added. When the output mode is integer or float, the TIFF file will contain the minimum and maximum value for the data in the file. When a TIFF stack is created, each image will have the same overall minimum and maximum, rather than values specific to that image. This way, 3dmod will be able to read in the data with proper scaling. However, Photo- shop pays no attention to these values when displaying integer data, so when the integer data have a relatively small range, the image will initially appear black or very dark. The simplest solution for this problem is to apply the scaling options described next. When either the -S, the -C, or the -a option is entered, integer and floating point data will be scaled to bytes and any values outside the range of 0 to 255 will be truncated. If the input data is already in bytes (either byte data or RGB data), these options will cause the data to be scaled, and values outside the range truncated. To have the range of the input data mapped into the full range of byte data, just enter "-C 0,255". To have a subset of the input range mapped to 0 to 255, either enter the limits of the subset of the range directly with the -S option, or adjust the contrast in 3dmod to give the desired expansion of the dynamic range for that subset of the image data, and enter the contrast settings withs the -C option. Output to JPEG or PNG files is selected by entering the -j or the -p option. There are some restrictions in these cases. An output stack cannot be created, only a series of single-image files. The type of compression cannot be specified, but the quality or degree of compres- sion can. Tiling cannot be specified. Only byte and RGB output is available. Integer and floating point files are converted to byte based either on the minimum and maximum densities in the input file or on the values entered with -S, -C, or -a. In addition to the fact that JPEG images cannot be bigger than 65535 pixels in X or Y, problems may be encountered with images much bigger than 1 gigapixel. Since IMOD is distributed with version 4 of the TIFF library, this pro- gram will write files bigger than 4 GB in the BigTIFF format, and con- tinue to write smaller files in classical TIFF format. When images are written to TIFF files with ZIP or LZW compression, the program will use compress the data in parallel threads, with the number of threads depending on the image size. However, if the image is larger than a certain threshold, it is processed in chunks instead of read in all at once, and the parallel compression routine cannot be used. The default threshold is 400 MB. To ensure parallel compres- sion, you can either raise this threshold with the -t option or over- ride the default behavior with "-O 1". Note that with parallel com- pression, memory usage will be about 2.2 times the size of the image. OPTIONS -s Create a single output file, a TIFF stack with all of the sec- tions in the input file. -j Produce JPEG files instead of TIFF files. See above for the restrictions with this kind of output. -p Produce PNG files instead of TIFF files. See above for the restrictions. -c value Compress the data in TIFF files with the type of compression indicated. The most useful compression types are LZW (value 5), Zip or Deflate (value 8), and JPEG (value 7). For these types, the value can be given as a text string: "lzw", "zip", or "jpeg". The other allowed values are 32773 for Packbits and 32946 for a possibly different Deflate. These are available on all operating systems when running with the TIFF libraries dis- tributed with IMOD. Also note that JPEG compression is not available with 16-bit data. -q value Set the quality for JPEG or ZIP compression (ZIP compression is used in PNG output). For JPEG, the quality ranges from 0 to 100 with a default of 75; higher numbers preserve more information but with less compression. For ZIP/PNG, which is a lossless compression, the quality factor ranges from 1 to 9 with a default of 6 and specifies a tradeoff between speed and amount of compression. Higher numbers giving somewhat more compression for more computational time. Lower numbers give somewhat less compression with potentially much less computational time. -S min,min Specify an initial intensity scaling that will scale "min" to 0 and "max" to 255, just as is achieved with the -s options to 3dmod and mrcbyte. -C black,white Specify intensity scaling to match the scaling achieved with the given black and white contrast settings in 3dmod, with the -c option to mrcbyte, or the "-contrast" option to newstack. If both -S and -C are entered, the final scaling will be the prod- uct of these two scalings. If -S is entered alone, the black/white values are 0/255 (no scaling for contrast). If -C is entered alone, the initial scaling will be from the minimum in the input file to 0, and from the maximum in the file to 255. If you have integer data and you want to convert it to bytes, you will generally want to apply some scaling with black/white values to preserve the dynamic range of the data of interest. -a mean,SD Scale data for conversion to bytes so that it has the given mean and standard deviation. Enter 0 for either value to use the default for auto-contrasting in 3dmod, which is a mean of 150 and an SD of 40. This option cannot be entered with -S or -C, since it supercedes the scaling specified by them. -z min,max Starting and ending Z slices in file to output, numbered from 0. -i value Initial file number. The default is the number of the first Z slice output, where Z is numbered from 0. -r value Set the resolution setting of the output file in dots per inch to the given value. -P Use the pixel spacing in the input file header to set the reso- lution in the output file. The resolution will be set in dots per cm in a TIFF file and will typically be a very large number, but this value allows the pixel spacing to be recovered if the file is read back into IMOD programs or converted back with Tif2mrc. -m Use the pixel spacings in an ".mdoc" file associated with the input file, or in other associated autodoc structures, to set the resolution individually for each of the output files. The program will look for pixel spacings directly in an ".idoc" file or an HDF file, and otherwise will try to find a file named as the input filename with ".mdoc" added. If such metadata are found but the pixel spacing is not present for an individual section, it will fall back to the pixel spacing in the input file header. This option cannot be entered with -r or -P nor when making a TIFF output stack. -T xsize,ysize or size Organize output data in tiles instead of strips, which can allow faster access to subareas of very large images. Enter one num- ber for the tile size in both dimensions, or two numbers to specify a different size in X and Y. The TIFF library requires that all tiles be the same size, which means that the image file will be padded so that tiles on the bottom and right sides have the same sizes as the rest. The program will pick an actual tile size near the entered number that is a multiple of 16 and that minimizes the amount of padding required. -t value Set the criterion for processing each image in strips to the given value in megabytes (fractional values are allowed). Whole images will be read in, processed, and saved as a unit if they are less than this criterion (default 400 MB). Above the crite- rion, images will be read, processed, and saved in strips (unless "-O 1" is entered), with much lower memory requirements. -O value Override the default behavior on whether to compress data in parallel. Specifically, a value of 0 will force data not to be compressed in parallel if it ordinarily would be. A value of 1 will force large images to be compressed in parallel if they would ordinarily be read in chunks instead. -o Use old IMOD code instead of libtiff for writing the files (for testing purposes). AUTHORS Jim Kremer, David Mastronarde SEE ALSO clip, newstack BUGS Complex and long integer data modes are not supported. Email bug reports to mast at colorado dot edu. IMOD 5.0.2 mrc2tif(1)