Commit bf2ba914 authored by Andrey Filippov's avatar Andrey Filippov

CLAUDE: Add MAX-over-v locator slice to -HYPER-RECT

Prepend velocity index 0 = max over all velocities (per scene, per pixel) to
showConvKernel5dHyperRect, and scale the display range to that slice instead
of the fixed IMP_MINMAX, so the small (~0.1) maxima are visible on open. It is
the first slice ImageJ shows - a quick map of non-empty pixels before scanning
scenes (Z) and velocities (T). Applies to both -HYPER-RECT and -DNN-HYPER-RECT.
Co-authored-by: 's avatarClaude Opus 4.8 (1M context) <noreply@anthropic.com>
parent 134a5bdb
...@@ -1685,16 +1685,20 @@ public class CuasRTUtils { ...@@ -1685,16 +1685,20 @@ public class CuasRTUtils {
scene_titles[i] = String.format("scene-%03d", i); scene_titles[i] = String.format("scene-%03d", i);
} }
} }
String[] v_titles = new String[num_vout]; // Extra leading velocity slice (index 0) = max over all velocities, a quick locator // By Claude on 06/13/2026
// of non-empty pixels. It is the first slice ImageJ shows, and the display range below
// is scaled to it so the small (~0.1) maxima are immediately visible on open.
String[] v_titles = new String[num_vout + 1];
v_titles[0] = "MAX (all v)";
for (int nvout = 0; nvout < num_vout; nvout++) { for (int nvout = 0; nvout < num_vout; nvout++) {
int vout_v = nvout / vout_dim - vout_rad; int vout_v = nvout / vout_dim - vout_rad;
int vout_h = nvout % vout_dim - vout_rad; int vout_h = nvout % vout_dim - vout_rad;
v_titles[nvout] = nvout + " (" + ((vout_v > 0) ? "+" : "") + vout_v + v_titles[nvout + 1] = nvout + " (" + ((vout_v > 0) ? "+" : "") + vout_v +
":" + ((vout_h > 0) ? "+" : "") + vout_h + ")"; ":" + ((vout_h > 0) ? "+" : "") + vout_h + ")";
} }
// outer dim = velocities (T = bottom slider), inner dim = scenes (Z = second slider) // outer dim = velocities (T = bottom slider; index 0 = MAX-over-v), inner dim = scenes (Z = second slider)
double [][][] pixels_hyper = new double [num_vout][num_scenes][img_width * img_height]; double [][][] pixels_hyper = new double [num_vout + 1][num_scenes][img_width * img_height];
for (double [][] d2 : pixels_hyper) for (double [] d1 : d2) Arrays.fill(d1, Double.NaN); for (double [][] d2 : pixels_hyper) for (double [] d1 : d2) Arrays.fill(d1, Double.NaN);
for (int nscene = 0; nscene < num_scenes; nscene++) { for (int nscene = 0; nscene < num_scenes; nscene++) {
...@@ -1712,23 +1716,36 @@ public class CuasRTUtils { ...@@ -1712,23 +1716,36 @@ public class CuasRTUtils {
int ix = px_roi * sub_dim + sx; int ix = px_roi * sub_dim + sx;
int iy = py_roi * sub_dim + sy; int iy = py_roi * sub_dim + sy;
int img_pix = iy * img_width + ix; int img_pix = iy * img_width + ix;
double vmax = Double.NEGATIVE_INFINITY; // By Claude on 06/13/2026
for (int v_out_idx = 0; v_out_idx < num_vout; v_out_idx++) { for (int v_out_idx = 0; v_out_idx < num_vout; v_out_idx++) {
pixels_hyper[v_out_idx][nscene][img_pix] = pix_data[sub_idx][v_out_idx]; double v = pix_data[sub_idx][v_out_idx];
pixels_hyper[v_out_idx + 1][nscene][img_pix] = v; // velocities shifted by 1
if (v > vmax) vmax = v;
} }
pixels_hyper[0][nscene][img_pix] = vmax; // leading MAX-over-v slice
} }
} }
} }
} }
} }
// Display range from the MAX-over-v slice (the one that opens first), so non-empty // By Claude on 06/13/2026
// pixels are auto-visible; velocity slices share it (their values are <= the max).
double disp_min = Double.POSITIVE_INFINITY, disp_max = Double.NEGATIVE_INFINITY;
for (double [] sc : pixels_hyper[0]) for (double v : sc) if (!Double.isNaN(v)) {
if (v < disp_min) disp_min = v;
if (v > disp_max) disp_max = v;
}
if (!(disp_max > disp_min)) { disp_min = IMP_MINMAX[0]; disp_max = IMP_MINMAX[1]; } // fallback (empty/flat)
ImagePlus imp = ShowDoubleFloatArrays.showArraysHyperstack( ImagePlus imp = ShowDoubleFloatArrays.showArraysHyperstack(
pixels_hyper, // double[num_vout][num_scenes][img_w*img_h] pixels_hyper, // double[num_vout+1][num_scenes][img_w*img_h]
img_width, img_width,
title, title,
scene_titles, // Z slider (second) scene_titles, // Z slider (second)
v_titles, // T slider (bottom) v_titles, // T slider (bottom)
false); false);
imp.setDisplayRange(IMP_MINMAX[0], IMP_MINMAX[1]); imp.setDisplayRange(disp_min, disp_max);
return imp; return imp;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment