{from Globals.header} var Raw16Pid, Raw8Pid, RawANDPid, RawB16Pid: integer; RawHeight, RawMaskPid, RawWidth, rawDirID, rawVRefNum: integer; frameType, firstFrame, lastFrame, nextFrame, skipFrame: integer; fore, foredef, cropheight, cropwidth, maskheight: integer; maskwidth, b16Pid, i16Pid, s16Pid, m16Pid: integer; o16Pid, i8Pid, referencePid, smoothPid, markPid: integer; maskPid, mask1Pid, mask2Pid, mask3Pid, dilatePid: integer; flagPid, kernelPid, rbKerPid, xlate16uTo8P, std65535Pid: integer; std8191Pid, customLUTPid, xmax, xmin, ymax: integer; ymin, pack16Pid, packDirID, packMarkPid, packVRefNum: integer; {initialize global variables} begin requiresUser('Pixel16u',2); requiresUser('GetPutPixel',1); requiresUser('timer',1); requiresUser('utilities',1); requiresUser('markup',1); {info about the raw data} Raw16Pid := GetMemo('Raw16Pid'); Raw8Pid := GetMemo('Raw8Pid'); RawANDPid := GetMemo('RawANDPid'); RawB16Pid := GetMemo('RawB16Pid'); RawHeight := GetMemo('RawHeight'); RawMaskPid := GetMemo('RawMaskPid'); RawWidth := GetMemo('RawWidth'); rawDirID := GetMemo('rawDirID'); rawVRefNum := GetMemo('rawVRefNum'); {raw data frame numbers} frameType := GetMemo('frameType'); firstFrame := GetMemo('firstFrame'); lastFrame := GetMemo('lastFrame'); nextFrame := GetMemo('nextFrame'); skipFrame := GetMemo('skipFrame'); {mark color} fore := GetMemo('fore'); foredef := GetMemo('foredef'); {cropped image dimensions} cropheight := GetMemo('cropheight'); cropwidth := GetMemo('cropwidth'); maskheight := GetMemo('maskheight'); maskwidth := GetMemo('maskwidth'); {scratch image pidNumbers} b16Pid := GetMemo('b16Pid'); i16Pid := GetMemo('i16Pid'); s16Pid := GetMemo('s16Pid'); m16Pid := GetMemo('m16Pid'); o16Pid := GetMemo('o16Pid'); i8Pid := GetMemo('i8Pid'); referencePid := GetMemo('referencePid'); smoothPid := GetMemo('smoothPid'); markPid := GetMemo('markPid'); maskPid := GetMemo('maskPid'); mask1Pid := GetMemo('mask1Pid'); mask2Pid := GetMemo('mask2Pid'); mask3Pid := GetMemo('mask3Pid'); dilatePid := GetMemo('dilatePid'); flagPid := GetMemo('flagPid'); {kernel information} kernelPid := GetMemo('kernelPid'); rbKerPid := GetMemo('rbKerPid'); xlate16uTo8P := GetMemo('xlate16uTo8P'); std65535Pid := GetMemo('std65535Pid'); std8191Pid := GetMemo('std8191Pid'); customLUTPid := GetMemo('customLUTPid'); xmax := GetMemo('xmax'); xmin := GetMemo('xmin'); ymax := GetMemo('ymax'); ymin := GetMemo('ymin'); {packed stack info} pack16Pid := GetMemo('pack16Pid'); packDirID := GetMemo('packDirID'); packMarkPid := GetMemo('packMarkPid'); packVRefNum := GetMemo('packVRefNum'); if pidExists(GetMemo('frontPid')) then selectPic(GetMemo('frontPid')); {end from Globals.header} end; macro '[F5] 16 bit arithmetic'; begin SetMemo('frontPid', pidNumber); SelectWindow('16 bit arithmetic'); LoadMacros; end; macro '[F6] Adjust 16 bit LUT'; begin SetMemo('frontPid', pidNumber); SelectWindow('Adjust 16 bit LUT'); LoadMacros; end; macro '[F7] Calculate Intensity'; begin SetMemo('frontPid', pidNumber); SelectWindow('Calculate Intensity'); LoadMacros; end; macro '[F8] Create Kernels'; begin SetMemo('frontPid', pidNumber); SelectWindow('Create Kernels'); LoadMacros; end; macro '([F9] Examine Old 16 bit Stacks'; begin end; macro '[F10] Examine Packed 16 bit stack'; begin SetMemo('frontPid', pidNumber); SelectWindow('Examine Packed 16 bit stack'); LoadMacros; end; macro '[F11] Examine Raw Data'; begin SetMemo('frontPid', pidNumber); SelectWindow('Examine Raw Data'); LoadMacros; end; macro '[F12] Front Image Is ...'; begin SetMemo('frontPid', pidNumber); SelectWindow('Front Image Is ...'); LoadMacros; end; macro '(-'; begin end; { utilities for dealing with old 16 bit stacks } macro 'convert front 16 bit stack to 8 bits'; var i, n: integer; inPid, outPid: integer; width, height: integer; begin RequiresUser('pixel16u', 1); inPid := pidNumber; n := nSlices; GetPicSize(width, height); SaveState; ChoosePic(xlate16uTo8P); MakeRoi(0, 0, 256, 256); SetNewSize(width div 2, height); MakeNewStack('8 bit stack from ', inPid : 0); outPid := pidNumber; RestoreState; for i := 1 to n do begin choosePic(inPid); chooseSlice(i); choosePic(outPid); if i > nSlices then addSlice; chooseSlice(i); MakeRoi(0,0,width div 2, height); Cnvrt16uto8(inPid, xlate16uTo8P, outPid); end; end; macro 'Export VDM format Frame nnnn from stack'; var width, height: integer; i, n, inPid: integer; begin GetPicSize(width,height); width := width div 2; n := nSlices; inPid := pidNumber; SaveState; setNewSize(32,32); makeNewWindow('Frame 0000'); putPixel(0,0,width div 256); putPixel(1,0,width mod 256); putPixel(2,0,height div 256); putPixel(3,0,height mod 256); export('Frame 0000'); RestoreState; Dispose; selectPic(inPid); for i := 1 to n do begin chooseSlice(i); selectAll; export('Frame ',i:4); end; end; macro 'add mark stack flags to front stack'; var i, n: integer; d, u, t, h: integer; begin n := nSlices; for i := 1 to n do begin selectSlice(i); d := i - 1; u := d; d := d div 10; u := u - d * 10 + 128; t := d; d := d div 10; t := t - d * 10 + 128; h := d; d := d div 10; h := h - d * 10 + 128; PutPixel(0,0,h); PutPixel(1,0,t); PutPixel(2,0,u); PutPixel(3,0,129); {mtype length} PutPixel(4,0,0); {focus quality default} PutPixel(5,0,0);{never cuts} PutPixel(6,0,0);{never cuts} PutPixel(7,0,0);{never cuts} PutPixel(8,0,0);{never cuts} PutPixel(9,0,0);{never cuts} end; end; macro 'dilate front stack using default binary settings'; begin selectSlice(1); while true do begin changeValues(1,255,255); Dilate; if sliceNumber = nSlices then exit; selectSlice(sliceNumber + 1); end; end; macro 'change yellow to cyan for a range of slices'; var i, first, last: integer; begin first := GetNumber('First slice',1); last := GetNumber('Last slice',nSlices); for i := first to last do begin selectSlice(i); changeValues(4,4,5); end; end;