Commit 9540ac2a authored by Andrey Filippov's avatar Andrey Filippov

CLAUDE: Embed all curt_* run config as image metadata on DNN saves

tagCuasImp() serializes every curt_* param (via IntersceneMatchParameters.setProperties,
so new params are auto-included) into the ImagePlus properties and calls
EyesisTiff.encodeProperiesToInfo -> XML in the "Info" field -> FileSaver writes it
to the TIFF ImageDescription. Applied to -DNN-RECT/-HYPER-RECT/-OFFSET. The python
reader (python3-imagej-tiff format) decodes it back, so outputs are self-describing;
ROI/model/patch/vmax/etc. restore without manual entry (supplements the filename tag).
Co-Authored-By: 's avatarClaude Opus 4.8 (1M context) <noreply@anthropic.com>
parent e42d6120
...@@ -310,7 +310,22 @@ public class CuasDetectRT { ...@@ -310,7 +310,22 @@ public class CuasDetectRT {
} }
} }
} }
/** Tag a saved CUAS image with the full run config: copy ALL curt_* params (via the config
* serializer, so any new curt_ param is auto-included) into the ImagePlus properties and encode
* them to the ImageJ Info field (XML -> TIFF ImageDescription). The python reader (python3-imagej-tiff
* format) decodes <key>value</key> back to a dict - so every output is self-describing. By Claude on 06/16/2026 */
private static ImagePlus tagCuasImp(ImagePlus imp, com.elphel.imagej.tileprocessor.IntersceneMatchParameters p) {
if ((imp == null) || (p == null)) return imp;
java.util.Properties props = new java.util.Properties();
p.setProperties("", props); // serialize all params -> props (keys "curt_..." among others)
for (String key : props.stringPropertyNames()) {
if (key.startsWith("curt_")) imp.setProperty(key, props.getProperty(key));
}
com.elphel.imagej.readers.EyesisTiff.encodeProperiesToInfo(imp); // -> imp "Info" XML -> FileSaver writes ImageDescription
return imp;
}
public int getWidth() { public int getWidth() {
return width; return width;
...@@ -1267,12 +1282,12 @@ public class CuasDetectRT { ...@@ -1267,12 +1282,12 @@ public class CuasDetectRT {
int [] win_dnn = timeWindow(ts_dnn); // timing ROI // By Claude on 06/14/2026 int [] win_dnn = timeWindow(ts_dnn); // timing ROI // By Claude on 06/14/2026
double [][][][] dnn_w = win4(dnn_roi, win_dnn); String [] ts_dnn_w = winS(ts_dnn, win_dnn); // By Claude on 06/14/2026 double [][][][] dnn_w = win4(dnn_roi, win_dnn); String [] ts_dnn_w = winS(ts_dnn, win_dnn); // By Claude on 06/14/2026
if (curt_save_c5rect) { // By Claude on 06/13/2026 if (curt_save_c5rect) { // By Claude on 06/13/2026
QuadCLTCPU.saveImagePlusInDirectory(cuasRTUtils.showConvKernel5d( // By Claude on 06/13/2026 QuadCLTCPU.saveImagePlusInDirectory(tagCuasImp(cuasRTUtils.showConvKernel5d( // By Claude on 06/13/2026
dnn_w, curt_save_select, ts_dnn_w, title_dnn+"-RECT"), getModelDirectory()); // By Claude on 06/14/2026 dnn_w, curt_save_select, ts_dnn_w, title_dnn+"-RECT"), clt_parameters.imp), getModelDirectory()); // metadata: all curt_* // By Claude on 06/16/2026
} // By Claude on 06/13/2026 } // By Claude on 06/13/2026
if (clt_parameters.imp.curt_save_c5hyper) { // By Claude on 06/13/2026 if (clt_parameters.imp.curt_save_c5hyper) { // By Claude on 06/13/2026
QuadCLTCPU.saveImagePlusInDirectory(cuasRTUtils.showConvKernel5dHyperRect( // By Claude on 06/13/2026 QuadCLTCPU.saveImagePlusInDirectory(tagCuasImp(cuasRTUtils.showConvKernel5dHyperRect( // By Claude on 06/13/2026
dnn_w, curt_save_select, ts_dnn_w, title_dnn+"-HYPER-RECT"), getModelDirectory()); // By Claude on 06/14/2026 dnn_w, curt_save_select, ts_dnn_w, title_dnn+"-HYPER-RECT"), clt_parameters.imp), getModelDirectory()); // metadata: all curt_* // By Claude on 06/16/2026
} // By Claude on 06/13/2026 } // By Claude on 06/13/2026
// -DNN-OFFSET: the per-pixel sub-pixel offset (dx,dy) + confidence s over the ROI, // By Claude on 06/14/2026 // -DNN-OFFSET: the per-pixel sub-pixel offset (dx,dy) + confidence s over the ROI, // By Claude on 06/14/2026
// to see whether a cluster's offsets converge on one fractional position. Channels // to see whether a cluster's offsets converge on one fractional position. Channels
...@@ -1290,8 +1305,8 @@ public class CuasDetectRT { ...@@ -1290,8 +1305,8 @@ public class CuasDetectRT {
off_hyper[0][k][p] = dx; off_hyper[1][k][p] = dy; off_hyper[2][k][p] = sv; off_hyper[0][k][p] = dx; off_hyper[1][k][p] = dy; off_hyper[2][k][p] = sv;
} }
} }
QuadCLTCPU.saveImagePlusInDirectory(ShowDoubleFloatArrays.showArraysHyperstack( QuadCLTCPU.saveImagePlusInDirectory(tagCuasImp(ShowDoubleFloatArrays.showArraysHyperstack(
off_hyper, rwid, title_dnn+"-OFFSET", ts_dnn_w, new String[]{"dx","dy","s"}, false), getModelDirectory()); off_hyper, rwid, title_dnn+"-OFFSET", ts_dnn_w, new String[]{"dx","dy","s"}, false), clt_parameters.imp), getModelDirectory()); // metadata: all curt_* // By Claude on 06/16/2026
} }
// Feed the DNN field to the recurrent layer (Layer 2): as-is, or offset-splatted (px+dx,py+dy). // By Claude on 06/14/2026 // Feed the DNN field to the recurrent layer (Layer 2): as-is, or offset-splatted (px+dx,py+dy). // By Claude on 06/14/2026
// Tune the recurrent blend with curt_recur_w (0.25/0.75) etc.; the field is [0,1]-scaled so rs_min may need lowering. // Tune the recurrent blend with curt_recur_w (0.25/0.75) etc.; the field is [0,1]-scaled so rs_min may need lowering.
......
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