diff --git a/README.md b/README.md
index b145661..e64d0e6 100755
--- a/README.md
+++ b/README.md
@@ -8,56 +8,19 @@ http://www.mccauslandcenter.sc.edu/mricrogl/
![alt tag](https://github.com/neurolabusc/MRIcroGL/blob/master/clipping.jpg)
-##### Recent Versions
-15-December-2017 (v1.0.20171215)
- - Updated [dcm2niix](https://github.com/rordenlab/dcm2niix).
-14-July-2017
- - [Display/Radiological menuitem](https://www.nitrc.org/forum/message.php?msg_id=21719) flips between neurological and radiological convention. The "L" and "R" symbols change in the "2D Slices" panel to remind user of current setting. Slices coordinates reflect MNI space (e.g. left side of brain is negative regardless of viewing convention). Rendering view not influenced: radiological view assumes camera is anterior/inferior to object for coronal/sagittal views while neurological assumes camera is posterior/superior.
- - Preference window allows user to select between fonts installed in the LUT folder, and create their own fonts using [Hiero](https://github.com/libgdx/libgdx/wiki/Distance-field-fonts).
+##### Installation
+You can download the latest release for Windows, MacOS or Linux from either of these sites:
+ - [Available from NITRC](https://www.nitrc.org/projects/mricrogl/).
+ - [Available from Github](https://github.com/neurolabusc/MRIcroGL/releases).
-24-June-2017
- - [Smooth](https://github.com/neurolabusc/OpenGLCoreTutorials) numbers in colorbars
-21-June-2017
- - Preferences window now allows user to enable optional support for MacOS retina resolution. Slower but better quality.
- - [Screenshot fixes](http://www.nitrc.org/forum/message.php?msg_id=21504). Fix 'seams' when taking screenshots with high zoom factors, reduce blurriness of mosaic screenshots.
- - New script commands "sharpen" and "bmpzoom" (described in manual).
- - Better support for NRRD format images.
-28-May-2017
- - [Better thresholding of binary overlays](https://www.nitrc.org/forum/message.php?msg_id=19974).
- - [DICOM import interface fix](https://www.nitrc.org/forum/forum.php?thread_id=7624&forum_id=4442).
-
-1-April-2017
- - Better [Gentoo support](https://github.com/neurolabusc/MRIcroGL/issues/8): Allow supporting files to be stored in /usr/share/mricrogl/script, /usr/share/mricrogl/lut and /usr/share/mricrogl/shaders
- - Fix bug where drawing erase tool would get inadvertently activated.
-
-7-February-2017
- - Looks better on Linux high-DPI screens
- - [Cubic b-spline interpolation](http://www.mccauslandcenter.sc.edu/mricrogl/beta-features).
- - [Threshold Detection](http://www.mccauslandcenter.sc.edu/mricrogl/beta-features).
-
-30-September-2016
- - Ensure colorbars show active overlay colors. Improvements for macOS 10.11.
-
-6-June-2016
- - Fix some shaders to ensure variable colorSample initialized to zero.
-
-9-September-2015
- - Add retina and 64-bit support for macOS (aka OSX). Better compatibility with VirtualBox. New shaders. Retina quality screen captures.
-
-##### Installation and Compiling
-
-The easiest way to install MRIcroGL is to get pre-compiled binaries from [NITRC (macOS, Linux and Windows)](https://www.nitrc.org/projects/mricrogl/). You can also compile a copy yourself. Instructions are available on the [MRIcroGL website](http://www.mccauslandcenter.sc.edu/mricrogl/source). In brief, you need to install FreePascal and Lazarus. You also have to [install](http://wiki.freepascal.org/Install_Packages) the "LazOpenGL" package into Lazarus. Finally you need to compile the application. On most systems this is as simple as running the following from the terminal command line: `lazbuild ./simplelaz.lpr`. This will compile to the default widgetset for your operating system (Windows: WinAPI; macOS: Carbon; Linux: GTK2). You can also compile to other widgetsets (e.g. QT, Cocoa), but that is beyond the scope of these instructions.
-
-To use the Python scripting language you will need to install [Python-for-Lazarus](https://github.com/Alexey-T/Python-for-Lazarus) in your build of Lazarus. If you do not want to do this, comment the line "{$DEFINE MYPY}" in the file "opts.inc" and remove the dependency in the Project/ProjectInspector window.
-
-
-A basic command line script for ensuring the required packages are installed and compiling this software would look like this (assuming you are using a Linux or macOS computer).
+##### Compiling
+Most users will want to use the pre-compiled executable (see the previous section). However, you can compile this yourself. Lazarus 2.0 or later is recommended.
```
lazbuild --verbose-pkgsearch lazopenglcontext --verbose-pkgsearch pascalscript
diff --git a/backup/clut.pas b/backup/clut.pas
deleted file mode 100755
index 9107df7..0000000
--- a/backup/clut.pas
+++ /dev/null
@@ -1,331 +0,0 @@
-unit clut;
-{$D-,L-,O+,Q-,R-,Y-,S-}
-{$IFDEF FPC} {$mode delphi}{$H+} {$ENDIF}
-//color lookup tables
-interface
-uses
-//{$IFNDEF UNIX}Windows,{$ENDIF}
-dialogs,Classes,define_types, IniFiles, SysUtils,prefs,Menus, StdCtrls, userdir;
-type
- TCLUTnode =record
- intensity: byte;
- rgba: TGLRGBQuad;
- end;
- TCLUTnodeRA = array [0..255] of TCLUTnode;
- TCLUTrec =record
- numnodes: integer;
- min,max: single;
- nodes: TCLUTnodeRA;
- end;
-var
- gCLUTrec: TCLUTrec;
- gSelectedNode: integer = -1;
- function Node(lIntensity,lR,lG,lB,lA: byte): TCLUTnode;
- procedure RangeRec (lMin,lMax: single);
- procedure AutoContrast (var lCLUTrec: TCLUTrec);
- procedure GenerateLUT(lNodeRA: TCLUTrec; var lCLUT: TLUT);
- procedure LoadColorSchemes;
- procedure LUTChange(Sender: TObject);
- procedure SetItemNameX (lStr: string; var LUTdrop: TComboBox); overload;
- procedure SetItemNameX (lStr: string; var LUTdrop: TMenuItem); overload;
- procedure UpdateColorSchemes (var LUTdrop: TComboBox);
- procedure CLUT2TLUT(lFilename: string; var lLUT: TLUT; var lCLUTrec: TCLUTrec);
- //procedure LinearMinMaxCLUT(lMin,lMax: TGLRGBQuad; var lCLUT: TLUT);
- function CLUTDir: string;
-implementation
-uses mainunit;
-
-function StripAmpersand(lS: string): string;
-var i: integer;
-
-begin
- result := '';
- if length(lS) < 1 then
- exit;
- for i := 1 to length(lS) do
- if lS[i] <> '&' then
- result := result+ lS[i];
-end;
-
-procedure SetItemNameX (lStr: string; var LUTdrop: TMenuItem); overload;
-var
- i: integer;
- lIStr,lUStr,lPStr: string;
-begin
- if LUTdrop.Count < 1 then exit;
- lUStr := ansiuppercase(lStr);
- lPStr := parsefilename(extractfilename(lUStr));
- i := 0;
- while i < LUTdrop.Count do begin
- lIStr := StripAmpersand(ansiuppercase(LUTdrop.Items[i].caption));
- if (lIStr = lUStr) or (lIStr = lPStr) then begin
- LUTdrop.Items[i].click;
- exit;
- end;
- inc(i);
- end;
-end;//SetItemNameX
-(* the following code seems elegant, but is case sensitive and crashes lazarus if not found
-begin
- LUTdrop.Find(lStr).Click;
- //GLForm1.OpenColorScheme( LUTdrop.Find(lStr));
-end;//SetItemNameX *)
-
-procedure SetItemNameX (lStr: string; var LUTdrop: TComboBox); overload;
-var
- i: integer;
- lIStr,lUStr,lPStr: string;
-begin
- if LUTdrop.Items.Count < 1 then exit;
- lUStr := ansiuppercase(lStr);
- lPStr := parsefilename(extractfilename(lUStr));
- i := 0;
- while i < LUTdrop.Items.Count do begin
- lIStr := ansiuppercase(LUTdrop.Items[i]);
- if (lIStr = lUStr) or (lIStr = lPStr) then begin
- LUTdrop.ItemIndex := i;
- exit;
- end;
- inc(i);
- end;
-end;//SetItemNameX
-
-function CLUTDir: string;
-begin
- //result := extractfilepath(paramstr(0))+'lut';
- result := AppDir+'lut';
- {$IFDEF UNIX}
- if fileexists(result) then exit;
- result := '/usr/share/mricrogl/lut';
- if fileexists(result) then exit;
- result := AppDir+'lut'
- {$ENDIF}
- if fileexists(result) then exit;
- result := AppDir+'Resources'+pathdelim+'lut'
-
-end;
-
-function CLUT2disk(lRead: boolean; lFilename: string; var lCLUTrec: TCLUTrec): boolean;
-//Read or write initialization variables to disk
-var
- lIniFile: TIniFile;
- lI: integer;
-begin
- result := false;
- if lRead then
- AutoContrast(lCLUTrec);
- if (lRead) and (not Fileexists(lFilename)) then
- exit;
- lIniFile := TIniFile.Create(lFilename);
- IniFloat(lRead,lIniFile, 'min',lCLUTrec.min);
- IniFloat(lRead,lIniFile, 'max',lCLUTrec.max);
- IniInt(lRead,lIniFile, 'numnodes',lCLUTrec.numnodes);
- if (lCLUTrec.numnodes > 1) and (lCLUTrec.numnodes <= 256) then begin
- for lI := 0 to (lCLUTrec.numnodes-1) do begin
- IniByte(lRead,lIniFile, 'nodeintensity'+inttostr(lI),lCLUTrec.nodes[lI].intensity);
- IniRGBA(lRead,lIniFile, 'nodergba'+inttostr(lI),lCLUTrec.nodes[lI].rgba);
- end;
- end else
- AutoContrast (lCLUTrec);
- lIniFile.Free;
- result := true;
-end;
-
-function RemoveSpecial (S: string): string;
-var
- i: integer;
-begin
- result := '';
- if length(S) < 1 then
- exit;
- for i:= 1 to length(S) do
- if ord(S[i]) <> 38 then result := result + S[i];
-end;
-
-procedure LUTChange(Sender: TObject);
-begin
- if (Sender as TMenuItem).Tag = 0 then
- AutoContrast (gCLUTrec)
- else
- CLUT2disk(true,ClutDir+pathdelim+removespecial((Sender as TMenuItem).caption)+'.clut', gCLUTrec);
- if (gCLUTrec.min = gCLUTrec.max) then
- RangeRec(gTexture3D.MinThreshScaled,gTexture3D.MaxThreshScaled);
-end;
-
-procedure FindColorSchemes(out lS: TStringList);
-var
- lSearchRec: TSearchRec;
- lStr : string;
-begin
- lS := TStringList.Create;
- if FindFirst(CLUTdir+pathdelim+'*.clut', faAnyFile, lSearchRec) = 0 then
- repeat
- lStr := ParseFileName(ExtractFileName(lSearchRec.Name));
- if (length(lStr) > 0) and (lStr[1] <> '.') then
- lS.Add(lStr);
- until (FindNext(lSearchRec) <> 0);
- FindClose(lSearchRec);
- lS.sort;
-end;
-
-procedure UpdateColorSchemes (var LUTdrop: TComboBox);
-var
- lS: TStringList;
-begin
- FindColorSchemes(lS);
- if lS.Count > 0 then
- LUTdrop.Items.AddStrings(lS);
- Freeandnil(lS);
-end;//UpdateColorSchemes
-
-procedure LoadColorSchemes;
-var
- lS: TStringList;
- NewItem: TMenuItem;
- lPos: integer;
-begin
- FindColorSchemes(lS);
- for lPos := 0 to lS.Count do begin//for each MRU
- NewItem := TMenuItem.Create(GLForm1);
- if lPos = 0 then
- NewItem.Caption := 'Grayscale'
- else
- NewItem.Caption :=ExtractFileName(lS[lPos-1]);//NewItem.Caption :=ExtractFileName(lS[lPos-1]);//(ParseFileName(ExtractFileName(lFName)));
- NewItem.Tag := lPos;
-
- NewItem.onclick := GLForm1.OpenColorScheme;
- GLForm1.Scheme1.Add(NewItem);
- end;//for each MRU
- Freeandnil(lS);
-end;//UpdateColorSchemes
-
-
-
-procedure RangeRec (lMin,lMax: single);
-begin
- gCLUTrec.min := lMin;
- gCLUTrec.max := lMax;
-end;
-
-function Node(lIntensity,lR,lG,lB,lA: byte): TCLUTnode;
-begin
- result.intensity := lIntensity;
- result.rgba := RGBA(lR,lG,lB,lA);
-end;
-
-procedure GenerateLUT(lNodeRA: TCLUTrec; var lCLUT: TLUT);
-var
- lSlope: single;
- lSpace,lI,lIprev,lS: integer;
- lMin,lMax: TCLUTnode;
-begin
- if lNodeRA.numNodes < 2 then exit;
- lMin := lNodeRA.nodes[0];
- lMax := lNodeRA.nodes[lNodeRA.NumNodes-1];
- //check that nodes are in order...
- lIprev := lMin.intensity;
- for lI := 1 to (lNodeRA.numnodes-1) do begin
- if lNodeRA.nodes[lI].intensity <= lIprev then begin
- showmessage('Error, nodes not sorted or overlapping.');
- exit;
- end;
- lIprev := lNodeRA.nodes[lI].intensity;
- end;
- //clip values <= lMin to value of lMin
- for lI := 0 to lMin.Intensity do begin
- lCLUT[lI] := lMin.rgba;
- if (lCLUT[lI].rgbReserved= 0) then lCLUT[lI] := RGBA(0,0,0,0); //some clear nodes have RGB values to help interpolation
- end;
- //clip values >= lMax to value of lMin
- for lI := lMax.Intensity to 255 do begin
- lCLUT[lI] := lMax.rgba;
- end;
- for lI := 0 to (lNodeRA.NumNodes-2) do begin
- lSpace := lNodeRA.nodes[lI+1].Intensity-lNodeRA.nodes[lI].Intensity;
- //interpolate red
- lSlope := (lNodeRA.nodes[lI+1].rgba.rgbRed-lNodeRA.nodes[lI].rgba.rgbRed)/lSpace;
- for lS := 1 to lSpace do
- lCLUT[lNodeRA.nodes[lI].Intensity+lS].rgbRed :=lNodeRA.nodes[lI].rgba.rgbRed + round(lS * lSlope);
- //interpolate green
- lSlope := (lNodeRA.nodes[lI+1].rgba.rgbGreen-lNodeRA.nodes[lI].rgba.rgbGreen)/lSpace;
- for lS := 1 to lSpace do
- lCLUT[lNodeRA.nodes[lI].Intensity+lS].rgbGreen :=lNodeRA.nodes[lI].rgba.rgbGreen + round(lS * lSlope);
- //interpolate blue
- lSlope := (lNodeRA.nodes[lI+1].rgba.rgbBlue-lNodeRA.nodes[lI].rgba.rgbBlue)/lSpace;
- for lS := 1 to lSpace do
- lCLUT[lNodeRA.nodes[lI].Intensity+lS].rgbBlue :=lNodeRA.nodes[lI].rgba.rgbBlue + round(lS * lSlope);
- //interpolate alpha
- lSlope := (lNodeRA.nodes[lI+1].rgba.rgbreserved-lNodeRA.nodes[lI].rgba.rgbreserved)/lSpace;
- for lS := 1 to lSpace do
- lCLUT[lNodeRA.nodes[lI].Intensity+lS].rgbreserved :=lNodeRA.nodes[lI].rgba.rgbreserved + round(lS * lSlope);
- end;
-
- //need to check this works with overlays...
- //TColor2RGBA(GLForm1.GLSceneViewer1.Buffer.BackgroundColor,Q);
- //Q.rgbReserved := 0;
- //for lI := 0 to 255 do
- // if lCLUT[lI].rgbReserved = 0 then
- // lCLUT[lI] := Q;
-end;
-
-(*procedure GenerateLUT(lNodeRA: TCLUTnodeRA; lNodes: integer; var lCLUT: TCLUT);
-var
- lSlope: single;
- lSpace,lI,lIprev,lS: integer;
- lMin,lMax: TCLUTnode;
-begin
- for lI := 0 to 255 do begin
- lCLUT[lI] := RGBA(lI,lI,0,128);
- end;
-end; *)
-
-(*procedure LinearMinMaxCLUT(lMin,lMax: TGLRGBQuad; var lCLUT: TLUT);
-//creates linear RGBA values from minimum to maximum
-var
- lNodeRA: TCLUTrec;
-begin
- lNodeRA.nodes[0].intensity := 0;
- lNodeRA.nodes[0].rgba := lMin;
- lNodeRA.nodes[1].intensity := 255;
- lNodeRA.nodes[1].rgba := lMax;
- lNodeRA.numnodes := 2;
- GenerateLUT(lNodeRA,lCLUT);
-end;*)
-
-(*procedure AutoContrast (var lCLUTrec: TCLUTrec);
-begin
- lCLUTrec.nodes[0] := node(0,0,0,0,0);
- {$IFDEF ENABLERAYCAST}
- lCLUTrec.nodes[1] := node(255,255,255,255,168);
- {$ELSE}
- lCLUTrec.nodes[1] := node(255,255,255,255,100);
- {$ENDIF}
- lCLUTrec.numnodes := 2;
- lCLUTrec.min := 0;
- lCLUTrec.max := 0;
- //RangeRec(gTexture3D.MinThreshScaled,gTexture3D.MaxThreshScaled);
-end; *)
-
-procedure AutoContrast (var lCLUTrec: TCLUTrec);
-begin
- lCLUTrec.nodes[0] := node(0,0,0,0,0);
- lCLUTrec.nodes[1] := node(128,128,128,128,84);
- lCLUTrec.nodes[2] := node(255,255,255,255,168);
- lCLUTrec.numnodes := 3;
- lCLUTrec.min := 0;
- lCLUTrec.max := 0;
- //RangeRec(gTexture3D.MinThreshScaled,gTexture3D.MaxThreshScaled);
-end;
-
-procedure CLUT2TLUT(lFilename: string; var lLUT: TLUT; var lCLUTrec: TCLUTrec);
-begin
- if not CLUT2disk(true, lFilename,lCLUTrec) then
- exit;
- GenerateLUT(lCLUTrec, lLUT);
-end;
-
-
-initialization
-AutoContrast(gCLUTrec);
-end.
-
diff --git a/backup/mainunit.lfm b/backup/mainunit.lfm
deleted file mode 100755
index 2b76d83..0000000
--- a/backup/mainunit.lfm
+++ /dev/null
@@ -1,2113 +0,0 @@
-object GLForm1: TGLForm1
- Left = 312
- Height = 1512
- Top = 64
- Width = 1936
- ActiveControl = ToolPanel
- AllowDropFiles = True
- Caption = 'MRIcroGL'
- ClientHeight = 1465
- ClientWidth = 1936
- DesignTimePPI = 192
- KeyPreview = True
- Menu = MainMenu1
- OnChangeBounds = FormChangeBounds
- OnClose = FormClose
- OnCreate = FormCreate
- OnDestroy = FormDestroy
- OnDropFiles = FormDropFiles
- OnKeyDown = FormKeyDown
- OnShow = FormShow
- Position = poScreenCenter
- LCLVersion = '2.1.0.0'
- object ToolPanel: TPanel
- Left = 0
- Height = 1465
- Top = 0
- Width = 432
- Align = alLeft
- BevelOuter = bvNone
- ClientHeight = 1465
- ClientWidth = 432
- ParentFont = False
- TabOrder = 0
- OnClick = ToolPanelClick
- object ClipBox: TGroupBox
- Left = 0
- Height = 184
- Top = 248
- Width = 432
- Align = alTop
- Caption = 'Clipping'
- ClientHeight = 144
- ClientWidth = 430
- ParentFont = False
- TabOrder = 4
- object Label4: TLabel
- Left = 6
- Height = 39
- Top = 4
- Width = 87
- Caption = 'Depth'
- ParentColor = False
- ParentFont = False
- OnClick = Label4Click
- end
- object Label5: TLabel
- Left = 6
- Height = 39
- Top = 48
- Width = 117
- Caption = 'Azimuth'
- ParentColor = False
- ParentFont = False
- OnClick = Label5Click
- end
- object Label6: TLabel
- Left = 6
- Height = 39
- Top = 92
- Width = 134
- Caption = 'Elevation'
- ParentColor = False
- ParentFont = False
- OnClick = Label6Click
- end
- object ClipTrack: TTrackBar
- Left = 172
- Height = 60
- Top = 0
- Width = 232
- Max = 1000
- OnChange = ClipTrackChange
- Position = 0
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 0
- end
- object AziTrack1: TTrackBar
- Left = 172
- Height = 60
- Top = 44
- Width = 232
- Max = 360
- OnChange = ClipTrackChange
- Position = 180
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 1
- end
- object ElevTrack1: TTrackBar
- Left = 172
- Height = 60
- Top = 90
- Width = 232
- Max = 180
- Min = -180
- OnChange = ClipTrackChange
- Position = 0
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 2
- end
- end
- object ShaderBox: TGroupBox
- Left = 0
- Height = 1
- Top = 1465
- Width = 432
- Align = alClient
- Caption = 'Shader'
- ClientHeight = 1
- ClientWidth = 430
- ParentFont = False
- TabOrder = 9
- OnResize = ShaderBoxResize
- object ShaderMemo: TMemo
- Left = 0
- Height = 33
- Top = 1
- Width = 430
- Align = alClient
- Lines.Strings = (
- 'Memo1'
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- )
- ParentFont = False
- TabOrder = 1
- TabStop = False
- end
- object ShaderPanel: TPanel
- Left = 0
- Height = 240
- Top = 0
- Width = 430
- Align = alTop
- BevelOuter = bvNone
- ClientHeight = 240
- ClientWidth = 430
- ParentFont = False
- TabOrder = 0
- object ShaderDrop: TComboBox
- Left = 4
- Height = 55
- Top = 0
- Width = 220
- DropDownCount = 24
- ItemHeight = 0
- OnChange = ShaderDropChange
- ParentFont = False
- Style = csDropDownList
- TabOrder = 0
- end
- object Label1: TLabel
- Left = 234
- Height = 39
- Hint = 'Lower quality renders faster, higher quality looks better'
- Top = 18
- Width = 22
- Caption = 'Q'
- ParentColor = False
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- end
- object QualityTrack: TTrackBar
- Left = 264
- Height = 60
- Top = 0
- Width = 132
- Min = 1
- OnChange = QualityTrackChange
- Position = 3
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 1
- end
- object Label2: TLabel
- Left = 6
- Height = 39
- Hint = 'Set the elevation and azimuth of the illumination'
- Top = 70
- Width = 72
- Caption = 'Light'
- ParentColor = False
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- end
- object LightElevTrack: TTrackBar
- Left = 92
- Height = 60
- Top = 60
- Width = 132
- Max = 90
- Min = -90
- OnChange = AziElevChange
- Position = 5
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 2
- end
- object LightAziTrack: TTrackBar
- Left = 264
- Height = 60
- Top = 60
- Width = 132
- Max = 180
- Min = -180
- OnChange = AziElevChange
- Position = 0
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 3
- end
- object S1Label: TLabel
- Tag = 1
- Left = 8
- Height = 39
- Top = 124
- Width = 30
- Caption = 'S1'
- ParentColor = False
- ParentFont = False
- ParentShowHint = False
- end
- object S2Label: TLabel
- Tag = 2
- Left = 8
- Height = 39
- Top = 184
- Width = 33
- Caption = 'S2'
- ParentColor = False
- ParentFont = False
- ParentShowHint = False
- end
- object S3Label: TLabel
- Tag = 3
- Left = 8
- Height = 39
- Top = 244
- Width = 33
- Caption = 'S3'
- ParentColor = False
- ParentFont = False
- ParentShowHint = False
- end
- object S4Label: TLabel
- Tag = 4
- Left = 8
- Height = 39
- Top = 304
- Width = 34
- Caption = 'S4'
- ParentColor = False
- ParentFont = False
- ParentShowHint = False
- end
- object S5Label: TLabel
- Tag = 5
- Left = 8
- Height = 39
- Top = 364
- Width = 33
- Caption = 'S5'
- ParentColor = False
- ParentFont = False
- ParentShowHint = False
- end
- object S6Label: TLabel
- Tag = 6
- Left = 8
- Height = 39
- Top = 424
- Width = 34
- Caption = 'S6'
- ParentColor = False
- ParentFont = False
- ParentShowHint = False
- end
- object S7Label: TLabel
- Tag = 7
- Left = 8
- Height = 39
- Top = 484
- Width = 30
- Caption = 'S7'
- ParentColor = False
- ParentFont = False
- ParentShowHint = False
- end
- object S8Label: TLabel
- Tag = 8
- Left = 8
- Height = 39
- Top = 544
- Width = 35
- Caption = 'S8'
- ParentColor = False
- ParentFont = False
- ParentShowHint = False
- end
- object S9Label: TLabel
- Tag = 9
- Left = 8
- Height = 39
- Top = 604
- Width = 33
- Caption = 'S9'
- ParentColor = False
- ParentFont = False
- ParentShowHint = False
- end
- object S10Label: TLabel
- Tag = 10
- Left = 8
- Height = 39
- Top = 664
- Width = 48
- Caption = 'S10'
- ParentColor = False
- ParentFont = False
- ParentShowHint = False
- end
- object S1Track: TTrackBar
- Tag = 1
- Left = 264
- Height = 60
- Top = 120
- Width = 132
- Max = 100
- OnChange = UniformChange
- Position = 50
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 4
- end
- object S2Track: TTrackBar
- Tag = 2
- Left = 264
- Height = 60
- Top = 180
- Width = 132
- Max = 100
- OnChange = UniformChange
- Position = 50
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 5
- end
- object S3Track: TTrackBar
- Tag = 3
- Left = 264
- Height = 60
- Top = 240
- Width = 132
- Max = 100
- OnChange = UniformChange
- Position = 50
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 6
- end
- object S4Track: TTrackBar
- Tag = 4
- Left = 264
- Height = 60
- Top = 300
- Width = 132
- Max = 100
- OnChange = UniformChange
- Position = 50
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 7
- end
- object S5Track: TTrackBar
- Tag = 5
- Left = 264
- Height = 60
- Top = 360
- Width = 132
- Max = 100
- OnChange = UniformChange
- Position = 50
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 8
- end
- object S6Track: TTrackBar
- Tag = 6
- Left = 264
- Height = 60
- Top = 420
- Width = 132
- Max = 100
- OnChange = UniformChange
- Position = 50
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 9
- end
- object S7Track: TTrackBar
- Tag = 7
- Left = 264
- Height = 60
- Top = 480
- Width = 132
- Max = 100
- OnChange = UniformChange
- Position = 50
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 10
- end
- object S8Track: TTrackBar
- Tag = 8
- Left = 264
- Height = 60
- Top = 540
- Width = 132
- Max = 100
- OnChange = UniformChange
- Position = 50
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 11
- end
- object S9Track: TTrackBar
- Tag = 9
- Left = 264
- Height = 60
- Top = 600
- Width = 132
- Max = 100
- OnChange = UniformChange
- Position = 50
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 12
- end
- object S10Track: TTrackBar
- Tag = 10
- Left = 264
- Height = 60
- Top = 660
- Width = 132
- Max = 100
- OnChange = UniformChange
- Position = 50
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 13
- end
- object S1Check: TCheckBox
- Tag = 1
- Left = 282
- Height = 23
- Hint = 'If checked, edge color varies'
- Top = 124
- Width = 23
- Checked = True
- OnChange = UniformChange
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- State = cbChecked
- TabOrder = 14
- end
- object S2Check: TCheckBox
- Tag = 2
- Left = 282
- Height = 23
- Hint = 'If checked, edge color varies'
- Top = 184
- Width = 23
- Checked = True
- OnChange = UniformChange
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- State = cbChecked
- TabOrder = 15
- end
- object S3Check: TCheckBox
- Tag = 3
- Left = 282
- Height = 23
- Hint = 'If checked, edge color varies'
- Top = 244
- Width = 23
- Checked = True
- OnChange = UniformChange
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- State = cbChecked
- TabOrder = 16
- end
- object S4Check: TCheckBox
- Tag = 4
- Left = 282
- Height = 23
- Hint = 'If checked, edge color varies'
- Top = 304
- Width = 23
- Checked = True
- OnChange = UniformChange
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- State = cbChecked
- TabOrder = 17
- end
- object S5Check: TCheckBox
- Tag = 5
- Left = 282
- Height = 23
- Hint = 'If checked, edge color varies'
- Top = 364
- Width = 23
- Checked = True
- OnChange = UniformChange
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- State = cbChecked
- TabOrder = 18
- end
- object S6Check: TCheckBox
- Tag = 6
- Left = 282
- Height = 23
- Hint = 'If checked, edge color varies'
- Top = 424
- Width = 23
- Checked = True
- OnChange = UniformChange
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- State = cbChecked
- TabOrder = 19
- end
- object S7Check: TCheckBox
- Tag = 7
- Left = 282
- Height = 23
- Hint = 'If checked, edge color varies'
- Top = 484
- Width = 23
- Checked = True
- OnChange = UniformChange
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- State = cbChecked
- TabOrder = 20
- end
- object S8Check: TCheckBox
- Tag = 8
- Left = 282
- Height = 23
- Hint = 'If checked, edge color varies'
- Top = 544
- Width = 23
- Checked = True
- OnChange = UniformChange
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- State = cbChecked
- TabOrder = 21
- end
- object S9Check: TCheckBox
- Tag = 9
- Left = 282
- Height = 23
- Hint = 'If checked, edge color varies'
- Top = 604
- Width = 23
- Checked = True
- OnChange = UniformChange
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- State = cbChecked
- TabOrder = 22
- end
- object S10Check: TCheckBox
- Tag = 10
- Left = 282
- Height = 23
- Hint = 'If checked, edge color varies'
- Top = 664
- Width = 23
- Checked = True
- OnChange = UniformChange
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- State = cbChecked
- TabOrder = 23
- end
- end
- end
- object IntensityBox: TGroupBox
- Tag = 270
- Left = 0
- Height = 100
- Top = 0
- Width = 432
- Align = alTop
- Caption = 'Intensity Range'
- ClientHeight = 60
- ClientWidth = 430
- ParentFont = False
- TabOrder = 2
- object MinEdit: TEdit
- Left = 6
- Height = 44
- Hint = 'Adjust image brightness and contrast'
- Top = 2
- Width = 180
- AutoSize = False
- OnKeyPress = MinMaxEditKeyPress
- OnKeyUp = MinMaxEditKeyUp
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- TabOrder = 0
- Text = 'MinEdit'
- end
- object MaxEdit: TEdit
- Left = 208
- Height = 44
- Top = 2
- Width = 180
- AutoSize = False
- OnExit = MinMaxEditExit
- OnKeyPress = MinMaxEditKeyPress
- OnKeyUp = MinMaxEditKeyUp
- ParentFont = False
- TabOrder = 1
- Text = 'MaxEdit'
- end
- end
- object CutoutBox: TGroupBox
- Left = 0
- Height = 184
- Top = 950
- Width = 432
- Align = alTop
- Caption = 'Cutout'
- ClientHeight = 144
- ClientWidth = 430
- ParentFont = False
- TabOrder = 5
- object Xx: TLabel
- Left = 6
- Height = 39
- Top = 6
- Width = 17
- Caption = 'X'
- ParentColor = False
- ParentFont = False
- end
- object Yy: TLabel
- Left = 6
- Height = 39
- Top = 50
- Width = 17
- Caption = 'Y'
- ParentColor = False
- ParentFont = False
- end
- object Zz: TLabel
- Left = 6
- Height = 39
- Top = 94
- Width = 17
- Caption = 'Z'
- ParentColor = False
- ParentFont = False
- end
- object XTrackBar: TTrackBar
- Left = 28
- Height = 60
- Top = 0
- Width = 132
- Max = 1000
- OnChange = CutoutChange
- Position = 1000
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 0
- end
- object X2TrackBar: TTrackBar
- Left = 168
- Height = 60
- Top = 0
- Width = 132
- Max = 1000
- OnChange = CutoutChange
- Position = 1000
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 1
- end
- object YTrackBar: TTrackBar
- Left = 28
- Height = 60
- Top = 44
- Width = 132
- Max = 1000
- OnChange = CutoutChange
- Position = 1000
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 2
- end
- object Y2TrackBar: TTrackBar
- Left = 168
- Height = 60
- Top = 44
- Width = 132
- Max = 1000
- OnChange = CutoutChange
- Position = 1000
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 3
- end
- object ZTrackBar: TTrackBar
- Left = 28
- Height = 60
- Top = 90
- Width = 132
- Max = 1000
- OnChange = CutoutChange
- Position = 1000
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 4
- end
- object Z2TrackBar: TTrackBar
- Left = 168
- Height = 60
- Top = 90
- Width = 132
- Max = 1000
- OnChange = CutoutChange
- Position = 1000
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 5
- end
- object NearBtn: TButton
- Left = 300
- Height = 44
- Top = 18
- Width = 104
- Caption = 'Near'
- OnClick = CutoutNearestSector
- ParentFont = False
- TabOrder = 6
- end
- object NoneBtn: TButton
- Left = 300
- Height = 44
- Top = 72
- Width = 104
- Caption = 'None'
- OnClick = HideBtnClick
- ParentFont = False
- TabOrder = 7
- end
- end
- object CollapseToolPanelBtn: TButton
- Left = 398
- Height = 24
- Hint = 'Click here to hide the tool panel'
- Top = 2
- Width = 24
- OnClick = CollapsedToolPanelClick
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- TabOrder = 1
- end
- object MosaicBox: TGroupBox
- Left = 0
- Height = 518
- Top = 432
- Width = 432
- Align = alTop
- Caption = 'Mosaic'
- ClientHeight = 478
- ClientWidth = 430
- ParentFont = False
- TabOrder = 6
- Visible = False
- object MosaicText: TMemo
- Left = 0
- Height = 246
- Top = 232
- Width = 430
- Align = alClient
- Lines.Strings = (
- 'MosaicText'
- )
- OnChange = MosaicTextChange
- ParentFont = False
- TabOrder = 1
- end
- object MosaicPanel: TPanel
- Left = 0
- Height = 232
- Top = 0
- Width = 430
- Align = alTop
- BevelOuter = bvNone
- ClientHeight = 232
- ClientWidth = 430
- ParentFont = False
- TabOrder = 0
- object ColOverlap: TTrackBar
- Left = 252
- Height = 60
- Top = 0
- Width = 132
- Max = 9
- Min = -9
- OnChange = UpdateMosaic
- Position = -1
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 1
- end
- object ColEdit: TSpinEdit
- Left = 128
- Height = 56
- Top = 4
- Width = 108
- MaxValue = 20
- MinValue = 1
- OnChange = UpdateMosaic
- ParentFont = False
- TabOrder = 0
- Value = 3
- end
- object Label7: TLabel
- Left = 6
- Height = 39
- Top = 4
- Width = 125
- Caption = 'Columns'
- ParentColor = False
- ParentFont = False
- end
- object Label3: TLabel
- Left = 6
- Height = 39
- Top = 52
- Width = 76
- Caption = 'Rows'
- ParentColor = False
- ParentFont = False
- end
- object RowEdit: TSpinEdit
- Left = 128
- Height = 56
- Top = 52
- Width = 108
- MaxValue = 20
- MinValue = 1
- OnChange = UpdateMosaic
- ParentFont = False
- TabOrder = 2
- Value = 2
- end
- object RowOverlap: TTrackBar
- Left = 252
- Height = 60
- Top = 52
- Width = 132
- Max = 9
- Min = -9
- OnChange = UpdateMosaic
- Position = 0
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 3
- end
- object OrientDrop: TComboBox
- Left = 208
- Height = 51
- Top = 96
- Width = 186
- ItemHeight = 0
- ItemIndex = 0
- Items.Strings = (
- 'Axial'
- 'Coronal'
- 'Sagittal+'
- 'Sagittal-'
- )
- OnChange = UpdateMosaic
- ParentFont = False
- Style = csDropDownList
- TabOrder = 4
- Text = 'Axial'
- end
- object Label8: TLabel
- Left = 6
- Height = 39
- Top = 100
- Width = 165
- Caption = 'Orientation'
- ParentColor = False
- ParentFont = False
- end
- object CrossCheck: TCheckBox
- Left = 6
- Height = 43
- Top = 140
- Width = 176
- Caption = 'Cross slice'
- Checked = True
- OnChange = UpdateMosaic
- ParentFont = False
- State = cbChecked
- TabOrder = 5
- end
- object CopyScriptBtn: TButton
- Left = 12
- Height = 44
- Top = 180
- Width = 184
- Caption = 'Copy Script'
- OnClick = CopyScriptClick
- ParentFont = False
- TabOrder = 7
- end
- object RunScriptBtn: TButton
- Left = 220
- Height = 44
- Top = 180
- Width = 184
- Caption = 'Run Script'
- OnClick = RunScriptClick
- ParentFont = False
- TabOrder = 8
- Visible = False
- end
- object LabelCheck: TCheckBox
- Left = 208
- Height = 43
- Top = 140
- Width = 192
- Caption = 'Label slices'
- Checked = True
- OnChange = UpdateMosaic
- ParentFont = False
- State = cbChecked
- TabOrder = 6
- end
- end
- end
- object OverlayBox: TGroupBox
- Left = 0
- Height = 148
- Top = 100
- Width = 432
- Align = alTop
- Caption = 'Overlays'
- ClientHeight = 108
- ClientWidth = 430
- ParentFont = False
- TabOrder = 3
- Visible = False
- object StringGrid1: TStringGrid
- Left = 0
- Height = 108
- Top = 0
- Width = 430
- Align = alClient
- AutoEdit = False
- BorderStyle = bsNone
- ColCount = 4
- DefaultColWidth = 100
- DefaultRowHeight = 46
- Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goDrawFocusSelected, goEditing, goTabs, goAlwaysShowEditor, goSmoothScroll]
- ParentFont = False
- ParentShowHint = False
- RowCount = 33
- ScrollBars = ssNone
- ShowHint = True
- TabOrder = 0
- OnDrawCell = StringGrid1DrawCell
- OnEditingDone = StringGrid1Exit
- OnExit = StringGrid1Exit
- OnKeyPress = StringGrid1KeyPress
- OnMouseDown = StringGrid1MouseDown
- OnSelectCell = StringGrid1SelectCell
- end
- object LUTdrop: TComboBox
- Left = 132
- Height = 51
- Top = 60
- Width = 110
- DropDownCount = 22
- ItemHeight = 0
- Items.Strings = (
- 'a'
- 'b'
- 'c'
- 'd'
- 'e'
- 'f'
- 'g'
- )
- OnChange = LUTdropChange
- ParentFont = False
- Style = csDropDownList
- TabOrder = 1
- end
- end
- object HideRenderToolsBtn: TButton
- Left = 368
- Height = 24
- Hint = 'Click to hide/show render tools (useful for small screens)'
- Top = 2
- Width = 24
- OnClick = HideRenderToolsBtnClick
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- TabOrder = 0
- end
- object LineBox: TGroupBox
- Left = 0
- Height = 100
- Top = 1398
- Width = 432
- Align = alTop
- Caption = 'Lines'
- ClientHeight = 60
- ClientWidth = 430
- ParentFont = False
- TabOrder = 8
- object LineWidthLabel: TLabel
- Left = 6
- Height = 39
- Top = 4
- Width = 84
- Caption = 'Width'
- ParentColor = False
- ParentFont = False
- end
- object LineColorBtn: TButton
- Left = 248
- Height = 44
- Top = 4
- Width = 156
- Caption = 'Color'
- OnClick = LineColorBtnClick
- ParentFont = False
- TabOrder = 1
- end
- object LineWidthEdit: TSpinEdit
- Left = 96
- Height = 56
- Top = 4
- Width = 140
- MaxValue = 7
- OnChange = LineWidthEditChange
- ParentFont = False
- TabOrder = 0
- Value = 3
- end
- end
- object Slice2DBox: TGroupBox
- Left = 0
- Height = 264
- Top = 1134
- Width = 432
- Align = alTop
- Caption = '2D Slice Selection'
- ClientHeight = 224
- ClientWidth = 430
- ParentFont = False
- TabOrder = 7
- object LeftBtn: TButton
- Left = 8
- Height = 40
- Top = 36
- Width = 80
- Caption = 'L'
- OnClick = OrientBtnClick
- ParentFont = False
- TabOrder = 0
- end
- object SuperiorBtn: TButton
- Tag = 5
- Left = 296
- Height = 40
- Top = 4
- Width = 80
- Caption = 'S'
- OnClick = OrientBtnClick
- ParentFont = False
- TabOrder = 4
- end
- object InferiorBtn: TButton
- Tag = 4
- Left = 296
- Height = 40
- Top = 68
- Width = 80
- Caption = 'I'
- OnClick = OrientBtnClick
- ParentFont = False
- TabOrder = 5
- end
- object AnteriorBtn: TButton
- Tag = 3
- Left = 96
- Height = 40
- Top = 4
- Width = 80
- Caption = 'A'
- OnClick = OrientBtnClick
- ParentFont = False
- TabOrder = 1
- end
- object PosteriorBtn: TButton
- Tag = 2
- Left = 96
- Height = 40
- Top = 68
- Width = 80
- Caption = 'P'
- OnClick = OrientBtnClick
- ParentFont = False
- TabOrder = 2
- end
- object RightBtn: TButton
- Tag = 1
- Left = 184
- Height = 40
- Top = 32
- Width = 80
- Caption = 'R'
- OnClick = OrientBtnClick
- ParentFont = False
- TabOrder = 3
- end
- object CoordLabel: TLabel
- Left = 6
- Height = 39
- Top = 116
- Width = 261
- Caption = 'Coordinates (X,Y,Z)'
- ParentColor = False
- ParentFont = False
- end
- object XCoordEdit: TEdit
- Left = 4
- Height = 44
- Top = 160
- Width = 132
- AutoSize = False
- OnChange = CoordEditChange
- OnKeyPress = MinMaxEditKeyPress
- OnKeyUp = MinMaxEditKeyUp
- ParentFont = False
- TabOrder = 6
- Text = '0'
- end
- object YCoordEdit: TEdit
- Left = 140
- Height = 44
- Top = 160
- Width = 132
- AutoSize = False
- OnChange = CoordEditChange
- OnKeyPress = MinMaxEditKeyPress
- OnKeyUp = MinMaxEditKeyUp
- ParentFont = False
- TabOrder = 7
- Text = '0'
- end
- object ZCoordEdit: TEdit
- Left = 276
- Height = 44
- Top = 160
- Width = 132
- AutoSize = False
- OnChange = CoordEditChange
- OnKeyPress = MinMaxEditKeyPress
- OnKeyUp = MinMaxEditKeyUp
- ParentFont = False
- TabOrder = 8
- Text = '0'
- end
- end
- end
- object CollapsedToolPanel: TPanel
- Left = 432
- Height = 1465
- Top = 0
- Width = 10
- Align = alLeft
- ParentFont = False
- TabOrder = 1
- Visible = False
- OnClick = CollapsedToolPanelClick
- end
- object MainMenu1: TMainMenu
- left = 640
- top = 1072
- object AppleMenu: TMenuItem
- Caption = ''
- object AppleAbout: TMenuItem
- Caption = 'About MRIcroGL'
- OnClick = About1Click
- end
- object ApplePreferences: TMenuItem
- Caption = 'Preferences'
- OnClick = Preferences1Click
- end
- end
- object File1: TMenuItem
- Caption = 'File'
- object NewWindow1: TMenuItem
- Caption = 'New window'
- OnClick = NewWindow1Click
- end
- object Open1: TMenuItem
- Caption = 'Open'
- ShortCut = 16463
- OnClick = Open1Click
- end
- object Save1: TMenuItem
- Caption = 'Save'
- OnClick = Save1Click
- end
- object Exit1: TMenuItem
- Caption = 'Exit'
- ShortCut = 16472
- OnClick = Exit1Click
- end
- object MenuSep1: TMenuItem
- Caption = '-'
- end
- object MRU1: TMenuItem
- Caption = 'MRU1'
- end
- object MRU2: TMenuItem
- Caption = 'MRU2'
- end
- object MRU3: TMenuItem
- Caption = 'MRU3'
- end
- object MRU4: TMenuItem
- Caption = 'MRU4'
- end
- object MRU5: TMenuItem
- Caption = 'MRU5'
- end
- object MRU6: TMenuItem
- Caption = 'MRU6'
- end
- object MRU7: TMenuItem
- Caption = 'MRU7'
- end
- object MRU8: TMenuItem
- Caption = 'MRU8'
- end
- object MRU9: TMenuItem
- Caption = 'MRU9'
- end
- object MRU10: TMenuItem
- Caption = 'MRU10'
- end
- end
- object Edit1: TMenuItem
- Caption = 'Edit'
- object Copy1: TMenuItem
- Caption = 'Copy'
- ShortCut = 16451
- OnClick = Copy1Click
- end
- end
- object Overlays1: TMenuItem
- Caption = 'Overlays'
- object Addoverlay1: TMenuItem
- Caption = 'Add overlay'
- OnClick = Addoverlay1Click
- end
- object Thresholdmenu: TMenuItem
- Caption = 'Add overlay (remove small clusters)'
- OnClick = ThresholdMenuClick
- end
- object Closeoverlays1: TMenuItem
- Caption = 'Close overlays'
- OnClick = Closeoverlays1Click
- end
- object Onbackground1: TMenuItem
- Caption = 'Transparency on background'
- object N0Opaque1: TMenuItem
- AutoCheck = True
- Caption = '0% Opaque'
- GroupIndex = 123
- RadioItem = True
- OnClick = SetBackgroundAlpha
- end
- object N201: TMenuItem
- Tag = 20
- AutoCheck = True
- Caption = '20%'
- GroupIndex = 123
- RadioItem = True
- OnClick = SetBackgroundAlpha
- end
- object N401: TMenuItem
- Tag = 40
- AutoCheck = True
- Caption = '40%'
- GroupIndex = 123
- RadioItem = True
- OnClick = SetBackgroundAlpha
- end
- object N501: TMenuItem
- Tag = 50
- AutoCheck = True
- Caption = '50%'
- GroupIndex = 123
- RadioItem = True
- OnClick = SetBackgroundAlpha
- end
- object N601: TMenuItem
- Tag = 60
- AutoCheck = True
- Caption = '60%'
- GroupIndex = 123
- RadioItem = True
- OnClick = SetBackgroundAlpha
- end
- object N801: TMenuItem
- Tag = 80
- AutoCheck = True
- Caption = '80%'
- GroupIndex = 123
- RadioItem = True
- OnClick = SetBackgroundAlpha
- end
- object N100transparent1: TMenuItem
- Tag = 100
- AutoCheck = True
- Caption = '100% transparent'
- GroupIndex = 123
- RadioItem = True
- OnClick = SetBackgroundAlpha
- end
- object Additive1: TMenuItem
- Tag = -1
- AutoCheck = True
- Caption = 'Additive'
- GroupIndex = 123
- RadioItem = True
- OnClick = SetBackgroundAlpha
- end
- object ModulateMenu: TMenuItem
- Tag = -2
- AutoCheck = True
- Caption = 'Modulate'
- GroupIndex = 123
- RadioItem = True
- OnClick = SetBackgroundAlpha
- end
- end
- object Onotheroverlays1: TMenuItem
- Caption = 'Transparency on other overlays'
- object N0opaque2: TMenuItem
- AutoCheck = True
- Caption = '0% opaque'
- GroupIndex = 133
- RadioItem = True
- OnClick = SetOverlayAlpha
- end
- object N202: TMenuItem
- Tag = 20
- AutoCheck = True
- Caption = '20%'
- GroupIndex = 133
- RadioItem = True
- OnClick = SetOverlayAlpha
- end
- object N402: TMenuItem
- Tag = 40
- AutoCheck = True
- Caption = '40%'
- GroupIndex = 133
- RadioItem = True
- OnClick = SetOverlayAlpha
- end
- object N502: TMenuItem
- Tag = 50
- AutoCheck = True
- Caption = '50%'
- GroupIndex = 133
- RadioItem = True
- OnClick = SetOverlayAlpha
- end
- object N602: TMenuItem
- Tag = 60
- AutoCheck = True
- Caption = '60%'
- GroupIndex = 133
- RadioItem = True
- OnClick = SetOverlayAlpha
- end
- object N802: TMenuItem
- Tag = 80
- AutoCheck = True
- Caption = '80%'
- GroupIndex = 133
- RadioItem = True
- OnClick = SetOverlayAlpha
- end
- object N100transparent2: TMenuItem
- Tag = 100
- AutoCheck = True
- Caption = '100% transparent'
- GroupIndex = 133
- RadioItem = True
- OnClick = SetOverlayAlpha
- end
- object Additive2: TMenuItem
- Tag = -1
- AutoCheck = True
- Caption = 'Additive'
- GroupIndex = 133
- RadioItem = True
- OnClick = SetOverlayAlpha
- end
- end
- object InterpolateMenu: TMenuItem
- AutoCheck = True
- Caption = 'Smooth when loading'
- Checked = True
- OnClick = InterpolateMenuClick
- end
- object BackgroundMaskMenu: TMenuItem
- AutoCheck = True
- Caption = 'Background masks overlays'
- Checked = True
- OnClick = BackgroundMaskMenuClick
- end
- object OverlayColorFromZeroMenu: TMenuItem
- AutoCheck = True
- Caption = 'Overlay color from zero'
- OnClick = OverlayColorFromZeroMenuClick
- end
- object OverlayHideZerosMenu: TMenuItem
- AutoCheck = True
- Caption = 'Overlay hide zeros'
- OnClick = OverlayColorFromZeroMenuClick
- end
- end
- object Import1: TMenuItem
- Caption = 'Import'
- object ConvertDicom1: TMenuItem
- Caption = 'Convert DICOM to NIfTI'
- OnClick = ConvertDicom1Click
- end
- object ConvertForeign1: TMenuItem
- Caption = 'Convert foreign to NIfTI'
- Hint = 'Convert MGH, LSM, NRRD, PIC, TIFF'
- OnClick = ConvertForeign1Click
- end
- object ReorientMenu: TMenuItem
- Caption = 'Rotate volume'
- Hint = 'Reorient image to standard space'
- OnClick = ReorientMenuClick
- end
- end
- object Draw1: TMenuItem
- Caption = 'Draw'
- object OpenVOI1: TMenuItem
- Caption = 'Open VOI'
- OnClick = OpenVOI1Click
- end
- object SaveVOI1: TMenuItem
- Caption = 'Save VOI'
- OnClick = SaveVOI1Click
- end
- object CloseVOI1: TMenuItem
- Caption = 'Close VOI'
- OnClick = CloseVOI1Click
- end
- object UndoVOI1: TMenuItem
- Caption = 'Undo'
- ShortCut = 16474
- OnClick = UndoVOI1Click
- end
- object Transparency1: TMenuItem
- Caption = 'Transparency'
- object HideVOI1: TMenuItem
- AutoCheck = True
- Caption = 'Hide/Unhide'
- ShortCut = 16456
- OnClick = TransparencyVOIClick
- end
- object TransparencyVOIhi: TMenuItem
- Tag = 64
- AutoCheck = True
- Caption = '25%'
- GroupIndex = 121
- RadioItem = True
- OnClick = TransparencyVOIClick
- end
- object TransparencyVOImid: TMenuItem
- Tag = 128
- AutoCheck = True
- Caption = '50%'
- Checked = True
- GroupIndex = 121
- RadioItem = True
- OnClick = TransparencyVOIClick
- end
- object TransparencyVOIlo: TMenuItem
- Tag = 230
- AutoCheck = True
- Caption = '90%'
- GroupIndex = 121
- RadioItem = True
- OnClick = TransparencyVOIClick
- end
- end
- object DrawTool1: TMenuItem
- Caption = 'Draw color'
- object NoDraw1: TMenuItem
- Tag = -1
- AutoCheck = True
- Caption = 'None (disable: draw mode off)'
- Checked = True
- GroupIndex = 189
- RadioItem = True
- ShortCut = 16452
- OnClick = DrawTool1Click
- end
- object Eraser1: TMenuItem
- AutoCheck = True
- Caption = 'Erase'
- GroupIndex = 189
- RadioItem = True
- ShortCut = 16453
- OnClick = DrawTool1Click
- end
- end
- object Advanced1: TMenuItem
- Caption = 'Advanced'
- object OverwriteDrawColor1: TMenuItem
- AutoCheck = True
- Caption = 'Overwrite draw colors'
- Checked = True
- end
- object PasteSlice1: TMenuItem
- Caption = 'Clone slice'
- ShortCut = 16470
- OnClick = PasteSlice1Click
- end
- object CustomDrawColors1: TMenuItem
- Caption = 'Custom draw colors'
- OnClick = CustomDrawColors1Click
- end
- object Smooth1: TMenuItem
- Caption = 'Smooth and refine drawing'
- OnClick = Smooth1Click
- end
- object AutoRoi1: TMenuItem
- Caption = 'Automatic VOI'
- OnClick = AutoRoi1Click
- end
- object voiBinarize1: TMenuItem
- Caption = 'Binarize (make entire drawing red)'
- Hint = 'Make entire drawing red'
- OnClick = voiBinarize1Click
- end
- object InterpolateDrawMenu: TMenuItem
- Caption = 'Interpolate between slices'
- object InterpolateRecentMenu: TMenuItem
- Caption = 'Last two slices'
- ShortCut = 16472
- OnClick = InterpolateDrawMenuClick
- end
- object InterpolateAxialMenu: TMenuItem
- Tag = 1
- Caption = 'All axial gaps'
- OnClick = InterpolateDrawMenuClick
- end
- object InterpolateCoronalMenu: TMenuItem
- Tag = 2
- Caption = 'All coronal gaps'
- OnClick = InterpolateDrawMenuClick
- end
- object InterpolateSagittalMenu: TMenuItem
- Tag = 3
- Caption = 'All sagittal gaps'
- OnClick = InterpolateDrawMenuClick
- end
- end
- object voiDescriptives1: TMenuItem
- Caption = 'Descriptives'
- OnClick = voiDescriptives1Click
- end
- end
- end
- object Display1: TMenuItem
- Caption = 'Display'
- object Render1: TMenuItem
- AutoCheck = True
- Caption = 'Render'
- Checked = True
- GroupIndex = 212
- RadioItem = True
- ShortCut = 16466
- OnClick = SetViewClick
- end
- object Axial1: TMenuItem
- Tag = 1
- AutoCheck = True
- Caption = 'Axial'
- GroupIndex = 212
- RadioItem = True
- ShortCut = 16449
- OnClick = SetViewClick
- end
- object Coronal1: TMenuItem
- Tag = 2
- AutoCheck = True
- Caption = 'Coronal'
- GroupIndex = 212
- RadioItem = True
- OnClick = SetViewClick
- end
- object Sagittal1: TMenuItem
- Tag = 3
- AutoCheck = True
- Caption = 'Sagittal'
- GroupIndex = 212
- RadioItem = True
- ShortCut = 16467
- OnClick = SetViewClick
- end
- object MPR1: TMenuItem
- Tag = 4
- AutoCheck = True
- Caption = 'Multi planar (A+C+S)'
- GroupIndex = 212
- RadioItem = True
- ShortCut = 16461
- OnClick = SetViewClick
- end
- object Mosaic1: TMenuItem
- Tag = 5
- AutoCheck = True
- Caption = 'Mosaic'
- GroupIndex = 212
- RadioItem = True
- OnClick = Mosaic1Click
- end
- object YokeSepMenu: TMenuItem
- Caption = '-'
- Visible = False
- end
- object YokeMenu: TMenuItem
- AutoCheck = True
- Caption = 'Yoke'
- ShortCut = 16473
- Visible = False
- OnClick = YokeMenuClick
- end
- object ViewSepMenu: TMenuItem
- Caption = '-'
- end
- object LeftMenu: TMenuItem
- Caption = 'Left'
- ShortCut = 76
- OnClick = OrientMenuClick
- end
- object RightMenu: TMenuItem
- Tag = 1
- Caption = 'Right'
- ShortCut = 82
- OnClick = OrientMenuClick
- end
- object PosteriorMenu: TMenuItem
- Tag = 2
- Caption = 'Posterior'
- ShortCut = 80
- OnClick = OrientMenuClick
- end
- object AnteriorMenu: TMenuItem
- Tag = 3
- Caption = 'Anterior'
- ShortCut = 65
- OnClick = OrientMenuClick
- end
- object InferiorMenu: TMenuItem
- Tag = 4
- Caption = 'Inferior'
- ShortCut = 73
- OnClick = OrientMenuClick
- end
- object SuperiorMenu: TMenuItem
- Tag = 5
- Caption = 'Superior'
- ShortCut = 83
- OnClick = OrientMenuClick
- end
- object RadiologicalMenu: TMenuItem
- AutoCheck = True
- Caption = 'Radiological (flip LR)'
- OnClick = RadiologicalMenuClick
- end
- end
- object View1: TMenuItem
- Caption = 'View'
- object ResetDefaults1: TMenuItem
- Caption = 'Reset defaults'
- OnClick = ResetDefaults1Click
- end
- object Tool1: TMenuItem
- AutoCheck = True
- Caption = 'Tool panel'
- ShortCut = 16468
- OnClick = Tool1Click
- end
- object Orient1: TMenuItem
- AutoCheck = True
- Caption = 'Text and orientation cube'
- ShortCut = 112
- OnClick = Orient1Click
- end
- object Scripting1: TMenuItem
- Caption = 'Scripting'
- OnClick = Scripting1Click
- end
- object Extract1: TMenuItem
- Caption = 'Extract object[s]'
- OnClick = Extract1Click
- end
- object BET1: TMenuItem
- Caption = 'Extract brain'
- OnClick = BET1Click
- end
- object Sharpen1: TMenuItem
- Caption = 'Sharpen'
- OnClick = Sharpen1Click
- end
- end
- object Colors1: TMenuItem
- Caption = 'Color'
- object Scheme1: TMenuItem
- Caption = 'Scheme'
- end
- object ToggleTransparency1: TMenuItem
- AutoCheck = True
- Caption = 'Color editor'
- OnClick = ToggleTransparency1Click
- end
- object ClrbarMenu: TMenuItem
- Caption = 'Colorbar'
- object VisibleClrbarMenu: TMenuItem
- AutoCheck = True
- Caption = 'Visible'
- Checked = True
- OnClick = ClrbarMenu1Click
- end
- object ClrbarSep: TMenuItem
- Caption = '-'
- end
- object WhiteClrbarMenu: TMenuItem
- Tag = 1
- AutoCheck = True
- Caption = 'White'
- GroupIndex = 193
- RadioItem = True
- OnClick = ClrbarMenuClick
- end
- object TransWhiteClrbarMenu: TMenuItem
- Tag = 2
- Caption = 'Translucent White'
- GroupIndex = 193
- RadioItem = True
- OnClick = ClrbarMenuClick
- end
- object BlackClrbarMenu: TMenuItem
- Tag = 3
- AutoCheck = True
- Caption = 'Black'
- GroupIndex = 193
- RadioItem = True
- OnClick = ClrbarMenuClick
- end
- object TransBlackClrbarMenu: TMenuItem
- Tag = 4
- AutoCheck = True
- Caption = 'Translucent Black'
- Checked = True
- GroupIndex = 193
- RadioItem = True
- OnClick = ClrbarMenuClick
- end
- end
- object Backcolor1: TMenuItem
- Caption = 'Back color'
- OnClick = Backcolor1Click
- end
- end
- object Help1: TMenuItem
- Caption = 'Help'
- object About1: TMenuItem
- Caption = 'About'
- OnClick = About1Click
- end
- object Preferences1: TMenuItem
- Caption = 'Preferences'
- OnClick = Preferences1Click
- end
- object OnlineHelpMenu: TMenuItem
- Caption = 'Online help'
- OnClick = OnlineHelpMenuClick
- end
- end
- end
- object OpenDialog1: TOpenDialog
- FileName = '/Users/rorden/Documents/pas'
- Filter = 'NIfTI|*.nii;*.hdr;*.nii.gz|PIC|*.PIC'
- InitialDir = '/Users/rorden/Documents/'
- left = 640
- top = 32
- end
- object ColorDialog1: TColorDialog
- Color = clBlack
- CustomColors.Strings = (
- 'ColorA=000000'
- 'ColorB=000080'
- 'ColorC=008000'
- 'ColorD=008080'
- 'ColorE=800000'
- 'ColorF=800080'
- 'ColorG=808000'
- 'ColorH=808080'
- 'ColorI=C0C0C0'
- 'ColorJ=0000FF'
- 'ColorK=00FF00'
- 'ColorL=00FFFF'
- 'ColorM=FF0000'
- 'ColorN=FF00FF'
- 'ColorO=FFFF00'
- 'ColorP=FFFFFF'
- 'ColorQ=C0DCC0'
- 'ColorR=F0CAA6'
- 'ColorS=F0FBFF'
- 'ColorT=A4A0A0'
- )
- left = 864
- top = 32
- end
- object UpdateTimer: TTimer
- Enabled = False
- Interval = 150
- OnTimer = UpdateTimerTimer
- left = 640
- top = 160
- end
- object SaveDialog1: TSaveDialog
- DefaultExt = '.png'
- Filter = 'PNG lossless|*.png'
- left = 640
- top = 288
- end
- object AutoRunTimer1: TTimer
- Enabled = False
- Interval = 250
- OnTimer = AutoRunTimer1Timer
- left = 640
- top = 416
- end
- object GradientsIdleTimer: TTimer
- Enabled = False
- OnTimer = GradientsIdleTimerTimer
- left = 640
- top = 560
- end
- object SaveDialogVoi: TSaveDialog
- Title = 'Save drawing as'
- Filter = 'Volume of Interest (.voi)|.voi|FSL (.nii.gz)|.nii.gz|SPM/FSL (.nii)|.nii'
- left = 640
- top = 688
- end
- object OpenDialogVoi: TOpenDialog
- left = 640
- top = 816
- end
- object OpenDialogTxt: TOpenDialog
- Filter = 'ITK-SnAP Label Description (txt)|*.txt'
- left = 640
- top = 944
- end
- object ErrorTimer: TTimer
- Enabled = False
- Interval = 50
- OnTimer = ErrorTimerTimer
- left = 864
- top = 144
- end
- object YokeTimer: TTimer
- Enabled = False
- Interval = 200
- OnTimer = YokeTimerTimer
- left = 858
- top = 302
- end
-end
diff --git a/backup/mainunit.pas b/backup/mainunit.pas
deleted file mode 100755
index 3ecd1a2..0000000
--- a/backup/mainunit.pas
+++ /dev/null
@@ -1,6321 +0,0 @@
-unit mainunit;
-{$IFDEF FPC}{$H+}{$mode delphi} {$ENDIF}
-{$D-,O+,Q-,R-,S-}
-
-
-
-{$include opts.inc}
-interface
-//{$IFDEF FPC}
-{$DEFINE COMPILEYOKE}
-//{$ENDIF}
-
-
-{$IFDEF LCLcarbon}
- This program does not support Carbon
- Please choose Project/ProjectOptions, go to the CompilerOptions/Additions&Overrides and set the BuildMode pull-down to "MacOS"
-{$ENDIF}
-uses
-{$IFDEF Linux} uscaledpi, {$ENDIF}
-{$IFDEF COMPILEYOKE}
-yokesharemem, coordinates, nii_mat, math, nifti_tiff,
-{$ENDIF}
-{$IFDEF DGL} dglOpenGL, {$ELSE DGL} {$IFDEF COREGL}glcorearb, {$ELSE} gl,glext, {$ENDIF} {$ENDIF DGL}
-types,clipbrd,
-{$IFNDEF FPC}
- messages,ShellAPI, detectmsaa,{$IFDEF PNG}pngimage, JPEG,{$ENDIF}
-{$ENDIF}Dialogs, ExtCtrls, Menus, shaderu, texture2raycast,
- StdCtrls, Controls, ComCtrls, Reslice, glcube,glclrbar, dcm_load,
-{$IFDEF USETRANSFERTEXTURE}texture_3d_unit_transfertexture, {$ELSE} texture_3d_unit,extract,{$ENDIF}
- {$IFDEF FPC} FileUtil, GraphType, LCLProc,LCLtype, LCLIntf,LResources,OpenGLContext,{$ELSE}glpanel, {$ENDIF}
-{$IFDEF UNIX}Process, strutils, fphttpclient,
-{$ELSE}//ShellApi,
-Windows,{$IFDEF FPC}uscaledpi,{$ENDIF}{$ENDIF} glmtext,
- Graphics, Classes, SysUtils, Forms, Buttons, Spin, Grids, clut, define_types,
- histogram2d, readint, {$IFDEF COREGL} raycast_core, {$ELSE} raycast_legacy, {$ENDIF} raycast_common, histogram, nifti_hdr, shaderui,
- prefs, userdir, slices2d, autoroi, fsl_calls, drawU, dcm2nii, lut,
- extractui, scaleimageintensity;
-
- {$IFNDEF FPC}
- //WARNING DELPHI USER: YOU NEED TO COMMENT OUT THE LINE "GLBox:TOpenGLControl;"
- {$ENDIF}
-type { TGLForm1 }
-TGLForm1 = class(TForm)
- CoordLabel: TLabel;
- LeftBtn: TButton;
- AnteriorBtn: TButton;
- OnlineHelpMenu: TMenuItem;
- XCoordEdit: TEdit;
- ResetDefaults1: TMenuItem;
- PosteriorBtn: TButton;
- RightBtn: TButton;
- SuperiorBtn: TButton;
- InferiorBtn: TButton;
- LineWidthEdit: TSpinEdit;
- LineColorBtn: TButton;
- LineWidthLabel: TLabel;
- ReorientMenu: TMenuItem;
- RadiologicalMenu: TMenuItem;
- ClrbarMenu: TMenuItem;
- WhiteClrbarMenu: TMenuItem;
- TransWhiteClrbarMenu: TMenuItem;
- BlackClrbarMenu: TMenuItem;
- TransBlackClrbarMenu: TMenuItem;
- Label1: TLabel;
- Label2: TLabel;
- LightAziTrack: TTrackBar;
- LightElevTrack: TTrackBar;
- ConvertForeign1: TMenuItem;
- InterpolateRecentMenu: TMenuItem;
- InterpolateAxialMenu: TMenuItem;
- InterpolateCoronalMenu: TMenuItem;
- InterpolateSagittalMenu: TMenuItem;
- ShaderPanel: TPanel;
- QualityTrack: TTrackBar;
- S10Check: TCheckBox;
- S10Label: TLabel;
- S10Track: TTrackBar;
- S1Check: TCheckBox;
- S1Label: TLabel;
- S1Track: TTrackBar;
- S2Check: TCheckBox;
- S2Label: TLabel;
- S2Track: TTrackBar;
- S3Check: TCheckBox;
- S3Label: TLabel;
- S3Track: TTrackBar;
- S4Check: TCheckBox;
- S4Label: TLabel;
- S4Track: TTrackBar;
- S5Check: TCheckBox;
- S5Label: TLabel;
- S5Track: TTrackBar;
- S6Check: TCheckBox;
- S6Label: TLabel;
- S6Track: TTrackBar;
- S7Check: TCheckBox;
- S7Label: TLabel;
- S7Track: TTrackBar;
- S8Check: TCheckBox;
- S8Label: TLabel;
- S8Track: TTrackBar;
- S9Check: TCheckBox;
- S9Label: TLabel;
- ColEdit: TSpinEdit;
- ColOverlap: TTrackBar;
- CopyScriptBtn: TButton;
- CrossCheck: TCheckBox;
- Label3: TLabel;
- Label7: TLabel;
- Label8: TLabel;
- LabelCheck: TCheckBox;
- MosaicText: TMemo;
- OrientDrop: TComboBox;
- MosaicPanel: TPanel;
- RowEdit: TSpinEdit;
- RowOverlap: TTrackBar;
- RunScriptBtn: TButton;
- S9Track: TTrackBar;
- ShaderDrop: TComboBox;
- Slice2DBox: TGroupBox;
- LineBox: TGroupBox;
- InterpolateDrawMenu: TMenuItem;
- voiBinarize1: TMenuItem;
- NearBtn: TButton;
- LUTdrop: TComboBox;
- Addoverlay1: TMenuItem;
- InterpolateMenu: TMenuItem;
- Additive1: TMenuItem;
- NoneBtn: TButton;
- OverlayHideZerosMenu: TMenuItem;
- N100transparent2: TMenuItem;
- N802: TMenuItem;
- N602: TMenuItem;
- N502: TMenuItem;
- N402: TMenuItem;
- N202: TMenuItem;
- N0opaque2: TMenuItem;
- ModulateMenu: TMenuItem;
- N100transparent1: TMenuItem;
- N801: TMenuItem;
- N601: TMenuItem;
- N501: TMenuItem;
- N401: TMenuItem;
- N201: TMenuItem;
- N0Opaque1: TMenuItem;
- OverlayColorFromZeroMenu: TMenuItem;
- BackgroundMaskMenu: TMenuItem;
- Onbackground1: TMenuItem;
- Onotheroverlays1: TMenuItem;
- Additive2: TMenuItem;
- //Thresholdmenu: TMenuItem;
- Closeoverlays1: TMenuItem;
- Overlays1: TMenuItem;
- OverlayBox: TGroupBox;
- HideRenderToolsBtn: TButton;
- Extract1: TMenuItem;
- BET1: TMenuItem;
- MosaicBox: TGroupBox;
- Import1: TMenuItem;
- ConvertDicom1: TMenuItem;
- MRU8: TMenuItem;
- MRU10: TMenuItem;
- MRU9: TMenuItem;
- MRU7: TMenuItem;
- MRU4: TMenuItem;
- MRU6: TMenuItem;
- MRU5: TMenuItem;
- MRU3: TMenuItem;
- MRU2: TMenuItem;
- MRU1: TMenuItem;
- StringGrid1: TStringGrid;
- ToolPanel: TPanel;
- ClipBox: TGroupBox;
- Label4: TLabel;
- Label5: TLabel;
- Label6: TLabel;
- ClipTrack: TTrackBar;
- AziTrack1: TTrackBar;
- ElevTrack1: TTrackBar;
- ShaderBox: TGroupBox;
- ShaderMemo: TMemo;
- IntensityBox: TGroupBox;
- MinEdit: TEdit;
- MaxEdit: TEdit;
- CutoutBox: TGroupBox;
- YCoordEdit: TEdit;
- ZCoordEdit: TEdit;
- Xx: TLabel;
- XTrackBar: TTrackBar;
- X2TrackBar: TTrackBar;
- yY: TLabel;
- YTrackBar: TTrackBar;
- Y2TrackBar: TTrackBar;
- zZ: TLabel;
- ZTrackBar: TTrackBar;
- Z2TrackBar: TTrackBar;
- MainMenu1: TMainMenu;
- File1: TMenuItem;
- AppleMenu: TMenuItem;
- AppleAbout: TMenuItem;
- Open1: TMenuItem;
- Save1: TMenuItem;
- Exit1: TMenuItem;
- MenuSep1: TMenuItem;
- Edit1: TMenuItem;
- Copy1: TMenuItem;
- View1: TMenuItem;
- Tool1: TMenuItem;
- Orient1: TMenuItem;
- Scripting1: TMenuItem;
- Colors1: TMenuItem;
- Scheme1: TMenuItem;
- ToggleTransparency1: TMenuItem;
- Backcolor1: TMenuItem;
- Help1: TMenuItem;
- About1: TMenuItem;
- OpenDialog1: TOpenDialog;
- ColorDialog1: TColorDialog;
- UpdateTimer: TTimer;
- SaveDialog1: TSaveDialog;
- AutoRunTimer1: TTimer;
- GradientsIdleTimer: TTimer;
- Draw1: TMenuItem;
- OpenVOI1: TMenuItem;
- SaveVOI1: TMenuItem;
- CloseVOI1: TMenuItem;
- UndoVOI1: TMenuItem;
- Transparency1: TMenuItem;
- HideVOI1: TMenuItem;
- TransparencyVOIhi: TMenuItem;
- TransparencyVOImid: TMenuItem;
- TransparencyVOIlo: TMenuItem;
- DrawTool1: TMenuItem;
- NoDraw1: TMenuItem;
- Eraser1: TMenuItem;
- Advanced1: TMenuItem;
- OverwriteDrawColor1: TMenuItem;
- PasteSlice1: TMenuItem;
- CustomDrawColors1: TMenuItem;
- Smooth1: TMenuItem;
- Display1: TMenuItem;
- Render1: TMenuItem;
- Sagittal1: TMenuItem;
- Coronal1: TMenuItem;
- Axial1: TMenuItem;
- MPR1: TMenuItem;
- SaveDialogVoi: TSaveDialog;
- OpenDialogVoi: TOpenDialog;
- OpenDialogTxt: TOpenDialog;
- Mosaic1: TMenuItem;
- AutoRoi1: TMenuItem;
- NewWindow1: TMenuItem;
- ErrorTimer: TTimer;
- Sharpen1: TMenuItem;
- ApplePreferences: TMenuItem;
- Preferences1: TMenuItem;
- YokeSepMenu: TMenuItem;
- YokeMenu: TMenuItem;
- YokeTimer: TTimer;
- CollapsedToolPanel: TPanel;
- CollapseToolPanelBtn: TButton;
- Thresholdmenu: TMenuItem;
- ViewSepMenu: TMenuItem;
- LeftMenu: TMenuItem;
- RightMenu: TMenuItem;
- PosteriorMenu: TMenuItem;
- AnteriorMenu: TMenuItem;
- InferiorMenu: TMenuItem;
- SuperiorMenu: TMenuItem;
- voiDescriptives1: TMenuItem;
- VisibleClrbarMenu: TMenuItem;
- ClrbarSep: TMenuItem;
- procedure ConvertForeign1Click(Sender: TObject);
- procedure FormChangeBounds(Sender: TObject);
- procedure InterpolateDrawMenuClick(Sender: TObject);
- procedure LineColorBtnClick(Sender: TObject);
- procedure LineWidthEditChange(Sender: TObject);
- procedure CoordEditChange(Sender: TObject);
- procedure OnlineHelpMenuClick(Sender: TObject);
- procedure MosaicTextChange(Sender: TObject);
- function OpenVOI(lFilename: string): boolean;
- procedure BackgroundMaskMenuClick(Sender: TObject);
- procedure FormDropFiles(Sender: TObject; const FileNames: array of String);
- procedure FormShow(Sender: TObject);
- procedure InterpolateMenuClick(Sender: TObject);
- procedure LUTdropChange(Sender: TObject);
- procedure OrientBtnClick(Sender: TObject);
- procedure OrientClick(lOrient: integer);
- procedure OrientMenuClick(Sender: TObject);
- procedure RadiologicalMenuClick(Sender: TObject);
- procedure ReorientMenuClick(Sender: TObject);
- procedure ResetDefaults1Click(Sender: TObject);
- procedure SetOverlayAlpha(Sender: TObject);
- //procedure StringGridSetCaption(aRow: integer);
- procedure StringGrid1DrawCell(Sender: TObject; aCol, aRow: Integer;
- aRect: TRect; aState: TGridDrawState);
- procedure ThresholdMenuClick(Sender: TObject);
- procedure UpdateOverlaySpread;
- procedure UpdateFont(initialSetup: boolean);
- procedure DemoteOrder(lRow: integer);
- procedure ReadCell (ACol,ARow: integer; Update: boolean);
- procedure RecompileShader(oldQ, newQ: integer);
- procedure BlendOverlaysRGBA (var lTexture: TTexture);
- procedure OverlayIdleTimerReset;
- function OverlayIntensityString(Voxel: integer): string;
- procedure OverlayColorFromZeroMenuClick(Sender: TObject);
- procedure SetBackgroundAlpha(Sender: TObject);
- procedure SetOverlayAlphaValue(NewValue: integer);
- procedure SetOverlayAlphaLayerValue(Layer, NewValue: integer);
- procedure SetBackgroundAlphaLayerValue(Layer, NewValue: integer);
- procedure SetSubmenuWithTag (var lRootMenu: TMenuItem; lTag: Integer);
- procedure SetBackgroundAlphaValue(NewValue: integer);
- procedure OverlayVisible(lOverlay: integer; lVisible: boolean);
- procedure ChangeOverlayUpdate;
- function Addoverlay(lFilename: string; lVolume: integer): integer;
- procedure Closeoverlays1Click(Sender: TObject);
- procedure StringGrid1Exit(Sender: TObject);
- procedure StringGrid1KeyPress(Sender: TObject; var Key: char);
- procedure StringGrid1MouseDown(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- procedure StringGrid1SelectCell(Sender: TObject; aCol, aRow: Integer;
- var CanSelect: Boolean);
- procedure UpdateImageIntensity (lOverlay: integer);
- procedure UpdateImageIntensityMinMax (lOverlay: integer; lMinIn,lMaxIn: double);
- procedure UpdateOverlaySpreadI (lIndex: integer);
- procedure UpdateLUT(lOverlay,lLUTIndex: integer; lChangeDrop: boolean);
- procedure Addoverlay1Click(Sender: TObject);
- //function Addoverlay(lFilename: string; lVolume: integer): integer;
- procedure CollapsedToolPanelClick(Sender: TObject);
- procedure HideRenderToolsBtnClick(Sender: TObject);
- procedure CopyScriptClick(Sender: TObject);
- procedure FormDestroy(Sender: TObject);
- procedure RunScriptClick(Sender: TObject);
- procedure SetToolPanelWidth;
- procedure NewWindow1Click(Sender: TObject);
- procedure Preferences1Click(Sender: TObject);
- function ScreenShot(Zoom: integer): TBitmap;
- procedure AutoDetectVOI;
- procedure AutoRoi1Click(Sender: TObject);
- procedure ConvertDicom1Click(Sender: TObject);
- procedure CustomDrawColors1Click(Sender: TObject);
- procedure ErrorTimerTimer(Sender: TObject);
- procedure Sharpen1Click(Sender: TObject);
- procedure ShowmessageError(Str:string);
- procedure LoadDraw;
- function MouseMoveVOI (X, Y: Integer): boolean;
-function MouseUpVOI (Shift: TShiftState; X, Y: Integer): boolean;
- function MouseDownVOI (Shift: TShiftState; X, Y: Integer): boolean;
- procedure CloseVOI1Click(Sender: TObject);
- procedure Extract1Click(Sender: TObject);
- procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
- procedure BET1Click(Sender: TObject);
- procedure GradientsIdleTimerTimer(Sender: TObject);
- procedure SetColorBarPosition;
- procedure Label4Click(Sender: TObject);
- procedure Label5Click(Sender: TObject);
- procedure Label6Click(Sender: TObject);
- procedure DrawTool1Click(Sender: TObject);
- procedure MinMaxEditExit(Sender: TObject);
- procedure OpenVOI1Click(Sender: TObject);
- procedure PasteSlice1Click(Sender: TObject);
- procedure SetViewClick(Sender: TObject);
- procedure ResetSliders;
- procedure OrthoClick(X,Y: integer);
- procedure SaveVOI1Click(Sender: TObject);
- procedure ShowOrthoSliceInfo (isYoke: boolean);
- procedure Quit2TextEditor;
- function GLBoxBackingWidth: integer;
- function GLBoxBackingHeight: integer;
- procedure ClipTrackChange(Sender: TObject);
- procedure AppDropFiles(Sender: TObject; const FileNames: array of String);
- procedure OpenColorScheme(Sender: TObject);
- procedure About1Click(Sender: TObject);
- procedure Smooth1Click(Sender: TObject);
- procedure ToolPanelClick(Sender: TObject);
- procedure UpdateContrast (Xa,Ya, Xb, Yb: integer);
- procedure GLboxMouseUp(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; lX, lY: Integer);
- procedure GLboxMouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
- procedure Backcolor1Click(Sender: TObject);
- procedure Orient1Click(Sender: TObject);
- procedure LoadStartupImage;
- procedure ShaderBoxResize(Sender: TObject);
- procedure Tool1Click(Sender: TObject);
- procedure TransparencyVOIClick(Sender: TObject);
- procedure UndoVOI1Click(Sender: TObject);
- procedure UniformChange(Sender: TObject);
- procedure Exit1Click(Sender: TObject);
- procedure ExitButton1Click(Sender: TObject);
- procedure CheckForUpdates(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure OverlayBoxCreate;
- procedure UpdateClrbar;
- procedure ClrbarClr(i: integer);
- procedure ClrbarMenuClick(Sender: TObject);
- procedure DrawClrbar (lScrnWid, lScrnHt, zoom, zoomOffsetX, zoomOffsetY: integer; ClrbarSizeFracX: single);
- procedure DrawCube (lScrnWid, lScrnHt, zoom, zoomOffsetX, zoomOffsetY: integer);
- procedure TextArrow (X,Y,Sz: single; NumStr: string; orient: integer;FontColor,ArrowColor: TGLRGBQuad);
-
- procedure GLboxMouseDown(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; lX, lY: Integer);
- procedure GLboxMouseMove(Sender: TObject; Shift: TShiftState; lX, lY: Integer);
- procedure GLboxDblClick(Sender: TObject);
- procedure OpenMRU(Sender: TObject);//open template or MRU
- function LoadDatasetNIFTIvolx(lFilename: string; lStopScript: boolean): boolean;
- procedure TerminateRendering;
- procedure UpdateMosaic(Sender: TObject);
- procedure UpdateMRU;//most-recently-used menu
- function LoadDatasetNIFTIvol(lFilename: string; lStopScript: boolean; lVolume: integer): boolean;
- procedure AdjustFormPos (var lForm: TForm);
- procedure GLboxPaint(Sender: TObject);
- procedure GLboxResize(Sender: TObject);
- procedure ClrbarMenu1Click(Sender: TObject);
- procedure Open1Click(Sender: TObject);
- //procedure FormResize(Sender: TObject);
- procedure AziElevChange(Sender: TObject);
- procedure QualityTrackChange(Sender: TObject);
- procedure ShaderDropChange(Sender: TObject);
- procedure UpdateTimerTimer(Sender: TObject);
- procedure ToggleTransparency1Click(Sender: TObject);
- function CheckFilename (var lFilenameX: string; lBitmap: boolean): boolean;
- procedure FormClose(Sender: TObject; var TheAction: TCloseAction);
- procedure HideBtnClick(Sender: TObject);
- procedure CutoutNearestSector(Sender: TObject);
- procedure CutoutChange(Sender: TObject);
- procedure MinMaxEditKeyPress(Sender: TObject; var Key: Char);
- procedure MinMaxEditKeyUp(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- procedure Overlays1Click(Sender: TObject);
- function loadLabelsITK(fnm: string): boolean;
- procedure loadLabelsDefault;
- procedure Mosaic1Click(Sender: TObject);
- procedure DrawMosaic(Str: string);
- procedure SelectSliceView(lView: integer);
- procedure SelectShowColorEditor(lShow: boolean);
- function LoadDatasetNIFTIvol1(lFilename: string; lStopScript: boolean): boolean;
- procedure SelectShowTools(lShow: boolean);
- procedure SelectIntensityMinMax(lMin,lMax: single);
- procedure SelectCube(lShow: boolean);
- procedure StopTimers;
- procedure Scripting1Click(Sender: TObject);
- procedure SetFormSize(FormWidth,FormHeight: integer);
- procedure Copy1Click(Sender: TObject);
- procedure SavePicture (lFilename: string; lX, lY: integer); overload;
- procedure SavePicture (lFilename: string); overload;
- procedure Save1Click(Sender: TObject);
- procedure DisplayRadiological;
- procedure DisplayPrefs;
- procedure StopScripts;
- procedure AutoRunTimer1Timer(Sender: TObject);
- procedure UpdateGL;
- procedure GradientsIdleTimerReset;
- procedure voiBinarize1Click(Sender: TObject);
- procedure voiDescriptives1Click(Sender: TObject);
- procedure YokeMenuClick(Sender: TObject);
- procedure YokeTimerTimer(Sender: TObject);
- procedure ClearText(ScrnWid, lScrnHt: integer);
- procedure DrawText(lScrnWid, lScrnHt, zoom, zoomOffsetX, zoomOffsetY: integer);
- {$IFDEF LCLCocoa}
- procedure SetFormDarkMode(var f: TForm);
- procedure SetRetina;
- procedure SetDarkMode;
- {$ENDIF}
- private
- {$IFNDEF FPC} procedure WMDropFiles(var Msg: TWMDropFiles); message WM_DROPFILES; {$ENDIF}
- public
- { public declarations }
- M_reload: integer;
- end;
-const
- //kCloseVOI_reload = -1;
- //kOpenBlankVOI_reload = -2;
- kOpenExistingVOI_reload = -3;
-const
- kMinOverlayIndex = 1;
- kMaxOverlays = 32;
-var
- M_refresh: boolean;
- GLForm1: TGLForm1;
- gPrefs: TPrefs;
- gTexture3D: TTexture;
- gRendering: boolean = false;
- gInitialSetup: boolean = true;
- gOpenOverlays : integer = 0;
- gOverlayImg : array [kMinOverlayIndex..kMaxOverlays] of TMRIcroHdr;
- gTypeInCell: boolean = false;
- gEnterCell: boolean = false;
- gOverlayCLUTrec : array [kMinOverlayIndex..kMaxOverlays] of TCLUTrec;
- gOverlayAlpha : array [kMinOverlayIndex..kMaxOverlays] of integer;
- gBackgroundAlpha : array [kMinOverlayIndex..kMaxOverlays] of integer;
- gPrevCol: integer = 0;
- gPrevRow: integer = 0;
- gRetinaScale: single = 1;
- gCube : TGLCube;
- gClrbar: TGLClrbar;
- gText: TGLText;
-
-implementation
-
-{$IFDEF ENABLEOVERLAY} uses {$IFDEF LCLCocoa} UserNotification, nsappkitext, glcocoanscontext,{$ENDIF} nifti_types, savethreshold, nii_reslice {$IFDEF ENABLESCRIPT}, scriptengine{$ENDIF};{$ENDIF}
-{$IFDEF FPC} {$R *.lfm} {$ENDIF}
-{$IFNDEF FPC} {$R *.dfm} {$ENDIF}
-var
- MouseStartPt, MousePt: TPoint;
- //gnClrbar: integer;
- gFontSz, gFontPx: single;
-{$IFDEF FPC}
-GLBox:TOpenGLControl;
-{$ELSE}
-GLbox : TGLPanel;
-{$ENDIF}
-
-{$IFDEF LCLCocoa}
-(* //the alert sheets are not modal (yet)
-procedure ShowMessage(Str: string);
-begin
- ShowAlertSheet(GLForm1.Handle,'Note', str);
-
-end; *)
-
-{$ENDIF}
-
-procedure TGLForm1.ClearText(ScrnWid, lScrnHt: integer);
-const
- sizeFrac = 0.035;
-begin
- if ScrnWid < lScrnHt then
- gFontSz := round(ScrnWid * sizeFrac)
- else
- gFontSz := round(lScrnHt * sizeFrac);
- gFontPx := gFontSz;
- gFontSz := gFontSz/gText.BaseHeight;
- gText.ClearText;
- gText.TextColor(255,128,128);
-end;
-
-
-procedure TGLForm1.TextArrow (X,Y,Sz: single; NumStr: string; orient: integer;FontColor,ArrowColor: TGLRGBQuad);
-begin
- if (gPrefs.BackColor.rgbRed = FontColor.rgbRed) and (gPrefs.BackColor.rgbGreen = FontColor.rgbGreen) and (gPrefs.BackColor.rgbBlue = FontColor.rgbBlue) then
- gText.TextColor(255-FontColor.rgbRed, 255-FontColor.rgbGreen, 255-FontColor.rgbBlue)
-
- else
- gText.TextColor(FontColor.rgbRed, FontColor.rgbGreen, FontColor.rgbBlue);
- //Caption := inttostr(orient);
- //1=left,2=top,3=right,4=bottom,5=above
- if orient = 5 then //centered directly below XY
- gText.TextOut(X- (gText.TextWidth(gFontSz,NumStr)*0.5) ,Y-(gFontPx*1.2),gFontSz,NumStr);
- if orient = 6 then //left of X, Below Y
- gText.TextOut(X+(gFontPx*0.1) ,Y-(gFontPx*1.2),gFontSz,NumStr)
- else //??
- gText.TextOut(X- (gText.TextWidth(gFontSz,NumStr)*0.5) ,Y-(gFontPx*1.2),gFontSz,NumStr);
-end;
-
-procedure TGLForm1.DrawText(lScrnWid, lScrnHt, zoom, zoomOffsetX, zoomOffsetY: integer);
-begin
-(*glDisable(GL_CULL_FACE);
-glMatrixMode(GL_MODELVIEW);
-glLoadIdentity;
-glMatrixMode(GL_PROJECTION);
-glLoadIdentity();
-//glOrtho (0, Width, 0, Height, 0.1, 40);
-//glTranslatef(zoom*zoomOffsetX, zoom*zoomOffsetY, 0);
-glEnable (GL_BLEND);
-glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-glDisable(GL_DEPTH_TEST);
-glDisable(GL_CULL_FACE);
-glMatrixMode(GL_MODELVIEW);
-glLoadIdentity;
-glMatrixMode(GL_PROJECTION);
-glLoadIdentity();
-glOrtho (0, Width div zoom , 0, Height div zoom, 0.1, 40);
-glTranslatef(zoomOffsetX, zoomOffsetY, 0);
-glEnable (GL_BLEND);
-glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-glDisable(GL_DEPTH_TEST); *)
-gText.DrawText;
-end;
-
-procedure SetLutFromZero(var lMin,lMax: single);
-//if both min and max are positive, returns 0..max
-//if both min and max are negative, returns min..0
-begin
- SortSingle(lMin,lMax);
- if (lMin > 0) and (lMax > 0) then
- lMin := 0
- else if (lMin < 0) and (lMax < 0) then
- lMax := 0;
-end;
-
-procedure TGLForm1.UpdateClrbar;
-var
- i: integer;
- lMin, lMax: single;
- LUT: TLUT;
-begin
- (* //
- for i := 0 to 255 do begin
- LUT[i].rgbRed := i;
- LUT[i].rgbGreen := 0;
- LUT[i].rgbBlue := 0;
- end;*)
- if gOpenOverlays < 1 then begin
- GenerateLUT(gCLUTrec, LUT);
- gClrbar.SetLUT(1, LUT, gCLUTrec.min,gCLUTrec.max);
- exit;
- end; //
- for i := 1 to gOpenOverlays do begin
- lMin := gOverlayImg[i].WindowScaledMin;
- lMax := gOverlayImg[i].WindowScaledMax;
- SortSingle(lMin,lMax);
- if gOverlayImg[i].LutFromZero then
- SetLutFromZero(lMin,lMax);
-
- gClrbar.SetLUT(i, gOverlayImg[i].LUT, lMin,lMax);
- end;
-
-end;
-
-procedure TGLForm1.DrawClrbar (lScrnWid, lScrnHt, zoom, zoomOffsetX, zoomOffsetY: integer; ClrbarSizeFracX: single);
-
-begin
- gClrbar.ForcedSizeFracX:= ClrbarSizeFracX;
- gClrbar.Draw(max(gOpenOverlays,1),lScrnWid, lScrnHt, zoom, zoomOffsetX, zoomOffsetY);
-end;
-
-procedure TGLForm1.DrawCube (lScrnWid, lScrnHt, zoom, zoomOffsetX, zoomOffsetY: integer);
-begin
- gCube.Azimuth:= -gRayCast.Azimuth;
- gCube.Elevation:= gRayCast.Elevation;
- if (gPrefs.ColorbarPosition = 1) or (gPrefs.ColorbarPosition = 2) then
- gCube.TopLeft:= true
- else
- gCube.TopLeft:= false;
- gCube.Draw(lScrnWid, lScrnHt,zoom, zoomOffsetX, zoomOffsetY);
-end;
-
-function TGLForm1.GLBoxBackingWidth: integer;
-begin
- {$IFDEF LCLCocoa}
- result := Round(GLBox.Width * LBackingScaleFactor(GLBox.Handle));
- {$ELSE}
- result := GLBox.Width;
- {$ENDIF}
-end;
-
-function TGLForm1.GLBoxBackingHeight: integer;
-begin
- {$IFDEF LCLCocoa}
- result := Round(GLBox.Height * LBackingScaleFactor(GLBox.Handle));
- {$ELSE}
- result := GLBox.Height;
- {$ENDIF}
-end;
-
-{$IFDEF LCLCocoa}
-procedure TGLForm1.SetFormDarkMode(var f: TForm);
-begin
- if not gPrefs.DarkMode then exit;
- f.PopupMode:= pmAuto;
- f.HandleNeeded;
- setThemeMode(f, true);
- //setThemeMode(f.Handle, true);
-end;
-
-procedure TGLForm1.SetDarkMode;
-begin
- setThemeMode(Self, gPrefs.DarkMode);
- //setThemeMode(Self.Handle, gPrefs.DarkMode);
- if gPrefs.DarkMode then begin
- MosaicText.Color := clGray;
- ShaderMemo.Color := clGray;
- StringGrid1.Color := clGray;
- StringGrid1.AlternateColor:= clGray;
- StringGrid1.FixedColor:= clBlack;
- (*LeftBtn.Color := clDefault;
- AnteriorBtn.Color := clGray;
- RightBtn.Color := clSilver;
- PosteriorBtn.Color := clMedGray;
- SuperiorBtn.Color := clBtnFace;
- InferiorBtn.Color := clBlack; *)
- end else begin
- MosaicText.Color:= clDefault;
- ShaderMemo.Color := clDefault;
- StringGrid1.Color := clDefault;
- StringGrid1.AlternateColor:= clDefault;
- StringGrid1.FixedColor:= clBtnFace;
- end;
-end;
-
-procedure TGLForm1.SetRetina;
-begin
- (*if gPrefs.RetinaDisplay then
- GLBox.Options := [ocoMacRetinaMode]
- else
- GLBox.Options := [];
- GLBox.MultiSampling:=GLBox.MultiSampling;
- *)
-
- LSetWantsBestResolutionOpenGLSurface(gPrefs.RetinaDisplay, GLBox.Handle);
- //GLBox.WantsBestResolutionOpenGLSurface:=gPrefs.RetinaDisplay;
- if (GLbox.Height < 1) or (GLBoxBackingHeight <= GLbox.Height) then
- gRetinaScale := 1
- else
- gRetinaScale := GLBoxBackingHeight/GLbox.Height;
-end;
-{$ENDIF}
-
-
-procedure TGLForm1.YokeMenuClick(Sender: TObject);
-begin
- {$IFDEF COMPILEYOKE}
- YokeTimer.Enabled := YokeMenu.Checked;
- {$ENDIF}
-end;
-
-
-procedure TGLForm1.YokeTimerTimer(Sender: TObject);
-{$IFDEF COMPILEYOKE}
-var
- lAzimuth, lElevation,lXmm,lYmm,lZmm: single;
- lInvMat: TMatrix ;
- lOK: boolean;
-begin
- YokeTimer.Enabled := YokeMenu.Checked;
- if not YokeMenu.Checked then exit;
- if (gPrefs.SliceView = 5) then exit;//not for mosaics
- if not GetShareFloats(lXmm,lYmm,lZmm, lAzimuth, lElevation) then
- exit;
- if (gPrefs.SliceView < 1) or (gPrefs.SliceView > 5) then begin //not 2D slice view: assume rendering
- GLBox.Invalidate;
- gRayCast.Azimuth := round(lAzimuth);
- gRayCast.Elevation := round(lElevation);
- exit;
- end;
- lInvMat := Hdr2InvMat (gTexture3D.NIftiHdr,lOK);
- if (not lOK) or (gTexture3D.FiltDim[1] < 2) or (gTexture3D.FiltDim[2] < 2) or (gTexture3D.FiltDim[3] < 2) then exit;
- mm2Voxel (lXmm,lYmm,lZmm, lInvMat);
- gRayCast.OrthoX := (lXmm-1)/(gTexture3D.FiltDim[1]-1);
- gRayCast.OrthoY := (lYmm-1)/(gTexture3D.FiltDim[2]-1);
- gRayCast.OrthoZ := (lZmm-1)/(gTexture3D.FiltDim[3]-1);
- ShowOrthoSliceInfo (true);
- GLBox.Invalidate;
-end;
-{$ELSE}
-begin
- //
-end;
-
-{$ENDIF}
-
-{$IFDEF FPC}
-{$IFDEF COREGL}
-Type
-TFrameBuffer = record
- depthBuf,frameBuf, tex: GLUint;
- w, h: integer;
-end;
-
-procedure initFrame (var f : TFrameBuffer);
-begin
- f.tex := 0;
- f.depthBuf := 0;
- f.frameBuf := 0;
-end;
-
-procedure freeFrame (var f : TFrameBuffer);
-begin
- //Delete resources
- glDeleteTextures(1, @f.tex);
- glDeleteTextures(1, @f.depthBuf);
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
- glDeleteFramebuffers(1, @f.frameBuf);
- //Bind 0, which means render to back buffer, as a result, frameBuf is unbound
-end;
-
-function setFrame (wid, ht: integer; var f : TFrameBuffer; isMultiSample: boolean) : boolean; //returns true if multi-sampling
-//http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-14-render-to-texture/
-var
- w,h: integer;
- //drawBuf: GLenum;
- drawBuf: array[0..1] of GLenum;
-
-begin
- w := wid;
- h := ht;
- if isMultiSample then begin
- w := w * 2;
- h := h * 2;
- end;
- result := isMultiSample;
- if (w = f.w) and (h = f.h) then begin
- {$IFDEF COREGL}
- glBindFramebuffer(GL_FRAMEBUFFER, f.frameBuf);
- {$ELSE}
- glBindFramebuffer(GL_FRAMEBUFFER_EXT, f.frameBuf);
- {$ENDIF}
- exit;
- end;
- freeframe(f);
- f.w := w;
- f.h := h;
- //https://www.opengl.org/wiki/Framebuffer_Object_Examples#Quick_example.2C_render_to_texture_.282D.29
- glGenTextures(1, @f.tex);
- glBindTexture(GL_TEXTURE_2D, f.tex);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexImage2D(GL_TEXTURE_2D, 0,GL_RGBA8, f.w, f.h, 0,GL_RGBA, GL_UNSIGNED_BYTE, nil); //RGBA16 for AO
- glGenFramebuffers(1, @f.frameBuf);
- glBindFramebuffer(GL_FRAMEBUFFER, f.frameBuf);
- //Attach 2D texture to this FBO
- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, f.tex, 0);
-
- //glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, f.tex, 0);
- // Create the depth buffer
- glGenTextures(1, @f.depthBuf);
- glBindTexture(GL_TEXTURE_2D, f.depthBuf);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, f.w, f.h, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, nil);
- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, f.depthBuf, 0);
- //glDrawBuffers(1, @drawBuf); // "1" is the size of DrawBuffers
- drawBuf[0] := GL_COLOR_ATTACHMENT0;
- drawBuf[1] := GL_COLOR_ATTACHMENT1;
- glDrawBuffers(1, @drawBuf[0]); // draw colors only
- if(glCheckFramebufferStatus(GL_FRAMEBUFFER) <> GL_FRAMEBUFFER_COMPLETE) then begin
- GLForm1.ShowmessageError('Frame buffer error 0x'+inttohex(glCheckFramebufferStatus(GL_FRAMEBUFFER),4) );
- exit;
- end;
-end;
-
-function TGLForm1.ScreenShot(Zoom: integer): TBitmap;
-var
- RawImage: TRawImage;
- p: array of byte;
- zoom2, w, h, x, y, BytePerPixel: integer;
- z:longword;
- //fbuf, ftex: GLUint;
- f : TFrameBuffer;
- DestPtr: PInteger;
- origSz : TPoint;
- maxXY : array[0..1] of GLuint;
-begin
- GLBox.MakeCurrent;
- glGetIntegerv(GL_MAX_VIEWPORT_DIMS, @maxXY);
- //caption := inttostr(maxXY[0]) +'x'+inttostr(maxXY[1]);
- zoom2 := Zoom;
- origSz.X := gRayCast.WINDOW_WIDTH;
- origSz.Y := gRayCast.WINDOW_HEIGHT;
- w := GLBoxBackingWidth * zoom2;
- h := GLboxBackingHeight * zoom2;
- if (w > maxXY[0]) or (h > maxXY[1]) then begin
- w := GLBoxBackingWidth;
- h := GLboxBackingHeight;
- zoom2 := 1
- end;
- Result:=TBitmap.Create;
- Result.Width:=w;
- Result.Height:=h;
- Result.PixelFormat := pf24bit; //if pf32bit the background color is wrong, e.g. when alpha = 0
- RawImage := Result.RawImage;
- BytePerPixel := RawImage.Description.BitsPerPixel div 8;
- setlength(p, 4*w* h);
- //GLBox.MakeCurrent;
- (*fbuf := 0;
- ftex := 0;
- glGenTextures(1, @ftex);
- glBindTexture(GL_TEXTURE_2D, ftex);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexImage2D(GL_TEXTURE_2D, 0,GL_RGBA8, w, h, 0,GL_RGBA, GL_UNSIGNED_BYTE, nil); //RGBA16 for AO
- glGenFramebuffers(1, @fbuf);
- glBindFramebuffer(GL_FRAMEBUFFER, fbuf);
- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, ftex, 0); *)
- initFrame(f);
- setFrame (w, h, f, false);
- gRendering:=true;
- //Attach 2D texture to this FBO
- //gRayCast.ScreenCapture := true;
- //gPrefs.RayCastQuality1to10 := 10;
- gRayCast.WINDOW_WIDTH := w;
- gRayCast.WINDOW_HEIGHT := h;
- //DisplayGLz(gTexture3D,fbuf);
- DisplayGLz(gTexture3D,f.frameBuf);
- glFlush;
- glFinish;//<-this would pause until all jobs finished: generally a bad idea! required here
- GLbox.SwapBuffers;
- //CreateRender(w, h, false); //draw to framebuffer fScreenShot
- {$IFDEF Darwin} //http://lists.apple.com/archives/mac-opengl/2006/Nov/msg00196.html
- glReadPixels(0, 0, w, h, $80E1, $8035, @p[0]); //OSX-Darwin GL_BGRA = $80E1; GL_UNSIGNED_INT_8_8_8_8_EXT = $8035;
- {$ELSE}
- {$IFDEF Linux}
- glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, @p[0]); //Linux-Windows GL_RGBA = $1908; GL_UNSIGNED_BYTE
- {$ELSE}
- glReadPixels(0, 0, w, h, $80E1, GL_UNSIGNED_BYTE, @p[0]); //Linux-Windows GL_RGBA = $1908; GL_UNSIGNED_BYTE
- {$ENDIF}
- {$ENDIF}
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
- freeFrame(f);
- //glDeleteFramebuffers(1, @fbuf);
- //glDeleteTextures(1, @ftex);
- gRendering:=false;
- //gRayCast.ScreenCapture := false;
- gRayCast.WINDOW_WIDTH := origSz.X;
- gRayCast.WINDOW_HEIGHT := origSz.Y;
- GLbox.ReleaseContext;
- z := 0;
- if BytePerPixel <> 4 then begin
- for y:= h-1 downto 0 do begin
- DestPtr := PInteger(RawImage.Data);
- Inc(PByte(DestPtr), y * RawImage.Description.BytesPerLine );
- for x := 1 to w do begin
- DestPtr^ := p[z] + (p[z+1] shl 8) + (p[z+2] shl 16);
- Inc(PByte(DestPtr), BytePerPixel);
- z := z + 4;
- end;
- end; //for y : each line in image
- end else begin
- for y:= h-1 downto 0 do begin
- DestPtr := PInteger(RawImage.Data);
- Inc(PByte(DestPtr), y * RawImage.Description.BytesPerLine );
- System.Move(p[z], DestPtr^, w * BytePerPixel );
- z := z + ( w * 4 );
- end; //for y : each line in image
- end;
- setlength(p, 0);
- GLbox.invalidate;
-end;
-
-
-{$ELSE} //not COREGL
-function ScreenShotX1: TBitmap; //native resolution: no framebuffer, automatic multisampling
-var
- p: bytep0;
- x, y: integer;
- prevQ, w,h, BytePerPixel: int64;
- z:longword;
- RawImage: TRawImage;
- DestPtr: PInteger;
- maxXY: array[0..1] of GLuint;
-begin
- prevQ := gPrefs.RayCastQuality1to10;
- gPrefs.RayCastQuality1to10 := 10;
- if ((prevQ <> 10) and (gPrefs.SliceView = 0)) then
- GLForm1.recompileShader(prevQ, 10);
- GLBox.MakeCurrent;
- DisplayGL(gTexture3D);
- w := GLForm1.GLBoxBackingWidth;
- h := GLForm1.GLboxBackingHeight;
- Result:=TBitmap.Create;
- Result.Width:=w;
- Result.Height:=h;
- Result.PixelFormat := pf24bit; //if pf32bit the background color is wrong, e.g. when alpha = 0
- RawImage := Result.RawImage;
- //GLForm1.ShowmessageError('GLSL error '+inttostr(RawImage.Description.RedShift)+' '+inttostr(RawImage.Description.GreenShift) +' '+inttostr(RawImage.Description.BlueShift));
- BytePerPixel := RawImage.Description.BitsPerPixel div 8;
- GetMem(p, w*h*4);
- {$IFDEF Darwin} //http://lists.apple.com/archives/mac-opengl/2006/Nov/msg00196.html
- glReadPixels(0, 0, w, h, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, @p[0]); //OSX-Darwin
- {$ELSE}
- glReadPixels(0, 0, w, h, GL_BGRA, GL_UNSIGNED_BYTE, @p[0]); //Linux-Windows
- {$ENDIF}
- z := 0;
- if BytePerPixel <> 4 then begin
- for y:= h-1 downto 0 do begin
- DestPtr := PInteger(RawImage.Data);
- Inc(PByte(DestPtr), y * RawImage.Description.BytesPerLine );
- for x := 1 to w do begin
- DestPtr^ := p[z] + (p[z+1] shl 8) + (p[z+2] shl 16);
- Inc(PByte(DestPtr), BytePerPixel);
- z := z + 4;
- end;
- end; //for y : each line in image
- end else begin
- for y:= h-1 downto 0 do begin
- DestPtr := PInteger(RawImage.Data);
- Inc(PByte(DestPtr), y * RawImage.Description.BytesPerLine );
- System.Move(p[z], DestPtr^, w * BytePerPixel );
- z := z + ( w * 4 );
- end; //for y : each line in image
- end;
- FreeMem(p);
- GLbox.ReleaseContext;
- if ((prevQ <> 10) and (gPrefs.SliceView = 0)) then begin
- gPrefs.RayCastQuality1to10 := prevQ;
- GLForm1.recompileShader(10, gPrefs.RayCastQuality1to10);
- end;
-end;
-
-function ScreenShotTiled(Zoom: integer): TBitmap;
-var
- p: bytep0;
- x, y, tile: integer;
- prevQ, w,h, wz,hz, tilex,tiley, BytePerPixel: int64;
- z:longword;
- RawImage: TRawImage;
- DestPtr: PInteger;
-begin
- prevQ := gPrefs.RayCastQuality1to10;
- gPrefs.RayCastQuality1to10 := 10;
- if (prevQ <> 10) then
- GLForm1.recompileShader(prevQ, 10);
- gRayCast.ScreenCapture := true;
- GLBox.MakeCurrent;
- w := GLForm1.GLBoxBackingWidth;
- h := GLForm1.GLboxBackingHeight;
- wz := w*Zoom;
- hz := h*Zoom;
- Result:=TBitmap.Create;
- Result.Width:=wz;
- Result.Height:=hz;
- Result.PixelFormat := pf24bit; //if pf32bit the background color is wrong, e.g. when alpha = 0
- RawImage := Result.RawImage;
- //GLForm1.ShowmessageError('GLSL error '+inttostr(RawImage.Description.RedShift)+' '+inttostr(RawImage.Description.GreenShift) +' '+inttostr(RawImage.Description.BlueShift));
- BytePerPixel := RawImage.Description.BitsPerPixel div 8;
- Result.BeginUpdate(False);
- GetMem(p, w*h*4);
- //GLForm1.Caption := inttostr(Zoom);
- //tic := gettickcount;
- for tile := 0 to ((Zoom * Zoom) - 1) do begin
- tilex := (tile mod zoom) * w;
- tiley := (tile div zoom) * h;
- DisplayGLz(gTexture3D, Zoom, -tilex, -tiley, 0 {to screen}, true {tiled});
- {$IFDEF Darwin} //http://lists.apple.com/archives/mac-opengl/2006/Nov/msg00196.html
- glReadPixels(0, 0, w, h, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, @p[0]); //OSX-Darwin
- {$ELSE}
- glReadPixels(0, 0, w, h, GL_BGRA, GL_UNSIGNED_BYTE, @p[0]); //Linux-Windows
- {$ENDIF}
- z := 0;
- if BytePerPixel = 4 then begin
- for y:=0 to h-1 do begin
- DestPtr := PInteger(RawImage.Data);
- Inc(PByte(DestPtr), (( (hz-1) - (Y+tiley)) * RawImage.Description.BytesPerLine) + (tilex * BytePerPixel));
- System.Move(p^[z], DestPtr^, w * BytePerPixel );
- z := z + ( w * 4 );
- end; //for y
- end else begin //below BytePerPixel <> 4, e.g. Windows
- for y:=0 to h-1 do begin
- DestPtr := PInteger(RawImage.Data);
- Inc(PByte(DestPtr), (( (hz-1) - (Y+tiley)) * RawImage.Description.BytesPerLine) + (tilex * BytePerPixel));
- for x:=0 to w-1 do begin
- DestPtr^ := (p^[z])+(p^[z+1] shl 8)+(p^[z+2] shl 16);
- Inc(PByte(DestPtr), BytePerPixel);
- z := z + 4;
- end;
- end; //for y
- end; //if BytePerPixel = 4 else ...
- end; //for each tile
- Result.EndUpdate(False);
- FreeMem(p);
- GLbox.ReleaseContext;
- gRayCast.ScreenCapture := false;
- if (prevQ <> 10) then begin
- gPrefs.RayCastQuality1to10 := prevQ;
- GLForm1.recompileShader(10, gPrefs.RayCastQuality1to10);
- end;
- {$IFDEF LCLCocoa}
- GLBox.Invalidate; //at least for Cocoa we need to reset this or the user will see the final tile
- {$ENDIF}
- //clipbox.caption := inttostr(gettickcount - tic);
-end;
-
-//not IFDEF TILED_SCREENSHOT
-Type
-TFrameBuffer = record
- //depthBuf,
- frameBuf, tex: GLUint; //we need depth buffer for 2D cube
- w, h: integer;
-end;
-
-procedure initFrame (var f : TFrameBuffer);
-begin
- f.tex := 0;
- //f.depthBuf := 0;
- f.frameBuf := 0;
-end;
-
-procedure freeFrame (var f : TFrameBuffer);
-begin
- glDeleteTextures(1, @f.tex);
- //glDeleteTextures(1, @f.depthBuf);
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
- glDeleteFramebuffersEXT(1, @f.frameBuf);
- //Bind 0, which means render to back buffer, as a result, frameBuf is unbound
-end;
-
-
-//{$DEFINE multisample}
-{$IFDEF multisample}
- //How to get this to work on MacOS?
- //https://stackoverflow.com/questions/33587682/opengl-how-can-i-attach-a-depth-buffer-to-a-framebuffer-using-a-multisampled-2d
-{$ELSE}
-
-function setFrame (wid, ht: integer; var f : TFrameBuffer; isMultiSample: boolean) : boolean; //returns true if multi-sampling
-//http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-14-render-to-texture/
-var
- w,h: integer;
- drawBuf: array[0..1] of GLenum;
-begin
- w := wid;
- h := ht;
- if isMultiSample then begin
- w := w * 2;
- h := h * 2;
- end;
- result := isMultiSample;
- if (w = f.w) and (h = f.h) then begin
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, f.frameBuf);
- exit;
- end;
- freeframe(f);
- f.w := w;
- f.h := h;
- //https://www.opengl.org/wiki/Framebuffer_Object_Examples#Quick_example.2C_render_to_texture_.282D.29
- glGenTextures(1, @f.tex);
- glBindTexture(GL_TEXTURE_2D, f.tex);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexImage2D(GL_TEXTURE_2D, 0,GL_RGBA8, f.w, f.h, 0,GL_RGBA, GL_UNSIGNED_BYTE, nil); //RGBA16 for AO
- glGenFramebuffersEXT(1, @f.frameBuf);
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, f.frameBuf);
- //Attach 2D texture to this FBO
- glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, f.tex, 0);
-
- //glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, f.tex, 0);
- //--> Create the depth buffer
- (*glGenTextures(1, @f.depthBuf);
- glBindTexture(GL_TEXTURE_2D, f.depthBuf);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, f.w, f.h, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, nil);
- glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, f.depthBuf, 0);
- //glDrawBuffers(1, @drawBuf); // "1" is the size of DrawBuffers
- drawBuf[0] := GL_COLOR_ATTACHMENT0;
- drawBuf[1] := GL_COLOR_ATTACHMENT1;
- glDrawBuffers(1, @drawBuf[0]); // draw colors only *)
- if(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) <> GL_FRAMEBUFFER_COMPLETE) then begin
- GLForm1.ShowmessageError('Frame buffer error 0x'+inttohex(glCheckFramebufferStatus(GL_FRAMEBUFFER),4) );
- exit;
- end;
-end;
-{$ENDIF}
-function ScreenShotNoTile(Zoom: integer): TBitmap;
-var
- p: bytep0;
- x, y: integer;
- prevQ, w,h, BytePerPixel: int64;
- z:longword;
- RawImage: TRawImage;
- DestPtr: PInteger;
- maxXY: array[0..1] of GLuint;
- f: TFrameBuffer;
-begin
- prevQ := gPrefs.RayCastQuality1to10;
- gPrefs.RayCastQuality1to10 := 10;
- if ((prevQ <> 10) and (gPrefs.SliceView = 0)) then
- GLForm1.recompileShader(prevQ, 10);
- gRayCast.ScreenCapture := true;
- GLBox.MakeCurrent;
- glGetIntegerv(GL_MAX_VIEWPORT_DIMS, @maxXY);
- //caption := inttostr(maxXY[0]) +'x'+inttostr(maxXY[1]);
- w := GLForm1.GLBoxBackingWidth * Zoom;
- h := GLForm1.GLboxBackingHeight * Zoom;
- MosaicScale(w, h, Zoom);
- if (w > maxXY[0]) or (h > maxXY[1]) then begin
- //OpenGL unable to create such a large bitmap
- if (gPrefs.SliceView <> 5) then begin
- result := ScreenShotX1;
- exit;
- end else begin
- w := GLForm1.GLBoxBackingWidth;
- h := GLForm1.GLboxBackingHeight;
- zoom := 1;
- end;
- end;
- Result:=TBitmap.Create;
- Result.Width:=w;
- Result.Height:=h;
- Result.PixelFormat := pf24bit; //if pf32bit the background color is wrong, e.g. when alpha = 0
- RawImage := Result.RawImage;
- //GLForm1.ShowmessageError('GLSL error '+inttostr(RawImage.Description.RedShift)+' '+inttostr(RawImage.Description.GreenShift) +' '+inttostr(RawImage.Description.BlueShift));
- BytePerPixel := RawImage.Description.BitsPerPixel div 8;
- Result.BeginUpdate(False);
- GetMem(p, w*h*4);
- initFrame(f);
- setFrame (w, h, f, false);
- //tic := gettickcount;
- gRayCast.WINDOW_WIDTH := w;
- gRayCast.WINDOW_HEIGHT := h;
- InitGL (false);
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, f.frameBuf); //<- required for 2D views
- DisplayGLz(gTexture3D, 1, 0, 0, f.frameBuf, false);
- {$IFDEF Darwin} //http://lists.apple.com/archives/mac-opengl/2006/Nov/msg00196.html
- glReadPixels(0, 0, w, h, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, @p[0]); //OSX-Darwin
- {$ELSE}
- glReadPixels(0, 0, w, h, GL_BGRA, GL_UNSIGNED_BYTE, @p[0]); //Linux-Windows
- {$ENDIF}
- z := 0;
- if BytePerPixel <> 4 then begin
- for y:= h-1 downto 0 do begin
- DestPtr := PInteger(RawImage.Data);
- Inc(PByte(DestPtr), y * RawImage.Description.BytesPerLine );
- for x := 1 to w do begin
- DestPtr^ := p[z] + (p[z+1] shl 8) + (p[z+2] shl 16);
- Inc(PByte(DestPtr), BytePerPixel);
- z := z + 4;
- end;
- end; //for y : each line in image
- end else begin
- for y:= h-1 downto 0 do begin
- DestPtr := PInteger(RawImage.Data);
- Inc(PByte(DestPtr), y * RawImage.Description.BytesPerLine );
- System.Move(p[z], DestPtr^, w * BytePerPixel );
- z := z + ( w * 4 );
- end; //for y : each line in image
- end;
- FreeMem(p);
- gRayCast.WINDOW_WIDTH := GLForm1.GLBoxBackingWidth;
- gRayCast.WINDOW_HEIGHT := GLForm1.GLBoxBackingHeight;
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); //draw to display
- freeFrame(f);
- Result.EndUpdate(False);
- InitGL (false);
- GLbox.ReleaseContext;
-
- gRayCast.ScreenCapture := false;
- if ((prevQ <> 10) and (gPrefs.SliceView = 0)) then begin
- gPrefs.RayCastQuality1to10 := prevQ;
- GLForm1.recompileShader(10, gPrefs.RayCastQuality1to10);
- end;
- {$IFDEF LCLCocoa}
- GLBox.Invalidate; //at least for Cocoa we need to reset this or the user will see the final tile
- {$ENDIF}
- //clipbox.caption := inttostr(gettickcount - tic);
-end;
-
-function TGLForm1.ScreenShot(Zoom: integer): TBitmap;
-begin
- if (Zoom = 1) and (gPrefs.SliceView <> 5) then begin
- result := ScreenShotX1;
- exit;
- end;
- if (gPrefs.isTiledScreenShot) and (gPrefs.SliceView <> 5) then
- result := ScreenShotTiled(Zoom)
- else
- result := ScreenShotNoTile(Zoom);
-
-end;
-
-{$ENDIF} //if COREGL else not CORE
-
-{$ELSE} //If FPC else Delphi
-
-function TGLForm1.ScreenShot(Zoom: integer): TBitmap;
-var
- p: bytep0;
- tile, w,h, wz,hz, x, y, tilex,tiley, BytePerPixel: integer;
- z:longword;
- DestPtr: PInteger;
-begin
- gRayCast.ScreenCapture := true;
- GLBox.MakeCurrent;
- w := GLBox.Width;
- h := GLbox.Height;
- wz := w*Zoom;
- hz := h*Zoom;
- Result:=TBitmap.Create;
- Result.Width:=wz;
- Result.Height:=hz;
- Result.PixelFormat := pf24bit;
- BytePerPixel := 3;
- GetMem(p, w*h*4);
- for tile := 0 to ((Zoom * Zoom) - 1) do begin
- tilex := (tile mod zoom) * w;
- tiley := (tile div zoom) * h;
- DisplayGLz(gTexture3D, Zoom, -tilex, -tiley,0,true);
- glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, @p[0]);
- z := 0;
- for y:=0 to h-1 do begin
- DestPtr := Result.ScanLine[(hz-1) - (Y+tiley)]; //[ Y+tiley];
- //if tilex > 0 then
- Inc(PByte(DestPtr), tilex * BytePerPixel);
- for x:=0 to w-1 do begin
- DestPtr^ := p^[z+2]+(p^[z+1] shl 8)+(p^[z] shl 16);
- Inc(PByte(DestPtr), BytePerPixel);
- z := z + 4;
- end;
- end;
- end;
- FreeMem(p);
- GLbox.ReleaseContext;
- gRayCast.ScreenCapture := false;
-end;
-{$ENDIF}
-
-procedure TGLForm1.loadLabelsDefault;
-var
- nColors: integer;
- NewItem: TMenuItem;
- s: string;
-begin
- while DrawTool1.Count > 2 do
- DrawTool1.Delete(2); //delete all pens except disable and erase
- for nColors := 1 to 9 do begin
- NewItem := TMenuItem.Create(Self);
- NewItem.onclick := DrawTool1Click;
- NewItem.AutoCheck := true;
- NewItem.RadioItem := true;
- NewItem.GroupIndex := 189;
- NewItem.Tag := nColors;
- {$IFDEF Darwin}
- NewItem.ShortCut := ShortCut(Word(inttostr(nColors)[1]), [ssMeta]);
- {$ELSE}
- NewItem.ShortCut := ShortCut(Word(inttostr(nColors)[1]), [ssCtrl]);
- {$ENDIF}
- case nColors of
- 2: s := 'Green';
- 3: s := 'Blue';
- 4: s := 'Orange';
- 5: s := 'Purple';
- 6: s := 'Cyan';
- 7: s := 'Brick';
- 8: s := 'Lime';
- 9: s := 'Sky';
- else s := 'Red';
- end;
- NewItem.Caption := s;
- DrawTool1.Add(NewItem);
- end; //for each color
-end;
-
-function str2int (s: string): integer;
-begin
-result := 0;
-try
- result := StrToInt(s); // Trailing blanks are not supported
-except
-on Exception : EConvertError do
- ShowMessage(Exception.Message);
-end;
-end;
-
-function TGLForm1.loadLabelsITK(fnm: string): boolean;
-label
- 666;
-var
- strs, strDelim : TStringList;
- l, nColors, R,G,B,Idx: integer;
- lValid : boolean;
- NewItem: TMenuItem;
- s: string;
-begin
- result := false;
- if not fileexists(fnm) then exit;
- strs := TStringList.Create;
- strDelim := TStringList.Create;
- //strLabel := TStringList.Create;
- strs.LoadFromFile(fnm);
- if (strs.Count < 1) then goto 666;
- lValid := false;
- nColors := 0;
- While DrawTool1.Count > 2 do
- DrawTool1.Delete(2); //delete all pens except disable and erase
- for l := 0 to (strs.Count-1) do begin
- if strs.Strings[l] = '# ITK-SnAP Label Description File' then
- lValid := true
- else if strs.Strings[l][1] = '#' then
- //
- else begin
- strDelim.DelimitedText := strs.Strings[l];
- if (strDelim.Count = 8) then begin
- idx := str2int(strDelim.Strings[0]);
- if (idx > 0) and (idx < 256) then begin
- r := str2int(strDelim.Strings[1]);
- g := str2int(strDelim.Strings[2]);
- b := str2int(strDelim.Strings[3]);
- voiColor (idx, r, g, b);
- inc(nColors);
- NewItem := TMenuItem.Create(Self);
- NewItem.onclick := DrawTool1Click;
- NewItem.AutoCheck := true;
- NewItem.RadioItem := true;
- NewItem.GroupIndex := 189;
- NewItem.Tag := idx;
- if nColors < 10 then begin
- s := inttostr(nColors);
- {$IFDEF Darwin}
- NewItem.ShortCut := ShortCut(Word(s[1]), [ssMeta]);
- {$ELSE}
- NewItem.ShortCut := ShortCut(Word(s[1]), [ssCtrl]);
- {$ENDIF}
- end;
- NewItem.Caption :=strDelim.Strings[7];
- DrawTool1.Add(NewItem);
- //strLabel.Add (strDelim.Strings[7]);
- end; //idx 1..255
- end; //8 items
- end; //not comment
- end; //for each line
-
- if (not lValid)or (nColors < 1) then begin
- Showmessage('This does not appear to be a valid ITK-SnAP Label Description File');
- goto 666;
- end;
- result := true;
-
- 666:
- strDelim.free;
- strs.Free;
- if not result then
- loadLabelsDefault;
- GLBox.Invalidate; //refresh colors
-end;
-
-procedure TGLForm1.StopScripts;
-begin
- {$IFDEF ENABLESCRIPT}
- ScriptForm.Stop1Click(nil);
- {$ENDIF}
-end;
-
-
-
-procedure TGLForm1.UpdateGL;
-begin
- GLBox.invalidate;//IF YOU GET AN ERROR HERE UNCOMMENT THE LINE "//GLBox:TOpenGLControl; "
- //caption := '----'+inttostr(random(888));
-end;
-{$IFNDEF FPC}
-procedure TGLForm1.WMDropFiles(var Msg: TWMDropFiles); //implement drag and drop
-var CFileName: array[0..MAX_PATH] of Char;
-begin
- try
- if DragQueryFile(Msg.Drop, 0, CFileName, MAX_PATH) > 0 then begin
- LoadDatasetNIFTIvol1(CFilename,true);
- Msg.Result := 0;
- end;
- finally
- DragFinish(Msg.Drop);
- end;
-end;//Proc WMDropFiles
-{$ENDIF}
-
-procedure ScreenRes(var lVidX,lVidY: integer);
-{$IFDEF FPC}
-begin
- lVidX := Screen.Width;
- lVidY := Screen.Height;
-end;
-{$ELSE}
-var
- DC: HDC;
-begin
- DC := GetDC(0);
- try
- lVidX :=(GetDeviceCaps(DC, HORZRES));
- lVidY :=(GetDeviceCaps(DC, VERTRES));
- finally
- ReleaseDC(0, DC);
- end; // of try/finally
-end;//screenres
-{$ENDIF}
-
-procedure TGLForm1.SetFormSize(FormWidth,FormHeight: integer);
-//{$IFNDEF Darwin}
-var
- lVidX,lVidY: integer;
- //{$ENDIF}
-begin
- //{$IFNDEF Darwin} //Previously Darwin did not resize the GLSceneViewer correctly... seems to work 0.9.30 with Intel Sandy Bridge
-
- ScreenRes(lVidX,lVidY);
- {$IFDEF FPC} {$IFNDEF UNIX}
- (* //2018 - bad idea with high dpi Windows screens
- if Screen.PixelsPerInch <> 96 then begin
- FormWidth := round(FormWidth* (96/Screen.PixelsPerInch));
- FormHeight := round(FormHeight* (96/Screen.PixelsPerInch));
- //ClipBox.Caption := INTTOSTR(Screen.PixelsPerInch)+' '+ inttostr(FormWidth)+'x'+inttostr(FormHeight)+' '+inttostr(lVidx)+'x'+inttostr(lVidY);
- end;*)
-{$ENDIF}{$ENDIF}
-
- if lVidX > FormWidth then
- GLForm1.Width := FormWidth;
- if (lVidy-20) > FormHeight then //give a bit of room for dock
- GLForm1.Height := FormHeight;
-end;
-
-procedure TGLForm1.StopTimers;
-begin
- UpdateTimer.enabled := false;
-end;
-
-(*procedure TGLForm1.SelectIntensityMinMax(lMin,lMax: single);
-var
- mn,mx,range: single;
- lLog10: integer;
-begin
- if lMin > lMax then begin
- mn := lMax;
- mx := lMin;
- end else begin
- mn := lMin;
- mx := lMax;
- end;
- lLog10 := trunc(log10( mx-mn))-1;
- mn := roundto(mn,lLog10);
- mx := roundto(mx,lLog10);
-
- gCLUTrec.min := mn;
- gCLUTrec.max := mx;
- MinEdit.text := float2str(mn, 3);
- MaxEdit.text := float2str(mx,3);
- M_refresh := true;
-end; *)
-procedure TGLForm1.SelectIntensityMinMax(lMin,lMax: single);
-var
- mn,mx,range: single;
- lDec: integer;
-begin
- if lMin > lMax then begin
- mn := lMax;
- mx := lMin;
- end else begin
- mn := lMin;
- mx := lMax;
- end;
- range := abs(lMax-lMin);
- lDec := 2 - trunc(log10(range));
- if lDec < 0 then
- lDec := 0;
- if lDec > 8 then
- lDec := 8;
- (*if range > 10000 then
- lDec := 0
- else if range > 1000 then
- lDec := 1
- else if range > 100 then
- lDec := 2
- else if range > 10 then
- lDec := 3
- else if range > 0.05 then
- lDec := 4
- else
- lDec := 6;*)
- gCLUTrec.min := mn;
- gCLUTrec.max := mx;
- MinEdit.text := realtostr(mn,lDec);
- MaxEdit.text := realtostr(mx,lDec);
- M_refresh := true;
-end;
-
-procedure TGLForm1.SelectCube(lShow: boolean);
-begin
- Orient1.checked := lShow;
- Orient1Click(nil);
-end;
-
-(*procedure TGLForm1.Select2Dor3D(l3D: boolean);
-begin
- OrthoSlice.checked := not l3D;
- gPrefs.OrthoSliceView := OrthoSlice.checked;
- GLbox.Invalidate;
-end; *)
-
-procedure TGLForm1.SelectShowTools(lShow: boolean);
-begin
- Tool1.checked := lShow;
- Tool1Click(nil);
-end;
-
-procedure TGLForm1.SelectShowColorEditor(lShow: boolean);
-begin
- ToggleTransparency1.checked := lshow;
- ToggleTransparency1Click(nil);
-end;
-
-function TGLForm1.LoadDatasetNIFTIvol1(lFilename: string; lStopScript: boolean): boolean;
-begin
- result := LoadDatasetNIFTIVol(lFilename, lStopScript, 1);
-end;
-
-function AddExtSearchImg (var lFilenameX: string): boolean;
-//see if we can find a file by adding .nii, .hdr or .nii.gz to filename..
-var lFilename: string;
-begin
- result := true;
- if fileexistsEx(lFilenameX) then exit;
- lFilename := lFilenameX;
- lFilenameX := lFilename+'.hdr';
- if fileexistsEx(lFilenameX) then
- exit;
- lFilenameX := lFilename+'.nii';
- if fileexistsEx(lFilenameX) then
- exit;
- lFilenameX := lFilename+'.voi';
- if fileexistsEx(lFilenameX) then
- exit;
- lFilenameX := lFilename+'.nii.gz';
- if fileexistsEx(lFilenameX) then
- exit;
- if (UpCaseExt(lFilename) = '.NII') then begin
- lFilenameX := lFilename+'.gz';
- if fileexistsEx(lFilenameX) then
- exit;
- end;
- result := false;
-end;
-
-function AddExtSearchBMP (var lFilenameX: string): boolean;
-//see if we can find a file by adding .nii, .hdr or .nii.gz to filename..
-var lFilename: string;
-begin
- result := true;
- if fileexists(lFilenameX) then exit;
- lFilename := lFilenameX;
- lFilenameX := lFilename+'.png';
- if fileexists(lFilenameX) then
- exit;
- lFilenameX := lFilename+'.jpg';
- if fileexists(lFilenameX) then
- exit;
- lFilenameX := lFilename+'.bmp';
- if fileexists(lFilenameX) then
- exit;
- result := false;
-end;
-
-function AddExtSearch (var lFilenameX: string; lBitmap: boolean): boolean;
-begin
- if lBitmap then
- result := AddExtSearchBMP(lFilenameX)
- else
- result := AddExtSearchImg(lFilenameX);
-end;
-
-procedure TGLForm1.DrawMosaic(Str: string);
-begin
- gRayCast.MosaicString := Str;
- MosaicText.Font.Color := clBlack;
- GLBox.invalidate;
-end;
-
-{$IFDEF Darwin}
-function ParentOfAppFolder: string;
-var
- lS,lSapp: String;
- lL,lP : integer;
-begin
- result := '';
- lS := extractfilepath(paramstr(0));
- lL:= length(lS);
- lP := lL;
- lSapp := '';
- while (lP > 1) and (lSapp <> '.APP') do begin
- if lS[lP] = pathdelim then
- lSapp := ''
- else
- lSapp := upcase(lS[lP])+lSapp;
-
- dec(lP);
- end;
- if lP < 2 then
- exit;
- lSapp := '';
- for lL := 1 to lP do
- lSapp := lSapp + lS[lL];
- result := ExtractFileDirWithPathDelim(lSapp);
-end;
-{$ENDIF}
-
-function TGLForm1.CheckFilename (var lFilenameX: string; lBitmap: boolean): boolean;
-//find a file even if the file name is missing an extension or does not have a path
-var
- lFilename: string;
-begin
- result := false;
- if lFilenameX = '' then exit;
- result := true;
- if fileexistsEx(lFilenameX) then exit;
- lFilename := lFilenameX;
- lFilenameX := GetCurrentDir + pathdelim + lFilename;
- if AddExtSearch(lFilenameX,lBitmap) then
- exit;
- lFilenameX := lFilename;
- if AddExtSearch(lFilenameX,lBitmap) then
- exit;
- {$IFDEF Darwin}
- lFilenameX := ParentOfAppFolder + extractfilename(lFilename);
- if AddExtSearch(lFilenameX,lBitmap) then
- exit;
- lFilenameX := AppDir2 + extractfilename(lFilename);
- if AddExtSearch(lFilenameX,lBitmap) then
- exit;
- {$ENDIF}
- lFilenameX := DefaultsDir('') + extractfilename(lFilename);
- if AddExtSearch(lFilenameX,lBitmap) then
- exit;
- lFilenameX := ExtractFileDirWithPathDelim(gPrefs.PrevFilename[1]) + extractfilename(lFilename);
- if AddExtSearch(lFilenameX,lBitmap) then
- exit;
- lFilenameX := ExtractFileDirWithPathDelim(gPrefs.PrevScriptName[1]) + extractfilename(lFilename);
- if AddExtSearch(lFilenameX,lBitmap) then
- exit;
- lFilenameX := ExtractFileDirWithPathDelim(GetCurrentDir) + extractfilename(lFilename);
- if AddExtSearch(lFilenameX,lBitmap) then
- exit;
- //next Aug 2009 - check executable's directory... (same as CurrentDir for Windows, different for Linux)
- lFilenameX := ExtractFileDirWithPathDelim(paramstr(0)) + extractfilename(lFilename);
- if AddExtSearch(lFilenameX,lBitmap) then
- exit;
- //unable to find a match!
- lFilenameX := lFilename;
- if fileexistsEx(lFilenameX) then exit;
- result := false;
-end;
-
-procedure TGLForm1.ResetSliders;
-begin
- //make sure we are not showing cutout when we load a new image... otherwise gradient might be cut
- //SetShader(ShaderDir+pathdelim+ShaderDrop.Items[0]);
- ShaderDrop.ItemIndex := 0;
- ShaderDropChange(nil);
- GLForm1.Closeoverlays1Click(nil);
- XTrackBar.Position := 0;
- X2TrackBar.Position := 0;
- ClipTrack.Position := 0;
- gRayCast.Distance := kDefaultDistance;
- gRayCast.Azimuth := 110;
- gRayCast.Elevation := 15;
- gRayCast.LightAzimuth := 0;
- gRayCast.LightElevation := 70;
-end;
-
-procedure TGLForm1.TerminateRendering;
-//OSX crashes when you open a modal dialog while OpenGL is working...
-begin
- UpdateTimer.Enabled := false;
- while gRendering do
- application.ProcessMessages;
-end;
-
-procedure TGLForm1.RunScriptClick(Sender: TObject);
-begin
- GLForm1.DrawMosaic(MosaicText.Text);
-end;
-procedure TGLForm1.CopyScriptClick(Sender: TObject);
-begin
- {$IFDEF FPC}
- Clipboard.AsText := MosaicText.Text;
- //MosaicText.Text := 'not yet implemented';
- {$ELSE}
- Clipboard.AsText := MosaicText.Text;
- {$ENDIF}
-end;
-
-function lerpFraction (frac: single; min,max: single): integer;
-var
- f: single;
-begin
- if frac < 0.0 then
- f := min
- else if frac > 1.0 then
- f := max
- else
- f := min + (frac * (max-min));
- result := round (f);
- if odd(result) then result := result + 1;
- if result > max then result := result -2;
-end;
-
-function isMNISpace: boolean;
-var
- lXYZmmMin, lXYZmmMax : array[1..3] of single;
-begin
- lXYZmmMin[1] := 1;
- lXYZmmMin[2] := 1;
- lXYZmmMin[3] := 1;
- Voxel2mm(lXYZmmMin[1],lXYZmmMin[2],lXYZmmMin[3],gTexture3D.NIfTIHdr);
- lXYZmmMax[1] := gTexture3D.FiltDim[1];
- lXYZmmMax[2] := gTexture3D.FiltDim[2];
- lXYZmmMax[3] := gTexture3D.FiltDim[3];
- Voxel2mm(lXYZmmMax[1],lXYZmmMax[2],lXYZmmMax[3],gTexture3D.NIfTIHdr);
- SortSingle(lXYZmmMin[1],lXYZmmMax[1]);
- SortSingle(lXYZmmMin[2],lXYZmmMax[2]);
- SortSingle(lXYZmmMin[3],lXYZmmMax[3]);
- result := (lXYZmmMin[1] < -70) and (lXYZmmMax[1] > 70) and
- (lXYZmmMin[2] < -100) and (lXYZmmMax[2] > 70) and
- (lXYZmmMin[3] < -38) and (lXYZmmMax[3] > 76);
-
-end;
-procedure TGLForm1.UpdateMosaic(Sender: TObject);
-var
- lXYZmmMin, lXYZmmMax : array[1..3] of single;
- isMNISpaceV: boolean;
- lRi,lCi,lR,lC,lRxC,lI, lmm, lO: integer;
- lInterval, lFrac: single;
- lOrthoCh: Char;
- lStr: string;
-begin
- //work out MNI space
- //gTexture3D.FiltDim[1]);
- lXYZmmMin[1] := 1;
- lXYZmmMin[2] := 1;
- lXYZmmMin[3] := 1;
- Voxel2mm(lXYZmmMin[1],lXYZmmMin[2],lXYZmmMin[3],gTexture3D.NIfTIHdr);
- lXYZmmMax[1] := gTexture3D.FiltDim[1];
- lXYZmmMax[2] := gTexture3D.FiltDim[2];
- lXYZmmMax[3] := gTexture3D.FiltDim[3];
- Voxel2mm(lXYZmmMax[1],lXYZmmMax[2],lXYZmmMax[3],gTexture3D.NIfTIHdr);
- SortSingle(lXYZmmMin[1],lXYZmmMax[1]);
- SortSingle(lXYZmmMin[2],lXYZmmMax[2]);
- SortSingle(lXYZmmMin[3],lXYZmmMax[3]);
- (*isMNISpace := (lXYZmmMin[1] < -70) and (lXYZmmMax[1] > 70) and
- (lXYZmmMin[2] < -100) and (lXYZmmMax[2] > 70) and
- (lXYZmmMin[3] < -38) and (lXYZmmMax[3] > 76); *)
- isMNISpaceV := isMNISpace;
- //caption := format('%g..%g %g..%g %g..%g',[lXYZmmMin[1],lXYZmmMax[1],lXYZmmMin[2],lXYZmmMax[2],lXYZmmMin[3],lXYZmmMax[3] ]);
- //if not MosaicPrefsForm.Visible then exit;
- lR := RowEdit.value;
- lC := ColEdit.value;
- lRxC := lR * lC;
- if lRxC < 1 then
- exit;
- if (lRxC > 1) and (CrossCheck.Checked) then
- lInterval := 1 / (lRxC) //with cross-check, final image will be 0.5
- else
- lInterval := 1 / (lRxC+1);
- lCi := OrientDrop.ItemIndex;
- case lCi of
- 1 : lStr := 'C';//coronal
- 2 : lStr := 'S'; //Sag
- 3 : lStr := 'Z'; //rev Sag
- else lStr := 'A'; //axial
- end; //Case
- lO := lCi;
- case lCi of
- 1 : lOrthoCh := 'S';//coronal
- 2 : lOrthoCh := 'C'; //Sag
- 3 : lOrthoCh := 'C'; //rev Sag
- else lOrthoCh := 'S'; //axial
- end; //Case
- lStr := lStr + ' ';
- //next Labels...
- if LabelCheck.checked then
- lStr := lStr + 'L+ ';
- //next horizonatal overlap
- if ColOverlap.Position <> 0 then
- lStr := lStr +'H '+ FloatToStrF(ColOverlap.Position/10, ffGeneral, 4, 3)+ ' ';
- //next vertical overlap
- if RowOverlap.Position <> 0 then
- lStr := lStr +'V '+ FloatToStrF(RowOverlap.Position/10, ffGeneral, 4, 3) + ' ';
- //next draw rows....
- lI := 0;
- for lRi := 1 to lR do begin
- for lCi := 1 to lC do begin
- inc(lI);
- if (lI = lRxC) and (CrossCheck.Checked) then begin
- if isMNISpaceV then
- lStr := lStr +lOrthoCh + ' X R 0' //maybe "X" used to disable text on cross slice? perhaps "L-"
- else
- lStr := lStr +lOrthoCh + ' X R 0.5' //maybe "X" used to disable text on cross slice? perhaps "L-"
- //lStr := lStr + 'X '+lOrthoCh + ' 0.5'
- end else begin
- lFrac := lI * lInterval;
- if isMNISpaceV then begin
- case lO of
- 1 : lmm := lerpFraction(lFrac, lXYZmmMin[2],lXYZmmMax[2]);//coronal
- 2,3 : lmm := lerpFraction(lFrac, lXYZmmMin[1],lXYZmmMax[1]); //Sag
- else lmm := lerpFraction(lFrac, lXYZmmMin[3],lXYZmmMax[3]); //axial
- end; //Case
- lStr := lStr + InttoStr(lmm);
- //lStr := lStr + FloatToStrF(lFrac, ffFixed, 8, 4);
- end else
- lStr := lStr + FloatToStrF(lFrac, ffGeneral, 8, 4);
- end;
- if lCi < lC then
- lStr := lStr + ' ';
- end; //for each column
- if lRi < lR then
- lStr := lStr +'; ';
- end;//for each row
- MosaicText.Text := lStr;
- GLForm1.DrawMosaic(lStr);
-end;
-
-function TGLForm1.LoadDatasetNIFTIvol(lFilename: string; lStopScript: boolean; lVolume: integer): boolean;
-var
- lFilenameX: string;
-begin
- result := false;
- UpdateTimer.Enabled := false;
- if lStopScript then
- StopScripts;
- while gRendering do
- application.ProcessMessages;
- gRendering := true;
- if (not voiIsEmpty) and (voiIsModified) then
- SaveVOI1Click(nil);
- lFilenameX := lFilename;
- if lFilenameX <> '' then
- result := CheckFilename (lFilenameX,false);
- //caption := lFilename +' --> '+lFilenameX;
- ResetSliders;
- if lVolume > 0 then
- M_Reload := lVolume
- else
- M_reload := 1;
- //caption := inttostr(lVolume)+' '+inttostr(M_reload);
- OpenDialog1.FileName := lFilenameX;
- AreaInitialized := false;
- gRendering := false;
- GLbox.Invalidate;
- GLForm1.Refresh;
-end; //LoadDatasetNIFTI
-
-function TGLForm1.LoadDatasetNIFTIvolx(lFilename: string; lStopScript: boolean): boolean;
-var
- lnVol : integer;
-begin
- UpdateTimer.Enabled:=false;
- result := false;
-
- {x$IFDEF USETRANSFERTEXTURE}
- //x lnVol := 1;
-{x$ELSE}
- if lFilename = '' then
- lnVol := 1
- else
- lnVol := NIFTIvolumes(lFilename);
- //caption := inttostr(lnVol);
- //if lnVol < 1 then lnVol := 1;
- if lnVol < 1 then
- exit;
- if lnVol > 1 then
- lnVol := ReadIntForm.GetInt(extractfilename(lFilename)+' select volume',1,1,lnVol);
- {x$ENDIF}
- result := LoadDatasetNIFTIVol(lFilename, lStopScript, lnVol);
-end;
-
-procedure TGLForm1.OpenMRU(Sender: TObject);//open template or MRU
-//Templates have tag set to 0, Most-Recently-Used items have tag set to position in gMRUstr
-var
- lFilename: string;
-begin
- if Sender = nil then
- lFilename := gPrefs.PrevFilename[1]
- else
- lFilename := gPrefs.PrevFilename[(Sender as TMenuItem).tag];
-
- LoadDatasetNIFTIvolx(lFilename,true);
-end;
-
-procedure TGLForm1.UpdateMRU;//most-recently-used menu
-const
-
- kMenuItems = 5;//515) Check Darwin: no File/Exit with OSX users quit from application menu
-var
- lPos,lN,lM : integer;
-begin
- lN := File1.Count-kMenuItems;
- if lN > knMRU then
- lN := knMRU;
- lM := kMenuItems;
- for lPos := 1 to lN do begin
- if gPrefs.PrevFilename[lPos] <> '' then
- begin
-
- File1.Items[lM].Caption :=ExtractFileName(gPrefs.PrevFilename[lPos]);//(ParseFileName(ExtractFileName(lFName)));
- File1.Items[lM].Tag := lPos;
- File1.Items[lM].onclick := OpenMRU; //Lazarus
- File1.Items[lM].Visible := true;
- //Number key shortcuts used for pens!
- //if lPos < 10 then
- {$IFDEF Darwin}
- File1.Items[lM].ShortCut := ShortCut(Word('1')+ord(lPos-1), [ssMeta]);
- {$ELSE}
- //File1.Items[lM].ShortCut := ShortCut(Word('1')+ord(lPos-1), [ssCtrl]);
- {$ENDIF}
- end else
- File1.Items[lM].Visible := false;
- inc(lM);
- end;//for each MRU
-end; //UpdateMRU
-
-procedure TGLForm1.OpenColorScheme(Sender: TObject);
-begin
- LUTChange(sender);
- MinEdit.Text := floattostr(gCLUTrec.min);
- MaxEdit.Text := floattostr(gCLUTrec.max);
- UpdateTimer.Enabled := true;
-end;
-
-(*procedure TGLForm1.FormResize(Sender: TObject);
-begin
- AreaInitialized := false;
- GLbox.Invalidate;
- ShaderBoxResize(Sender);
-end; *)
-
-procedure TGLForm1.ExitButton1Click(Sender: TObject);
-begin
- Close;
-end;
-
-procedure TGLForm1.SelectSliceView(lView: integer);
-begin
- gPrefs.SliceView := lView;
- case gPrefs.SliceView of
- 1: Axial1.checked := true;
- 2: Coronal1.checked := true;
- 3: Sagittal1.checked := true;
- 4: MPR1.checked := true;
- 5: Mosaic1.checked := true;
- else Render1.checked := true;
-
- end;
- SetToolPanelWidth;
- //{$IFDEF FPC} GLBox.Invalidate; {$ENDIF} //this will crash Delphi as GLBox not yet created
-end;
-
-procedure TGLForm1.DisplayRadiological;
-begin
- if gPrefs.FlipLR then begin //radiological view shows Left on Right
- if LeftBtn.Caption = 'R' then exit;
- LeftBtn.Caption := 'R';
- RightBtn.Caption := 'L';
- Slice2DBox.refresh;
- exit;
- end;
- if LeftBtn.Caption = 'L' then exit;
- LeftBtn.Caption := 'L';
- RightBtn.Caption := 'R';
- Slice2DBox.refresh;
-end;
-
-procedure TGLForm1.DisplayPrefs;
-begin
- Orient1.checked := gPrefs.SliceDetailsCubeAndText;
- RadiologicalMenu.Checked := gPrefs.FlipLR;
- DisplayRadiological;
- ToggleTransparency1.checked := gPrefs.ColorEditor;
- Tool1.checked := gPrefs.ShowToolbar;
- ToolPanel.Visible := gPrefs.ShowToolbar;
- CollapsedToolPanel.Visible := not ToolPanel.Visible;
- //OrthoSlice.checked := gPrefs.OrthoSliceView;
- VisibleClrbarMenu.Checked := gPrefs.Colorbar;
- SelectSliceView(gPrefs.SliceView);
- OverlayColorFromZeroMenu.checked := gPrefs.OverlayColorFromZero;
- LineWidthEdit.Value := gPrefs.CrosshairThick;
- SetToolPanelWidth; //4/2017: show correct tool panel when script runs ResetDefaults()
-end;
-
-{$IFDEF LCLCocoa}
-function SimpleGetInt(lPrompt: string; lMin,lDefault,lMax: integer): integer;
-var
- i: integer;
-begin
- i := MessageDlg('Set graphics (abort=old, cancel=fair, ok=good)',mtInformation,[mbIgnore , mbAbort, mbCancel, mbOK],0);
- if i = mrIgnore then
- result := 0
- else if i = mrAbort then
- result := 1
- else if i = mrCancel then
- result := 2
- else
- result := 3;
- //(0=old, 1=poor, 2=ok, 3=great
-
-end;
-{$ELSE}
-function SimpleGetInt(lPrompt: string; lMin,lDefault,lMax: integer): integer;
-var
- lStr: string;
-begin
- result := lDefault;
- lStr := inttostr(lDefault);
-
- if not InputQuery ('Enter a value '+inttostr(lMin)+'..'+inttostr(lMax), lPrompt, lStr) then exit;
- result := strtoint(lStr);
- result := Bound (result,lMin,lMax);
-end;
-{$ENDIF}
-const
-kFname=0;
-kLUT=1;
-kMin=2;
-kMax=3;
-
-procedure InitOverlay (lOverlayIndex: integer);
-begin
- gOverlayImg[lOverlayIndex].ImgBufferItems := 0;
- gOverlayImg[lOverlayIndex].ScrnBufferItems := 0;
- gOverlayImg[lOverlayIndex].ImgBufferUnaligned := nil;
- gOverlayImg[lOverlayIndex].ImgBuffer := nil;
- gOverlayImg[lOverlayIndex].ScrnBuffer := nil;
-end;
-
-procedure InitOverlays;
-var
- I: integer;
-begin
- gOpenOverlays := 0;
- for I := kMinOverlayIndex to kMaxOverlays do
- InitOverlay(I);
-end;
-
-procedure TGLForm1.OverlayBoxCreate;
-begin
- InitOverlays;
- InterpolateMenu.checked := gPrefs.InterpolateOverlays;
- OverlayColorFromZeroMenu.checked := gPrefs.OverlayColorFromZero;
- SetSubmenuWithTag(Onotheroverlays1,gPrefs.OverlayAlpha);
- SetOverlayAlphaValue( gPrefs.OverlayAlpha);
- SetBackgroundAlphaValue( gPrefs.BackgroundAlpha);
- SetSubmenuWithTag(Onbackground1,gPrefs.BackgroundAlpha);
- StringGrid1.Selection := TGridRect(Rect(-1, -1, -1, -1));
- StringGrid1.DefaultRowHeight := LUTdrop.Height+1;
- StringGrid1.DefaultColWidth := (StringGrid1.width div 4)-2;
- {$IFDEF FPC} {$IFNDEF UNIX} //removed July 2017: Lazarus 1.8 repainting issues?
- //if Screen.PixelsPerInch <> 96 then
- // StringGrid1.DefaultColWidth := round(StringGrid1.width* (Screen.PixelsPerInch/96) * 0.25) - 2;
-{$ENDIF}{$ENDIF}
- //{$ENDIF}
- //LUTdrop.Visible := False;
- //UpdateColorSchema;
- StringGrid1.Cells[kFname, 0] := 'Name';
- StringGrid1.Cells[kLUT, 0] := 'Color';
- StringGrid1.Cells[kMin, 0] := 'Min';
- StringGrid1.Cells[kMax, 0] := 'Max';
-
- LUTdrop.Items.Clear;
- LUTdrop.Items.Add('Grayscale');
- LUTdrop.Items.Add('Red');
- LUTdrop.Items.Add('Green');
- LUTdrop.Items.Add('Blue');
- LUTdrop.Items.Add('Violet [r+b]');
- LUTdrop.Items.Add('Yellow [r+g]');
- LUTdrop.Items.Add('Cyan [g+b]');
- UpdateColorSchemes(LUTdrop);
-end;
-
-procedure TGLForm1.FormCreate(Sender: TObject);
- var
- lQuality, i: integer;
- forceReset: boolean;
- s: string;
- c: char;
-begin
-{$IFDEF FPC} Application.ShowButtonGlyphs:= sbgNever; {$ENDIF}
- forceReset := false;
- gPrefs.InitScript := '';
- i := 1;
- while i <= ParamCount do begin
- s := ParamStr(i);
- if (length(s)> 1) and (s[1]='-') then begin
- c := upcase(s[2]);
- if c='R' then
- forceReset := true
- else if (i < paramcount) and (c='S') then begin
- inc(i);
- gPrefs.InitScript := ParamStr(i);
- end;
- end else //length > 1 char
- gPrefs.initScript := ParamStr(i);
- inc(i);
- end; //for each parameter
- if (not ResetIniDefaults) and (not forceReset) then
- IniFile(true,IniName,gPrefs)
- else begin
- SetDefaultPrefs(gPrefs,true);//reset everything to defaults!
- lQuality := SimpleGetInt('Set graphics card (0=old, 1=poor, 2=ok, 3=great)',0,3,3);
- if lQuality = 0 then gPrefs.ForcePowerOfTwo := True
- else
- gPrefs.ForcePowerOfTwo := False;
- if lQuality = 1 then begin gPrefs.BitDepth:= 16; gPrefs.MaxVox := 90; gPrefs.RayCastQuality1to10 := 8; end;
- if lQuality = 2 then begin gPrefs.BitDepth := 24; gPrefs.MaxVox := 256; gPrefs.RayCastQuality1to10 := 5; end;
- if lQuality = 3 then begin gPrefs.BitDepth := 24; gPrefs.MaxVox := 2048; gPrefs.RayCastQuality1to10 := 8; end;
- if gPrefs.FasterGradientCalculations then
- lQuality := 1
- else
- lQuality := 0;
- lQuality := SimpleGetInt('Set gradient calculation (0=slow[CPU], 1=fast[GPU])',0,lQuality,1);
- gPrefs.FasterGradientCalculations:= (lQuality <> 0);
- end;
- //gPrefs.FasterGradientCalculations := true;
- OpenDialog1.filter := kImgPlusVOIFilter;
- M_reload := 0;
- InitTexture(gTexture3D);
- OverlayBoxCreate;//after we read defaults
- //{$IFNDEF FPC}
- // gPrefs.FasterGradientCalculations := false; //Delphi GPU code crashes Windows XP computers - Lazarus fine for XP, Delphi fine for Win 7+
- //{$ENDIF}
- {$IFDEF USETRANSFERTEXTURE}
- IntensityBox.Visible := false;
- {$ENDIF}
- {$IFNDEF ENABLESCRIPT}Scripting1.visible := false;{$ENDIF}
- {$IFNDEF ENABLEOVERLAY}Overlays1.Visible := false;{$ENDIF}
- {$IFNDEF ENABLEMOSAICS} Mosaic1.Visible := false;{$ENDIF}
- {$IFNDEF ENABLECUTOUT}
- CutoutBox.Visible := false;
- {$ELSE}
- {$IFDEF USETRANSFERTEXTURE}showmessage('Compiler error: 8-bit image with transfer texture does not yet support cutouts');{$ENDIF}
- {$ENDIF}
- UpdateMRU;
- LoadColorSchemes;
- DisplayPrefs;
- FormCreateShaders; //CreateAllControls;
- {$IFDEF FPC}
- {$IFDEF Darwin}Application.OnDropFiles:= AppDropFiles; {$ENDIF} //for OSX: respond if user drops icon on dock
- Application.ShowButtonGlyphs:= sbgNever;
- GLbox:= TOpenGLControl.Create(GLForm1);
- {$IFDEF COREGL}
- GLbox.OpenGLMajorVersion:= 3;
- GLbox.OpenGLMinorVersion:= 3;
- {$IFDEF Linux}
- writeln('OpenGL 3.3 with 8/8/8/24 bits of R/G/B/Dpth required. Use glxinfo to test capabilities.');
- {$ENDIF}
- {$ELSE}
- {$IFDEF Linux}
- writeln('OpenGL 2.1 with 8/8/8/24 bits of R/G/B/Dpth required. Use glxinfo to test capabilities.');
- {$ENDIF}
- {$ENDIF}
- if gPrefs.BitDepth = 16 then begin//gPrefs.BitDepth = 16 then
- //GLBox.AlphaBits:=0;
- //GLBox.RedBits:=5;
- //GLBox.GreenBits:=6;
- //GLBox.BlueBits:=5;
- GLbox.DepthBits:= 16 //Some mesa implementations do not support 16 bit depths
- end else
- gPrefs.BitDepth := 24;
- GLbox.AutoResizeViewport:= true; // http://www.delphigl.com/forum/viewtopic.php?f=10&t=11311
- GLBox.Parent := GLForm1;
- GLBox.MultiSampling:= 4;
- GLBox.OnMouseWheel := GLboxMouseWheel;
- GLBox.OnPaint := GLboxPaint;
- {$ELSE}
- DragAcceptFiles(GLForm1.Handle, True);
- lQuality := DetectMutliSampleMode(4,GLForm1);
- GLBox := TGLPanel.Create(GLForm1);
- GLBox.Parent := GLForm1;
- rglSetupGL(GLbox, lQuality);
- {$ENDIF}
- GLBox.Align := alClient;
- //GLBox.ParentBackground:= false;
-
- GLBox.OnMouseDown := GLboxMouseDown;
- GLBox.OnMouseMove := GLboxMouseMove;
- GLBox.OnMouseUp := GLboxMouseUp;
- GLBox.OnDblClick := GLboxDblClick;
- GLBox.OnResize:= GLboxResize;
- //GLBox.DepthBits:= 0; //if set to zero, uncomment raycastglsl.pas glEnable(GL_CULL_FACE);
- ShaderDropChange(Sender);
- {$IFNDEF Cocoa}
- if gPrefs.FormMaximized then
- GLForm1.WindowState := wsMaximized
- else
- SetFormSize(gPrefs.FormWidth,gPrefs.FormHeight);
- {$ENDIF}
- //VolumeFilename := '+';
- MousePt.X := -1;
- // loadlabelsITK('/Users/rorden/Documents/test.txt');
- {$IFDEF Darwin} //only for Carbon compile
- // OnDropFiles := DropFiles;
- //GLBox.DoubleBuffered:= false; // DoubleBuffered
- // Help1.visible := false;
- About1.visible := false;
- Preferences1.visible := false;
- //Edit1.visible := false;
- NewWindow1.Visible:= true;
- Exit1.visible := false;//with OSX users quit from application menu
- //Copy1.enabled := false;
- Copy1.ShortCut:= ShortCut(Word('C'), [ssMeta]); ;
- Open1.ShortCut := ShortCut(Word('O'), [ssMeta]);
- Overlays1.ShortCut := ShortCut(Word('O'), [ssShift, ssMeta]);
- Tool1.ShortCut := ShortCut(Word('T'), [ssMeta]);
- //ToggleTransparency1.ShortCut := ShortCut(Word('A'), [ssMeta]);
- Backcolor1.ShortCut := ShortCut(Word('B'), [ssMeta]);
- InterpolateRecentMenu.ShortCut := ShortCut(Word('X'), [ssMeta]);
- //Copy1.ShortCut := ShortCut(Word('C'), [ssMeta]);
- //SaveVOI1.ShortCut := ShortCut(Word('S'), [ssMeta]);
- HideVOI1.ShortCut := ShortCut(Word('H'), [ssMeta]);
- PasteSlice1.ShortCut := ShortCut(Word('V'), [ssMeta]);
- //UndoVOI1.ShortCut := ShortCut(Word('Z'), [ssMeta]);
- UndoVOI1.ShortCut := ShortCut(Word('U'), [ssMeta]);
- UndoVOI1.Caption := 'Undo drawing';
- Eraser1.ShortCut := ShortCut(Word('E'), [ssMeta]);
- NoDraw1.ShortCut := ShortCut(Word('D'), [ssMeta]);
- YokeMenu.ShortCut := ShortCut(Word('Y'), [ssMeta]);
- //in Cocoa: non-active menu intercepts keystrokes, so user typing in script form can not type "A" if that is used by main forms Axial menu
-
- (*Render1.ShortCut := ShortCut(Word('R'), [ssMeta]);
- Axial1.ShortCut := ShortCut(Word('A'), [ssMeta]);
- Coronal1.ShortCut := ShortCut(Word('C'), [ssMeta]);
- Sagittal1.ShortCut := ShortCut(Word('S'), [ssMeta]);
- MPR1.ShortCut := ShortCut(Word('M'), [ssMeta]);
- LeftMenu.ShortCut := ShortCut(Word('L'), [ssCtrl]);
- RightMenu.ShortCut := ShortCut(Word('R'), [ssCtrl]);
- AnteriorMenu.ShortCut := ShortCut(Word('A'), [ssCtrl]);
- PosteriorMenu.ShortCut := ShortCut(Word('P'), [ssCtrl]);
- SuperiorMenu.ShortCut := ShortCut(Word('S'), [ssCtrl]);
- InferiorMenu.ShortCut := ShortCut(Word('I'), [ssCtrl]);*)
- {$ELSE}
- LeftMenu.ShortCut := ShortCut(Word('L'), [ssAlt]);
- RightMenu.ShortCut := ShortCut(Word('R'), [ssAlt]);
- AnteriorMenu.ShortCut := ShortCut(Word('A'), [ssAlt]);
- PosteriorMenu.ShortCut := ShortCut(Word('P'), [ssAlt]);
- SuperiorMenu.ShortCut := ShortCut(Word('S'), [ssAlt]);
- InferiorMenu.ShortCut := ShortCut(Word('I'), [ssAlt]);
- AppleMenu.visible := false;
- {$ENDIF}
- //{$IFNDEF UNIX} BET1.Visible := false; {$ENDIF}
- QualityTrack.Position := gPrefs.RayCastQuality1to10;
- loadLabelsDefault;
- {$IFDEF COMPILEYOKE}
- if gPrefs.EnableYoke then begin
- YokeSepMenu.visible := true;
- YokeMenu.visible := true;
- CreateSharedMem(self);
- SetShareFloats2D(0,0,0);
- SetShareFloats2D(0,0,0); //twice so previous is set
- SetShareFloats3D(gRayCast.Azimuth, gRayCast.Elevation);
- SetShareFloats3D(gRayCast.Azimuth, gRayCast.Elevation); //twice so previous is set
- end;
- //SetShareMem (0,0,0, gRayCast.Azimuth, gRayCast.Elevation);
- //SetShareMem (0,0,0, gRayCast.Azimuth, gRayCast.Elevation); //twice to overwrite previous
- //YokeTimer.Enabled := gYoke;
-{$ENDIF}
-SetToolPanelWidth;
-//gPrefs.FasterGradientCalculations := true;
-//GLForm1.Caption:= inttostr(GetFontData(GLForm1.Font.Handle).Height)+' '+inttostr(Screen.PixelsPerInch);
-end;
-
-
-function InColorBox(X, Y: Integer): boolean;
-var
- px: integer;
-begin
- px := ColorBoxPixels(gRayCast.WINDOW_HEIGHT,gRayCast.WINDOW_WIDTH)+4;
- result := (X>=0) and (Y>=0) and (X < px) and (Y < px);
-end;
-
-procedure Bound (var Val: integer; Min,Max: integer);
-begin
- if Val < Min then
- Val := Min;
- if Val > Max then
- Val := Max;
-end;
-
-procedure OrthoPix2Frac (X, Y: integer; var lOrient: integer; var lXfrac,lYfrac,lZfrac: single);
-var
- lI: integer;
- lZoomDim: array [1..3] of single;
-begin
- SetZooms (lZoomDim[1],lZoomDim[2],lZoomDim[3],gTexture3D);
- for lI := 1 to 3 do
- lZoomDim[lI] := lZoomDim[lI]*abs(gRayCast.OrthoZoom) * gTexture3D.FiltDim[lI];
- if (gPrefs.SliceView = 1) then begin //if Axial
- lOrient := 1;
- lXfrac := X/lZoomDim[1];
- lYfrac := (lZoomDim[2]- (Y) )/lZoomDim[2];
- lZfrac := gRayCast.OrthoZ;
- exit;
- end; //Axial
- if (gPrefs.SliceView = 2) then begin //if Coronal
- lOrient := 2;
- lXfrac := X/lZoomDim[1];
- lYfrac := gRayCast.OrthoY;
- lZFrac := (lZoomDim[3]-Y)/lZoomDim[3];
- exit;
- end; //Coronal
- if (gPrefs.SliceView = 3) then begin //if Sagittal
- lOrient := 3;
- lXfrac := gRayCast.OrthoX;
- lYfrac := (X )/lZoomDim[2];
- lZFrac := (lZoomDim[3]-Y)/lZoomDim[3];
- exit;
- end; //Sagittal
- //following code for MPR views...
- if (X < lZoomDim[1]) and (Y < lZoomDim[3]) then begin //coronal
- lOrient := 2;
- lXfrac := X/lZoomDim[1];
- lYfrac := gRayCast.OrthoY;
- lZFrac := (lZoomDim[3]-Y)/lZoomDim[3];
- end else if (X < (lZoomDim[1] + lZoomDim[2])) and (Y < lZoomDim[3]) then begin //sag
- lOrient := 3;
- lXfrac := gRayCast.OrthoX;
- lYfrac := (X-lZoomDim[1] )/lZoomDim[2];
- lZFrac := (lZoomDim[3]-Y)/lZoomDim[3];
- end else if (X < lZoomDim[1]) and (Y < (lZoomDim[3]+lZoomDim[2])) then begin //axial
- lOrient := 1;
- lXfrac := X/lZoomDim[1];
- lYfrac := (lZoomDim[2]- (Y-lZoomDim[3]) )/lZoomDim[2];
- lZfrac := gRayCast.OrthoZ;
- //exit;
- end else
- lOrient := 0;
-end;
-
-
-procedure BoundF (var v: single; lMin,lMax: single);
-begin
- if (v < lMin) then
- v := lMin
- else if (v > lMax) then
- v := lMax;
-end;
-
-procedure OrthoCoordMidSlice(X,Y,Z: single);
-begin
- X := round(FracToSlice(gRayCast.OrthoX,gTexture3D.FiltDim[1]))-0.5 + X;
- Y := round(FracToSlice(gRayCast.OrthoY,gTexture3D.FiltDim[2]))-0.5 + Y;
- Z := round(FracToSlice(gRayCast.OrthoZ,gTexture3D.FiltDim[3]))-0.5 + Z;
- boundF(X,0.5, gTexture3D.FiltDim[1]-0.5);
- boundF(Y,0.5, gTexture3D.FiltDim[2]-0.5);
- boundF(Z,0.5, gTexture3D.FiltDim[3]-0.5);
- gRayCast.OrthoX := X/gTexture3D.FiltDim[1];
- gRayCast.OrthoY := Y/gTexture3D.FiltDim[2];
- gRayCast.OrthoZ := Z/gTexture3D.FiltDim[3];
-(*//2015 FCX
- exit;
- lX := round(FracToSlice(gRayCast.OrthoX,gTexture3D.FiltDim[1]));
- lY := round(FracToSlice(gRayCast.OrthoY,gTexture3D.FiltDim[2]));
- lZ := round(FracToSlice(gRayCast.OrthoZ,gTexture3D.FiltDim[3]));
- //exit;
- lX := lX - 0.5;
- lY :=lY - 0.5;
- lZ :=lZ - 0.5;
- gRayCast.OrthoX := lX/gTexture3D.FiltDim[1];
- gRayCast.OrthoY := lY/gTexture3D.FiltDim[2];
- gRayCast.OrthoZ := lZ/gTexture3D.FiltDim[3];
- glform1.caption := floattostr(gRayCast.OrthoX)+' '+inttostr(gTexture3D.FiltDim[1])+' '+floattostr(lX);
- *)
-end;
-
-procedure TGLForm1.OrthoClick(X,Y: integer);
- var
- lOrient: integer;
- lXfrac,lYfrac,lZfrac: single;
-
- begin
- OrthoPix2Frac (X, Y, lOrient,lXfrac,lYfrac,lZfrac);
- if lOrient < 1 then exit;
- gRayCast.OrthoX := lXfrac;
- gRayCast.OrthoY := lYfrac;
- gRayCast.OrthoZ := lZfrac;
- //OrthoCoordMidSlice;
- ShowOrthoSliceInfo (false);
- GLBox.Invalidate;
- if AutoRoiForm.Visible and (ssShift in KeyDataToShiftState(vk_Shift)) then
- AutoRoiForm.OriginBtnClick(nil);
-end;
-(*procedure TGLForm1.OrthoClick(X,Y: integer);
-var
- lI: integer;
- lZoomDim: array [1..3] of single;
-begin
- SetZooms (lZoomDim[1],lZoomDim[2],lZoomDim[3],gTexture3D);
-
- for lI := 1 to 3 do
- lZoomDim[lI] := lZoomDim[lI]*abs(gRayCast.OrthoZoom) * gTexture3D.FiltDim[lI];
- if (X < lZoomDim[1]) and (Y < lZoomDim[3]) then begin //coronal
- gRayCast.OrthoX := X/lZoomDim[1];
- gRayCast.OrthoZ := (lZoomDim[3]-Y)/lZoomDim[3];
- ShowOrthoSliceInfo;
- GLBox.Invalidate;
- exit;
- end;
- if (X < (lZoomDim[1] + lZoomDim[2])) and (Y < lZoomDim[3]) then begin //sag
- gRayCast.OrthoY := (X-lZoomDim[1] )/lZoomDim[2];
- gRayCast.OrthoZ := (lZoomDim[3]-Y)/lZoomDim[3];
- ShowOrthoSliceInfo;
- GLBox.Invalidate;
- exit;
- end;
- if (X < lZoomDim[1]) and (Y < (lZoomDim[3]+lZoomDim[2])) then begin //axial
- gRayCast.OrthoX := X/lZoomDim[1];
- gRayCast.OrthoY := (lZoomDim[2]- (Y-lZoomDim[3]) )/lZoomDim[2];
- ShowOrthoSliceInfo;
- GLBox.Invalidate;
- exit;
- end;
- //GLSceneViewer1DblClick(nil);
-end; *)
-{$IFDEF LCLCocoa}
-procedure Mouse2Retina(var X,Y: integer);
-begin
- if not gPrefs.RetinaDisplay then exit;
- X := round(X * gRetinaScale);
- Y := round(Y * gRetinaScale);
-end;
-{$ELSE}
-procedure Mouse2Retina(var X,Y: integer);
-begin
- //Retina display is MacOS feature
-end;
-{$ENDIF}
-
-procedure TGLForm1.GLboxMouseDown(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; lX, lY: Integer);
-var
- X,Y: integer;
-begin
- {$IFNDEF FPC}
- GLBox.SetFocus;//without this the scroll wheel can adjust previously selected combobox
- {$ENDIF}
- //if gPrefs.SliceView = 5 then exit; //mosaic
- X := lX; Y := lY; Mouse2Retina(X,Y);
- MouseStartPt.X := -1;
- if MouseDownVOI(Shift,X, Y) then exit; //intercepted by draw tool
- if (SSRight in Shift) then begin
- MouseStartPt.X := X;
- MouseStartPt.Y := Y;
- exit;
- end;
- if (ssAlt in Shift) then begin
- if InColorBox(abs(X),abs(Y)) then
- ToggleTransparency1.Click
- else begin
- //OrthoSlice.Click;
- end;
- exit;
- end;
- if (gPrefs.ColorEditor) and (InColorBox(X,Y)) then begin
- //mango
- ClutMouseDown(Button, Shift, X, Y);
- M_refresh := true;
- //5/2018: the next few lines are too sluggish for high resolution images
- //UpdateTimer.Enabled:=true;
- //GLbox.invalidate;
- exit;
- end;
- If (gPrefs.SliceView <> 0) and (gPrefs.SliceView <> 5) then begin
- OrthoClick(X,Y);
- exit;
- end;
- MousePt.X := X;
- MousePt.Y := Y;
-end;
-
-procedure TGLForm1.GLboxMouseMove(Sender: TObject; Shift: TShiftState; lX,
- lY: Integer);
-var
- zoom: single;
- X,Y: integer;
-begin
- X := lX; Y := lY; Mouse2Retina(X,Y);
- if MouseMoveVOI (X, Y) then exit;
- if (SSLeft in Shift) and (InColorBox(abs(X),abs(Y))) and (gPrefs.ColorEditor) and (gSelectedNode >= 0) then begin
- CLUTMouseMove(Shift, X, Y);
- M_refresh := true;
- GLbox.invalidate;
- exit;
- end;
- if gPrefs.SliceView = 5 then exit; //mosaic
-
- If (SSLeft in Shift) and (gPrefs.SliceView <> 0) then begin
- OrthoClick(X,Y);
- exit;
- end;
- if MousePt.X < 1 then //only change if dragging mouse
- exit; //mouse button not down
- If ((ssRight in Shift) or (ssShift in Shift)) then begin //change render depth
- if (gPrefs.SliceView = 0) then begin
- Zoom := ((Y-MousePt.Y)*0.025);
- gRayCast.Distance := gRayCast.Distance - zoom;
- if gRayCast.Distance > kMaxDistance then
- gRayCast.Distance := kMaxDistance;
- if gRayCast.Distance < 1 then
- gRayCast.Distance := 1.0;
- end;
- end else begin
- gRayCast.Azimuth := (gRayCast.Azimuth + (X-MousePt.X)) mod 360;
- while gRayCast.Azimuth < 0 do gRayCast.Azimuth := gRayCast.Azimuth + 360;
- gRayCast.Elevation := gRayCast.Elevation + (Y-MousePt.Y);
- Bound(gRayCast.Elevation,-90,90);
- {$IFDEF COMPILEYOKE}
- SetShareFloats3D(gRayCast.Azimuth, gRayCast.Elevation);
- {$ENDIF}
- end;
- MousePt.X := X;
- MousePt.Y := Y;
- GLbox.Invalidate;
-end;
-
-function VoxInten (lVox: integer): single;
-var
- lV: integer;
-begin
- result := 0;
- if (lVox < 1) then exit;
- if gTexture3D.RawUnscaledImg16 <> nil then
- result := gTexture3D.RawUnscaledImg16^[lVox]
- else if gTexture3D.RawUnscaledImg32 <> nil then
- result := gTexture3D.RawUnscaledImg32^[lVox]
- else if (gTexture3D.RawUnscaledImg8 <> nil) then
- result := gTexture3D.RawUnscaledImg8^[lVox]
- else if (gTexture3D.RawUnscaledImgRGBA <> nil) then begin
- lV := (lVox-1) * 4; //4 bytes (RGBA)
- result := 1/3*(gTexture3D.RawUnscaledImgRGBA^[lV+1]+gTexture3D.RawUnscaledImgRGBA^[lV+2]+gTexture3D.RawUnscaledImgRGBA^[lV+3]) ;
- end;
-end;
-
-procedure Raw2ScaledIntensity (var v: single);
-begin
-
- if gTexture3D.NIFTIhdr.scl_slope = 0 then
- v := v+gTexture3D.NIFTIhdr.scl_inter
- else
- v := (v * gTexture3D.NIFTIhdr.scl_slope)+gTexture3D.NIFTIhdr.scl_inter;
-end;
-
-procedure TGLForm1.UpdateContrast (Xa,Ya, Xb, Yb: integer);
-var
- X,Y, Xs,Xe,Ys,Ye,lOrients,lOriente,lVox, lLog10: integer;
- lXfrac,lYfrac,lZfrac,lMin, lMax, lVoxInten: single;
-begin
- if (Xa = Xb) and (Ya = Yb) then exit;
- Xs := Xa; Xe := Xb; Ys := Ya; Ye := Yb;
- SortInt(Xs,Xe);
- SortInt(Ys,Ye);
- if gTexture3D.isLabels then exit;
- OrthoPix2Frac (Xs, Ys, lOrients,lXfrac,lYfrac,lZfrac);
- OrthoPix2Frac (Xe, Ye, lOriente,lXfrac,lYfrac,lZfrac);
- if lOrients <> lOriente then exit;
- lVox := FracToVox (lXfrac,lYfrac,lZfrac, gTexture3D.FiltDim[1], gTexture3D.FiltDim[2],gTexture3D.FiltDim[3]);
- lMin := VoxInten(lVox);
- lMax := lMin;
- for Y := Ys to Ye do begin
- for X := Xs to Xe do begin
- OrthoPix2Frac (X, Y, lOrients,lXfrac,lYfrac,lZfrac);
- lVox := FracToVox (lXfrac,lYfrac,lZfrac, gTexture3D.FiltDim[1], gTexture3D.FiltDim[2],gTexture3D.FiltDim[3]);
- lVoxInten := VoxInten(lVox);
- if (lVoxInten < lMin) then lMin := lVoxInten;
- if (lVoxInten > lMax) then lMax := lVoxInten;
- end;
- end;
- Raw2ScaledIntensity(lMin);
- Raw2ScaledIntensity(lMax);
- if lMax > lMin then begin
- lLog10 := trunc(log10( lMax-lMin))-1;
- lMin := roundto(lMin,lLog10);
- lMax := roundto(lMax,lLog10);
- end;
- SelectIntensityMinMax(lMin,lMax);
- glbox.Invalidate;
-end;
-
-procedure TGLForm1.GLboxMouseUp(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; lX, lY: Integer);
-var
- X,Y: integer;
-begin
- if (gPrefs.SliceView = 5) then exit; //mosaic
- X := lX; Y := lY; Mouse2Retina(X,Y);
- MouseUpVOI (Shift, X, Y) ;
- //if (SSRight in Shift) then begin
- if (gPrefs.SliceView <> 0) and (MouseStartPt.X >= 0) then begin
- UpdateContrast(MouseStartPt.X,MouseStartPt.Y,X,Y);
- //Caption := inttostr( MouseStartPt.X)+' '+inttostr(X);
- end;
- MousePt.X := -X;
- MousePt.Y := -Y;
- gSelectedNode := -gSelectedNode;
-end;
-
-procedure TGLForm1.SetColorBarPosition;
-begin
- if (gPrefs.ColorBarPosition < 1) or (gPrefs.ColorBarPosition > 4) then gPrefs.ColorBarPosition := 1;
- case gPrefs.ColorBarPosition of
- 3: begin gClrbar.isTopOrRight := true; gClrbar.isVertical:=false; end; //top row
- 4: begin gClrbar.isTopOrRight := true; gClrbar.isVertical:=true; end; //right column
- 1: begin gClrbar.isTopOrRight := false; gClrbar.isVertical:=false; end;//bottom row
- 2: begin gClrbar.isTopOrRight := false; gClrbar.isVertical:=true; end;//left column
- end;
- //gClrbar.isTopOrRight := true; gClrbar.isVertical:=false;
-end;
-
-procedure TGLForm1.GLboxDblClick(Sender: TObject);
-var
- AbsNode: integer;
-begin
- AbsNode := Abs(gSelectedNode);
- if (not (gPrefs.ColorEditor)) or (not InColorBox(abs(MousePt.X),abs(MousePt.Y))) then begin
- if not gPrefs.Colorbar then
- exit;
- gPrefs.ColorBarPosition := gPrefs.ColorBarPosition + 1;
- SetColorbarPosition;
- GLbox.invalidate;
- exit;
- end;
- ColorDialog1.Color := RGBA2TColor(gCLUTrec.nodes[AbsNode].rgba);
- if not ColorDialog1.Execute then
- exit;
- TColor2RGBA(ColorDialog1.Color, gCLUTrec.nodes[AbsNode].rgba);
- M_refresh := true;
- GLbox.invalidate;
-end;
-
-procedure TGLForm1.Quit2TextEditor;
-{$IFDEF UNIX}
-var
- AProcess: TProcess;
- {$IFDEF LINUX} I: integer; EditorFName : string; {$ENDIF}
-begin
- {$IFDEF LINUX}
- EditorFName := FindDefaultExecutablePath('gedit');
- if EditorFName = '' then
- EditorFName := FindDefaultExecutablePath('tea');
- if EditorFName = '' then
- EditorFName := FindDefaultExecutablePath('nano');
- if EditorFName = '' then
- EditorFName := FindDefaultExecutablePath('pico');
- if EditorFName = '' then begin
- Showmessage(ExtractFilename(paramstr(0))+' will now quit. You can then use a text editor to modify the file '+IniName);
- Clipboard.AsText := EditorFName;
- end else begin
- EditorFName := '"'+EditorFName +'" "'+IniName+'"';
- Showmessage(ExtractFilename(paramstr(0))+' will now quit. Modify the settings with the command "'+EditorFName+'"');
- AProcess := TProcess.Create(nil);
- AProcess.InheritHandles := False;
- AProcess.Options := [poNewProcessGroup, poNewConsole];
- AProcess.ShowWindow := swoShow;
- for I := 1 to GetEnvironmentVariableCount do
- AProcess.Environment.Add(GetEnvironmentString(I));
- AProcess.Executable := EditorFName;
- AProcess.Execute;
- AProcess.Free;
- end;
- Clipboard.AsText := EditorFName;
- GLForm1.close;
- exit;
- {$ENDIF}
- Showmessage('Preferences will be opened in a text editor. The program '+ExtractFilename(paramstr(0))+' will now quit, so that the file will not be overwritten.');
- AProcess := TProcess.Create(nil);
- {$IFDEF UNIX}
- //AProcess.CommandLine := 'open -a TextEdit '+IniName;
- AProcess.Executable := 'open';
- AProcess.Parameters.Add('-e');
- AProcess.Parameters.Add(IniName);
- {$ELSE}
- AProcess.CommandLine := 'notepad '+IniName;
- {$ENDIF}
- Clipboard.AsText := AProcess.CommandLine;
- //AProcess.Options := AProcess.Options + [poWaitOnExit];
- AProcess.Execute;
- AProcess.Free;
- GLForm1.close;
-end;
-{$ELSE} //ShellExecute(Handle,'open', 'c:\windows\notepad.exe','c:\SomeText.txt', nil, SW_SHOWNORMAL) ;
-begin
- gPrefs.SkipPrefWriting := true;
- Showmessage('Preferences will be opened in a text editor. The program '+ExtractFilename(paramstr(0))+' will now quit, so that the file will not be overwritten.');
- //GLForm1.SavePrefs;
- ShellExecute(Handle,'open', 'notepad.exe',PAnsiChar(AnsiString(IniName)), nil, SW_SHOWNORMAL) ;
- //WritePrefsOnQuit.checked := false;
- GLForm1.close;
-end;
-{$ENDIF}
-
-(*procedure NewInstanceX;
- var
- AProcess: TProcess;
- begin
- //showmessage('xxx');
- AProcess := TProcess.Create(nil);
- AProcess.
- AProcess.CommandLine := 'open -n '+paramstr(0);
- AProcess.CommandLine:= 'open -n /Users/rorden/Documents/osx/MRIcroGL.app/Contents/MacOS/MRIcroGL &';
- Clipboard.AsText := AProcess.CommandLine;
- //showmessage(AProcess.CommandLine);
- AProcess.Execute;
- AProcess.Free;
-end; *)
-
-procedure TGLForm1.About1Click(Sender: TObject);
-const
- kSamp = 36;
-var
- s: dword;
- debug : boolean;
- i: integer;
- titleStr, str: string;
-begin
- If (ssShift in KeyDataToShiftState(vk_Shift)) then begin
- M_Refresh := TRUE;
- GLForm1.UpdateTimer.Enabled := true;
- //GLbox.Invalidate;
- exit;
- end;
- debug := gPrefs.Debug;
- gPrefs.Debug := true; //display gradient timing
- M_Refresh := TRUE;
- //deleteGradients(gTexture3D);
- s := gettickcount;
-(* fpsstr := '';
- if (gPrefs.SliceView = 0) then begin //rendering
- for i := 1 to kSamp do begin
- gRayCast.Azimuth := (gRayCast.Azimuth + 10) mod 360;
- GLbox.Repaint;
- end;
- fpsstr := kCR+' FPS '+realtostr((kSamp*1000)/(gettickcount-s),1) ;
-end;*)
- gPrefs.Debug := debug;
- {$IFDEF CPU64}
- str := '64-bit';
- {$ELSE}
- str := '32-bit';
- {$ENDIF}
- {$IFDEF Windows}str := str + ' Windows '; {$ENDIF}
- {$IFDEF LINUX}str := str + ' Linux '; {$ENDIF}
- {$IFDEF Darwin}str := str + ' OSX '; {$ENDIF}
- {$IFDEF LCLQT}str := str + ' (QT) '; {$ENDIF}
- {$IFDEF LCLGTK2}str := str + ' (GTK2) '; {$ENDIF}
- {$IFDEF LCLCocoa}str := str + ' (Cocoa) ';{$ENDIF}
- {$IFDEF LCLCarbon}str := str + ' (Carbon) '; {$ENDIF}
- {$IFDEF DGL} str := str +' (DGL) '; {$ENDIF}//the DGL library has more dependencies - report this if incompatibilities are found
- str := 'MRIcroGL '+str+' '+kVers
- //{$IFDEF LCLCocoa}+kCR+' '+paramstr(0){$ENDIF}
- {$IFDEF LCLCocoa}+''; titleStr := str; str :=
- {$ELSE}
- +kCR+
- {$ENDIF}
-
- ' www.mricro.com :: BSD 2-Clause License (opensource.org/licenses/BSD-2-Clause)'
- +kCR+' Dimensions '+inttostr(gTexture3D.NIFTIhdr.dim[1])+'x'+inttostr(gTexture3D.NIFTIhdr.dim[2])+'x'+inttostr(gTexture3D.NIFTIhdr.dim[3])
- +kCR+' Bytes per voxel '+inttostr(gTexture3D.NIFTIhdr.bitpix div 8)
- +kCR+' Spacing '+realtostr(gTexture3D.NIFTIhdr.pixdim[1],2)+'x'+realtostr(gTexture3D.NIFTIhdr.pixdim[2],2)+'x'+realtostr(gTexture3D.NIFTIhdr.pixdim[3],2)
- +kCR+' Description '+ trim(gTexture3D.NIFTIhdr.descrip)
- +kCR + gShader.Vendor;
- {$IFDEF LCLCocoa}
- //ShowAlertSheet(GLForm1.Handle,titleStr, str); //limited line length
- MessageDlg(titleStr, str,mtInformation,[mbOK],0);
- {$ELSE}
- MessageDlg(str,mtInformation,[mbOK],0);
- {$ENDIF}
-end;
-
-procedure TGLForm1.GLboxMouseWheel(Sender: TObject; Shift: TShiftState;
- WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
-begin
- if Wheeldelta < 0 then
- gRayCast.Distance := gRayCast.Distance - 0.1
- else
- gRayCast.Distance := gRayCast.Distance + 0.1;
- if gRayCast.Distance > kMaxDistance then
- gRayCast.Distance := kMaxDistance;
- if gRayCast.Distance < 1 then
- gRayCast.Distance := 1.0;
- GLbox.Invalidate;
-end;
-
-function RGB2Color (r,g,b: single) : TColor;
-begin
- result := round(r*255)+round(g*255) shl 8 + round(b*255) shl 16;
-end;
-
-procedure Color2RGB (Color : TColor; var r,g,b: single);
-begin
- r := (Color and $ff)/$ff;
- g := ((Color and $ff00) shr 8)/255;
- b := ((Color and $ff0000) shr 16)/255;
-end;
-
-procedure TGLForm1.Backcolor1Click(Sender: TObject);
-var
- c: byte;
-begin
- If (ssShift in KeyDataToShiftState(vk_Shift)) then begin
- if gPrefs.BackColor.rgbGreen = 0 then
- c := 255
- else
- c := 0;
- gPrefs.BackColor.rgbRed:= c;
- gPrefs.BackColor.rgbGreen:= c;
- gPrefs.BackColor.rgbBlue:= c;
- gPrefs.BackColor.rgbReserved := 0;
- if gTexture3D.isLabels then M_Refresh := true; //make background match
- GLbox.Invalidate;
- exit;
- end;
- ColorDialog1.Color := RGBA2TColor(gPrefs.BackColor);
- if not ColorDialog1.Execute then
- exit;
- TColor2RGBA(ColorDialog1.Color,gPrefs.BackColor );
- gPrefs.BackColor.rgbReserved := 0;
- if gTexture3D.isLabels then M_Refresh := true; //make background match
- GLbox.Invalidate;
-end;
-
-procedure TGLForm1.Orient1Click(Sender: TObject);
-begin
- gPrefs.SliceDetailsCubeAndText := Orient1.checked;
- GLbox.Invalidate;
-end;
-
-procedure TGLForm1.Tool1Click(Sender: TObject);
-begin
- ToolPanel.visible := Tool1.checked;
- CollapsedToolPanel.Visible := not Tool1.checked;
- GLForm1.Resize;
-end;
-
-procedure TGLForm1.Exit1Click(Sender: TObject);
-begin
- Close;
-end;
-
-procedure TGLForm1.LoadStartupImage;
-var
- lFilename : string;
-begin
- (*if gPrefs.PrevFilename[1] = '' then begin
- lFilename := 'mni152_2009_256';
- CheckFilename (lFilename,false);
- if not fileexists(lFilename) then begin
- lFilename := 'ch256';
- CheckFilename (lFilename,false);
- end;
- if fileexists(lFilename) then begin
- OpenDialog1.filename := lFilename;
- gPrefs.PrevFilename[1] := lFilename;
- FillMRU (gPrefs.PrevFilename, ExtractFileDirWithPathDelim(gPrefs.PrevFilename[1]),'.nii.gz',false);
- UpdateMRU;
- end;
- end else *)
- lFilename := gPrefs.PrevFilename[1];
- {$IFDEF ENABLESCRIPT}
- AutoRunTimer1.enabled := ScriptForm.OpenParamScript; //if user passes script as parameter when launching program, e.g. "mricrogl ~/myscript.gls"
- if not AutoRunTimer1.enabled then begin
-
- if gPrefs.StartupScript then begin
- //AutoRunTimer1.enabled := ScriptForm.OpenStartupScript;
- ScriptForm.OpenStartupScript;
- AutoRunTimer1.enabled := true; //run first script even if no script named 'startupscript' found
- end;
- end;
- if AutoRunTimer1.enabled then lFilename := ''; //we will run a script - don't waste time with external image
- {$ENDIF}
- CheckFilename (lFilename,false);
- if fileexists(lFilename) then begin
- OpenDialog1.filename := lFilename;
- Load_From_NIfTI (gTexture3D,lFilename,gPrefs.ForcePowerOfTwo, 1)
- end else
- Load_From_NIfTI (gTexture3D,'',gPrefs.ForcePowerOfTwo, 1);
-end;
-
-procedure TGLForm1.ShaderBoxResize(Sender: TObject);
-begin
- if not ShaderBox.Visible then exit;
- if (ShaderPanel.Height <> ShaderPanelHeight) then
- ShaderPanel.Height := ShaderPanelHeight;
-end;
-
-(*const
-kMinMemoSz= 32;
-var
- lDesiredControlSz: integer;//420;
-begin
- if not ShaderBox.Visible then exit;
- //if (ShaderBox.Height < 740) and (ShaderBox.Parent <> OverflowPanel) then
- // ShaderBox.Parent := OverflowPanel
- // else if (ShaderBox.Parent <> ToolPanel) then
- // ShaderBox.Parent := ToolPanel;
- lDesiredControlSz := ShaderPanelHeight;
- if ShaderBox.ClientHeight > (lDesiredControlSz+kMinMemoSz) then begin
- ShaderMemo.Height := ShaderBox.ClientHeight - lDesiredControlSz;
- ShaderMemo.visible := true;
- end
- else
- ShaderMemo.visible := false;//ShaderMemo.Height := kMinMemoSz;
-end;*)
-
-procedure TGLForm1.ShowOrthoSliceInfo (isYoke: boolean);
-//Updated Sept 2014 to include overlay information
-var
- lXmm,lYmm,lZmm,lVoxInten : single;
- lVox: integer;
-begin
- if gPrefs.SliceView = 0 then exit;
- lXmm := SliceMM (gRayCast.OrthoX,kSagLeftOrient); //Sag
- lYmm := SliceMM (gRayCast.OrthoY,kCoronalOrient); //Coronal
- lZmm := SliceMM (gRayCast.OrthoZ,kAxialOrient); //Axial
- {$IFDEF COMPILEYOKE}
- if (not isYoke) then
- SetShareFloats2D(lXmm,lYmm,lZmm);
- {$ENDIF}
-
- lVox := FracToVox (gRayCast.OrthoX,gRayCast.OrthoY,gRayCast.OrthoZ, gTexture3D.FiltDim[1], gTexture3D.FiltDim[2],gTexture3D.FiltDim[3]);
- if lVox < 1 then
- exit;
- lVoxInten := VoxInten(lVox);
- if (gTexture3D.isLabels) and ( High(gTexture3D.LabelRA) > 0) then begin
- if (lVoxInten >=0) and (lVoxInten <= High(gTexture3D.LabelRA)) then
- {$IFDEF ENABLEOVERLAY}
- Caption := gPrefs.ImgNameShort +' '+ realtostr(lXmm,1)+'x'+realtostr(lYmm,1)+'x'+realtostr(lZmm,1)+'='+gTexture3D.LabelRA[round(lVoxInten)]+OverlayIntensityString(lVox);
- {$ELSE}
- Caption := gPrefs.ImgNameShort +' '+ realtostr(lXmm,1)+'x'+realtostr(lYmm,1)+'x'+realtostr(lZmm,1)+'='+gTexture3D.LabelRA[round(lVoxInten)];
- {$ENDIF}
- exit;
- end;
- Raw2ScaledIntensity(lVoxInten);
- {$IFDEF ENABLEOVERLAY}
- Caption := gPrefs.ImgNameShort +' '+realtostr(lXmm,1)+'x'+realtostr(lYmm,1)+'x'+realtostr(lZmm,1)+'='+realtostr(lVoxInten,3) +OverlayIntensityString(lVox);
- {$ELSE}
- Caption := gPrefs.ImgNameShort +' '+ realtostr(lXmm,1)+'x'+realtostr(lYmm,1)+'x'+realtostr(lZmm,1)+'='+realtostr(lVoxInten,3);
- {$ENDIF}
-end;
-
-procedure TGLForm1.LoadDraw;
-var
- lDestHdr: TMRIcroHdr;
-begin
- if (length(OpenDialogVoi.Filename) < 1) or (not fileexists(OpenDialogVoi.Filename)) then begin
- exit;
- end;
- if Reslice2Targ(OpenDialogVoi.Filename,gTexture3D.NIFTIhdr,lDestHdr,false,1 )='' then begin
- showmessage('Failed to load drawing '+OpenDialogVoi.Filename);
- caption := 'Failed to load drawing'+ OpenDialogVoi.Filename;
- exit;
-
- end;
- if not ImgToUint8 (lDestHdr, lDestHdr.ImgBuffer) then begin//binarizes image <=0 -> 0, else 1
- freemem(lDestHdr.ImgBuffer);
- caption := 'datatype '+inttostr(lDestHdr.NIFTIHdr.datatype)+' bpp '+ inttostr(lDestHdr.ImgBufferBPP);
- showmessage('This version can only load 8-bit images for drawing');
- exit;
- end;
-
- voiCreate(gTexture3D.FiltDim[1], gTexture3D.FiltDim[2],gTexture3D.FiltDim[3], ByteP0(@lDestHdr.ImgBuffer^));
- //voiBinarize;
- freemem(lDestHdr.ImgBuffer);
-end;
-
-procedure TGLForm1.AutoDetectVOI;
-begin
- if (not IsVOIExt(OpenDialog1.Filename)) and (fileexists (ParseFileName (OpenDialog1.FileName)+'.voi') ) then begin
- OpenDialogVoi.Filename := ParseFileName (OpenDialog1.FileName)+'.voi';
- M_reload := kOpenExistingVOI_reload;
- end;
-
-end;
-
-procedure TGLForm1.AutoRoi1Click(Sender: TObject);
-begin
-{$IFDEF LCLCocoa}
-//setThemeMode(AutoROIForm.Handle, gPrefs.DarkMode);
-setThemeMode(AutoROIForm, gPrefs.DarkMode);
- {$ENDIF}
- AutoROIForm.Show;
-end;
-
-procedure TGLForm1.ConvertDicom1Click(Sender: TObject);
-begin
- dcm2niiForm.showmodal;
-end;
-
-procedure TGLForm1.ClrbarClr(i: integer);
-begin
- if (i < 1) or (i > 4) then i := 4;
- gPrefs.ColorbarColor:= i;
- Case i of
- 1: begin
- gClrbar.BackColor := (RGBA(255,255,255,255));
- gClrbar.FontColor := (RGBA(0,0,0,255));
- WhiteClrbarMenu.checked := true;
- end;
- 2: begin
- gClrbar.BackColor := (RGBA(255,255,255,168));
- gClrbar.FontColor := (RGBA(0,0,0,255));
- TransWhiteClrbarMenu.checked := true;
- end;
- 3: begin
- gClrbar.BackColor := (RGBA(0,0,0,255));
- gClrbar.FontColor := (RGBA(255,255,255,255));
- BlackClrbarMenu.checked := true;
- end;
- else begin
- gClrbar.BackColor := (RGBA(0,0,0,168));
- gClrbar.FontColor := (RGBA(255,255,255,255));
- TransBlackClrbarMenu.checked := true;
- end;
- end;
-end;
-
-procedure TGLForm1.ClrbarMenuClick(Sender: TObject);
-begin
- ClrbarClr((sender as TMenuItem).Tag);
- GLBox.Invalidate;
-end;
-
-procedure TGLForm1.GLboxPaint(Sender: TObject);
-//var
-// OK: boolean;
-// i: integer;
-// LUT: TLUT;
-begin
-
- if (gRendering) or (gRayCast.ScreenCapture) then exit;
- gRendering:=true;
- if gInitialSetup then begin //first time only!
- {$IFDEF DGL}
- InitOpenGL;
- ReadExtensions;
- ReadImplementationProperties;
- {$ELSE DGL}
- {$IFDEF COREGL}
- if not Load_GL_VERSION_3_3_CORE then
- GLForm1.ShowmessageError('Unable to load OpenGL v3.3 Core: '+gpuReport);
- {$ELSE COREGL}
- if not Load_GL_version_2_1 then
- GLForm1.ShowmessageError('Unable to load OpenGL v2.1: '+gpuReport);
- Load_GL_EXT_framebuffer_object;
- //Load_GL_ARB_framebuffer_object;
- Load_GL_EXT_texture_object;
- {$ENDIF COREGL}
- {$ENDIF DGL}
- {$IFDEF LCLCocoa}
- SetRetina;
- // GLBox.WantsBestResolutionOpenGLSurface:= gPrefs.RetinaDisplay;
- {$ENDIF}
- gRayCast.WINDOW_WIDTH := GLBoxBackingWidth;
- gRayCast.WINDOW_HEIGHT := GLboxBackingHeight;
- LoadStartupImage;
- AutoDetectVOI;
- gCube := TGLCube.Create(GLBox);
- gCube.TopLeft:= true;
- UpdateFont(true);
- SetColorbarPosition;
-(* ClrbarClr(gPrefs.ColorbarColor);
- for i := 0 to 255 do begin
- LUT[i].rgbRed := i;
- LUT[i].rgbGreen := 0;
- LUT[i].rgbBlue := 0;
- end;
- gClrbar.SetLUT(1, LUT, 10,20);
- for i := 0 to 255 do begin
- LUT[i].rgbRed := 0;
- LUT[i].rgbGreen := i;
- LUT[i].rgbBlue := 0;
- end;
- gClrbar.SetLUT(2, LUT, -5,5); *)
- ClrbarClr(gPrefs.ColorbarColor);
- GLBox.MakeCurrent();
-
- {$IFDEF LINUX}
- if gPrefs.NoveauWarning then WarningIfNoveau;
- {$ENDIF}
- end;
- if not AreaInitialized then begin
- gRayCast.WINDOW_WIDTH := GLBoxBackingWidth;
- gRayCast.WINDOW_HEIGHT := GLboxBackingHeight;
- if (GLbox.Height < 1) or (GLBoxBackingHeight <= GLbox.Height) then
- gRetinaScale := 1
- else
- gRetinaScale := GLBoxBackingHeight/GLbox.Height;
- if M_reload > 0 then begin
- voiClose;
- if Load_From_NIfTI (gTexture3D,OpenDialog1.Filename,gPrefs.ForcePowerOfTwo, M_reload) then begin
- Add2MRU(gPrefs.PrevFileName,OpenDialog1.Filename);
- //IntensityBox.Caption := OpenDialog1.Filename;
- UpdateMRU;
- M_reload := 0;
- AutoDetectVOI;
- end else
- M_reload := 0;
- end;
- InitGL (gInitialSetup);
- gRayCast.slices := round(FloatMaxVal(gTexture3D.FiltDim[1], gTexture3D.FiltDim[2],gTexture3D.FiltDim[3]) );
- if gRayCast.slices < 1 then
- gRayCast.slices := 100;
- AreaInitialized:=true;
- MinEdit.Text := float2str(gCLUTrec.min,3);
- MaxEdit.Text := float2str(gCLUTrec.max,3);
- if (gPrefs.SliceView > 0) and (gPrefs.SliceView < 5) then
- ShowOrthoSliceInfo (false);
- if gInitialSetup then begin
- gInitialSetup := false;
- UpdateTimer.enabled := true;
- end;
- end;
- if (M_reload = kOpenExistingVOI_reload) then begin
- LoadDraw;
- end;
- M_reload := 0;
- if M_Refresh then begin
- {$IFNDEF USETRANSFERTEXTURE}
- Calculate_Transfer_Function;
- CreateHisto (gTexture3D,gCLUTrec.Min,gCLUTrec.Max,gTexture3D.WindowHisto, true);
- {$ELSE}
- UpdateTransferFunctionX(gCLUTrec,gRayCast.TransferTexture1D);
- CreateHisto (gTexture3D,gCLUTrec.Min,gCLUTrec.Max,gTexture3D.WindowHisto, true);
- {$ENDIF}
- UpdateClrbar;
- M_Refresh := false;
- end;
- DisplayGL(gTexture3D);
- //DisplaySimple(gTexture3D);
- {$IFDEF FPC}
- {$IFDEF LCLCarbon}
- GLbox.SwapBuffers; //DoubleBuffered
- {$ELSE}
- {$IFDEF Darwin} if gPrefs.isDoubleBuffer then {$ENDIF}
- GLbox.SwapBuffers; //DoubleBuffered
- {$ENDIF}
- (*if ( gRayCast.WINDOW_WIDTH = GLBox.BackingWidth) and (gRayCast.WINDOW_HEIGHT = GLbox.BackingHeight) then begin
- if gPrefs.isDoubleBuffer then
- GLbox.SwapBuffers //DoubleBuffered
- end else begin
- GLBox.Invalidate;
-
- end;*)
- {$ENDIF}
- gRendering:=false;
-end;
-
-procedure TGLForm1.GLboxResize(Sender: TObject);
-begin
- AreaInitialized := false;
- GLbox.Invalidate;
- UpdateTimer.Enabled:=true;
-end;
-
-procedure TGLForm1.Open1Click(Sender: TObject);
-begin
- TerminateRendering;
- if not OpenDialog1.Execute then
- LoadDatasetNIFTIvolx('',true)
- else
- LoadDatasetNIFTIvolx(OpenDialog1.FileName,true);
-end;
-
-procedure TGLForm1.ClipTrackChange(Sender: TObject);
-begin
- gRayCast.ClipAzimuth:=AziTrack1.position;
- gRayCast.ClipElevation:=ElevTrack1.position;
- gRayCast.ClipDepth := ClipTrack.Position;
- {$IFNDEF FPC} //On Windows changing this can make the other labels on the groupbox vanish
- ClipBox.Caption := 'Clip A:'+inttostr(AziTrack1.Position)+' E:'+inttostr(ElevTrack1.Position);
- {$ENDIF}
- //
- GLBox.Invalidate;
-end;
-
-procedure TGLForm1.AziElevChange(Sender: TObject);
-begin
- gRayCast.LightAzimuth := LightAziTrack.Position;
- gRayCast.LightElevation := LightElevTrack.Position;
- GLBox.Invalidate;
-end;
-
-procedure TGLForm1.RecompileShader(oldQ, newQ: integer);
-//recompile shader to-from level 10 (which uses bicubic)
-begin
- if (oldQ = newQ) then exit; //no change
- if (oldQ <> 10) and (newQ <> 10) then exit; //neither used bicubic
- GLBox.MakeCurrent(false);
- InitGL (false);
- {$IFNDEF USETRANSFERTEXTURE}
- Calculate_Transfer_Function;
- CreateHisto (gTexture3D,gCLUTrec.Min,gCLUTrec.Max,gTexture3D.WindowHisto, true);
- {$ELSE}
- UpdateTransferFunctionX(gCLUTrec,gRayCast.TransferTexture1D);
- CreateHisto (gTexture3D,gCLUTrec.Min,gCLUTrec.Max,gTexture3D.WindowHisto, true);
- {$ENDIF}
- GLBox.ReleaseContext;
-end;
-
-procedure TGLForm1.QualityTrackChange(Sender: TObject);
-var
- lPrev: integer;
-begin
- lPrev := gPrefs.RayCastQuality1to10;
- gPrefs.RayCastQuality1to10 := QualityTrack.position;
- RecompileShader(lPrev, gPrefs.RayCastQuality1to10); //switch shader CUBIC_FILTER
- GLbox.Invalidate;
-end;
-
-procedure TGLForm1.ShaderDropChange(Sender: TObject);
-begin
- SetShader(ShaderDir+pathdelim+ShaderDrop.Items[ShaderDrop.ItemIndex]+'.txt');
-end;
-
-procedure TGLForm1.UniformChange(Sender: TObject);
-begin
- ShaderMemo.lines.BeginUpdate;
- ShaderMemo.lines.clear;
- ReportUniformChange(Sender);
- ShaderMemo.Lines.EndUpdate;
- GLbox.Invalidate;
-end;
-
-procedure TGLForm1.UpdateTimerTimer(Sender: TObject);
-begin
- GLForm1.Refresh;
- // StringGridSetCaption(gPrevRow);
- UpdateTimer.Enabled := false;
- M_refresh := true;
- GLbox.Invalidate;
-end;
-
-procedure TGLForm1.ToggleTransparency1Click(Sender: TObject);
-begin
-
- gPrefs.ColorEditor := ToggleTransparency1.checked;
- GLbox.Invalidate;
-end;
-
-procedure TGLForm1.FormClose(Sender: TObject; var TheAction: TCloseAction);
-begin
- gRendering:=true;
- UpdateTimer.Enabled := false;
- GradientsIdleTimer.Enabled := false;
- StopScripts;
- if (not voiIsEmpty) and (voiIsModified) then
- SaveVOI1Click(nil);
- gPrefs.FormWidth := glForm1.Width;
- gPrefs.FormHeight := glForm1.Height;
- gPrefs.FormMaximized := glForm1.WindowState = wsMaximized;
- gPrefs.ShowToolbar := Tool1.checked;
- IniFile(false,IniName,gPrefs);
- Closeoverlays1Click(nil);
- InitTexture(gTexture3D);
- {$IFNDEF FPC}DragAcceptFiles(GLForm1.Handle, False);{$ENDIF}
-
- //gClipboardBitmap.Free;
-end;
-
-procedure TGLForm1.HideBtnClick(Sender: TObject);
-begin
- XTrackBar.Position := 0;
- X2TrackBar.Position := 0;
- {$IFDEF FPC} CutoutChange(nil); {$ENDIF}
-end;
-
-type
- T4D = record
- X,Y,Z,D: single;
- end;
-
-procedure TGLForm1.CutoutNearestSector(Sender: TObject);
-var
- lDx: single;
- lMin,lTest: T4D;
- lDirection: integer;
-begin
-
- lDx := sqrt(1/3); //unit circle: by pythgorean equation...
- lMin.D := 1.0 / 0.0;
- while gRaycast.Azimuth < 0 do gRaycast.Azimuth := gRaycast.Azimuth+ 360;
- //caption := inttostr(gRaycast.Azimuth)+' '+inttostr(gRayCast.Elevation);
- for lDirection := 1 to 8 do begin
- if lDirection <= 4 then
- lTest.X := lDx
- else
- lTest.X := -lDx;
- Case lDirection of
- 1,2,5,6: lTest.Y := lDx;
- else lTest.Y := -lDx;
- end;//Y case
- if odd(lDirection) then
- lTest.Z := lDx
- else
- lTest.Z := -lDx;
- if gRayCast.Elevation < 0 then
- lTest.D := (lTest.Z)
- else
- lTest.D := -(lTest.Z);
- if (gRaycast.Azimuth >= 90) and (gRaycast.Azimuth < 270) then //gRayCast.Azimuth
- lTest.D := lTest.D-(lTest.Y)
- else
- lTest.D := lTest.D+(lTest.Y);
- if (gRaycast.Azimuth >= 0) and (gRaycast.Azimuth < 180) then //gRayCast.Azimuth
- lTest.D := lTest.D+(lTest.X)
- else
- lTest.D := lTest.D-(lTest.X);
- //lTest.D := sqrt(lTest.D);//pythagorean theorem Dx = sqrt(x^2+y^2+z^2)
- if lTest.D < lMin.D then begin //we have found a new minimum
- lMin.X := lTest.X;
- lMin.Y := lTest.Y;
- lMin.Z := lTest.Z;
- lMin.D := lTest.D;
- //showmessage(floattostr(lTest.D));
- end;//new minimum end; //
- end; //for each possible hemiquadrant
- //now set quadrants based on outcome...
- if lMin.X < 0 then begin
- XTrackBar.Position := 0;
- X2TrackBar.Position := 500;
- end else begin
- XTrackBar.Position := 500;
- X2TrackBar.Position := 1000;
- end;
- if lMin.Y < 0 then begin
- YTrackBar.Position := 0;
- Y2TrackBar.Position := 500;
- end else begin
- YTrackBar.Position := 500;
- Y2TrackBar.Position := 1000;
- end;
- if lMin.Z < 0 then begin
- ZTrackBar.Position := 0;
- Z2TrackBar.Position := 500;
- end else begin
- ZTrackBar.Position := 500;
- Z2TrackBar.Position := 1000;
- end;
- {$IFDEF FPC} CutoutChange(nil); {$ENDIF}
-end; //CutoutNearestSector
-
-procedure TGLForm1.CutoutChange(Sender: TObject);
-begin
- M_Refresh := TRUE;
- {$IFDEF ENABLESCRIPT}
- {$IFDEF darwin}
- //OSX can not use a timer during scripting
- if ScriptForm.PSScript1.running then
- exit;
- {$ENDIF}
- {$ENDIF}
- GLForm1.UpdateTimer.Enabled := true;
- if gPrefs.FasterGradientCalculations then
- GradientsIdleTimerReset;
-end;
-
-(*procedure TGLForm1.OrthoSliceClick(Sender: TObject);
-begin
- gPrefs.OrthoSliceView := OrthoSlice.checked;
- GLbox.Invalidate;
-end; *)
-
-function Str2FloatSafe(S: string; var FloatVal: single): boolean;
-//like StrToFloat but accepts either decimal separator: '1.23' or '1,23'
-var
- inVal: single;
- fmt: TFormatSettings;
-begin
- result := false;
- if length(S) < 1 then exit;
- result := true;
- inVal := FloatVal;
- fmt := DefaultFormatSettings;
- fmt.DecimalSeparator := '.';
- if TryStrToFloat(s, FloatVal, fmt) then
- exit;
- fmt.DecimalSeparator := ',';
- if TryStrToFloat(s, FloatVal, fmt) then
- exit;
- result := false;
- FloatVal := inVal;
-end;
-
-(*function Str2FloatSafe(S: string; var FloatVal: single): boolean;
-var
- NewVal: single;
- errorPos: integer;
-begin
- result := false;
- if length(S) < 1 then exit;
- Val(S, NewVal, errorPos);
- result := (errorPos = 0);
- if result then FloatVal := NewVal;
-end;*)
-
-procedure TGLForm1.MinMaxEditKeyPress(Sender: TObject; var Key: Char);
-const
- AllowDec = true; FAllowNeg = true;
-begin
-
- case Key of
- '-','0'..'9' : ;
- '.',',' : if AllowDec AND (pos(DecimalSeparator,(Sender as TEdit).Text)=0)
- then Key := DecimalSeparator
- else Key:=#0;
- #8 : ;
- chr(127): ;
- (*#45 : if FAllowNeg then
- begin
- s := (Sender as TEdit).Text;
- if (length(s) < 1) or (s[1] <> '-') then
- (Sender as TEdit).Text := '-'+s
- else
- (Sender as TEdit).Text := Copy(s, 2,length(s)-1);
- (Sender as TEdit).SelStart := length(s)+1;
- Key:=#0;
- end;*)
- else
- Key:=#0;
- end;
-end;
-
-procedure TGLForm1.MinMaxEditKeyUp(Sender: TObject; var Key: Word;
- Shift: TShiftState);
-var
- mn,mx: single;
-begin
- mn := gCLUTrec.min;
- mx := gCLUTrec.max;
-
- if Str2FloatSafe(MinEdit.Text,gCLUTrec.min) and Str2FloatSafe(MaxEdit.Text,gCLUTrec.max) then begin
- if (mn = gCLUTrec.min) and (mx = gCLUTrec.max) then exit; //no change
- M_refresh := true;
- UpdateTimer.Enabled := false;
- UpdateTimer.Enabled := true;
- end;
-end;
-
-procedure TGLForm1.ClrbarMenu1Click(Sender: TObject);
-begin
- gPrefs.Colorbar := VisibleClrbarMenu.checked;
- GLBox.invalidate;
-end;
-
-procedure TGLForm1.AdjustFormPos (var lForm: TForm);
-{$IFDEF FPC}
-const
- kBorderHt = 30;
- kBorderWid = 10;
-{$ELSE}
-const
- kBorderHt = 0;
- kBorderWid = 0;
-{$ENDIF}
-const
-{$IFDEF FPC}
-kExtra = 8;
-{$ELSE}
-kExtra = 0;
-{$ENDIF}
-var
- lPos: integer;
- lVidX,lVidY,lLeft,lTop: integer;
-begin
-
- ScreenRes(lVidX,lVidY);
- lPos := lForm.Tag;
- if odd(lPos) then begin//form on left
- lLeft := GLForm1.Left-lForm.Width-kBorderWid;
- if lLeft < 0 then //try putting the form on the right
- lLeft := GLForm1.Left+GLForm1.Width+kExtra; //form on right
- end else begin
- lLeft := GLForm1.Left+GLForm1.Width+kExtra;//-default: right
- if ((lLeft+ lForm.Width) > lVidX) then
- lLeft := GLForm1.Left-lForm.Width-kBorderWid; //try on right
- end;
- if lPos < 3 then begin //align with top
- lTop := GLForm1.Top; //default - align with top
- if lTop < 0 then //backup - top of screen
- lTop := 0;
- end else if lPos > 4 then begin //align with vertical middle
- lTop := GLForm1.Top+(GLForm1.Height div 2)-(lForm.Height div 2)+kBorderHt; //default - align with bottom
- if ((lTop+lForm.Height) > lVidY) then
- lTop := GLForm1.Top; //backup - align with top
- if lTop < 0 then
- lTop := 0;
- end else begin //align with bottom
- lTop := GLForm1.Top+GLForm1.Height-lForm.Height+kBorderHt; //default - align with bottom
- if ((lTop+lForm.Height) > lVidY) then
- lTop := GLForm1.Top; //backup - align with top
- if lTop < 0 then
- lTop := 0;
- end;
- if (lPos = 0) or ((lLeft+ lForm.Width) > lVidX) or (lLeft < 0)
- or (lTop < 0) or ((lTop+lForm.Height) > lVidY) then
- lForm.Position := poScreenCenter
- else begin
- lForm.Position := poDesigned;
- lForm.Left := lLeft;
- lForm.Top := lTop;
- end;
-end;
-
-procedure TGLForm1.Overlays1Click(Sender: TObject);
-begin
-//
-end;
-
-procedure TGLForm1.Mosaic1Click(Sender: TObject);
-begin
- gPrefs.SliceView := (Sender as TMenuItem).tag;
- SetToolPanelWidth;
- //AdjustFormPos(TFOrm(MosaicPrefsForm));
- UpdateMosaic(Sender);
-end;
-
-procedure TGLForm1.Scripting1Click(Sender: TObject);
-begin
-{$IFDEF ENABLESCRIPT}
- AdjustFormPos(TForm(ScriptForm));
- ScriptForm.SHow;
-{$ENDIF}
-end;
-
-(*function GetFloat(lStr: string; lMin,lDefault,lMax: single): single;
-var
- s: string;
-begin
- s := floattostr(ldefault);
- InputQuery('Integer required',lStr,s);
- try
- result := StrToFloat(S);
- except
- on Exception : EConvertError do
- result := ldefault;
- end;
- if result < lmin then
- result := lmin;
- if result > lmax then
-end;*)
-function GetFloat(prompt: string; min,def,max: double): double;
-var
- PrefForm: TForm;
- OkBtn: TButton;
- promptLabel: TLabel;
- valEdit: TEdit;
-begin
- PrefForm:=TForm.Create(nil);
- PrefForm.SetBounds(100, 100, 512, 112);
- PrefForm.Caption:='Value required';
- PrefForm.Position := poScreenCenter;
- PrefForm.BorderStyle := bsDialog;
- //label
- promptLabel:=TLabel.create(PrefForm);
- promptLabel.Caption:= prompt;
- if (min < max) then
- promptLabel.Caption:= format('%s (range %g..%g)', [prompt, min, max]);
- promptLabel.Left := 8;
- promptLabel.Top := 12;
- promptLabel.Parent:=PrefForm;
- //edit
- valEdit:=TEdit.create(PrefForm);
- valEdit.Caption := FloatToStrF(def, ffGeneral, 8, 4);
- valEdit.Top := 42;
- valEdit.Width := PrefForm.Width - 16;
- valEdit.Left := 8;
- valEdit.Parent:=PrefForm;
- //OK button
- OkBtn:=TButton.create(PrefForm);
- OkBtn.Caption:='OK';
- OkBtn.Top := 78;
- OkBtn.Width := 128;
- OkBtn.Left := PrefForm.Width - OkBtn.Width - 8;
- OkBtn.Parent:=PrefForm;
- OkBtn.ModalResult:= mrOK;
- {$IFDEF Windows} ScaleDPI(PrefForm, 96); {$ENDIF}
- {$IFDEF Linux} ScaleDPIX(PrefForm, 96); {$ENDIF}
- {$IFDEF LCLCocoa}
- if gPrefs.DarkMode then GLForm1.SetFormDarkMode(PrefForm);
- {$ENDIF}
- PrefForm.ShowModal;
- result := NaN;
- if (PrefForm.ModalResult = mrOK) then begin
- result := StrToFloatDef(valEdit.Caption, def);
- if (min < max) and (result < min) then
- result := min;
- if (min < max) and (result > max) then
- result := max;
- end;
- FreeAndNil(PrefForm);
-end; //GetFloat()
-
-procedure TGLForm1.BET1Click(Sender: TObject);
-var
- lFrac: double;
- lB: string;
-begin
- lFrac := GetFloat('Brain extraction fraction (smaller values lead to larger brain volume)',0.1,0.45,0.9);
- if specialdouble(lFrac) then exit;
- if not OpenDialog1.Execute then
- exit;
- lB := FSLbet(OpenDialog1.FileName,lFrac);
- LoadDatasetNIFTIvol1(lB,true);
-end;
-
-procedure TGLForm1.GradientsIdleTimerReset;
-begin
- GradientsIdleTimer.Enabled := false;
- GradientsIdleTimer.Enabled := true;
- M_Refresh := TRUE;
-end;
-
-procedure TGLForm1.voiBinarize1Click(Sender: TObject);
-begin
- voiBinarize(1);
- //voiInterpolate;
- GLForm1.UpdateGL;
-end;
-
-procedure TGLForm1.voiDescriptives1Click(Sender: TObject);
-var
- nPix : integer;
- loutmm3: single;
-begin
- nPix := voiDescriptives;
- if nPix < 1 then begin
- showmessage('Unable to generate descriptives: no open drawing');
- exit;
- end;
- loutmm3 := abs(gTexture3D.NIFTIhdr.pixdim[1]*gTexture3D.NIFTIhdr.pixdim[2]*gTexture3D.NIFTIhdr.pixdim[3]);
-
- showmessage (format('Volume of drawing is %d voxels (%.0fmm^3, %.03fcc).',[nPix, nPix * loutmm3, nPix * loutmm3/1000]));
-
-end;
-
-procedure TGLForm1.GradientsIdleTimerTimer(Sender: TObject);
-begin
- GradientsIdleTimer.Enabled := false;
- GLbox.Invalidate;
-end;
-
-procedure IncTrackBar (T: TTrackBar; isDepthTrack: boolean);
-var
- i: integer;
-begin
- i := (T.Max div 4);
- i := ((i+T.Position) div i) * i;
- if i >= T.Max then i := T.Min;
- T.position := i;
- if not(isDepthTrack) and (T.position <> 0) and (GLForm1.ClipTrack.position = 0) then
- GLForm1.ClipTrack.Position := GLForm1.ClipTrack.Max div 2;
-end;
-
-procedure TGLForm1.Label4Click(Sender: TObject);
-begin
- IncTrackBar(ClipTrack, true);
-end;
-
-procedure TGLForm1.Label5Click(Sender: TObject);
-begin
- IncTrackBar(AziTrack1, false);
-end;
-
-procedure TGLForm1.Label6Click(Sender: TObject);
-begin
- IncTrackBar(ElevTrack1, false);
-end;
-
-procedure TGLForm1.Extract1Click(Sender: TObject);
-begin
- {$IFDEF USETRANSFERTEXTURE}
- showmessage('Not yet available in this version');
- {$ELSE}
- if gTexture3D.RawUnscaledImgRGBA <> nil then begin
- showmessage('Only able to extract grayscale images (not RGB color images).');
- exit;
- end;
- {$IFDEF LCLCocoa}
- ExtractForm.PopupMode:= pmAuto; //see issue 33616
- //setThemeMode(ExtractForm.Handle, gPrefs.DarkMode);
- setThemeMode(ExtractForm, gPrefs.DarkMode);
-
- {$ENDIF}
- ExtractForm.ShowModal;
- if ExtractForm.ModalResult <> mrOK then exit;
- ExtractTexture (gTexture3D, ExtractForm.OtsuLevelsEdit.value, ExtractForm.DilateEdit.value, ExtractForm.OneContiguousObjectCheck.checked);
- M_refresh := true;
- UpdateTimer.Enabled := true;
- {$ENDIF}
-end;
-
-
-procedure TGLForm1.FormKeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
-var
- X,Y,Z: single;
-begin
- //if not GLForm1.Focused then exit; //e.g. do not intercept key srokes if use is editing a script!
- //Requires Form.KeyPreview := true;
- if (gPrefs.SliceView < 1) or (gPrefs.SliceView >= 5 ) then exit; //not for render or mosaic
- if MinEdit.Focused or MaxEdit.Focused or LineWidthEdit.Focused or XCoordEdit.Focused or YCoordEdit.Focused or ZCoordEdit.Focused then exit;
- X := 0; Y := 0; Z := 0;
- Case Key of
- 36: Y := -1.0; //home Fn+left_arrow on OSX
- 35: Y := +1.0; //end Fn+right_arrow on OSX
- 37: X := -1.0; //left arrow
- 38: Z := +1.0; //up arrow
- 39: X := +1.0; //right arrow
- 40: Z := -1.0; //down arrow
- end; //case Key
- if (X = 0) and (Y = 0) and (Z = 0) then exit;
- OrthoCoordMidSlice(X,Y,Z);
- ShowOrthoSliceInfo (false);
- (*X := round(FracToSlice(gRayCast.OrthoX,gTexture3D.FiltDim[1]))-0.5 + X;
- Y := round(FracToSlice(gRayCast.OrthoY,gTexture3D.FiltDim[2]))-0.5 + Y;
- Z := round(FracToSlice(gRayCast.OrthoZ,gTexture3D.FiltDim[3]))-0.5 + Z;
- boundF(X,0.5, gTexture3D.FiltDim[1]-0.5);
- boundF(Y,0.5, gTexture3D.FiltDim[2]-0.5);
- boundF(Z,0.5, gTexture3D.FiltDim[3]-0.5);
- gRayCast.OrthoX := X/gTexture3D.FiltDim[1];
- gRayCast.OrthoY := Y/gTexture3D.FiltDim[2];
- gRayCast.OrthoZ := Z/gTexture3D.FiltDim[3]; *)
- UpdateGL;
-end;
-
-procedure TGLForm1.MinMaxEditExit(Sender: TObject);
-begin
- //Cursor := crDefault;
-end;
-
-
-procedure TGLForm1.UpdateFont(initialSetup: boolean);
-var
- p,f: string;
- OK: boolean;
-begin
- p := (ClutDir+pathdelim+gPrefs.FontName+'.png');
- f := (ClutDir+pathdelim+gPrefs.FontName+'.json');
- if (gPrefs.FontName = '') or (not fileexists(p)) or (not fileexists(f)) then begin
- gPrefs.FontName := '';
- p := '';
- end;
- if initialSetup then begin
- gClrbar:= TGLClrbar.Create(p, GLBox);
- if (gPrefs.ColorbarSize < 0.01) or (gPrefs.ColorbarSize > 0.3) then
- gPrefs.ColorbarSize := gClrbar.SizeFraction;
- gClrbar.SizeFraction := gPrefs.ColorbarSize;
- gText := TGLText.Create(p,OK,GLBox);
- end
- else begin
- gText.ChangeFontName(p, GLBox);
- gClrBar.ChangeFontName(p, GLBox);
- GLBox.Invalidate;
- end;
-end;
-
-{$IFDEF UNIX}
-function latestGitRelease(url: string): string;
-//Returns string for latest release (error will return empty string)
-//example
-// latestGitRelease('https://api.github.com/repos/rordenlab/dcm2niix/releases/latest');
-//will return
-// "v1.0.20171204" / "v1.0.20180306"
-const
- key = '"tag_name":"';
-var
- s, e: integer;
- cli: TFPHTTPClient;
-begin
- result := '';
- cli := TFPHTTPClient.Create(nil);
- cli.AddHeader('User-Agent','Mozilla/5.0 (compatible; fpweb)');
- try
- try
- result := Cli.Get(url);
- except
- result := '';
- end;
- finally
- cli.free
- end;
- if length(result) < 1 then exit;
- s := posex(key, result);
- if s < 1 then begin
- result := '';
- exit;
- end;
- s := s+length(key);
- e:= posex('"', result, s);
- if e < 1 then begin
- result := '';
- exit;
- end;
- result := copy(result, s, e-s);
-end;
-
-procedure ReportGitVer(localVer, api, url, exe: string);
-var
- gitVer, exeNam: string;
- git, local: integer;
-begin
- exeNam := ExtractFileName(exe);
- if length(localVer) < 8 then begin //last 8 digits are date: v.1.0.20170101
- MessageDlg(exeNam,'Unable to detect version: '+exe, mtConfirmation,[mbOK],0) ;
- //showmessage('Unable to detect latest version: '+exe);
- Clipboard.AsText := exe+' : '+ localVer;
- exit;
- end;
- gitVer := latestGitRelease(api);
- if length(gitVer) < 8 then begin //last 8 digits are date: v.1.0.20170101
- showmessage('Unable to detect latest version: are you connected to the web and do you have libssl installed? '+api);
- exit;
- end;
-
- if CompareText(gitVer, localVer) = 0 then begin
- //showmessage('You are running the latest release '+localVer);
- MessageDlg(exeNam,'You are running the latest release '+localVer, mtConfirmation,[mbOK],0) ;
- exit;
- end;
- git := strtointdef(RightStr(gitVer,8),0);
- local := strtointdef(RightStr(localVer,8),0);
- if local > git then
- MessageDlg(exeNam,'You are running a beta release '+localVer+', the latest stable release is '+gitVer+' Visit '+url +' to update '+exe, mtConfirmation,[mbOK],0)
-
- //showmessage('You are running a beta release '+localVer+', the latest stable release is '+gitVer+' Visit '+url +' to update '+exe)
- else
- MessageDlg(exeNam,'You are running an old release '+localVer+', the latest stable release is '+gitVer+' Visit '+url +' to update '+exe, mtConfirmation,[mbOK],0)
- //showmessage('You are running an old release '+localVer+', the latest stable release is '+gitVer+' Visit '+url +' to update '+exe);
-end;
-
-procedure CheckForUpdatesMRIcroGL;
-const
- kBase = '/neurolabusc/MRIcroGL/releases/latest';
- kUrl = 'https://github.com' + kBase;
- kApi = 'https://api.github.com/repos' + kBase;
-begin
- ReportGitVer(kVers, kApi, kUrl, paramstr(0));
-end;
-
-function delimStr(s, default: string; idx: integer): string;
-//e.g. delimStr('Chris Rorden's dcm2niiX version v1.0.20171215 GCC6.1.0',5) returns 'v1.0.20171215'
-var
- strs : TStringList;
-begin
- result := default;
- strs := TStringList.Create;
- strs.DelimitedText := s;
- if (strs.Count >= idx) then
- result := strs[idx-1]; //string lists are indexed from 0
- strs.Free;
-end;
-
-procedure CheckForUpdatesDcm2niix;
-const
- kBase = '/rordenlab/dcm2niix/releases/latest';
- kUrl = 'https://github.com' + kBase;
- kApi = 'https://api.github.com/repos' + kBase;
-var
- exe, cmd, line1, localVer: string;
-begin
- exe := dcm2niiForm.getExeName;
- if not fileexists(exe) then begin
- showmessage('Unable to find dcm2niix installed '+ exe);
- exit;
- end;
- cmd := '"'+exe +'" -h';
- dcm2niiForm.RunCmd(cmd, false, line1);
- localVer := delimStr(line1, line1, 5);
- ReportGitVer(localVer, kApi, kUrl, exe);
-end;
-
-(*
-//this is an alternate method, using dcm2niix's internal methods: has additional dependencies (sed, awk) and Unix only
-procedure CheckForUpdatesDcm2niix;
-var
- exe, cmd: string;
- ret: integer;
-begin
- exe := dcm2niiForm.getExeName;
- if not fileexists(exe) then begin
- showmessage('Unable to find dcm2niix installed '+ exe);
- end;
- cmd := '"'+exe +'" -u';
- ret := dcm2niiForm.RunCmd(cmd, false);
- if ret = 3 then
- showmessage('Unable to check dcm2niix version')
- else if ret = 2 then
- showmessage('Your version of dcm2niix is more recent than latest stable release '+exe)
- else if ret = 1 then
- showmessage('Your version of dcm2niix is obsolete '+exe)
- else
- showmessage('Your version of dcm2niix is up to date');
-end;*)
-
-
-procedure TGLForm1.CheckForUpdates(Sender: TObject);
-begin
- CheckForUpdatesMRIcroGL;
- CheckForUpdatesDcm2niix;
-end;
-{$ELSE}
-procedure TGLForm1.CheckForUpdates(Sender: TObject);
-begin
- //not available for windows
-end;
-
-{$ENDIF}
-
-procedure PrefMenuClick;
-var
- PrefForm: TForm;
- bmpEdit: TEdit;
- {$IFDEF FPC}TiledCheck,{$ENDIF}
- {$IFDEF LCLCocoa} DarkModeCheck, RetinaCheck,{$ENDIF} flipCheck: TCheckBox;
- {$IFDEF FPC}UpdateBtn: TButton;{$ENDIF}
- OkBtn, AdvancedBtn: TButton;
- bmpLabel: TLabel;
- searchRec: TSearchRec;
- s: string;
- FontCombo : TComboBox;
- isFontChanged, isFlipChanged,isAdvancedPrefs {$IFDEF LCLCocoa}, isDarkModeChanged, isRetinaChanged {$ENDIF}: boolean;
-begin
- //PrefForm:=TForm.Create(nil);
- PrefForm:=TForm.Create(GLForm1);
- PrefForm.SetBounds(100, 100, 520, 242);
- PrefForm.Caption:='Preferences';
- PrefForm.Position := poScreenCenter;
- PrefForm.BorderStyle := bsDialog;
- {$IFNDEF FPC}PrefForm.AutoSize := true;{$ENDIF}
- //flipCheck
- flipCheck:=TCheckBox.create(PrefForm);
- flipCheck.Checked := gPrefs.FlipYZ;
- flipCheck.Caption:='Flip Y/Z axis (animal scans)';
- flipCheck.Left := 8;
- flipCheck.Top := 18;
- flipCheck.Parent:=PrefForm;
- //Bitmap Scale
- bmpLabel:=TLabel.create(PrefForm);
- bmpLabel.Left := 8;
- bmpLabel.Top := 48;
- bmpLabel.Width := PrefForm.Width - 86;
- bmpLabel.Caption := 'Bitmap zoom (large values create huge images)';
- bmpLabel.Parent:=PrefForm;
- //bmp edit
- bmpEdit := TEdit.Create(PrefForm);
- bmpEdit.Left := PrefForm.Width - 76;
- bmpEdit.Top := 48;
- bmpEdit.Width := 60;
- bmpEdit.Text := inttostr(gPrefs.BitmapZoom);
- bmpEdit.Parent:=PrefForm;
- //Font name
- FontCombo:=TComboBox.create(PrefForm);
- FontCombo.Parent:=PrefForm;
- FontCombo.Left := 8;
- FontCombo.Top := 78;
- FontCombo.Width := PrefForm.Width -16;
- FontCombo.Items.Add('Default Font');
- //add fonts
- FontCombo.ItemIndex:= 0;
- if FindFirst(ClutDir+pathdelim+'*.json', faAnyFile, searchRec) = 0 then begin
- repeat
- s :=ParseFileName(ExtractFileName(searchRec.Name));
- if (length(s) > 1) and (s[1] <> '.') and (fileexists(ClutDir+pathdelim+s+'.png')) then begin
- FontCombo.Items.Add(s);
- if (s = gPrefs.FontName) then
- FontCombo.ItemIndex := FontCombo.Items.Count-1;
- end;
- until (FindNext(searchRec) <> 0);
- end; //find fonts
- FindClose(searchRec);
- FontCombo.Style := csDropDownList;
- FontCombo.Parent:=PrefForm;
- //Tiled Check
- {$IFDEF FPC}
- TiledCheck:=TCheckBox.create(PrefForm);
- TiledCheck.Checked := gPrefs.isTiledScreenShot;
- TiledCheck.Caption:='Tiled bitmaps (more compatible)';
- TiledCheck.Left := 8;
- TiledCheck.Top := 108;
- TiledCheck.Parent:=PrefForm;
- {$ENDIF}
- //Retina Check
- {$IFDEF LCLCocoa}
- RetinaCheck:=TCheckBox.create(PrefForm);
- RetinaCheck.Checked := gPrefs.RetinaDisplay;
- RetinaCheck.Caption:='Retina display (better but slower)';
- RetinaCheck.Left := 8;
- RetinaCheck.Top := 138;
- RetinaCheck.Parent:=PrefForm;
- //
- DarkModeCheck:=TCheckBox.create(PrefForm);
- //
- DarkModeCheck.Checked := gPrefs.DarkMode;
- DarkModeCheck.Caption:='Dark Mode';
- DarkModeCheck.Left := 8;
- DarkModeCheck.Top := 168;
- DarkModeCheck.Parent:=PrefForm;
- GLForm1.SetFormDarkMode(PrefForm);
- {$ENDIF}
- //UpdateBtn
- {$IFDEF UNIX}
- (*UpdateBtn:=TButton.create(PrefForm);
- UpdateBtn.Caption:='Check for updates';
- UpdateBtn.Left := 28;
- UpdateBtn.Width:= 168;
- UpdateBtn.Top := 198;
- UpdateBtn.Parent:=PrefForm;
- UpdateBtn.OnClick:= GLForm1.CheckForUpdates;*)
- {$ENDIF}
- //UpdateBtn.ModalResult:= mrOK;
-
- //OK button
- OkBtn:=TButton.create(PrefForm);
- OkBtn.Caption:='OK';
- OkBtn.Left := PrefForm.Width - 128;
- OkBtn.Width:= 100;
- OkBtn.Top := 198;
- OkBtn.Parent:=PrefForm;
- OkBtn.ModalResult:= mrOK;
- //Advanced button
- AdvancedBtn:=TButton.create(PrefForm);
- AdvancedBtn.Caption:='Advanced';
- AdvancedBtn.Left := PrefForm.Width - 256;
- AdvancedBtn.Width:= 100;
- AdvancedBtn.Top := 198;
- AdvancedBtn.Parent:=PrefForm;
- AdvancedBtn.ModalResult:= mrYesToAll;
- {$IFDEF Windows} ScaleDPI(PrefForm, 96); {$ENDIF}
- {$IFDEF Linux} ScaleDPIX(PrefForm, 96); {$ENDIF}
- PrefForm.ShowModal;
- if (PrefForm.ModalResult <> mrOK) and (PrefForm.ModalResult <> mrYesToAll) then begin
- FreeAndNil(PrefForm);
- exit; //if user closes window with out pressing "OK"
- end;
- isFlipChanged := (gPrefs.FlipYZ <> FlipCheck.Checked);
- gPrefs.FlipYZ:= FlipCheck.Checked;
- gPrefs.BitmapZoom:= strtointdef(bmpEdit.Text,1);
- if gPrefs.BitmapZoom < 1 then gPrefs.BitmapZoom := 1;
- if gPrefs.BitmapZoom > 10 then gPrefs.BitmapZoom := 10;
- isAdvancedPrefs := (PrefForm.ModalResult = mrYesToAll);
- {$IFDEF FPC}
- gPrefs.isTiledScreenShot := TiledCheck.Checked;
- {$ENDIF}
- {$IFDEF LCLCocoa}
- isRetinaChanged := gPrefs.RetinaDisplay <> RetinaCheck.Checked;
- gPrefs.RetinaDisplay := RetinaCheck.Checked;
- isDarkModeChanged := gPrefs.DarkMode <> DarkModeCheck.Checked;
- gPrefs.DarkMode := DarkModeCheck.Checked;
- {$ENDIF}
- s := '';
- if FontCombo.ItemIndex > 0 then
- s := FontCombo.Items[FontCombo.ItemIndex];
- isFontChanged := (s <> gPrefs.FontName);
- gPrefs.FontName := s;
- FreeAndNil(PrefForm);
- if isAdvancedPrefs then begin
- GLForm1.Refresh;
- //showmessage('Success');
- GLForm1.Quit2TextEditor;
- exit;
- end;
- if isFlipChanged then
- GLForm1.OpenMRU(nil);
- if isFontChanged then
- GLForm1.UpdateFont(false);
- {$IFDEF LCLCocoa}
- if isDarkModeChanged then
- GLForm1.SetDarkMode();
- if isRetinaChanged then begin
- GLForm1.SetRetina;
- //GLBox.WantsBestResolutionOpenGLSurface:=gPrefs.RetinaDisplay;
- AreaInitialized := false;
- //M_Refresh := true;
- GLForm1.UpdateTimer.enabled := true;
- end;
- {$ENDIF}
-
-end; // PrefMenuClick()
-
-procedure SetBitmapZoom;
-begin
- gPrefs.BitmapZoom := ReadIntForm.GetInt('Bitmap zoom (large values create huge images)',1,gPrefs.BitmapZoom,10);
-end; // SetBitmapZoom()
-
-procedure TGLForm1.Preferences1Click(Sender: TObject);
-begin
- PrefMenuClick;//SetBitmapZoom;
-end;
-
-procedure TGLForm1.NewWindow1Click(Sender: TObject);
-{$IFNDEF UNIX}
-begin
- ShellExecute(handle,'open',PChar(paramstr(0)), '','',SW_SHOWNORMAL); //uses ShellApi;
-end;
-{$ELSE}
-var
- AProcess: TProcess;
- i : integer;
- //http://wiki.freepascal.org/Executing_External_Programs
-begin
- IniFile(false,IniName,gPrefs); //load new window with latest settings
- AProcess := TProcess.Create(nil);
- AProcess.InheritHandles := False;
- //AProcess.Options := [poNoConsole]; //poNoConsole is Windows only! http://lazarus-ccr.sourceforge.net/docs/fcl/process/tprocess.options.html
- //AProcess.ShowWindow := swoShow; //Windows only http://www.freepascal.org/docs-html/fcl/process/tprocess.showwindow.html
- for I := 1 to GetEnvironmentVariableCount do
- AProcess.Environment.Add(GetEnvironmentString(I));
- {$IFDEF Darwin}
- AProcess.Executable := 'open';
- AProcess.Parameters.Add('-n');
- AProcess.Parameters.Add('-a');
- AProcess.Parameters.Add(paramstr(0));
- {$ELSE}
- AProcess.Executable := paramstr(0);
- {$ENDIF}
- //AProcess.Parameters.Add('/Users/rorden/Documents/osx/MRIcroGL.app/Contents/MacOS/MRIcroGL');
- AProcess.Execute;
- AProcess.Free;
-end;
-{$ENDIF}
-
-procedure TGLForm1.Copy1Click(Sender: TObject);
-var bmp: TBitmap;
-begin
- if (ssShift in KeyDataToShiftState(vk_Shift)) then
- setBitmapZoom;
- bmp := ScreenShot(gPrefs.BitmapZoom);
- Clipboard.Assign(bmp);
- bmp.Free;
-end;
-
-(*procedure TGLForm1.Copy1Click(Sender: TObject);
-{$IFNDEF FPC}
-var
- MyFormat : Word;
- AData : THandle;
- APalette : hPalette; // Wrong in D3-D7 online example
-{$ENDIF}
-begin
- if not GenerateClipboardImage then exit;
- {$IFDEF FPC}
- gClipboardBitmap.SaveToClipboardFormat(2);
- {$ELSE}
- gClipboardBitmap.SaveToClipBoardFormat(MyFormat,AData,APalette);
- ClipBoard.SetAsHandle(MyFormat,AData);
- {$ENDIF}
-end; *)
-
-{$IFNDEF FPC}
-{$IFDEF PNG} //proprietary PNGIMAGE IN PATH
-
-procedure SaveImgAsPNGCore (var lImage: TBitmap; lFilename: string);
-var
- PNG: TPNGObject;
-begin
- if (lImage = nil) then begin
- Showmessage('No image found to save.');
- exit;
- end;
- PNG := TPNGObject.Create;
- try
- PNG.Assign(lImage); //Convert data into png
- PNG.SaveToFile(ChangeFileExt(lFilename,'.png'));
- finally
- PNG.Free;
- end
-end;
-{$ELSE}
-procedure SaveImgAsPNGCore (var lImage: TBitmap; lFilename: string);
-begin
- if (lImage = nil) then begin
- Showmessage('No image found to save.');
- exit;
- end;
- lImage.SaveToFile(ChangeFileExt(lFilename,'.bmp'));
-end;
-
-{$ENDIF}
-{$ELSE}
-procedure SaveImgAsPNGCore (lImage: TBitmap; lFilename: string);
-var
- PNG: TPortableNetworkGraphic;
-begin
- if (lImage = nil) then begin
- Showmessage('No image found to save.');
- exit;
- end;
- PNG := TPortableNetworkGraphic.Create;
- try
- PNG.Assign(lImage); //Convert data into png
- PNG.SaveToFile(ChangeFileExt(lFilename,'.png'));
- finally
- PNG.Free;
- end
-end;
-{$ENDIF}
-
-{$IFDEF FPC}
-//{$DEFINE JPEG}
-{$IFDEF JPEG}
-procedure SaveImgAsJPGCore (lImage: TBitmap; lFilename: string);
-var
- JpegImg : TJpegImage;
-begin
- JpegImg := TJpegImage.Create;
- try
- JpegImg.Assign(lImage) ;
- JpegImg.SaveToFile(ChangeFileExt(lFilename,'.jpg')) ;
- finally
- JpegImg.Free
- end;
-end;
-{$ENDIF}
-{$ELSE}
-procedure SaveImgAsJPGCore (lImage: TBitmap; lFilename: string);
-begin
- lImage.SaveToFile(ChangeFileExt(lFilename,'.bmp'));
-end;
-{$ENDIF}
-
-procedure TGLForm1.SavePicture(lFilename: string; lX,lY: integer); overload;
-var
- bmp: TBitmap;
- png: TPortableNetworkGraphic;
- {$IFDEF LCLCocoa}retina: boolean; {$ENDIF}
-begin
- GLBox.Align := alNone;
- GLBox.Width:=lX;
- GLBox.Height:=lY;
- {$IFDEF LCLCocoa}
- if (gPrefs.RetinaDisplay) then begin
- retina := gPrefs.RetinaDisplay;
- gPrefs.RetinaDisplay := false;
- setRetina;
- end;
- {$ENDIF}
- GLBox.ClientWidth:=lX;
- GLBox.ClientHeight:=lY;
- gRayCast.WINDOW_WIDTH := lX;
- gRayCast.WINDOW_HEIGHT := lY;
- gPrefs.BitmapZoom:=1;
- GLBox.Invalidate;
- {$IFDEF COREGL}
- bmp := ScreenShot(1);
- {$ELSE}
- bmp := ScreenShotX1;
- {$ENDIF}
- GLBox.Align := alClient;
- {$IFDEF LCLCocoa}
- if (retina) then begin
- gPrefs.RetinaDisplay := true;
- setRetina;
- end;
- {$ENDIF}
- gRayCast.WINDOW_WIDTH := GLBox.ClientWidth;
- gRayCast.WINDOW_HEIGHT := GLBox.ClientHeight;
-
- GLBox.Invalidate;
- //JPEG
- {$IFDEF JPEG}
- if (UpCaseExt(lFilename) = '.JPG') or (UpCaseExt(lFilename) = '.JPEG') then
- SaveImgAsJPGCore (bmp, lFilename)
- else {$ENDIF}
- SaveImgAsPNGCore (bmp, lFilename);
- bmp.Free;
-end;
-
-procedure TGLForm1.SavePicture(lFilename: string); overload;
-var bmp: TBitmap;
-begin
- bmp := ScreenShot(gPrefs.BitmapZoom);
- {$IFDEF JPEG}if (UpCaseExt(lFilename) = '.JPG') or (UpCaseExt(lFilename) = '.JPEG') then
- SaveImgAsJPGCore (bmp, lFilename)
- else {$ENDIF}
- SaveImgAsPNGCore (bmp, lFilename);
- bmp.Free;
-end; //proc SavePicture
-
-procedure TGLForm1.Save1Click(Sender: TObject);
-begin
- if (ssShift in KeyDataToShiftState(vk_Shift)) then
- setBitmapZoom;
- {$IFNDEF FPC}{$IFNDEF PNG}
- SaveDialog1.DefaultExt := '*.bmp';
- SaveDialog1.Filter := 'Bitmap|*.bmp';
- {$ENDIF}{$ENDIF}
- if (SaveDialog1.initialDir = '') and fileexists(OpenDialog1.Filename) then
- SaveDialog1.initialDir := ExtractFileDirWithPathDelim(OpenDialog1.Filename);
- if not SaveDialog1.execute then
- exit;
- SavePicture (SaveDialog1.Filename);
-end; //proc Save1Click
-
-procedure TGLForm1.AutoRunTimer1Timer(Sender: TObject);
-begin
- AutoRunTimer1.Enabled := false;
- {$IFDEF ENABLESCRIPT}
- ScriptForm.Compile1Click(nil);
- {$ENDIF}
-end;
-
-procedure TGLForm1.TransparencyVOIClick(Sender: TObject);
-var
- alpha: integer;
-begin
- alpha := (Sender as TMenuItem).tag;
- if (alpha = 0) and (not HideVOI1.checked) then begin //unhide
- if TransparencyVOIhi.checked then
- alpha := TransparencyVOIhi.tag
- else if TransparencyVOIlo.checked then
- alpha := TransparencyVOIlo.tag
- else
- alpha := TransparencyVOImid.tag
- end;
- if alpha > 0 then
- HideVOI1.checked := false;
- voiChangeAlpha(alpha);
- UpdateGL;
-end;
-
-{$IFDEF FPC}
-// http://bugs.freepascal.org/view.php?id=7797
-function SetExtensionFromFilterAtIndex(InName, Filter: String; Index: Integer): String;
-var
- ext: string;
- p, pipe: Integer;
-begin
- result := InName;
- ext := UpCaseExt(InName);
- if length(ext) > 0 then exit;
- Result := '';
- if Index < 1 then Exit;
- p := 0;
- pipe := 0;
- while (p < Length(Filter)) do begin
- Inc(p);
- if Filter[p] = '|' then Inc(pipe);
- if (pipe = 2 * (Index - 1)) then break;
- end;
- if (p = length(Filter)) then exit;
- System.Delete(Filter,1,p);
- p := Pos('|',Filter);
- if (p = 0) then exit;
- System.Delete(Filter,1,p);
- Filter := Copy(Filter,1,MaxInt);
- p := Pos(';',Filter);
- pipe := Pos('|',Filter);
- if (pipe < p) or (p = 0) then p := pipe;
- if (p > 0) then System.Delete(Filter,p,Length(Filter) - p +1);
- Filter := StringReplace(Filter, '*', '',[rfReplaceAll, rfIgnoreCase]);
- if (Pos('?',Filter) > 0) {or (Pos('*',Filter) > 0)} then exit;
- //showmessage(ext+' -> '+filter);
- Result := InName+Filter;
-end;
-{$ENDIF}
-
-procedure TGLForm1.SaveVOI1Click(Sender: TObject);
-var
- ptr: bytep0;
- lHdr: TNIFTIHdr;
- lSrcHdr,lDestHdr: TMRIcroHdr;
-begin
- {$IFNDEF USETRANSFERTEXTURE}
- ptr := voiGetVolume;
- if voiIsEmpty then begin
- showmessage('The drawing is empty: nothing to save');
- exit;
- end;
- if not voiIsModified then begin
- showmessage('This drawing has not been changed. Are you sure you want to save an identical copy?');
- end;
- //
- (*if (SaveDialogVoi.initialDir = '') and fileexists(OpenDialog1.Filename) then begin
- SaveDialogVoi.initialDir := ExtractFileDirWithPathDelim(OpenDialog1.Filename);
- SaveDialogVoi.FileName := SaveDialogVoi.initialDir;
- end else
- SaveDialogVoi.FileName := ParseFileName (OpenDialog1.FileName); *)
- if fileexists(OpenDialog1.filename) then begin
- //SaveDialogVoi.FileName := ChangeFileExt (OpenDialog1.FileName,'.voi');
- SaveDialogVoi.FileName := ChangeFileExtX (OpenDialog1.FileName,'.voi');
- SaveDialogVoi.initialDir := ExtractFilePath (OpenDialog1.FileName);
- end;
- if not SaveDialogVoi.Execute then exit;
- {$IFDEF FPC} //recent versions of Lazarus (1.2) do handle this, but will put .gz not .nii.gz
- SaveDialogVoi.FileName := SetExtensionFromFilterAtIndex(SaveDialogVoi.FileName, SaveDialogVoi.Filter, SaveDialogVoi.FilterIndex); //8/8/2014 check on OSX 10.4
- {$ENDIF}
- //showmessage(SaveDialogVoi.FileName);
- lHdr := gTexture3D.NIFTIhdr;
- lHdr.bitpix := 8;
- lHdr.datatype := kDT_UNSIGNED_CHAR;
- lHdr.intent_code := kNIFTI_INTENT_NONE;
- lHdr.intent_name[1] := 'B';//Binary
- lHdr.scl_slope := 1;
- lHdr.scl_inter := 0;
- lHdr.dim[0] := 3;//3D
- lHdr.dim[4] := 1;//3D
- lSrcHdr.NIFTIhdr := lHdr;
- lDestHdr.NIFTIhdr := lHdr;
- //we rotate images to nearest orthogonal, but SPM/FSL expect identical slicing, so re-orient VOI to match raw image!
- Reslice2TargCore (lSrcHdr, bytep(ptr), gTexture3D.NiftiHdrRaw, lDestHdr, false , 1);
- //SaveImg (SaveDialogVoi.FileName, lSrcHdr.NIFTIhdr, bytep(ptr));
- //showmessage(inttostr(lDestHdr.NIFTIhdr.dim[1])+'x'+inttostr(lDestHdr.NIFTIhdr.dim[2])+'x'+inttostr(lDestHdr.NIFTIhdr.dim[3]));
- if lDestHdr.ImgBufferUnaligned = nil then exit;
- SaveImg (SaveDialogVoi.FileName, lDestHdr.NIFTIhdr, lDestHdr.ImgBuffer);
- freemem(lDestHdr.ImgBufferUnaligned);
- voiSetModified(false);
- {$ENDIF}
-end;
-
-procedure TGLForm1.CloseVOI1Click(Sender: TObject);
-begin
- if (not voiIsEmpty) and (voiIsModified) then
- SaveVOI1Click(nil);
- //closeDraw; 2015
- NoDraw1.Click;
- voiClose;
- //M_reload := kCloseVOI_reload;
- GLbox.Invalidate;
-end;
-
-function TGLForm1.OpenVOI(lFilename: string): boolean;
-var
- lFilenameX : string;
-begin
- lFilenameX := lFilename;
- GLForm1.CheckFilename (lFilenameX,false); //e.g. "nam" -> "c:\nam.voi"
- result := fileexists(lFilenameX);
- if not result then
- exit;
- GLForm1.OpenDialogVoi.Filename := lFilenameX;
- GLForm1.M_reload := kOpenExistingVOI_reload;
- GLbox.Invalidate;
-end;
-
-procedure TGLForm1.InterpolateDrawMenuClick(Sender: TObject);
-begin
- voiInterpolate ((sender as tMenuItem).tag);
- GLForm1.UpdateGL;
-end;
-
-procedure TGLForm1.LineColorBtnClick(Sender: TObject);
-begin
- ColorDialog1.Color := RGBA2TColor(gPrefs.CrosshairColor);
- if not ColorDialog1.Execute then
- exit;
- TColor2RGBA(ColorDialog1.Color,gPrefs.CrosshairColor);
- //caption := ColorDialog1.Color.
- gPrefs.CrosshairColor.rgbReserved := 255;
- //ColorDialog1.
- //gPrefs.CrosshairColor.rgbReserved := (ColorDialog1.Color shr 24) and 255;
- GLForm1.UpdateGL;
-end;
-
-procedure TGLForm1.LineWidthEditChange(Sender: TObject);
-begin
- if LineWidthEdit.Value = gPrefs.CrosshairThick then exit;
- gPrefs.CrosshairThick:= LineWidthEdit.Value;
- GLForm1.UpdateGL;
-end;
-
-function OutOfRange(val, min,max: single): boolean;
-begin
- result := (val < min) or (val > max);
-end;
-
-function is0or1(val: single): boolean;
-begin
- result := (val = 0) or (val = 1);
-end;
-
-procedure SetXHairPosition (lX,lY,lZ: single);
-var
- isMNISpaceV: boolean;
- X,Y,Z: single;
-begin
- X := lX;
- Y := lY;
- Z := lZ;
- //if (isMNISpace) then //or OutOfRange(X,0,1) or OutOfRange(Y,0,1) or OutOfRange(Z,0,1) then
- isMNISpaceV := isMNISpace;
- if OutOfRange(X,0,1) or OutOfRange(Y,0,1) or OutOfRange(Z,0,1) then
- isMNISpaceV := true;
- //0,0,0/1,1,1 do not make sense for fractions as they are at edge
- if is0or1(X) and is0or1(Y) and is0or1(Z) then
- isMNISpaceV := true;
- if isMNISpaceV then
- MMToFrac(X,Y,Z);
- //GLForm1.CoordLabel.Caption := format('%g %g %g :: %g %g %g',[lX,lY,lZ,X,Y,Z]);
- gRayCast.OrthoX := X;
- gRayCast.OrthoY := Y;
- gRayCast.OrthoZ := Z;
- //GLForm1.SelectSliceView(4);
- GLForm1.ShowOrthoSliceInfo (false);
- GLForm1.UpdateGL;
-
-end;
-
-procedure TGLForm1.CoordEditChange(Sender: TObject);
-begin
- //CoordLabel.caption := inttostr(random(888));
- SetXHairPosition(StrToFloatDef(XCoordEdit.Text,0),StrToFloatDef(YCoordEdit.Text,0),StrToFloatDef(ZCoordEdit.Text,0) );
-
-end;
-
-procedure TGLForm1.OnlineHelpMenuClick(Sender: TObject);
-begin
- OpenURL('https://www.nitrc.org/plugins/mwiki/index.php/mricrogl:MainPage');
-end;
-
-procedure TGLForm1.MosaicTextChange(Sender: TObject);
-begin
- GLForm1.DrawMosaic(MosaicText.Text); //2018
-end;
-
-procedure TGLForm1.ConvertForeign1Click(Sender: TObject);
-var
- Opt : TOpenOptions;
- lF: integer;
-begin
- Opt := OpenDialog1.Options;
- OpenDialog1.filter := 'Images|*.*';
- OpenDialog1.Options := [ofAllowMultiSelect,ofFileMustExist {,ofNoChangeDir}];
- if not OpenDialog1.Execute then begin
- OpenDialog1.Options := Opt;
- OpenDialog1.filter := kImgPlusVOIFilter;
- exit;
- end;
- OpenDialog1.filter := kImgPlusVOIFilter;
- OpenDialog1.Options := Opt;
- if OpenDialog1.Files.Count < 1 then
- exit;
- for lF := 0 to (OpenDialog1.Files.Count-1) do
- SaveForeignAsNifti(OpenDialog1.Files[lF]);
-end;
-
-
-
-procedure TGLForm1.FormChangeBounds(Sender: TObject);
-{$IFDEF LCLCocoa} var lprev: single; {$ENDIF}
-begin
- {$IFDEF LCLCocoa}
- if (gPrefs.RetinaDisplay) then begin //detect if window moved between retina and non-retina display
- lprev := gRetinaScale;
- SetRetina;
- if (lprev <> gRetinaScale) then
- GLboxResize(Sender);
- end;
- {$ENDIF}
-end;
-
-
-procedure TGLForm1.OpenVOI1Click(Sender: TObject);
-begin
- OpenDialogVoi.filter := kImgPlusVOIFilter;
- OpenDialogVoi.initialDir := OpenDialog1.InitialDir;
- if not OpenDialogVoi.Execute then exit;
- if not OpenVOI(OpenDialogVoi.Filename) then
- Showmessage('Unable to find drawing '+OpenDialogVoi.Filename);
-end;
-
-procedure TGLForm1.DrawTool1Click(Sender: TObject);
-begin
- if not (sender is TMenuItem) then exit;
-(Sender as TMenuItem).checked := true;
- gPrefs.DrawColor := (Sender as TMenuItem).tag;
- if AutoRoiForm.Visible then
- AutoRoiForm.PreviewBtnClick(Sender);
- (*if (gPrefs.DrawColor >= 0) and (not voiIsOpen) then begin
- voiCreate(gTexture3D.FiltDim[1], gTexture3D.FiltDim[2],gTexture3D.FiltDim[3], nil);
- GLbox.Invalidate;
- end; *)
-
-end;
-
-procedure TGLForm1.UndoVOI1Click(Sender: TObject);
-begin
- voiUndo;
- GLbox.Invalidate;
-end;
-
-function TGLForm1.MouseDownVOI (Shift: TShiftState; X, Y: Integer): boolean;
-var
- lOrient, lPen: integer;
- lXfrac,lYfrac,lZfrac: single;
-begin
- result := false;
- if (AutoROIForm.visible) then exit;
- if (ssCtrl in Shift) then exit;
- if (gPrefs.SliceView < 1) or (gPrefs.SliceView = 5) or (gPrefs.DrawColor < 0) then exit;
- if (not voiIsOpen) then begin //clicked after VOI/Close - lets create a new one
- voiCreate(gTexture3D.FiltDim[1], gTexture3D.FiltDim[2],gTexture3D.FiltDim[3], nil);
- end;
- OrthoCoordMidSlice(0,0,0);
- //if (not voiActiveX) then exit;
- OrthoPix2Frac (X, Y, lOrient, lXfrac,lYfrac,lZfrac);
- if (ssShift in Shift) then begin
- if gPrefs.DrawColor <> 0 then
- lPen := 0
- else
- lPen := 1;
- end else
- lPen := gPrefs.DrawColor;
- if (ssAlt in Shift) then begin
- if gPrefs.FlipLR then
- voiMouseFloodFill(lPen, lOrient, 1-lXfrac, lYfrac, lZfrac)
- else
- voiMouseFloodFill(lPen, lOrient, lXfrac, lYfrac, lZfrac);
- GLbox.Invalidate;
- end else begin
- if gPrefs.FlipLR then
- voiMouseDown(lPen, lOrient, 1-lXfrac, lYfrac, lZfrac)
- else
- voiMouseDown(lPen, lOrient, lXfrac, lYfrac, lZfrac);
- end;
- result := true;
- //caption := inttostr(lOrient)+':'+floattostr(lXFrac)+'x'+floattostr(lYFrac)+'x'+floattostr(lZFrac);
-end;
-
-function TGLForm1.MouseMoveVOI (X, Y: Integer): boolean;
-var
- lXfrac,lYfrac,lZfrac: single;
- lOrient, lActiveOrient: integer;
-begin
- result := false;
- if (gPrefs.SliceView < 1) or (gPrefs.SliceView = 5) or (gPrefs.DrawColor < 0) then exit;
- lActiveOrient := voiActiveOrient;
- if (lActiveOrient < 1) then exit;
- OrthoPix2Frac (X, Y, lOrient, lXfrac,lYfrac,lZfrac);
- result := true;
- if (lActiveOrient <> lOrient) then
- exit;
- if gPrefs.FlipLR then
- voiMouseMove(1-lXfrac, lYfrac, lZfrac)
- else
- voiMouseMove(lXfrac, lYfrac, lZfrac);
- GLbox.Invalidate;
-end;
-
-function TGLForm1.MouseUpVOI (Shift: TShiftState; X, Y: Integer): boolean;
-var
- lXfrac,lYfrac,lZfrac: single;
- lOrient: integer;
-begin
- result := false;
- if (gPrefs.SliceView < 1) or (gPrefs.SliceView = 5) or (gPrefs.DrawColor < 0) then exit;
- if (voiActiveOrient < 1) then exit;
- OrthoPix2Frac (X, Y, lOrient, lXfrac,lYfrac,lZfrac);
- //voiMouseUp(lXfrac, lYfrac, lZfrac,not (ssCtrl in Shift) );// not (ssCtrl in Shift)); (ssCtrl in Shift)
- voiMouseUp(not (ssCtrl in Shift), OverwriteDrawColor1.checked );
- GLbox.Invalidate;
- result := true;
-end;
-
-procedure TGLForm1.Smooth1Click(Sender: TObject);
-begin
- voiSmoothIntensity (nil);
- GLbox.Invalidate;
-end;
-
-procedure TGLForm1.ToolPanelClick(Sender: TObject);
-begin
- if (gPrefs.SliceView < 1) or (gPrefs.SliceView > 5) then //already rendering
- exit;
- Render1.Click;
-end;
-
-procedure TGLForm1.PasteSlice1Click(Sender: TObject);
-begin
- voiPasteSlice(gRayCast.OrthoX, gRayCast.OrthoY,gRayCast.OrthoZ);
- GLbox.Invalidate;
-end;
-
-procedure TGLForm1.SetToolPanelWidth;
-var
- ShowRenderTools: boolean;
-begin
- ShowRenderTools := (gPrefs.SliceView < 1) or (gPrefs.SliceView > 5); //rendering
- HideRenderToolsBtn.Visible := ShowRenderTools;
- ClipBox.Visible := ShowRenderTools;
- ShaderBox.Visible := ShowRenderTools;
- if ShaderBox.Visible then ShaderBoxResize(nil);
- (*ViewSepMenu.Visible := ShowRenderTools;
- LeftMenu.Visible := ShowRenderTools;
- RightMenu.Visible := ShowRenderTools;
- AnteriorMenu.Visible := ShowRenderTools;
- PosteriorMenu.Visible := ShowRenderTools;
- InferiorMenu.Visible := ShowRenderTools;
- SuperiorMenu.Visible := ShowRenderTools; *)
- CutoutBox.visible := ShowRenderTools;
- Slice2DBox.Visible := ((not ShowRenderTools) and (gPrefs.SliceView <> 5));
- LineBox.Visible := not ShowRenderTools;
- MosaicBox.Visible := gPrefs.SliceView = 5;
-end;
-
-procedure TGLForm1.FormDestroy(Sender: TObject);
-begin
- //IniFile(false,IniName,gPrefs);
-gCube.Free;
-gText.Free;
-gClrBar.Free;
- {$IFDEF COMPILEYOKE}
- YokeTimer.Enabled := false;
- CloseSharedMem;
- {$ENDIF}
-end;
-
-
-procedure TGLForm1.CollapsedToolPanelClick(Sender: TObject);
-begin
- Tool1.Click;
- Self.ActiveControl := nil;
-end;
-
-procedure TGLForm1.HideRenderToolsBtnClick(Sender: TObject);
-begin
-
- ClipBox.visible := not ClipBox.visible;
- CutoutBox.visible := not CutoutBox.visible;
- ShaderBoxResize(Sender);
- Self.ActiveControl := nil;
-end;
-
-procedure CloseOverlay (lOverlayIndex: integer);
-begin
- GLForm1.ActiveControl := nil; //GLForm1.MinEdit.SetFocus;
- GLForm1.LUTdrop.visible := false;
- GLForm1.StringGrid1.Selection := TGridRect(Rect(-1, -1, -1, -1));
- if gOverlayImg[lOverlayIndex].ImgBufferUnaligned <> nil then
- freemem(gOverlayImg[lOverlayIndex].ImgBufferUnaligned);
- if gOverlayImg[lOverlayIndex].ScrnBuffer <> nil then
- freemem(gOverlayImg[lOverlayIndex].ScrnBuffer);
- InitOverlay(lOverlayIndex);
-end;
-
-procedure CloseOverlays;
-var
- I: integer;
-begin
- GLForm1.StringGrid1.Selection:=TGridRect(Rect(-1,-1,-1,-1));
- for I := kMinOverlayIndex to kMaxOverlays do
- CloseOverlay(I);
- gOpenOverlays := 0;
-end;
-
-procedure TGLForm1.UpdateImageIntensityMinMax (lOverlay: integer; lMinIn,lMaxIn: double);
-var
- lMin,lMax: single;
-begin
- if (lOverlay > gOpenOverlays) then exit;
- if lMinIn > lMaxin then begin
- lMin := lMaxIn;
- lMax := lMinIn;
- end else begin
- lMin := lMinIn;
- lMax := lMaxIn;
- end;
- gOverlayImg[lOverlay].WindowScaledMin := lMin;
- gOverlayImg[lOverlay].WindowScaledMax := lMax;
- StringGrid1.Cells[kMin,lOverlay] := float2str(lMin,3);
- StringGrid1.Cells[kMax,lOverlay] := float2str(lMax,3);
- //StringGrid1.Cells[kMin,lOverlay] := floattostrf(lMin, ffGeneral, 8, 3); //requires extended precision: lMin = 2.6 yields 2.5999999
- //StringGrid1.Cells[kMax,lOverlay] := floattostrf(lMax, ffGeneral, 8, 3);
- //StringGrid1.Cells[kMin,lOverlay] := floattostr(lMin);
- //StringGrid1.Cells[kMax,lOverlay] := floattostr(lMax);
- UpdateImageIntensity(lOverlay);
-end;
-
-procedure TGLForm1.ChangeOverlayUpdate;
-begin
- {$IFDEF FPC}{$IFDEF Windows} //July2017: Lazarus 1.8.0 does not repaint?
- StringGrid1.Refresh;
- {$ENDIF}{$ENDIF}
- M_Refresh := true;
- // deleteGradients(gTexture3D);
- GLForm1.UpdateTimer.enabled := true;
-end;
-
-procedure TGLForm1.Closeoverlays1Click(Sender: TObject);
-begin
- GLForm1.ActiveControl := nil;
- OverlayBox.Visible := false;//StringGrid1.Visible := false;
- LUTdrop.Visible := false;
- CloseOverlays;
- gOpenOverlays := 0;
- StringGrid1.RowCount := StringGrid1.FixedRows+1;
- ChangeOverlayUpdate;
-end;
-
-function HasDigit (var lS: string): boolean;
-//do not attempt to convert '-', '.', or '-.' as a number...
-var
- lI,lLen: integer;
-begin
- result := false;
- lLen := length (lS);
- if lLen < 1 then
- exit;
- for lI := 1 to lLen do begin
- if lS[lI] in ['0'..'9'] then begin
- result := true;
- exit;
- end;
- end;
-end;
-
-procedure TGLForm1.ReadCell (ACol,ARow: integer; Update: boolean);
-var
- lF: single;
- lS: string;
-begin
- if (ARow < GLForm1.StringGrid1.FixedRows) or (ARow > kMaxOverlays) then
- exit;
- if (ACol <> kMin) and (ACol <> kMax) then
- exit;
- lS := StringGrid1.Cells[ACol,ARow];
- if not HasDigit(lS) then
- exit;
- try
- lF := strtofloat(lS);
- except
- exit;
- {on EConvertError do begin
- Msg('Unable to convert the string '+lStr+' to a number');
- result := 1;
- exit;
- end;}
- end; {except}
- if ACol = kMin then
- gOverlayImg[ARow].WindowScaledMin := lF
- else
- gOverlayImg[ARow].WindowScaledMax := lF;
- if Update then UpdateImageIntensity(ARow);
-end;
-
-procedure TGLForm1.StringGrid1Exit(Sender: TObject);
-begin
- ReadCell(gPrevCol,gPrevRow, true);
-end;
-
-function IsDigit (letter : char) : boolean;
-// If letter is a digit, 0 through 9, true is returned.
-// Otherwise, false is returned.
-begin
- if ((letter <= '9') and (letter >= '0')) then
- IsDigit := true
- else
- IsDigit := false;
-end;
-
-procedure TGLForm1.OverlayIdleTimerReset;
-begin
- GradientsIdleTimer.enabled := false;//reset
- GradientsIdleTimer.enabled := true;
-end;
-
-procedure TGLForm1.StringGrid1KeyPress(Sender: TObject; var Key: char);
-const
- EnterKey = #13;
- BackspaceKey = #8;
- ControlC = #3; // Copy
- ControlV = #22; // Paste
-var
- ACol,ARow: integer;
- //S: string;
-begin
-
-ACol := abs(GLForm1.StringGrid1.Selection.Right);
- ARow := abs(GLForm1.StringGrid1.Selection.Top);
- //if ((ACol <> gPrevCol) or (ACol <> gPrevCol)) and ChangeOverlayUpdate;
- gPrevCol := ACol;
- gPrevRow := ARow;
- if not( (IsDigit (Key) or (Key = chr(127)) or (Key = decimalseparator) or (Key = '+') or (Key = '-') or
- (Key = ControlC) or (Key = ControlV) or (Key = BackspaceKey) or
- (Key = EnterKey))) then begin
- Key := #0;
- exit;
- end;
- if (Key = kTab) then begin
- OverlayIdleTimerReset;
- exit;
- end;
- if (Key = kTab) or (Key = kCR) then begin
- ReadCell(gPrevCol,gPrevRow, true);
- OverlayIdleTimerReset;
- exit;
- end;
- gTypeInCell := true;
- {$IFNDEF LCLCocoa}
- OverlayIdleTimerReset;
-{$ENDIF}
-
-(* if(( GLForm1.StringGrid1.Selection.Top = GLForm1.StringGrid1.Selection.Bottom ) and
- ( GLForm1.StringGrid1.Selection.Left = GLForm1.StringGrid1.Selection.Right )) then begin
- if gEnterCell then begin
- S := ''
- end else
- S := GLForm1.StringGrid1.Cells[ GLForm1.StringGrid1.Selection.Left,GLForm1.StringGrid1.Selection.Top ] ;
- gEnterCell := false;
- if ( ( Key = kDEL ) or ( Key = kBS ) )then begin
- if( length( S ) > 0 ) then begin
- setlength( S, length( S ) - 1 ) ;
- end;
- end else
- S := S + Key ;
- //StringGrid1.Cells[ StringGrid1.Selection.Left, StringGrid1.Selection.Top ] := S ;
- {$IFDEF FPC} GLForm1.StringGrid1.Cells[ GLForm1.StringGrid1.Selection.Left,GLForm1.StringGrid1.Selection.Top ] := S;
- {$ENDIF}
- end ; *)
- ReadCell(gPrevCol,gPrevRow, false);
-end;
-
-procedure CopyImg2Mem(var lH: TMRIcroHdr; var lAScrnBuffer,lAImgBuffer : Bytep; var lAUnaligned: Pointer);
-var
- lABytes: integer;
-begin
-if lH.ImgBuffer <> nil then begin
- lABytes := lH.ImgBufferItems * lH.ImgBufferBPP;
- GetMem(lAUnaligned ,lABytes+15);
- {$IFDEF FPC}
- lAImgBuffer := Align(lAUnaligned,16); // not commented - check this
- {$ELSE}
- lAImgBuffer := ByteP($fffffff0 and (integer(lAUnaligned)+15));
- {$ENDIF}
- System.Move(lH.ImgBuffer^,lAImgBuffer^,lABytes);
- FreeMem(lH.ImgBufferUnaligned);
- lH.ImgBufferUnaligned := nil;
-
-end else
- lAUnaligned := nil;
-if lH.ScrnBuffer <> nil then begin
- GetMem(lAScrnBuffer ,lH.ScrnBufferItems);
- System.Move(lH.ScrnBuffer^,lAScrnBuffer^,lH.ScrnBufferItems);
- FreeMem(lH.ScrnBuffer);
-end else
- lAScrnBuffer := nil;
-end;
-
-procedure CopyMem2Img(var lH: TMRIcroHdr; var lAScrnBuffer,lAImgBuffer : Bytep; var lAUnaligned: Pointer);
-var
- lABytes: integer;
-begin
- if lAUnaligned <> nil then begin
- lABytes := lH.ImgBufferItems * lH.ImgBufferBPP;
- GetMem(lH.ImgBufferUnaligned ,lABytes+15);
-
- {$IFDEF FPC}
- lH.ImgBuffer := Align(lH.ImgBufferUnaligned,16); // not commented - check this
- {$ELSE}
- lH.ImgBuffer := ByteP($fffffff0 and (integer(lH.ImgBufferUnaligned)+15));
- {$ENDIF}
- System.Move(lAImgBuffer^,lH.ImgBuffer^,lABytes);
- FreeMem(lAUnaligned);
-end;
- if lAScrnBuffer <> nil then begin
- GetMem(lH.ScrnBuffer ,lH.ScrnBufferItems);
- System.Move(lAScrnBuffer^,lH.ScrnBuffer^,lH.ScrnBufferItems);//src, dest, bytes
- FreeMem(lAScrnBuffer);
- end;
-end;
-
- procedure TGLForm1.UpdateOverlaySpreadI (lIndex: integer);
-//var
-// lP,lV : string;
-begin
- {if lVolume > 1 then
- lV := ':'+inttostr(lVolume)
- else
- lV := '';}
- GLForm1.StringGrid1.Cells[kFName, lIndex] := parsefilename(extractfilename(gOverlayImg[lIndex].HdrFileName));
- GLForm1.StringGrid1.Cells[kLUT, lIndex] := GLForm1.LutDrop.Items[gOverlayImg[lIndex].LUTindex];
- UpdateImageIntensityMinMax(lIndex,gOverlayImg[lIndex].WindowScaledMin,gOverlayImg[lIndex].WindowScaledMax);
- //if gOverlayImg[lIndex].LUTvisible then
- // GLForm1.StringGrid1.Cells[kVis, lIndex] := '+'
- //else
- // GLForm1.StringGrid1.Cells[kVis,lIndex] := '-';
-end;
-
-procedure TGLForm1.UpdateOverlaySpread;
-var
- i: integer;
-begin
- if gOpenOverlays < 1 then
- exit;
- for i := 1 to gOpenOverlays do
- UpdateOverlaySpreadI(i);
-end;
-
-procedure TGLForm1.LUTdropChange(Sender: TObject);
-var intRow: Integer;
-begin
- inherited;
- if GLForm1.Lutdrop.Tag < 1 then
- exit;
- intRow := GLForm1.StringGrid1.Row;
- if intRow < 0 then
- intRow := GLForm1.Lutdrop.Tag;
- if (intRow < 1) or (intRow > kMaxOverlays) then
- exit;
- GLForm1.StringGrid1.Cells[kLUT, intRow] := GLForm1.LutDrop.Items[GLForm1.LUTdrop.ItemIndex];
- UpdateLUT(intRow,GLForm1.LUTdrop.ItemIndex,false);
- ChangeOverlayUpdate;
- GLForm1.StringGrid1.Selection:=TGridRect(Rect(-1,-1,-1,-1));
-end;
-
-procedure TGLForm1.OrientClick(lOrient: integer);
-var
- elev, azi: integer;
- X,Y,Z: single;
-begin
- //if not GLForm1.Focused then exit; //e.g. do not intercept key srokes if use is editing a script!
- //Requires Form.KeyPreview := true;
- if gPrefs.SliceView > 0 then begin
- X := 0; Y := 0; Z := 0;
- Case lOrient of
- 0: X := -1.0; //LEFT
- 1: X := +1.0; //RIGHT
- 2: Y := -1.0; //POSTERIOR
- 3: Y := +1.0; //ANTERIOR
- 4: Z := -1.0; //INFERIOR
- 5: Z := +1.0; //SUPERIOR
- end; //case Key
- if (X = 0) and (Y = 0) and (Z = 0) then exit;
- //caption := format('%g %g %g',[X,Y,Z]) ;
-
- OrthoCoordMidSlice(X,Y,Z);
- ShowOrthoSliceInfo (false);
- updateGL;
- exit;
- end;
- //if not GLForm1.Focused then exit; //disable when user is typing scripts
- case lOrient of
- 4: elev := -90;
- 5: elev := 90;
- else elev := 0;
- end;
- case lOrient of
- 0: azi := 90;
- 1: azi := 270;
- 2,5: azi := 0;
- else azi := 180;
- end;
- gRayCast.Elevation := elev;
- gRayCast.Azimuth := azi;
- updateGL;
-end;
-
-procedure TGLForm1.OrientBtnClick(Sender: TObject);
-begin
-//OrientClick( (Sender as TSpeedButton).tag);
- OrientClick( (Sender as TButton).tag);
-end;
-
-procedure TGLForm1.OrientMenuClick(Sender: TObject);
-begin
- OrientClick( (Sender as TMenuItem).tag);
-end;
-
-procedure TGLForm1.RadiologicalMenuClick(Sender: TObject);
-begin
- gPrefs.FlipLR:= RadiologicalMenu.Checked;
- DisplayRadiological;
- GLbox.Invalidate;
-end;
-
-procedure TGLForm1.ReorientMenuClick(Sender: TObject);
-{$IFNDEF FPC}
-begin
- showmessage('Feature not available for Delphi');
-
-end;
-{$ELSE}
-//{$DEFINE REORIENTDEBUG}
-label
- 245;
-var
- lImg: Bytep;
- s: string;
- dx, dy, dz: single;
- btn : array [1..6] of string = ('red','green','blue','purple','orange','yellow');
- M, Mhdr: TMatrix;
- i, dim1,dim2,dim3, btnR,btnA,btnS: integer;
- lHdr: TNIFTIHdr;
-begin
- if (lHdr.bitpix = 24) then begin
- showmessage('Rotation not available for RGB images');
- exit;
- end;
- {$IFNDEF REORIENTDEBUG}
- gPrefs.isOrientationTriangles := true;
- if gPrefs.SliceView <> 4 then
- MPR1.click;
- btnR := QuestionDlg ('Reorient image','Which arrow is pointing toward participant’s RIGHT?',
- mtInformation,[ 1,btn[1], 2,btn[2], 3,btn[3], 4,btn[4], 5,btn[5], 6,btn[6] ],'');
- if (btnR <= 2) then
- btnA := QuestionDlg ('Reorient image','Which arrow is pointing toward participant’s ANTERIOR?',
- mtCustom,[ 3,btn[3], 4,btn[4], 5,btn[5], 6,btn[6] ],'')
- else if (btnR <= 4) then
- btnA := QuestionDlg ('Reorient image','Which arrow is pointing toward participant’s ANTERIOR?',
- mtCustom,[ 1,btn[1], 2,btn[2], 5,btn[5], 6,btn[6] ],'')
- else
- btnA := QuestionDlg ('Reorient image','Which arrow is pointing toward participant’s ANTERIOR?',
- mtCustom,[ 1,btn[1], 2,btn[2], 3,btn[3], 4,btn[4] ],'');
- if (max(btnR,btnA) <= 4) then
- btnS := QuestionDlg ('Reorient image','Which arrow is pointing toward participant’s SUPERIOR?',
- mtCustom,[5,btn[5], 6,btn[6] ],'')
- else if (min(btnR,btnA) >= 3) then
- btnS := QuestionDlg ('Reorient image','Which arrow is pointing toward participant’s SUPERIOR?',
- mtCustom,[1,btn[1], 2,btn[2] ],'')
- else
- btnS := QuestionDlg ('Reorient image','Which arrow is pointing toward participant’s SUPERIOR?',
- mtCustom,[3,btn[3], 4,btn[4] ],'');
- if (btnR=2) and (btnA=4) and (btnS=6) then begin
- showmessage('Image already oriented');
- goto 245;
- end;
- {$ELSE}
- btnR := 2;
- btnA := 4;
- btnS := 5;
- {$ENDIF}
- dim1 := (btnR + 1) div 2;
- dim2 := (btnA + 1) div 2;
- dim3 := (btnS + 1) div 2;
- M := zero3D;
- if odd(btnR) then
- M.matrix[1,dim1] := -1
- else
- M.matrix[1,dim1] := 1;
- if odd(btnA) then
- M.matrix[2,dim2] := -1
- else
- M.matrix[2,dim2] := 1;
- if odd(btnS) then
- M.matrix[3,dim3] := -1
- else
- M.matrix[3,dim3] := 1;
- M.matrix[4,4] := 1;
- lHdr := gTexture3D.NIFTIhdr;
- s := format('M = [%g %g %g %g; %g %g %g %g; %g %g %g %g; %g %g %g %g]; nii_reorient('''',M);',
- [M.matrix[1,1], M.matrix[1,2], M.matrix[1,3], M.matrix[1,4],
- M.matrix[2,1], M.matrix[2,2], M.matrix[2,3], M.matrix[2,4],
- M.matrix[3,1], M.matrix[3,2], M.matrix[3,3], M.matrix[3,4],
- M.matrix[4,1], M.matrix[4,2], M.matrix[4,3], M.matrix[4,4] ]);
- clipboard.AsText:= s;
- Mhdr := matrix3D(
- lHdr.srow_x[0],lHdr.srow_x[1],lHdr.srow_x[2],lHdr.srow_x[3],
- lHdr.srow_y[0],lHdr.srow_y[1],lHdr.srow_y[2],lHdr.srow_y[3],
- lHdr.srow_z[0],lHdr.srow_z[1],lHdr.srow_z[2],lHdr.srow_z[3]);
- M := multiplymatrices(M,Mhdr);
-
- //update S_Form
- for i := 0 to 4 do begin
- lHdr.srow_x[i] := M.matrix[1,i+1];
- lHdr.srow_y[i] := M.matrix[2,i+1];
- lHdr.srow_z[i] := M.matrix[3,i+1];
- end;
- //update q_form
- nifti_mat44_to_quatern( M, lHdr.quatern_b,lHdr.quatern_c,lHdr.quatern_d,
- lHdr.qoffset_x,lHdr.qoffset_y,lHdr.qoffset_z,dx, dy, dz, lHdr.pixdim[0]);
-
- //check format
- if (lHdr.bitpix > 24) then begin
- lHdr.datatype := kDT_FLOAT;
- lHdr.bitpix := 32;
- lHdr.scl_slope := 1;
- lHdr.scl_inter := 0;
-end;
-// showmessage(inttostr(lHdr.dim[4]));
-if (lHdr.dim[4] > 1) then
- showmessage('Only able to rotate 1st volume. Check clipboard for Matlab script')
-else
- showmessage('Check clipboard for Matlab script');
-lHdr.dim[0] := 3;//3D
-lHdr.dim[4] := 1;//3D
- if gTexture3D.RawUnscaledImg16 <> nil then
- lImg := bytep(gTexture3D.RawUnscaledImg16)
- else if gTexture3D.RawUnscaledImg32 <> nil then
- lImg := bytep(gTexture3D.RawUnscaledImg32)
- else if (gTexture3D.RawUnscaledImg8 <> nil) then
- lImg := bytep(gTexture3D.RawUnscaledImg8)
- else
- goto 245;
- //save results
- if fileexists(OpenDialog1.filename) then begin
- //SaveDialogVoi.FileName := ChangeFileExtX (OpenDialog1.FileName,'.nii');
- SaveDialogVoi.FileName := ChangeFilePrefixExt(OpenDialog1.FileName,'r', '.nii');
- SaveDialogVoi.initialDir := ExtractFilePath (OpenDialog1.FileName);
- end;
- s := SaveDialogVoi.Filter;
- SaveDialogVoi.Filter := 'SPM/FSL (.nii)|.nii|FSL (.nii.gz)|.nii.gz|Volume of Interest (.voi)|.voi';
- if not SaveDialogVoi.Execute then begin
- SaveDialogVoi.Filter := s;
- goto 245;
- end;
- {$IFDEF FPC} //recent versions of Lazarus (1.2) do handle this, but will put .gz not .nii.gz
- SaveDialogVoi.FileName := SetExtensionFromFilterAtIndex(SaveDialogVoi.FileName, SaveDialogVoi.Filter, SaveDialogVoi.FilterIndex); //8/8/2014 check on OSX 10.4
- {$ENDIF}
- SaveDialogVoi.Filter := s;
- SaveImg (SaveDialogVoi.FileName, lHdr, lImg);
- 245:
- gPrefs.isOrientationTriangles := false;
-end;
-{$ENDIF}
-(*type
- TVec = array [1..3] of single;
-function isSame(a,b: TVec): boolean;
-begin
- result := (a[1]=b[1]) and (a[2]=b[2]) and (a[3]=b[3]);
-end;
-
-var
- mat: TMatrix;
- Origin, Right, Anterior,Superior: TVec;
- lAzimuth, lElevation: single;
- dimx, dimy, dimz, integer;
- //lXmm,lYmm,lZmm, ,lXmmR,lYmmR,lZmmR,lXmmA,lYmmA,lZmmA,lXmmS,lYmmS,lZmmS: single;
-begin
-
- if gPrefs.DrawColor <> -1 then
- NoDraw1.Click;
- if gPrefs.SliceView <> 4 then
- MPR1.click;
- //set crosshair to center of volume
- gRayCast.OrthoX := 0.5;
- gRayCast.OrthoY := 0.5;
- gRayCast.OrthoZ := 0.5;
- ShowOrthoSliceInfo (true);
- GLBox.Invalidate;
- showmessage('Please click on a location on the RIGHT side of the image');
- GetShareFloats(Origin[1],Origin[2],Origin[3], lAzimuth, lElevation);
- repeat
- application.ProcessMessages();
- GetShareFloats(Right[1],Right[2],Right[3], lAzimuth, lElevation);
- until not isSame(Origin, Right);
- showmessage('Please click on a location on the ANTERIOR side of the image');
- repeat
- application.ProcessMessages();
- GetShareFloats(Anterior[1],Anterior[2],Anterior[3], lAzimuth, lElevation);
- until not isSame(Right, Anterior);
- showmessage('Please click on a location on the SUPERIOR side of the image');
- repeat
- application.ProcessMessages();
- GetShareFloats(Superior[1],Superior[2],Superior[3], lAzimuth, lElevation);
- until not isSame(Anterior, Superior);
- //compare each click to center of volume
-
- mat := Eye3D;
-*)
- (* Origin[1] := SliceMM (0.5,kSagLeftOrient); //Sag
- Origin[2] := SliceMM (0.5,kCoronalOrient); //Coronal
- Origin[3] := SliceMM (0.5,kAxialOrient); //Axial
-*)
-
-procedure TGLForm1.ResetDefaults1Click(Sender: TObject);
-begin
- //FinishRender;
- SetDefaultPrefs(gPrefs,false);
- GLForm1.ResetSliders;
- GLForm1.DisplayPrefs;
-end;
-
-procedure TGLForm1.InterpolateMenuClick(Sender: TObject);
-begin
- gPrefs.InterpolateOverlays := InterpolateMenu.checked;
-end;
-
-procedure TGLForm1.BackgroundMaskMenuClick(Sender: TObject);
-begin
- gPrefs.MaskOverlayWithBackground := BackgroundMaskMenu.checked;
- ChangeOverlayUpdate;
-end;
-
-procedure TGLForm1.SetOverlayAlpha(Sender: TObject);
-begin
- gPrefs.OverlayAlpha := (Sender as TMenuItem).tag;
- SetOverlayAlphaValue (gPrefs.OverlayAlpha);
- ChangeOverlayUpdate;
-end;
-
-procedure TGLForm1.ThresholdMenuClick(Sender: TObject);
-var loutmm3, lClusterMM3, lThresh: single;
-begin
- if (gOpenOverlays >= kMaxOverlays) then begin
- Showmessage('Error: too many overlays open (choose "Close overlays" command)');
- exit;
- end;
- loutmm3 := abs(gTexture3D.NIFTIhdr.pixdim[1]*gTexture3D.NIFTIhdr.pixdim[2]*gTexture3D.NIFTIhdr.pixdim[3]);
- if loutmm3 = 0 then begin
- showmessage('Error: current background image reports impossible voxel spacing. Solution: first load a valid background image');
- exit;
- end;
- ResliceForm.BGLabel.Caption:= 'Reslice to match '+realtostr(loutmm3,2)+'mm^3 voxels of background image';
- ResliceForm.showmodal;
- if ResliceForm.ModalResult <> mrOK then exit;
- Str2FloatSafe(ResliceForm.ThreshEdit.Text,lThresh) ;
- Str2FloatSafe(ResliceForm.ClusterEdit.Text,lClusterMM3) ;
- savethresholdedUI(lThresh, lClusterMM3, ResliceForm.SaveCheck.checked);
-end;
-
-function TGLForm1.Addoverlay(lFilename: string; lVolume: integer): integer;
-var
- lL: integer;
- lFilenameX: string;
-begin
- result := -1;
- GLForm1.StringGrid1.Selection := TGridRect(Rect(2, 3, 2, 3));
- lL := kMaxOverlays;
- // if gShader.OverlayEmis then lL := 3;
- if gOpenOverlays >= lL then begin
- showmessage('Too many overlays open. Please close an overlay before adding a new one.');
- exit;
- end;
- if (gTexture3D.FiltDim[1] < 1) or (gTexture3D.FiltDim[2] < 1) or (gTexture3D.FiltDim[3] < 1) then begin
- showmessage('Please load a background image before loading an overlay.');
- exit;
- end;
- lFilenameX := lFilename;
- GLForm1.CheckFilename (lFilenameX,false);
- if not fileexistsEx(lFilenameX) then begin
- {$IFDEF ENABLESCRIPT} ScriptForm.Stop1Click(nil); {$ENDIF} //OSX crashes if you give a modal dialog while script is running
- showmessage('Unable to find overlay named '+lFilename);
- exit;
- end;
- OverlayBox.visible := true; //GLForm1.StringGrid1.Visible := true;
- inc (gOpenOverlays);
- OverlayBox.Height := 2+ ( (2+gOpenOverlays)*(StringGrid1.DefaultRowHeight+1));
- {$IFDEF FPC} {$IFNDEF UNIX}
- if Screen.PixelsPerInch <> 96 then begin
- OverlayBox.Height := 2+ round((2+gOpenOverlays)*(StringGrid1.DefaultRowHeight+2)); end;
-{$ENDIF}{$ENDIF}
- GLForm1.StringGrid1.RowCount := GLForm1.StringGrid1.FixedRows+gOpenOverlays;
- if Reslice2Targ (lFilenameX, gTexture3D.NIFTIhdr,gOverlayImg[gOpenOverlays],gPrefs.InterpolateOverlays,lVolume) = '' then begin
- showmessage('Error loading overlay.');
- dec (gOpenOverlays);
- exit;
- end;
- ComputeThreshOverlay (gOverlayImg[gOpenOverlays]);
- //caption := format('%g %g',[gOverlayImg[gOpenOverlays].AutoBalMinUnscaled, gOverlayImg[gOpenOverlays].AutoBalMaxUnscaled]);
- if (gOverlayImg[gOpenOverlays].RGB) then begin //RGB images
- gOverlayImg[gOpenOverlays].AutoBalMinUnscaled := 0.1;
- gOverlayImg[gOpenOverlays].AutoBalMaxUnscaled := 255;
- //Dec2016: texture_3d_unit now handles planar/RGB conversion, so following lines change:
- if (lVolume mod 3) = 1 then //red
- lL := 1 //TODO : check with Windows/Linux: LOADIMAGE('avg152T1'); OVERLAYLOAD('visiblehuman');
- else if (lVolume mod 3) = 2 then //green
- lL := 2
- else //blue
- lL := 3;
- UpdateLUT(gOpenOverlays,lL,true);
- end else //not RGB
- UpdateLUT(gOpenOverlays,gOpenOverlays,true);
- gOverlayImg[gOpenOverlays].LUTvisible := true;
- if (gOverlayImg[gOpenOverlays].AutoBalMinUnscaled < 0) and (gOverlayImg[gOpenOverlays].AutoBalMaxUnscaled > 0) then begin
- if (odd(gOpenOverlays)) then begin
- if (abs(gOverlayImg[gOpenOverlays].AutoBalMinUnscaled) > gOverlayImg[gOpenOverlays].AutoBalMaxUnscaled) then
- gOverlayImg[gOpenOverlays].AutoBalMaxUnscaled := gOverlayImg[gOpenOverlays].AutoBalMinUnscaled / 2
- else
- gOverlayImg[gOpenOverlays].AutoBalMinUnscaled := gOverlayImg[gOpenOverlays].AutoBalMaxUnscaled / 2;
- end else begin
- if (abs(gOverlayImg[gOpenOverlays].AutoBalMinUnscaled) < gOverlayImg[gOpenOverlays].AutoBalMaxUnscaled) then
- gOverlayImg[gOpenOverlays].AutoBalMaxUnscaled := gOverlayImg[gOpenOverlays].AutoBalMinUnscaled / 2
- else
- gOverlayImg[gOpenOverlays].AutoBalMinUnscaled := gOverlayImg[gOpenOverlays].AutoBalMaxUnscaled / 2;
- end;
-
- end;
- gOverlayImg[gOpenOverlays].WindowScaledMin := gOverlayImg[gOpenOverlays].AutoBalMinUnscaled;
- gOverlayImg[gOpenOverlays].WindowScaledMax := gOverlayImg[gOpenOverlays].AutoBalMaxUnscaled;
- //caption := format('%g %g',[gOverlayImg[gOpenOverlays].WindowScaledMin, gOverlayImg[gOpenOverlays].WindowScaledMax]);
- gOverlayImg[gOpenOverlays].LutFromZero := gPrefs.OverlayColorFromZero;
- UpdateOverlaySpreadI(gOpenOverlays);
- UpdateImageIntensity (gOpenOverlays);
- ChangeOverlayUpdate;
- GLForm1.LUTdrop.Visible := false;
- result :=gOpenOverlays;
- //RGB
- if (gOverlayImg[gOpenOverlays].RGB) then begin
- if (lVolume < 3) then
- result :=Addoverlay(lFilename, lVolume+1)
- else
- Additive2.Click;//additive
- end; //RGB
-end;
-
-
-procedure TGLForm1.DemoteOrder(lRow: integer);
-var
- lSwap:integer;
- lAImg : TMRIcroHdr;
- lOverlayCLUTrec : TCLUTrec;
- lAUnaligned,lBUnaligned: Pointer; //raw address of Image Buffer: address may not be aligned
- lAScrnBuffer,lAImgBuffer,lBScrnBuffer,lBImgBuffer: Bytep;
-begin
- if (gOpenOverlays < 2 ) or (lRow > gOpenOverlays) or (lRow < 1) then
- exit;
- if lRow = gOpenOverlays then
- lSwap := 1
- else
- lSwap := lRow+1;
- lOverlayCLUTrec := gOverlayCLUTrec[lSwap];
- gOverlayCLUTrec[lSwap] := gOverlayCLUTrec[lRow];
- gOverlayCLUTrec[lRow] := lOverlayCLUTrec;
- //This next bit is involved, as for speed we do not use dynamic memory allocation...
- //Copy and purge memory allocation
- CopyImg2Mem(gOverlayImg[lRow], lAScrnBuffer,lAImgBuffer,lAUnaligned);
- CopyImg2Mem(gOverlayImg[lSwap], lBScrnBuffer,lBImgBuffer,lBUnaligned);
- //Swap image headers
- lAImg := gOverlayImg[lRow];
- gOverlayImg[lRow] := gOverlayImg[lSwap];
- gOverlayImg[lSwap] := lAImg;
- //allocate and include image data
- CopyMem2Img(gOverlayImg[lSwap], lAScrnBuffer,lAImgBuffer,lAUnaligned);
- CopyMem2Img(gOverlayImg[lRow], lBScrnBuffer,lBImgBuffer,lBUnaligned);
- UpdateOverlaySpread;
-end;
-
-procedure TGLForm1.StringGrid1DrawCell(Sender: TObject; aCol, aRow: Integer;
- aRect: TRect; aState: TGridDrawState);
-begin
- if aRow < 1 then exit;
- if not (gOverlayImg[aRow].LUTvisible) then begin
- with TStringGrid(Sender) do
- begin
- //paint the background Green
- Canvas.Font.Color := clRed;
- //Canvas.Brush.Color := clBlack;
- //Canvas.FillRect(aRect);
- Canvas.TextOut(aRect.Left+2,aRect.Top+2,Cells[ACol, ARow]);
- end;
- end;
-end;
-
-(*procedure TGLForm1.StringGridSetCaption(aRow: integer);
-begin
- if (aRow < 1) or (aRow > gOpenOverlays) then exit;
- //writes 2.599999 instead of 2.6
- GLForm1.Caption := format('%s : %s %g..%g', [GLForm1.StringGrid1.Cells[0, aRow], GLForm1.StringGrid1.Cells[kLUT, aRow], gOverlayImg[aRow].WindowScaledMin, gOverlayImg[aRow].WindowScaledMax] );
-end;*)
-
-
-procedure TGLForm1.StringGrid1MouseDown(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
-var
- Row: integer;
-begin
- if (gOpenOverlays < 1) then exit;
- if (X > (GLForm1.StringGrid1.ColWidths[kFName])) then
- exit; //not one of the first two colums
- Row := GLForm1.StringGrid1.DefaultRowHeight div 2;
- Row := round((Y-Row)/GLForm1.StringGrid1.DefaultRowHeight);
- GLForm1.LUTdrop.visible := false;
- if (Row < 1) or (Row > gOpenOverlays) then exit;
- StringGrid1.Hint := GLForm1.StringGrid1.Cells[0, Row];
- If ((ssRight in Shift) or (ssShift in Shift)) then begin //hide overlay
- OverlayVisible(Row, (not gOverlayImg[Row].LUTvisible) );
- ChangeOverlayUpdate;
- exit;
- end;
- if (gOpenOverlays < 2) then
- exit; //can not shuffle order of a single item!
- //if (X <= kVisWid) then begin
- // OverlayVisible(Row, (not gOverlayImg[Row].LUTvisible) );
- // ChangeOverlayUpdate;
- //end else
- DemoteOrder(Row);
-
-end;
-
-procedure TGLForm1.StringGrid1SelectCell(Sender: TObject; aCol, aRow: Integer;
- var CanSelect: Boolean);
-var R: TYPES.TRect;
-begin
- if (gTypeInCell) then UpdateImageIntensity(gPrevRow); // ChangeOverlayUpdate;
- if (ARow < 1) or (ARow > gOpenOverlays) then exit;
- StringGrid1.Hint := GLForm1.StringGrid1.Cells[0, ARow];
- if (ACol < kLUT) or (ACol > kMax) then exit;
- ReadCell(gPrevCol,gPrevRow, false);
- if (ACol = kLUT) and (ARow <> 0) then begin
- //Size and position the combo box to fit the cell
- R := StringGrid1.CellRect(ACol, ARow);
- R.Left := R.Left + GLForm1.StringGrid1.Left;
- R.Right := R.Right + GLForm1.StringGrid1.Left;
- R.Top := R.Top + GLForm1.StringGrid1.Top;
- R.Bottom := R.Bottom + GLForm1.StringGrid1.Top;
- //Show the combobox
- with GLForm1.LUTdrop do begin
- Tag := 0;
- Left := R.Left + 1;
- Top := R.Top + 1;
- Width := (R.Right + 1) - R.Left;
- Height := (R.Bottom + 1) - R.Top;
- ItemIndex := Items.IndexOf(GLForm1.StringGrid1.Cells[ACol, ARow]);
- Visible := True;
- SetFocus;
- Tag := ARow;
- end;
- end else begin
- GLForm1.LUTdrop.visible := false;
- ReadCell(ACol,ARow, false);
- gEnterCell := true;
- end;
- CanSelect := True;
-end;
-
-procedure TGLForm1.UpdateImageIntensity (lOverlay: integer);
-begin
- gTypeInCell := false;
- RescaleImgIntensity(gOverlayImg[lOverlay] );
- if gPrefs.OverlayHideZeros then HideZeros(gOverlayImg[lOverlay] );
- ChangeOverlayUpdate;
-end;
-
-procedure TGLForm1.UpdateLUT(lOverlay,lLUTIndex: integer; lChangeDrop: boolean);
-//6776
-begin
- if gOpenOverlays > kMaxOverlays then
- exit;
- if lLUTIndex >= LUTdrop.Items.Count then
- gOverlayImg[lOverlay].LUTindex:= 0
- else
- gOverlayImg[lOverlay].LUTindex:= lLUTIndex;
- if lChangeDrop then begin
- StringGrid1.Cells[kLUT, lOverlay] := LUTdrop.Items[gOverlayImg[lOverlay].LUTindex];
- //LUTdrop.ItemIndex := gOverlayImg[lOverlay].LUTindex;
- end;
- LUTdropLoad(gOverlayImg[lOverlay].LUTindex, gOverlayImg[lOverlay].LUT, LUTdrop.Items[lLUTindex], gOverlayCLUTrec[lOverlay]);
-end;
-
-
-function ImgIntensityStr(var lHdr: TMRIcroHdr; lVox: integer ): string;
-var
- v: single;
- l16Buf : SmallIntP;
- l32Buf : SingleP;
-begin
- result := '';
- if (lHdr.ImgBufferBPP = 4) then begin
- l32Buf := SingleP(lHdr.ImgBuffer );
- v := l32Buf^[lVox] ;
- end else if (lHdr.ImgBufferBPP = 2) then begin
- l16Buf := SmallIntP(lHdr.ImgBuffer );
- v := l16Buf^[lVox] ;
- end else if lHdr.ImgBufferBPP = 1 then
- v := lHdr.ImgBuffer[lVox]
- else
- exit;
- v := (v * lHdr.NiftiHdr.scl_slope)+lHdr.NiftiHdr.scl_inter;
- result := ' '+realtostr(v,3);
-end;
-
-{$DEFINE XXLX}
-{$IFDEF XXLX}
-
-procedure GenerateSlice (l32bitOutput: RGBQuadp; l8BitInput: bytep; lLUT: TLUT; lSlicePixels: integer; lAlphaPct: integer);
-var
- lI, lAlpha: integer;
- lLUTX: TLUT;
-begin
- if lSlicePixels < 1 then
- exit;
- lAlpha := 255-round(lAlphaPct * 2.55);
- if lAlpha < 0 then lAlpha := 0;
- if lAlpha > 255 then lAlpha := 255;
- lLUTX := lLUT;
- for lI := 0 to 255 do
- //if (lLUTX[lI].rgbReserved <> 0) then
- lLUTX[li].rgbReserved := lAlpha;
-
- lLUTX[0].rgbReserved := 0;
- for lI := 1 to lSlicePixels do begin
- l32bitOutput^[lI] := lLUTX[l8BitInput^[lI]];
- end;//each voxel
-end;
-
-procedure MinMax (var lMin,lMax: integer; lVal: integer);
-begin
- if lVal < lMin then
- lMin := lVal;
- if lVal > lMax then
- lMax := lVal;
-end;
-
-procedure AlphaBlend32Final(lBGQuad,lOverlayQuad : RGBQuadp; lBG0Clr,lOverlay0Clr: DWord; lSlicePixels, lOverlayTransPct: integer; lMaskWithBackground: boolean); // 630
-var
- lBGp,lOverlayP: ByteP;
- I,J: integer;
- lWtBg, lWtOver: single;
-begin
- lBGp := ByteP(lBGQuad);
- lOverlayP := ByteP(lOverlayQuad);
- J := 1;
- for I := 1 to lSlicePixels do begin
- if (lOverlayP^[J+3] = 0) or ((lBGp^[J+3] = 0 ) and (lMaskWithBackground)) then begin
- inc(J,4);
- continue;
- end;
- lWtOver := (lOverlayP^[J+3]* (1/255));
- lWtBG := 1 - lWtOver;
- lBGp^[J] := round(lWtBG*lBGp^[J] +lWtOver*lOverlayP^[J]);
- inc(J);
- lBGp^[J] := round(lWtBG*lBGp^[J] +lWtOver*lOverlayP^[J]);
- inc(J);
- lBGp^[J] := round(lWtBG*lBGp^[J] +lWtOver*lOverlayP^[J]);
- inc(J);
- lBGp^[J] := max(lBGp^[J], lOverlayP^[J]); //alpha on background
- inc(J);
- end;
-end;
-
-procedure AlphaAdditive32Final(lBGQuad,lOverlayQuad : RGBQuadp; lBG0Clr,lOverlay0Clr: DWord; lSlicePixels, lOverlayTransPct: integer; lMaskWithBackground: boolean); // 630
-var
- lBGp,lOverlayP: ByteP;
- I,J: integer;
-begin
- lBGp := ByteP(lBGQuad);
- lOverlayP := ByteP(lOverlayQuad);
- J := 1;
- for I := 1 to lSlicePixels do begin
- if (lOverlayP^[J+3] = 0) or ((lBGp^[J+3] = 0 ) and (lMaskWithBackground)) then begin
- inc(J,4);
- continue;
- end;
- lBGp^[J] := max(lBGp^[J], lOverlayP^[J]);
- inc(J);
- lBGp^[J] := max(lBGp^[J], lOverlayP^[J]);
- inc(J);
- lBGp^[J] := max(lBGp^[J], lOverlayP^[J]);
- inc(J);
- lBGp^[J] := max(lBGp^[J], lOverlayP^[J]); //alpha on background
- inc(J);
- end;
-end;
-
-procedure AlphaModulate32Final(lBGQuad,lOverlayQuad : RGBQuadp; lBG0Clr,lOverlay0Clr: DWord; lSlicePixels, lOverlayTransPct: integer; lMaskWithBackground: boolean); // 630
-var
- lBGp,lOverlayP: ByteP;
- lMin,lMax,I,J: integer;
- lWt,lSlope: single;
-begin
- lBGp := ByteP(lBGQuad);
- lOverlayP := ByteP(lOverlayQuad);
- J := 4;
- lMin := lBGp^[J];
- lMax := lBGp^[J];
- for I := 1 to lSlicePixels do begin
- MinMax(lMin,lMax,lBGp^[J]);
- inc(J,4);
- end;
- if lMin >= lMax then
- exit;//no range
- lSlope := 1/(lMax-lMin);
- J := 1;
- for I := 1 to lSlicePixels do begin
- if (lOverlayP^[J+3] = 0) or ((lBGp^[J+3] = 0 ) and (lMaskWithBackground)) then begin
- inc(J,4);
- continue;
- end;
- lWt := (lBGp^[J+3]-lMin)*lSlope;
- lBGp^[J] := round(lWt*lOverlayP^[J]);
- inc(J);
- lBGp^[J] := round(lWt*lOverlayP^[J]);
- inc(J);
- lBGp^[J] := round(lWt*lOverlayP^[J]);
- inc(J);
- lBGp^[J] := max(lBGp^[J], lOverlayP^[J]); //alpha on background
- inc(J);
- end;
-end;
-
-procedure AlphaBlend32(lBGQuad,lOverlayQuad : RGBQuadp; lBG0Clr,lOverlay0Clr: DWord; lSlicePixels, lOverlayTransPct: integer; lMaskWithBackground: boolean); // 630
-var
- lBGwt,lOverlaywt,lPixel,lPos:integer;
- lBGp,lOverlayP: ByteP;
- lBGQuadp,lOverlayDWordp : DWordp;
-procedure ModulateBlendX;
-var
- lMin,lMax,I,J: integer;
- lSlope,lWt: single;
-begin
- J := 4;
- lMin := lBGp^[J];
- lMax := lBGp^[J];
- for I := 1 to lSlicePixels do begin
- MinMax(lMin,lMax,lBGp^[J]);
- inc(J,4);
- end;
- if lMin >= lMax then
- exit;//no range
- lSlope := 1/(lMax-lMin);
- J := 1;
- for I := 1 to lSlicePixels do begin
- lWt := (lBGp^[J+3]-lMin)*lSlope;
- lBGp^[J] := round(lWt*lOverlayP^[J]);
- inc(J);
- lBGp^[J] := round(lWt*lOverlayP^[J]);
- inc(J);
- lBGp^[J] := round(lWt*lOverlayP^[J]);
- inc(J);
- lBGp^[J] := max(lBGp^[J], lOverlayP^[J]); //alpha on background
- inc(J);
- end;
-end; //nested ModulateBlendX
-begin
- lBGp := ByteP(lBGQuad);
- lOverlayP := ByteP(lOverlayQuad);
- lOverlayDWordp := DWordp(lOverlayQuad);
- lBGQuadp := DWordp(lBGQuad);
- //next: transparency weighting
- lBGwt := round((lOverlayTransPct)/100 * 1024);
- lOverlaywt := round((100-lOverlayTransPct)/100 * 1024);
- //lOverlayByte := 12;//round((255-lOverlayTransPct)/100 * 255);
- //next redraw each pixel
- lPos := 1;
- if lOverlayTransPct > -1 then begin //weighted
- for lPixel := 1 to lSlicePixels do begin
- if lOverlayDWordp^[lPixel] = lOverlay0Clr then begin
- inc(lPos,4);
- end else if (lOverlayP^[lPos+3] = 0) or ((lBGp^[lPos+3] = 0 ) and (lMaskWithBackground)) then begin
- inc(lPos,4)
- end else if lBGQuadp^[lPixel] = lOverlay0Clr then begin
- lBGp^[lPos] := lOverlayP^[lPos];
- inc(lPos);
- lBGp^[lPos] := lOverlayP^[lPos];
- inc(lPos);
- lBGp^[lPos] := lOverlayP^[lPos];
- inc(lPos);
- lBGp^[lPos] := lOverlayP^[lPos];//lOverlayByte;
- inc(lPos);
- end else begin
- lBGp^[lPos] := (lBGp^[lPos]*lBGwt+lOverlayP^[lPos]*lOverlaywt) shr 10;
- inc(lPos);
- lBGp^[lPos] := (lBGp^[lPos]*lBGwt+lOverlayP^[lPos]*lOverlaywt) shr 10;
- inc(lPos);
- lBGp^[lPos] := (lBGp^[lPos]*lBGwt+lOverlayP^[lPos]*lOverlaywt) shr 10;
- inc(lPos);
- if (not lMaskWithBackground) and (lBGp^[lPos]< lOverlayP^[lPos] {lOverlayByte}) then
- lBGp^[lPos] := lOverlayP^[lPos];//lOverlayByte;
- inc(lPos);
- end;
- end;//for each pixel
- end else if lOverlayTransPct = -2 then begin
- ModulateBlendX;// (lSlicePixels,lPos);//,lBGp,lOverlayP);
- end else begin //less than one : additive
- for lPixel := 1 to lSlicePixels do begin
- if lOverlayDWordp^[lPixel] = lOverlay0Clr then
- inc(lPos,4)
- else if (lBGp^[lPos+3] = 0 ) and (lMaskWithBackground) then
- inc(lPos,4)
- else begin
- if lOverlayP^[lPos] > lBGp^[lPos] then lBGp^[lPos] := lOverlayP^[lPos];
- inc(lPos);
- if lOverlayP^[lPos] > lBGp^[lPos] then lBGp^[lPos] := lOverlayP^[lPos];
- inc(lPos);
- if lOverlayP^[lPos] > lBGp^[lPos] then lBGp^[lPos] := lOverlayP^[lPos];
- inc(lPos);
- if (not lMaskWithBackground) and (lOverlayP^[lPos] > lBGp^[lPos]) then
- lBGp^[lPos] := lOverlayP^[lPos];
- //lBGp^[lPos] := max(lOverlayP^[lPos],lBGp^[lPos]);
- inc(lPos);
- end;
- end; //for each pixel
- end; //additive
-end;
-
-
-procedure TGLForm1.BlendOverlaysRGBA (var lTexture: TTexture);
-var
- lOverlaySlice2P: RGBQuadp;
- lOffset,lRGBOffset: integer;
- l1st: boolean;
- lSlicePixels,lSliceBytes,lSlice,lO,lVox,lA,lAlpha: integer;
- lTextureOverlayImgRGBA: Bytep0;
-begin
- lVox := lTexture.FiltDim[1]*lTexture.FiltDim[2]*lTexture.FiltDim[3];
- if (lVox < 1) or ((gPrefs.BackgroundAlpha = 100) and (gShader.OverlayVolume = 0)) or (gOpenOverlays < 1) or (lTexture.DataType <> GL_RGBA) then
- exit;
- for lO := 1 to gOpenOverlays do
- if lVox <> gOverlayImg[lO].ScrnBufferItems then
- exit;//error - sizes do not match
- lSlicePixels :=lTexture.FiltDim[1]*lTexture.FiltDim[2];
- lSliceBytes:= lSlicePixels*sizeof(TGLRGBQuad);
- lTextureOverlayImgRGBA := nil;
- SetLengthB(lTextureOverlayImgRGBA,lVox*sizeof(TGLRGBQuad));
- //lTextureOverlayImg := nil;
- //SetLengthB(lTextureOverlayImg,lVox);
- getmem(lOverlaySlice2P,lSliceBytes);
- lOffset := 1;
- lRGBOffset := 0;
- for lSlice := 1 to lTexture.FiltDim[3] do begin
- l1st := true;
- for lO := 1 to gOpenOverlays do begin
- if gOverlayImg[lO].LUTvisible then begin
- if l1st then begin
- l1st := false;
- GenerateSlice(@lTextureOverlayImgRGBA^[lRGBOffset],@gOverlayImg[lO].ScrnBuffer^[lOffset],gOverlayImg[lO].LUT,lSlicePixels, gBackgroundAlpha[lO]);
- end else begin
- GenerateSlice(lOverlaySlice2P,@gOverlayImg[lO].ScrnBuffer^[lOffset],gOverlayImg[lO].LUT,lSlicePixels,gBackgroundAlpha[lO]);
- AlphaBlend32(@lTextureOverlayImgRGBA^[lRGBOffset],lOverlaySlice2P, DWord(gOverlayImg[1].LUT[0]),DWord(gOverlayImg[lO].LUT[0]), lSlicePixels, gOverlayAlpha[lO], false{gPrefs.MaskOverlayWithBackground} ); // 630
- end;
- end;
- end;
- //if (gPrefs.BackgroundAlpha
- if gPrefs.BackgroundAlpha = -2 then //modulate
- AlphaModulate32Final(RGBquadp(@lTexture.FiltImg^[lRGBOffset]),@lTextureOverlayImgRGBA^[lRGBOffset], 0,DWord(gOverlayImg[1].LUT[0]), lSlicePixels, gPrefs.BackgroundAlpha,gPrefs.MaskOverlayWithBackground)
- else if gPrefs.BackgroundAlpha = -1 then //additive
- AlphaAdditive32Final(RGBquadp(@lTexture.FiltImg^[lRGBOffset]),@lTextureOverlayImgRGBA^[lRGBOffset], 0,DWord(gOverlayImg[1].LUT[0]), lSlicePixels, gPrefs.BackgroundAlpha,gPrefs.MaskOverlayWithBackground)
- //AlphaBlend32(RGBquadp(@lTexture.FiltImg^[lRGBOffset]),@lTextureOverlayImgRGBA^[lRGBOffset], 0,DWord(gOverlayImg[1].LUT[0]), lSlicePixels, gPrefs.BackgroundAlpha,gPrefs.MaskOverlayWithBackground)
- else
- AlphaBlend32Final(RGBquadp(@lTexture.FiltImg^[lRGBOffset]),@lTextureOverlayImgRGBA^[lRGBOffset], 0,DWord(gOverlayImg[1].LUT[0]), lSlicePixels, gPrefs.BackgroundAlpha,gPrefs.MaskOverlayWithBackground); // 630
-
-
- //AlphaBlend32(RGBquadp(@lTexture.FiltImg^[lRGBOffset]),@lTextureOverlayImgRGBA^[lRGBOffset], 0,DWord(gOverlayImg[1].LUT[0]), lSlicePixels, gPrefs.BackgroundAlpha,gPrefs.MaskOverlayWithBackground); // 630
- lOffset := lOffset + lSlicePixels;
- lRGBOffset := lRGBOffset + lSliceBytes;
- end;
- freemem(lOverlaySlice2P);
- lAlpha := 255- ((gPrefs.BackgroundAlpha*255) div 100);
- if (gShader.OverlayVolume < 1) then begin
- if (lAlpha < 32) then lAlpha := 32
- end else begin
- if (lAlpha < 64) then lAlpha := 64; //the GLSL shader does not scale output, so provide sharp gradients
- end;
- //lAlpha := lAlpha div 4;
- //GLForm1.Caption :='>>>'+ inttostr(lAlpha) ;
- lA := 0;
- for lO := 0 to (lVox-1) do begin
- if (lTextureOverlayImgRGBA^[lA]+lTextureOverlayImgRGBA^[lA+1]+lTextureOverlayImgRGBA^[lA+2]) > 0 then
- lTextureOverlayImgRGBA^[lA+3]:=lAlpha;
- lA := lA+4;
- end;
- CreateVolumeGL (lTexture, gRayCast.intensityOverlay3D,PChar(lTextureOverlayImgRGBA));
- CreateGradientVolume (lTexture, gRayCast.gradientOverlay3D,lTextureOverlayImgRGBA, true);
- SetLengthB(lTextureOverlayImgRGBA,0);
-end; //BlendOverlaysRGBA
-
-{$ELSE}
-procedure GenerateSlice (l32bitOutput: RGBQuadp; l8BitInput: bytep; lLUT: TLUT; lSlicePixels: integer);
-var
- lI: integer;
-begin
- if lSlicePixels < 1 then
- exit;
- for lI := 1 to lSlicePixels do begin
- l32bitOutput^[lI] := lLUT[l8BitInput^[lI]];
- end;//each voxel
-end;
-
-procedure MinMax (var lMin,lMax: integer; lVal: integer);
-begin
- if lVal < lMin then
- lMin := lVal;
- if lVal > lMax then
- lMax := lVal;
-end;
-
-procedure AlphaBlend32(lBGQuad,lOverlayQuad : RGBQuadp; lBG0Clr,lOverlay0Clr: DWord; lSlicePixels, lOverlayTransPct: integer; lMaskWithBackground: boolean); // 630
-var
- lBGwt,lOverlaywt,lPixel,lPos:integer;
- lBGp,lOverlayP: ByteP;
- lBGQuadp,lOverlayDWordp : DWordp;
-procedure ModulateBlendX;
-var
- lMin,lMax,I,J: integer;
- lSlope,lWt: single;
-begin
- J := 4;
- lMin := lBGp^[lPos];
- lMax := lBGp^[lPos];
- for I := 1 to lSlicePixels do begin
- MinMax(lMin,lMax,lBGp^[J]);
- inc(J,4);
- end;
- if lMin >= lMax then
- exit;//no range
- lSlope := 1/(lMax-lMin);
- J := 1;
- for I := 1 to lSlicePixels do begin
- lWt := (lBGp^[J+3]-lMin)*lSlope;
- lBGp^[J] := round(lWt*lOverlayP^[J]);
- inc(J);
- lBGp^[J] := round(lWt*lOverlayP^[J]);
- inc(J);
- lBGp^[J] := round(lWt*lOverlayP^[J]);
- inc(J);
- inc(J); //skip alpha
- end;
-end; //nested ModulateBlendX
-begin
- lBGp := ByteP(lBGQuad);
- lOverlayP := ByteP(lOverlayQuad);
- lOverlayDWordp := DWordp(lOverlayQuad);
- lBGQuadp := DWordp(lBGQuad);
- //next: transparency weighting
- lBGwt := round((lOverlayTransPct)/100 * 1024);
- lOverlaywt := round((100-lOverlayTransPct)/100 * 1024);
- //lOverlayByte := 12;//round((255-lOverlayTransPct)/100 * 255);
- //next redraw each pixel
- lPos := 1;
- if lOverlayTransPct > -1 then begin
- for lPixel := 1 to lSlicePixels do begin
- if lOverlayDWordp^[lPixel] = lOverlay0Clr then begin
- inc(lPos,4);
- end else if (lOverlayP^[lPos+3] = 0) or ((lBGp^[lPos+3] = 0 ) and (lMaskWithBackground)) then begin
- inc(lPos,4)
- end else if lBGQuadp^[lPixel] = lOverlay0Clr then begin
- lBGp^[lPos] := lOverlayP^[lPos];
- inc(lPos);
- lBGp^[lPos] := lOverlayP^[lPos];
- inc(lPos);
- lBGp^[lPos] := lOverlayP^[lPos];
- inc(lPos);
- lBGp^[lPos] := lOverlayP^[lPos];//lOverlayByte;
- inc(lPos);
-
- end else begin
- lBGp^[lPos] := (lBGp^[lPos]*lBGwt+lOverlayP^[lPos]*lOverlaywt) shr 10;
- inc(lPos);
- lBGp^[lPos] := (lBGp^[lPos]*lBGwt+lOverlayP^[lPos]*lOverlaywt) shr 10;
- inc(lPos);
- lBGp^[lPos] := (lBGp^[lPos]*lBGwt+lOverlayP^[lPos]*lOverlaywt) shr 10;
- inc(lPos);
- if (not lMaskWithBackground) and (lBGp^[lPos]< lOverlayP^[lPos] {lOverlayByte}) then
- lBGp^[lPos] := lOverlayP^[lPos];//lOverlayByte;
- inc(lPos);
- end;
- end;//for each pixel
- end else if lOverlayTransPct = -2 then begin
- ModulateBlendX;// (lSlicePixels,lPos);//,lBGp,lOverlayP);
- end else begin //less than one : additive
- for lPixel := 1 to lSlicePixels do begin
- if lOverlayDWordp^[lPixel] = lOverlay0Clr then
- inc(lPos,4)
- else if (lBGp^[lPos+3] = 0 ) and (lMaskWithBackground) then
- inc(lPos,4)
- else begin
- if lOverlayP^[lPos] > lBGp^[lPos] then lBGp^[lPos] := lOverlayP^[lPos];
- inc(lPos);
- if lOverlayP^[lPos] > lBGp^[lPos] then lBGp^[lPos] := lOverlayP^[lPos];
- inc(lPos);
- if lOverlayP^[lPos] > lBGp^[lPos] then lBGp^[lPos] := lOverlayP^[lPos];
- inc(lPos);
- if (not lMaskWithBackground) and (lOverlayP^[lPos] > lBGp^[lPos]) then
- lBGp^[lPos] := lOverlayP^[lPos];
- inc(lPos);
- end;
- end; //for each pixel
- end; //additive
-end;
-
-
-procedure TGLForm1.BlendOverlaysRGBA (var lTexture: TTexture);
-var
- lOverlaySlice2P: RGBQuadp;
- lOffset,lRGBOffset: integer;
- l1st: boolean;
- lSlicePixels,lSliceBytes,lSlice,lO,lVox,lA,lAlpha: integer;
- lTextureOverlayImgRGBA: Bytep0;
-begin
- lVox := lTexture.FiltDim[1]*lTexture.FiltDim[2]*lTexture.FiltDim[3];
- if (lVox < 1) or ((gPrefs.BackgroundAlpha = 100) and (gShader.OverlayVolume = 0)) or (gOpenOverlays < 1) or (lTexture.DataType <> GL_RGBA) then
- exit;
- for lO := 1 to gOpenOverlays do
- if lVox <> gOverlayImg[lO].ScrnBufferItems then
- exit;//error - sizes do not match
- lSlicePixels :=lTexture.FiltDim[1]*lTexture.FiltDim[2];
- lSliceBytes:= lSlicePixels*sizeof(TGLRGBQuad);
- lTextureOverlayImgRGBA := nil;
- SetLengthB(lTextureOverlayImgRGBA,lVox*sizeof(TGLRGBQuad));
- //lTextureOverlayImg := nil;
- //SetLengthB(lTextureOverlayImg,lVox);
- getmem(lOverlaySlice2P,lSliceBytes);
- lOffset := 1;
- lRGBOffset := 0;
- for lSlice := 1 to lTexture.FiltDim[3] do begin
- l1st := true;
- for lO := 1 to gOpenOverlays do begin
- if gOverlayImg[lO].LUTvisible then begin
- if l1st then begin
- l1st := false;
- GenerateSlice(@lTextureOverlayImgRGBA^[lRGBOffset],@gOverlayImg[lO].ScrnBuffer^[lOffset],gOverlayImg[lO].LUT,lSlicePixels);
- end else begin
- GenerateSlice(lOverlaySlice2P,@gOverlayImg[lO].ScrnBuffer^[lOffset],gOverlayImg[lO].LUT,lSlicePixels);
- AlphaBlend32(@lTextureOverlayImgRGBA^[lRGBOffset],lOverlaySlice2P, DWord(gOverlayImg[1].LUT[0]),DWord(gOverlayImg[lO].LUT[0]), lSlicePixels, gOverlayAlpha[lO], false{gPrefs.MaskOverlayWithBackground} ); // 630
- end;
- end;
- end;
- //AlphaBlend32(RGBquadp(@lTexture.FiltImg^[lRGBOffset]),@lTexture.OverlayImgRGBA^[lRGBOffset], 0,DWord(gOverlayImg[1].LUT[0]), lSlicePixels, gPrefs.BackgroundAlpha,gPrefs.MaskOverlayWithBackground); // 630
- //if (gShader.OverlayVolume < 1) then
- AlphaBlend32(RGBquadp(@lTexture.FiltImg^[lRGBOffset]),@lTextureOverlayImgRGBA^[lRGBOffset], 0,DWord(gOverlayImg[1].LUT[0]), lSlicePixels, gPrefs.BackgroundAlpha,gPrefs.MaskOverlayWithBackground); // 630
- //else
- // AlphaBlend32(RGBquadp(@lTexture.FiltImg^[lRGBOffset]),@lTexture.OverlayImgRGBA^[lRGBOffset], 0,DWord(gOverlayImg[1].LUT[0]), lSlicePixels, 90,gPrefs.MaskOverlayWithBackground); // 630
- lOffset := lOffset + lSlicePixels;
- lRGBOffset := lRGBOffset + lSliceBytes;
- end;
- freemem(lOverlaySlice2P);
- lAlpha := 255- ((gPrefs.BackgroundAlpha*255) div 100);
- if (gShader.OverlayVolume < 1) then begin
- if (lAlpha < 32) then lAlpha := 32
- end else begin
- if (lAlpha < 64) then lAlpha := 64; //the GLSL shader does not scale output, so provide sharp gradients
- end;
- //lAlpha := lAlpha div 4;
- //GLForm1.Caption :='>>>'+ inttostr(lAlpha) ;
- lA := 0;
- for lO := 0 to (lVox-1) do begin
- if (lTextureOverlayImgRGBA^[lA]+lTextureOverlayImgRGBA^[lA+1]+lTextureOverlayImgRGBA^[lA+2]) > 0 then
- lTextureOverlayImgRGBA^[lA+3]:=lAlpha;
- lA := lA+4;
- end;
- CreateVolumeGL (lTexture, gRayCast.intensityOverlay3D,PChar(lTextureOverlayImgRGBA));
- CreateGradientVolume (lTexture, gRayCast.gradientOverlay3D,lTextureOverlayImgRGBA, true);
- SetLengthB(lTextureOverlayImgRGBA,0);
-end; //BlendOverlaysRGBA
-
-{$ENDIF}
-
-function TGLForm1.OverlayIntensityString(Voxel: integer): string;
-var
- lO: integer;
-begin
- result := '';
- if (gOpenOverlays < 1) then exit;
- //result := 'x';
- for lO := 1 to gOpenOverlays do begin
- //RescaleImgIntensity(gOverlayImg[lOverlay] );
- result := result + ImgIntensityStr(gOverlayImg[lO], Voxel )
- end
-end;
-
-procedure TGLForm1.SetOverlayAlphaValue(NewValue: integer);
-var
- i: integer;
-begin
- gPrefs.OverlayAlpha := NewValue;
- for i := kMinOverlayIndex to kMaxOverlays do
- gOverlayAlpha[i] := NewValue;
-end;
-
-procedure TGLForm1.OverlayColorFromZeroMenuClick(Sender: TObject);
-var
- lO: integer;
-begin
- gPrefs.OverlayHideZeros:= OverlayHideZerosMenu.Checked;
- gPrefs.OverlayColorFromZero := OverlayColorFromZeroMenu.checked;
- if gOpenOverlays < 1 then
- exit;
- for lO := 1 to gOpenOverlays do
- gOverlayImg[lO].LutFromZero := gPrefs.OverlayColorFromZero;
- for lO := 1 to gOpenOverlays do begin
- RescaleImgIntensity(gOverlayImg[lO] );
- if gPrefs.OverlayHideZeros then HideZeros(gOverlayImg[lO]);
- end;
- ChangeOverlayUpdate;
-end;
-
-procedure TGLForm1.SetBackgroundAlpha(Sender: TObject);
-begin
- gPrefs.BackgroundAlpha := (Sender as TMenuItem).tag;
- SetBackgroundAlphaValue (gPrefs.BackgroundAlpha);
- //StatusPanelUpdate;
- ChangeOverlayUpdate;
-end;
-
-
-procedure TGLForm1.OverlayVisible(lOverlay: integer; lVisible: boolean);
-begin
- if (lOverlay > gOpenOverlays) or (lOverlay < 1) then
- exit;
- gOverlayImg[lOverlay].LUTvisible := lVisible{not gOverlayImg[lOverlay].LUTvisible};
- UpdateOverlaySpreadI(lOverlay);
-end;
-
-procedure TGLForm1.SetOverlayAlphaLayerValue(Layer, NewValue: integer);
-begin
- if (Layer < kMinOverlayIndex) or (Layer > kMaxOverlays) then
- exit;
- gOverlayAlpha[Layer] := NewValue;
- gPrefs.OverlayAlpha := NewValue;
-end;
-
-procedure TGLForm1.SetBackgroundAlphaLayerValue(Layer, NewValue: integer);
-begin
- if (Layer < kMinOverlayIndex) or (Layer > kMaxOverlays) then
- exit;
- gBackgroundAlpha[Layer] := NewValue;
- gPrefs.BackgroundAlpha := NewValue;
-end;
-
-procedure TGLForm1.SetSubmenuWithTag (var lRootMenu: TMenuItem; lTag: Integer);
-var
- lCount,lSubMenu: integer;
-begin
- lCount := lRootMenu.Count;
- if lCount < 1 then exit;
- for lSubMenu := (lCount-1) downto 0 do
- if lRootmenu.Items[lSubmenu].Tag = lTag then begin
- lRootmenu.Items[lSubmenu].Checked := true;
- exit
- end;
- //will exit unless tag not found: default select 1st item
- lRootmenu.Items[0].Checked := true;
- //While Recent1.Count > 0 do Recent1.Items[0].Free;
-end;
-
-procedure TGLForm1.SetBackgroundAlphaValue(NewValue: integer);
-var
- i: integer;
-begin
- gPrefs.BackgroundAlpha := NewValue;
- for i := kMinOverlayIndex to kMaxOverlays do
- gBackgroundAlpha[i] := NewValue;
-end;
-
-procedure TGLForm1.Addoverlay1Click(Sender: TObject);
-//6776
-var
- lFilename: string;
- lF,lnVol: integer;
- Opt : TOpenOptions;
-begin
- lF := kMaxOverlays;
- if gOpenOverlays >= lF then begin
- showmessage('Too many overlays open. Please close an overlay before adding a new one.');
- exit;
- end;
- StringGrid1.Selection := TGridRect(Rect(-1, -1, -1, -1));
- if (gTexture3D.FiltDim[1] < 1) or (gTexture3D.FiltDim[2] < 1) or (gTexture3D.FiltDim[3] < 1) then begin
- showmessage('Please load a background image before loading an overlay.');
- exit;
- end;
- Opt := OpenDialog1.Options;
- OpenDialog1.Options := [ofAllowMultiSelect,ofFileMustExist];
- if not OpenDialog1.Execute then begin
- OpenDialog1.Options := Opt;
- exit;
- end;
- OpenDialog1.Options := Opt;
- if OpenDialog1.Files.Count < 1 then
- exit;
- for lF := 0 to (OpenDialog1.Files.Count-1) do begin
- lFilename := OpenDialog1.Files[lF];
- lnVol := NIFTIvolumes(lFilename);
- if lnVol < 1 then
- exit;
- if ScriptForm.PSScript1.Running then
- lnVol := 1
- else if lnVol > 1 then
- ReadIntForm.GetInt('4D image: select volume',1,1,lnVol); // 5/2017 https://github.com/neurolabusc/MRIcroGL/issues/4
- AddOverlay(lFilename,lnVol);
- end;
-end;
-
-procedure TGLForm1.SetViewClick(Sender: TObject);
-begin
- gPrefs.SliceView := (Sender as TMenuItem).tag;
- Mosaic1Click(Sender);
- SetToolPanelWidth;
- if (gPrefs.SliceView <> 5) then gRayCast.MosaicString := '';
- GLbox.Invalidate;
-end;
-
-procedure TGLForm1.CustomDrawColors1Click(Sender: TObject);
-begin
- if (OpenDialogTxt.Execute) then
- loadLabelsITK(OpenDialogTxt.Filename)
- else
- loadLabelsDefault;
-end;
-
-procedure TGLForm1.ErrorTimerTimer(Sender: TObject);
-//we can not open a dialog in a openGL context, so we show error messages later
-begin
- ErrorTimer.Enabled:= false;
- if length(IntensityBox.Hint) < 1 then
- showmessage('Unspecified OpenGL error')
- else
- showmessage(IntensityBox.Hint);
- GLForm1.IntensityBox.Hint := '';
-end;
-
-procedure TGLForm1.Sharpen1Click(Sender: TObject);
-begin
- if gTexture3D.isLabels then exit; //we can not sharpen indexed colors
- SharpenTexture(gTexture3D);
- UpdateTimer.enabled := true;
-end;
-
-procedure TGLForm1.ShowmessageError(Str:string);
-begin
- if (GLForm1.IntensityBox.Hint = '') then //Show 1st error
- GLForm1.IntensityBox.Hint := Str;
- GLForm1.ErrorTimer.Enabled := true;
-end;
-
-procedure TGLForm1.FormDropFiles(Sender: TObject;
- const FileNames: array of String);
-var
- lFilename: string;
- ss: TShiftState;
-begin
-if (dcm2niiForm.visible) and ((dcm2niiForm.Active) or (dcm2niiForm.Focused)) then begin
- dcm2niiForm.FormDropFiles(Sender, FileNames);
- exit;
-end;
-ss := getKeyshiftstate;
-if AutoRunTimer1.enabled then exit;
-//AutoRunTimer1.Enabled := false; //if user opens with application, disable startup script in OSX
-if length(FileNames) < 1 then
- exit;
-lFilename := Filenames[0];
-if (ssMeta in ss) or (ssCtrl in ss) then begin
- AddOverlay(lFilename,1);
- exit;
-end;
-if (not DirectoryExists(lFilename)) and (NIFTIvolumes(lFilename) > 0) then begin
- LoadDatasetNIFTIvolx(lFileName,true);
- exit;
-end;
-//check for DICOM
- lFilename := dcm2Nifti(dcm2niiForm.getExeName, lFilename);
- if lFilename = '' then exit;
- LoadDatasetNIFTIvolx(lFileName,true);
-end;
-
-procedure TGLForm1.FormShow(Sender: TObject);
-begin
- //CheckForUpdates(nil);
- {$IFDEF LCLCocoa}
- SetDarkMode;
- {$ENDIF}
-end;
-
-procedure TGLForm1.AppDropFiles(Sender: TObject; const FileNames: array of String);
-begin
- //With MacOS and Lazarus 1.9, this causees FormDropFIiles to be called twice
- //FormDropFiles(Sender, Filenames);
-end;
-
-initialization
- DecimalSeparator := '.';
-end.
-
diff --git a/backup/readint.lfm b/backup/readint.lfm
deleted file mode 100755
index bd819cb..0000000
--- a/backup/readint.lfm
+++ /dev/null
@@ -1,41 +0,0 @@
-object ReadIntForm: TReadIntForm
- Left = 473
- Height = 92
- Top = 237
- Width = 242
- ActiveControl = ReadIntEdit
- Caption = 'Integer required'
- ClientHeight = 92
- ClientWidth = 242
- Font.Height = -11
- Font.Name = 'Default'
- OnCreate = FormCreate
- Position = poScreenCenter
- LCLVersion = '1.9.0.0'
- object ReadIntLabel: TLabel
- Left = 12
- Height = 13
- Top = 16
- Width = 79
- Caption = 'Enter a number'
- ParentColor = False
- end
- object ReadIntEdit: TSpinEdit
- Left = 99
- Height = 21
- Top = 12
- Width = 93
- MaxValue = 0
- ParentFont = False
- TabOrder = 1
- end
- object OKBtn: TButton
- Left = 136
- Height = 25
- Top = 48
- Width = 75
- Caption = 'OK'
- OnClick = OKBtnClick
- TabOrder = 0
- end
-end
diff --git a/backup/readint.pas b/backup/readint.pas
deleted file mode 100755
index 784c7ef..0000000
--- a/backup/readint.pas
+++ /dev/null
@@ -1,88 +0,0 @@
-unit readint;
-
-interface
-
-uses
- {$IFDEF FPC} LResources,{$ENDIF}
- Buttons{only Lazarus?},SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- StdCtrls, Spin, types;
-
-type
-
- { TReadIntForm }
-
- TReadIntForm = class(TForm)
- ReadIntEdit: TSpinEdit;
- ReadIntLabel: TLabel;
- OKBtn: TButton;
- procedure FormCreate(Sender: TObject);
- function GetInt(lStr: string; lMin,lDefault,lMax: integer): integer;
- procedure OKBtnClick(Sender: TObject);
-
- private
- { Private declarations }
- public
-
- { Public declarations }
- end;
-
-var
- ReadIntForm: TReadIntForm;
-
-implementation
-
-//uses nifti_img_view,{license,} MultiSlice, render;
- {$IFDEF FPC} {$R *.lfm} {$ENDIF}
- {$IFNDEF FPC}
-{$R *.DFM}
-{$ENDIF}
-
- {$ifdef LCLCocoa}
-uses mainunit, nsappkitext; //darkmode
-{$ENDIF}
- function TReadIntForm.GetInt(lStr: string; lMin,lDefault,lMax: integer): integer;
- var
- w,h: integer;
- begin
- ReadIntLabel.caption := lStr+' ['+inttostr(lMin)+'..'+inttostr(lMax)+']';
- ReadIntEdit.AnchorSide[akLeft].Side := asrRight;
- ReadIntEdit.AnchorSide[akLeft].Control := ReadIntLabel;
- ReadIntEdit.Anchors := ReadIntEdit.Anchors + [akLeft];
- ReadIntEdit.BorderSpacing.Left := 12;
- ReadIntEdit.MinValue := lMin;
- ReadIntEdit.MaxValue := lMax;
- ReadIntEdit.Value := lDefault;
- OKBtn.AnchorSide[akLeft].Side := asrRight;
- OKBtn.AnchorSide[akLeft].Control := ReadIntLabel;
- OKBtn.Anchors := OKBtn.Anchors + [akLeft];
- OKBtn.BorderSpacing.Left := 12;
- ReadIntForm.HandleNeeded;
- ReadIntForm.GetPreferredSize(w,h);
- ReadIntForm.Width:= w+12;
- {$IFDEF LCLCocoa}
- //ReadIntForm.PopupMode:= pmAuto; //see issue 33616
- setThemeMode(ReadIntForm, gPrefs.DarkMode);
- {$ENDIF}
- ReadIntForm.ShowModal;
- result := ReadIntEdit.Value;
- end;
-
-procedure TReadIntForm.FormCreate(Sender: TObject);
-begin
- //ScaleDPI(Self,48);
-end;
-
-procedure TReadIntForm.OKBtnClick(Sender: TObject);
-begin
- ReadIntForm.ModalResult := mrOK;
-end;
-
-
-
-
-initialization
-{$IFDEF FPC}
- // {$I readint.lrs}
-{$ENDIF}
-
-end.
diff --git a/backup/scriptengine.lfm b/backup/scriptengine.lfm
deleted file mode 100755
index 815a732..0000000
--- a/backup/scriptengine.lfm
+++ /dev/null
@@ -1,702 +0,0 @@
-object ScriptForm: TScriptForm
- Tag = 2
- Left = 622
- Height = 750
- Top = 114
- Width = 774
- ActiveControl = Memo1
- Caption = 'ScriptForm'
- ClientHeight = 703
- ClientWidth = 774
- DesignTimePPI = 192
- Menu = ScriptMenu1
- OnActivate = FormActivate
- OnCloseQuery = FormCloseQuery
- OnCreate = FormCreate
- OnDeactivate = FormDeactivate
- OnHide = FormHide
- OnShow = FormShow
- Position = poScreenCenter
- LCLVersion = '2.1.0.0'
- object Splitter1: TSplitter
- Cursor = crVSplit
- Left = 0
- Height = 6
- Top = 545
- Width = 774
- Align = alBottom
- ResizeAnchor = akBottom
- end
- object Memo1: TMemo
- Left = 0
- Height = 545
- Top = 0
- Width = 774
- Align = alClient
- Constraints.MinHeight = 6
- OnChange = Memo1Change
- OnClick = Memo1Click
- OnKeyUp = Memo1KeyUp
- ParentBidiMode = False
- ParentFont = False
- ScrollBars = ssAutoVertical
- TabOrder = 0
- WantTabs = True
- WordWrap = False
- end
- object Memo2: TMemo
- Left = 0
- Height = 152
- Top = 551
- Width = 774
- Align = alBottom
- Constraints.MinHeight = 6
- ParentFont = False
- ReadOnly = True
- ScrollBars = ssAutoVertical
- TabOrder = 1
- end
- object ScriptMenu1: TMainMenu
- left = 208
- top = 64
- object File1: TMenuItem
- Caption = '&File'
- object New1: TMenuItem
- Caption = '&New'
- OnClick = New1Click
- end
- object NewPython1: TMenuItem
- Tag = 1
- Caption = 'New Python'
- OnClick = New1Click
- end
- object Open1: TMenuItem
- Caption = '&Open...'
- OnClick = Open1Click
- end
- object Save1: TMenuItem
- Caption = '&Save'
- OnClick = Save1Click
- end
- object SaveAs1: TMenuItem
- Caption = 'Save &As...'
- OnClick = SaveAs1Click
- end
- object Exit1: TMenuItem
- Caption = 'E&xit'
- OnClick = Exit1Click
- end
- object N1: TMenuItem
- Caption = '-'
- end
- object MRU1: TMenuItem
- Caption = 'MRU1'
- end
- object MRU2: TMenuItem
- Caption = 'MRU2'
- end
- object MRU3: TMenuItem
- Caption = 'MRU3'
- end
- object MRU4: TMenuItem
- Caption = 'MRU4'
- end
- object MRU5: TMenuItem
- Caption = 'MRU5'
- end
- object MRU6: TMenuItem
- Caption = 'MRU6'
- end
- object MRU7: TMenuItem
- Caption = 'MRU7'
- end
- object MRU8: TMenuItem
- Caption = 'MRU8'
- end
- object MRU9: TMenuItem
- Caption = 'MRU9'
- end
- object MRU10: TMenuItem
- Caption = 'MRU10'
- end
- end
- object Edit1: TMenuItem
- Caption = 'Edit'
- object Cut1: TMenuItem
- Caption = 'Cut'
- ShortCut = 16472
- OnClick = Cut1Click
- end
- object Copy1: TMenuItem
- Caption = 'Copy'
- ShortCut = 16451
- OnClick = Copy1Click
- end
- object Paste1: TMenuItem
- Caption = 'Paste'
- ShortCut = 16470
- OnClick = Paste1Click
- end
- object ListCommands1: TMenuItem
- Caption = 'List all commands'
- OnClick = ListCommands1Click
- end
- object showcolortable1: TMenuItem
- Caption = 'List color table'
- OnClick = showcolortable1Click
- end
- end
- object Insert1: TMenuItem
- Caption = 'Insert'
- object Forms1: TMenuItem
- Caption = 'Forms'
- object clipformvisible1: TMenuItem
- Tag = 1
- Caption = 'clipformvisible'
- Hint = 'clipformvisible (visible: boolean) Shows or hides the clipping form.'
- Visible = False
- OnClick = InsertCommand
- end
- object colorbarformvisible1: TMenuItem
- Tag = 1
- Caption = 'colorbarformvisible'
- Hint = 'colorbarformvisible (visible: boolean) Shows or hides the window that allows the user to interactively control the size and location of the colorbar. '
- Visible = False
- OnClick = InsertCommand
- end
- object contrastformvisible1: TMenuItem
- Tag = 1
- Caption = 'contrastformvisible'
- Hint = 'contrastformvisible (visible: boolean) Shows or hides the contrast and color window. '
- OnClick = InsertCommand
- end
- object cutoutformvisible1: TMenuItem
- Tag = 1
- Caption = 'cutoutformvisible'
- Hint = 'cutoutformvisible (visible: boolean) Shows or hides the cutout window.'
- Visible = False
- OnClick = InsertCommand
- end
- object edgeenhanceformvisible1: TMenuItem
- Tag = 1
- Caption = 'edgeenhanceformvisible'
- Hint = 'edgeenhanceformvisible (visible: boolean) Shows or hides the edge enhancement form that helps emphasize tissue boundaries. '
- Visible = False
- OnClick = InsertCommand
- end
- object mosaicformvisible1: TMenuItem
- Tag = 1
- Caption = 'mosaicformvisible'
- Hint = 'mosaicformvisible (visible: boolean) Shows or hides the mosaic designer window.'
- Visible = False
- OnClick = InsertCommand
- end
- object overlayformvisible1: TMenuItem
- Tag = 1
- Caption = 'overlayformvisible'
- Hint = 'overlayformvisible (visible: boolean) Shows or hides the overlay window.'
- Visible = False
- OnClick = InsertCommand
- end
- object scriptformvisible1: TMenuItem
- Tag = 1
- Caption = 'scriptformvisible'
- Hint = 'scriptformvisible (visible: boolean) Shows or hides the scripting window.'
- OnClick = InsertCommand
- end
- object toolformvisible1: TMenuItem
- Tag = 1
- Caption = 'toolformvisible'
- Hint = 'toolformvisible (visible: boolean) Shows or hides the tools panel.'
- OnClick = InsertCommand
- end
- end
- object Colorbar1: TMenuItem
- Caption = 'Colorbar'
- object colorbarvisible1: TMenuItem
- Tag = 1
- Caption = 'colorbarvisible'
- Hint = 'colorbarvisible (visible: boolean) Shows a colorbar on the main images.'
- OnClick = InsertCommand
- end
- object colorbarcoord1: TMenuItem
- Tag = 2
- Caption = 'colorbarposition'
- Hint = 'colorbarposition (p: integer) Sets the position of the colorbar: 1=bottom, 2=left, 3=top, 4=right.'
- OnClick = InsertCommand
- end
- object colorbarsize1: TMenuItem
- Tag = 3
- Caption = 'colorbarsize'
- Hint = 'colorbarsize (f) Change width of color bar f is a value 0.01..0.5 that specifies the fraction of the screen used by the colorbar'
- OnClick = InsertCommand
- end
- object colorbartext1: TMenuItem
- Tag = 1
- Caption = 'colorbartext'
- Hint = 'colorbartext (visible: boolean) If set to true, then colorbars will include text that indicates intensity range.'
- Visible = False
- OnClick = InsertCommand
- end
- end
- object Contrast1: TMenuItem
- Caption = 'Contrast'
- object setcolortable1: TMenuItem
- Tag = 2
- Caption = 'setcolortable'
- Hint = 'setcolortable (tablenum: integer) changes the color scheme used to display an image.'
- OnClick = InsertCommand
- end
- object changenode1: TMenuItem
- Tag = 66
- Caption = 'changenode'
- Hint = 'changenode (index, intensity, r, g, b, a: integer) This command adjusts a point in the color table.'
- OnClick = InsertCommand
- end
- object addnode1: TMenuItem
- Tag = 56
- Caption = 'addnode'
- Hint = 'addnode (intensity, r, g, b, a: integer) this command adds a new point to the color table.'
- OnClick = InsertCommand
- end
- object contrastminmax1: TMenuItem
- Tag = 23
- Caption = 'contrastminmax'
- Hint = 'contrastminmax (min, max: float) sets the minumum nd maximum value for the color lookup table.'
- OnClick = InsertCommand
- end
- object colorname1: TMenuItem
- Tag = 4
- Caption = 'colorname'
- Hint = 'colorname (filename: string) Loads the requested colorscheme for the background image.'
- OnClick = InsertCommand
- end
- object edgedetect1: TMenuItem
- Tag = 22
- Caption = 'edgedetect'
- Hint = 'edgedetect (thresh: float; dilatecycles: integer) This procedure attempts to hide regions of consistent color from your image.'
- Visible = False
- OnClick = InsertCommand
- end
- end
- object Dialogs1: TMenuItem
- Caption = 'Dialogs'
- object modalmessage1: TMenuItem
- Tag = 4
- Caption = 'modalmessage'
- Hint = 'modalmessage (str: string) Shows a modal dialog, script stops until user presses ''OK'' button to dismiss dialog.'
- OnClick = InsertCommand
- end
- object modelessmessage1: TMenuItem
- Tag = 4
- Caption = 'modelessmessage'
- Hint = 'modelessmessage (str: string) Shows text in the rendering window. This text is displayed until the text is changed.'
- OnClick = InsertCommand
- end
- end
- object Overlays1: TMenuItem
- Caption = 'Overlays'
- object overlayload1: TMenuItem
- Tag = 4
- Caption = 'overlayload'
- Hint = 'overlayload (filename: string) integer; Will add the overlay named filename and return the number of the overlay.'
- OnClick = InsertCommand
- end
- object overlayloadcluster1: TMenuItem
- Tag = 142211
- Caption = 'overlayloadcluster'
- Hint = 'overlayloadcluster (filename: string; threshold, clusterMM3: float; lSaveToDisk: boolean) integer; Will add the overlay named filename, only display voxels with intensity greater than threshold with a cluster volume greater than clusterMM and return the number of the overlay.'
- OnClick = InsertCommand
- end
- object overlayloadvol1: TMenuItem
- Caption = 'overlayloadvol'
- OnClick = InsertCommand
- end
- object overlaycloseall1: TMenuItem
- Caption = 'overlaycloseall'
- Hint = 'overlaycloseall () This function has no parameters. All open overlays will be closed.'
- OnClick = InsertCommand
- end
- object overlaycolornumber1: TMenuItem
- Tag = 22
- Caption = 'overlaycolornumber'
- Hint = 'overlaycolornumber (overlay, color_index: integer) Sets the color scheme for a overlay.'
- OnClick = InsertCommand
- end
- object overlaycolorname1: TMenuItem
- Tag = 1214
- Caption = 'overlaycolorname'
- Hint = 'overlaycolorname (overlay: integer; filename: string) Set the colorscheme for the target overlay to a specified name.'
- OnClick = InsertCommand
- end
- object overlayminmax1: TMenuItem
- Tag = 1223
- Caption = 'overlayminmax'
- Hint = 'overlayminmax (overlay: integer; min, max: float) Sets the color range for the overlay.'
- OnClick = InsertCommand
- end
- object overlaytransparencyonbackground1: TMenuItem
- Tag = 2
- Caption = 'overlaytransparencyonbackground'
- Hint = 'overlaytransparencyonbackground (percent: integer) Controls the opacity of the overlays on the background.'
- OnClick = InsertCommand
- end
- object overlaytransparencyonoverlay1: TMenuItem
- Tag = 2
- Caption = 'overlaytransparencyonoverlay'
- Hint = 'overlaytransparencyonoverlay (percent: integer) Controls the opacity of the overlays on other overlays.'
- OnClick = InsertCommand
- end
- object overlaycolorfromzero1: TMenuItem
- Tag = 1
- Caption = 'overlaycolorfromzero'
- Hint = 'overlaycolorfromzero (fromzero: boolean) If set to false, then the full color range is used to show the overlay.'
- OnClick = InsertCommand
- end
- object overlayloadsmooth1: TMenuItem
- Tag = 1
- Caption = 'overlayloadsmooth'
- Hint = 'overlayloadsmooth (smooth: boolean) Determines whether overlays are interpolated using trilinear interpolation.'
- OnClick = InsertCommand
- end
- object overlaymaskedbybackground1: TMenuItem
- Tag = 1
- Caption = 'overlaymaskedbybackground'
- Hint = 'overlaymaskedbybackground (mask: boolean) If true, than a overlay will be transparent on any voxel where the background image is transparent.'
- OnClick = InsertCommand
- end
- object overlayvisible1: TMenuItem
- Tag = 1211
- Caption = 'overlayvisible'
- Hint = 'overlayvisible (overlay: integer; visible: boolean) The feature allows you to make individual overlays visible or invisible.'
- OnClick = InsertCommand
- end
- object overlayhidezeros1: TMenuItem
- Tag = 1
- Caption = 'overlayhidezeros'
- Hint = 'overlayhidezeros (mask: boolean) If true, values with intensity of zero are always transparent.'
- OnClick = InsertCommand
- end
- object overlaylayertransparencyonoverlay1: TMenuItem
- Tag = 22
- Caption = 'overlaylayertransparencyonoverlay'
- Hint = 'overlaylayertransparencyonoverlay (layer, percent: integer) allows you to make a specific overlay volume have a custom transparency on other overlay images.'
- OnClick = InsertCommand
- end
- object overlaylayertransparencyonbackground1: TMenuItem
- Tag = 22
- Caption = 'overlaylayertransparencyonbackground'
- Hint = 'overlaylayertransparencyonbackground (overlaylayer, percent: integer) Specifies a custom transparency for a single overlay layer on top of the background image'
- OnClick = InsertCommand
- end
- end
- object Shaders1: TMenuItem
- Caption = 'Shaders'
- object shadername1: TMenuItem
- Tag = 4
- Caption = 'shadername'
- Hint = 'shadername (filename: string) Loads the requested shader.'
- OnClick = InsertCommand
- end
- object shaderlightazimuthelevation1: TMenuItem
- Tag = 22
- Caption = 'shaderlightazimuthelevation'
- Hint = 'shaderlightazimuthelevation (azi, elev: integer) Changes location of light source.'
- OnClick = InsertCommand
- end
- object shaderadjust1: TMenuItem
- Tag = 1413
- Caption = 'shaderadjust'
- Hint = 'shaderadjust (property: string; value: float) Sets one of the user-adjustable properties.'
- OnClick = InsertCommand
- end
- object shaderquality1to101: TMenuItem
- Tag = 7
- Caption = 'shaderquality1to10'
- Hint = 'shaderquality1to10 (value: integer) Renderings can be quick or slow but precise, corresponding to values 1-10.'
- OnClick = InsertCommand
- end
- object shaderupdategradients1: TMenuItem
- Caption = 'shaderupdategradients'
- Hint = 'shaderupdategradients () This command re-calculates the gradients for surface direction and magnitude.'
- OnClick = InsertCommand
- end
- end
- object Sliceviews1: TMenuItem
- Caption = '2D'
- object orthoview1: TMenuItem
- Tag = 33
- Caption = 'orthoview'
- Hint = 'orthoview (x, y, z: float) Shows a 2D projection view of the brain.'
- OnClick = InsertCommand
- end
- object orthoviewmm1: TMenuItem
- Tag = 33
- Caption = 'orthoviewmm'
- Hint = 'orthoviewmm (x, y, z: float) Shows a 2D projection view of the brain. Crosshair at X,Y,Z coordinates specified in millimeters.'
- OnClick = InsertCommand
- end
- object mosaic1: TMenuItem
- Tag = 5
- Caption = 'mosaic'
- Hint = 'mosaic (str: string) Shows a series of 2D slices.'
- OnClick = InsertCommand
- end
- object slicetext1: TMenuItem
- Tag = 1
- Caption = 'slicetext'
- Hint = 'slicetext (visible: boolean) If true, the 2D slices will be displayed with text.'
- OnClick = InsertCommand
- end
- object xbarthick1: TMenuItem
- Tag = 2
- Caption = 'linewidth'
- Hint = 'linewidth (pixels: integer) Adjusts thickness of crosshairs shown on 2D slices. Set to zero to hide crosshairs.'
- OnClick = InsertCommand
- end
- object xbarcolor1: TMenuItem
- Tag = 36
- Caption = 'linecolor'
- Hint = 'linecolor (r, g, b: integer) Changes the color for the crosshairs shown on 2D slices. For example linecolor(255, 0, 0) will show red crosshairs.'
- OnClick = InsertCommand
- end
- object radiological1: TMenuItem
- Tag = 1
- Caption = 'radiological'
- Hint = 'radiological (visible: boolean) If true, the 2D slices displayed in radiological convention (left on right: camera inferior/anterior to object) otherwise neurological (superior/posterior)'
- OnClick = InsertCommand
- end
- end
- object Render1: TMenuItem
- Caption = '3D'
- object azimuth1: TMenuItem
- Tag = 2
- Caption = 'azimuth'
- Hint = 'azimuth (degree: integer) This command rotates the rendering.'
- OnClick = InsertCommand
- end
- object azimuthelevation1: TMenuItem
- Tag = 22
- Caption = 'azimuthelevation'
- Hint = 'azimuthelevation (azi, elev: integer) Sets the viewer location.'
- OnClick = InsertCommand
- end
- object cameradistance1: TMenuItem
- Tag = 3
- Caption = 'cameradistance'
- Hint = 'cameradistance (z: float) Sets the viewing distance from the object.'
- OnClick = InsertCommand
- end
- object clip1: TMenuItem
- Tag = 3
- Caption = 'clip'
- Hint = 'clip (depth: float) Creates a clip plane that hides information close to the viewer.'
- OnClick = InsertCommand
- end
- object clipazimuthelevation1: TMenuItem
- Tag = 33
- Caption = 'clipazimuthelevation'
- Hint = 'clipazimuthelevation (depth, azi, elev: float) Set a view-point independent clip plane.'
- OnClick = InsertCommand
- end
- object cutout1: TMenuItem
- Tag = 63
- Caption = 'cutout'
- Hint = 'cutout (l, a, s, r, p, i: float) Selects a sector to remove from rendering view.'
- OnClick = InsertCommand
- end
- object edgeenhance1: TMenuItem
- Tag = 26
- Caption = 'edgeenhance'
- Hint = 'edgeenhance (bias, gain: integer) Attempts to emphasize tissue boundaries in 3D renderings by making regions with consistent brightness transparent.'
- Visible = False
- OnClick = InsertCommand
- end
- object elevation1: TMenuItem
- Tag = 2
- Caption = 'elevation'
- Hint = 'elevation (deg: integer) changes the render camera up or down.'
- OnClick = InsertCommand
- end
- object extract1: TMenuItem
- Tag = 2211
- Caption = 'extract'
- Hint = 'extract (levels, dilatevox: integer; oneobject: boolean) Attempts to remove noise speckles from dark regions (air) around object. Levels=1..5 (larger for larger surviving image), Dilate=0..12 (larger for larger surround). You can also specify if there is a single object or multiple objects '
- OnClick = InsertCommand
- end
- object framevisible1: TMenuItem
- Tag = 1
- Caption = 'framevisible'
- Hint = 'framevisible (visible: boolean) Shows or hides the cube that appears around the rendered object.'
- Visible = False
- OnClick = InsertCommand
- end
- object maximumintensity1: TMenuItem
- Tag = 1
- Caption = 'maximumintensity'
- Hint = 'maximumintensity (mip_on: boolean) Changes the rendering mode between standard and Maximum Intensity Projection.'
- OnClick = InsertCommand
- end
- object perspective1: TMenuItem
- Tag = 1
- Caption = 'perspective'
- Hint = 'perspective (on: boolean) Turns on or off perspective rendering.'
- OnClick = InsertCommand
- end
- object viewaxial1: TMenuItem
- Tag = 1
- Caption = 'viewaxial'
- Hint = 'viewaxial (std: boolean) creates rendering from an axial viewpoint.'
- OnClick = InsertCommand
- end
- object viewcoronal1: TMenuItem
- Tag = 1
- Caption = 'viewcoronal'
- Hint = 'viewcoronal (std: boolean) creates rendering from a coronal viewpoint.'
- OnClick = InsertCommand
- end
- object viewsagittal1: TMenuItem
- Tag = 1
- Caption = 'viewsagittal'
- Hint = 'viewsagittal (std: boolean) creates rendering from an sagittal viewpoint.'
- OnClick = InsertCommand
- end
- end
- object Advanced1: TMenuItem
- Caption = 'Advanced'
- object bmpzoom1: TMenuItem
- Tag = 2
- Caption = 'bmpzoom'
- Hint = 'bmpzoom (z: integer) copy and save bitmaps at higher resolution than screen. bmpzoom(2) will save images at twice the resolution.'
- OnClick = InsertCommand
- end
- object exists1: TMenuItem
- Tag = 4
- Caption = 'exists'
- Hint = 'exists (filename): boolean Returns true if file exists.'
- OnClick = InsertCommand
- end
- object fontname1: TMenuItem
- Tag = 4
- Caption = 'fontname'
- Hint = 'fontname (filename) Changes font used for colorbar. For example, "fontname(''ubuntu'')" will use the Ubuntu font.'
- OnClick = InsertCommand
- end
- object loaddrawing1: TMenuItem
- Tag = 4
- Caption = 'loaddrawing'
- Hint = 'loaddrawing (filename) Load an image for editing with the drawing tools'
- OnClick = InsertCommand
- end
- object loaddti1: TMenuItem
- Tag = 4
- Caption = 'loaddti'
- Hint = 'loaddti (filename: string) If you provide a name of a FSL-format FA image, the corresponding V1 will be loaded'
- OnClick = InsertCommand
- end
- object loadimagevol1: TMenuItem
- Tag = 1412
- Caption = 'loadimagevol'
- Hint = 'loadimagevol (filename: string; vol: integer) Use to load a specific volume in a 4D dataset, for example loadimagevol(''fmri.nii'',4) will load the 4th volume of an fMRI dataset.'
- OnClick = InsertCommand
- end
- object quit1: TMenuItem
- Caption = 'quit'
- Hint = 'quit () Terminates the program. Use with caution. This allows external programs to launch this software and quit once they are done.'
- OnClick = InsertCommand
- end
- object savebmp1: TMenuItem
- Tag = 4
- Caption = 'savebmp'
- Hint = 'savebmp (filename: string) Saves the currently viewed image as a PNG format compressed bitmap image.'
- OnClick = InsertCommand
- end
- object savebmpxy1: TMenuItem
- Tag = 1422
- Caption = 'savebmpxy'
- Hint = 'savebmpxy (filename: string; x, y: integer) Saves the currently viewed image as a PNG bitmap image. Specify the image width (x) and height (y). Does not work for mosaic images (where resolution defined by volume dimensions).'
- OnClick = InsertCommand
- end
- object savenii1: TMenuItem
- Tag = 141213
- Caption = 'savenii'
- Hint = 'savenii (filename: string; filter: integer; scale: float) Save currently open background image as NIfTI format image. Filename: name of output (e.g. ''myfile.nii''). Filter: -1=auto, 0=Nearest, 1=Linear, 2=Hermite, 3=Bell, 4=Spline, 5=Lanczos, 6=Mitchell. Example: savenii(''my.nii'',1,0.5) will create image half-scale image using linear filter. If filter is -1, then Lanczos is used for downsampling and Mitchell is used for up sampling. If scale is negative, an isotropic image is generated.'
- OnClick = InsertCommand
- end
- object sharpen1: TMenuItem
- Caption = 'sharpen'
- Hint = 'sharpen () Emphasize edges in image'
- OnClick = InsertCommand
- end
- object version1: TMenuItem
- Caption = 'version'
- Hint = 'version () : string Returns the software version.'
- OnClick = InsertCommand
- end
- end
- object loadimage1: TMenuItem
- Tag = 4
- Caption = 'loadimage'
- Hint = 'loadimage (filename: string) Opens a NIfTI format image to view.'
- OnClick = InsertCommand
- end
- object wait1: TMenuItem
- Tag = 2
- Caption = 'wait'
- Hint = 'wait (msec: integer) The program pauses for the specified duration. For example wait(1000) delays the script for one second.'
- OnClick = InsertCommand
- end
- object backcolor1: TMenuItem
- Tag = 36
- Caption = 'backcolor'
- Hint = 'backcolor (r, g, b: integer) Changes the background color, for example backcolor(255, 0, 0) will set a bright red background'
- OnClick = InsertCommand
- end
- object resetdefaults1: TMenuItem
- Caption = 'resetdefaults'
- Hint = 'resetdefaults () Sets all of the user adjustable settings to their default values.'
- OnClick = InsertCommand
- end
- end
- object Toosl1: TMenuItem
- Caption = '&Script'
- object Compile1: TMenuItem
- Caption = 'Run'
- ShortCut = 16466
- OnClick = Compile1Click
- end
- object N2: TMenuItem
- Caption = '-'
- end
- object Stop1: TMenuItem
- Caption = 'Halt'
- ShortCut = 16456
- OnClick = Stop1Click
- end
- end
- end
- object OpenDialog1: TOpenDialog
- DefaultExt = '.gls'
- FileName = '*.gls'
- Filter = 'scripts (*.gls)|*.gls'
- Options = [ofHideReadOnly, ofNoChangeDir, ofPathMustExist, ofFileMustExist, ofDontAddToRecent]
- left = 80
- top = 208
- end
- object SaveDialog1: TSaveDialog
- DefaultExt = '.gls'
- FileName = '*.gls'
- Filter = 'scripts (*.gls)|*.gls'
- Options = [ofHideReadOnly, ofPathMustExist]
- left = 80
- top = 288
- end
- object PSScript1: TPSScript
- CompilerOptions = []
- OnCompile = PSScript1Compile
- Plugins = <>
- UsePreProcessor = False
- left = 78
- top = 128
- end
-end
diff --git a/backup/scriptengine.pas b/backup/scriptengine.pas
deleted file mode 100755
index 3e9b9e7..0000000
--- a/backup/scriptengine.pas
+++ /dev/null
@@ -1,1912 +0,0 @@
-unit scriptengine;
-{$include opts.inc}
-{$H+}
-{$D-,O+,Q-,R-,S-}
-interface
-{$IFDEF FPC} {$mode delphi}{$H+} {$ENDIF}
-uses
-{$IFDEF FPC}LResources,
-{$ELSE}
- Windows,
-{$ENDIF}
-{$IFDEF Windows} uscaledpi, {$ENDIF}
-{$IFDEF LCLCocoa} nsappkitext,{$ENDIF}
-{$IFDEF MYPY}PythonEngine, {$ENDIF}
-{$IFDEF Unix} LCLIntf, {$ENDIF} //Messages,
- //{$IFNDEF USETRANSFERTEXTURE} scaleimageintensity,{$ENDIF}
-ClipBrd, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- ExtCtrls, StdCtrls, define_types, Menus, strutils,
- uPSComponent,commandsu;
-
-(*OVERLAYLOADCLUSTER (lFilename: string; lThreshold, lClusterMM3: single; lSaveToDisk: boolean): integer; Will add the overlay named filename, only display voxels with intensity greater than threshold with a cluster volume greater than clusterMM and return the number of the overlay.
-
-142211*)
-
-type
-
- { TScriptForm }
- TScriptForm = class(TForm)
- colorbarsize1: TMenuItem;
- ListCommands1: TMenuItem;
- exists1: TMenuItem;
- fontname1: TMenuItem;
- Advanced1: TMenuItem;
- loaddti1: TMenuItem;
- loaddrawing1: TMenuItem;
- loadimagevol1: TMenuItem;
- savebmpxy1: TMenuItem;
- showcolortable1: TMenuItem;
- savenii1: TMenuItem;
- overlaylayertransparencyonoverlay1: TMenuItem;
- overlaylayertransparencyonbackground1: TMenuItem;
- version1: TMenuItem;
- sharpen1: TMenuItem;
- quit1: TMenuItem;
- overlayloadvol1: TMenuItem;
- overlayhidezeros1: TMenuItem;
- bmpzoom1: TMenuItem;
- NewPython1: TMenuItem;
- orthoviewmm1: TMenuItem;
- radiological1: TMenuItem;
- MRU10: TMenuItem;
- MRU9: TMenuItem;
- MRU8: TMenuItem;
- MRU7: TMenuItem;
- MRU6: TMenuItem;
- MRU5: TMenuItem;
- MRU4: TMenuItem;
- MRU3: TMenuItem;
- MRU2: TMenuItem;
- MRU1: TMenuItem;
- Splitter1: TSplitter;
- Memo1: TMemo;
- Memo2: TMemo;
- ScriptMenu1: TMainMenu;
- File1: TMenuItem;
- New1: TMenuItem;
- Open1: TMenuItem;
- Save1: TMenuItem;
- SaveAs1: TMenuItem;
- Exit1: TMenuItem;
- N1: TMenuItem;
- Edit1: TMenuItem;
- Cut1: TMenuItem;
- Copy1: TMenuItem;
- Paste1: TMenuItem;
- Insert1: TMenuItem;
- Forms1: TMenuItem;
- clipformvisible1: TMenuItem;
- colorbarformvisible1: TMenuItem;
- contrastformvisible1: TMenuItem;
- cutoutformvisible1: TMenuItem;
- edgeenhanceformvisible1: TMenuItem;
- mosaicformvisible1: TMenuItem;
- overlayformvisible1: TMenuItem;
- scriptformvisible1: TMenuItem;
- toolformvisible1: TMenuItem;
- Colorbar1: TMenuItem;
- colorbarvisible1: TMenuItem;
- colorbarcoord1: TMenuItem;
- colorbartext1: TMenuItem;
- Contrast1: TMenuItem;
- setcolortable1: TMenuItem;
- changenode1: TMenuItem;
- addnode1: TMenuItem;
- contrastminmax1: TMenuItem;
- colorname1: TMenuItem;
- edgedetect1: TMenuItem;
- Dialogs1: TMenuItem;
- modalmessage1: TMenuItem;
- modelessmessage1: TMenuItem;
- Overlays1: TMenuItem;
- overlayload1: TMenuItem;
- overlaycloseall1: TMenuItem;
- overlaycolornumber1: TMenuItem;
- overlaycolorname1: TMenuItem;
- overlayminmax1: TMenuItem;
- overlaytransparencyonbackground1: TMenuItem;
- overlaytransparencyonoverlay1: TMenuItem;
- overlaycolorfromzero1: TMenuItem;
- overlayloadsmooth1: TMenuItem;
- overlaymaskedbybackground1: TMenuItem;
- overlayvisible1: TMenuItem;
- Shaders1: TMenuItem;
- shadername1: TMenuItem;
- shaderlightazimuthelevation1: TMenuItem;
- shaderadjust1: TMenuItem;
- shaderquality1to101: TMenuItem;
- shaderupdategradients1: TMenuItem;
- Sliceviews1: TMenuItem;
- orthoview1: TMenuItem;
- mosaic1: TMenuItem;
- slicetext1: TMenuItem;
- Render1: TMenuItem;
- azimuth1: TMenuItem;
- cameradistance1: TMenuItem;
- clip1: TMenuItem;
- clipazimuthelevation1: TMenuItem;
- cutout1: TMenuItem;
- edgeenhance1: TMenuItem;
- elevation1: TMenuItem;
- framevisible1: TMenuItem;
- maximumintensity1: TMenuItem;
- perspective1: TMenuItem;
- viewaxial1: TMenuItem;
- viewcoronal1: TMenuItem;
- viewsagittal1: TMenuItem;
- loadimage1: TMenuItem;
- savebmp1: TMenuItem;
- wait1: TMenuItem;
- backcolor1: TMenuItem;
- resetdefaults1: TMenuItem;
- Toosl1: TMenuItem;
- Compile1: TMenuItem;
- N2: TMenuItem;
- Stop1: TMenuItem;
- OpenDialog1: TOpenDialog;
- SaveDialog1: TSaveDialog;
- PSScript1: TPSScript;
- extract1: TMenuItem;
- azimuthelevation1: TMenuItem;
- linecolor1: TMenuItem;
- linewidth1: TMenuItem;
- overlayloadcluster1: TMenuItem;
- xbarcolor1: TMenuItem;
- xbarthick1: TMenuItem;
- //radiological1: TMenuItem;
- procedure Compile1Click(Sender: TObject);
- procedure FormActivate(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure Exit1Click(Sender: TObject);
- procedure FormDeactivate(Sender: TObject);
- procedure FormHide(Sender: TObject);
- procedure FormShow(Sender: TObject);
- procedure ListCommands1Click(Sender: TObject);
- procedure New1Click(Sender: TObject);
- procedure NewPython1Click(Sender: TObject);
- procedure Open1Click(Sender: TObject);
- procedure Save1Click(Sender: TObject);
- procedure SaveAs1Click(Sender: TObject);
- function OpenScript(lFilename: string): boolean;
- function OpenParamScript: boolean;
- function OpenStartupScript: boolean;
- procedure Memo1Change(Sender: TObject);
- procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
- procedure showcolortable1Click(Sender: TObject);
- procedure Stop1Click(Sender: TObject);
- procedure Copy1Click(Sender: TObject);
- procedure OpenSMRU(Sender: TObject);//open template or MRU
- procedure UpdateSMRU;
- procedure ToPascal(s: string);
- procedure InsertCommand(Sender: TObject);
- //procedure AdjustSelText;
- procedure PSScript1Compile(Sender: TPSScript);
- procedure Memo1KeyUp(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- procedure Memo1Click(Sender: TObject);
- procedure Cut1Click(Sender: TObject);
- procedure Paste1Click(Sender: TObject);
- procedure DemoProgram (isPython: boolean = false);
- {$IFDEF MYPY}
- function PyCreate: boolean;
- function PyIsPythonScript(): boolean;
- function PyExec(): boolean;
- procedure PyEngineAfterInit(Sender: TObject);
- procedure PyIOSendData(Sender: TObject; const Data: AnsiString);
- procedure PyIOSendUniData(Sender: TObject; const Data: UnicodeString);
- procedure PyModInitialization(Sender: TObject);
- {$ENDIF}
- private
- fn: string;
- gchanged: Boolean;
- function SaveTest: Boolean;
- public
- { Public declarations }
- end;
-const
- kScriptExt = '.gls';
- {$IFDEF MYPY}
- kScriptFilter = 'Scripting ('+kScriptExt+')|*'+kScriptExt+'|Python|*.py';
- {$ELSE}
- kScriptFilter = 'Scripting ('+kScriptExt+')|*'+kScriptExt;
- {$ENDIF}
-var
- ScriptForm: TScriptForm;
-
-implementation
-{$IFDEF FPC} {$R *.lfm} {$ENDIF}
-{$IFNDEF FPC}
-{$R *.DFM}
-{$ENDIF}
-
-{$IFNDEF MYPY}
-uses
- clut, mainunit,userdir, prefs;
-
-function ScriptDir: string;
-begin
- result := AppDir+'script';
- {$IFDEF UNIX}
- if fileexists(result) then exit;
- result := '/usr/share/mricrogl/script';
- if fileexists(result) then exit;
- result := AppDir+'script'
- {$ENDIF}
-end;
-{$ELSE}
-uses clut, mainunit,userdir, prefs, proc_py;
-
-function ScriptDir: string;
-begin
- result := AppDir+'script';
- {$IFDEF UNIX}
- if fileexists(result) then exit;
- result := AppDir+'Resources+pathdelim+'script';
- if fileexists(result) then exit;
- result := '/usr/share/mricrogl/script';
- if fileexists(result) then exit;
- result := AppDir+'script'
- {$ENDIF}
-end;
-
-var
- PythonIO : TPythonInputOutput;
- PyMod: TPythonModule;
- PyEngine: TPythonEngine = nil;
- {$IFDEF Darwin}
- const
- kBasePath = '/Library/Frameworks/Python.framework/Versions/';
- {$ENDIF}
-
-function findPythonLib(def: string): string;
-{$IFDEF WINDOWS}
-var
- fnm: string;
-begin
- result := def;
- if fileexists(def) then exit;
- result :=''; //assume failure
- fnm := ScriptDir + pathdelim + 'python35.dll';
- if not FileExists(fnm) then exit;
- if not FileExists(changefileext(fnm,'.zip')) then exit;
- result := fnm;
-end;
-{$ELSE}
-{$IFDEF Linux}
- const
- knPaths = 7;
- // /usr/lib/i386-linux-gnu/
- {$IFDEF CPU64}
- kBasePaths : array [1..knPaths] of string = ('/lib/','/lib64/','/usr/lib64/','/usr/lib/x86_64-linux-gnu/','/usr/lib/','/usr/local/lib/','/usr/lib/python2.7/config-x86_64-linux-gnu/');
- {$ELSE}
- kBasePaths : array [1..knPaths] of string = ('/lib/','/lib32/','/usr/lib32/','/usr/lib/i386-linux-gnu/','/usr/lib/','/usr/local/lib/','/usr/lib/python2.7/config-i386-linux-gnu/');
- {$ENDIF}
-
- kBaseName = 'libpython';
-
-{$ENDIF}
-{$IFDEF Darwin}
- const
- knPaths = 2;
- kBasePaths : array [1..knPaths] of string = (kBasePath, '/System'+kBasePath);
-
-{$ENDIF}
- var
- searchResult : TSearchRec;
- pth, fnm: string;
- vers : TStringList;
- n: integer;
- begin
- result := def;
- if DirectoryExists(def) then begin //in case the user supplies libdir not the library name
- result := '';
- {$IFDEF Darwin}
- if FindFirst(IncludeTrailingPathDelimiter(def)+'libpython*.dylib', faDirectory, searchResult) = 0 then
- {$ELSE}
- if FindFirst(IncludeTrailingPathDelimiter(def)+'libpython*.so', faDirectory, searchResult) = 0 then
- {$ENDIF}
- result := IncludeTrailingPathDelimiter(def)+(searchResult.Name);
- FindClose(searchResult);
- if length(result) > 0 then exit;
- end;
- if fileexists(def) then exit;
- result :=''; //assume failure
- vers := TStringList.Create;
- n := 1;
- while (n <= knPaths) and (vers.Count < 1) do begin
- pth := kBasePaths[n];
- n := n + 1;
- if not DirectoryExists(pth) then continue;
- if FindFirst(pth+'*', faDirectory, searchResult) = 0 then begin
- repeat
- //showmessage('?'+searchResult.Name);
- if (length(searchResult.Name) < 1) or (searchResult.Name[1] = '.') then continue;
- {$IFDEF LINUX}
- if (pos(kBaseName,searchResult.Name) < 1) then continue;
- {$ELSE}
- if (not (searchResult.Name[1] in ['0'..'9'])) then continue;
- {$ENDIF}
- vers.Add(searchResult.Name);
- until findnext(searchResult) <> 0;
- end;
- FindClose(searchResult);
- end;
- if vers.Count < 1 then begin
- vers.Free;
- exit;
- end;
- vers.Sort;
- fnm := vers.Strings[vers.Count-1]; //newest version? what if 3.10 vs 3.9?
- vers.Free;
- {$IFDEF Darwin}
- fnm := kBasePath+fnm+'/lib/libpython'+fnm+'.dylib';
- {$ENDIF}
- {$IFDEF LINUX}
- fnm := pth+ fnm;
- {$ENDIF}
- if fileexists(fnm) then
- result := fnm;
- end;
-{$ENDIF}
-function TScriptForm.PyCreate: boolean;
-var
- S: string;
-begin
- result := false;
- S:= findPythonLib(gPrefs.PyLib);
- if (S = '') then exit;
- if (pos('libpython2.6',S) > 0) then begin
- showmessage('Old, unsupported version of Python '+S);
- exit;
- end;
- gPrefs.PyLib := S;
- result := true;
- PythonIO := TPythonInputOutput.Create(ScriptForm);
- PyMod := TPythonModule.Create(ScriptForm);
- PyEngine := TPythonEngine.Create(ScriptForm);
- PyEngine.IO := PythonIO;
- PyEngine.PyFlags:=[pfIgnoreEnvironmentFlag];
- PyEngine.UseLastKnownVersion:=false;
- PyMod.Engine := PyEngine;
- PyMod.ModuleName := 'gl';
- PyMod.OnInitialization:=PyModInitialization;
- PythonIO.OnSendData := PyIOSendData;
- PythonIO.OnSendUniData:= PyIOSendUniData;
- PyEngine.DllPath:= ExtractFileDir(S);
- PyEngine.DllName:= ExtractFileName(S);
- PyEngine.LoadDll
-end;
-procedure TScriptForm.PyIOSendData(Sender: TObject;
- const Data: AnsiString);
-begin
- Memo2.Lines.Add(Data);
-end;
-
-procedure TScriptForm.PyIOSendUniData(Sender: TObject;
- const Data: UnicodeString);
-begin
- Memo2.Lines.Add(Data);
-end;
-
-function PyVERSION(Self, Args : PPyObject): PPyObject; cdecl;
-var
- s: string;
-begin
- s := kVers+' PyLib: '+gPrefs.PyLib;
- with GetPythonEngine do
- Result:= PyString_FromString(PChar(s));
-end;
-
-function PyRESETDEFAULTS(Self, Args : PPyObject): PPyObject; cdecl;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- RESETDEFAULTS;
-end;
-
-function BOOL(i: integer): boolean;
-begin
- result := i <> 0;
-end;
-
-function PySAVEBMP(Self, Args : PPyObject): PPyObject; cdecl;
-var
- PtrName: PChar;
- StrName: string;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 's:savebmp', @PtrName)) then
- begin
- StrName:= string(PtrName);
- SAVEBMP(StrName);
- end;
-end;
-
-function PySAVEBMPXY(Self, Args : PPyObject): PPyObject; cdecl;
-var
- PtrName: PChar;
- x,y: integer;
- StrName: string;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'sii:savebmpxy', @PtrName, @x, @y)) then
- begin
- StrName:= string(PtrName);
- SAVEBMPXY(StrName,X,Y);
- end;
-end;
-//(Ptr:@SAVENII;Decl:'SAVENII';Vars:'(lFilename: string; lFilter: integer; lScale: Single)'),
-function PySAVENII(Self, Args : PPyObject): PPyObject; cdecl;
-var
- PtrName: PChar;
- StrName: string;
- Filt: integer;
- Scale: single;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'sif:savenii', @PtrName, @Filt, @Scale)) then
- begin
- StrName:= string(PtrName);
- SAVENII(StrName, Filt, Scale);
- end;
-end;
-
-function PySAVENIIXYZ(Self, Args : PPyObject): PPyObject; cdecl;
-var
- PtrName: PChar;
- StrName: string;
- Filt: integer;
- ScaleX, ScaleY, ScaleZ: single;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'sifff:saveniixyz', @PtrName, @Filt, @ScaleX, @ScaleY, @ScaleZ)) then
- begin
- StrName:= string(PtrName);
- SAVENIIXYZ(StrName, Filt, ScaleX, ScaleY, ScaleZ);
- end;
-end;
-
-function PyBACKCOLOR(Self, Args : PPyObject): PPyObject; cdecl;
-var
- R,G,B: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'iii:backcolor', @R,@G,@B)) then
- BACKCOLOR(R,G,B);
-end;
-
-function PyEXISTS(Self, Args : PPyObject): PPyObject; cdecl;
-var
- PtrName: PChar;
- StrName: string;
-begin
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 's:exists', @PtrName)) then
- begin
- StrName:= string(PtrName);
- Result:= GetPythonEngine.PyBool_FromLong(Ord(EXISTS(StrName)));
- end;
-end;
-
-function PyAZIMUTH(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:azimuth', @A)) then
- AZIMUTH(A);
-end;
-
-function PyAZIMUTHELEVATION(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A,E: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'ii:azimuthelevation', @A, @E)) then
- AZIMUTHELEVATION(A,E);
-end;
-
-function PyBMPZOOM(Self, Args : PPyObject): PPyObject; cdecl;
-var
- Z: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:bmpzoom', @Z)) then
- BMPZOOM(Z);
-end;
-
-function PyCAMERADISTANCE(Self, Args : PPyObject): PPyObject; cdecl;
-var
- Z: single;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'f:cameradistance', @Z)) then
- CAMERADISTANCE(Z);
-end;
-
-function PyCHANGENODE(Self, Args : PPyObject): PPyObject; cdecl;
-var
- INDEX, INTENSITY, R,G,B,A: byte;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'bbbbbb:changenode', @INDEX, @INTENSITY, @R,@G,@B,@A)) then
- CHANGENODE(INDEX, INTENSITY, R,G,B,A);
-end;
-
-function PyCLIP(Self, Args : PPyObject): PPyObject; cdecl;
-var
- D: single;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'f:clip', @D)) then
- CLIP(D);
-end;
-
-function PyCLIPAZIMUTHELEVATION(Self, Args : PPyObject): PPyObject; cdecl;
-var
- D,A,E: single;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'fff:clipazimuthelevation', @D,@A,@E)) then
- CLIPAZIMUTHELEVATION(D,A,E);
-end;
-
-function PyCOLORBARPOSITION(Self, Args : PPyObject): PPyObject; cdecl;
-var
- P: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:colorbarposition', @P)) then
- COLORBARPOSITION (P);
-end;
-
-function PyCOLORBARSIZE(Self, Args : PPyObject): PPyObject; cdecl;
-var
- Sz: single;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'f:colorbarsize', @Sz)) then
- COLORBARSIZE(Sz);
-end;
-
-function PyCOLORBARVISIBLE(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:colorbarvisible', @A)) then
- COLORBARVISIBLE(BOOL(A));
-end;
-
-function PyCOLORNAME(Self, Args : PPyObject): PPyObject; cdecl;
-var
- PtrName: PChar;
- StrName: string;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(FALSE));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 's:colorname', @PtrName)) then
- begin
- StrName:= string(PtrName);
- COLORNAME(StrName);
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- end;
-end;
-
-function PyCONTRASTMINMAX(Self, Args : PPyObject): PPyObject; cdecl;
-var
- MN,MX: single;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'ff:contrastminmax', @MN,@MX)) then
- CONTRASTMINMAX(MN,MX);
-end;
-
-function PyCUTOUT(Self, Args : PPyObject): PPyObject; cdecl;
-var
- L,A,S,R,P,I: single;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'ffffff:cutout', @L,@A,@S,@R,@P,@I)) then
- CUTOUT(L,A,S,R,P,I);
-end;
-
-function PyEXTRACT(Self, Args : PPyObject): PPyObject; cdecl;
-var
- Otsu,Dil,One: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'iii:extract', @Otsu,@Dil,@One)) then
- EXTRACT(Otsu,Dil,Bool(One));
-end;
-
-function PyFONTNAME(Self, Args : PPyObject): PPyObject; cdecl;
-var
- PtrName: PChar;
- StrName: string;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(FALSE));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 's:fontname', @PtrName)) then
- begin
- StrName:= string(PtrName);
- FONTNAME(StrName);
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- end;
-end;
-
-function PyELEVATION(Self, Args : PPyObject): PPyObject; cdecl;
-var
- E: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:elevation', @E)) then
- ELEVATION(E);
-end;
-
-function PyLINECOLOR(Self, Args : PPyObject): PPyObject; cdecl;
-var
- R,G,B: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'iii:linecolor', @R,@G,@B)) then
- LINECOLOR(R,G,B);
-end;
-
-function PyLINEWIDTH(Self, Args : PPyObject): PPyObject; cdecl;
-var
- W: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:linewidth', @W)) then
- LINEWIDTH(W);
-end;
-
-function PyLOADDRAWING(Self, Args : PPyObject): PPyObject; cdecl;
-var
- PtrName: PChar;
- StrName: string;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(FALSE));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 's:loaddrawing', @PtrName)) then
- begin
- StrName:= string(PtrName);
- LOADDRAWING(StrName);
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- end;
-end;
-
-function PyLOADDTI(Self, Args : PPyObject): PPyObject; cdecl;
-var
- PtrName: PChar;
- StrName: string;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(FALSE));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 's:loaddti', @PtrName)) then
- begin
- StrName:= string(PtrName);
- LOADDTI(StrName);
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- end;
-end;
-
-function PyLOADIMAGE(Self, Args : PPyObject): PPyObject; cdecl;
-var
- PtrName: PChar;
- StrName: string;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(FALSE));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 's:loadimage', @PtrName)) then
- begin
- StrName:= string(PtrName);
- LOADIMAGE(StrName);
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- end;
-end;
-
-function PyLOADIMAGEVOL(Self, Args : PPyObject): PPyObject; cdecl;
-var
- PtrName: PChar;
- StrName: string;
- V: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(FALSE));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'si:loadimagevol', @PtrName, @V)) then
- begin
- StrName:= string(PtrName);
- LOADIMAGEVOL(StrName, V);
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- end;
-end;
-
-function PyMAXIMUMINTENSITY(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:maximumintensity', @A)) then
- MAXIMUMINTENSITY(BOOL(A));
-end;
-
-function PyMODALMESSAGE(Self, Args : PPyObject): PPyObject; cdecl;
-var
- PtrName: PChar;
- StrName: string;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(FALSE));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 's:modalmessage', @PtrName)) then
- begin
- StrName:= string(PtrName);
- MODALMESSAGE(StrName);
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- end;
-end;
-
-function PyMODELESSMESSAGE(Self, Args : PPyObject): PPyObject; cdecl;
-var
- PtrName: PChar;
- StrName: string;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(FALSE));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 's:modelessmessage', @PtrName)) then
- begin
- StrName:= string(PtrName);
- MODELESSMESSAGE(StrName);
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- end;
-end;
-
-function PyMOSAIC(Self, Args : PPyObject): PPyObject; cdecl;
-var
- PtrName: PChar;
- StrName: string;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(FALSE));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 's:mosaic', @PtrName)) then
- begin
- StrName:= string(PtrName);
- MOSAIC(StrName);
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- end;
-end;
-
-function PyORTHOVIEW(Self, Args : PPyObject): PPyObject; cdecl;
-var
- X,Y,Z: single;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'fff:orthoview', @X,@Y,@Z)) then
- ORTHOVIEW(X,Y,Z);
-end;
-
-function PyORTHOVIEWMM(Self, Args : PPyObject): PPyObject; cdecl;
-var
- X,Y,Z: single;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'fff:orthoviewmm', @X,@Y,@Z)) then
- ORTHOVIEWMM(X,Y,Z);
-end;
-
-function PyOVERLAYCLOSEALL(Self, Args : PPyObject): PPyObject; cdecl;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(TRUE));
- OVERLAYCLOSEALL;
-end;
-
-function PySHARPEN(Self, Args : PPyObject): PPyObject; cdecl;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(TRUE));
- SHARPEN;
-end;
-
-function PyQUIT(Self, Args : PPyObject): PPyObject; cdecl;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(TRUE));
- QUIT;
-end;
-
-function PySHADERUPDATEGRADIENTS(Self, Args : PPyObject): PPyObject; cdecl;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(TRUE));
- SHADERUPDATEGRADIENTS;
-end;
-
-function PyOVERLAYCOLORNAME(Self, Args : PPyObject): PPyObject; cdecl;
-var
- PtrName: PChar;
- StrName: string;
- V: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(FALSE));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'is:overlaycolorname', @V, @PtrName)) then
- begin
- StrName:= string(PtrName);
- OVERLAYCOLORNAME(V, StrName);
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- end;
-end;
-
-function PySHADERNAME(Self, Args : PPyObject): PPyObject; cdecl;
-var
- PtrName: PChar;
- StrName: string;
- V: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(FALSE));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 's:shadername', @PtrName)) then
- begin
- StrName:= string(PtrName);
- SHADERNAME(StrName);
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- end;
-end;
-
-function PySHADERADJUST(Self, Args : PPyObject): PPyObject; cdecl;
-var
- PtrName: PChar;
- StrName: string;
- f: single;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(FALSE));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'sf:shaderadjust', @PtrName, @f)) then
- begin
- StrName:= string(PtrName);
- SHADERADJUST(StrName, f);
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- end;
-end;
-
-function PyOVERLAYLOADSMOOTH(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:overlayloadsmooth', @A)) then
- OVERLAYLOADSMOOTH(BOOL(A));
-end;
-
-function PyOVERLAYCOLORFROMZERO(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:overlaycolorfromzero', @A)) then
- OVERLAYCOLORFROMZERO(BOOL(A));
-end;
-
-function PyOVERLAYHIDEZEROS(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:overlayhidezeros', @A)) then
- OVERLAYHIDEZEROS(BOOL(A));
-end;
-
-function PyOVERLAYMASKEDBYBACKGROUND(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:overlaymaskedbybackground', @A)) then
- OVERLAYMASKEDBYBACKGROUND(BOOL(A));
-end;
-
-function PyPERSPECTIVE(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:perspective', @A)) then
- PERSPECTIVE(BOOL(A));
-end;
-
-function PyRADIOLOGICAL(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:radiological', @A)) then
- RADIOLOGICAL(BOOL(A));
-end;
-
-function PyTOOLFORMVISIBLE(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:toolformvisible', @A)) then
- TOOLFORMVISIBLE(BOOL(A));
-end;
-
-function PyCONTRASTFORMVISIBLE(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:contrastformvisible', @A)) then
- CONTRASTFORMVISIBLE(BOOL(A));
-end;
-
-function PySCRIPTFORMVISIBLE(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:scriptformvisible', @A)) then
- SCRIPTFORMVISIBLE(BOOL(A));
-end;
-
-function PySLICETEXT(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:slicetext', @A)) then
- SLICETEXT(BOOL(A));
-end;
-
-function PyVIEWAXIAL(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:viewaxial', @A)) then
- VIEWAXIAL(BOOL(A));
-end;
-
-function PyVIEWCORONAL(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:viewcoronal', @A)) then
- VIEWCORONAL(BOOL(A));
-end;
-
-function PyOVERLAYTRANSPARENCYONBACKGROUND(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:overlaytransparencyonbackground', @A)) then
- OVERLAYTRANSPARENCYONBACKGROUND(A);
-end;
-
-function PyOVERLAYTRANSPARENCYONOVERLAY(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:overlaytransparencyonoverlay', @A)) then
- OVERLAYTRANSPARENCYONOVERLAY(A);
-end;
-
-function PyWAIT(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:wait', @A)) then
- WAIT(A);
-end;
-
-function PySHADERQUALITY1TO10(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:shaderquality1to10', @A)) then
- SHADERQUALITY1TO10(A);
-end;
-
-function PySETCOLORTABLE(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:setcolortable', @A)) then
- SETCOLORTABLE(A);
-end;
-
-function PyOVERLAYCOLORNUMBER(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A,B: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'ii:overlaycolornumber', @A, @B)) then
- OVERLAYCOLORNUMBER(A,B);
-end;
-
-function PySHADERLIGHTAZIMUTHELEVATION(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A,B: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'ii:shaderlightazimuthelevation', @A, @B)) then
- SHADERLIGHTAZIMUTHELEVATION(A,B);
-end;
-
-function PyOVERLAYLAYERTRANSPARENCYONOVERLAY(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A,B: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'ii:overlaylayertransparencyonoverlay', @A, @B)) then
- OVERLAYLAYERTRANSPARENCYONOVERLAY(A,B);
-end;
-
-function PyOVERLAYLAYERTRANSPARENCYONBACKGROUND(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A,B: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'ii:overlaylayertransparencyonbackground', @A, @B)) then
- OVERLAYLAYERTRANSPARENCYONBACKGROUND(A,B);
-end;
-
-function PyOVERLAYMINMAX(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A: integer;
- B,C: single;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'iff:overlayminmax', @A, @B, @C)) then
- OVERLAYMINMAX(A,B,C);
-end;
-
-function PyOVERLAYVISIBLE(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A,B: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'ii:overlayvisible', @A, @B)) then
- OVERLAYVISIBLE(A,BOOL(B));
-end;
-
-function PyADDNODE(Self, Args : PPyObject): PPyObject; cdecl;
-var
- I,R,G,B,A: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'iiiii:addnode',@I, @R,@G,@B, @A)) then
- ADDNODE(I,R,G,B,A);
-end;
-
-function PyOVERLAYLOAD(Self, Args : PPyObject): PPyObject; cdecl;
-var
- PtrName: PChar;
- StrName: string;
- Ret: integer;
-begin
- Result:= GetPythonEngine.PyInt_FromLong(-1);
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 's:overlayload', @PtrName)) then
- begin
- StrName:= string(PtrName);
- ret := OVERLAYLOAD(StrName);
- Result:= GetPythonEngine.PyInt_FromLong(ret);
- end;
-end;
-
-function PyOVERLAYLOADVOL(Self, Args : PPyObject): PPyObject; cdecl;
-var
- PtrName: PChar;
- StrName: string;
- V, Ret: integer;
-begin
- Result:= GetPythonEngine.PyInt_FromLong(-1);
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'si:overlayloadvol', @PtrName, @V)) then
- begin
- StrName:= string(PtrName);
- ret := OVERLAYLOADVOL(StrName, V);
- Result:= GetPythonEngine.PyInt_FromLong(ret);
- end;
-end;
-
-function PyOVERLAYLOADCLUSTER(Self, Args : PPyObject): PPyObject; cdecl;
-var
- PtrName: PChar;
- StrName: string;
- f1,f2: single;
- B, Ret: integer;
-begin
- Result:= GetPythonEngine.PyInt_FromLong(-1);
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'sffi:overlayloadcluster', @PtrName, @f1, @f2, @B)) then
- begin
- StrName:= string(PtrName);
- ret := OVERLAYLOADCLUSTER(StrName, f1, f2, BOOL(B));
- Result:= GetPythonEngine.PyInt_FromLong(ret);
- end;
-end;
-
-function PyVIEWSAGITTAL(Self, Args : PPyObject): PPyObject; cdecl;
-var
- A: integer;
-begin
- Result:= GetPythonEngine.PyBool_FromLong(Ord(True));
- with GetPythonEngine do
- if Bool(PyArg_ParseTuple(Args, 'i:viewsagittal', @A)) then
- VIEWSAGITTAL(BOOL(A));
-end;
-procedure TScriptForm.PyModInitialization(Sender: TObject);
-begin
- with Sender as TPythonModule do begin
- AddMethod('addnode', @PyADDNODE, '');
- AddMethod('azimuth', @PyAZIMUTH, '');
- AddMethod('azimuthelevation', @PyAZIMUTHELEVATION, '');
- AddMethod('backcolor', @PyBACKCOLOR, '');
- AddMethod('bmpzoom', @PyBMPZOOM, '');
- AddMethod('cameradistance', @PyCAMERADISTANCE, '');
- AddMethod('changenode', @PyCHANGENODE, '');
- AddMethod('clip', @PyCLIP, '');
- AddMethod('clipazimuthelevation', @PyCLIPAZIMUTHELEVATION, '');
- AddMethod('colorbarposition', @PyCOLORBARPOSITION, '');
- AddMethod('colorbarsize', @PyCOLORBARSIZE, '');
- AddMethod('colorbarvisible', @PyCOLORBARVISIBLE, '');
- AddMethod('colorname', @PyCOLORNAME, '');
- AddMethod('contrastminmax', @PyCONTRASTMINMAX, '');
- AddMethod('cutout', @PyCUTOUT, '');
- AddMethod('elevation', @PyELEVATION, '');
- AddMethod('exists', @PyEXISTS, '');
- AddMethod('extract', @PyEXTRACT, '');
- AddMethod('fontname', @PyFONTNAME, '');
- AddMethod('linecolor', @PyLINECOLOR, '');
- AddMethod('linewidth', @PyLINEWIDTH, '');
- AddMethod('loaddrawing', @PyLOADDRAWING, '');
- AddMethod('loaddti', @PyLOADDTI, '');
- AddMethod('loadimage', @PyLOADIMAGE, '');
- AddMethod('loadimagevol', @PyLOADIMAGEVOL, '');
- AddMethod('maximumintensity', @PyMAXIMUMINTENSITY, '');
- AddMethod('modalmessage', @PyMODALMESSAGE, '');
- AddMethod('modelessmessage', @PyMODELESSMESSAGE, '');
- AddMethod('mosaic', @PyMOSAIC, '');
- AddMethod('orthoview', @PyORTHOVIEW, '');
- AddMethod('orthoviewmm', @PyORTHOVIEWMM, '');
- AddMethod('overlaycloseall', @PyOVERLAYCLOSEALL, '');
- AddMethod('overlaycolorfromzero', @PyOVERLAYCOLORFROMZERO, '');
- AddMethod('overlaycolorname', @PyOVERLAYCOLORNAME, '');
- AddMethod('overlaycolornumber', @PyOVERLAYCOLORNUMBER, '');
- AddMethod('overlayhidezeros', @PyOVERLAYHIDEZEROS, '');
- AddMethod('overlaylayertransparencyonbackground', @PyOVERLAYLAYERTRANSPARENCYONBACKGROUND, '');
- AddMethod('overlaylayertransparencyonoverlay', @PyOVERLAYLAYERTRANSPARENCYONOVERLAY, '');
- AddMethod('overlayload', @PyOVERLAYLOAD, '');
- AddMethod('overlayloadcluster', @PyOVERLAYLOADCLUSTER, '');
- AddMethod('overlayloadsmooth', @PyOVERLAYLOADSMOOTH, '');
- AddMethod('overlayloadvol', @PyOVERLAYLOADVOL, '');
- AddMethod('overlaymaskedbybackground', @PyOVERLAYMASKEDBYBACKGROUND, '');
- AddMethod('overlayminmax', @PyOVERLAYMINMAX, '');
- AddMethod('overlaytransparencyonbackground', @PyOVERLAYTRANSPARENCYONBACKGROUND, '');
- AddMethod('overlaytransparencyonoverlay', @PyOVERLAYTRANSPARENCYONOVERLAY, '');
- AddMethod('overlayvisible', @PyOVERLAYVISIBLE, '');
- AddMethod('perspective', @PyPERSPECTIVE, '');
- AddMethod('quit', @PyQUIT, '');
- AddMethod('radiological', @PyRADIOLOGICAL, '');
- AddMethod('resetdefaults', @PyRESETDEFAULTS, '');
- AddMethod('savebmp', @PySAVEBMP, '');
- AddMethod('savebmp', @PySAVEBMPXY, '');
- AddMethod('savenii', @PySAVENII, '');
- AddMethod('saveniixyz', @PySAVENIIXYZ, '');
- AddMethod('scriptformvisible', @PySCRIPTFORMVISIBLE, '');
- AddMethod('contrastformvisible', @PyCONTRASTFORMVISIBLE, '');
- AddMethod('toolformvisible', @PyTOOLFORMVISIBLE, '');
- AddMethod('setcolortable', @PySETCOLORTABLE, '');
- AddMethod('shaderadjust', @PySHADERADJUST, '');
- AddMethod('shaderlightazimuthelevation', @PySHADERLIGHTAZIMUTHELEVATION, '');
- AddMethod('shadername', @PySHADERNAME, '');
- AddMethod('shaderquality1to10', @PySHADERQUALITY1TO10, '');
- AddMethod('shaderupdategradients', @PySHADERUPDATEGRADIENTS, '');
- AddMethod('sharpen', @PySHARPEN, '');
- AddMethod('slicetext', @PySLICETEXT, '');
- AddMethod('version', @PyVERSION, '');
- AddMethod('viewaxial', @PyVIEWAXIAL, '');
- AddMethod('viewcoronal', @PyVIEWCORONAL, '');
- AddMethod('viewsagittal', @PyVIEWSAGITTAL, '');
- AddMethod('wait', @PyWAIT, '');
- end;
-end;
-
-function TScriptForm.PyIsPythonScript(): boolean;
-begin
- result := ( Pos('import gl', Memo1.Text) > 0); //any python project must import gl
-end;
-
-function TScriptForm.PyExec(): boolean;
-
-begin
- result := false; //assume code is not Python
- if not (PyIsPythonScript) then exit;
- Memo2.lines.Clear;
- if PyEngine = nil then begin
- if not PyCreate then begin //do this the first time
- {$IFDEF Windows}
- Memo2.lines.Add('Unable to find Python library [place Python .dll and .zip in Script folder]');
- {$ENDIF}
- {$IFDEF Unix}
- Memo2.lines.Add('Unable to find Python library');
- {$IFDEF Darwin}
- Memo2.lines.Add(' For MacOS this is typically in: '+kBasePath+'');
- {$ELSE}
- Memo2.lines.Add(' run ''find -name "*libpython*"'' to find the library');
- Memo2.lines.Add(' if it does not exist, install it (e.g. ''apt-get install libpython2.7'')');
- {$ENDIF}
- Memo2.lines.Add(' if it does exist, set use the Preferences/Advanced to set ''PyLib''');
- {$IFDEF Darwin}
- //otool -L $(which python)
- Memo2.lines.Add(' PyLib should be the complete path and filename of libpython*.dylib');
- {$ELSE}
- Memo2.lines.Add(' PyLib should be the complete path and filename of libpython*.so');
- {$ENDIF}
- Memo2.lines.Add(' This file should be in your LIBDIR, which you can detect by running Python from the terminal:');
- Memo2.lines.Add(' ''import sysconfig; print(sysconfig.get_config_var("LIBDIR"))''');
- {$ENDIF}
- result := true;
- exit;
- end;
- end;
- result := true;
- Memo2.lines.Add('Running Python script');
- try
- PyEngine.ExecStrings(ScriptForm.Memo1.Lines);
- except
- caption := 'Python Engine Failed';
- end;
- Memo2.lines.Add('Python Succesfully Executed');
- result := true;
-end;
-
-procedure TScriptForm.PyEngineAfterInit(Sender: TObject);
-var
- dir: string;
-begin
- dir:= ExtractFilePath(Application.ExeName);
- {$ifdef windows}
- Py_SetSysPath([ScriptDir, changefileext(gPrefs.PyLib,'.zip')], false);
- {$endif}
- Py_SetSysPath([ScriptDir], true);
-end;
-{$ENDIF} //IFDEF MYPY
-
-procedure TScriptForm.DemoProgram( isPython: boolean = false);
-begin
-Memo1.lines.clear;
-if isPython then begin
- Memo1.Lines.Add('import gl');
- Memo1.Lines.Add('import sys');
- Memo1.Lines.Add('print(sys.version)');
- Memo1.Lines.Add('print(gl.version())');
- Memo1.Lines.Add('gl.resetdefaults()');
-
-
- Memo1.lines.Add('');
- Memo1.SelStart := maxint;
- exit;
-end;
-
-//Memo1.lines.Add('PROGRAM Demo;');
-Memo1.lines.Add('BEGIN');
-Memo1.lines.Add('//Insert commands here...');
-Memo1.lines.Add('');
-Memo1.lines.Add('END.');
-{$IFDEF UNIX}
-Memo1.SelStart := 32;
-{$ELSE}
-Memo1.SelStart := 34;//windows uses CR+LF line ends, UNIX uses LF
-{$ENDIF}
-end;
-
-procedure MyWriteln(const s: string);
-begin
- ScriptForm.Memo2.lines.add(S);
-end;
-
-
-
-procedure TScriptForm.OpenSMRU(Sender: TObject);//open template or MRU
-//Templates have tag set to 0, Most-Recently-Used items have tag set to position in gMRUstr
-begin
- if Sender = nil then begin
- if (gPrefs.PrevScriptName[1] <> '') and (Fileexists(gPrefs.PrevScriptName[1])) then
- OpenScript (gPrefs.PrevScriptName[1]);
- end else begin
- OpenScript (gPrefs.PrevScriptName[(Sender as TMenuItem).tag]);
- Compile1Click(Sender);
- end;
-end;
-
-procedure TScriptForm.UpdateSMRU;
-const
- kMenuItems = 7;//with OSX users quit from application menu
-var
- lPos,lN,lM : integer;
-begin
- lN := File1.Count-kMenuItems;
- if lN > knMRU then
- lN := knMRU;
- lM := kMenuItems;
- for lPos := 1 to lN do begin
- if gPrefs.PrevScriptName[lPos] <> '' then begin
- File1.Items[lM].Caption :=ExtractFileName(gPrefs.PrevScriptName[lPos]);//(ParseFileName(ExtractFileName(lFName)));
- File1.Items[lM].Tag := lPos;
- File1.Items[lM].onclick := OpenSMRU; //Lazarus
- File1.Items[lM].Visible := true;
- if lPos < 10 then
- {$IFDEF Darwin}
- File1.Items[lM].ShortCut := ShortCut(Word('1')+ord(lPos-1), [ssMeta]);
- {$ELSE}
- File1.Items[lM].ShortCut := ShortCut(Word('1')+ord(lPos-1), [ssCtrl]);
- {$ENDIF}
- end else
- File1.Items[lM].Visible := false;
- inc(lM);
- end;//for each MRU
-end; //UpdateMRU
-
-procedure TScriptForm.PSScript1Compile(Sender: TPSScript);
-var
- i: integer;
-begin
- //Sender.AddFunction( @TScriptForm.MyWriteln,'procedure Writeln(const s: string);');
- Sender.AddFunction(@MyWriteln, 'procedure Writeln(s: string);');
- for i := 1 to knFunc do
- Sender.AddFunction(kFuncRA[i].Ptr,'function '+kFuncRA[i].Decl+kFuncRA[i].Vars+';');
- for i := 1 to knProc do
- Sender.AddFunction(kProcRA[i].Ptr,'procedure '+kProcRA[i].Decl+kProcRA[i].Vars+':');
-end;
-
-procedure TScriptForm.Compile1Click(Sender: TObject);
-var
- i: integer;
- compiled: boolean;
-begin
- {$IFDEF MYPY}
- if PyExec() then exit;
- if (not (AnsiContainsText(Memo1.Text, 'begin'))) then begin
- Memo2.Lines.Clear;
- Memo2.Lines.Add('Error: script must contain "import gl" (for Python) or "begin" (for Pascal).');
- exit;
- end;
- {$ENDIF}
- Memo2.Lines.Clear;
- PSScript1.Script.Text := Memo1.Lines.Text;
- //PSScript1.Script.Text := Memo1.Lines.GetText; //<- this will leak! requires StrDispose
- Compiled := PSScript1.Compile;
- for i := 0 to PSScript1.CompilerMessageCount -1 do
- MyWriteln( PSScript1.CompilerMessages[i].MessageToString);
- if Compiled then
- MyWriteln('Successfully Compiled Script');
- if Compiled then begin
- if PSScript1.Execute then
- MyWriteln('Succesfully Executed')
- else
- MyWriteln('Error while executing script: '+
- PSScript1.ExecErrorToString);
- VideoEnd;
- end;
-end;
-
-procedure TScriptForm.FormActivate(Sender: TObject);
-begin
- GLForm1.Display1.enabled := false;
-end;
-
-procedure TScriptForm.FormCreate(Sender: TObject);
-begin
- {$IFDEF Windows} ScaleDPI(ScriptForm, 96); {$ENDIF}
- OpenDialog1.Filter := kScriptFilter;
- SaveDialog1.Filter := kScriptFilter;
- fn := '';
- gchanged := False;
- {$IFNDEF MYPY} NewPython1.Visible := false;{$ENDIF}
- DemoProgram;
- FillMRU (gPrefs.PrevScriptName, ScriptDir+pathdelim,kScriptExt,True);
- //FillMRU (gPrefs.PrevScriptName, ScriptDir+pathdelim,kScriptExt,True);
- UpdateSMRU;
- OpenSMRU(nil);
- OpenDialog1.InitialDir := ScriptDir;
- SaveDialog1.InitialDir := ScriptDir;
- {$IFDEF Darwin}
- //Copy1.enabled := false;
- Cut1.ShortCut := ShortCut(Word('X'), [ssMeta]);
- Copy1.ShortCut := ShortCut(Word('C'), [ssMeta]);
- Paste1.ShortCut := ShortCut(Word('V'), [ssMeta]);
- Stop1.ShortCut := ShortCut(Word('H'), [ssMeta]);
- Compile1.ShortCut := ShortCut(Word('R'), [ssMeta]);
- Memo1.ScrollBars:= ssVertical;
- {$ENDIF}
-end;
-
-function TScriptForm.SaveTest: Boolean;
-begin
- result := True;
-(* if changed then
- begin
- case MessageDlg('File is not saved, save now?', mtWarning, mbYesNoCancel, 0) of
- mrYes:
- begin
- Save1Click(nil);
- Result := not changed;
- end;
- mrNo: Result := True;
- else
- Result := False;
- end;
- end
- else
- Result := True;
-*)
-end;
-
-
-function TScriptForm.OpenScript(lFilename: string): boolean;
-begin
- result := false;
- GLForm1.StopTimers;
- ScriptForm.Stop1Click(nil);
- if not fileexists (lFilename) then begin
- Showmessage('Can not find '+lFilename);
- exit;
- end;
- ScriptForm.Hint := parsefilename(extractfilename(lFilename));
- ScriptForm.Caption := 'Script loaded: '+ScriptForm.Hint;
- Memo1.Lines.LoadFromFile(lFileName);
- gchanged := False;
- Memo2.Lines.Clear;
- fn := lFileName;
- (* Add2MRU(gPrefs.PrevScriptName,fn);
- UpdateSMRU;*)
- result := true;
-
-end;
-
-function EndsStr( const Needle, Haystack : string ) : Boolean;
-//http://www.delphibasics.co.uk/RTL.asp?Name=AnsiEndsStr
-var
- szN,szH: integer;
- s : string;
-begin
- result := false;
- szH := length(Haystack);
- szN := length(Needle);
- if szN > szH then exit;
- s := copy ( Haystack, szH-szN + 1, szN );
- if comparestr(Needle,s) = 0 then result := true;
-end;
-
-function isNewLine(s: string): boolean;
-var
- sz: integer;
-begin
- result := false;
- sz := length(s);
- if sz < 1 then exit;
- result := true;
- if s[sz] = ';' then exit;
- if EndsStr('var', s) then exit;
- if EndsStr('begin', s) then exit;
- result := false;
-end;
-
-procedure TScriptForm.ToPascal(s: string);
-var
- i: integer;
- l: string;
-begin
- if length(s) < 1 then exit;
- Memo1.lines.Clear;
- l := '';
- for i := 1 to length(s) do begin
- l := l + s[i];
- if isNewLine(l) then begin
- Memo1.lines.Add(l);
- l := '';
- end;
- end;
- Memo1.lines.Add(l);
-end;
-
-function TScriptForm.OpenParamScript: boolean;
-begin
- result := false;
- if gPrefs.initScript = '' then exit;
- //FillMRU (gPrefs.PrevScriptName, ScriptDir+pathdelim,kScriptExt,True);
- if FileExists(gPrefs.initScript) or (UpCaseExt(gPrefs.initScript) = uppercase(kScriptExt)) then begin
- if not FileExists(gPrefs.initScript) then
- gPrefs.initScript := ScriptDir +pathdelim+gPrefs.initScript;
- result := OpenScript(gPrefs.initScript);
- if not result then
- writeln('Unable to find '+ gPrefs.initScript);
- end else begin
- ToPascal(gPrefs.initScript);//Memo1.Lines.Add(gPrefs.initScript);
- result := true;
- end;
-
-end;
-
-function TScriptForm.OpenStartupScript: boolean;
-var
- lF: string;
-begin
- result := false;
- lF := ScriptDir +pathdelim+'startup'+kScriptExt;
- if fileexists(lF) then
- result := OpenScript(lF);
- //if result then
- // Compile1Click(nil);
-
-end;
-
-procedure TScriptForm.Open1Click(Sender: TObject);
-var
- lS: string;
-begin
- if not SaveTest then
- exit;
- lS := GetCurrentDir;
- if not OpenDialog1.Execute then
- exit;
- SetCurrentDir(lS);
- OpenScript(OpenDialog1.FileName);
-end;
-
-
-procedure TScriptForm.Save1Click(Sender: TObject);
-begin
- if fn = '' then
- Saveas1Click(nil)
- else begin
- Memo1.Lines.SaveToFile(fn);
- gchanged := False;
- Add2MRU(gPrefs.PrevScriptName,fn);
- UpdateSMRU;
- end;
-end;
-
-procedure TScriptForm.SaveAs1Click(Sender: TObject);
-begin
- SaveDialog1.FileName := '';
- if not SaveDialog1.Execute then
- exit;
- fn := SaveDialog1.FileName;
- Memo1.Lines.SaveToFile(fn);
- gchanged := False;
- Add2MRU(gPrefs.PrevScriptName,fn);
- UpdateSMRU;
-end;
-
-procedure TScriptForm.Memo1Change(Sender: TObject);
-begin
- inherited;
- gchanged := True;
-end;
-
-procedure TScriptForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
-begin
- CanClose := SaveTest;
-end;
-
-procedure TScriptForm.showcolortable1Click(Sender: TObject);
-var
- i: integer;
-begin
- Memo2.Lines.clear;
- Memo2.Lines.add('[FLT]');
- Memo2.Lines.add(format('min=%g',[gCLUTrec.min]));
- Memo2.Lines.add(format('max=%g',[gCLUTrec.max]));
- Memo2.Lines.add('[INT]');
- Memo2.Lines.add(format('numnodes=%d',[gCLUTrec.numnodes]));
- if gCLUTrec.numnodes < 1 then exit;
- Memo2.Lines.add('[BYT]');
- for i := 0 to (gCLUTrec.numnodes-1) do
- Memo2.Lines.add(format('nodeintensity%d=%d',[i, gCLUTrec.nodes[i].intensity]));
- Memo2.Lines.add('[RGBA255]');
- for i := 0 to (gCLUTrec.numnodes-1) do
- Memo2.Lines.add(format('nodergba%d=%d|%d|%d|%d',[i,gCLUTrec.nodes[i].rgba.rgbRed,gCLUTrec.nodes[i].rgba.rgbGreen
- ,gCLUTrec.nodes[i].rgba.rgbBlue,gCLUTrec.nodes[i].rgba.rgbReserved]));
-end;
-
-procedure TScriptForm.Exit1Click(Sender: TObject);
-begin
- Close;
-end;
-
-procedure TScriptForm.FormDeactivate(Sender: TObject);
-begin
- GLForm1.Display1.Enabled:= true;
-end;
-
-procedure TScriptForm.FormHide(Sender: TObject);
-begin
- {$IFDEF Darwin}Application.MainForm.SetFocus;{$ENDIF}
-end;
-
-procedure TScriptForm.FormShow(Sender: TObject);
-begin
-{$IFDEF LCLCocoa}
-setThemeMode(Self, gPrefs.DarkMode);
-//setThemeMode(Self.Handle, gPrefs.DarkMode);
- if gPrefs.DarkMode then begin
- Memo1.Color := clGray;
- Memo2.Color := clGray;
- end else begin
- Memo1.Color := Graphics.clDefault;
- Memo2.Color := Graphics.clDefault;
- end;
-{$ENDIF}
-end;
-
-procedure TScriptForm.ListCommands1Click(Sender: TObject);
-var
- i,j: integer;
- M, M2: TMenuItem;
- cmds: TStringList;
-begin
- cmds := TStringList.Create;
- for i := 0 to (Insert1.Count -1) do begin
- M := Insert1.Items[i];
- if (M.Visible) and (length(M.Hint) > 1) then
- cmds.Add(M.Hint);
- if (M.Count > 1) then begin
- for j := 0 to (M.Count -1) do begin
- M2 := M.Items[j];
- if (M2.Visible) and (length(M2.Hint) > 1) then
- cmds.Add(M2.Hint);
- end;
- end;
- end;
- Memo2.Lines.Clear;
- cmds.Sort;
- Memo2.Lines.AddStrings(cmds);
- cmds.Free;
-end;
-
-procedure TScriptForm.Stop1Click(Sender: TObject);
-begin
- if PSScript1.Running then
- PSScript1.Stop;
-end;
-
-procedure TScriptForm.New1Click(Sender: TObject);
-begin
- GLForm1.StopTimers;
- ScriptForm.Stop1Click(nil);
- if not SaveTest then
- exit;
- Memo2.Lines.Clear;
- fn := '';
- DemoProgram((Sender as TMenuItem).tag = 1 );
-end;
-
-procedure TScriptForm.NewPython1Click(Sender: TObject);
-begin
-
-end;
-
-procedure CleanStr (var lStr: string);
-//remove symbols, set lower case...
-var
- lLen,lPos: integer;
- lS: string;
-begin
- lLen := length(lStr);
- if lLen < 1 then
- exit;
- lS := '';
- for lPos := 1 to lLen do
- if lStr[lPos] in ['0'..'9','a'..'z','A'..'Z'] then
- lS := lS + AnsiLowerCase(lStr[lPos]);
- lStr := lS;
-end;
-
-
-function TypeStr (lType: integer; isPy: boolean = false): string;
-var
- lTStr,lStr : string;
- i,n,len,lLoop,lT: integer;//1=boolean,2=integer,3=float,4=string[filename]
-
-begin
- result := '';
- if (lType = 0) and (isPy) then
- result := '()';
- if lType = 0 then
- exit;
- lTStr := inttostr(lType);
- lStr := '(';
- len := length(lTStr);
- i := 1;
- while i <= len do begin
- if i = len then
- n := 1
- else begin
- n := strtoint(lTStr[i]);
- inc(i);
- end;
- lT := strtoint(lTStr[i]);
- inc(i);
- for lLoop := 1 to n do begin
- case lT of
- 1: begin
- if isPy then
- lStr := lStr +'1'
- else
- lStr := lStr +'true';
-
- end;
- 2: lStr := lStr +'1';
- 3: begin
- if lLoop <= 1 then
- lStr := lStr +'0.4'
- else if lLoop <= 3 then //for Cutout view, we need six values - make them different so this is a sensible cutout
- lStr := lStr +'0.5'
- else
- lStr := lStr +'1.0';
- end;
- 4: lStr := lStr +'''filename''';
- 5: lStr := lStr + '''0.2 0.4 0.6; 0.8 S 0.5''';
- 6: begin //byte
- if lLoop <= 3 then //for Cutout view, we need six values - make them different so this is a sensible cutout
- lStr := lStr +'1'
- else
- lStr := lStr +'255';
- end;
- 7: lStr := lStr +'5';//kludge - make integer where 1 is not a good default, e.g. shaderquality
- else lStr := lStr + '''?''';
- end;//case
- if lLoop < n then
- lStr := lStr+', ';
- end;//for each loop
- if i < len then
- lStr := lStr+', ';
- end;
- lStr := lStr + ')';
- result := lStr;
-end;
-
-procedure TScriptForm.InsertCommand(Sender: TObject);
-var
- lStr: string;
- isPy: boolean;
-begin
- {$IFDEF MYPY}
- isPy := PyIsPythonScript();
- {$ELSE}
- isPy := false;
- {$ENDIF}
- lStr := (Sender as TMenuItem).Hint;
- if lStr <> '' then begin
- Memo2.Lines.Clear;
- Memo2.Lines.Add(lStr);
- end;
- lStr := (Sender as TMenuItem).Caption;
- CleanStr(lStr);
- if isPy then
- lStr := 'gl.'+lStr+TypeStr((Sender as TMenuItem).Tag, isPy)
- else
- lStr := lStr+TypeStr((Sender as TMenuItem).Tag)+ ';';
- Clipboard.AsText := lStr;
- {$IFDEF OLD}
- {$IFDEF UNIX}
- Memo1.SelText := (lStr)+ UNIXeoln;
- {$ELSE}
- Memo1.SelText := (lStr)+ #13#10;
- {$ENDIF}
- {$ELSE}
- Memo1.Lines.Insert(Memo1.CaretPos.Y, lStr);
- {$ENDIF}
-end;
-
-
-procedure TScriptForm.Memo1Click(Sender: TObject);
-var lPos : TPoint;
-begin
- inherited;
- lPos := Memo1.CaretPos; //+1 as indexed from zero
- caption := ScriptForm.Hint +' '+inttostr(lPos.Y+1)+':'+inttostr(lPos.X+1);
-end;
-
-procedure TScriptForm.Memo1KeyUp(Sender: TObject; var Key: Word;
- Shift: TShiftState);
-begin
- Memo1Click(nil);
- inherited;
-end;
-
-procedure TScriptForm.Copy1Click(Sender: TObject);
-begin
- if length(Memo1.SelText) < 1 then
- Memo1.SelectAll;
- //Clipboard.AsText := Memo1.SelText;
- Memo1.CopyToClipboard;
-end;
-
-procedure TScriptForm.Cut1Click(Sender: TObject);
-begin
- if length(Memo1.SelText) < 1 then
- Memo1.SelectAll;
- Memo1.CutToClipboard;
-end;
-
-(*procedure TScriptForm.Paste1Click(Sender: TObject);
-begin
- Memo1.PasteFromClipboard;
-end; *)
-
-procedure TScriptForm.Paste1Click(Sender: TObject);
-var
- s: Tstringlist;
-begin
- {$IFDEF LCLCocoa}
- s := TStringList.Create;
- s.AddStrings(Clipboard.AsText);
- Memo1.Lines.addstrings(s);
- s.free;
- {$ELSE}
- Memo1.PasteFromClipboard;
- {$ENDIF}
-end;
-
-initialization
-{$IFDEF FPC}
- // {$I scriptengine.lrs}
-{$ENDIF}
-end.
diff --git a/backup/shaderui.pas b/backup/shaderui.pas
deleted file mode 100755
index b58352e..0000000
--- a/backup/shaderui.pas
+++ /dev/null
@@ -1,354 +0,0 @@
-unit shaderui;
-{$Include opts.inc}
-{$D-,O+,Q-,R-,S-} //Delphi only L- Y-
-{$IFDEF FPC}
-{$mode delphi} {$H+}
-{$ENDIF}
-interface
-{$include opts.inc}
- uses
- {$IFDEF DGL} dglOpenGL, {$ELSE DGL} {$IFDEF COREGL}define_types, glcorearb, {$ELSE} gl, {$ENDIF} {$ENDIF DGL}
- {$IFDEF FPC} FileUtil, GraphType, LCLProc, LCLIntf,LResources,OpenGLContext,{$ELSE}Windows,glpanel, {$ENDIF}
- Graphics,Classes, SysUtils, Forms, Buttons,userdir,
- Dialogs, ComCtrls, Menus, Controls,
- ExtCtrls, StdCtrls, shaderu, {$IFDEF COREGL} raycast_core, {$ELSE} raycast_legacy, {$ENDIF} raycast_common;
-
-procedure SetShader(lFilename: string);
-function ShaderPanelHeight: integer;
-function ShaderDir: string;
-procedure FormCreateShaders;
-procedure ReportUniformChange(Sender: TObject);
-procedure SetShaderAndDrop(lFilename: string);
-procedure SetShaderAdjust(lProperty: string; lVal: single);
-
-implementation
-uses mainunit;
-
-var
- sLabel: array [1..kMaxUniform] of integer; //control count for Labels
- sCheck: array [1..kMaxUniform] of integer; //control count for CheckBoxes
- sTrack: array [1..kMaxUniform] of integer; //control count for TrackBars
- gUpdateGLSL: boolean = false;
-
-function Val2Percent (min,val,max: single): integer;
-var
- S: single;
-begin
- if max = min then
- S := 0
- else if max < min then
- S := 100* ((val-max)/(min-max))
- else
- S := 100* ((val-min)/(max-min));
- if S < 0 then
- S := 0;
- if S > 100 then
- S := 100;
- result := round(S);
-end;
-
-function ShaderPanelHeight: integer;
-begin
- result := 2 + GLForm1.LightElevTrack.top+GLForm1.LightElevTrack.height;
- if (gShader.nUniform < 1) or (gShader.nUniform > kMaxUniform) or (sTrack[gShader.nUniform] = 0) then exit;
- result := 2 + (GLForm1.ShaderPanel.Controls[sTrack[gShader.nUniform]] as TTrackBar).top + (GLForm1.ShaderPanel.Controls[sTrack[gShader.nUniform]] as TTrackBar).height;
-end;
-
-procedure CreateAllControls;
- var
- i, t: integer;
- begin
- for t := 1 to kMaxUniform do begin //assume we can not find control
- sCheck[t] := 0;
- sLabel[t] := 0;
- sTrack[t] := 0;
- end;
- for i := 0 to GLForm1.ShaderPanel.ControlCount - 1 do begin
- t := GLForm1.ShaderPanel.Controls[i].tag;
- if (t < 1) or (t > kMaxUniform) then continue;
- if (GLForm1.ShaderPanel.Controls[i] is TCheckBox) then
- sCheck[t] := i;
- if (GLForm1.ShaderPanel.Controls[i] is TLabel) then
- sLabel[t] := i;
- if (GLForm1.ShaderPanel.Controls[i] is TTrackBar) then
- sTrack[t] := i;
- end;
- end;
-
-procedure ShowUniform(N: integer; U: TUniform);
-var
- aCheck: TCheckBox;
- aLabel: TLabel;
- aTrack: TTrackBar;
-begin
- if (n > kMaxUniform) or (n < 1) then
- exit;
- aCheck := (GLForm1.ShaderPanel.Controls[sCheck[n]] as TCheckBox);
- aLabel := (GLForm1.ShaderPanel.Controls[sLabel[n]] as TLabel);
- aTrack := (GLForm1.ShaderPanel.Controls[sTrack[n]] as TTrackBar);
- aLabel.Caption := U.Name;
- aLabel.Visible := true;
- if U.Widget = kBool then begin
- aCheck.Visible := true;
- aCheck.Checked := U.Bool;
- end else
- aCheck.visible := false;
- if (U.Widget = kInt) or (U.Widget = kFloat) then begin
- aTrack.Visible := true;
- aTrack.position := Val2Percent(U.Min, U.DefaultV,U.Max);
- end else
- aTrack.visible := false;
-end;
-
- procedure SetShaderAdjust(lProperty: string; lVal: single);
-var
- UpperName: string;
- i: integer;
- aCheck: TCheckBox;
- aLabel: TLabel;
- aTrack: TTrackBar;
-begin
- if gShader.nUniform < 1 then
- exit;
- UpperName := UpperCase(lProperty);
- for i := 1 to gShader.nUniform do begin
- aCheck := (GLForm1.ShaderPanel.Controls[sCheck[i]] as TCheckBox);
- aLabel := (GLForm1.ShaderPanel.Controls[sLabel[i]] as TLabel);
- aTrack := (GLForm1.ShaderPanel.Controls[sTrack[i]] as TTrackBar);
- if UpperName = upperCase(aLabel.Caption) then begin
- if aCheck.visible then
- aCheck.Checked := not (lVal = 0.0)
- else
- aTrack.position := Val2Percent(gShader.Uniform[i].Min, lVal,gShader.Uniform[i].Max);
- GLForm1.UniformChange(nil);
- end;//if property matches shader's caption
- end; //for each uniform
-end;
-
-function ShaderDir: string;
-var
- s: string;
-begin
- {$IFDEF COREGL} //OpenGL 3 Core shaders not compatible with OpenGL2
- {$IFDEF HEMISSAO}
- s := 'shader';
- {$ELSE}
- s := 'shaders33';
- {$ENDIF}
- {$ELSE}
- {$IFDEF ENABLESHADER} //MRIcroGL
- s := 'shaders';
- {$ELSE} //SurfIce
- s := 'shadersOld';
- {$ENDIF}
- {$ENDIF}
- result := AppDir + s;
- {$IFDEF UNIX}
- if fileexists(result) then exit;
- result := '/usr/share/mricrogl/'+s;
- if fileexists(result) then exit;
- result := AppDir + s;
- {$ENDIF}
-
-end;
-
-(*{$IFDEF COREGL}
-procedure UpdateTrackUniforms;
-var
- i: integer;
-begin
- for i := 1 to gShader.nUniform do begin
- if gShader.Uniform[i].Widget = kFloat then begin
- if AnsiCompareText(gShader.Uniform[i].name, 'Ambient') = 0 then gShader.TrackAmbient:= UnitBound(gShader.Uniform[i].defaultV);
- if AnsiCompareText(gShader.Uniform[i].name, 'Diffuse') = 0 then gShader.TrackDiffuse:= UnitBound(gShader.Uniform[i].defaultV);
- if AnsiCompareText(gShader.Uniform[i].name, 'Specular') = 0 then gShader.TrackSpecular:= UnitBound(gShader.Uniform[i].defaultV);
- end; //if kFloat
- end; //for i: each uniform
-end; //UpdateTrackUniforms()
-{$ENDIF} *)
-
-(*procedure SetShader(lFilename: string);
-var
- i : integer;
-begin
- LoadShader(lFilename, gShader);
- //if length(aLabel) < kMaxUniform then
- // exit;
- gUpdateGLSL := true;
- if gShader.nUniform > 0 then
- for i := 1 to gShader.nUniform do
- ShowUniform(i, gShader.Uniform[i]);
- if gShader.nUniform < kMaxUniform then begin
- for i := (gShader.nUniform+1) to kMaxUniform do begin
- (GLForm1.ShaderBox.Controls[sCheck[i]] as TCheckBox).Visible := false;
- (GLForm1.ShaderBox.Controls[sLabel[i]] as TLabel).Visible := false;
- (GLForm1.ShaderBox.Controls[sTrack[i]] as TTrackBar).Visible := false;
- end;//for all unused
- end; //not max uniforms
- //GLForm1.UniformChange(nil);
- GLForm1.ShaderBoxResize(nil);
- //deleteGradients(gTexture3D);
- M_refresh := true;
- GLForm1.updatetimer.enabled := true;
- AreaInitialized := false;
- gUpdateGLSL := false;
- GLForm1.Memo1.Lines.Clear;
- GLForm1.Memo1.Lines.Add(gShader.note);
-end;*)
-
-procedure SetShader(lFilename: string);
-var
- i : integer;
-begin
- gUpdateGLSL := true;
- LoadShader(lFilename, gShader);
- if gShader.nUniform > 0 then
- for i := 1 to gShader.nUniform do
- ShowUniform(i, gShader.Uniform[i]);
- if gShader.nUniform < kMaxUniform then begin
- for i := (gShader.nUniform+1) to kMaxUniform do begin
- (GLForm1.ShaderPanel.Controls[sCheck[i]] as TCheckBox).Visible := false;
- (GLForm1.ShaderPanel.Controls[sLabel[i]] as TLabel).Visible := false;
- (GLForm1.ShaderPanel.Controls[sTrack[i]] as TTrackBar).Visible := false;
- end;//for all unused
- end; //not max uniforms
- GLForm1.ShaderBoxResize(nil);
- GLForm1.ShaderMemo.Lines.Clear;
- GLForm1.ShaderMemo.Lines.Add(gShader.note);
- //{$IFDEF COREGL} UpdateTrackUniforms; {$ENDIF}
- {$IFDEF ENABLESHADER} //MRIcroGL
- M_refresh := true;
- GLForm1.updatetimer.enabled := true;
- AreaInitialized := false;
- {$ENDIF}
- gUpdateGLSL := false;
-end;
-
-procedure SetShaderAndDrop(lFilename: string);
-//precedence: if filename is in ShadersDrop list, set ShaderDrop, else load directly
-var
- lName,lNameExt,lItem: string;
- i: integer;
-begin
- lName := UPPERCASE(ExtractFileName(lFilename));
- lNameExt := lName +'.TXT';
- //showmessage(inttostr(ShaderDrop.Items.Count) + lFilename) ;
- if GLForm1.ShaderDrop.Items.Count > 1 then begin
- for i := 0 to (GLForm1.ShaderDrop.Items.Count-1) do begin
- //Showmessage(lName + ' <> '+ ShaderDrop.Items[i]);
- lItem := UPPERCASE (GLForm1.ShaderDrop.Items[i]);
- if (lItem = lName) or (lItem = lNameExt) then begin
- GLForm1.ShaderDrop.ItemIndex := i;
- GLForm1.ShaderDropChange(nil);
- exit;
- end;
-
- end;//for each shader
- end; //if at least one shader
- //only get here if filename not in shaderdrop - load directly from disk
- if fileexists(lFilename) then
- SetShader(lFilename);
-end;
-
-procedure UpdateShaderDrop (var LUTdrop: TComboBox);
-var
- lSearchRec: TSearchRec;
- lF: ansistring;
- lS: TStringList;
-begin
- LUTdrop.Items.Clear;
- lS := TStringList.Create;
- if FindFirst(ShaderDir+pathdelim+'*.txt', faAnyFile, lSearchRec) = 0 then
- repeat
- lF :=ExtractFileName(lSearchRec.Name);
- if (length(lF) > 1) and (lF[1] <> '.') then //OSX can create hidden files
- lS.Add(ChangeFileExt(ExtractFileName(lSearchRec.Name),'')) ;
- //lS.Add(ChangeFileExt(ExtractFileName(lSearchRec.Name,'') ;
- //lS.Add((ExtractFileName(lSearchRec.Name)))
- until (FindNext(lSearchRec) <> 0);
- FindClose(lSearchRec);
- if lS.Count < 1 then begin;
- showmessage('Error: unable to find any shaders in '+ShaderDir+pathdelim+'*.txt' );
- LUTdrop.Items.Add('No shaders found');
- Freeandnil(lS);
- exit;
- end;
- lS.sort;
- LUTdrop.Items.AddStrings(lS);
- Freeandnil(lS);
-end;//UpdateColorSchemes
-
-procedure FormCreateShaders;
-begin
- CreateAllControls;
- gShader.nUniform := 0;
- UpdateShaderDrop(GLForm1.ShaderDrop);
- GLForm1.ShaderDrop.ItemIndex := 0;
- //gShader := LoadShader(ShaderDir+pathdelim+GLForm1.ShaderDrop.Items[GLForm1.ShaderDrop.ItemIndex]);
-end;
-
-function boolstr(b: boolean): string;
-begin
- if b then
- result := 'true'
- else
- result := 'false';
-end;
-
-function Track2S(Pct,Min,Max: single): single;
-begin
- if Max > Min then
- result := Min + (Pct/100)*(Max-Min)
- else
- result := Min;
-end;
-
-function Track2I(Pct,Min,Max: single): integer;
-begin
- result := round(Track2S(Pct,Min,Max));
-end;
-
-procedure ReportUniformChange(Sender: TObject);
-var
- i: integer;
- aCheck: TCheckBox;
- aTrack: TTrackBar;
-begin
- if gUpdateGLSL then exit;
- //GLForm1.updatetimer.enabled := true;
- if gShader.nUniform > 0 then
- for i := 1 to gShader.nUniform do begin
- aCheck := (GLForm1.ShaderPanel.Controls[sCheck[i]] as TCheckBox);
- aTrack := (GLForm1.ShaderPanel.Controls[sTrack[i]] as TTrackBar);
- case gShader.Uniform[i].Widget of
- kBool: begin
- if ACheck.visible then
- gShader.Uniform[i].Bool := ACheck.checked;
- GLForm1.ShaderMemo.lines.add('Bool '+ gShader.Uniform[i].name+' '+boolstr(gShader.Uniform[i].Bool) );
- end;
- kInt:begin
- if aTrack.visible then
- gShader.Uniform[i].DefaultV := Track2I(aTrack.Position, gShader.Uniform[i].Min,gShader.Uniform[i].Max) ;
- GLForm1.ShaderMemo.lines.add('Int '+ gShader.Uniform[i].name+' '+ inttostr(round(gShader.Uniform[i].defaultV)) );
- end;
- kFloat:
- begin
- if aTrack.visible then
- gShader.Uniform[i].DefaultV := Track2S(aTrack.Position, gShader.Uniform[i].Min,gShader.Uniform[i].Max) ;
- GLForm1.ShaderMemo.lines.add('Float '+ gShader.Uniform[i].name+' '+ floattostrf(gShader.Uniform[i].defaultV,ffGeneral,4,4) );
- //GLForm1.memo1.lines.add('FloatZ '+ floattostrf(gShader.Uniform[i].Min,ffGeneral,4,4))+' '+floattostrf(gShader.Uniform[i].Max,ffGeneral,4,4)) );
- (*{$IFDEF COREGL}
- if AnsiCompareText(gShader.Uniform[i].name, 'Ambient') = 0 then gShader.TrackAmbient:= UnitBound(gShader.Uniform[i].defaultV);
- if AnsiCompareText(gShader.Uniform[i].name, 'Diffuse') = 0 then gShader.TrackDiffuse:= UnitBound(gShader.Uniform[i].defaultV);
- if AnsiCompareText(gShader.Uniform[i].name, 'Specular') = 0 then gShader.TrackSpecular:= UnitBound(gShader.Uniform[i].defaultV);
- {$ENDIF} *)
- end;
- end;//case
- end;//cor each item
- GLForm1.ShaderMemo.Lines.Add(format('Rot %d/%d Light %d/%d Q%d',[gRayCast.Azimuth,gRayCast.Elevation, gRayCast.LightAzimuth, gRayCast.LightElevation, gPrefs.RayCastQuality1to10]));
- //{$IFDEF COREGL} UpdateTrackUniforms; {$ENDIF}
-end;
-
-end.
-
-
diff --git a/backup/simplelaz.lpi b/backup/simplelaz.lpi
deleted file mode 100644
index 05a27aa..0000000
--- a/backup/simplelaz.lpi
+++ /dev/null
@@ -1,185 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/backup/simplelaz.lps b/backup/simplelaz.lps
deleted file mode 100644
index 618d8e0..0000000
--- a/backup/simplelaz.lps
+++ /dev/null
@@ -1,707 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/clut.pas b/clut.pas
index 272ebe3..53649a1 100755
--- a/clut.pas
+++ b/clut.pas
@@ -94,6 +94,8 @@ function CLUTDir: string;
begin
//result := extractfilepath(paramstr(0))+'lut';
result := AppDir+'lut';
+ if fileexists(result) then exit;
+ result := AppDir +'Resources'+pathdelim+'lut';
{$IFDEF UNIX}
if fileexists(result) then exit;
result := '/usr/share/mricrogl/lut';
diff --git a/lib/x86_64-linux/autoroi.lrs b/lib/x86_64-linux/autoroi.lrs
deleted file mode 100644
index 2912ae9..0000000
--- a/lib/x86_64-linux/autoroi.lrs
+++ /dev/null
@@ -1,34 +0,0 @@
-LazarusResources.Add('TAutoROIForm','FORMDATA',[
- 'TPF0'#12'TAutoROIForm'#11'AutoROIForm'#4'Left'#3#210#1#6'Height'#3#249#0#3'T'
- +'op'#3#137#0#5'Width'#3#252#0#18'HorzScrollBar.Page'#3#8#1#18'VertScrollBar.'
- +'Page'#3'b'#1#13'ActiveControl'#7#12'VarianceEdit'#11'BorderStyle'#7#8'bsDia'
- +'log'#7'Caption'#6#10'Create ROI'#12'ClientHeight'#3#249#0#11'ClientWidth'#3
- +#252#0#20'Constraints.MaxWidth'#3#252#0#20'Constraints.MinWidth'#3#252#0#9'F'
- +'ont.Name'#6#13'MS Sans Serif'#7'OnClose'#7#9'FormClose'#8'OnCreate'#7#10'Fo'
- +'rmCreate'#9'OnDestroy'#7#11'FormDestroy'#6'OnHide'#7#8'FormHide'#6'OnShow'#7
- +#8'FormShow'#8'Position'#7#14'poScreenCenter'#10'LCLVersion'#6#7'1.9.0.0'#0#6
- +'TLabel'#11'OriginLabel'#4'Left'#2#6#6'Height'#2#16#3'Top'#2'&'#5'Width'#2'-'
- +#7'Caption'#6#8'Origin: '#11'ParentColor'#8#0#0#6'TLabel'#9'DiffLabel'#4'Lef'
- +'t'#2#12#6'Height'#2#16#3'Top'#2'b'#5'Width'#3#134#0#7'Caption'#6#22'Differe'
- +'nce from origin'#11'ParentColor'#8#0#0#6'TLabel'#6'Label2'#4'Left'#2#12#6'H'
- +'eight'#2#16#3'Top'#3#128#0#5'Width'#2'M'#7'Caption'#6#11'Radius (mm)'#11'Pa'
- +'rentColor'#8#0#0#6'TLabel'#6'Label4'#4'Left'#2#4#6'Height'#2#16#3'Top'#2'D'
- +#5'Width'#2'F'#7'Caption'#6#11'Constraints'#11'ParentColor'#8#0#0#9'TSpinEdi'
- +'t'#12'VarianceEdit'#4'Left'#3#173#0#6'Height'#2#25#3'Top'#2'b'#5'Width'#2'H'
- +#8'MaxValue'#3#255#0#8'OnChange'#7#13'AutoROIchange'#8'TabOrder'#2#1#5'Value'
- +#2#16#0#0#9'TSpinEdit'#10'RadiusEdit'#4'Left'#3#173#0#6'Height'#2#25#3'Top'#3
- +#128#0#5'Width'#2'H'#8'MaxValue'#3#15''''#8'OnChange'#7#13'AutoROIchange'#8
- +'TabOrder'#2#2#5'Value'#2' '#0#0#9'TComboBox'#13'ROIconstraint'#4'Left'#2#12
- +#6'Height'#2#26#3'Top'#3#162#0#5'Width'#3#226#0#10'ItemHeight'#2#26#9'ItemIn'
- +'dex'#2#0#13'Items.Strings'#1#6#21'Append to current VOI'#6#23'Delete from c'
- +'urrent VOI'#6#26'Constrain with current VOI'#0#8'OnChange'#7#13'AutoROIchan'
- +'ge'#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#3#4'Text'#6#21'Append to cu'
- +'rrent VOI'#0#0#7'TButton'#9'OriginBtn'#4'Left'#2#4#6'Height'#2#25#3'Top'#2#9
- +#5'Width'#2'r'#7'Caption'#6#12'Reset origin'#7'OnClick'#7#14'OriginBtnClick'
- +#8'TabOrder'#2#0#0#0#7'TButton'#10'AutoROIBtn'#4'Left'#2#12#6'Height'#2#25#3
- +'Top'#3#208#0#5'Width'#2'r'#7'Caption'#6#5'Apply'#7'OnClick'#7#15'AutoROIBtn'
- +'Click'#8'TabOrder'#2#4#0#0#7'TButton'#9'CancelBtn'#4'Left'#2#127#6'Height'#2
- +#25#3'Top'#3#208#0#5'Width'#2'r'#7'Caption'#6#6'Cancel'#7'OnClick'#7#14'Canc'
- +'elBtnClick'#8'TabOrder'#2#5#0#0#6'TTimer'#6'Timer1'#7'Enabled'#8#8'Interval'
- +#3#144#1#7'OnTimer'#7#11'Timer1Timer'#4'left'#3#208#0#3'top'#2' '#0#0#0
-]);
diff --git a/lib/x86_64-linux/autoroi.o b/lib/x86_64-linux/autoroi.o
deleted file mode 100644
index 761e0b7..0000000
Binary files a/lib/x86_64-linux/autoroi.o and /dev/null differ
diff --git a/lib/x86_64-linux/autoroi.ppu b/lib/x86_64-linux/autoroi.ppu
deleted file mode 100644
index 6278bd7..0000000
Binary files a/lib/x86_64-linux/autoroi.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/clustering.o b/lib/x86_64-linux/clustering.o
deleted file mode 100644
index 9ca5acf..0000000
Binary files a/lib/x86_64-linux/clustering.o and /dev/null differ
diff --git a/lib/x86_64-linux/clustering.ppu b/lib/x86_64-linux/clustering.ppu
deleted file mode 100644
index 67279cb..0000000
Binary files a/lib/x86_64-linux/clustering.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/clut.o b/lib/x86_64-linux/clut.o
deleted file mode 100644
index d27e574..0000000
Binary files a/lib/x86_64-linux/clut.o and /dev/null differ
diff --git a/lib/x86_64-linux/clut.ppu b/lib/x86_64-linux/clut.ppu
deleted file mode 100644
index 6ca5e37..0000000
Binary files a/lib/x86_64-linux/clut.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/commandsu.o b/lib/x86_64-linux/commandsu.o
deleted file mode 100644
index a54faf7..0000000
Binary files a/lib/x86_64-linux/commandsu.o and /dev/null differ
diff --git a/lib/x86_64-linux/commandsu.ppu b/lib/x86_64-linux/commandsu.ppu
deleted file mode 100644
index 033906f..0000000
Binary files a/lib/x86_64-linux/commandsu.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/coordinates.o b/lib/x86_64-linux/coordinates.o
deleted file mode 100644
index 65a2945..0000000
Binary files a/lib/x86_64-linux/coordinates.o and /dev/null differ
diff --git a/lib/x86_64-linux/coordinates.ppu b/lib/x86_64-linux/coordinates.ppu
deleted file mode 100644
index 61ae304..0000000
Binary files a/lib/x86_64-linux/coordinates.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/dcm2nii.lfm b/lib/x86_64-linux/dcm2nii.lfm
deleted file mode 100644
index 574ec30..0000000
--- a/lib/x86_64-linux/dcm2nii.lfm
+++ /dev/null
@@ -1,177 +0,0 @@
-object dcm2niiForm: Tdcm2niiForm
- Left = 353
- Height = 511
- Top = 219
- Width = 925
- AllowDropFiles = True
- Caption = 'dcm2niix'
- ClientHeight = 511
- ClientWidth = 925
- Constraints.MinHeight = 120
- Constraints.MinWidth = 720
- Menu = MainMenu1
- OnClose = FormClose
- OnCreate = FormCreate
- OnDropFiles = FormDropFiles
- OnResize = FormResize
- OnShow = FormShow
- Position = poScreenCenter
- LCLVersion = '1.9.0.0'
- object Memo1: TMemo
- Left = 0
- Height = 476
- Top = 35
- Width = 925
- Align = alClient
- Lines.Strings = ( )
- ScrollBars = ssAutoVertical
- TabOrder = 0
- end
- object Panel2: TPanel
- Left = 0
- Height = 35
- Top = 0
- Width = 925
- Align = alTop
- AutoSize = True
- ClientHeight = 35
- ClientWidth = 925
- TabOrder = 1
- object CompressCheck: TCheckBox
- Left = 1
- Height = 18
- Hint = 'Create gz images (smaller but slower)'
- Top = 8
- Width = 80
- Caption = 'Compress'
- OnClick = compressCheckClick
- TabOrder = 0
- end
- object verboseCheck: TCheckBox
- AnchorSideLeft.Control = CompressCheck
- AnchorSideLeft.Side = asrBottom
- AnchorSideTop.Control = CompressCheck
- Left = 85
- Height = 18
- Hint = 'Show detailed notes during conversion'
- Top = 8
- Width = 69
- BorderSpacing.Left = 4
- Caption = 'Verbose'
- OnClick = compressCheckClick
- TabOrder = 1
- end
- object bidsCheck: TCheckBox
- AnchorSideLeft.Control = verboseCheck
- AnchorSideLeft.Side = asrBottom
- AnchorSideTop.Control = CompressCheck
- Left = 158
- Height = 18
- Hint = 'Create BIDS format JSON text files that describe details.'
- Top = 8
- Width = 50
- BorderSpacing.Left = 4
- Caption = 'BIDS'
- OnClick = compressCheckClick
- ParentBidiMode = False
- TabOrder = 2
- end
- object outnameLabel: TLabel
- AnchorSideLeft.Control = bidsCheck
- AnchorSideLeft.Side = asrBottom
- AnchorSideTop.Control = CompressCheck
- AnchorSideTop.Side = asrCenter
- Left = 220
- Height = 16
- Top = 9
- Width = 81
- BorderSpacing.Left = 12
- Caption = 'Output Name'
- ParentColor = False
- ParentShowHint = False
- ShowHint = True
- end
- object outnameEdit: TEdit
- AnchorSideLeft.Control = outnameLabel
- AnchorSideLeft.Side = asrBottom
- AnchorSideTop.Control = CompressCheck
- AnchorSideTop.Side = asrCenter
- Left = 305
- Height = 21
- Hint = 'Name for NIfTI images. Special characters are %f (Folder name) %i (ID) %n (patient Name) %p (Protocol name) %s (Series number) %t (Time)'
- Top = 7
- Width = 164
- BorderSpacing.Left = 4
- OnKeyUp = outnameEditKeyUp
- ParentShowHint = False
- ShowHint = True
- TabOrder = 3
- Text = '%p_%s'
- end
- object outputFolderLabel: TLabel
- AnchorSideLeft.Control = outnameEdit
- AnchorSideLeft.Side = asrBottom
- AnchorSideTop.Control = CompressCheck
- AnchorSideTop.Side = asrCenter
- Left = 473
- Height = 16
- Top = 9
- Width = 81
- BorderSpacing.Left = 4
- Caption = 'Output folder'
- ParentColor = False
- end
- object outputFolderName: TButton
- AnchorSideLeft.Control = outputFolderLabel
- AnchorSideLeft.Side = asrBottom
- AnchorSideTop.Control = CompressCheck
- AnchorSideTop.Side = asrCenter
- Left = 558
- Height = 25
- Hint = 'NIfTI files will be saved to this folder. Press this button and click Cancel if you want files NIfTI images saved to same folder as DICOM input'
- Top = 5
- Width = 156
- BorderSpacing.Left = 4
- BorderSpacing.Top = 4
- BorderSpacing.Bottom = 4
- Caption = 'input folder'
- Constraints.MaxHeight = 64
- OnClick = outputFolderNameClick
- ParentShowHint = False
- ShowHint = True
- TabOrder = 4
- end
- end
- object MainMenu1: TMainMenu
- left = 96
- top = 200
- object FileMenu: TMenuItem
- Caption = 'File'
- object DicomMenu: TMenuItem
- Caption = 'DICOM to NIfTI...'
- OnClick = DicomMenuClick
- end
- object ParRecMenu: TMenuItem
- Caption = 'PAR/REC to NIfTI...'
- OnClick = ParRecMenuClick
- end
- object ResetMenu: TMenuItem
- Caption = 'Reset defaults'
- OnClick = ResetMenuClick
- end
- end
- object EditMenu: TMenuItem
- Caption = 'Edit'
- object CopyMenu: TMenuItem
- Caption = 'Copy'
- OnClick = CopyMenuClick
- end
- end
- end
- object OpenDialog1: TOpenDialog
- Filter = 'Philips research (*.par)|*.PAR;*.par'
- Options = [ofAllowMultiSelect, ofEnableSizing, ofViewDetail]
- left = 168
- top = 208
- end
-end
diff --git a/lib/x86_64-linux/dcm2nii.o b/lib/x86_64-linux/dcm2nii.o
deleted file mode 100644
index a178b48..0000000
Binary files a/lib/x86_64-linux/dcm2nii.o and /dev/null differ
diff --git a/lib/x86_64-linux/dcm2nii.ppu b/lib/x86_64-linux/dcm2nii.ppu
deleted file mode 100644
index 565ae28..0000000
Binary files a/lib/x86_64-linux/dcm2nii.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/dcm_load.o b/lib/x86_64-linux/dcm_load.o
deleted file mode 100644
index 273e72f..0000000
Binary files a/lib/x86_64-linux/dcm_load.o and /dev/null differ
diff --git a/lib/x86_64-linux/dcm_load.ppu b/lib/x86_64-linux/dcm_load.ppu
deleted file mode 100644
index 5d78e82..0000000
Binary files a/lib/x86_64-linux/dcm_load.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/define_types.o b/lib/x86_64-linux/define_types.o
deleted file mode 100644
index 4995e24..0000000
Binary files a/lib/x86_64-linux/define_types.o and /dev/null differ
diff --git a/lib/x86_64-linux/define_types.ppu b/lib/x86_64-linux/define_types.ppu
deleted file mode 100644
index 9be8957..0000000
Binary files a/lib/x86_64-linux/define_types.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/drawu.o b/lib/x86_64-linux/drawu.o
deleted file mode 100644
index f2b48f2..0000000
Binary files a/lib/x86_64-linux/drawu.o and /dev/null differ
diff --git a/lib/x86_64-linux/drawu.ppu b/lib/x86_64-linux/drawu.ppu
deleted file mode 100644
index 5e1aa65..0000000
Binary files a/lib/x86_64-linux/drawu.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/extract.o b/lib/x86_64-linux/extract.o
deleted file mode 100644
index 490e302..0000000
Binary files a/lib/x86_64-linux/extract.o and /dev/null differ
diff --git a/lib/x86_64-linux/extract.ppu b/lib/x86_64-linux/extract.ppu
deleted file mode 100644
index f86696a..0000000
Binary files a/lib/x86_64-linux/extract.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/extractui.lfm b/lib/x86_64-linux/extractui.lfm
deleted file mode 100644
index dd80949..0000000
--- a/lib/x86_64-linux/extractui.lfm
+++ /dev/null
@@ -1,74 +0,0 @@
-object ExtractForm: TExtractForm
- Left = 528
- Height = 153
- Top = 168
- Width = 498
- BorderStyle = bsDialog
- Caption = 'Extract Objects (Remove Haze)'
- ClientHeight = 153
- ClientWidth = 498
- Font.Name = 'Default'
- Position = poScreenCenter
- LCLVersion = '1.4.0.4'
- object ReadIntLabel: TLabel
- Left = 120
- Height = 13
- Top = 16
- Width = 243
- Caption = 'Otsu levels: larger values for larger volumes (1..5)'
- ParentColor = False
- ParentFont = False
- end
- object OtsuLevelsEdit: TSpinEdit
- Left = 16
- Height = 21
- Top = 16
- Width = 93
- MaxValue = 5
- MinValue = 1
- ParentFont = False
- TabOrder = 1
- Value = 3
- end
- object OKBtn: TButton
- Left = 416
- Height = 25
- Top = 120
- Width = 75
- BorderSpacing.InnerBorder = 4
- Caption = 'OK'
- ModalResult = 1
- ParentFont = False
- TabOrder = 0
- end
- object ReadIntLabel1: TLabel
- Left = 120
- Height = 13
- Top = 48
- Width = 291
- Caption = 'Edge dilation voxels: larger values for larger volumes (0..12)'
- ParentColor = False
- ParentFont = False
- end
- object DilateEdit: TSpinEdit
- Left = 17
- Height = 21
- Top = 44
- Width = 93
- MaxValue = 12
- ParentFont = False
- TabOrder = 2
- Value = 2
- end
- object OneContiguousObjectCheck: TCheckBox
- Left = 17
- Height = 17
- Top = 80
- Width = 179
- Caption = 'Only extract single largest object'
- Checked = True
- ParentFont = False
- State = cbChecked
- TabOrder = 3
- end
-end
diff --git a/lib/x86_64-linux/extractui.o b/lib/x86_64-linux/extractui.o
deleted file mode 100644
index b1c7b8e..0000000
Binary files a/lib/x86_64-linux/extractui.o and /dev/null differ
diff --git a/lib/x86_64-linux/extractui.ppu b/lib/x86_64-linux/extractui.ppu
deleted file mode 100644
index b73fec1..0000000
Binary files a/lib/x86_64-linux/extractui.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/fsl_calls.o b/lib/x86_64-linux/fsl_calls.o
deleted file mode 100644
index cd542d2..0000000
Binary files a/lib/x86_64-linux/fsl_calls.o and /dev/null differ
diff --git a/lib/x86_64-linux/fsl_calls.ppu b/lib/x86_64-linux/fsl_calls.ppu
deleted file mode 100644
index 2b48913..0000000
Binary files a/lib/x86_64-linux/fsl_calls.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/glclrbar.o b/lib/x86_64-linux/glclrbar.o
deleted file mode 100644
index 349fa7f..0000000
Binary files a/lib/x86_64-linux/glclrbar.o and /dev/null differ
diff --git a/lib/x86_64-linux/glclrbar.ppu b/lib/x86_64-linux/glclrbar.ppu
deleted file mode 100644
index 7c48423..0000000
Binary files a/lib/x86_64-linux/glclrbar.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/glcube.o b/lib/x86_64-linux/glcube.o
deleted file mode 100644
index 5dbcb8b..0000000
Binary files a/lib/x86_64-linux/glcube.o and /dev/null differ
diff --git a/lib/x86_64-linux/glcube.ppu b/lib/x86_64-linux/glcube.ppu
deleted file mode 100644
index ba3d333..0000000
Binary files a/lib/x86_64-linux/glcube.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/glmtext.o b/lib/x86_64-linux/glmtext.o
deleted file mode 100644
index a2e4380..0000000
Binary files a/lib/x86_64-linux/glmtext.o and /dev/null differ
diff --git a/lib/x86_64-linux/glmtext.ppu b/lib/x86_64-linux/glmtext.ppu
deleted file mode 100644
index 871d4a6..0000000
Binary files a/lib/x86_64-linux/glmtext.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/gzio2.o b/lib/x86_64-linux/gzio2.o
deleted file mode 100644
index b0fb4c0..0000000
Binary files a/lib/x86_64-linux/gzio2.o and /dev/null differ
diff --git a/lib/x86_64-linux/gzio2.ppu b/lib/x86_64-linux/gzio2.ppu
deleted file mode 100644
index 12bb1ae..0000000
Binary files a/lib/x86_64-linux/gzio2.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/histogram.o b/lib/x86_64-linux/histogram.o
deleted file mode 100644
index b4d253b..0000000
Binary files a/lib/x86_64-linux/histogram.o and /dev/null differ
diff --git a/lib/x86_64-linux/histogram.ppu b/lib/x86_64-linux/histogram.ppu
deleted file mode 100644
index 2a72cfa..0000000
Binary files a/lib/x86_64-linux/histogram.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/histogram2d.o b/lib/x86_64-linux/histogram2d.o
deleted file mode 100644
index 2437dd4..0000000
Binary files a/lib/x86_64-linux/histogram2d.o and /dev/null differ
diff --git a/lib/x86_64-linux/histogram2d.ppu b/lib/x86_64-linux/histogram2d.ppu
deleted file mode 100644
index d7e1ef7..0000000
Binary files a/lib/x86_64-linux/histogram2d.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/lut.o b/lib/x86_64-linux/lut.o
deleted file mode 100644
index 0ccaa70..0000000
Binary files a/lib/x86_64-linux/lut.o and /dev/null differ
diff --git a/lib/x86_64-linux/lut.ppu b/lib/x86_64-linux/lut.ppu
deleted file mode 100644
index 708bdd4..0000000
Binary files a/lib/x86_64-linux/lut.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/mainunit.lfm b/lib/x86_64-linux/mainunit.lfm
deleted file mode 100644
index 9be83a8..0000000
--- a/lib/x86_64-linux/mainunit.lfm
+++ /dev/null
@@ -1,2113 +0,0 @@
-object GLForm1: TGLForm1
- Left = 1568
- Height = 1512
- Top = 215
- Width = 1936
- ActiveControl = ToolPanel
- AllowDropFiles = True
- Caption = 'MRIcroGL'
- ClientHeight = 1465
- ClientWidth = 1936
- DesignTimePPI = 192
- KeyPreview = True
- Menu = MainMenu1
- OnChangeBounds = FormChangeBounds
- OnClose = FormClose
- OnCreate = FormCreate
- OnDestroy = FormDestroy
- OnDropFiles = FormDropFiles
- OnKeyDown = FormKeyDown
- OnShow = FormShow
- Position = poScreenCenter
- LCLVersion = '2.1.0.0'
- object ToolPanel: TPanel
- Left = 0
- Height = 1465
- Top = 0
- Width = 432
- Align = alLeft
- BevelOuter = bvNone
- ClientHeight = 1465
- ClientWidth = 432
- ParentFont = False
- TabOrder = 0
- OnClick = ToolPanelClick
- object ClipBox: TGroupBox
- Left = 0
- Height = 184
- Top = 248
- Width = 432
- Align = alTop
- Caption = 'Clipping'
- ClientHeight = 144
- ClientWidth = 430
- ParentFont = False
- TabOrder = 4
- object Label4: TLabel
- Left = 6
- Height = 39
- Top = 4
- Width = 87
- Caption = 'Depth'
- ParentColor = False
- ParentFont = False
- OnClick = Label4Click
- end
- object Label5: TLabel
- Left = 6
- Height = 39
- Top = 48
- Width = 117
- Caption = 'Azimuth'
- ParentColor = False
- ParentFont = False
- OnClick = Label5Click
- end
- object Label6: TLabel
- Left = 6
- Height = 39
- Top = 92
- Width = 134
- Caption = 'Elevation'
- ParentColor = False
- ParentFont = False
- OnClick = Label6Click
- end
- object ClipTrack: TTrackBar
- Left = 172
- Height = 60
- Top = 0
- Width = 232
- Max = 1000
- OnChange = ClipTrackChange
- Position = 0
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 0
- end
- object AziTrack1: TTrackBar
- Left = 172
- Height = 60
- Top = 44
- Width = 232
- Max = 360
- OnChange = ClipTrackChange
- Position = 180
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 1
- end
- object ElevTrack1: TTrackBar
- Left = 172
- Height = 60
- Top = 90
- Width = 232
- Max = 180
- Min = -180
- OnChange = ClipTrackChange
- Position = 0
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 2
- end
- end
- object ShaderBox: TGroupBox
- Left = 0
- Height = 1
- Top = 1465
- Width = 432
- Align = alClient
- Caption = 'Shader'
- ClientHeight = 1
- ClientWidth = 430
- ParentFont = False
- TabOrder = 9
- OnResize = ShaderBoxResize
- object ShaderMemo: TMemo
- Left = 0
- Height = 33
- Top = 1
- Width = 430
- Align = alClient
- Lines.Strings = (
- 'Memo1'
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- ''
- )
- ParentFont = False
- TabOrder = 1
- TabStop = False
- end
- object ShaderPanel: TPanel
- Left = 0
- Height = 240
- Top = 0
- Width = 430
- Align = alTop
- BevelOuter = bvNone
- ClientHeight = 240
- ClientWidth = 430
- ParentFont = False
- TabOrder = 0
- object ShaderDrop: TComboBox
- Left = 4
- Height = 55
- Top = 0
- Width = 220
- DropDownCount = 24
- ItemHeight = 0
- OnChange = ShaderDropChange
- ParentFont = False
- Style = csDropDownList
- TabOrder = 0
- end
- object Label1: TLabel
- Left = 234
- Height = 39
- Hint = 'Lower quality renders faster, higher quality looks better'
- Top = 18
- Width = 22
- Caption = 'Q'
- ParentColor = False
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- end
- object QualityTrack: TTrackBar
- Left = 264
- Height = 60
- Top = 0
- Width = 132
- Min = 1
- OnChange = QualityTrackChange
- Position = 3
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 1
- end
- object Label2: TLabel
- Left = 6
- Height = 39
- Hint = 'Set the elevation and azimuth of the illumination'
- Top = 70
- Width = 72
- Caption = 'Light'
- ParentColor = False
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- end
- object LightElevTrack: TTrackBar
- Left = 92
- Height = 60
- Top = 60
- Width = 132
- Max = 90
- Min = -90
- OnChange = AziElevChange
- Position = 5
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 2
- end
- object LightAziTrack: TTrackBar
- Left = 264
- Height = 60
- Top = 60
- Width = 132
- Max = 180
- Min = -180
- OnChange = AziElevChange
- Position = 0
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 3
- end
- object S1Label: TLabel
- Tag = 1
- Left = 8
- Height = 39
- Top = 124
- Width = 30
- Caption = 'S1'
- ParentColor = False
- ParentFont = False
- ParentShowHint = False
- end
- object S2Label: TLabel
- Tag = 2
- Left = 8
- Height = 39
- Top = 184
- Width = 33
- Caption = 'S2'
- ParentColor = False
- ParentFont = False
- ParentShowHint = False
- end
- object S3Label: TLabel
- Tag = 3
- Left = 8
- Height = 39
- Top = 244
- Width = 33
- Caption = 'S3'
- ParentColor = False
- ParentFont = False
- ParentShowHint = False
- end
- object S4Label: TLabel
- Tag = 4
- Left = 8
- Height = 39
- Top = 304
- Width = 34
- Caption = 'S4'
- ParentColor = False
- ParentFont = False
- ParentShowHint = False
- end
- object S5Label: TLabel
- Tag = 5
- Left = 8
- Height = 39
- Top = 364
- Width = 33
- Caption = 'S5'
- ParentColor = False
- ParentFont = False
- ParentShowHint = False
- end
- object S6Label: TLabel
- Tag = 6
- Left = 8
- Height = 39
- Top = 424
- Width = 34
- Caption = 'S6'
- ParentColor = False
- ParentFont = False
- ParentShowHint = False
- end
- object S7Label: TLabel
- Tag = 7
- Left = 8
- Height = 39
- Top = 484
- Width = 30
- Caption = 'S7'
- ParentColor = False
- ParentFont = False
- ParentShowHint = False
- end
- object S8Label: TLabel
- Tag = 8
- Left = 8
- Height = 39
- Top = 544
- Width = 35
- Caption = 'S8'
- ParentColor = False
- ParentFont = False
- ParentShowHint = False
- end
- object S9Label: TLabel
- Tag = 9
- Left = 8
- Height = 39
- Top = 604
- Width = 33
- Caption = 'S9'
- ParentColor = False
- ParentFont = False
- ParentShowHint = False
- end
- object S10Label: TLabel
- Tag = 10
- Left = 8
- Height = 39
- Top = 664
- Width = 48
- Caption = 'S10'
- ParentColor = False
- ParentFont = False
- ParentShowHint = False
- end
- object S1Track: TTrackBar
- Tag = 1
- Left = 264
- Height = 60
- Top = 120
- Width = 132
- Max = 100
- OnChange = UniformChange
- Position = 50
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 4
- end
- object S2Track: TTrackBar
- Tag = 2
- Left = 264
- Height = 60
- Top = 180
- Width = 132
- Max = 100
- OnChange = UniformChange
- Position = 50
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 5
- end
- object S3Track: TTrackBar
- Tag = 3
- Left = 264
- Height = 60
- Top = 240
- Width = 132
- Max = 100
- OnChange = UniformChange
- Position = 50
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 6
- end
- object S4Track: TTrackBar
- Tag = 4
- Left = 264
- Height = 60
- Top = 300
- Width = 132
- Max = 100
- OnChange = UniformChange
- Position = 50
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 7
- end
- object S5Track: TTrackBar
- Tag = 5
- Left = 264
- Height = 60
- Top = 360
- Width = 132
- Max = 100
- OnChange = UniformChange
- Position = 50
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 8
- end
- object S6Track: TTrackBar
- Tag = 6
- Left = 264
- Height = 60
- Top = 420
- Width = 132
- Max = 100
- OnChange = UniformChange
- Position = 50
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 9
- end
- object S7Track: TTrackBar
- Tag = 7
- Left = 264
- Height = 60
- Top = 480
- Width = 132
- Max = 100
- OnChange = UniformChange
- Position = 50
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 10
- end
- object S8Track: TTrackBar
- Tag = 8
- Left = 264
- Height = 60
- Top = 540
- Width = 132
- Max = 100
- OnChange = UniformChange
- Position = 50
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 11
- end
- object S9Track: TTrackBar
- Tag = 9
- Left = 264
- Height = 60
- Top = 600
- Width = 132
- Max = 100
- OnChange = UniformChange
- Position = 50
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 12
- end
- object S10Track: TTrackBar
- Tag = 10
- Left = 264
- Height = 60
- Top = 660
- Width = 132
- Max = 100
- OnChange = UniformChange
- Position = 50
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 13
- end
- object S1Check: TCheckBox
- Tag = 1
- Left = 282
- Height = 23
- Hint = 'If checked, edge color varies'
- Top = 124
- Width = 23
- Checked = True
- OnChange = UniformChange
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- State = cbChecked
- TabOrder = 14
- end
- object S2Check: TCheckBox
- Tag = 2
- Left = 282
- Height = 23
- Hint = 'If checked, edge color varies'
- Top = 184
- Width = 23
- Checked = True
- OnChange = UniformChange
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- State = cbChecked
- TabOrder = 15
- end
- object S3Check: TCheckBox
- Tag = 3
- Left = 282
- Height = 23
- Hint = 'If checked, edge color varies'
- Top = 244
- Width = 23
- Checked = True
- OnChange = UniformChange
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- State = cbChecked
- TabOrder = 16
- end
- object S4Check: TCheckBox
- Tag = 4
- Left = 282
- Height = 23
- Hint = 'If checked, edge color varies'
- Top = 304
- Width = 23
- Checked = True
- OnChange = UniformChange
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- State = cbChecked
- TabOrder = 17
- end
- object S5Check: TCheckBox
- Tag = 5
- Left = 282
- Height = 23
- Hint = 'If checked, edge color varies'
- Top = 364
- Width = 23
- Checked = True
- OnChange = UniformChange
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- State = cbChecked
- TabOrder = 18
- end
- object S6Check: TCheckBox
- Tag = 6
- Left = 282
- Height = 23
- Hint = 'If checked, edge color varies'
- Top = 424
- Width = 23
- Checked = True
- OnChange = UniformChange
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- State = cbChecked
- TabOrder = 19
- end
- object S7Check: TCheckBox
- Tag = 7
- Left = 282
- Height = 23
- Hint = 'If checked, edge color varies'
- Top = 484
- Width = 23
- Checked = True
- OnChange = UniformChange
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- State = cbChecked
- TabOrder = 20
- end
- object S8Check: TCheckBox
- Tag = 8
- Left = 282
- Height = 23
- Hint = 'If checked, edge color varies'
- Top = 544
- Width = 23
- Checked = True
- OnChange = UniformChange
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- State = cbChecked
- TabOrder = 21
- end
- object S9Check: TCheckBox
- Tag = 9
- Left = 282
- Height = 23
- Hint = 'If checked, edge color varies'
- Top = 604
- Width = 23
- Checked = True
- OnChange = UniformChange
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- State = cbChecked
- TabOrder = 22
- end
- object S10Check: TCheckBox
- Tag = 10
- Left = 282
- Height = 23
- Hint = 'If checked, edge color varies'
- Top = 664
- Width = 23
- Checked = True
- OnChange = UniformChange
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- State = cbChecked
- TabOrder = 23
- end
- end
- end
- object IntensityBox: TGroupBox
- Tag = 270
- Left = 0
- Height = 100
- Top = 0
- Width = 432
- Align = alTop
- Caption = 'Intensity Range'
- ClientHeight = 60
- ClientWidth = 430
- ParentFont = False
- TabOrder = 2
- object MinEdit: TEdit
- Left = 6
- Height = 44
- Hint = 'Adjust image brightness and contrast'
- Top = 2
- Width = 180
- AutoSize = False
- OnKeyPress = MinMaxEditKeyPress
- OnKeyUp = MinMaxEditKeyUp
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- TabOrder = 0
- Text = 'MinEdit'
- end
- object MaxEdit: TEdit
- Left = 208
- Height = 44
- Top = 2
- Width = 180
- AutoSize = False
- OnExit = MinMaxEditExit
- OnKeyPress = MinMaxEditKeyPress
- OnKeyUp = MinMaxEditKeyUp
- ParentFont = False
- TabOrder = 1
- Text = 'MaxEdit'
- end
- end
- object CutoutBox: TGroupBox
- Left = 0
- Height = 184
- Top = 950
- Width = 432
- Align = alTop
- Caption = 'Cutout'
- ClientHeight = 144
- ClientWidth = 430
- ParentFont = False
- TabOrder = 5
- object Xx: TLabel
- Left = 6
- Height = 39
- Top = 6
- Width = 17
- Caption = 'X'
- ParentColor = False
- ParentFont = False
- end
- object Yy: TLabel
- Left = 6
- Height = 39
- Top = 50
- Width = 17
- Caption = 'Y'
- ParentColor = False
- ParentFont = False
- end
- object Zz: TLabel
- Left = 6
- Height = 39
- Top = 94
- Width = 17
- Caption = 'Z'
- ParentColor = False
- ParentFont = False
- end
- object XTrackBar: TTrackBar
- Left = 28
- Height = 60
- Top = 0
- Width = 132
- Max = 1000
- OnChange = CutoutChange
- Position = 1000
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 0
- end
- object X2TrackBar: TTrackBar
- Left = 168
- Height = 60
- Top = 0
- Width = 132
- Max = 1000
- OnChange = CutoutChange
- Position = 1000
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 1
- end
- object YTrackBar: TTrackBar
- Left = 28
- Height = 60
- Top = 44
- Width = 132
- Max = 1000
- OnChange = CutoutChange
- Position = 1000
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 2
- end
- object Y2TrackBar: TTrackBar
- Left = 168
- Height = 60
- Top = 44
- Width = 132
- Max = 1000
- OnChange = CutoutChange
- Position = 1000
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 3
- end
- object ZTrackBar: TTrackBar
- Left = 28
- Height = 60
- Top = 90
- Width = 132
- Max = 1000
- OnChange = CutoutChange
- Position = 1000
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 4
- end
- object Z2TrackBar: TTrackBar
- Left = 168
- Height = 60
- Top = 90
- Width = 132
- Max = 1000
- OnChange = CutoutChange
- Position = 1000
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 5
- end
- object NearBtn: TButton
- Left = 300
- Height = 44
- Top = 18
- Width = 104
- Caption = 'Near'
- OnClick = CutoutNearestSector
- ParentFont = False
- TabOrder = 6
- end
- object NoneBtn: TButton
- Left = 300
- Height = 44
- Top = 72
- Width = 104
- Caption = 'None'
- OnClick = HideBtnClick
- ParentFont = False
- TabOrder = 7
- end
- end
- object CollapseToolPanelBtn: TButton
- Left = 398
- Height = 24
- Hint = 'Click here to hide the tool panel'
- Top = 2
- Width = 24
- OnClick = CollapsedToolPanelClick
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- TabOrder = 1
- end
- object MosaicBox: TGroupBox
- Left = 0
- Height = 518
- Top = 432
- Width = 432
- Align = alTop
- Caption = 'Mosaic'
- ClientHeight = 478
- ClientWidth = 430
- ParentFont = False
- TabOrder = 6
- Visible = False
- object MosaicText: TMemo
- Left = 0
- Height = 246
- Top = 232
- Width = 430
- Align = alClient
- Lines.Strings = (
- 'MosaicText'
- )
- OnChange = MosaicTextChange
- ParentFont = False
- TabOrder = 1
- end
- object MosaicPanel: TPanel
- Left = 0
- Height = 232
- Top = 0
- Width = 430
- Align = alTop
- BevelOuter = bvNone
- ClientHeight = 232
- ClientWidth = 430
- ParentFont = False
- TabOrder = 0
- object ColOverlap: TTrackBar
- Left = 252
- Height = 60
- Top = 0
- Width = 132
- Max = 9
- Min = -9
- OnChange = UpdateMosaic
- Position = -1
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 1
- end
- object ColEdit: TSpinEdit
- Left = 128
- Height = 56
- Top = 4
- Width = 108
- MaxValue = 20
- MinValue = 1
- OnChange = UpdateMosaic
- ParentFont = False
- TabOrder = 0
- Value = 3
- end
- object Label7: TLabel
- Left = 6
- Height = 39
- Top = 4
- Width = 125
- Caption = 'Columns'
- ParentColor = False
- ParentFont = False
- end
- object Label3: TLabel
- Left = 6
- Height = 39
- Top = 52
- Width = 76
- Caption = 'Rows'
- ParentColor = False
- ParentFont = False
- end
- object RowEdit: TSpinEdit
- Left = 128
- Height = 56
- Top = 52
- Width = 108
- MaxValue = 20
- MinValue = 1
- OnChange = UpdateMosaic
- ParentFont = False
- TabOrder = 2
- Value = 2
- end
- object RowOverlap: TTrackBar
- Left = 252
- Height = 60
- Top = 52
- Width = 132
- Max = 9
- Min = -9
- OnChange = UpdateMosaic
- Position = 0
- TickStyle = tsNone
- ParentFont = False
- TabOrder = 3
- end
- object OrientDrop: TComboBox
- Left = 208
- Height = 51
- Top = 96
- Width = 186
- ItemHeight = 0
- ItemIndex = 0
- Items.Strings = (
- 'Axial'
- 'Coronal'
- 'Sagittal+'
- 'Sagittal-'
- )
- OnChange = UpdateMosaic
- ParentFont = False
- Style = csDropDownList
- TabOrder = 4
- Text = 'Axial'
- end
- object Label8: TLabel
- Left = 6
- Height = 39
- Top = 100
- Width = 165
- Caption = 'Orientation'
- ParentColor = False
- ParentFont = False
- end
- object CrossCheck: TCheckBox
- Left = 6
- Height = 43
- Top = 140
- Width = 176
- Caption = 'Cross slice'
- Checked = True
- OnChange = UpdateMosaic
- ParentFont = False
- State = cbChecked
- TabOrder = 5
- end
- object CopyScriptBtn: TButton
- Left = 12
- Height = 44
- Top = 180
- Width = 184
- Caption = 'Copy Script'
- OnClick = CopyScriptClick
- ParentFont = False
- TabOrder = 7
- end
- object RunScriptBtn: TButton
- Left = 220
- Height = 44
- Top = 180
- Width = 184
- Caption = 'Run Script'
- OnClick = RunScriptClick
- ParentFont = False
- TabOrder = 8
- Visible = False
- end
- object LabelCheck: TCheckBox
- Left = 208
- Height = 43
- Top = 140
- Width = 192
- Caption = 'Label slices'
- Checked = True
- OnChange = UpdateMosaic
- ParentFont = False
- State = cbChecked
- TabOrder = 6
- end
- end
- end
- object OverlayBox: TGroupBox
- Left = 0
- Height = 148
- Top = 100
- Width = 432
- Align = alTop
- Caption = 'Overlays'
- ClientHeight = 108
- ClientWidth = 430
- ParentFont = False
- TabOrder = 3
- Visible = False
- object StringGrid1: TStringGrid
- Left = 0
- Height = 108
- Top = 0
- Width = 430
- Align = alClient
- AutoEdit = False
- BorderStyle = bsNone
- ColCount = 4
- DefaultColWidth = 100
- DefaultRowHeight = 46
- Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goDrawFocusSelected, goEditing, goTabs, goAlwaysShowEditor, goSmoothScroll]
- ParentFont = False
- ParentShowHint = False
- RowCount = 33
- ScrollBars = ssNone
- ShowHint = True
- TabOrder = 0
- OnDrawCell = StringGrid1DrawCell
- OnEditingDone = StringGrid1Exit
- OnExit = StringGrid1Exit
- OnKeyPress = StringGrid1KeyPress
- OnMouseDown = StringGrid1MouseDown
- OnSelectCell = StringGrid1SelectCell
- end
- object LUTdrop: TComboBox
- Left = 132
- Height = 51
- Top = 60
- Width = 110
- DropDownCount = 22
- ItemHeight = 0
- Items.Strings = (
- 'a'
- 'b'
- 'c'
- 'd'
- 'e'
- 'f'
- 'g'
- )
- OnChange = LUTdropChange
- ParentFont = False
- Style = csDropDownList
- TabOrder = 1
- end
- end
- object HideRenderToolsBtn: TButton
- Left = 368
- Height = 24
- Hint = 'Click to hide/show render tools (useful for small screens)'
- Top = 2
- Width = 24
- OnClick = HideRenderToolsBtnClick
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- TabOrder = 0
- end
- object LineBox: TGroupBox
- Left = 0
- Height = 100
- Top = 1398
- Width = 432
- Align = alTop
- Caption = 'Lines'
- ClientHeight = 60
- ClientWidth = 430
- ParentFont = False
- TabOrder = 8
- object LineWidthLabel: TLabel
- Left = 6
- Height = 39
- Top = 4
- Width = 84
- Caption = 'Width'
- ParentColor = False
- ParentFont = False
- end
- object LineColorBtn: TButton
- Left = 248
- Height = 44
- Top = 4
- Width = 156
- Caption = 'Color'
- OnClick = LineColorBtnClick
- ParentFont = False
- TabOrder = 1
- end
- object LineWidthEdit: TSpinEdit
- Left = 96
- Height = 56
- Top = 4
- Width = 140
- MaxValue = 7
- OnChange = LineWidthEditChange
- ParentFont = False
- TabOrder = 0
- Value = 3
- end
- end
- object Slice2DBox: TGroupBox
- Left = 0
- Height = 264
- Top = 1134
- Width = 432
- Align = alTop
- Caption = '2D Slice Selection'
- ClientHeight = 224
- ClientWidth = 430
- ParentFont = False
- TabOrder = 7
- object LeftBtn: TButton
- Left = 8
- Height = 40
- Top = 36
- Width = 80
- Caption = 'L'
- OnClick = OrientBtnClick
- ParentFont = False
- TabOrder = 0
- end
- object SuperiorBtn: TButton
- Tag = 5
- Left = 296
- Height = 40
- Top = 4
- Width = 80
- Caption = 'S'
- OnClick = OrientBtnClick
- ParentFont = False
- TabOrder = 4
- end
- object InferiorBtn: TButton
- Tag = 4
- Left = 296
- Height = 40
- Top = 68
- Width = 80
- Caption = 'I'
- OnClick = OrientBtnClick
- ParentFont = False
- TabOrder = 5
- end
- object AnteriorBtn: TButton
- Tag = 3
- Left = 96
- Height = 40
- Top = 4
- Width = 80
- Caption = 'A'
- OnClick = OrientBtnClick
- ParentFont = False
- TabOrder = 1
- end
- object PosteriorBtn: TButton
- Tag = 2
- Left = 96
- Height = 40
- Top = 68
- Width = 80
- Caption = 'P'
- OnClick = OrientBtnClick
- ParentFont = False
- TabOrder = 2
- end
- object RightBtn: TButton
- Tag = 1
- Left = 184
- Height = 40
- Top = 32
- Width = 80
- Caption = 'R'
- OnClick = OrientBtnClick
- ParentFont = False
- TabOrder = 3
- end
- object CoordLabel: TLabel
- Left = 6
- Height = 39
- Top = 116
- Width = 261
- Caption = 'Coordinates (X,Y,Z)'
- ParentColor = False
- ParentFont = False
- end
- object XCoordEdit: TEdit
- Left = 4
- Height = 44
- Top = 160
- Width = 132
- AutoSize = False
- OnChange = CoordEditChange
- OnKeyPress = MinMaxEditKeyPress
- OnKeyUp = MinMaxEditKeyUp
- ParentFont = False
- TabOrder = 6
- Text = '0'
- end
- object YCoordEdit: TEdit
- Left = 140
- Height = 44
- Top = 160
- Width = 132
- AutoSize = False
- OnChange = CoordEditChange
- OnKeyPress = MinMaxEditKeyPress
- OnKeyUp = MinMaxEditKeyUp
- ParentFont = False
- TabOrder = 7
- Text = '0'
- end
- object ZCoordEdit: TEdit
- Left = 276
- Height = 44
- Top = 160
- Width = 132
- AutoSize = False
- OnChange = CoordEditChange
- OnKeyPress = MinMaxEditKeyPress
- OnKeyUp = MinMaxEditKeyUp
- ParentFont = False
- TabOrder = 8
- Text = '0'
- end
- end
- end
- object CollapsedToolPanel: TPanel
- Left = 432
- Height = 1465
- Top = 0
- Width = 10
- Align = alLeft
- ParentFont = False
- TabOrder = 1
- Visible = False
- OnClick = CollapsedToolPanelClick
- end
- object MainMenu1: TMainMenu
- left = 640
- top = 1072
- object AppleMenu: TMenuItem
- Caption = ''
- object AppleAbout: TMenuItem
- Caption = 'About MRIcroGL'
- OnClick = About1Click
- end
- object ApplePreferences: TMenuItem
- Caption = 'Preferences'
- OnClick = Preferences1Click
- end
- end
- object File1: TMenuItem
- Caption = 'File'
- object NewWindow1: TMenuItem
- Caption = 'New window'
- OnClick = NewWindow1Click
- end
- object Open1: TMenuItem
- Caption = 'Open'
- ShortCut = 16463
- OnClick = Open1Click
- end
- object Save1: TMenuItem
- Caption = 'Save'
- OnClick = Save1Click
- end
- object Exit1: TMenuItem
- Caption = 'Exit'
- ShortCut = 16472
- OnClick = Exit1Click
- end
- object MenuSep1: TMenuItem
- Caption = '-'
- end
- object MRU1: TMenuItem
- Caption = 'MRU1'
- end
- object MRU2: TMenuItem
- Caption = 'MRU2'
- end
- object MRU3: TMenuItem
- Caption = 'MRU3'
- end
- object MRU4: TMenuItem
- Caption = 'MRU4'
- end
- object MRU5: TMenuItem
- Caption = 'MRU5'
- end
- object MRU6: TMenuItem
- Caption = 'MRU6'
- end
- object MRU7: TMenuItem
- Caption = 'MRU7'
- end
- object MRU8: TMenuItem
- Caption = 'MRU8'
- end
- object MRU9: TMenuItem
- Caption = 'MRU9'
- end
- object MRU10: TMenuItem
- Caption = 'MRU10'
- end
- end
- object Edit1: TMenuItem
- Caption = 'Edit'
- object Copy1: TMenuItem
- Caption = 'Copy'
- ShortCut = 16451
- OnClick = Copy1Click
- end
- end
- object Overlays1: TMenuItem
- Caption = 'Overlays'
- object Addoverlay1: TMenuItem
- Caption = 'Add overlay'
- OnClick = Addoverlay1Click
- end
- object Thresholdmenu: TMenuItem
- Caption = 'Add overlay (remove small clusters)'
- OnClick = ThresholdMenuClick
- end
- object Closeoverlays1: TMenuItem
- Caption = 'Close overlays'
- OnClick = Closeoverlays1Click
- end
- object Onbackground1: TMenuItem
- Caption = 'Transparency on background'
- object N0Opaque1: TMenuItem
- AutoCheck = True
- Caption = '0% Opaque'
- GroupIndex = 123
- RadioItem = True
- OnClick = SetBackgroundAlpha
- end
- object N201: TMenuItem
- Tag = 20
- AutoCheck = True
- Caption = '20%'
- GroupIndex = 123
- RadioItem = True
- OnClick = SetBackgroundAlpha
- end
- object N401: TMenuItem
- Tag = 40
- AutoCheck = True
- Caption = '40%'
- GroupIndex = 123
- RadioItem = True
- OnClick = SetBackgroundAlpha
- end
- object N501: TMenuItem
- Tag = 50
- AutoCheck = True
- Caption = '50%'
- GroupIndex = 123
- RadioItem = True
- OnClick = SetBackgroundAlpha
- end
- object N601: TMenuItem
- Tag = 60
- AutoCheck = True
- Caption = '60%'
- GroupIndex = 123
- RadioItem = True
- OnClick = SetBackgroundAlpha
- end
- object N801: TMenuItem
- Tag = 80
- AutoCheck = True
- Caption = '80%'
- GroupIndex = 123
- RadioItem = True
- OnClick = SetBackgroundAlpha
- end
- object N100transparent1: TMenuItem
- Tag = 100
- AutoCheck = True
- Caption = '100% transparent'
- GroupIndex = 123
- RadioItem = True
- OnClick = SetBackgroundAlpha
- end
- object Additive1: TMenuItem
- Tag = -1
- AutoCheck = True
- Caption = 'Additive'
- GroupIndex = 123
- RadioItem = True
- OnClick = SetBackgroundAlpha
- end
- object ModulateMenu: TMenuItem
- Tag = -2
- AutoCheck = True
- Caption = 'Modulate'
- GroupIndex = 123
- RadioItem = True
- OnClick = SetBackgroundAlpha
- end
- end
- object Onotheroverlays1: TMenuItem
- Caption = 'Transparency on other overlays'
- object N0opaque2: TMenuItem
- AutoCheck = True
- Caption = '0% opaque'
- GroupIndex = 133
- RadioItem = True
- OnClick = SetOverlayAlpha
- end
- object N202: TMenuItem
- Tag = 20
- AutoCheck = True
- Caption = '20%'
- GroupIndex = 133
- RadioItem = True
- OnClick = SetOverlayAlpha
- end
- object N402: TMenuItem
- Tag = 40
- AutoCheck = True
- Caption = '40%'
- GroupIndex = 133
- RadioItem = True
- OnClick = SetOverlayAlpha
- end
- object N502: TMenuItem
- Tag = 50
- AutoCheck = True
- Caption = '50%'
- GroupIndex = 133
- RadioItem = True
- OnClick = SetOverlayAlpha
- end
- object N602: TMenuItem
- Tag = 60
- AutoCheck = True
- Caption = '60%'
- GroupIndex = 133
- RadioItem = True
- OnClick = SetOverlayAlpha
- end
- object N802: TMenuItem
- Tag = 80
- AutoCheck = True
- Caption = '80%'
- GroupIndex = 133
- RadioItem = True
- OnClick = SetOverlayAlpha
- end
- object N100transparent2: TMenuItem
- Tag = 100
- AutoCheck = True
- Caption = '100% transparent'
- GroupIndex = 133
- RadioItem = True
- OnClick = SetOverlayAlpha
- end
- object Additive2: TMenuItem
- Tag = -1
- AutoCheck = True
- Caption = 'Additive'
- GroupIndex = 133
- RadioItem = True
- OnClick = SetOverlayAlpha
- end
- end
- object InterpolateMenu: TMenuItem
- AutoCheck = True
- Caption = 'Smooth when loading'
- Checked = True
- OnClick = InterpolateMenuClick
- end
- object BackgroundMaskMenu: TMenuItem
- AutoCheck = True
- Caption = 'Background masks overlays'
- Checked = True
- OnClick = BackgroundMaskMenuClick
- end
- object OverlayColorFromZeroMenu: TMenuItem
- AutoCheck = True
- Caption = 'Overlay color from zero'
- OnClick = OverlayColorFromZeroMenuClick
- end
- object OverlayHideZerosMenu: TMenuItem
- AutoCheck = True
- Caption = 'Overlay hide zeros'
- OnClick = OverlayColorFromZeroMenuClick
- end
- end
- object Import1: TMenuItem
- Caption = 'Import'
- object ConvertDicom1: TMenuItem
- Caption = 'Convert DICOM to NIfTI'
- OnClick = ConvertDicom1Click
- end
- object ConvertForeign1: TMenuItem
- Caption = 'Convert foreign to NIfTI'
- Hint = 'Convert MGH, LSM, NRRD, PIC, TIFF'
- OnClick = ConvertForeign1Click
- end
- object ReorientMenu: TMenuItem
- Caption = 'Rotate volume'
- Hint = 'Reorient image to standard space'
- OnClick = ReorientMenuClick
- end
- end
- object Draw1: TMenuItem
- Caption = 'Draw'
- object OpenVOI1: TMenuItem
- Caption = 'Open VOI'
- OnClick = OpenVOI1Click
- end
- object SaveVOI1: TMenuItem
- Caption = 'Save VOI'
- OnClick = SaveVOI1Click
- end
- object CloseVOI1: TMenuItem
- Caption = 'Close VOI'
- OnClick = CloseVOI1Click
- end
- object UndoVOI1: TMenuItem
- Caption = 'Undo'
- ShortCut = 16474
- OnClick = UndoVOI1Click
- end
- object Transparency1: TMenuItem
- Caption = 'Transparency'
- object HideVOI1: TMenuItem
- AutoCheck = True
- Caption = 'Hide/Unhide'
- ShortCut = 16456
- OnClick = TransparencyVOIClick
- end
- object TransparencyVOIhi: TMenuItem
- Tag = 64
- AutoCheck = True
- Caption = '25%'
- GroupIndex = 121
- RadioItem = True
- OnClick = TransparencyVOIClick
- end
- object TransparencyVOImid: TMenuItem
- Tag = 128
- AutoCheck = True
- Caption = '50%'
- Checked = True
- GroupIndex = 121
- RadioItem = True
- OnClick = TransparencyVOIClick
- end
- object TransparencyVOIlo: TMenuItem
- Tag = 230
- AutoCheck = True
- Caption = '90%'
- GroupIndex = 121
- RadioItem = True
- OnClick = TransparencyVOIClick
- end
- end
- object DrawTool1: TMenuItem
- Caption = 'Draw color'
- object NoDraw1: TMenuItem
- Tag = -1
- AutoCheck = True
- Caption = 'None (disable: draw mode off)'
- Checked = True
- GroupIndex = 189
- RadioItem = True
- ShortCut = 16452
- OnClick = DrawTool1Click
- end
- object Eraser1: TMenuItem
- AutoCheck = True
- Caption = 'Erase'
- GroupIndex = 189
- RadioItem = True
- ShortCut = 16453
- OnClick = DrawTool1Click
- end
- end
- object Advanced1: TMenuItem
- Caption = 'Advanced'
- object OverwriteDrawColor1: TMenuItem
- AutoCheck = True
- Caption = 'Overwrite draw colors'
- Checked = True
- end
- object PasteSlice1: TMenuItem
- Caption = 'Clone slice'
- ShortCut = 16470
- OnClick = PasteSlice1Click
- end
- object CustomDrawColors1: TMenuItem
- Caption = 'Custom draw colors'
- OnClick = CustomDrawColors1Click
- end
- object Smooth1: TMenuItem
- Caption = 'Smooth and refine drawing'
- OnClick = Smooth1Click
- end
- object AutoRoi1: TMenuItem
- Caption = 'Automatic VOI'
- OnClick = AutoRoi1Click
- end
- object voiBinarize1: TMenuItem
- Caption = 'Binarize (make entire drawing red)'
- Hint = 'Make entire drawing red'
- OnClick = voiBinarize1Click
- end
- object InterpolateDrawMenu: TMenuItem
- Caption = 'Interpolate between slices'
- object InterpolateRecentMenu: TMenuItem
- Caption = 'Last two slices'
- ShortCut = 16472
- OnClick = InterpolateDrawMenuClick
- end
- object InterpolateAxialMenu: TMenuItem
- Tag = 1
- Caption = 'All axial gaps'
- OnClick = InterpolateDrawMenuClick
- end
- object InterpolateCoronalMenu: TMenuItem
- Tag = 2
- Caption = 'All coronal gaps'
- OnClick = InterpolateDrawMenuClick
- end
- object InterpolateSagittalMenu: TMenuItem
- Tag = 3
- Caption = 'All sagittal gaps'
- OnClick = InterpolateDrawMenuClick
- end
- end
- object voiDescriptives1: TMenuItem
- Caption = 'Descriptives'
- OnClick = voiDescriptives1Click
- end
- end
- end
- object Display1: TMenuItem
- Caption = 'Display'
- object Render1: TMenuItem
- AutoCheck = True
- Caption = 'Render'
- Checked = True
- GroupIndex = 212
- RadioItem = True
- ShortCut = 16466
- OnClick = SetViewClick
- end
- object Axial1: TMenuItem
- Tag = 1
- AutoCheck = True
- Caption = 'Axial'
- GroupIndex = 212
- RadioItem = True
- ShortCut = 16449
- OnClick = SetViewClick
- end
- object Coronal1: TMenuItem
- Tag = 2
- AutoCheck = True
- Caption = 'Coronal'
- GroupIndex = 212
- RadioItem = True
- OnClick = SetViewClick
- end
- object Sagittal1: TMenuItem
- Tag = 3
- AutoCheck = True
- Caption = 'Sagittal'
- GroupIndex = 212
- RadioItem = True
- ShortCut = 16467
- OnClick = SetViewClick
- end
- object MPR1: TMenuItem
- Tag = 4
- AutoCheck = True
- Caption = 'Multi planar (A+C+S)'
- GroupIndex = 212
- RadioItem = True
- ShortCut = 16461
- OnClick = SetViewClick
- end
- object Mosaic1: TMenuItem
- Tag = 5
- AutoCheck = True
- Caption = 'Mosaic'
- GroupIndex = 212
- RadioItem = True
- OnClick = Mosaic1Click
- end
- object YokeSepMenu: TMenuItem
- Caption = '-'
- Visible = False
- end
- object YokeMenu: TMenuItem
- AutoCheck = True
- Caption = 'Yoke'
- ShortCut = 16473
- Visible = False
- OnClick = YokeMenuClick
- end
- object ViewSepMenu: TMenuItem
- Caption = '-'
- end
- object LeftMenu: TMenuItem
- Caption = 'Left'
- ShortCut = 76
- OnClick = OrientMenuClick
- end
- object RightMenu: TMenuItem
- Tag = 1
- Caption = 'Right'
- ShortCut = 82
- OnClick = OrientMenuClick
- end
- object PosteriorMenu: TMenuItem
- Tag = 2
- Caption = 'Posterior'
- ShortCut = 80
- OnClick = OrientMenuClick
- end
- object AnteriorMenu: TMenuItem
- Tag = 3
- Caption = 'Anterior'
- ShortCut = 65
- OnClick = OrientMenuClick
- end
- object InferiorMenu: TMenuItem
- Tag = 4
- Caption = 'Inferior'
- ShortCut = 73
- OnClick = OrientMenuClick
- end
- object SuperiorMenu: TMenuItem
- Tag = 5
- Caption = 'Superior'
- ShortCut = 83
- OnClick = OrientMenuClick
- end
- object RadiologicalMenu: TMenuItem
- AutoCheck = True
- Caption = 'Radiological (flip LR)'
- OnClick = RadiologicalMenuClick
- end
- end
- object View1: TMenuItem
- Caption = 'View'
- object ResetDefaults1: TMenuItem
- Caption = 'Reset defaults'
- OnClick = ResetDefaults1Click
- end
- object Tool1: TMenuItem
- AutoCheck = True
- Caption = 'Tool panel'
- ShortCut = 16468
- OnClick = Tool1Click
- end
- object Orient1: TMenuItem
- AutoCheck = True
- Caption = 'Text and orientation cube'
- ShortCut = 112
- OnClick = Orient1Click
- end
- object Scripting1: TMenuItem
- Caption = 'Scripting'
- OnClick = Scripting1Click
- end
- object Extract1: TMenuItem
- Caption = 'Extract object[s]'
- OnClick = Extract1Click
- end
- object BET1: TMenuItem
- Caption = 'Extract brain'
- OnClick = BET1Click
- end
- object Sharpen1: TMenuItem
- Caption = 'Sharpen'
- OnClick = Sharpen1Click
- end
- end
- object Colors1: TMenuItem
- Caption = 'Color'
- object Scheme1: TMenuItem
- Caption = 'Scheme'
- end
- object ToggleTransparency1: TMenuItem
- AutoCheck = True
- Caption = 'Color editor'
- OnClick = ToggleTransparency1Click
- end
- object ClrbarMenu: TMenuItem
- Caption = 'Colorbar'
- object VisibleClrbarMenu: TMenuItem
- AutoCheck = True
- Caption = 'Visible'
- Checked = True
- OnClick = ClrbarMenu1Click
- end
- object ClrbarSep: TMenuItem
- Caption = '-'
- end
- object WhiteClrbarMenu: TMenuItem
- Tag = 1
- AutoCheck = True
- Caption = 'White'
- GroupIndex = 193
- RadioItem = True
- OnClick = ClrbarMenuClick
- end
- object TransWhiteClrbarMenu: TMenuItem
- Tag = 2
- Caption = 'Translucent White'
- GroupIndex = 193
- RadioItem = True
- OnClick = ClrbarMenuClick
- end
- object BlackClrbarMenu: TMenuItem
- Tag = 3
- AutoCheck = True
- Caption = 'Black'
- GroupIndex = 193
- RadioItem = True
- OnClick = ClrbarMenuClick
- end
- object TransBlackClrbarMenu: TMenuItem
- Tag = 4
- AutoCheck = True
- Caption = 'Translucent Black'
- Checked = True
- GroupIndex = 193
- RadioItem = True
- OnClick = ClrbarMenuClick
- end
- end
- object Backcolor1: TMenuItem
- Caption = 'Back color'
- OnClick = Backcolor1Click
- end
- end
- object Help1: TMenuItem
- Caption = 'Help'
- object About1: TMenuItem
- Caption = 'About'
- OnClick = About1Click
- end
- object Preferences1: TMenuItem
- Caption = 'Preferences'
- OnClick = Preferences1Click
- end
- object OnlineHelpMenu: TMenuItem
- Caption = 'Online help'
- OnClick = OnlineHelpMenuClick
- end
- end
- end
- object OpenDialog1: TOpenDialog
- FileName = '/Users/rorden/Documents/pas'
- Filter = 'NIfTI|*.nii;*.hdr;*.nii.gz|PIC|*.PIC'
- InitialDir = '/Users/rorden/Documents/'
- left = 640
- top = 32
- end
- object ColorDialog1: TColorDialog
- Color = clBlack
- CustomColors.Strings = (
- 'ColorA=000000'
- 'ColorB=000080'
- 'ColorC=008000'
- 'ColorD=008080'
- 'ColorE=800000'
- 'ColorF=800080'
- 'ColorG=808000'
- 'ColorH=808080'
- 'ColorI=C0C0C0'
- 'ColorJ=0000FF'
- 'ColorK=00FF00'
- 'ColorL=00FFFF'
- 'ColorM=FF0000'
- 'ColorN=FF00FF'
- 'ColorO=FFFF00'
- 'ColorP=FFFFFF'
- 'ColorQ=C0DCC0'
- 'ColorR=F0CAA6'
- 'ColorS=F0FBFF'
- 'ColorT=A4A0A0'
- )
- left = 864
- top = 32
- end
- object UpdateTimer: TTimer
- Enabled = False
- Interval = 150
- OnTimer = UpdateTimerTimer
- left = 640
- top = 160
- end
- object SaveDialog1: TSaveDialog
- DefaultExt = '.png'
- Filter = 'PNG lossless|*.png'
- left = 640
- top = 288
- end
- object AutoRunTimer1: TTimer
- Enabled = False
- Interval = 250
- OnTimer = AutoRunTimer1Timer
- left = 640
- top = 416
- end
- object GradientsIdleTimer: TTimer
- Enabled = False
- OnTimer = GradientsIdleTimerTimer
- left = 640
- top = 560
- end
- object SaveDialogVoi: TSaveDialog
- Title = 'Save drawing as'
- Filter = 'Volume of Interest (.voi)|.voi|FSL (.nii.gz)|.nii.gz|SPM/FSL (.nii)|.nii'
- left = 640
- top = 688
- end
- object OpenDialogVoi: TOpenDialog
- left = 640
- top = 816
- end
- object OpenDialogTxt: TOpenDialog
- Filter = 'ITK-SnAP Label Description (txt)|*.txt'
- left = 640
- top = 944
- end
- object ErrorTimer: TTimer
- Enabled = False
- Interval = 50
- OnTimer = ErrorTimerTimer
- left = 864
- top = 144
- end
- object YokeTimer: TTimer
- Enabled = False
- Interval = 200
- OnTimer = YokeTimerTimer
- left = 858
- top = 302
- end
-end
diff --git a/lib/x86_64-linux/mainunit.o b/lib/x86_64-linux/mainunit.o
deleted file mode 100644
index 31979bc..0000000
Binary files a/lib/x86_64-linux/mainunit.o and /dev/null differ
diff --git a/lib/x86_64-linux/mainunit.ppu b/lib/x86_64-linux/mainunit.ppu
deleted file mode 100644
index 18ccaa8..0000000
Binary files a/lib/x86_64-linux/mainunit.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/nifti_dicom.o b/lib/x86_64-linux/nifti_dicom.o
deleted file mode 100644
index e386442..0000000
Binary files a/lib/x86_64-linux/nifti_dicom.o and /dev/null differ
diff --git a/lib/x86_64-linux/nifti_dicom.ppu b/lib/x86_64-linux/nifti_dicom.ppu
deleted file mode 100644
index 43fbc6e..0000000
Binary files a/lib/x86_64-linux/nifti_dicom.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/nifti_foreign.o b/lib/x86_64-linux/nifti_foreign.o
deleted file mode 100644
index 85e7407..0000000
Binary files a/lib/x86_64-linux/nifti_foreign.o and /dev/null differ
diff --git a/lib/x86_64-linux/nifti_foreign.ppu b/lib/x86_64-linux/nifti_foreign.ppu
deleted file mode 100644
index 8a43bee..0000000
Binary files a/lib/x86_64-linux/nifti_foreign.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/nifti_hdr.o b/lib/x86_64-linux/nifti_hdr.o
deleted file mode 100644
index 5d3d69d..0000000
Binary files a/lib/x86_64-linux/nifti_hdr.o and /dev/null differ
diff --git a/lib/x86_64-linux/nifti_hdr.ppu b/lib/x86_64-linux/nifti_hdr.ppu
deleted file mode 100644
index c659082..0000000
Binary files a/lib/x86_64-linux/nifti_hdr.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/nifti_tiff.o b/lib/x86_64-linux/nifti_tiff.o
deleted file mode 100644
index aff8dad..0000000
Binary files a/lib/x86_64-linux/nifti_tiff.o and /dev/null differ
diff --git a/lib/x86_64-linux/nifti_tiff.ppu b/lib/x86_64-linux/nifti_tiff.ppu
deleted file mode 100644
index 3d5716f..0000000
Binary files a/lib/x86_64-linux/nifti_tiff.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/nifti_types.o b/lib/x86_64-linux/nifti_types.o
deleted file mode 100644
index 21c89b6..0000000
Binary files a/lib/x86_64-linux/nifti_types.o and /dev/null differ
diff --git a/lib/x86_64-linux/nifti_types.ppu b/lib/x86_64-linux/nifti_types.ppu
deleted file mode 100644
index d66995f..0000000
Binary files a/lib/x86_64-linux/nifti_types.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/nii_label.o b/lib/x86_64-linux/nii_label.o
deleted file mode 100644
index 53ab35b..0000000
Binary files a/lib/x86_64-linux/nii_label.o and /dev/null differ
diff --git a/lib/x86_64-linux/nii_label.ppu b/lib/x86_64-linux/nii_label.ppu
deleted file mode 100644
index 3b0e4c5..0000000
Binary files a/lib/x86_64-linux/nii_label.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/nii_mat.o b/lib/x86_64-linux/nii_mat.o
deleted file mode 100644
index f969b40..0000000
Binary files a/lib/x86_64-linux/nii_mat.o and /dev/null differ
diff --git a/lib/x86_64-linux/nii_mat.ppu b/lib/x86_64-linux/nii_mat.ppu
deleted file mode 100644
index 93d62e4..0000000
Binary files a/lib/x86_64-linux/nii_mat.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/nii_reslice.o b/lib/x86_64-linux/nii_reslice.o
deleted file mode 100644
index 308beae..0000000
Binary files a/lib/x86_64-linux/nii_reslice.o and /dev/null differ
diff --git a/lib/x86_64-linux/nii_reslice.ppu b/lib/x86_64-linux/nii_reslice.ppu
deleted file mode 100644
index 5181522..0000000
Binary files a/lib/x86_64-linux/nii_reslice.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/otsuml.o b/lib/x86_64-linux/otsuml.o
deleted file mode 100644
index ff6422a..0000000
Binary files a/lib/x86_64-linux/otsuml.o and /dev/null differ
diff --git a/lib/x86_64-linux/otsuml.ppu b/lib/x86_64-linux/otsuml.ppu
deleted file mode 100644
index c7c8f90..0000000
Binary files a/lib/x86_64-linux/otsuml.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/prefs.o b/lib/x86_64-linux/prefs.o
deleted file mode 100644
index 8cf0363..0000000
Binary files a/lib/x86_64-linux/prefs.o and /dev/null differ
diff --git a/lib/x86_64-linux/prefs.ppu b/lib/x86_64-linux/prefs.ppu
deleted file mode 100644
index 2347d27..0000000
Binary files a/lib/x86_64-linux/prefs.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/proc_py.o b/lib/x86_64-linux/proc_py.o
deleted file mode 100644
index a8f15e8..0000000
Binary files a/lib/x86_64-linux/proc_py.o and /dev/null differ
diff --git a/lib/x86_64-linux/proc_py.ppu b/lib/x86_64-linux/proc_py.ppu
deleted file mode 100644
index f7dafb4..0000000
Binary files a/lib/x86_64-linux/proc_py.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/raycast_common.o b/lib/x86_64-linux/raycast_common.o
deleted file mode 100644
index cf999a7..0000000
Binary files a/lib/x86_64-linux/raycast_common.o and /dev/null differ
diff --git a/lib/x86_64-linux/raycast_common.ppu b/lib/x86_64-linux/raycast_common.ppu
deleted file mode 100644
index 53f48d5..0000000
Binary files a/lib/x86_64-linux/raycast_common.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/raycast_legacy.o b/lib/x86_64-linux/raycast_legacy.o
deleted file mode 100644
index 428e409..0000000
Binary files a/lib/x86_64-linux/raycast_legacy.o and /dev/null differ
diff --git a/lib/x86_64-linux/raycast_legacy.ppu b/lib/x86_64-linux/raycast_legacy.ppu
deleted file mode 100644
index 2e071d4..0000000
Binary files a/lib/x86_64-linux/raycast_legacy.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/readint.lfm b/lib/x86_64-linux/readint.lfm
deleted file mode 100644
index 23d1929..0000000
--- a/lib/x86_64-linux/readint.lfm
+++ /dev/null
@@ -1,60 +0,0 @@
-object ReadIntForm: TReadIntForm
- Left = 2031
- Height = 184
- Top = 76
- Width = 484
- ActiveControl = ReadIntEdit
- AutoSize = True
- Caption = 'Integer required'
- ClientHeight = 184
- ClientWidth = 484
- DesignTimePPI = 192
- Font.Height = -22
- Font.Name = 'Default'
- OnCreate = FormCreate
- Position = poScreenCenter
- LCLVersion = '2.1.0.0'
- object ReadIntLabel: TLabel
- AnchorSideLeft.Control = Owner
- AnchorSideTop.Control = ReadIntEdit
- AnchorSideTop.Side = asrCenter
- Left = 8
- Height = 39
- Top = 15
- Width = 224
- BorderSpacing.Left = 8
- Caption = 'Enter a number'
- Font.Name = 'Default'
- ParentColor = False
- ParentFont = False
- end
- object ReadIntEdit: TSpinEdit
- AnchorSideLeft.Control = ReadIntLabel
- AnchorSideLeft.Side = asrBottom
- AnchorSideTop.Control = Owner
- Left = 240
- Height = 56
- Top = 6
- Width = 186
- BorderSpacing.Left = 8
- BorderSpacing.Top = 6
- MaxValue = 0
- ParentFont = False
- TabOrder = 1
- end
- object OKBtn: TButton
- AnchorSideTop.Control = ReadIntEdit
- AnchorSideTop.Side = asrBottom
- Left = 272
- Height = 50
- Top = 70
- Width = 150
- BorderSpacing.Top = 8
- Caption = 'OK'
- Font.Height = -22
- Font.Name = 'Default'
- OnClick = OKBtnClick
- ParentFont = False
- TabOrder = 0
- end
-end
diff --git a/lib/x86_64-linux/readint.o b/lib/x86_64-linux/readint.o
deleted file mode 100644
index 6ae6b8a..0000000
Binary files a/lib/x86_64-linux/readint.o and /dev/null differ
diff --git a/lib/x86_64-linux/readint.ppu b/lib/x86_64-linux/readint.ppu
deleted file mode 100644
index cdf9cdc..0000000
Binary files a/lib/x86_64-linux/readint.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/reorient.o b/lib/x86_64-linux/reorient.o
deleted file mode 100644
index 4271acf..0000000
Binary files a/lib/x86_64-linux/reorient.o and /dev/null differ
diff --git a/lib/x86_64-linux/reorient.ppu b/lib/x86_64-linux/reorient.ppu
deleted file mode 100644
index 7a664b7..0000000
Binary files a/lib/x86_64-linux/reorient.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/reslice.lfm b/lib/x86_64-linux/reslice.lfm
deleted file mode 100644
index 531d9a3..0000000
--- a/lib/x86_64-linux/reslice.lfm
+++ /dev/null
@@ -1,80 +0,0 @@
-object ResliceForm: TResliceForm
- Left = 594
- Height = 200
- Top = 155
- Width = 408
- BorderStyle = bsDialog
- Caption = 'Reslice Overlay to Match Background'
- ClientHeight = 200
- ClientWidth = 408
- Position = poScreenCenter
- LCLVersion = '1.0.12.0'
- object ThreshEdit: TEdit
- Left = 232
- Height = 22
- Top = 56
- Width = 160
- TabOrder = 0
- Text = '2'
- end
- object ClusterLabel: TLabel
- Left = 24
- Height = 17
- Top = 87
- Width = 189
- Caption = 'Minimum cluster size (mm^3)'
- ParentColor = False
- end
- object ThreshLabel: TLabel
- Left = 24
- Height = 17
- Top = 56
- Width = 123
- Caption = 'Threshold intensity'
- ParentColor = False
- end
- object SaveCheck: TCheckBox
- Left = 24
- Height = 18
- Top = 119
- Width = 138
- Caption = 'Save image to disk'
- Checked = True
- State = cbChecked
- TabOrder = 1
- end
- object OKbtn: TButton
- Left = 317
- Height = 25
- Top = 152
- Width = 75
- Caption = 'OK'
- ModalResult = 1
- TabOrder = 2
- end
- object CancelBtn: TButton
- Left = 216
- Height = 25
- Top = 152
- Width = 75
- Caption = 'Cancel'
- ModalResult = 2
- TabOrder = 3
- end
- object ClusterEdit: TEdit
- Left = 232
- Height = 22
- Top = 84
- Width = 160
- TabOrder = 4
- Text = '0'
- end
- object BGLabel: TLabel
- Left = 24
- Height = 17
- Top = 16
- Width = 51
- Caption = 'BGLabel'
- ParentColor = False
- end
-end
diff --git a/lib/x86_64-linux/reslice.o b/lib/x86_64-linux/reslice.o
deleted file mode 100644
index 1bd8b23..0000000
Binary files a/lib/x86_64-linux/reslice.o and /dev/null differ
diff --git a/lib/x86_64-linux/reslice.ppu b/lib/x86_64-linux/reslice.ppu
deleted file mode 100644
index c67e69e..0000000
Binary files a/lib/x86_64-linux/reslice.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/savethreshold.o b/lib/x86_64-linux/savethreshold.o
deleted file mode 100644
index 74c09e8..0000000
Binary files a/lib/x86_64-linux/savethreshold.o and /dev/null differ
diff --git a/lib/x86_64-linux/savethreshold.ppu b/lib/x86_64-linux/savethreshold.ppu
deleted file mode 100644
index 7f18c35..0000000
Binary files a/lib/x86_64-linux/savethreshold.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/scaleimageintensity.o b/lib/x86_64-linux/scaleimageintensity.o
deleted file mode 100644
index 5fa7e8b..0000000
Binary files a/lib/x86_64-linux/scaleimageintensity.o and /dev/null differ
diff --git a/lib/x86_64-linux/scaleimageintensity.ppu b/lib/x86_64-linux/scaleimageintensity.ppu
deleted file mode 100644
index ab21580..0000000
Binary files a/lib/x86_64-linux/scaleimageintensity.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/scriptengine.lfm b/lib/x86_64-linux/scriptengine.lfm
deleted file mode 100644
index 815a732..0000000
--- a/lib/x86_64-linux/scriptengine.lfm
+++ /dev/null
@@ -1,702 +0,0 @@
-object ScriptForm: TScriptForm
- Tag = 2
- Left = 622
- Height = 750
- Top = 114
- Width = 774
- ActiveControl = Memo1
- Caption = 'ScriptForm'
- ClientHeight = 703
- ClientWidth = 774
- DesignTimePPI = 192
- Menu = ScriptMenu1
- OnActivate = FormActivate
- OnCloseQuery = FormCloseQuery
- OnCreate = FormCreate
- OnDeactivate = FormDeactivate
- OnHide = FormHide
- OnShow = FormShow
- Position = poScreenCenter
- LCLVersion = '2.1.0.0'
- object Splitter1: TSplitter
- Cursor = crVSplit
- Left = 0
- Height = 6
- Top = 545
- Width = 774
- Align = alBottom
- ResizeAnchor = akBottom
- end
- object Memo1: TMemo
- Left = 0
- Height = 545
- Top = 0
- Width = 774
- Align = alClient
- Constraints.MinHeight = 6
- OnChange = Memo1Change
- OnClick = Memo1Click
- OnKeyUp = Memo1KeyUp
- ParentBidiMode = False
- ParentFont = False
- ScrollBars = ssAutoVertical
- TabOrder = 0
- WantTabs = True
- WordWrap = False
- end
- object Memo2: TMemo
- Left = 0
- Height = 152
- Top = 551
- Width = 774
- Align = alBottom
- Constraints.MinHeight = 6
- ParentFont = False
- ReadOnly = True
- ScrollBars = ssAutoVertical
- TabOrder = 1
- end
- object ScriptMenu1: TMainMenu
- left = 208
- top = 64
- object File1: TMenuItem
- Caption = '&File'
- object New1: TMenuItem
- Caption = '&New'
- OnClick = New1Click
- end
- object NewPython1: TMenuItem
- Tag = 1
- Caption = 'New Python'
- OnClick = New1Click
- end
- object Open1: TMenuItem
- Caption = '&Open...'
- OnClick = Open1Click
- end
- object Save1: TMenuItem
- Caption = '&Save'
- OnClick = Save1Click
- end
- object SaveAs1: TMenuItem
- Caption = 'Save &As...'
- OnClick = SaveAs1Click
- end
- object Exit1: TMenuItem
- Caption = 'E&xit'
- OnClick = Exit1Click
- end
- object N1: TMenuItem
- Caption = '-'
- end
- object MRU1: TMenuItem
- Caption = 'MRU1'
- end
- object MRU2: TMenuItem
- Caption = 'MRU2'
- end
- object MRU3: TMenuItem
- Caption = 'MRU3'
- end
- object MRU4: TMenuItem
- Caption = 'MRU4'
- end
- object MRU5: TMenuItem
- Caption = 'MRU5'
- end
- object MRU6: TMenuItem
- Caption = 'MRU6'
- end
- object MRU7: TMenuItem
- Caption = 'MRU7'
- end
- object MRU8: TMenuItem
- Caption = 'MRU8'
- end
- object MRU9: TMenuItem
- Caption = 'MRU9'
- end
- object MRU10: TMenuItem
- Caption = 'MRU10'
- end
- end
- object Edit1: TMenuItem
- Caption = 'Edit'
- object Cut1: TMenuItem
- Caption = 'Cut'
- ShortCut = 16472
- OnClick = Cut1Click
- end
- object Copy1: TMenuItem
- Caption = 'Copy'
- ShortCut = 16451
- OnClick = Copy1Click
- end
- object Paste1: TMenuItem
- Caption = 'Paste'
- ShortCut = 16470
- OnClick = Paste1Click
- end
- object ListCommands1: TMenuItem
- Caption = 'List all commands'
- OnClick = ListCommands1Click
- end
- object showcolortable1: TMenuItem
- Caption = 'List color table'
- OnClick = showcolortable1Click
- end
- end
- object Insert1: TMenuItem
- Caption = 'Insert'
- object Forms1: TMenuItem
- Caption = 'Forms'
- object clipformvisible1: TMenuItem
- Tag = 1
- Caption = 'clipformvisible'
- Hint = 'clipformvisible (visible: boolean) Shows or hides the clipping form.'
- Visible = False
- OnClick = InsertCommand
- end
- object colorbarformvisible1: TMenuItem
- Tag = 1
- Caption = 'colorbarformvisible'
- Hint = 'colorbarformvisible (visible: boolean) Shows or hides the window that allows the user to interactively control the size and location of the colorbar. '
- Visible = False
- OnClick = InsertCommand
- end
- object contrastformvisible1: TMenuItem
- Tag = 1
- Caption = 'contrastformvisible'
- Hint = 'contrastformvisible (visible: boolean) Shows or hides the contrast and color window. '
- OnClick = InsertCommand
- end
- object cutoutformvisible1: TMenuItem
- Tag = 1
- Caption = 'cutoutformvisible'
- Hint = 'cutoutformvisible (visible: boolean) Shows or hides the cutout window.'
- Visible = False
- OnClick = InsertCommand
- end
- object edgeenhanceformvisible1: TMenuItem
- Tag = 1
- Caption = 'edgeenhanceformvisible'
- Hint = 'edgeenhanceformvisible (visible: boolean) Shows or hides the edge enhancement form that helps emphasize tissue boundaries. '
- Visible = False
- OnClick = InsertCommand
- end
- object mosaicformvisible1: TMenuItem
- Tag = 1
- Caption = 'mosaicformvisible'
- Hint = 'mosaicformvisible (visible: boolean) Shows or hides the mosaic designer window.'
- Visible = False
- OnClick = InsertCommand
- end
- object overlayformvisible1: TMenuItem
- Tag = 1
- Caption = 'overlayformvisible'
- Hint = 'overlayformvisible (visible: boolean) Shows or hides the overlay window.'
- Visible = False
- OnClick = InsertCommand
- end
- object scriptformvisible1: TMenuItem
- Tag = 1
- Caption = 'scriptformvisible'
- Hint = 'scriptformvisible (visible: boolean) Shows or hides the scripting window.'
- OnClick = InsertCommand
- end
- object toolformvisible1: TMenuItem
- Tag = 1
- Caption = 'toolformvisible'
- Hint = 'toolformvisible (visible: boolean) Shows or hides the tools panel.'
- OnClick = InsertCommand
- end
- end
- object Colorbar1: TMenuItem
- Caption = 'Colorbar'
- object colorbarvisible1: TMenuItem
- Tag = 1
- Caption = 'colorbarvisible'
- Hint = 'colorbarvisible (visible: boolean) Shows a colorbar on the main images.'
- OnClick = InsertCommand
- end
- object colorbarcoord1: TMenuItem
- Tag = 2
- Caption = 'colorbarposition'
- Hint = 'colorbarposition (p: integer) Sets the position of the colorbar: 1=bottom, 2=left, 3=top, 4=right.'
- OnClick = InsertCommand
- end
- object colorbarsize1: TMenuItem
- Tag = 3
- Caption = 'colorbarsize'
- Hint = 'colorbarsize (f) Change width of color bar f is a value 0.01..0.5 that specifies the fraction of the screen used by the colorbar'
- OnClick = InsertCommand
- end
- object colorbartext1: TMenuItem
- Tag = 1
- Caption = 'colorbartext'
- Hint = 'colorbartext (visible: boolean) If set to true, then colorbars will include text that indicates intensity range.'
- Visible = False
- OnClick = InsertCommand
- end
- end
- object Contrast1: TMenuItem
- Caption = 'Contrast'
- object setcolortable1: TMenuItem
- Tag = 2
- Caption = 'setcolortable'
- Hint = 'setcolortable (tablenum: integer) changes the color scheme used to display an image.'
- OnClick = InsertCommand
- end
- object changenode1: TMenuItem
- Tag = 66
- Caption = 'changenode'
- Hint = 'changenode (index, intensity, r, g, b, a: integer) This command adjusts a point in the color table.'
- OnClick = InsertCommand
- end
- object addnode1: TMenuItem
- Tag = 56
- Caption = 'addnode'
- Hint = 'addnode (intensity, r, g, b, a: integer) this command adds a new point to the color table.'
- OnClick = InsertCommand
- end
- object contrastminmax1: TMenuItem
- Tag = 23
- Caption = 'contrastminmax'
- Hint = 'contrastminmax (min, max: float) sets the minumum nd maximum value for the color lookup table.'
- OnClick = InsertCommand
- end
- object colorname1: TMenuItem
- Tag = 4
- Caption = 'colorname'
- Hint = 'colorname (filename: string) Loads the requested colorscheme for the background image.'
- OnClick = InsertCommand
- end
- object edgedetect1: TMenuItem
- Tag = 22
- Caption = 'edgedetect'
- Hint = 'edgedetect (thresh: float; dilatecycles: integer) This procedure attempts to hide regions of consistent color from your image.'
- Visible = False
- OnClick = InsertCommand
- end
- end
- object Dialogs1: TMenuItem
- Caption = 'Dialogs'
- object modalmessage1: TMenuItem
- Tag = 4
- Caption = 'modalmessage'
- Hint = 'modalmessage (str: string) Shows a modal dialog, script stops until user presses ''OK'' button to dismiss dialog.'
- OnClick = InsertCommand
- end
- object modelessmessage1: TMenuItem
- Tag = 4
- Caption = 'modelessmessage'
- Hint = 'modelessmessage (str: string) Shows text in the rendering window. This text is displayed until the text is changed.'
- OnClick = InsertCommand
- end
- end
- object Overlays1: TMenuItem
- Caption = 'Overlays'
- object overlayload1: TMenuItem
- Tag = 4
- Caption = 'overlayload'
- Hint = 'overlayload (filename: string) integer; Will add the overlay named filename and return the number of the overlay.'
- OnClick = InsertCommand
- end
- object overlayloadcluster1: TMenuItem
- Tag = 142211
- Caption = 'overlayloadcluster'
- Hint = 'overlayloadcluster (filename: string; threshold, clusterMM3: float; lSaveToDisk: boolean) integer; Will add the overlay named filename, only display voxels with intensity greater than threshold with a cluster volume greater than clusterMM and return the number of the overlay.'
- OnClick = InsertCommand
- end
- object overlayloadvol1: TMenuItem
- Caption = 'overlayloadvol'
- OnClick = InsertCommand
- end
- object overlaycloseall1: TMenuItem
- Caption = 'overlaycloseall'
- Hint = 'overlaycloseall () This function has no parameters. All open overlays will be closed.'
- OnClick = InsertCommand
- end
- object overlaycolornumber1: TMenuItem
- Tag = 22
- Caption = 'overlaycolornumber'
- Hint = 'overlaycolornumber (overlay, color_index: integer) Sets the color scheme for a overlay.'
- OnClick = InsertCommand
- end
- object overlaycolorname1: TMenuItem
- Tag = 1214
- Caption = 'overlaycolorname'
- Hint = 'overlaycolorname (overlay: integer; filename: string) Set the colorscheme for the target overlay to a specified name.'
- OnClick = InsertCommand
- end
- object overlayminmax1: TMenuItem
- Tag = 1223
- Caption = 'overlayminmax'
- Hint = 'overlayminmax (overlay: integer; min, max: float) Sets the color range for the overlay.'
- OnClick = InsertCommand
- end
- object overlaytransparencyonbackground1: TMenuItem
- Tag = 2
- Caption = 'overlaytransparencyonbackground'
- Hint = 'overlaytransparencyonbackground (percent: integer) Controls the opacity of the overlays on the background.'
- OnClick = InsertCommand
- end
- object overlaytransparencyonoverlay1: TMenuItem
- Tag = 2
- Caption = 'overlaytransparencyonoverlay'
- Hint = 'overlaytransparencyonoverlay (percent: integer) Controls the opacity of the overlays on other overlays.'
- OnClick = InsertCommand
- end
- object overlaycolorfromzero1: TMenuItem
- Tag = 1
- Caption = 'overlaycolorfromzero'
- Hint = 'overlaycolorfromzero (fromzero: boolean) If set to false, then the full color range is used to show the overlay.'
- OnClick = InsertCommand
- end
- object overlayloadsmooth1: TMenuItem
- Tag = 1
- Caption = 'overlayloadsmooth'
- Hint = 'overlayloadsmooth (smooth: boolean) Determines whether overlays are interpolated using trilinear interpolation.'
- OnClick = InsertCommand
- end
- object overlaymaskedbybackground1: TMenuItem
- Tag = 1
- Caption = 'overlaymaskedbybackground'
- Hint = 'overlaymaskedbybackground (mask: boolean) If true, than a overlay will be transparent on any voxel where the background image is transparent.'
- OnClick = InsertCommand
- end
- object overlayvisible1: TMenuItem
- Tag = 1211
- Caption = 'overlayvisible'
- Hint = 'overlayvisible (overlay: integer; visible: boolean) The feature allows you to make individual overlays visible or invisible.'
- OnClick = InsertCommand
- end
- object overlayhidezeros1: TMenuItem
- Tag = 1
- Caption = 'overlayhidezeros'
- Hint = 'overlayhidezeros (mask: boolean) If true, values with intensity of zero are always transparent.'
- OnClick = InsertCommand
- end
- object overlaylayertransparencyonoverlay1: TMenuItem
- Tag = 22
- Caption = 'overlaylayertransparencyonoverlay'
- Hint = 'overlaylayertransparencyonoverlay (layer, percent: integer) allows you to make a specific overlay volume have a custom transparency on other overlay images.'
- OnClick = InsertCommand
- end
- object overlaylayertransparencyonbackground1: TMenuItem
- Tag = 22
- Caption = 'overlaylayertransparencyonbackground'
- Hint = 'overlaylayertransparencyonbackground (overlaylayer, percent: integer) Specifies a custom transparency for a single overlay layer on top of the background image'
- OnClick = InsertCommand
- end
- end
- object Shaders1: TMenuItem
- Caption = 'Shaders'
- object shadername1: TMenuItem
- Tag = 4
- Caption = 'shadername'
- Hint = 'shadername (filename: string) Loads the requested shader.'
- OnClick = InsertCommand
- end
- object shaderlightazimuthelevation1: TMenuItem
- Tag = 22
- Caption = 'shaderlightazimuthelevation'
- Hint = 'shaderlightazimuthelevation (azi, elev: integer) Changes location of light source.'
- OnClick = InsertCommand
- end
- object shaderadjust1: TMenuItem
- Tag = 1413
- Caption = 'shaderadjust'
- Hint = 'shaderadjust (property: string; value: float) Sets one of the user-adjustable properties.'
- OnClick = InsertCommand
- end
- object shaderquality1to101: TMenuItem
- Tag = 7
- Caption = 'shaderquality1to10'
- Hint = 'shaderquality1to10 (value: integer) Renderings can be quick or slow but precise, corresponding to values 1-10.'
- OnClick = InsertCommand
- end
- object shaderupdategradients1: TMenuItem
- Caption = 'shaderupdategradients'
- Hint = 'shaderupdategradients () This command re-calculates the gradients for surface direction and magnitude.'
- OnClick = InsertCommand
- end
- end
- object Sliceviews1: TMenuItem
- Caption = '2D'
- object orthoview1: TMenuItem
- Tag = 33
- Caption = 'orthoview'
- Hint = 'orthoview (x, y, z: float) Shows a 2D projection view of the brain.'
- OnClick = InsertCommand
- end
- object orthoviewmm1: TMenuItem
- Tag = 33
- Caption = 'orthoviewmm'
- Hint = 'orthoviewmm (x, y, z: float) Shows a 2D projection view of the brain. Crosshair at X,Y,Z coordinates specified in millimeters.'
- OnClick = InsertCommand
- end
- object mosaic1: TMenuItem
- Tag = 5
- Caption = 'mosaic'
- Hint = 'mosaic (str: string) Shows a series of 2D slices.'
- OnClick = InsertCommand
- end
- object slicetext1: TMenuItem
- Tag = 1
- Caption = 'slicetext'
- Hint = 'slicetext (visible: boolean) If true, the 2D slices will be displayed with text.'
- OnClick = InsertCommand
- end
- object xbarthick1: TMenuItem
- Tag = 2
- Caption = 'linewidth'
- Hint = 'linewidth (pixels: integer) Adjusts thickness of crosshairs shown on 2D slices. Set to zero to hide crosshairs.'
- OnClick = InsertCommand
- end
- object xbarcolor1: TMenuItem
- Tag = 36
- Caption = 'linecolor'
- Hint = 'linecolor (r, g, b: integer) Changes the color for the crosshairs shown on 2D slices. For example linecolor(255, 0, 0) will show red crosshairs.'
- OnClick = InsertCommand
- end
- object radiological1: TMenuItem
- Tag = 1
- Caption = 'radiological'
- Hint = 'radiological (visible: boolean) If true, the 2D slices displayed in radiological convention (left on right: camera inferior/anterior to object) otherwise neurological (superior/posterior)'
- OnClick = InsertCommand
- end
- end
- object Render1: TMenuItem
- Caption = '3D'
- object azimuth1: TMenuItem
- Tag = 2
- Caption = 'azimuth'
- Hint = 'azimuth (degree: integer) This command rotates the rendering.'
- OnClick = InsertCommand
- end
- object azimuthelevation1: TMenuItem
- Tag = 22
- Caption = 'azimuthelevation'
- Hint = 'azimuthelevation (azi, elev: integer) Sets the viewer location.'
- OnClick = InsertCommand
- end
- object cameradistance1: TMenuItem
- Tag = 3
- Caption = 'cameradistance'
- Hint = 'cameradistance (z: float) Sets the viewing distance from the object.'
- OnClick = InsertCommand
- end
- object clip1: TMenuItem
- Tag = 3
- Caption = 'clip'
- Hint = 'clip (depth: float) Creates a clip plane that hides information close to the viewer.'
- OnClick = InsertCommand
- end
- object clipazimuthelevation1: TMenuItem
- Tag = 33
- Caption = 'clipazimuthelevation'
- Hint = 'clipazimuthelevation (depth, azi, elev: float) Set a view-point independent clip plane.'
- OnClick = InsertCommand
- end
- object cutout1: TMenuItem
- Tag = 63
- Caption = 'cutout'
- Hint = 'cutout (l, a, s, r, p, i: float) Selects a sector to remove from rendering view.'
- OnClick = InsertCommand
- end
- object edgeenhance1: TMenuItem
- Tag = 26
- Caption = 'edgeenhance'
- Hint = 'edgeenhance (bias, gain: integer) Attempts to emphasize tissue boundaries in 3D renderings by making regions with consistent brightness transparent.'
- Visible = False
- OnClick = InsertCommand
- end
- object elevation1: TMenuItem
- Tag = 2
- Caption = 'elevation'
- Hint = 'elevation (deg: integer) changes the render camera up or down.'
- OnClick = InsertCommand
- end
- object extract1: TMenuItem
- Tag = 2211
- Caption = 'extract'
- Hint = 'extract (levels, dilatevox: integer; oneobject: boolean) Attempts to remove noise speckles from dark regions (air) around object. Levels=1..5 (larger for larger surviving image), Dilate=0..12 (larger for larger surround). You can also specify if there is a single object or multiple objects '
- OnClick = InsertCommand
- end
- object framevisible1: TMenuItem
- Tag = 1
- Caption = 'framevisible'
- Hint = 'framevisible (visible: boolean) Shows or hides the cube that appears around the rendered object.'
- Visible = False
- OnClick = InsertCommand
- end
- object maximumintensity1: TMenuItem
- Tag = 1
- Caption = 'maximumintensity'
- Hint = 'maximumintensity (mip_on: boolean) Changes the rendering mode between standard and Maximum Intensity Projection.'
- OnClick = InsertCommand
- end
- object perspective1: TMenuItem
- Tag = 1
- Caption = 'perspective'
- Hint = 'perspective (on: boolean) Turns on or off perspective rendering.'
- OnClick = InsertCommand
- end
- object viewaxial1: TMenuItem
- Tag = 1
- Caption = 'viewaxial'
- Hint = 'viewaxial (std: boolean) creates rendering from an axial viewpoint.'
- OnClick = InsertCommand
- end
- object viewcoronal1: TMenuItem
- Tag = 1
- Caption = 'viewcoronal'
- Hint = 'viewcoronal (std: boolean) creates rendering from a coronal viewpoint.'
- OnClick = InsertCommand
- end
- object viewsagittal1: TMenuItem
- Tag = 1
- Caption = 'viewsagittal'
- Hint = 'viewsagittal (std: boolean) creates rendering from an sagittal viewpoint.'
- OnClick = InsertCommand
- end
- end
- object Advanced1: TMenuItem
- Caption = 'Advanced'
- object bmpzoom1: TMenuItem
- Tag = 2
- Caption = 'bmpzoom'
- Hint = 'bmpzoom (z: integer) copy and save bitmaps at higher resolution than screen. bmpzoom(2) will save images at twice the resolution.'
- OnClick = InsertCommand
- end
- object exists1: TMenuItem
- Tag = 4
- Caption = 'exists'
- Hint = 'exists (filename): boolean Returns true if file exists.'
- OnClick = InsertCommand
- end
- object fontname1: TMenuItem
- Tag = 4
- Caption = 'fontname'
- Hint = 'fontname (filename) Changes font used for colorbar. For example, "fontname(''ubuntu'')" will use the Ubuntu font.'
- OnClick = InsertCommand
- end
- object loaddrawing1: TMenuItem
- Tag = 4
- Caption = 'loaddrawing'
- Hint = 'loaddrawing (filename) Load an image for editing with the drawing tools'
- OnClick = InsertCommand
- end
- object loaddti1: TMenuItem
- Tag = 4
- Caption = 'loaddti'
- Hint = 'loaddti (filename: string) If you provide a name of a FSL-format FA image, the corresponding V1 will be loaded'
- OnClick = InsertCommand
- end
- object loadimagevol1: TMenuItem
- Tag = 1412
- Caption = 'loadimagevol'
- Hint = 'loadimagevol (filename: string; vol: integer) Use to load a specific volume in a 4D dataset, for example loadimagevol(''fmri.nii'',4) will load the 4th volume of an fMRI dataset.'
- OnClick = InsertCommand
- end
- object quit1: TMenuItem
- Caption = 'quit'
- Hint = 'quit () Terminates the program. Use with caution. This allows external programs to launch this software and quit once they are done.'
- OnClick = InsertCommand
- end
- object savebmp1: TMenuItem
- Tag = 4
- Caption = 'savebmp'
- Hint = 'savebmp (filename: string) Saves the currently viewed image as a PNG format compressed bitmap image.'
- OnClick = InsertCommand
- end
- object savebmpxy1: TMenuItem
- Tag = 1422
- Caption = 'savebmpxy'
- Hint = 'savebmpxy (filename: string; x, y: integer) Saves the currently viewed image as a PNG bitmap image. Specify the image width (x) and height (y). Does not work for mosaic images (where resolution defined by volume dimensions).'
- OnClick = InsertCommand
- end
- object savenii1: TMenuItem
- Tag = 141213
- Caption = 'savenii'
- Hint = 'savenii (filename: string; filter: integer; scale: float) Save currently open background image as NIfTI format image. Filename: name of output (e.g. ''myfile.nii''). Filter: -1=auto, 0=Nearest, 1=Linear, 2=Hermite, 3=Bell, 4=Spline, 5=Lanczos, 6=Mitchell. Example: savenii(''my.nii'',1,0.5) will create image half-scale image using linear filter. If filter is -1, then Lanczos is used for downsampling and Mitchell is used for up sampling. If scale is negative, an isotropic image is generated.'
- OnClick = InsertCommand
- end
- object sharpen1: TMenuItem
- Caption = 'sharpen'
- Hint = 'sharpen () Emphasize edges in image'
- OnClick = InsertCommand
- end
- object version1: TMenuItem
- Caption = 'version'
- Hint = 'version () : string Returns the software version.'
- OnClick = InsertCommand
- end
- end
- object loadimage1: TMenuItem
- Tag = 4
- Caption = 'loadimage'
- Hint = 'loadimage (filename: string) Opens a NIfTI format image to view.'
- OnClick = InsertCommand
- end
- object wait1: TMenuItem
- Tag = 2
- Caption = 'wait'
- Hint = 'wait (msec: integer) The program pauses for the specified duration. For example wait(1000) delays the script for one second.'
- OnClick = InsertCommand
- end
- object backcolor1: TMenuItem
- Tag = 36
- Caption = 'backcolor'
- Hint = 'backcolor (r, g, b: integer) Changes the background color, for example backcolor(255, 0, 0) will set a bright red background'
- OnClick = InsertCommand
- end
- object resetdefaults1: TMenuItem
- Caption = 'resetdefaults'
- Hint = 'resetdefaults () Sets all of the user adjustable settings to their default values.'
- OnClick = InsertCommand
- end
- end
- object Toosl1: TMenuItem
- Caption = '&Script'
- object Compile1: TMenuItem
- Caption = 'Run'
- ShortCut = 16466
- OnClick = Compile1Click
- end
- object N2: TMenuItem
- Caption = '-'
- end
- object Stop1: TMenuItem
- Caption = 'Halt'
- ShortCut = 16456
- OnClick = Stop1Click
- end
- end
- end
- object OpenDialog1: TOpenDialog
- DefaultExt = '.gls'
- FileName = '*.gls'
- Filter = 'scripts (*.gls)|*.gls'
- Options = [ofHideReadOnly, ofNoChangeDir, ofPathMustExist, ofFileMustExist, ofDontAddToRecent]
- left = 80
- top = 208
- end
- object SaveDialog1: TSaveDialog
- DefaultExt = '.gls'
- FileName = '*.gls'
- Filter = 'scripts (*.gls)|*.gls'
- Options = [ofHideReadOnly, ofPathMustExist]
- left = 80
- top = 288
- end
- object PSScript1: TPSScript
- CompilerOptions = []
- OnCompile = PSScript1Compile
- Plugins = <>
- UsePreProcessor = False
- left = 78
- top = 128
- end
-end
diff --git a/lib/x86_64-linux/scriptengine.o b/lib/x86_64-linux/scriptengine.o
deleted file mode 100644
index 58672f2..0000000
Binary files a/lib/x86_64-linux/scriptengine.o and /dev/null differ
diff --git a/lib/x86_64-linux/scriptengine.ppu b/lib/x86_64-linux/scriptengine.ppu
deleted file mode 100644
index d9f2c53..0000000
Binary files a/lib/x86_64-linux/scriptengine.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/shaderu.o b/lib/x86_64-linux/shaderu.o
deleted file mode 100644
index 3799fe9..0000000
Binary files a/lib/x86_64-linux/shaderu.o and /dev/null differ
diff --git a/lib/x86_64-linux/shaderu.ppu b/lib/x86_64-linux/shaderu.ppu
deleted file mode 100644
index 431f746..0000000
Binary files a/lib/x86_64-linux/shaderu.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/shaderui.o b/lib/x86_64-linux/shaderui.o
deleted file mode 100644
index 9dbf55d..0000000
Binary files a/lib/x86_64-linux/shaderui.o and /dev/null differ
diff --git a/lib/x86_64-linux/shaderui.ppu b/lib/x86_64-linux/shaderui.ppu
deleted file mode 100644
index b159fa9..0000000
Binary files a/lib/x86_64-linux/shaderui.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/simplelaz.compiled b/lib/x86_64-linux/simplelaz.compiled
deleted file mode 100644
index 5d90682..0000000
--- a/lib/x86_64-linux/simplelaz.compiled
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/lib/x86_64-linux/simplelaz.o b/lib/x86_64-linux/simplelaz.o
deleted file mode 100644
index 331a6a3..0000000
Binary files a/lib/x86_64-linux/simplelaz.o and /dev/null differ
diff --git a/lib/x86_64-linux/simplelaz.or b/lib/x86_64-linux/simplelaz.or
deleted file mode 100644
index cc7bf39..0000000
Binary files a/lib/x86_64-linux/simplelaz.or and /dev/null differ
diff --git a/lib/x86_64-linux/slices2d.o b/lib/x86_64-linux/slices2d.o
deleted file mode 100644
index fdb8722..0000000
Binary files a/lib/x86_64-linux/slices2d.o and /dev/null differ
diff --git a/lib/x86_64-linux/slices2d.ppu b/lib/x86_64-linux/slices2d.ppu
deleted file mode 100644
index 888d350..0000000
Binary files a/lib/x86_64-linux/slices2d.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/texture2raycast.o b/lib/x86_64-linux/texture2raycast.o
deleted file mode 100644
index 66859c9..0000000
Binary files a/lib/x86_64-linux/texture2raycast.o and /dev/null differ
diff --git a/lib/x86_64-linux/texture2raycast.ppu b/lib/x86_64-linux/texture2raycast.ppu
deleted file mode 100644
index 9234d86..0000000
Binary files a/lib/x86_64-linux/texture2raycast.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/texture_3d_unit.o b/lib/x86_64-linux/texture_3d_unit.o
deleted file mode 100644
index 92dad10..0000000
Binary files a/lib/x86_64-linux/texture_3d_unit.o and /dev/null differ
diff --git a/lib/x86_64-linux/texture_3d_unit.ppu b/lib/x86_64-linux/texture_3d_unit.ppu
deleted file mode 100644
index ddb35d6..0000000
Binary files a/lib/x86_64-linux/texture_3d_unit.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/uscaledpi.o b/lib/x86_64-linux/uscaledpi.o
deleted file mode 100644
index b9f9e33..0000000
Binary files a/lib/x86_64-linux/uscaledpi.o and /dev/null differ
diff --git a/lib/x86_64-linux/uscaledpi.ppu b/lib/x86_64-linux/uscaledpi.ppu
deleted file mode 100644
index 90caf3f..0000000
Binary files a/lib/x86_64-linux/uscaledpi.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/userdir.o b/lib/x86_64-linux/userdir.o
deleted file mode 100644
index 2d436b5..0000000
Binary files a/lib/x86_64-linux/userdir.o and /dev/null differ
diff --git a/lib/x86_64-linux/userdir.ppu b/lib/x86_64-linux/userdir.ppu
deleted file mode 100644
index 36c1053..0000000
Binary files a/lib/x86_64-linux/userdir.ppu and /dev/null differ
diff --git a/lib/x86_64-linux/yokesharemem.o b/lib/x86_64-linux/yokesharemem.o
deleted file mode 100644
index 65ab0fb..0000000
Binary files a/lib/x86_64-linux/yokesharemem.o and /dev/null differ
diff --git a/lib/x86_64-linux/yokesharemem.ppu b/lib/x86_64-linux/yokesharemem.ppu
deleted file mode 100644
index 8670de1..0000000
Binary files a/lib/x86_64-linux/yokesharemem.ppu and /dev/null differ