Commit 758adc65 authored by Andrey Filippov's avatar Andrey Filippov

Working with single-image higher AGL (75 and 100)

parent 5e4e5577
...@@ -216,6 +216,31 @@ public class GenericJTabbedDialog implements ActionListener { ...@@ -216,6 +216,31 @@ public class GenericJTabbedDialog implements ActionListener {
inp_units.putClientProperty("type", "combo"); inp_units.putClientProperty("type", "combo");
// combo.setPreferredSize(new Dimension(200)); // combo.setPreferredSize(new Dimension(200));
// combo.setSize(200, combo.getPreferredSize().height); // combo.setSize(200, combo.getPreferredSize().height);
// combo.setMaximumSize(20); // combo.getPreferredSize() );
inp_units.setLayout(new FlowLayout(FlowLayout.LEFT));
addLine(label, inp_units, tooltip);
}
public void addChoice(String label, String[] items, String defaultItem, String tooltip, int count) {
int index = 0;
if (defaultItem != null) {
for (int i = 0; i < items.length; i++) if (items[i].equals(defaultItem)) {
index = i;
break;
}
}
JComboBox<String> combo = new JComboBox<String>(items);
combo.setSelectedIndex(index);
JPanel inp_units = new JPanel(false);
inp_units.add(combo);
inp_units.putClientProperty("type", "combo");
if (count > 0) {
combo.setMaximumRowCount(count);
}
// combo.setPreferredSize(new Dimension(200));
// combo.setSize(200, combo.getPreferredSize().height);
// combo.setMaximumSize(20); // combo.getPreferredSize() ); // combo.setMaximumSize(20); // combo.getPreferredSize() );
inp_units.setLayout(new FlowLayout(FlowLayout.LEFT)); inp_units.setLayout(new FlowLayout(FlowLayout.LEFT));
......
...@@ -48,6 +48,11 @@ public class ComboMatch { ...@@ -48,6 +48,11 @@ public class ComboMatch {
GPUTileProcessor gpu_tile_processor, // initialized by the caller GPUTileProcessor gpu_tile_processor, // initialized by the caller
boolean extract_objects, boolean extract_objects,
int debugLevel) { int debugLevel) {
boolean create_kernels = debugLevel>1000;
if (create_kernels) {
OrthoMap.combineKernels();
return true;
}
GPU_TILE_PROCESSOR = gpu_tile_processor; GPU_TILE_PROCESSOR = gpu_tile_processor;
PairwiseOrthoMatch pairwiseOrthoMatch = null; PairwiseOrthoMatch pairwiseOrthoMatch = null;
String [] pair_names = new String[2]; String [] pair_names = new String[2];
...@@ -797,29 +802,46 @@ public class ComboMatch { ...@@ -797,29 +802,46 @@ public class ComboMatch {
String [] choices = getPairChoices( String [] choices = getPairChoices(
available_pairs, // int [][] pairs, available_pairs, // int [][] pairs,
names); // String [] names) names); // String [] names)
String [] choices_all = new String[choices.length+1];
System.arraycopy(choices, 0, choices_all, 0, choices.length);
choices_all[choices_all.length-1] = "--- select a single image ---";
GenericJTabbedDialog gdc = new GenericJTabbedDialog("Select image pair",1200,400); GenericJTabbedDialog gdc = new GenericJTabbedDialog("Select image pair",1200,400);
gdc.addChoice("Operation:", choices, choices[choices.length-1]); int num_choice_lines = 50;
gdc.addChoice("Image pair:",
choices_all,
choices_all[choices.length], // -1],
"Select processed image pair or request a single image selection", num_choice_lines);
gdc.showDialog(); gdc.showDialog();
if (gdc.wasCanceled()) return false; if (gdc.wasCanceled()) return false;
int pair= gdc.getNextChoiceIndex(); int pair= gdc.getNextChoiceIndex();
if (pair >= choices.length) {
int default_choice = 0;
int num_scene_lines = 50;
String scene_name = maps_collection.selectOneScene(
default_choice, // int default_choice,
num_scene_lines); // int num_choice_lines)
if (scene_name == null) {
return false;
}
gpu_spair = new String[] {scene_name};
} else {
gpu_spair = new String[] { gpu_spair = new String[] {
maps_collection.ortho_maps[available_pairs[pair][0]].getName(), maps_collection.ortho_maps[available_pairs[pair][0]].getName(),
maps_collection.ortho_maps[available_pairs[pair][1]].getName()}; maps_collection.ortho_maps[available_pairs[pair][1]].getName()};
} }
}
int [] gpu_pair = new int[gpu_spair.length]; int [] gpu_pair = new int[gpu_spair.length];
int min_zoom_lev = maps_collection.ortho_maps[gpu_pair[0]].getOriginalZoomLevel();
int max_zoom_lev = maps_collection.ortho_maps[gpu_pair[0]].getOriginalZoomLevel();
for (int i = 0; i < gpu_pair.length; i++) { for (int i = 0; i < gpu_pair.length; i++) {
gpu_pair[i] = maps_collection.getIndex(gpu_spair[i]); gpu_pair[i] = maps_collection.getIndex(gpu_spair[i]);
min_zoom_lev = Math.min(min_zoom_lev, maps_collection.ortho_maps[gpu_pair[i]].getOriginalZoomLevel());
max_zoom_lev = Math.max(max_zoom_lev, maps_collection.ortho_maps[gpu_pair[i]].getOriginalZoomLevel());
} }
int min_zoom_lev = Math.min(
maps_collection.ortho_maps[gpu_pair[0]].getOriginalZoomLevel(),
maps_collection.ortho_maps[gpu_pair[1]].getOriginalZoomLevel());
int max_zoom_lev = Math.max(
maps_collection.ortho_maps[gpu_pair[0]].getOriginalZoomLevel(),
maps_collection.ortho_maps[gpu_pair[1]].getOriginalZoomLevel());
int initial_zoom = max_zoom_lev - 4; // another algorithm? int initial_zoom = max_zoom_lev - 4; // another algorithm?
System.out.println("Setting up GPU"); System.out.println("Setting up GPU");
if (GPU_QUAD_AFFINE == null) { if (GPU_QUAD_AFFINE == null) {
try { try {
...@@ -836,13 +858,23 @@ public class ComboMatch { ...@@ -836,13 +858,23 @@ public class ComboMatch {
return false; return false;
} // final int debugLevel); } // final int debugLevel);
} }
double [][] affine0 = {{1,0,0},{0,1,0}}; // will always stay the same
double [][] affine1 = null;
if (gpu_spair.length < 2) {
System.out.println("Selected a single image");
double [][][] affines = {affine0}; // or use affine1 = null as second?
if (pattern_match) {
ImagePlus imp_pat_match = maps_collection.patternMatchDualWrap (
gpu_pair, // int [] indices, // null or which indices to use (normally just 2 for pairwise comparison)
affines, // double [][][] affines, // null or [indices.length][2][3]
null); // warp); // FineXYCorr warp)
// imp_pat_match.show();
}
} else {
double [][] affine0 = {{1,0,0},{0,1,0}}; // will always stay the same
pairwiseOrthoMatch = maps_collection.ortho_maps[gpu_pair[0]].getMatch( pairwiseOrthoMatch = maps_collection.ortho_maps[gpu_pair[0]].getMatch(
maps_collection.ortho_maps[gpu_pair[1]].getName()); maps_collection.ortho_maps[gpu_pair[1]].getName());
double [][] affine1 = null;
if (pairwiseOrthoMatch == null) { if (pairwiseOrthoMatch == null) {
System.out.println("No correlation data is available for pairs "+gpu_spair[0]+ System.out.println("No correlation data is available for pairs "+gpu_spair[0]+
" - "+gpu_spair[1]+" need to implement/search reverse, a spiral search or restart command"); " - "+gpu_spair[1]+" need to implement/search reverse, a spiral search or restart command");
...@@ -853,7 +885,7 @@ public class ComboMatch { ...@@ -853,7 +885,7 @@ public class ComboMatch {
double [][][] affines = {affine0,affine1}; double [][][] affines = {affine0,affine1};
int [] zooms = {initial_zoom, min_zoom_lev, 1000,1000}; // make automatic int [] zooms = {initial_zoom, min_zoom_lev, 1000,1000}; // make automatic
double scale = 2.0; // scale vectors when warping; double scale = 2.0; // scale vectors when warping;
// int num_tries = 5; // make configurable // int num_tries = 5; // make configurable
if (!process_correlation) { if (!process_correlation) {
zooms = new int[] {min_zoom_lev, 1000}; zooms = new int[] {min_zoom_lev, 1000};
num_tries_fit = 0; num_tries_fit = 0;
...@@ -908,18 +940,21 @@ public class ComboMatch { ...@@ -908,18 +940,21 @@ public class ComboMatch {
System.out.println(); System.out.println();
} }
} }
if (pattern_match) { if (pattern_match) {
ImagePlus imp_pat_match = maps_collection.patternMatchDualWrap ( ImagePlus imp_pat_match = maps_collection.patternMatchDualWrap (
gpu_pair, // int [] indices, // null or which indices to use (normally just 2 for pairwise comparison) gpu_pair, // int [] indices, // null or which indices to use (normally just 2 for pairwise comparison)
affines, // double [][][] affines, // null or [indices.length][2][3] affines, // double [][][] affines, // null or [indices.length][2][3]
warp); // FineXYCorr warp) warp); // FineXYCorr warp)
// imp_pat_match.show(); // imp_pat_match.show();
} }
if (render_match) { if (render_match) {
ImagePlus imp_img_pair = maps_collection.renderMulti ( ImagePlus imp_img_pair = maps_collection.renderMulti (
//_zoom<integer> is needed for opening with "Extract Objects" command //_zoom<integer> is needed for opening with "Extract Objects" command
"multi_"+gpu_spair[0]+"-"+gpu_spair[1]+"_zoom"+min_zoom_lev+"_"+zoom_lev, // String title, "multi_"+gpu_spair[0]+"-"+gpu_spair[1]+"_zoom"+min_zoom_lev+"_"+zoom_lev, // String title,
// false, // boolean use_alt, // false, // boolean use_alt,
OrthoMapsCollection.MODE_IMAGE, // int mode, // 0 - regular image, 1 - altitudes, 2 - black/white mask // boolean use_alt, OrthoMapsCollection.MODE_IMAGE, // int mode, // 0 - regular image, 1 - altitudes, 2 - black/white mask // boolean use_alt,
gpu_pair, // int [] indices, // null or which indices to use (normally just 2 for pairwise comparison) gpu_pair, // int [] indices, // null or which indices to use (normally just 2 for pairwise comparison)
bounds_to_indices, // boolean bounds_to_indices, bounds_to_indices, // boolean bounds_to_indices,
...@@ -934,6 +969,7 @@ public class ComboMatch { ...@@ -934,6 +969,7 @@ public class ComboMatch {
} }
} }
} }
}
if (save_collection) { if (save_collection) {
try { try {
maps_collection.writeOrthoMapsCollection(orthoMapsCollection_path); maps_collection.writeOrthoMapsCollection(orthoMapsCollection_path);
...@@ -1132,8 +1168,8 @@ adjusted affines[1] for a pair: 1694564291_293695/1694564778_589341 ...@@ -1132,8 +1168,8 @@ adjusted affines[1] for a pair: 1694564291_293695/1694564778_589341
pairs, // int [][] pairs, pairs, // int [][] pairs,
scene_names); // String [] names) scene_names); // String [] names)
GenericJTabbedDialog gds = new GenericJTabbedDialog("Select image pair",1200,400); GenericJTabbedDialog gds = new GenericJTabbedDialog("Select image pair from the image",1200,400);
gds.addChoice("Operation:", choices, choices[choices.length-1]); gds.addChoice("Image pair in the marked image:", choices, choices[choices.length-1]);
gds.showDialog(); gds.showDialog();
if (gds.wasCanceled()) return null; if (gds.wasCanceled()) return null;
pair= gds.getNextChoiceIndex(); pair= gds.getNextChoiceIndex();
......
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