Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What language am I "coding" "scripting"
#1
Hi,

Not to toot my own horn or anything, but I have started to write some pretty sophisticated stuff ((see below)) from a background of nearly zero in programming just like 4-5 months ago - when I started out having QM just record where I was clicking on the screen by coordinates (yuck!).

Anyway, people keep on asking me "What programming language are you writing all this stuff in". They are expecting to hear things that they know like: C++ or perlscript or something like that. THe problem is that I don't know what to tell them: What is QM? Is it its own scripting language or a (WONDERFUL) environment to script-in acting as more user friendly interface layer over another language? Or a mishmash of the two?

Anyway, hats off to Gintaras for creating such a wonderful program (language?) and his generosity and ingenuity on the forum. Also thanks to the others like Ken and _pi who also contribute so much to the community on the forums and their own blogs (and helped me get this far).

Stuart

ps. the "foreach" command has done so much for my code - cut some code to 1/10th its size, especially with user-defined functions.

pps. note that the code below are not general functions useful (without modification) outside of the applications I have written them for. However, there are some solutions to problems in there that may be generalizable and therefore useful to others. Ask me if you think we were both wrestling with the same problem and I can share whatever i have figured out.

pps. I know I have some user-interface screengrabs to upload - still perfecting them....

Code:
Copy      Help
CloseAllOSD

str series

str masterfolder;; receives folder tree level of master folder (to return to after cancels)


str c;; receives folder tree level of where initial timepoint to be displayed is located
str upalevel;; will later receive the depth of the patient master folder (contains all timepoints)

upalevel = "C:\IMAGES\4_Images To Be Read\";;set initial folder depth

str MasterfolderOSD= "Select Patient Master Folder:"
OnScreenDisplay MasterfolderOSD 30 500 100 "" 50 0xD30903 1 0

if(BrowseForFolder(masterfolder upalevel)); out masterfolder
CloseAllOSD

int counter=0;; to identify which timepoint we are at in the foreach cycle

str timepoints=
;Pre-S
;Week 24
;Week 48
;Week 96



str preseries=
;*re*air
;*re*ost*ad
;*re*re*ad
;*re*T2


str wk24series=
;*24*air
;*24*ost*ad
;*24*re*ad
;*24*T2


str wk48series=
;*48*air
;*48*ost*ad
;*48*re*ad
;*48*T2


str wk96series
;*96*air
;*96*ost*ad
;*96*re*ad
;*96*T2


str timepointsbucket
foreach timepointsbucket timepoints
,str timepointsOSD1.format("-Select SubFolder from Patient: %s containing:" masterfolder)
,str timepointsOSD2.format("%s Files" timepointsbucket)
,str timepointsOSD3="Press Cancel to skip the suggested timepoint"
,str timepointsOSD4="-If prior-comparisons are just COPIES,[] when prompted for the EARLIER folder,[] choose the location of the copies[] in the LATER folder"
,OnScreenDisplay timepointsOSD1 30 800 300 "" 30 0xD30903 1 0
,OnScreenDisplay timepointsOSD2 30 800 450 "" 50 0x191919 1 0;;0x4642FF
,OnScreenDisplay timepointsOSD3 30 800 600 "" 30 0xD30903 1 0
,OnScreenDisplay timepointsOSD4 30 800 800 "" 30 0xD30903 1 0
,;function $text [^_time] [x] [y] [$fname] [fsize] [fcolor] [flags] [$osdid] [bcolor] ;;flags: 1 nontransparent, 2 synchronous, 4 click to hide
,if(BrowseForFolder(c upalevel))
,else
,,counter=counter+1;;advances to next time point
,,upalevel.set(masterfolder);; = "R:\serono1\IMAGES\4_Images To Be Read\";;reset initial folder depth upon CANCEL
,,goto g1
,str seriesbucket
,counter=counter+1
,if counter=1;  series.set(preseries)    
,if counter=2; series.set(wk24series)
,if counter=3; series.set(wk48series)
,if counter=4; series.set(wk96series)    
,foreach seriesbucket series;;run each series wildcard through the folder level set in combo
,,str comboseries
,,EnumerateLaunchChesireSeries c seriesbucket comboseries
,,0.1
,,ResetImageThickness_ACTIVEWINDOW        
,CloseAllOSD
,UpAFolderLevel c upalevel
,;g1
mou 171 12 id(9999 win(" MS MENU" "QM_toolbar") 0x1);; moves cursor to Toolbar Hanging Protocol Menu

Acc menudrop=acc("Hanging Protocols" "PUSHBUTTON" win(" MS MENU" "QM_toolbar") "ToolbarWindow32" "" 0x1001);;identifies Hanging Protocol menu
menudrop.DoDefaultAction;; drops menu



or

Code:
Copy      Help
BlockInput2 3

lef
'Cs
wait 0.5 WC win("Save As" "#32770")
err
,;g1
,0.1
,'RY
,
,;str text.getfile("C:\Documents and Settings\All Users\Documents\QM\Results.txt")
,;out text
,
,str text="RED   626.217102   820.000000   461.000000   64.519341   1334.535645   447119.000000";;sameple string to be fed in by prior code
,;
,str pattern="\d{1,6}\.\d{6}";; regular expression pattern for each number
,;
,;
,ARRAY(str) result
,findrx(text pattern 2 4 result);; puts each pattern match into a string array "result"
,;
,;
,str volume.set(result[0 4]);; outputs the 5th (0, 1, 2, 3, 4)  element of the array into the str "volume"
,;out volume
,
,str pattern2="\d{1,6}(?=\.)";; regular expression for "all the numbers before the decimal point"
,str numsbeforedec
,findrx(volume pattern2 0 4 numsbeforedec);;extracts all the numbers before the decimal point
,;out numsbeforedec
,;mes numsbeforedec
,double numsbeforedecDou=val(numsbeforedec 2);;converts the numbers before the decimal point from a string into a Double number
,;int length=len(numsbeforedec);;gets the length of that number
,;mes length
,double volCCs=(numsbeforedecDou/1000)
,;mes volCCs
,;out volCCs
,str volCCsFormat.format("%#.3f" volCCs)
,;out volCCsFormat
,;mes volCCsFormat    
,ret
act win("Save As" "#32770")
'Yy
0.1
goto g1
#2
The program and the language cannot live without each other. The language is not derived from another language. I usually say "QM" or "QM language". Or could be "QMScript" or similar.

change name


Forum Jump:


Users browsing this thread: 1 Guest(s)