Skip to content

Commit

Permalink
Experimental NIML support
Browse files Browse the repository at this point in the history
  • Loading branch information
neurolabusc committed Nov 22, 2019
1 parent baf931c commit 8588ed2
Show file tree
Hide file tree
Showing 15 changed files with 852 additions and 232 deletions.
32 changes: 28 additions & 4 deletions commandsu.pas
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ procedure EDGESIZE(size: single; varies: boolean);
procedure EDGETHRESH (LO, HI: single);
procedure ELEVATION (DEG: integer);
procedure FONTNAME(name: string);
procedure MESHCREATE(niiname, meshname: string; threshold, decimateFrac: single; minimumClusterVox, smoothStyle: integer);
procedure FULLSCREEN (isFullScreen: boolean);
procedure ATLAS2NODE(lFilename: string);
function MESHCREATE(niiname, meshname: string; threshold, decimateFrac: single; minimumClusterVox, smoothStyle: integer): boolean;
procedure MESHCURV;
procedure MESHLOAD(lFilename: string);
procedure MESHOVERLAYORDER (FLIP: boolean);
Expand Down Expand Up @@ -89,7 +91,7 @@ procedure WAIT (MSEC: integer);
(Ptr:@VERSION;Decl:'VERSION';Vars:'(): string')
);

