Skip to content

Commit

Permalink
Segmentation optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
mfroeling committed Dec 31, 2024
1 parent 3e45d3c commit a61187d
Show file tree
Hide file tree
Showing 7 changed files with 1,283 additions and 3,938 deletions.
4 changes: 2 additions & 2 deletions QMRITools/Kernel/MaskingTools.wl
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ NormalizeData[data_, opts : OptionsPattern[]] := Block[{ndat, mask},
mask = Mask[NormDat[ndat - Min@ndat, 0.]];
NormalizeData[data, mask, opts]
,
NormDatC[data]
Quiet@NormDatC[data]
]
]

Expand All @@ -194,7 +194,7 @@ NormDatC = Compile[{{dat, _Real, 3}}, Block[{fl, min, max, bins, cdf, n, tot},
n = 1024;
fl = Flatten[dat];
{min, max} = MinMax[fl];
If[min == max, dat,
If[min === max, dat,
bins = BinCounts[fl, {min, max, (max - min)/n}];
bins[[1]] = 0.;
tot = Total[bins];
Expand Down
321 changes: 204 additions & 117 deletions QMRITools/Kernel/SegmentationTools.wl

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions QMRITools/Kernel/SpectroTools.wl
Original file line number Diff line number Diff line change
Expand Up @@ -2191,8 +2191,8 @@ SyntaxInformation[ImportSparSdat] = {"ArgumentsPattern" -> {_, _}};

ImportSparSdat[fspar_,fsdat_]:=Block[{nums,head,depth,row,nsamp,x,y,z,bw,te,nuc,gyro,field,fids,specs},
(*read raw data and header*)
nums=FromVaxD[bin=BinaryReadList[fsdat,"UnsignedInteger32"]];
head=ParseSpar[Import[fspar,"Lines"]];
nums=FromVaxD[BinaryReadList[fsdat, "UnsignedInteger32"]];
head=ParseSpar[Import[fspar, "Lines"]];

(*get header infor*)
{bw,te,nuc,gyro}={"sample_frequency","spectrum_echo_time","nucleus","synthesizer_frequency"}/.head;
Expand Down
6 changes: 5 additions & 1 deletion QMRITools/Kernel/TractographyTools.wl
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,11 @@ FiberTractography[tensor_, vox:{_?NumberQ,_?NumberQ,_?NumberQ}, inp : {{_, {_, _

step = N@If[NumberQ[step],step, Min[0.5 vox]];
maxStep = Ceiling[(maxLength/step)];
tractF = Switch[OptionValue[Method], "RungeKutta" | "RK" | "RK2", RK2, "RungeKutta4" | "RK4", RK4, _, Euler];
tractF = Switch[OptionValue[Method],
"RungeKutta" | "RK" | "RK2", RK2,
"RungeKutta4" | "RK4", RK4,
_, Euler
];

(*prepare tensor and stop data, remove background for performance and make int functions*)
dim = Rest@Dimensions@tensor;
Expand Down
2 changes: 1 addition & 1 deletion QMRITools/PacletInfo.wl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

PacletObject[<|
"Name" -> "QMRITools",
"Version" -> "4.1.2",
"Version" -> "4.1.3",
"WolframVersion" -> "14.0+",
"SystemID" -> All,

Expand Down
4,735 changes: 994 additions & 3,741 deletions QMRITools/Resources/Demonstrations.nb

Large diffs are not rendered by default.

Loading

0 comments on commit a61187d

Please sign in to comment.