-
Notifications
You must be signed in to change notification settings - Fork 1
createtrainingmrcstack.py
createtrainingmrcstack.py IS AN ALPHA IMPLEMENTATION AND MAY NOT WORK
createtrainingmrcstack.py creates an MRC file with help of IMOD by extracting random tiles from a directory of images.
Basic command:
createtrainingmrcstack.py <directory containing images> <# of random tiles to extract> <destination mrc file>
Example usage:
createtrainingmrcstack.py ./myimages 5 ./traindata.mrc
For help run:
createtrainingmrcstack.py --help
Examples below use the following image as input:
How to download the above image using wget:
wget https://raw.githubusercontent.com/wiki/CRBS/chmutil/images/bubbles_gray.png
The following command will extract 2 random tiles of default size (512x512 pixels) from the bubbles_gray.png image under the ./images directory. Those tiles will then be put into a MRC file using the IMOD command newstack
NOTE: The command below assumes the bubbles_gray.png was put in the images/ subdirectory
createtrainingmrcstack.py ./images 2 result.mrc
If above command is successful, output similar to the following will be seen:
THIS PROGRAM IS AN ALPHA IMPLEMENTATION AND MAY NOT WORK
RO image file on unit 1 : 0000.tif Size= 256 K
This is a TIFF file.
Number of columns, rows, sections ..... 512 512 1
Map mode .............................. 0 (byte)
Start cols, rows, sects, grid x,y,z ... 0 0 0 512 512 1
Pixel spacing (Angstroms).............. 1.000 1.000 1.000
Cell angles ........................... 90.000 90.000 90.000
Fast, medium, slow axes ............... X Y Z
Origin on x,y,z ....................... 0.000 0.000 0.000
Minimum density ....................... 0.0000
Maximum density ....................... 255.00
Mean density .......................... 127.50
tilt angles (original,current) ........ 0.0 0.0 0.0 0.0 0.0 0.0
Space group,# extra bytes,idtype,lens . 0 0 0 0
0 Titles :
NEW image file on unit 2 : /trainexample/result.mrc
section input min&max output min&max & mean
0 7.00 255.00 7.00 255.00 93.82
RO image file on unit 1 : 0001.tif Size= 256 K
This is a TIFF file.
Number of columns, rows, sections ..... 512 512 1
Map mode .............................. 0 (byte)
Start cols, rows, sects, grid x,y,z ... 0 0 0 512 512 1
Pixel spacing (Angstroms).............. 1.000 1.000 1.000
Cell angles ........................... 90.000 90.000 90.000
Fast, medium, slow axes ............... X Y Z
Origin on x,y,z ....................... 0.000 0.000 0.000
Minimum density ....................... 0.0000
Maximum density ....................... 255.00
Mean density .......................... 127.50
tilt angles (original,current) ........ 0.0 0.0 0.0 0.0 0.0 0.0
Space group,# extra bytes,idtype,lens . 0 0 0 0
0 Titles :
1 36.00 255.00 36.00 255.00 99.82
In addition, the following files should appear in the current directory:
-
result.mrc -- Output IMOD MRC file with 2 tiles extracted from input image(s).
-
result.mrc.tile.list.config -- ASCII text configuration file with coordinates containing locations where tiles were extracted from the input image(s).
Example contents of result.mrc.tile.list.config:
[DEFAULT]
imagedir = /foo/example/images
[bubbles_gray.png]
1 = 649,527,1161,1039
2 = 222,8,734,520
Run 3dmod to launch IMOD on result.mrc to view its contents
3dmod result.mrc
Screenshot of result.mrc