Skip to content

Commit

Permalink
Fix date-to-str month/minute
Browse files Browse the repository at this point in the history
  • Loading branch information
neurolabusc committed Oct 7, 2016
1 parent cd84da9 commit 8f7e875
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 86 deletions.
133 changes: 67 additions & 66 deletions npm/npm.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<EditorIndex Value="1"/>
<TopLine Value="1108"/>
<CursorPos X="25" Y="1109"/>
<TopLine Value="1106"/>
<CursorPos Y="1114"/>
<UsageCount Value="208"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
Expand Down Expand Up @@ -236,8 +236,8 @@
<Unit26>
<Filename Value="..\common\define_types.pas"/>
<EditorIndex Value="12"/>
<TopLine Value="24"/>
<CursorPos X="6" Y="31"/>
<TopLine Value="64"/>
<CursorPos X="38" Y="85"/>
<UsageCount Value="87"/>
<Loaded Value="True"/>
</Unit26>
Expand Down Expand Up @@ -289,18 +289,18 @@
</Unit34>
<Unit35>
<Filename Value="unpm.pas"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="4"/>
<TopLine Value="92"/>
<CursorPos X="155" Y="111"/>
<TopLine Value="288"/>
<CursorPos X="11" Y="307"/>
<UsageCount Value="92"/>
<Loaded Value="True"/>
</Unit35>
<Unit36>
<Filename Value="turbolesion.pas"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="6"/>
<TopLine Value="346"/>
<CursorPos X="56" Y="353"/>
<TopLine Value="303"/>
<CursorPos X="44" Y="335"/>
<UsageCount Value="87"/>
<Loaded Value="True"/>
</Unit36>
Expand Down Expand Up @@ -347,123 +347,124 @@
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="brunner.pas"/>
<Caret Line="639" Column="20" TopLine="609"/>
<Filename Value="turbolesion.pas"/>
<Caret Line="431" Column="96" TopLine="399"/>
</Position1>
<Position2>
<Filename Value="LesionStatThds.pas"/>
<Caret Line="690" Column="17" TopLine="661"/>
<Filename Value="turbolesion.pas"/>
<Caret Line="512" Column="44" TopLine="475"/>
</Position2>
<Position3>
<Filename Value="brunner.pas"/>
<Caret Line="32" Column="20" TopLine="23"/>
<Filename Value="turbolesion.pas"/>
<Caret Line="513" Column="83" TopLine="481"/>
</Position3>
<Position4>
<Filename Value="brunner.pas"/>
<Caret Line="670" Column="32" TopLine="651"/>
<Filename Value="turbolesion.pas"/>
<Caret Line="77" Column="49" TopLine="58"/>
</Position4>
<Position5>
<Filename Value="brunner.pas"/>
<Caret Line="19" Column="32"/>
<Filename Value="npmform.pas"/>
<Caret Line="1110" Column="34" TopLine="1108"/>
</Position5>
<Position6>
<Filename Value="brunner.pas"/>
<Caret Line="20" Column="27"/>
<Filename Value="npmform.pas"/>
<Caret Line="1409" Column="57" TopLine="1378"/>
</Position6>
<Position7>
<Filename Value="brunner.pas"/>
<Caret Line="21" Column="28"/>
<Filename Value="npmform.pas"/>
<Caret Line="1522" Column="48" TopLine="1490"/>
</Position7>
<Position8>
<Filename Value="brunner.pas"/>
<Caret Line="89" Column="29" TopLine="57"/>
<Filename Value="npmform.pas"/>
<Caret Line="1589" Column="19" TopLine="1557"/>
</Position8>
<Position9>
<Filename Value="brunner.pas"/>
<Caret Line="668" Column="31" TopLine="636"/>
<Filename Value="npmform.pas"/>
<Caret Line="1909" Column="43" TopLine="1877"/>
</Position9>
<Position10>
<Filename Value="brunner.pas"/>
<Caret Line="22" Column="28"/>
<Filename Value="npmform.pas"/>
<Caret Line="1960" Column="48" TopLine="1928"/>
</Position10>
<Position11>
<Filename Value="brunner.pas"/>
<Caret Line="101" Column="28" TopLine="69"/>
<Filename Value="npmform.pas"/>
<Caret Line="1961" Column="24" TopLine="1960"/>
</Position11>
<Position12>
<Filename Value="brunner.pas"/>
<Caret Line="110" Column="31" TopLine="79"/>
<Filename Value="npmform.pas"/>
<Caret Line="1998" Column="47" TopLine="1967"/>
</Position12>
<Position13>
<Filename Value="brunner.pas"/>
<Caret Line="126" Column="26" TopLine="95"/>
<Filename Value="npmform.pas"/>
<Caret Line="2049" Column="51" TopLine="2017"/>
</Position13>
<Position14>
<Filename Value="brunner.pas"/>
<Caret Line="127" Column="26" TopLine="96"/>
<Filename Value="unpm.pas"/>
<Caret Line="94" Column="43" TopLine="92"/>
</Position14>
<Position15>
<Filename Value="brunner.pas"/>
<Caret Line="140" Column="44" TopLine="109"/>
<Filename Value="unpm.pas"/>
<Caret Line="307" Column="11" TopLine="275"/>
</Position15>
<Position16>
<Filename Value="brunner.pas"/>
<Caret Column="35"/>
<Filename Value="unpm.pas"/>
<Caret Line="689" Column="52" TopLine="658"/>
</Position16>
<Position17>
<Filename Value="brunner.pas"/>
<Caret Line="14" Column="15"/>
<Filename Value="unpm.pas"/>
<Caret Line="808" Column="48" TopLine="776"/>
</Position17>
<Position18>
<Filename Value="LesionStatThds.pas"/>
<Caret Line="47" Column="68" TopLine="42"/>
<Filename Value="unpm.pas"/>
<Caret Line="891" Column="45" TopLine="859"/>
</Position18>
<Position19>
<Filename Value="LesionStatThds.pas"/>
<Caret Line="724" Column="48" TopLine="694"/>
<Filename Value="unpm.pas"/>
<Caret Line="1031" Column="48" TopLine="999"/>
</Position19>
<Position20>
<Filename Value="LesionStatThds.pas"/>
<Caret Line="542" Column="16" TopLine="524"/>
<Filename Value="unpm.pas"/>
<Caret Line="1154" Column="2" TopLine="1116"/>
</Position20>
<Position21>
<Filename Value="LesionStatThds.pas"/>
<Caret Line="632" Column="50" TopLine="630"/>
<Filename Value="unpm.pas"/>
<Caret Line="1253" Column="48" TopLine="1221"/>
</Position21>
<Position22>
<Filename Value="LesionStatThds.pas"/>
<Filename Value="unpm.pas"/>
<Caret Line="1313" Column="45" TopLine="1281"/>
</Position22>
<Position23>
<Filename Value="LesionStatThds.pas"/>
<Caret Line="3" Column="126"/>
<Filename Value="unpm.pas"/>
<Caret Line="1361" Column="48" TopLine="1329"/>
</Position23>
<Position24>
<Filename Value="LesionStatThds.pas"/>
<Caret Line="562" Column="7" TopLine="528"/>
<Filename Value="unpm.pas"/>
<Caret Line="307" Column="11" TopLine="288"/>
</Position24>
<Position25>
<Filename Value="npmform.pas"/>
<Caret Line="1133" Column="13" TopLine="1131"/>
<Caret Line="1371" Column="35" TopLine="1371"/>
</Position25>
<Position26>
<Filename Value="npmform.pas"/>
<Caret Line="1140" Column="35" TopLine="1131"/>
<Caret Line="131" Column="21" TopLine="112"/>
</Position26>
<Position27>
<Filename Value="npmform.pas"/>
<Caret Line="377" Column="34" TopLine="358"/>
<Filename Value="turbolesion.pas"/>
<Caret Line="282" Column="11" TopLine="258"/>
</Position27>
<Position28>
<Filename Value="npmform.pas"/>
<Caret Line="1140" Column="35" TopLine="1108"/>
<Filename Value="turbolesion.pas"/>
<Caret Line="312" Column="48" TopLine="306"/>
</Position28>
<Position29>
<Filename Value="npmform.pas"/>
<Caret Line="377" Column="34" TopLine="358"/>
<Filename Value="turbolesion.pas"/>
<Caret Line="433" Column="28" TopLine="411"/>
</Position29>
<Position30>
<Filename Value="unpm.pas"/>
<Caret Line="1173" Column="3" TopLine="1173"/>
<Filename Value="turbolesion.pas"/>
<Caret Line="289" Column="26" TopLine="263"/>
</Position30>
</JumpHistory>
</ProjectOptions>
Expand Down
15 changes: 9 additions & 6 deletions npm/npmform.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1112,14 +1112,17 @@ procedure doVLSM(lBinomial: boolean; VALFilename, lMaskFilename,lOutFilename: st
end; *)


