Skip to content

Commit

Permalink
Windows 10 tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
neurolabusc committed Aug 1, 2018
1 parent ea019e7 commit 18beb40
Show file tree
Hide file tree
Showing 7 changed files with 290 additions and 270 deletions.
6 changes: 3 additions & 3 deletions commandsu.pas
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ procedure COLORBARVISIBLE (VISIBLE: boolean);
procedure COLORNAME(Filename: string);
procedure CONTRASTFORMVISIBLE (VISIBLE: boolean);
procedure CONTRASTMINMAX(MIN,MAX: single);
procedure CUTOUT (L,A,S,R,P,I: single);
procedure CUTOUT (L,A,S,R,P,I: double);
procedure CUTOUTFORMVISIBLE (VISIBLE: boolean);
procedure EDGEDETECT (lThresh: single; lDilateCycles: integer);//new
procedure EDGEENHANCE (BIAS,GAIN: byte);//new
Expand Down Expand Up @@ -141,7 +141,7 @@ procedure QUIT;
(Ptr:@COLORNAME;Decl:'COLORNAME';Vars:'(Filename: string)'),
(Ptr:@CONTRASTFORMVISIBLE;Decl:'CONTRASTFORMVISIBLE';Vars:'(VISIBLE: boolean)'),
(Ptr:@CONTRASTMINMAX;Decl:'CONTRASTMINMAX';Vars:'(MIN, MAX: single)'),
(Ptr:@CUTOUT;Decl:'CUTOUT';Vars:'(L,A,S,R,P,I: single)'),
(Ptr:@CUTOUT;Decl:'CUTOUT';Vars:'(L,A,S,R,P,I: double)'),
(Ptr:@CUTOUTFORMVISIBLE;Decl:'CUTOUTFORMVISIBLE';Vars:'(VISIBLE: boolean)'),
(Ptr:@EDGEDETECT;Decl:'EDGEDETECT';Vars:'(lThresh: single; lDilateCycles: integer)'),//new
(Ptr:@EDGEENHANCE;Decl:'EDGEENHANCE';Vars:'(BIAS,GAIN: byte)'),//new
Expand Down Expand Up @@ -852,7 +852,7 @@ procedure LINEWIDTH (W: byte);
ReRender(false);
end;

procedure CUTOUT (L,A,S,R,P,I: single);
procedure CUTOUT (L,A,S,R,P,I: double);
var
lMax: integer;
begin
Expand Down
198 changes: 100 additions & 98 deletions dcm2nii.lfm
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
object dcm2niiForm: Tdcm2niiForm
Left = 392
Height = 480
Top = 179
Width = 820
Left = 353
Height = 511
Top = 219
Width = 925
AllowDropFiles = True
Caption = 'dcm2niix'
ClientHeight = 453
ClientWidth = 820
ClientHeight = 511
ClientWidth = 925
Constraints.MinHeight = 120
Constraints.MinWidth = 640
Constraints.MinWidth = 720
Menu = MainMenu1
OnClose = FormClose
OnCreate = FormCreate
Expand All @@ -17,132 +17,134 @@ object dcm2niiForm: Tdcm2niiForm
OnShow = FormShow
Position = poScreenCenter
LCLVersion = '1.9.0.0'
object Panel1: TPanel
object Memo1: TMemo
Left = 0
Height = 34
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 = 820
Width = 925
Align = alTop
ClientHeight = 34
ClientWidth = 820
TabOrder = 0
object compressCheck: TCheckBox
Left = 86
AutoSize = True
ClientHeight = 35
ClientWidth = 925
TabOrder = 1
object CompressCheck: TCheckBox
Left = 1
Height = 18
Top = 9
Width = 18
Checked = True
Hint = 'Create gz images (smaller but slower)'
Top = 8
Width = 80
Caption = 'Compress'
OnClick = compressCheckClick
ParentBidiMode = False
State = cbChecked
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
Left = 264
Height = 19
Top = 10
Width = 108
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
Left = 376
Height = 29
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 = 6
Top = 7
Width = 164
BorderSpacing.Left = 4
OnKeyUp = outnameEditKeyUp
ParentShowHint = False
ShowHint = True
TabOrder = 1
Text = 'outnameEdit'
end
object Label2: TLabel
Left = 2
Height = 19
Hint = 'Set whether NIfTI images are compressed (.nii.gz) or not (.nii)'
Top = 10
Width = 80
Caption = 'Compress'
ParentColor = False
ParentShowHint = False
ShowHint = True
TabOrder = 3
Text = '%p_%s'
end
object outputFolderLabel: TLabel
Left = 548
Height = 19
Top = 10
Width = 107
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
Left = 660
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 = 2
end
object VerboseLabel: TLabel
Left = 106
Height = 19
Hint = 'Set whether NIfTI images are compressed (.nii.gz) or not (.nii)'
Top = 10
Width = 65
Caption = 'Verbose'
ParentColor = False
ParentShowHint = False
ShowHint = True
end
object verboseCheck: TCheckBox
Left = 176
Height = 18
Top = 9
Width = 18
OnClick = compressCheckClick
ParentBidiMode = False
TabOrder = 3
end
object bidsCheck: TCheckBox
Left = 238
Height = 18
Top = 8
Width = 18
OnClick = compressCheckClick
ParentBidiMode = False
TabOrder = 4
end
object VerboseLabel1: TLabel
Left = 196
Height = 19
Hint = 'Create Brain Imaging Data Structure file'
Top = 10
Width = 38
Caption = 'BIDS'
ParentColor = False
ParentShowHint = False
ShowHint = True
end
end
object Memo1: TMemo
Left = 0
Height = 419
Top = 34
Width = 820
Align = alClient
ScrollBars = ssAutoVertical
TabOrder = 1
end
object MainMenu1: TMainMenu
left = 24
top = 48
left = 96
top = 200
object FileMenu: TMenuItem
Caption = 'File'
object DicomMenu: TMenuItem
Expand All @@ -169,7 +171,7 @@ object dcm2niiForm: Tdcm2niiForm
object OpenDialog1: TOpenDialog
Filter = 'Philips research (*.par)|*.PAR;*.par'
Options = [ofAllowMultiSelect, ofEnableSizing, ofViewDetail]
left = 96
top = 48
left = 168
top = 208
end
end
38 changes: 17 additions & 21 deletions dcm2nii.pas
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,25 @@ interface
type
{ Tdcm2niiForm }
Tdcm2niiForm = class(TForm)
compressCheck: TCheckBox;
CompressCheck: TCheckBox;
verboseCheck: TCheckBox;
bidsCheck: TCheckBox;
outnameEdit: TEdit;
outnameLabel: TLabel;
outputFolderLabel: TLabel;
outputFolderName: TButton;
Panel2: TPanel;
MainMenu1: TMainMenu;
FileMenu: TMenuItem;
EditMenu: TMenuItem;
CopyMenu: TMenuItem;
DicomMenu: TMenuItem;
ResetMenu: TMenuItem;
ParRecMenu: TMenuItem;
outputFolderName: TButton;
//compressCheck: TCheckBox;
Label2: TLabel;
outputFolderLabel: TLabel;
outnameLabel: TLabel;
Memo1: TMemo;
Panel1: TPanel;
OpenDialog1: TOpenDialog;
outnameEdit: TEdit;
VerboseCheck: TCheckBox;
//bidsCheck: TCheckBox;
VerboseLabel: TLabel;
VerboseLabel1: TLabel;
bidsCheck: TCheckBox;
//VerboseLabel1: TLabel;
//verboseCheck: TCheckBox;
//verboseCheck1: TCheckBox;
//VerboseLabel: TLabel;
procedure compressCheckClick(Sender: TObject);
procedure DicomMenuClick(Sender: TObject);
Expand Down Expand Up @@ -94,7 +89,7 @@ implementation
var
isAppDoneInitializing : boolean = false;