knProc = 69;
knProc = 71;
kProcRA : array [1..knProc] of TScriptRec = (
(Ptr:@ATLASSTATMAP;Decl:'ATLASSTATMAP';Vars:'(ATLASNAME, STATNAME: string; const Intensities: array of integer; const Intensities: array of single)'),
(Ptr:@ATLASSATURATIONALPHA;Decl:'ATLASSATURATIONALPHA';Vars:'(lSaturation, lTransparency: single)'),
Expand All @@ -112,6 +114,8 @@ procedure WAIT (MSEC: integer);
(Ptr:@ELEVATION;Decl:'ELEVATION';Vars:'(DEG: integer)'),
(Ptr:@EDGELOAD;Decl:'EDGELOAD';Vars:'(lFilename: string)'),
(Ptr:@FONTNAME;Decl:'FONTNAME';Vars:'(name: string)'),
(Ptr:@FULLSCREEN;Decl:'FULLSCREEN';Vars:'(isFullScreen: boolean)'),
(Ptr:@ATLAS2NODE;Decl:'ATLAS2NODE';Vars:'(lFilename: string)'),
(Ptr:@MESHCURV;Decl:'MESHCURV';Vars:''),
(Ptr:@MESHREVERSEFACES;Decl:'MESHREVERSEFACES';Vars:''),
(Ptr:@MESHLOAD;Decl:'MESHLOAD';Vars:'(lFilename: string)'),
Expand Down Expand Up @@ -431,6 +435,15 @@ procedure VIEWCORONAL (STD: boolean);
AZIMUTHELEVATION(180,0);
end;

procedure FULLSCREEN (isFullScreen: boolean);
begin
if (isFullScreen) then begin
GLForm1.WindowState := wsFullScreen// wsMaximized
{$IFNDEF LCLCocoa}ExitFullScreenMenu.Visible:=true;{$ENDIF} //Linux has issues getting out of full screen
end else
GLForm1.WindowState := wsMaximized;
end;

procedure FONTNAME(name: string);
begin
gPrefs.FontName:= name;
Expand All @@ -455,12 +468,13 @@ procedure MESHCURV;
GLForm1.CurvMenuTemp.Click;
end;

procedure MESHCREATE(niiname, meshname: string; threshold, decimateFrac: single; minimumClusterVox, smoothStyle: integer);
function MESHCREATE(niiname, meshname: string; threshold, decimateFrac: single; minimumClusterVox, smoothStyle: integer): boolean;
var
nVtx: integer;
meshnamePth: string;
begin
//Nii2MeshCore(niiname, meshname: string; threshold, decimateFrac: single; minimumClusterVox, smoothStyle: integer): integer;
result := false;
if (niiname = '') then begin
GLForm1.ScriptOutputMemo.Lines.Add('meshcreate error: no NIfTI name');
exit;
Expand All @@ -473,8 +487,10 @@ procedure MESHCREATE(niiname, meshname: string; threshold, decimateFrac: single;
nVtx := Nii2MeshCore(niiname, meshnamePth, threshold, decimateFrac, minimumClusterVox, smoothStyle);
if (nVtx < 3) then
GLForm1.ScriptOutputMemo.Lines.Add('meshcreate error: no mesh created')
else
else begin
GLForm1.ScriptOutputMemo.Lines.Add('meshcreate generated mesh with '+inttostr(nVtx)+' vertices');
result := true;
end;
end;

procedure MESHLOAD(lFilename: string);
Expand All @@ -484,6 +500,14 @@ procedure MESHLOAD(lFilename: string);
end;
end;


procedure ATLAS2NODE(lFilename: string);
begin
if not GLForm1.Atlas2Node(lFilename) then begin
GLForm1.ScriptOutputMemo.Lines.Add('Unable to convert labels to nodes (make sure .annot file is loaded)');
end;
end;

procedure MESHSAVE(lFilename: string);
begin
if not GLForm1.SaveMeshCore(lFilename) then begin
Expand Down
3 changes: 1 addition & 2 deletions define_types.pas
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface
{$endif}

const
kVers = 'v1.0.20190902';
kVers = 'v1.0.20191122 Beta';
NaN : double = 1/0;
kTab = chr(9);
kCR = chr (13);
Expand Down Expand Up @@ -169,7 +169,6 @@ function HomeDir: string; //set path to home if not provided
end;
{$ENDIF}


function DefaultToHomeDir(FileName: string; Force: boolean = false ): string; //set path to home if not provided
var
p,n,x: string;
Expand Down
49 changes: 27 additions & 22 deletions mainunit.lfm
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
object GLForm1: TGLForm1
Left = 553
Height = 514
Top = 102
Width = 691
Left = 187
Height = 671
Top = 170
Width = 1004
AllowDropFiles = True
Caption = 'Surf Ice'
ClientHeight = 514
ClientWidth = 691
ClientHeight = 671
ClientWidth = 1004
Menu = MainMenu1
OnChangeBounds = FormChangeBounds
OnClose = FormClose
Expand All @@ -18,15 +18,15 @@ object GLForm1: TGLForm1
LCLVersion = '2.1.0.0'
object ToolPanel: TScrollBox
Left = 0
Height = 514
Height = 671
Top = 0
Width = 261
HorzScrollBar.Page = 1
HorzScrollBar.Visible = False
VertScrollBar.Page = 514
VertScrollBar.Page = 671
Align = alLeft
BorderStyle = bsNone
ClientHeight = 514
ClientHeight = 671
ClientWidth = 246
Constraints.MaxWidth = 272
Constraints.MinWidth = 4
Expand Down Expand Up @@ -1532,7 +1532,7 @@ object GLForm1: TGLForm1
end
object LeftSplitter: TSplitter
Left = 261
Height = 514
Height = 671
Top = 0
Width = 6
OnCanOffset = LeftSplitterCanOffset
Expand All @@ -1542,9 +1542,9 @@ object GLForm1: TGLForm1
end
object CenterPanel: TPanel
Left = 267
Height = 514
Height = 671
Top = 0
Width = 416
Width = 729
Align = alClient
Constraints.MinHeight = 32
Constraints.MinWidth = 32
Expand All @@ -1553,41 +1553,41 @@ object GLForm1: TGLForm1
OnClick = CenterPanelClick
end
object RightSplitter: TSplitter
Left = 683
Height = 514
Left = 996
Height = 671
Top = 0
Width = 6
Align = alRight
ResizeAnchor = akRight
end
object ScriptPanel: TPanel
Left = 689
Height = 514
Left = 1002
Height = 671
Top = 0
Width = 2
Align = alRight
BevelOuter = bvNone
ClientHeight = 514
ClientHeight = 671
ClientWidth = 2
Constraints.MinWidth = 2
ParentFont = False
TabOrder = 0
OnDblClick = ScriptPanelDblClick
object ScriptBox: TGroupBox
Left = 0
Height = 514
Height = 671
Top = 0
Width = 2
Align = alClient
Caption = 'Scripting'
ClientHeight = 495
ClientHeight = 652
ClientWidth = 0
ParentFont = False
TabOrder = 0
OnDblClick = ScriptPanelDblClick
object ScriptMemo: TMemo
Left = 0
Height = 289
Height = 446
Top = 0
Width = 0
Align = alClient
Expand All @@ -1609,7 +1609,7 @@ object GLForm1: TGLForm1
object ScriptOutputMemo: TMemo
Left = 0
Height = 200
Top = 295
Top = 452
Width = 0
Align = alBottom
BorderStyle = bsNone
Expand All @@ -1626,7 +1626,7 @@ object GLForm1: TGLForm1
Cursor = crVSplit
Left = 0
Height = 6
Top = 289
Top = 446
Width = 0
Align = alBottom
ResizeAnchor = akBottom
Expand Down Expand Up @@ -1977,6 +1977,11 @@ object GLForm1: TGLForm1
Caption = 'Orientation cube'
OnClick = OrientCubeMenuClick
end
object ExitFullScreenMenu: TMenuItem
Caption = 'Exit Full Screen Mode'
Visible = False
OnClick = ExitFullScreenMenuClick
end
end
object ColorMenu: TMenuItem
Caption = 'Color'
Expand Down
Loading

0 comments on commit 8588ed2

Please sign in to comment.