Commit 1e63c534 authored by Andrey Filippov's avatar Andrey Filippov

Extracting parameters, debugging

parent 956905bd
...@@ -12,8 +12,6 @@ import java.util.Arrays; ...@@ -12,8 +12,6 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import java.nio.file.Paths; import java.nio.file.Paths;
...@@ -22,7 +20,6 @@ import java.net.URL; ...@@ -22,7 +20,6 @@ import java.net.URL;
import com.elphel.imagej.cameras.CLTParameters; import com.elphel.imagej.cameras.CLTParameters;
import com.elphel.imagej.common.DoubleGaussianBlur; import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.GenericJTabbedDialog;
import com.elphel.imagej.common.ShowDoubleFloatArrays; import com.elphel.imagej.common.ShowDoubleFloatArrays;
import com.elphel.imagej.gpu.GPUTileProcessor; import com.elphel.imagej.gpu.GPUTileProcessor;
import com.elphel.imagej.gpu.GpuQuad; import com.elphel.imagej.gpu.GpuQuad;
...@@ -32,7 +29,6 @@ import com.elphel.imagej.tileprocessor.Correlation2d; ...@@ -32,7 +29,6 @@ import com.elphel.imagej.tileprocessor.Correlation2d;
import com.elphel.imagej.tileprocessor.ErsCorrection; import com.elphel.imagej.tileprocessor.ErsCorrection;
import com.elphel.imagej.tileprocessor.GeometryCorrection; import com.elphel.imagej.tileprocessor.GeometryCorrection;
import com.elphel.imagej.tileprocessor.ImageDtt; import com.elphel.imagej.tileprocessor.ImageDtt;
import com.elphel.imagej.tileprocessor.IntersceneMatchParameters;
import com.elphel.imagej.tileprocessor.OpticalFlow; import com.elphel.imagej.tileprocessor.OpticalFlow;
import com.elphel.imagej.tileprocessor.QuadCLT; import com.elphel.imagej.tileprocessor.QuadCLT;
import com.elphel.imagej.tileprocessor.TDCorrTile; import com.elphel.imagej.tileprocessor.TDCorrTile;
...@@ -102,6 +98,23 @@ public class CuasMotion { ...@@ -102,6 +98,23 @@ public class CuasMotion {
}; };
public static String ICON_BLUE = "Circle63x63blue.png"; public static String ICON_BLUE = "Circle63x63blue.png";
public static final String [][] ANNOT_LABELS = {{"Target ID","Unique number fo detected targets, some targets may be erroneously detected as separate ones."},
{"Disparity","Raw measured disparity (in pixels), offset by the same \"disparity at infinity\"."},
{"Range","Distance to the target, calculated from the measured disparity."},
{"True range","Distance to the test UAS obtained from its flight log."},
{"AGL","Altitude above ground level."},
{"Azimuth","Target azimuth (degrees)."},
{"Elevation","Target elevation (degrees)."},
{"Conditional Elevation","Display elevation only if altitude (AGL) is undefined due to too far targets."},
{"Angular movements","Show horizontal and vertical apparent target movement in the camera field of view (degrees per second)."},
{"Vertical Speed","Target vertical speed (m/s)."},
{"Ground Speed","Horizontal target speed relative to the ground (m/s)."},
{"Heading","Target heading (m/s)."},
{"Segment Mismatch","Mismatch between target tracking at consecutive keyframes (now 10 frames @ 60fps) (pix)."},
{"Score","Target 2D detection score."},
{"Sequence Length","Number of consecutive keyframes where the same target is detected."},
{"Travel 2D","Bounding box diagonal of the target 2D travel in consecutive frames (pix)."}};
public static final int ANNOT_ID = 0; // target ID (global index) public static final int ANNOT_ID = 0; // target ID (global index)
public static final int ANNOT_DISP = 1; // disparity public static final int ANNOT_DISP = 1; // disparity
public static final int ANNOT_RANGE = 2; // range public static final int ANNOT_RANGE = 2; // range
...@@ -118,6 +131,7 @@ public class CuasMotion { ...@@ -118,6 +131,7 @@ public class CuasMotion {
public static final int ANNOT_SCORE =13; // Score public static final int ANNOT_SCORE =13; // Score
public static final int ANNOT_SEQ = 14; // Sequence length public static final int ANNOT_SEQ = 14; // Sequence length
public static final int ANNOT_TRV = 15; // Sequence travel (pixel diagonal of the bounding box of travel) public static final int ANNOT_TRV = 15; // Sequence travel (pixel diagonal of the bounding box of travel)
/*
public static final int ANNOT_CLEAN = public static final int ANNOT_CLEAN =
(1 << ANNOT_ID) | (1 << ANNOT_ID) |
(1 << ANNOT_RANGE) | (1 << ANNOT_RANGE) |
...@@ -128,7 +142,81 @@ public class CuasMotion { ...@@ -128,7 +142,81 @@ public class CuasMotion {
(1 << ANNOT_VS) | (1 << ANNOT_VS) |
(1 << ANNOT_GS) | (1 << ANNOT_GS) |
(1 << ANNOT_HDG); (1 << ANNOT_HDG);
*/
public static final int [] ANNOT_DEFAULTS = {
(1 << ANNOT_ID) |
(1 << ANNOT_DISP) |
(1 << ANNOT_RANGE) |
(1 << ANNOT_TRANG) |
(1 << ANNOT_AGL) |
(1 << ANNOT_AZ) |
(1 << ANNOT_EL) |
(1 << ANNOT_ELNOAGL) |
(1 << ANNOT_OMEGA) |
(1 << ANNOT_VS) |
(1 << ANNOT_GS) |
(1 << ANNOT_HDG) |
(1 << ANNOT_MISM) |
(1 << ANNOT_SCORE) |
(1 << ANNOT_SEQ) |
(1 << ANNOT_TRV),
(1 << ANNOT_ID) |
(1 << ANNOT_RANGE) |
(1 << ANNOT_TRANG) |
(1 << ANNOT_AGL) |
(1 << ANNOT_AZ) |
(1 << ANNOT_ELNOAGL) |
(1 << ANNOT_VS) |
(1 << ANNOT_GS) |
(1 << ANNOT_HDG),
(1 << ANNOT_ID) |
(1 << ANNOT_RANGE) |
(1 << ANNOT_TRANG) |
(1 << ANNOT_AGL) |
(1 << ANNOT_AZ) |
(1 << ANNOT_ELNOAGL) |
(1 << ANNOT_VS) |
(1 << ANNOT_GS) |
(1 << ANNOT_HDG)
};
/*
public static final char ANNOT_IMAGE_PANE = 'I';
public static final char ANNOT_RADAR_PANE = 'R';
public static final char ANNOT_CLEAN_VIEW = '+';
*/
public static final int ANNOT_IMAGE_PANE_INDX = 0;
public static final int ANNOT_RADAR_PANE_INDX = 1;
public static final int ANNOT_CLEAN_VIEW_INDX = 2;
public static final int ANNOT_VIEWS = ANNOT_CLEAN_VIEW_INDX+1;
public static final String ANNOTS = "IR+"; // Image pane, Radar pane, clean mask
public static final String ANNOT_TIP = "\"I\" - show in image pane, \"R\" - show in radar pane, \"+\" - show in clean view (mask for both panes)";
public static void setCuasAnnots(
String annot,
int indx,
int [] annots) {
for (int i = 0; i < ANNOT_VIEWS; i++) {
annots[i] &= ~(1 << indx);
if (annot.contains(ANNOTS.substring(i,i+1))) {
annots[i] |= (1 << indx);
}
}
}
public static String getCuasAnnot (
int indx,
int [] annots) {
String annot = "";
for (int i = 0; i < ANNOT_VIEWS; i++) {
if ((annots[i] & (1 << indx)) != 0) {
annot+= ANNOTS.substring(i,i+1);
}
}
return annot;
}
private final GPUTileProcessor gpuTileProcessor; private final GPUTileProcessor gpuTileProcessor;
private CLTParameters clt_parameters=null; private CLTParameters clt_parameters=null;
...@@ -154,7 +242,7 @@ public class CuasMotion { ...@@ -154,7 +242,7 @@ public class CuasMotion {
} }
private boolean slow_targets = false; private boolean slow_targets = false;
public int getSeqLength() { public int getSeqLength() {
return clt_parameters.imp.cuas_corr_offset + clt_parameters.imp.cuas_corr_pairs; return clt_parameters.imp.cuas_corr_offset + clt_parameters.imp.cuas_corr_pairs;
} }
...@@ -4487,30 +4575,29 @@ public class CuasMotion { ...@@ -4487,30 +4575,29 @@ public class CuasMotion {
final int target_type = clt_parameters.imp.cuas_target_type; // 0; // 0 - unknown, 1 - known, 2 - friend, 3 - foe final int target_type = clt_parameters.imp.cuas_target_type; // 0; // 0 - unknown, 1 - known, 2 - friend, 3 - foe
final int uas_type = clt_parameters.imp.cuas_known_type; // 2; // Target location matching UAS flight log: 0; // 0 - unknown, 1 - known, 2 - friend, 3 - foe final int uas_type = clt_parameters.imp.cuas_known_type; // 2; // Target location matching UAS flight log: 0; // 0 - unknown, 1 - known, 2 - friend, 3 - foe
final boolean reserve_missing_fields = false; // make a parameter.Reserve a line for requested but missing parameters final boolean annot_missing = clt_parameters.imp.cuas_annot_missing; // false; // make a parameter.Reserve a line for requested but missing parameters
final boolean scale2x = true; final boolean scale2x = true;
final int image_scale = 2; // here always 2 final int image_scale = 2; // here always 2
final int space_before_text = 2 * image_scale; final int space_before_text = 2 * image_scale;
final int width = 540; // calculate final int width = 540; // calculate
final int height = 1024; // calculate final int height = 1024; // calculate
final int radar_height = 950; // 970; // calculate final int radar_height = clt_parameters.imp.cuas_radar_height; // 950; // 970; // calculate
// move to configs: // move to configs:
final int bottom_gap = 10; final int bottom_gap = clt_parameters.imp.cuas_radar_bottom; // 10;
final int infinity_gap = 24; // 10; // add to radar_height final int infinity_gap = clt_parameters.imp.cuas_radar_top; // 24; // 10; // add to radar_height
final double ring_step = 100.0; final double ring_step = clt_parameters.imp.cuas_grid_ring; // 100.0;
final double dir_step = 5.0; // degrees final double dir_step = clt_parameters.imp.cuas_grid_line; // 5.0; // degrees
final int grid_font_size = 7; final int grid_font_size = clt_parameters.imp.cuas_grid_font; // 7;
final int grid_azimuth_top= 5; // where to put azimuth final int grid_azimuth_top = clt_parameters.imp.cuas_grid_az_top; // 5; // where to put azimuth
final int grid_margin= 5; // grid annotation from left/right final int grid_margin = clt_parameters.imp.cuas_grid_sides; // 5; // grid annotation from left/right
// final Color rings_color = new Color(140,140,140); final Color rings_color = clt_parameters.imp.cuas_grid_color; // new Color(100,100,100);
final Color rings_color = new Color(100,100,100); final Color uas_color = clt_parameters.imp.cuas_radar_uas_color; // new Color( 0,100,140);
final Color uas_color = new Color( 0,100,140); final Color target_color = clt_parameters.imp.cuas_radar_color; // new Color( 0,255,100);
final Color target_color = new Color( 0,255,100); final double uas_radius = clt_parameters.imp.cuas_radar_uas_rad;// 4.0;
final double uas_radius = 4.0; final double target_radius = clt_parameters.imp.cuas_radar_radius; // 2.5;
final double target_radius = 2.5; final boolean annotate_grid = clt_parameters.imp.cuas_grid_annot; // true;
final boolean annotate_grid = true;
final Font font_grid = annotate_grid ? (new Font(font_name, font_type, image_scale * grid_font_size)): null; final Font font_grid = annotate_grid ? (new Font(font_name, font_type, image_scale * grid_font_size)): null;
final Font font_target = new Font(font_name, font_type, image_scale * font_size_radar); final Font font_target = new Font(font_name, font_type, image_scale * font_size_radar);
...@@ -4777,7 +4864,7 @@ public class CuasMotion { ...@@ -4777,7 +4864,7 @@ public class CuasMotion {
String annot_txt = getAnnotationText( String annot_txt = getAnnotationText(
clt_parameters, // CLTParameters clt_parameters, clt_parameters, // CLTParameters clt_parameters,
annot_mode, // int annot_mode, annot_mode, // int annot_mode,
reserve_missing_fields, // boolean reserve_missing_fields, // make a parameter.Reserve a line for requested but missing parameters annot_missing, // boolean reserve_missing_fields, // make a parameter.Reserve a line for requested but missing parameters
ntile0, // int ntile0, ntile0, // int ntile0,
ntile1, // int ntile1, ntile1, // int ntile1,
target0, // double [] target0, target0, // double [] target0,
...@@ -5816,9 +5903,10 @@ public class CuasMotion { ...@@ -5816,9 +5903,10 @@ public class CuasMotion {
0); // int y0) 0); // int y0)
// imp_color2.show(); // imp_color2.show();
// parentCLT.saveImagePlusInModelDirectory(imp_color2); // parentCLT.saveImagePlusInModelDirectory(imp_color2);
int annot_mode = 0xffffffbf; // int annot_mode = 0xffffffbf;
int annot_mode = clt_parameters.imp.cuas_annot_sel[CuasMotion.ANNOT_RADAR_PANE_INDX];
if (video_pass) { if (video_pass) {
annot_mode &= ANNOT_CLEAN; annot_mode &= ANNOT_DEFAULTS[ANNOT_CLEAN_VIEW_INDX]; //ANNOT_CLEAN;
} }
ImagePlus img_radar = generateRadarImage( ImagePlus img_radar = generateRadarImage(
clt_parameters, clt_parameters,
......
...@@ -1543,7 +1543,9 @@ public class CuasMultiSeries { ...@@ -1543,7 +1543,9 @@ public class CuasMultiSeries {
int nser, int nser,
UasLogReader uasLogReader, // contains camera orientation (getCameraATR()) UasLogReader uasLogReader, // contains camera orientation (getCameraATR())
int debugLevel) { int debugLevel) {
int annot_mode = 0xffffffbf; // -1; // specify bits // int annot_mode = 0xffffffbf; // -1; // specify bits
int annot_mode = clt_parameters.imp.cuas_annot_sel[CuasMotion.ANNOT_RADAR_PANE_INDX];
String image_name = model_names[nser]; String image_name = model_names[nser];
int corr_pairs = clt_parameters.imp.cuas_corr_pairs; int corr_pairs = clt_parameters.imp.cuas_corr_pairs;
boolean ra_background = clt_parameters.imp.cuas_ra_background; // true; boolean ra_background = clt_parameters.imp.cuas_ra_background; // true;
......
...@@ -964,8 +964,8 @@ min_str_neib_fpn 0.35 ...@@ -964,8 +964,8 @@ min_str_neib_fpn 0.35
public int cuas_grid_az_top = 5; // where to put azimuth public int cuas_grid_az_top = 5; // where to put azimuth
public int cuas_grid_sides = 5; // grid annotation from left/right public int cuas_grid_sides = 5; // grid annotation from left/right
// Annotation selection
public int [] cuas_annot_sel = CuasMotion.ANNOT_DEFAULTS.clone();
// debug parameters // debug parameters
public boolean cuas_debug = false; // save debug images (and show them if not in batch mode) public boolean cuas_debug = false; // save debug images (and show them if not in batch mode)
...@@ -2679,7 +2679,7 @@ min_str_neib_fpn 0.35 ...@@ -2679,7 +2679,7 @@ min_str_neib_fpn 0.35
gd.addNumericField("Font spacing", this.cuas_font_spacing, 5,8,"x", gd.addNumericField("Font spacing", this.cuas_font_spacing, 5,8,"x",
"Height to size ratio. If 0 - will use default spacing ( ~=1.5)."); "Height to size ratio. If 0 - will use default spacing ( ~=1.5).");
gd.addCheckbox ("Reserve lines for undefined parameters", this.cuas_annot_missing, gd.addCheckbox ("Reserve lines for undefined parameters", this.cuas_annot_missing,
"Reserve linee for requested but missing parameters."); "Reserve line for requested but missing parameters.");
gd.addNumericField("Known image pixel X coordinate", this.cuas_px0, 0,3,"", gd.addNumericField("Known image pixel X coordinate", this.cuas_px0, 0,3,"",
"Image pixel X corresponding to the known azimuth."); "Image pixel X corresponding to the known azimuth.");
gd.addNumericField("Known image pixel X coordinate", this.cuas_py0, 0,3,"", gd.addNumericField("Known image pixel X coordinate", this.cuas_py0, 0,3,"",
...@@ -2827,7 +2827,7 @@ min_str_neib_fpn 0.35 ...@@ -2827,7 +2827,7 @@ min_str_neib_fpn 0.35
"Far (infinity) targets offset from window top."); "Far (infinity) targets offset from window top.");
gd.addStringField ("True UAS location color", getStringColor(cuas_radar_uas_color, DEFAULT_cuas_radar_uas_color), 8, gd.addStringField ("True UAS location color", getStringColor(cuas_radar_uas_color, DEFAULT_cuas_radar_uas_color), 8,
"6-character hex value. Any wrong hex value will be replaced by the default - "+getStringColor(DEFAULT_cuas_radar_uas_color)); "6-character hex value. Any wrong hex value will be replaced by the default - "+getStringColor(DEFAULT_cuas_radar_uas_color));
gd.addStringField ("Targets location color", getStringColor(cuas_radar_uas_color,DEFAULT_cuas_radar_color), 8, gd.addStringField ("Targets location color", getStringColor(cuas_radar_color,DEFAULT_cuas_radar_color), 8,
"6-character hex value. Any wrong hex value will be replaced by the default - "+getStringColor(DEFAULT_cuas_radar_color)); "6-character hex value. Any wrong hex value will be replaced by the default - "+getStringColor(DEFAULT_cuas_radar_color));
gd.addNumericField("Detected targets circle radius", this.cuas_radar_radius, 5,8,"pix", gd.addNumericField("Detected targets circle radius", this.cuas_radar_radius, 5,8,"pix",
"Radius of the detected targets location circle. Should be less than that of the true UAS circle"); "Radius of the detected targets location circle. Should be less than that of the true UAS circle");
...@@ -2848,8 +2848,17 @@ min_str_neib_fpn 0.35 ...@@ -2848,8 +2848,17 @@ min_str_neib_fpn 0.35
"Absolute Y-position of the bottom of the azimuth annotations."); "Absolute Y-position of the bottom of the azimuth annotations.");
gd.addNumericField("Grid annotations margins from righht/left", this.cuas_grid_sides, 0,3,"pix", gd.addNumericField("Grid annotations margins from righht/left", this.cuas_grid_sides, 0,3,"pix",
"Grid annotations margins from left/right of the Radar pane."); "Grid annotations margins from left/right of the Radar pane.");
gd.addMessage("=== Annotation Selection (what to display in the video ===");
gd.addMessage(CuasMotion.ANNOT_TIP);
for (int i = 0; i < CuasMotion.ANNOT_LABELS.length; i++) {
gd.addStringField(
CuasMotion.ANNOT_LABELS[i][0], // String label,
CuasMotion.getCuasAnnot ( //String value,
i, // int indx,
cuas_annot_sel), // int [] annots),
8, // int width,
CuasMotion.ANNOT_LABELS[i][1]); // String tooltip)
}
gd.addMessage("=== Debug ==="); gd.addMessage("=== Debug ===");
gd.addCheckbox ("Save/show debug images", this.cuas_debug, gd.addCheckbox ("Save/show debug images", this.cuas_debug,
...@@ -4095,6 +4104,14 @@ min_str_neib_fpn 0.35 ...@@ -4095,6 +4104,14 @@ min_str_neib_fpn 0.35
this.cuas_grid_font = (int) gd.getNextNumber(); this.cuas_grid_font = (int) gd.getNextNumber();
this.cuas_grid_az_top = (int) gd.getNextNumber(); this.cuas_grid_az_top = (int) gd.getNextNumber();
this.cuas_grid_sides = (int) gd.getNextNumber(); this.cuas_grid_sides = (int) gd.getNextNumber();
for (int i = 0; i < CuasMotion.ANNOT_LABELS.length; i++) {
String s = gd.getNextString();
CuasMotion.setCuasAnnots(
s, // String annot,
i, // int indx,
cuas_annot_sel); // int [] annots)
}
this.cuas_debug = gd.getNextBoolean(); this.cuas_debug = gd.getNextBoolean();
this.cuas_dbg_rng_seq = (int) gd.getNextNumber(); this.cuas_dbg_rng_seq = (int) gd.getNextNumber();
...@@ -5222,14 +5239,7 @@ min_str_neib_fpn 0.35 ...@@ -5222,14 +5239,7 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"cuas_grid_font", this.cuas_grid_font+""); // int properties.setProperty(prefix+"cuas_grid_font", this.cuas_grid_font+""); // int
properties.setProperty(prefix+"cuas_grid_az_top", this.cuas_grid_az_top+""); // int properties.setProperty(prefix+"cuas_grid_az_top", this.cuas_grid_az_top+""); // int
properties.setProperty(prefix+"cuas_grid_sides", this.cuas_grid_sides+""); // int properties.setProperty(prefix+"cuas_grid_sides", this.cuas_grid_sides+""); // int
properties.setProperty(prefix+"cuas_annot_sel", IntersceneMatchParameters.intsToString(this.cuas_annot_sel));
properties.setProperty(prefix+"cuas_debug", this.cuas_debug+""); // boolean properties.setProperty(prefix+"cuas_debug", this.cuas_debug+""); // boolean
properties.setProperty(prefix+"cuas_dbg_rng_seq", this.cuas_dbg_rng_seq+""); // int properties.setProperty(prefix+"cuas_dbg_rng_seq", this.cuas_dbg_rng_seq+""); // int
properties.setProperty(prefix+"cuas_dbg_rng_tgt", this.cuas_dbg_rng_tgt+""); // int properties.setProperty(prefix+"cuas_dbg_rng_tgt", this.cuas_dbg_rng_tgt+""); // int
...@@ -6337,6 +6347,8 @@ min_str_neib_fpn 0.35 ...@@ -6337,6 +6347,8 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"cuas_grid_font")!=null) this.cuas_grid_font=Integer.parseInt(properties.getProperty(prefix+"cuas_grid_font")); if (properties.getProperty(prefix+"cuas_grid_font")!=null) this.cuas_grid_font=Integer.parseInt(properties.getProperty(prefix+"cuas_grid_font"));
if (properties.getProperty(prefix+"cuas_grid_az_top")!=null) this.cuas_grid_az_top=Integer.parseInt(properties.getProperty(prefix+"cuas_grid_az_top")); if (properties.getProperty(prefix+"cuas_grid_az_top")!=null) this.cuas_grid_az_top=Integer.parseInt(properties.getProperty(prefix+"cuas_grid_az_top"));
if (properties.getProperty(prefix+"cuas_grid_sides")!=null) this.cuas_grid_sides=Integer.parseInt(properties.getProperty(prefix+"cuas_grid_sides")); if (properties.getProperty(prefix+"cuas_grid_sides")!=null) this.cuas_grid_sides=Integer.parseInt(properties.getProperty(prefix+"cuas_grid_sides"));
if (properties.getProperty(prefix+"cuas_annot_sel")!=null) this.cuas_annot_sel= IntersceneMatchParameters.StringToInts(properties.getProperty(prefix+"cuas_annot_sel"),this.cuas_annot_sel);
if (properties.getProperty(prefix+"cuas_debug")!=null) this.cuas_debug=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_debug")); if (properties.getProperty(prefix+"cuas_debug")!=null) this.cuas_debug=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_debug"));
if (properties.getProperty(prefix+"cuas_dbg_rng_seq")!=null) this.cuas_dbg_rng_seq=Integer.parseInt(properties.getProperty(prefix+"cuas_dbg_rng_seq")); if (properties.getProperty(prefix+"cuas_dbg_rng_seq")!=null) this.cuas_dbg_rng_seq=Integer.parseInt(properties.getProperty(prefix+"cuas_dbg_rng_seq"));
...@@ -7968,6 +7980,30 @@ min_str_neib_fpn 0.35 ...@@ -7968,6 +7980,30 @@ min_str_neib_fpn 0.35
} }
return data; return data;
} }
public static int [] StringToInts(String s, int [] default_data) {
int len = default_data.length;
StringTokenizer st = new StringTokenizer(s, " \t\n\r\f,");
if (st.countTokens() == 0) {
return null;
}
if (len <= 0) {
len = st.countTokens();
}
int [] data = new int [len];
int i = 0;
while (st.hasMoreTokens() && (i < len)) {
int d = 0;
try {
d = Integer.parseInt(st.nextToken());
} catch(NumberFormatException e){
d = default_data[i];
}
data[i++] = d;
}
return data;
}
public static String doublesToString(double [] data) { public static String doublesToString(double [] data) {
...@@ -7997,14 +8033,14 @@ min_str_neib_fpn 0.35 ...@@ -7997,14 +8033,14 @@ min_str_neib_fpn 0.35
if (len <= 0) { if (len <= 0) {
len = st.countTokens(); len = st.countTokens();
} }
double [] data = default_data.clone(); // new double [len]; double [] data = new double [len];
int i = 0; int i = 0;
while (st.hasMoreTokens() && (i < len)) { while (st.hasMoreTokens() && (i < len)) {
double d = 0; double d = 0;
try { try {
d = Double.parseDouble(st.nextToken()); d = Double.parseDouble(st.nextToken());
} catch(NumberFormatException e){ } catch(NumberFormatException e){
d = 0; d = default_data[i];
} }
data[i++] = d; data[i++] = d;
} }
...@@ -8079,5 +8115,8 @@ min_str_neib_fpn 0.35 ...@@ -8079,5 +8115,8 @@ min_str_neib_fpn 0.35
} }
return s; return s;
} }
} }
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