Got an error message when running ct_FIRE.m with the images below:
fiber_image_2.tif
fiber_image_3.tif
Error message being:
fiberproc
linking fibers (5) - 1, ctFIRE on reconstruction image is skipped, error message:Index exceeds the number of array elements. Index must not exceed 0.
These have been generated using the synthetic fiber generator. The diagnosis (by AI, so with a grain of salt), states that these caused an error due to brightness generating an increased number of nucleation points in the background, triggering the n > 2 if statement more than once.
Debugged through:
diff --git a/src/FIRE/fiberproc/fiberproc.m b/src/FIRE/fiberproc/fiberproc.m
index b71cab0..f56d785 100644
--- a/src/FIRE/fiberproc/fiberproc.m
+++ b/src/FIRE/fiberproc/fiberproc.m
@@ -75,6 +75,10 @@
%GETVECT - gets the fiber orientation vector that starts at the end
%vertex i and points along the fiber
len = length(fiber);
+ if isempty(fiber) % ADD THIS GUARD
+ vect = zeros(1,3);
+ return;
+ end
if fiber(1)==vi %if the fiber starts at vertex i
ii = min(sp,len);
vj = fiber(ii);
@@ -278,8 +282,12 @@
fk = fe(2);
fiber1 = F(fj).v;
fiber2 = F(fk).v;
- vect1 = getvect(X,vi,fiber1,sp);
- vect2 = getvect(X,vi,fiber2,sp);
+ if isempty(fiber1) || isempty(fiber2)
+ % skip -- stale fe entry points to already-merged fiber
+ else
+ vect1 = getvect(X,vi,fiber1,sp);
+ vect2 = getvect(X,vi,fiber2,sp);
+ end
a = dot(vect1,vect2);
if a < thresha
if plotflag==1
@@ -294,13 +302,16 @@
end
elseif n > 2 %if the vi end of fiber i touches another fiber
fe = V(vi).fe;
+ A = zeros(n, n);
for j=1:n-1
fj = fe(j);
fiber1 = F(fj).v;
+ if isempty(fiber1), continue; end % GUARD
vect1 = getvect(X,vi,fiber1,sp);
for k=j+1:n
fk = fe(k);
fiber2 = F(fk).v;
+ if isempty(fiber2), continue; end % GUARD
vect2 = getvect(X,vi,fiber2,sp);
A(j,k)= dot(vect1,vect2);
end
This has been diagnosed by comparing with fiber_image_1.tif, which has successfully been run but was also generated using the synthetic fiber generator.
Got an error message when running ct_FIRE.m with the images below:
fiber_image_2.tif
fiber_image_3.tif
Error message being:
These have been generated using the synthetic fiber generator. The diagnosis (by AI, so with a grain of salt), states that these caused an error due to brightness generating an increased number of nucleation points in the background, triggering the
n > 2if statement more than once.Debugged through:
This has been diagnosed by comparing with fiber_image_1.tif, which has successfully been run but was also generated using the synthetic fiber generator.