Commit ab8971fa authored by Andrey Filippov's avatar Andrey Filippov

CLAUDE: Add showConvKernel5dHyperRect() and -HYPER-RECT output

CuasRTUtils: new showConvKernel5dHyperRect(data, roi, scene_titles, title)
  - ImageJ hyperstack [num_vout][num_scenes][roi_w*sub_dim × roi_h*sub_dim]
  - Bottom slider (T): 121 velocities labelled "+vy:+vx"
  - Second slider (Z): scenes
  - Sub-pixels spatially embedded (no NaN separator grid)

CuasDetectRT: add HYPER-RECT save immediately after each RECT save block
  (level-0 and pyramid loop), suffix "-HYPER-RECT" / "-LEV{n}-HYPER-RECT"
Co-authored-by: 's avatarClaude <claude@elphel.com>
parent b4bfe9b1
...@@ -171,6 +171,7 @@ public class CuasDetectRT { ...@@ -171,6 +171,7 @@ public class CuasDetectRT {
boolean curt_save_c5full = clt_parameters.imp.curt_save_c5full; boolean curt_save_c5full = clt_parameters.imp.curt_save_c5full;
boolean curt_save_c5rect = clt_parameters.imp.curt_save_c5rect; boolean curt_save_c5rect = clt_parameters.imp.curt_save_c5rect;
Rectangle curt_save_select = clt_parameters.imp.curt_save_select; Rectangle curt_save_select = clt_parameters.imp.curt_save_select;
final double min_frac_last = 0.1; // make parameter
// Initialize LoG and other kernel parameters, calculate LoG first, show results // Initialize LoG and other kernel parameters, calculate LoG first, show results
int kernel3d3_rad = 1; int kernel3d3_rad = 1;
...@@ -187,14 +188,23 @@ public class CuasDetectRT { ...@@ -187,14 +188,23 @@ public class CuasDetectRT {
getHeight()); // int height) getHeight()); // int height)
// For testing, create whole arrays? // For testing, create whole arrays?
boolean save_LoG = debugLevel> -4; boolean save_LoG = debugLevel> -4;
boolean save_5d = debugLevel> -4;
boolean save_LoG_pixels = debugLevel> -4; boolean save_LoG_pixels = debugLevel> -4;
boolean save_3d3_pixels = debugLevel> -4; boolean save_3d3_pixels = debugLevel> -4;
int num_hist_5d = cuasRTUtils.getNumHist();
if (save_LoG) { if (save_LoG) {
String title_log = getBaseName()+SUFFIX_LOG+"-PSF"+d2s(cuasRTUtils.getPsfRadius())+"-KR"+d2s(cuasRTUtils.getKernel2dRadius()); String title_log = getBaseName()+SUFFIX_LOG+"-PSF"+d2s(cuasRTUtils.getPsfRadius())+"-KR"+d2s(cuasRTUtils.getKernel2dRadius());
ImagePlus imp_log = cuasRTUtils.showKernel2d(title_log); ImagePlus imp_log = cuasRTUtils.showKernel2d(title_log);
QuadCLTCPU.saveImagePlusInDirectory(imp_log,getModelDirectory()); QuadCLTCPU.saveImagePlusInDirectory(imp_log,getModelDirectory());
} }
if (save_5d) {
String title_5d = getBaseName()+SUFFIX_CONV5D+
"-NH"+num_hist_5d+
"-VR"+curt_vel_radius+"-VD"+curt_vel_decimate;
ImagePlus imp_5d = cuasRTUtils.showKernel5d(title_5d);
QuadCLTCPU.saveImagePlusInDirectory(imp_5d,getModelDirectory());
}
double [][] dpixels = getDPpixels(); double [][] dpixels = getDPpixels();
double [][] dpixels_log = new double [dpixels.length][dpixels[0].length]; double [][] dpixels_log = new double [dpixels.length][dpixels[0].length];
double [] kernel2d = cuasRTUtils.getKernel2d(); double [] kernel2d = cuasRTUtils.getKernel2d();
...@@ -282,12 +292,15 @@ public class CuasDetectRT { ...@@ -282,12 +292,15 @@ public class CuasDetectRT {
alpha_pyr); // final double alpha) alpha_pyr); // final double alpha)
} }
// System.arraycopy(dpixels_log, 1, dpixels_pyramid[0], 0, dpixels_pyramid[0].length); // System.arraycopy(dpixels_log, 1, dpixels_pyramid[0], 0, dpixels_pyramid[0].length);
int center9 = 4; // int center9 = 4;
int num_hist_5d = cuasRTUtils.getNumHist();
boolean save_5d_pixels = curt_save_c5full; // debugLevel > -4; boolean save_5d_pixels = curt_save_c5full; // debugLevel > -4;
String title_conv5d = getBaseName()+SUFFIX_CONV5D+"-PSF"+d2s(cuasRTUtils.getPsfRadius())+ String title_conv5d = getBaseName()+SUFFIX_CONV5D+"-PSF"+d2s(cuasRTUtils.getPsfRadius())+
"-KR"+d2s(cuasRTUtils.getKernel2dRadius())+"-NHIST"+num_hist_5d+ "-KR"+d2s(cuasRTUtils.getKernel2dRadius())+"-A0_"+d2s(alpha0)+
"-VELRAD"+curt_vel_radius+"-VELDEC"+curt_vel_decimate; "-AP_"+d2s(alpha_pyr)+"-M"+curt_3d3_mode+"-F"+d2s(curt_3d3_frac)+"-T"+d2s(curt_3d3_thrsh)+"-P"+d2s(curt_3d3_power)+
"-N"+d2s(w3d3_now)+":"+d2s(w3d3_prev)+
"-A1_"+d2s(alpha1)+
"-NH"+num_hist_5d+
"-VR"+curt_vel_radius+"-VD"+curt_vel_decimate+"-MF"+min_frac_last;
// Level-0 5D convolution (fine velocity from coarse-velocity history) // Level-0 5D convolution (fine velocity from coarse-velocity history)
int num_5d_lev0 = Math.max(0, dpixels_3d3.length - num_hist_5d + 1); int num_5d_lev0 = Math.max(0, dpixels_3d3.length - num_hist_5d + 1);
dpixels_5d_pyramid[0] = new double[num_5d_lev0][][][]; dpixels_5d_pyramid[0] = new double[num_5d_lev0][][][];
...@@ -301,10 +314,18 @@ public class CuasDetectRT { ...@@ -301,10 +314,18 @@ public class CuasDetectRT {
window[h] = dpixels_3d3[n5d + num_hist_5d - 1 - h]; window[h] = dpixels_3d3[n5d + num_hist_5d - 1 - h];
} }
if (curt_save_c5full) { if (curt_save_c5full) {
dpixels_5d_pyramid[0][n5d] = cuasRTUtils.convolve3d(window, null); dpixels_5d_pyramid[0][n5d] = cuasRTUtils.convolve3d(
window,
null,
min_frac_last); // final double min_frac_last){
} }
if (curt_save_c5rect && (curt_save_select != null)) { if (curt_save_c5rect && (curt_save_select != null)) {
dpixels_5d_roi_pyramid[0][n5d] = cuasRTUtils.convolve3d(window, curt_save_select, null); dpixels_5d_roi_pyramid[0][n5d] = cuasRTUtils.convolve3d(
window,
curt_save_select,
null,
min_frac_last); // final double min_frac_last)
} }
ts_5d_lev0[n5d] = ts_pyramid[0][n5d + num_hist_5d - 1]; ts_5d_lev0[n5d] = ts_pyramid[0][n5d + num_hist_5d - 1];
} }
...@@ -322,6 +343,12 @@ public class CuasDetectRT { ...@@ -322,6 +343,12 @@ public class CuasDetectRT {
ts_5d_lev0, ts_5d_lev0,
title_conv5d+"-RECT"); title_conv5d+"-RECT");
QuadCLTCPU.saveImagePlusInDirectory(imp_5d_rect, getModelDirectory()); QuadCLTCPU.saveImagePlusInDirectory(imp_5d_rect, getModelDirectory());
ImagePlus imp_5d_hyper = cuasRTUtils.showConvKernel5dHyperRect(
dpixels_5d_roi_pyramid[0],
curt_save_select,
ts_5d_lev0,
title_conv5d+"-HYPER-RECT");
QuadCLTCPU.saveImagePlusInDirectory(imp_5d_hyper, getModelDirectory());
} }
for (int nlev = 0; nlev < pyramid_levels; nlev++) { for (int nlev = 0; nlev < pyramid_levels; nlev++) {
if (save_LoG_pixels) { if (save_LoG_pixels) {
...@@ -383,10 +410,17 @@ public class CuasDetectRT { ...@@ -383,10 +410,17 @@ public class CuasDetectRT {
window[h] = dpixels_3d3_pyramid[nlev+1][n5d + num_hist_5d - 1 - h]; window[h] = dpixels_3d3_pyramid[nlev+1][n5d + num_hist_5d - 1 - h];
} }
if (curt_save_c5full) { if (curt_save_c5full) {
dpixels_5d_pyramid[nlev+1][n5d] = cuasRTUtils.convolve3d(window, null); dpixels_5d_pyramid[nlev+1][n5d] = cuasRTUtils.convolve3d(
window,
null,
min_frac_last); // final double min_frac_last){
} }
if (curt_save_c5rect && (curt_save_select != null)) { if (curt_save_c5rect && (curt_save_select != null)) {
dpixels_5d_roi_pyramid[nlev+1][n5d] = cuasRTUtils.convolve3d(window, curt_save_select, null); dpixels_5d_roi_pyramid[nlev+1][n5d] = cuasRTUtils.convolve3d(
window,
curt_save_select,
null,
min_frac_last); // final double min_frac_last)
} }
ts_5d_lev[n5d] = ts_pyramid[nlev+1][n5d + num_hist_5d - 1]; ts_5d_lev[n5d] = ts_pyramid[nlev+1][n5d + num_hist_5d - 1];
} }
...@@ -404,6 +438,12 @@ public class CuasDetectRT { ...@@ -404,6 +438,12 @@ public class CuasDetectRT {
ts_5d_lev, ts_5d_lev,
title_conv5d+"-LEV"+(nlev+1)+"-RECT"); title_conv5d+"-LEV"+(nlev+1)+"-RECT");
QuadCLTCPU.saveImagePlusInDirectory(imp_5d_rect, getModelDirectory()); QuadCLTCPU.saveImagePlusInDirectory(imp_5d_rect, getModelDirectory());
ImagePlus imp_5d_hyper = cuasRTUtils.showConvKernel5dHyperRect(
dpixels_5d_roi_pyramid[nlev+1],
curt_save_select,
ts_5d_lev,
title_conv5d+"-LEV"+(nlev+1)+"-HYPER-RECT");
QuadCLTCPU.saveImagePlusInDirectory(imp_5d_hyper, getModelDirectory());
} }
} }
} }
......
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