procedure TMainForm.FormShow(Sender: TObject);
begin

NPMMsgClear;
InitFact;
NPMMsg(GetkVers);
{$IFNDEF UNIX} {GUILaunch;}{$ENDIF}
LongTimeFormat := 'YYYY-MMM-DD hh:nn:ss'; //delphi TimeToStr
ShortTimeFormat := 'YYYY-MMM-DD hh:nn:ss'; //freepascal TimeToStr
//LongTimeFormat := 'YYYY-MMM-DD hh:nn:ss'; //delphi TimeToStr
LongTimeFormat := 'dd-mmmm-yyyy hh:nn:ss';
//ShortTimeFormat := 'YYYY-MMM-DD hh:nn:ss'; //freepascal TimeToStr
//{$IFDEF FPC}{$IFNDEF UNIX} ReadParamStr; {$ENDIF} {$ENDIF}
{$IFDEF benchmark}
//MonteCarloSimulation1.visible := true;
Expand Down Expand Up @@ -1406,7 +1409,7 @@ function TMainForm.FirthNPMAnalyze (var lImages: TStrings; var lPredictorList: T
gnCPUThreads := 1;
{$ENDIF}
NPMMsg('Permutations = ' +IntToStr(lnPermute));
NPMMsg('Logisitic Regression began = ' +TimeToStr(Now));
//NPMMsg('Logisitic Regression began = ' +TimeToStr(Now));
lTotalMemory := 0;
lVolVox := lMaskHdr.NIFTIhdr.dim[1]*lMaskHdr.NIFTIhdr.dim[2]* lMaskHdr.NIFTIhdr.dim[3];
if (lVolVox < 1) then goto 667;
Expand Down Expand Up @@ -1519,7 +1522,7 @@ function TMainForm.FirthNPMAnalyze (var lImages: TStrings; var lPredictorList: T
freemem(lOutImgSum);
freemem(lObsp);
freemem(lPlankImg);
NPMMsg('Analysis finished = ' +TimeToStr(Now));
//NPMMsg('Analysis finished = ' +TimeToStr(Now));
lOutNameMod := ChangeFilePostfixExt(lOutName,'Notes','.txt');
NPMMsgSave(lOutNameMod);

Expand Down Expand Up @@ -1995,7 +1998,7 @@ procedure TMainForm.ROIanalysis1Click(Sender: TObject);
end;
NPMMsgClear;
NPMMsg(GetKVers);
NPMmsg('Analysis began = ' +TimeToStr(Now));
//NPMmsg('Analysis began = ' +TimeToStr(Now));
NPMMsg('VAL file name: '+MainForm.OpenHdrDlg.Filename);
NPMMsg('Number of participants: '+inttostr(lnSubj));
NPMMsg('Number of factors: '+inttostr(lnFactors));
Expand Down Expand Up @@ -2046,7 +2049,7 @@ procedure TMainForm.ROIanalysis1Click(Sender: TObject);
lImageNames.Free;
lPredictorList.Free;
DeleteDecompressed4D(lTemp4D);
NPMmsg('Analysis finished = ' +TimeToStr(Now));
//NPMmsg('Analysis finished = ' +TimeToStr(Now));
end;


Expand Down
37 changes: 31 additions & 6 deletions npm/turbolesion.pas
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function MakeSum (var lImages: TStrings; var lMaskHdr: TMRIcroHdr; var lSumImg:
if lVolImg^[lVox] <> 0 then
lSumImg^[lVox] := lSumImg^[lVox]+1;
end;//for each image
NPMmsg('Sum image finished = ' +TimeToStr(Now));
//NPMmsg('Sum image finished = ' +TimeToStr(Now));
NPMProgressBar(0);
//Debog(lSumImg, lVolVox);
freemem(lVolImg);
Expand Down Expand Up @@ -271,7 +271,22 @@ procedure PtoZpermute (lnPermute: integer; lPermuteMaxT, lPermuteMinT: singlep);
end;
{$ENDIF}

(*{$IFDEF FPC}
function NowStr: string;
var
Fmt: string;
begin
Fmt := 'dd mmmm yyyy hh:nn:ss';
DateTimeToString (result,Fmt,Now);
end;
{$ENDIF}*)

{$IFDEF FPC} //TimeToStr is defective in FPC 3.0.0
function TimeToStr(lTime: TDateTime) : string;
begin
DateTimeToString (result,LongTimeFormat,lTime);
end;
{$ENDIF}

function TurboLDM (var lImages: TStrings; var lMaskHdr: TMRIcroHdr;var lPrefs: TLDMPrefs ; var lSymptomRA: SingleP;var lFactname,lOutName: string): boolean;
label
Expand Down Expand Up @@ -314,8 +329,11 @@ function TurboLDM (var lImages: TStrings; var lMaskHdr: TMRIcroHdr;var lPrefs: T
exit;
end;
NPMmsg('Permutations = ' +IntToStr(lPrefs.nPermute));

NPMmsg('Analysis began = ' +TimeToStr(Now));
//{$IFDEF FPC}
//NPMmsg('Analysis began ' +NowStr);
//{$ELSE}
NPMmsg('Analysis began ' +TimeToStr(Now));
//{$ENDIF}
lVolVox := lMaskHdr.NIFTIhdr.dim[1]*lMaskHdr.NIFTIhdr.dim[2]* lMaskHdr.NIFTIhdr.dim[3];
if (lVolVox < 1) then goto 667;
if not MakeSum( lImages, lMaskHdr, lSumImg) then goto 667;
Expand Down Expand Up @@ -415,7 +433,11 @@ function TurboLDM (var lImages: TStrings; var lMaskHdr: TMRIcroHdr;var lPrefs: T
Application.processmessages;
sleep(30);
if (gThreadsRunning <> lPrevThreadsRunning) then begin
NPMmsg(' '+inttostr(gThreadsRunning)+' threads still running ' +TimeToStr(Now));
//{$IFDEF FPC}
//NPMmsg(' '+inttostr(gThreadsRunning)+' threads still running ' + NowStr);
//{$ELSE}
NPMmsg(' '+inttostr(gThreadsRunning)+' threads still running ' +TimeToStr(Now));
//{$ENDIF}
lPrevThreadsRunning := gThreadsRunning;
end;
until gThreadsRunning = 0;
Expand Down Expand Up @@ -490,11 +512,14 @@ function TurboLDM (var lImages: TStrings; var lMaskHdr: TMRIcroHdr;var lPrefs: T
//NPMmsgAppend('threshbm,'+inttostr(lPrefs.Run)+','+inttostr(MainForm.ThreshMap(lThreshBonf,lVolVox,lOutImgBM))+','+realtostr(lThreshNULP,3)+','+realtostr(lThreshPermute,3)+','+realtostr(lThreshBonf,3));
NIFTIhdr_SaveHdrImg(lOutNameMod,lStatHdr,true,not IsNifTiMagic(lMaskHdr.NIFTIhdr),true,lOutImgBM,1);
end;
NPMmsg('Analysis finished = ' +TimeToStr(Now));

{$IFNDEF FPC}
NPMmsg('Analysis finished = ' +TimeToStr(Now));
NPMmsg('Processing Time = ' +inttostr(round((GetTickCount - lStartTime)/1000)));
{$ELSE}
NPMmsg('Processing Time (seconds) = ' +inttostr(round(MilliSecondsBetween(Now, lStartTime)/1000)));
//NPMmsg('Analysis finished ' + NowStr);
NPMmsg('Analysis finished ' +TimeToStr(Now));
NPMmsg('Processing Time (seconds) ' +inttostr(round(MilliSecondsBetween(Now, lStartTime)/1000)));
{$ENDIF}

lOutNameMod := ChangeFilePostfixExt(lOutName,'Notes'+lFactName,'.txt');
Expand Down
Loading

0 comments on commit 8f7e875

Please sign in to comment.