{$IFDEF FPC}
{$IFDEF UNIX}
function FindDefaultExecutablePathX(const Executable: string): string;
begin
{$IFDEF Darwin}
Expand All @@ -120,7 +115,8 @@ function Tdcm2niiForm.getExeName : string;
if not fileexists(result) then begin
lF := ExtractFilePath (paramstr(0));
result := lF+kExeName;
if not fileexists(result) then begin
{$IFNDEF UNIX}result := result + '.exe'; {$ENDIF}
if not fileexists(result) then begin
Memo1.Lines.Clear;
memo1.Lines.Add('Error: unable to find executable '+kExeName+' in path');
memo1.Lines.Add(' Solution: copy '+kExeName+' to '+lF);
Expand All @@ -145,7 +141,7 @@ procedure Tdcm2niiForm.writeIni;
FileMode := fmOpenWrite;
AssignFile(iniFile, iniName);
ReWrite(iniFile);
if (compressCheck.checked) then
if (CompressCheck.checked) then
WriteLn(iniFile, 'isGZ=1')
else
WriteLn(iniFile, 'isGZ=0');
Expand Down Expand Up @@ -194,7 +190,7 @@ procedure Tdcm2niiForm.readIni (ForceReset: boolean);
fileData.Free;
end else
memo1.Lines.Add('Using default settings');
compressCheck.Checked := opts_isGz;
CompressCheck.Checked := opts_isGz;
bidsCheck.Checked := opts_isBids;
outnameEdit.Caption := opts_filename;
//getExeName;
Expand All @@ -208,7 +204,7 @@ procedure Tdcm2niiForm.writeIni;
ARegistry := TRegistry.Create;
ARegistry.RootKey := HKEY_CURRENT_USER;//HKEY_LOCAL_MACHINE;
if ARegistry.OpenKey ('\Software\dcm2nii',true) then begin
ARegistry.WriteBool('isGZ', compressCheck.Checked );
ARegistry.WriteBool('isGZ', CompressCheck.Checked );
ARegistry.WriteBool('isBIDS', bidsCheck.Checked );
ARegistry.WriteString('filename', outnameEdit.text );
end;
Expand Down Expand Up @@ -238,7 +234,7 @@ procedure Tdcm2niiForm.readIni (ForceReset: boolean);
ARegistry.Free;
end;
bidsCheck.Checked := opts_isBids;
compressCheck.Checked := opts_isGz;
CompressCheck.Checked := opts_isGz;
outnameEdit.text := opts_filename;
//getExeName;
end; //readIni()
Expand Down Expand Up @@ -400,7 +396,7 @@ procedure Tdcm2niiForm.ProcessFile(infilename: string);
cmd := cmd + '-b y '
else
cmd := cmd + '-b n ';
if compressCheck.checked then
if CompressCheck.checked then
cmd := cmd + '-z y '
else
cmd := cmd + '-z n ';
Expand Down
Loading

0 comments on commit 18beb40

Please sign in to comment.