macro 'Convert BioRad PIC File to NIH Image Files'; { Written by Pete Smith, Pete DeVries, Charles Thomas 1-4-94 Converts a BioRad z-series to NIH-Tiff files with names 01, 02, ... As long as the converted files are saved in the same folder, you should only see two file dialog boxes (one for the first Import and one for the first Export). } Var file, pic, nFiles, nPic, width, height, offset, PicSize, numberbin: integer; begin numberbin:=0; SetImport('8-bits'); { Sets import default } SetCustom(6,6,0); { Imports first 6 bytes, which contain the width, height, } Import(''); { and number of pictures in the file. } width := (GetPixel(1,0)*256) + GetPixel(0,0); { 1 & 0, 3 &2, and 5 & 4 are three} height := (GetPixel(3,0)*256) + GetPixel(2,0); { 16-bit numbers expressing the } PutMessage('The X,Y dimensions of these images are: ',width:3:0,' x ',height:3:0); PicSize:=width*height; nPic := (GetPixel(5,0)*256) + GetPixel(4,0); { width, height, and number. } PutMessage('The number of slices is: ',nPic:3:0); Dispose; { Closes window without save. } for pic:= 1 to nPic do { Does each picture, one by one } begin offset:=(pic-1)*PicSize+76; { Offset increments by the size of the picture } SetCustom(width,height,offset); Import(''); numberbin:= numberbin+1; { Will be a 'numberbin' for each file made. } SetPicName(numberbin:2); { Renames each picture 01, 02, ... } Save; { Creates file using Tiff. } Dispose; { Closes window. } end; {for pic} end; {Convert Biorad PIC File to NIH Image Files}