really simple workbench macro mike avison (apologies to advanced users)
TRANSCRIPT
Really simple Workbench Macro
Mike Avison
(apologies to advanced users)
About Workbench Macros
How do they differ from Pixie macros?
• They output image files on disk (The only image you can store from Pixie is a Lightbox)
• There are no control functions (if, then, goto etc)
• There are no variables (as far as I am aware)
Macro Example
• Cine a cardiac image• What’s wrong with just >display >cine?• It cines all the frames. If you do SPECT with
heads at 102° you only want frames 42 to 109.
• You want “wiper” action• You can set all these in cine but its not
convenient
Also..
• You might want – some spatial or “temporal” smoothing– truncation (with Tc agents the gallbladder is
often much hotter than the heart so it compresses the colour scale horribly… see following images)
Frame of cardiac SPECT without truncation, and UL = 100
UL brought down to 6 (therefore only ~12 grey levels being used)
Not as bad as some we used to get before modifying the patient prep.
Here’s the macro…start.; Image Workbench Macro: cine_card.wmf.;.; Initialization*chain=yes*autosave=no
Chain means it will jump from the end of one command to the next
Autosave = no means that the intermediate files we create will only be temporary. Users usually want it on so we must remember to switch it on at the end
.;Set all counts above 30 to 30
.;*Image Algebrainteractive=nomainfunction=countsubfunction=replaceID=ReCcountlo=0countlonew=0counthi=30counthinew=30startimage=1endimage=2048startint=1endint=40*EOD
30 is locally derived arbitrary level to truncate the counts to. (with 128 matrix, no zoom and 400MBq inj tetrofosmin)
.;
.;Weiner filter
.;*Prefilteringinteractive=nofilter_type=Wienerdimension=0mult=defaultcollimator=defaultisotope=defaultdistance=defaultfield_entry=defaulthanning=Falseframe_to_frame=Falsebatch_mode=no*EOD
Spatial filter
.;Temporal 3 point smooth
.;*Image Algebrainteractive=nomainfunction=averagesubfunction=temp_dynID=rawdataweightpre=1.000000weight=2.000000weightpost=1.000000*EOD.;
Does a 1:2:1 smooth between each pixel and its corresponding pixel in the previous and next projections
.; Remove empty frames (102 deg acq.)
.;*Image Algebrainteractive=nomainfunction=editID=cinestartimage=42endimage=109startint=1endint=40*EOD.;
Remove those pesky blank frames, we could leave them in and tell the cine program not to display them, but why waste disk space?
.;Cine the results
.;*CineVersion=3Info=0Text=2Total_zones=1Active_zone=0All=0Type_1=0First_1=1Last_1=68Image_Int_1=1Speed_1=30Mode_1=2Zoom_1=128Scale_1=0Colorstripe_1=0
Type_2=0First_2=0Last_2=0Image_Int_2=0Speed_2=6Mode_2=0Zoom_2=256Scale_2=0Colorstripe_2=0Type_3=0First_3=0Last_3=0Image_Int_3=0Speed_3=6Mode_3=0Zoom_3=256Scale_3=0Colorstripe_3=0
Type_4=0First_4=0Last_4=0Image_Int_4=0Speed_4=6Mode_4=0Zoom_4=256Scale_4=0Colorstripe_4=0Type_5=0First_5=0Last_5=0Image_Int_5=0Speed_5=6Mode_5=0Zoom_5=256Scale_5=0Colorstripe_5=0
Type_6=0First_6=0Last_6=0Image_Int_6=0Speed_6=6Mode_6=0Zoom_6=256Scale_6=0Colorstripe_6=0
One long cine command, it seems you have to set all 6 possible zones even if 5 are not going to display anything
Looks horrible but it was created just by running cine in learn mode.
And finally...
*autosave=yes
Switch auto save back on.
Creating the Macro
In fact nearly all of it was created by just running through the process with learn mode switched on.
Only the truncation level and the Autosave were edited
One frame from the result
So why cine raw SPECT data anyway?
Its useful for the reporter to see problems in the acquisition data before reconstruction turns them into mysterious artifacts!
Particularly
Movement
Attenuation (it is one of the many ruses suggested to help the reporter work out if a defect is real or attenuation, I’ll leave it to you to work out how, personally I prefer Beacon any day)
End
(you can down-load the macro by right clicking on it, and run it by first
removing the .doc extrension.)