5 <& /util/import_javascript.mas, classes => [ 'jquery.iframe-post-form', 'CXGN.BreederSearch', 'd3.d3v4Min.js', "opencv.opencv" ] &>
8 .ui-autocomplete { z-index:2147483647; }
10 .straightLine, .hrLine{
12 background-color: red;
13 transition: transform .05s ease-in-out;
17 <div id="manage_drone_imagery_top_div">
19 <& /page/page_title.mas, title=>"Manage Aerial Imagery" &>
21 <div class="well well-sm">
22 <center><h4>Please use the Brave or Chrome web-browsers to view these image tools. In the future, other browsers may be supported.</h4></center>
26 #my $buttons_html = "<button class='btn btn-primary' style='margin:3px' id='upload_drone_imagery_link'>Upload Imagery</button><button class='btn btn-default' style='margin:3px' id='download_phenotypes_drone_imagery_link'>Download Image-Phenotypes</button><button class='btn btn-success' style='margin:3px' id='keras_cnn_drone_imagery_link'>CNN Models</button><button class='btn btn-success' style='margin:3px' id='drone_imagery_calculate_statistics_link'>Statistics</button><button class='btn btn-success' style='margin:3px' id='drone_imagery_analytics_link'>Analytics</button><button class='btn btn-default' style='margin:3px' id='drone_imagery_compare_field_images_link'>Compare Aerial Field Images</button><button class='btn btn-default' style='margin:3px' id='drone_imagery_view_imaging_vehicles_link'>Imaging Vehicles</button><button class='btn btn-default' style='margin:3px' id='export_drone_imagery_events'>Export Imaging Events</button>";
28 my $buttons_html = "<button class='btn btn-primary' style='margin:3px' id='upload_drone_imagery_link'>Upload Imagery</button><button class='btn btn-success' style='margin:3px' id='keras_cnn_drone_imagery_link'>CNN Models</button><button class='btn btn-success' style='margin:3px' id='drone_imagery_calculate_statistics_link'>Calculate Statistics</button><button class='btn btn-success' style='margin:3px' id='drone_imagery_analytics_link'>Analytics</button><button class='btn btn-default' style='margin:3px' id='drone_imagery_view_imaging_vehicles_link'>Imaging Vehicles</button><button class='btn btn-default' style='margin:3px' id='download_phenotypes_drone_imagery_link'>Download Image-Phenotype File</button><button class='btn btn-default' style='margin:3px' id='export_drone_imagery_events'>Export Imaging Events</button>";
31 <& /page/detail_page_2_col_section.mas, info_section_collapsed => 0, info_section_title => "<h4 style='display:inline'>Aerial Imagery</h4>", info_section_subtitle => 'Please cite <a href="https://acsess.onlinelibrary.wiley.com/doi/full/10.1002/ppj2.20004" target=_blank>ImageBreed</a> if you find any of these tools useful', buttons_html => $buttons_html, icon_class => undef, col1_width_class => "col-sm-0", col2_width_class => "col-sm-12", info_section_id => "manage_drone_imagery_main" &>
35 <& /breeders_toolbox/drone_imagery/drone_imagery_analytics.mas &>
36 <& /breeders_toolbox/drone_imagery/drone_imagery_analysis.mas &>
37 <& /breeders_toolbox/drone_imagery/drone_imagery_export_imaging_events.mas &>
38 <& /analyses/store_new_analysis_values_and_model.mas &>
40 <div id="manage_drone_imagery_standard_process_div" style="display:none">
42 <& /page/page_title.mas, title=>"Manage Aerial Imagery: Run A Standard Process On Orthophotomosaics" &>
44 <&| /util/workflow.mas, id=> "manage_drone_imagery_standard_process_workflow" &>
45 <&| /util/workflow.mas:step, title=> "Intro" &>
46 <& /page/page_title.mas, title=>"This workflow will guide you through applying a standard process to your aerial imaging bands" &>
47 <p>Here you can take one of the imaging event bands you uploaded all the way through the process to plot image saving. This will require manual steps such as image rotation, cropping, and plot polygon templating. After you have completed this process for one imaging event band, you can apply it to all other imaging event bands and other calculated vegetative indices.</p>
50 <button class="btn btn-primary" onclick="Workflow.complete(this); return false;">Go to Next Step</button>
53 <&| /util/workflow.mas:step, title=> "Imaging Event Band" &>
54 <& /page/page_title.mas, title=>"Select a imaging event band" &>
56 <div class="well well-sm">
57 <p>Please select one imaging event band to take through the process. It is recommended to select a band that has high contrast, such as a NIR band.</p>
60 <div class="well well-sm">
61 <div class="panel panel-default">
62 <div class="panel-body">
63 <table class="table table-bordered table-hover" id="manage_drone_imagery_standard_process_drone_run_bands_table">
67 <th>Imaging Event Band Name</th>
68 <th>Band Description</th>
70 <th>Imaging Event Name</th>
71 <th>Imaging Event Description</th>
72 <th>Imaging Event Date</th>
73 <th>Field Trial Name</th>
74 <th>Field Trial Description</th>
82 <button class="btn btn-primary" id="manage_drone_imagery_standard_process_drone_run_band_step">Go to Next Step</button>
89 <&| /util/workflow.mas:step, title=> "Use GCPs" &>
90 <& /page/page_title.mas, title=>"Use ground control points (GCPs) to automate the entire standard process" &>
92 <div class="well well-sm">
93 <p>If a previous imaging event on this field experiment has already completed the standard process, then that imaging event can be used to automate the rest of the standard process on this new imaging event.</p>
94 <p>If ground control points (GCPs) were defined for a previous imaging event, then GCPs can automate the standard process for this new imaging event.</p>
97 <div class="form-horizontal">
98 <div class="form-group form-group-sm">
99 <label class="col-sm-6 control-label">Has a previous imaging event on this field trial completed the standard process already?: </label>
100 <div class="col-sm-6">
101 <select class="form-control" id="manage_drone_imagery_standard_process_ground_control_points_option">
102 <option value="No">No</option>
103 <option value="Yes">Yes, and it has GCPs defined.</option>
104 <option value="Yes_camera_rig">Yes, and the same fixed camera rig was used.</option>
110 <div id="manage_drone_imagery_standard_process_ground_control_points_select_div" style="display:none">
111 <div class="well well-sm">
112 <div class="panel panel-default">
113 <div class="panel-body">
114 <div class="form-group form-group-sm">
115 <label class="col-sm-6 control-label">Select the aerial imaging event to use as a template: </label>
116 <div class="col-sm-6">
117 <div id="manage_drone_imagery_standard_process_ground_control_points_select"></div>
123 <div class="well well-sm">
125 <li>Click on the ground control points (GCPs) in the image below and save them.</li>
126 <li>Please click and save at least three points. The names of the GCPs MUST be consistent across imaging events!</li>
127 <li>For best results, use ground control points at the far four corners of the field.</li>
128 <li>You can zoom out on your browser (Cntrl + -).</li>
132 <div class="well well-sm">
133 <div id="project_drone_imagery_standard_process_ground_control_points_saved_div"></div>
137 <button class="btn btn-primary" id="manage_drone_imagery_standard_process_ground_control_points_step">Draw Computed Plot Polygons</button>
138 <button class="btn btn-primary" id="manage_drone_imagery_standard_process_ground_control_points_step_confirm">Confirm and Save</button>
142 <div id="project_drone_imagery_standard_process_ground_control_points_info_div"></div>
144 <div id="project_drone_imagery_standard_process_ground_control_points_loading_div"><img src="/img/wheel.gif" /></div>
146 <canvas id="project_drone_imagery_standard_process_ground_control_points_canvas_div"></canvas>
151 <div id="manage_drone_imagery_standard_process_previous_camera_rig_select_div" style="display:none">
152 <div class="well well-sm">
153 <div class="panel panel-default">
154 <div class="panel-body">
155 <div class="form-group form-group-sm">
156 <label class="col-sm-6 control-label">Select the aerial imaging event to use as a template. The same rotation, cropping, and plot-polygon template will be applied: </label>
157 <div class="col-sm-6">
158 <div id="manage_drone_imagery_standard_process_previous_camera_rig_select"></div>
164 <button class="btn btn-primary" id="manage_drone_imagery_standard_process_previous_camera_rig_step_confirm">Confirm and Save</button>
168 <div id="manage_drone_imagery_standard_process_ground_control_points_skip_div" style="display:none">
170 <button class="btn btn-primary" id="manage_drone_imagery_standard_process_ground_control_points_skip_step">Skip and Go to Next Step</button>
175 <&| /util/workflow.mas:step, title=> "Rotate" &>
176 <& /page/page_title.mas, title=>"Rotate your selected imaging event band" &>
178 <div class="well well-sm">
180 <li>Here you can do a rotation of your imaging event image.</li>
181 <li>You can zoom out on your browser (Cntrl + -).</li>
182 <li>Your image should have precise row-to-row parallel alignment.</li>
186 <div class="well well-sm">
188 <form class="form-horizontal">
189 <div class="form-group form-group-sm">
190 <label class="col-sm-6 control-label">Rotate Counter-Clockwise Degrees (Use Left and Right Arrows For Fine Tuning): </label>
191 <div class="col-sm-6">
192 <input type="range" min="-180" max="180" step="0.01" id="drone_imagery_standard_process_rotate_degrees_input" name="drone_imagery_standard_process_rotate_degrees_input" value="0.00"><div id="drone_imagery_standard_process_rotate_degrees_input_text"></div>
197 <!--button class="btn btn-primary" id="drone_imagery_standard_process_rotate_stitched_view">Rotate Image (Does Not Save)</button-->
198 <button class="btn btn-default" id="drone_imagery_standard_process_rotate_stitched_crosshairs">Draw Crosshairs Assist</button>
199 <!--button class="btn btn-default" id="drone_imagery_standard_process_rotate_stitched_restart">Restart</button-->
200 <button class="btn btn-primary" id="manage_drone_imagery_standard_process_rotate_step">Save Rotated Image And Go To Next Step</button>
203 <div id="manage_drone_imagery_standard_process_rotate_load_div">
204 <img src="/img/wheel.gif" />
207 <div id="drone_imagery_standard_process_rotate_original_stitched_div"></div>
210 <&| /util/workflow.mas:step, title=> "Cropping" &>
211 <& /page/page_title.mas, title=>"Crop your imaging event band to specific area of interest" &>
213 <div class="well well-sm">
215 <li>Here you can do a rough cropping of the stitched ortho image to focus only on the actual field experiment.</li>
216 <li>You can zoom out on your browser (Cntrl + -).</li>
217 <li>Click on four points in the image to make a four-sided polygon.</li>
218 <li>Only the last polygon that you draw will be used for the cropping.</li>
221 <button class="btn btn-primary" id="manage_drone_imagery_standard_process_cropping_step">Save and Go to Next Step</button>
224 <div id="manage_drone_imagery_standard_process_crop_load_div">
225 <img src="/img/wheel.gif" />
228 <canvas id="drone_imagery_standard_process_crop_original_stitched_div"></canvas>
231 <div class="well well-sm">
232 <form class="form-horizontal">
234 <div class="col-sm-12">
235 <div class="form-group form-group-sm">
236 <label class="col-sm-6 control-label">Previously Used Image Cropping For This Field Trial: </label>
237 <div class="col-sm-6">
238 <div id="plot_polygons_standard_process_previously_saved_image_cropping_templates">
245 <button class="btn btn-primary" id="drone_imagery_standard_process_cropping_use_previous_cropping">Use Image Cropping</button>
249 <&| /util/workflow.mas:step, title=> "Thresholding" &>
250 <& /page/page_title.mas, title=>"Threshold your imaging event band to remove background" &>
253 <&| /page/info_section.mas, title => 'Remove Background Using Percentage Threshold', collapsible=>1, collapsed => 0, subtitle=> 'Remove the background by specifying percentage threshold value' &>
254 <div class="panel panel-default">
255 <div class="panel-body">
257 <div class="col-sm-6">
258 <div class="form-group form-group-sm">
259 <label class="col-sm-6 control-label">Discard Lowest Percent of Pixel Values: </label>
260 <div class="col-sm-6">
261 <input class="form-control" id="drone_imagery_standard_process_remove_background_lower_threshold_percentage" name="drone_imagery_standard_process_remove_background_lower_threshold_percentage" type="number" max="99" min="0" placeholder="e.g. 10% of lowest pixel values (Min 0, Max 100)" value=25 disabled/>
265 <div class="col-sm-6">
266 <div class="form-group form-group-sm">
267 <label class="col-sm-6 control-label">Discard Highest Percent of Pixel Values: </label>
268 <div class="col-sm-6">
269 <input class="form-control" id="drone_imagery_standard_process_remove_background_upper_threshold_percentage" name="drone_imagery_standard_process_remove_background_upper_threshold_percentage" type="number" max="99" min="0" placeholder="e.g. 10% of highest pixel values (Min 0, Max 100)" value=25 disabled/>
280 <button id="drone_imagery_standard_process_remove_background_defined_percentage_submit" class="btn btn-primary">Apply Threshold</button>
285 <div id="manage_drone_imagery_standard_process_remove_background_load_div">
286 <img src="/img/wheel.gif" />
289 <div class="well well-sm">
290 <&| /page/info_section.mas, title => 'Histogram of pixel values', collapsible=>1, collapsed => 0, subtitle=> 'Histogram of Pixel Values' &>
292 <canvas id="drone_imagery_standard_process_remove_background_histogram_div"></canvas>
297 <div class="well well-sm">
298 <&| /page/info_section.mas, title => 'Denoised Original Image', collapsible=>1, collapsed => 0, subtitle=> 'Denoised Original Image' &>
300 <canvas id="drone_imagery_standard_process_remove_background_original"></canvas>
306 <&| /util/workflow.mas:step, title=> "Plot Polygons" &>
307 <& /page/page_title.mas, title=>"Define plot polygons relative to the field layout" &>
309 <& /page/detail_page_2_col_section.mas, info_section_collapsible=>1, info_section_collapsed=>0, info_section_title => "<h4 style='display:inline'>Generate Polygon Template Tool</h4>", info_section_subtitle => 'Overlay a uniform grid over the image.', icon_class => "glyphicon glyphicon-th-large", info_section_id => "manage_drone_imagery_standard_process_generate_plot_polygons_section" &>
311 <div class="well well-sm">
312 <div id="drone_imagery_standard_process_plot_polygons_top_section"></div>
314 <button id="drone_imagery_standard_process_plot_polygons_clear" class="btn btn-danger">Clear All Polygons</button>
315 <button id="drone_imagery_standard_process_plot_polygons_clear_one" class="btn btn-danger">Clear One Polygon</button>
316 <button id="drone_imagery_standard_process_plot_polygons_get_distance" class="btn btn-default">Find Distance Between Points</button>
317 <button id="drone_imagery_standard_process_plot_polygons_switch_image_url" class="btn btn-default">Switch Between Original and Background Removed Image</button>
320 <div id="manage_drone_imagery_standard_process_plot_polygons_load_div">
321 <img src="/img/wheel.gif" />
324 <canvas id="drone_imagery_standard_process_plot_polygons_original_stitched_div"></canvas>
327 <div class="well well-sm">
328 <h2>Either, Manually Assign Plot Numbers to Generated Polygons</h2>
330 <&| /page/info_section.mas, title => 'Manually Assign Plot Numbers to Polygon Numbers', collapsible=>1, collapsed => 1, subtitle=> 'Table for manually assigning plot numbers to polygon numbers.' &>
331 <div id="drone_imagery_standard_process_generated_polygons_table"></div>
335 <div id="drone_imagery_standard_process_generated_polygons_div"></div>
338 <div class="well well-sm">
339 <div id="drone_imagery_standard_process_trial_layout_div"></div>
343 <&| /util/workflow.mas:step, title=> "Apply" &>
344 <& /page/page_title.mas, title=>"Apply these same steps to other imaging event bands in the current imaging event" &>
346 <div class="well well-sm">
348 <li>Here you can apply the same actions you did for the previous steps 1 to 6, to additional imaging event bands in this imaging event.</li>
349 <li>Thresholding will be done dynamically, by removing the top and bottom 20% of pixel values.</li>
353 <div class="well well-sm">
354 <div class="panel panel-default">
355 <div class="panel-body">
356 <table class="table table-bordered table-hover" id="manage_drone_imagery_standard_process_drone_run_bands_apply_table">
360 <th>Imaging Event Band Name</th>
361 <th>Band Description</th>
363 <th>Imaging Event Name</th>
364 <th>Imaging Event Description</th>
365 <th>Imaging Event Date</th>
366 <th>Field Trial Name</th>
367 <th>Field Trial Description</th>
375 <button class="btn btn-primary" id="manage_drone_imagery_standard_process_drone_run_band_apply_step">Go to Next Step</button>
381 <&| /util/workflow.mas:step, title=> "Indices" &>
382 <& /page/page_title.mas, title=>"Create and apply these same steps to vegetative indices" &>
384 <form class="form-horizontal">
385 <div class="form-group form-group-sm">
386 <label class="col-sm-6 control-label">Vegetative Indices To Apply: </label>
387 <div class="col-sm-6">
388 <input name="drone_imagery_standard_process_apply_indices_select" value="TGI" type="checkbox" checked> Triangular Greenness Index (TGI) <br/>
389 <input name="drone_imagery_standard_process_apply_indices_select" value="VARI" type="checkbox" checked> Visible Atmospheric Resistant Index (VARI) <br/>
390 <input name="drone_imagery_standard_process_apply_indices_select" value="NDVI" type="checkbox" checked> Normalized Difference Vegetative Index (NDVI) <br/>
391 <input name="drone_imagery_standard_process_apply_indices_select" value="NDRE" type="checkbox" checked> Normalized Difference Red Edge Vegetative Index (NDRE) <br/>
399 <button type="button" class="btn btn-primary" id="manage_drone_imagery_standard_process_indices_step">Go to Next Step</button>
402 <&| /util/workflow.mas:step, title=> "Phenotypes" &>
403 <& /page/page_title.mas, title=>"Calculate phenotypes for all plot polygon images" &>
405 <form class="form-horizontal">
406 <div class="form-group form-group-sm">
407 <label class="col-sm-6 control-label">Zonal Statistics to Calculate and Save in Database: </label>
408 <div class="col-sm-6">
409 <input name="drone_imagery_standard_process_phenotypes_select" value="zonal" type="checkbox" checked disabled> Zonal Statistics: nonzero_pixel_count, total_pixel_sum, mean_pixel_value, harmonic_mean_value, median_pixel_value, variance_pixel_value, stdev_pixel_value, pstdev_pixel_value, min_pixel_value, max_pixel_value, minority_pixel_value, minority_pixel_count, majority_pixel_value, majority_pixel_count, pixel_variety_count <br/>
412 <div class="form-group form-group-sm">
413 <label class="col-sm-6 control-label">Apply same standard process to all uploaded imaging events that use the same camera rig: </label>
414 <div class="col-sm-6">
415 <select class="form-control" id="drone_imagery_standard_process_camera_rig_apply_select">
416 <option value="No">No</option>
417 <option value="Yes">Yes</option>
424 <div id="drone_imagery_standard_process_week_term_div"></div>
427 <button type="button" class="btn btn-info" id="manage_drone_imagery_standard_process_phenotypes_step">Finish</button>
434 <& /breeders_toolbox/drone_imagery/standard_process_raw_images.mas &>
436 <div id="project_drone_imagery_ground_control_points_div" style="display:none">
438 <& /page/page_title.mas, title=>"Manage Aerial Imagery: Save Ground Control Points" &>
440 <div id="project_drone_imagery_ground_control_points_title_div"></div>
442 <div class="well well-sm">
444 <li>Click on the ground control points (GCPs) in the image below and save them.</li>
445 <li>Please click and save at least three points. The names of the GCPs MUST be consistent across imaging events!.</li>
446 <li>You can move to different images (e.g. blue, green, red, NIR, BGR) which are available after the standard process has been completed.</li>
447 <li>You can zoom out on your browser (Cntrl + -).</li>
451 <div id="project_drone_imagery_ground_control_points_next_buttons" style="display:none">
452 <button class="btn btn-default" id="project_drone_imagery_ground_control_points_previous_image">View Previous Image Type</button>
453 <button class="btn btn-default" id="project_drone_imagery_ground_control_points_next_image">View Next Image Type</button>
457 <div class="well well-sm">
458 <div id="project_drone_imagery_ground_control_points_saved_div"></div>
461 <div id="project_drone_imagery_ground_control_points_image_type_div"></div>
462 <div id="project_drone_imagery_ground_control_points_info_div"></div>
464 <div id="project_drone_imagery_ground_control_points_loading_div"><img src="/img/wheel.gif" /></div>
466 <canvas id="project_drone_imagery_ground_control_points_canvas_div"></canvas>
470 <div class="modal fade" id="project_drone_imagery_ground_control_points_form_dialog" name="project_drone_imagery_ground_control_points_form_dialog" tabindex="-1" role="dialog" aria-labelledby="saveGroundControlPointsDialog">
471 <div class="modal-dialog" role="document">
472 <div class="modal-content">
473 <div class="modal-header">
474 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
475 <h4 class="modal-title" id="saveGroundControlPointsDialog">Save Ground Control Points</h4>
477 <div class="modal-body">
478 <div class="container-fluid">
479 <div class="form-horizontal">
480 <div class="form-group form-group-sm">
481 <label class="col-sm-6 control-label">Ground Control Point Name (Can overwrite if same name is used. Names MUST be consistent across imaging events!): </label>
482 <div class="col-sm-6">
483 <input class="form-control" id="project_drone_imagery_ground_control_points_form_input_name" name="project_drone_imagery_ground_control_points_form_input_name" type="text" placeholder="e.g. NorthWest Corner, or Point 1" />
486 <div class="form-group form-group-sm">
487 <label class="col-sm-6 control-label">Latitude (optional): </label>
488 <div class="col-sm-6">
489 <input class="form-control" id="project_drone_imagery_ground_control_points_form_input_latitude" name="project_drone_imagery_ground_control_points_form_input_latitude" type="text" />
492 <div class="form-group form-group-sm">
493 <label class="col-sm-6 control-label">Longitude (optional): </label>
494 <div class="col-sm-6">
495 <input class="form-control" id="project_drone_imagery_ground_control_points_form_input_longitude" name="project_drone_imagery_ground_control_points_form_input_longitude" type="text" />
498 <div class="form-group form-group-sm">
499 <label class="col-sm-6 control-label">X Pos: </label>
500 <div class="col-sm-6">
501 <input class="form-control" id="project_drone_imagery_ground_control_points_form_input_x_pos" name="project_drone_imagery_ground_control_points_form_input_x_pos" type="text" />
504 <div class="form-group form-group-sm">
505 <label class="col-sm-6 control-label">Y Pos: </label>
506 <div class="col-sm-6">
507 <input class="form-control" id="project_drone_imagery_ground_control_points_form_input_y_pos" name="project_drone_imagery_ground_control_points_form_input_y_pos" type="text" />
513 <div class="modal-footer">
514 <button type="button" class="btn btn-primary" id="project_drone_imagery_ground_control_points_form_save">Save GCP</button>
515 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
521 <div id="manage_drone_imagery_standard_process_raw_images_div" style="display:none">
523 <& /page/page_title.mas, title=>"Manage Aerial Imagery: Run A Standard Process On Raw Images" &>
525 <&| /util/workflow.mas, id=> "manage_drone_imagery_standard_process_raw_images_workflow" &>
526 <&| /util/workflow.mas:step, title=> "Intro" &>
527 <& /page/page_title.mas, title=>"This workflow will guide you through applying a standard process to your aerial imaging bands" &>
529 <div class="well well-sm">
530 <p>This process will allow you to manually assign plot-polygons to the raw images.</p>
535 <button class="btn btn-primary" onclick="Workflow.complete(this); return false;">Go to Next Step</button>
538 <&| /util/workflow.mas:step, title=> "Plot Polygons" &>
539 <& /page/page_title.mas, title=>"Manually assign plot-polygons to raw images" &>
541 <div class="well well-sm">
543 <li>(1) Select an image from the grid below and adjust the rotation.</li>
544 <li>(2) Click the four corners encompassing a group of plots of interest. Alternatively, paste a previously used template.</li>
545 <li>(3) Type the plot numbers corresponding to the drawn plot-polygons in the drawn table.</li>
546 <li>(4) Click assign plot-polygons to save. Repeat steps 1 to 4 until all plots have been assigned an image.</li>
550 <div class="form-horizontal">
551 <div class="form-group form-group-sm">
552 <label class="col-sm-2 control-label">Click Raw Image Stack: </label>
553 <div class="col-sm-10">
554 <div id="drone_imagery_standard_process_raw_images_image_id_select_div"></div>
560 <canvas id="drone_imagery_standard_process_raw_images_show"></canvas>
561 <canvas id="drone_imagery_standard_process_raw_images_show_another_image"></canvas>
562 <canvas id="drone_imagery_standard_process_raw_images_show_another_image_second"></canvas>
565 <button class="btn btn-default btn-sm" id="drone_imagery_standard_process_raw_images_paste_previous_polygon_in_place" onclick="return false;">Paste Previously Used Plot-Polygon</button>
566 <button class="btn btn-default btn-sm" id="drone_imagery_standard_process_raw_images_paste_previous_polygon_view_image" onclick="return false;">View Another Image Also</button>
567 <button class="btn btn-default btn-sm" id="drone_imagery_standard_process_raw_images_paste_previous_polygon_view_image_second" onclick="return false;">View Another Image Also</button>
570 <form class="form-horizontal">
571 <div class="form-group form-group-sm">
572 <label class="col-sm-6 control-label">Rotate Counter-Clockwise Degrees: </label>
573 <div class="col-sm-6">
574 <input class="form-control" id="drone_imagery_standard_process_raw_images_rotate_degrees_input" name="drone_imagery_standard_process_raw_images_rotate_degrees_input" type="text" placeholder="Number of degrees to rotate" value="0.00"/>
578 <button class="btn btn-primary btn-sm" id="drone_imagery_standard_process_raw_images_rotate_image" onclick="return false;">Rotate Image</button>
581 <form class="form-horizontal">
582 <div class="form-group form-group-sm">
583 <label class="col-sm-6 control-label">Trained Mask R-CNN Models: </label>
584 <div class="col-sm-6">
585 <div id="drone_imagery_standard_process_raw_images_retrain_mask_rcnn_models_div"></div>
589 <button class="btn btn-primary btn-sm" id="drone_imagery_standard_process_raw_images_retrain_mask_rcnn_predict_button" onclick="return false;">Predict Mask</button>
590 <button class="btn btn-primary btn-sm" id="drone_imagery_standard_process_raw_images_retrain_mask_rcnn_modal_button" onclick="return false;">Retrain Mask R-CNN</button>
594 <button class="btn btn-primary btn-sm" id="drone_imagery_standard_process_raw_images_save_polygon" onclick="return false;">Save Plot-Polygon</button>
595 <button class="btn btn-primary btn-sm" id="drone_imagery_standard_process_raw_images_paste_polygon" onclick="return false;">Paste Plot-Polygon</button>
596 <button class="btn btn-danger btn-sm" id="drone_imagery_standard_process_raw_images_clear_polygon" onclick="return false;">Start Over</button>
600 <form class="form-horizontal">
601 <div class="form-group form-group-sm">
602 <label class="col-sm-6 control-label">Previously used plot-polygons: </label>
603 <div class="col-sm-6">
604 <div id="drone_imagery_standard_process_raw_images_previous_polygons_div"></div>
608 <button class="btn btn-primary btn-sm" id="drone_imagery_standard_process_raw_images_paste_previous_polygon" onclick="return false;">Paste Previously Used Plot-Polygon To A New Point</button>
611 <div class="form-horizontal">
612 <div class="form-group form-group-sm">
613 <label class="col-sm-3 control-label">Number of Rows: </label>
614 <div class="col-sm-9">
615 <input type="number" class="form-control" id="drone_imagery_standard_process_raw_images_number_rows" name="drone_imagery_standard_process_raw_images_number_rows" placeholder="0"/>
618 <div class="form-group form-group-sm">
619 <label class="col-sm-3 control-label">Number of Columns: </label>
620 <div class="col-sm-9">
621 <input type="number" class="form-control" id="drone_imagery_standard_process_raw_images_number_columns" name="drone_imagery_standard_process_raw_images_number_columns" placeholder="0"/>
624 <div class="form-group form-group-sm">
625 <label class="col-sm-3 control-label">Template Name: </label>
626 <div class="col-sm-9">
627 <input type="text" class="form-control" id="drone_imagery_standard_process_raw_images_partial_template_name" name="drone_imagery_standard_process_raw_images_partial_template_name" placeholder="e.g. 3rd Range 2x4"/>
631 <button class="btn btn-primary btn-sm" id="drone_imagery_standard_process_raw_images_draw_polygons" onclick="return false;">Draw Plot-Polygon (Does Not Save)</button>
634 <div id="drone_imagery_standard_process_raw_images_polygon_assign_table" name="drone_imagery_standard_process_raw_images_polygon_assign_table"></div>
638 <button class="btn btn-primary" id="drone_imagery_standard_process_raw_images_assign_plot" onclick="return false;">Assign Plot Images (Saves)</button>
642 <div id="drone_imagery_standard_process_raw_images_assigned_plot_images" name="drone_imagery_standard_process_raw_images_assigned_plot_images"></div>
648 <div id="manage_drone_imagery_rotate_div" style="display:none">
650 <& /page/page_title.mas, title=>"Manage Aerial Imagery: Rotate Stitched Image" &>
652 <div class="well well-sm">
654 <li>Here you can rotate the stitched image so that the rows and columns align exactly vertically and horizontally.</li>
655 <li>The rotation can be done on decimals of degrees.</li>
656 <li>Negative values mean clock-wise and positive values mean counter-clockwise.</li>
657 <li>Crosshairs are only for assisting in alignment and they will not be saved.</li>
660 <div class="well well-sm">
662 <form class="form-horizontal">
663 <div class="form-group form-group-sm">
664 <label class="col-sm-6 control-label">Rotate Counter-Clockwise Degrees: </label>
665 <div class="col-sm-6">
666 <input class="form-control" id="drone_imagery_rotate_degrees_input" name="drone_imagery_rotate_degrees_input" type="text" placeholder="Number of degrees to rotate" value="0.00"/>
671 <button class="btn btn-primary" id="drone_imagery_rotate_stitched_view">Rotate Image (Does Not Save)</button>
672 <button class="btn btn-default" id="drone_imagery_rotate_stitched_crosshairs">Draw Crosshairs Assist</button>
673 <button class="btn btn-default" id="drone_imagery_rotate_stitched_restart">Restart</button>
674 <button class="btn btn-primary" id="drone_imagery_rotate_stitched_submit">Save Rotated Image</button>
677 <div id="manage_drone_imagery_rotate_load_div">
678 <img src="/img/wheel.gif" />
681 <canvas id="drone_imagery_rotate_original_stitched_div">
685 <div id="manage_drone_imagery_crop_div" style="display:none">
687 <& /page/page_title.mas, title=>"Manage Aerial Imagery: Crop Stitched Image To Field Experiment" &>
689 <div class="well well-sm">
691 <li>Here you can do a rough cropping of the stitched ortho image to focus only on the actual field experiment.</li>
692 <li>You can zoom out on your browser (Cntrl + -).</li>
693 <li>Click on four points in the image to make a four-sided polygon.</li>
694 <li>Only the last polygon that you draw will be used for the cropping.</li>
697 <button class="btn btn-primary" id="drone_imagery_crop_stitched_submit">Crop Image To Selected Polygon</button>
700 <div class="well well-sm">
701 <form class="form-horizontal">
703 <div class="col-sm-12">
704 <div class="form-group form-group-sm">
705 <label class="col-sm-6 control-label">Previously Used Image Cropping For This Field Trial: </label>
706 <div class="col-sm-6">
707 <div id="plot_polygons_previously_saved_image_cropping_templates">
714 <button class="btn btn-primary" id="drone_imagery_cropping_use_previous_cropping">Use Image Cropping</button>
717 <div id="manage_drone_imagery_crop_load_div">
718 <img src="/img/wheel.gif" />
721 <canvas id="drone_imagery_crop_original_stitched_div"></canvas>
724 <div id="manage_drone_imagery_vegetative_index_div" style="display:none">
726 <& /page/page_title.mas, title=>"Manage Aerial Imagery: Convert to Vegetative Index" &>
728 <div class="well well-sm">
730 <li>Here you can convert to a vegetative index.</li>
731 <li>If you have a NIR band, you can calculate "Normalized difference vegetative index", NDVI.</li>
732 <li>If you have an RGB image, you can calculate "Visible atmospheric resistant index", VARI, or "Triangular greenness index", TGI.</li>
733 <li>If you have red or blue or green, or images from any spectral band, you can calculate ratios to use as your vegetative index.</li>
738 <div id="manage_drone_imagery_vegetative_index_tgi_bgr_div" style="display:none">
739 <button class="btn btn-primary" id="drone_imagery_vegetative_index_TGI_bgr">Calculate "Triangular Greenness Index" TGI. TGI = {Green band2} - 0.39*{Red band3} - 0.61*{Blue band1}</button>
742 <div id="manage_drone_imagery_vegetative_index_vari_bgr_div" style="display:none">
743 <button class="btn btn-primary" id="drone_imagery_vegetative_index_VARI_bgr">Calculate "Visible Atmospheric Resistant Index" VARI. VARI = ({Green band2} - {Red band3}) / ({Green band2} + {Red band3} - {Blue band1})</button>
746 <div id="manage_drone_imagery_vegetative_index_tgi_rgb_div" style="display:none">
747 <button class="btn btn-primary" id="drone_imagery_vegetative_index_TGI_rgb">Calculate "Triangular Greenness Index" TGI. TGI = {Green band2} - 0.39*{Red band1} - 0.61*{Blue band3}</button>
750 <div id="manage_drone_imagery_vegetative_index_vari_rgb_div" style="display:none">
751 <button class="btn btn-primary" id="drone_imagery_vegetative_index_VARI_rgb">Calculate "Visible Atmospheric Resistant Index" VARI. VARI = ({Green band2} - {Red band1}) / ({Green band2} + {Red band1} - {Blue band3})</button>
754 <div id="manage_drone_imagery_vegetative_index_ndvi_div" style="display:none">
755 <button class="btn btn-primary" id="drone_imagery_vegetative_index_NDVI">Calculate "Normalized Difference Vegetative Index" NDVI. NDVI = ({NIR band1} - {Red band2}) / ({NIR band1} + {Red band2})</button>
758 <div id="manage_drone_imagery_vegetative_index_ndre_div" style="display:none">
759 <button class="btn btn-primary" id="drone_imagery_vegetative_index_NDRE">Calculate "Normalized Difference Red Edge" NDRE. NDRE = ({NIR band1} - {Red Edge band2}) / ({NIR band1} + {Red Edge band2})</button>
763 <button class="btn btn-success" id="drone_imagery_rgb_vegetative_index_submit">Finish and Save Vegetative Index</button>
766 <canvas id="drone_imagery_vegetative_index_original_stitched_div"></canvas>
769 <div id="manage_drone_imagery_remove_background_div" style="display:none">
771 <& /page/page_title.mas, title=>"Manage Aerial Imagery: Remove Background" &>
774 <&| /page/info_section.mas, title => 'Remove Background Using Graphical Threshold', collapsible=>1, collapsed => 1, subtitle=> 'Remove the background using a simple threshold value' &>
776 <div class="panel panel-default">
777 <div class="panel-body">
778 <div class="well well-sm">
779 <h5>The background can be removed by placing a threshold on pixel values</h5>
781 <li><b>1.</b> Click on the two right-most, highest peaks in the histogram. The right most peak represents the pixels we are interested in, while the peak immediately to the left of that peak represents the soil background.</li>
782 <li><b>2.</b> Click on the "Find Minimum" button.</li>
783 <li><b>3.</b> If the image looks good with the applied threshold, click Save. Otherwise, you can start over.</li>
787 <div class="well well-sm">
788 <div name="drone_imagery_remove_background_threshold_current"></div>
789 <div name="drone_imagery_remove_background_threshold"></div>
792 <canvas id="drone_imagery_remove_background_histogram_div"></canvas>
794 <button class="btn btn-primary" id="drone_imagery_remove_background_find_minimum">Find Minimum (Does Not Save)</button>
795 <button class="btn btn-default" id="drone_imagery_remove_background_start_over">Start Over</button>
796 <button class="btn btn-primary" id="drone_imagery_remove_background_submit">Save</button>
803 <&| /page/info_section.mas, title => 'Remove Background Using User Defined Threshold', collapsible=>1, collapsed => 1, subtitle=> 'Remove the background using a simple threshold value' &>
804 <div class="panel panel-default">
805 <div class="panel-body">
807 <div class="col-sm-6">
808 <div class="form-group form-group-sm">
809 <label class="col-sm-6 control-label">Discard Pixels with Value Lower Than: </label>
810 <div class="col-sm-6">
811 <input class="form-control" id="drone_imagery_remove_background_lower_threshold" name="drone_imagery_remove_background_lower_threshold" type="number" max="255" min="0" placeholder="e.g. 10 (Min 0)" />
815 <div class="col-sm-6">
816 <div class="form-group form-group-sm">
817 <label class="col-sm-6 control-label">Discard Pixels with Value Higher Than: </label>
818 <div class="col-sm-6">
819 <input class="form-control" id="drone_imagery_remove_background_upper_threshold" name="drone_imagery_remove_background_upper_threshold" type="number" max="255" min="0" placeholder="e.g. 200 (Max 255)"/>
824 <button id="drone_imagery_remove_background_defined_submit" class="btn btn-primary">Apply Threshold</button>
830 <&| /page/info_section.mas, title => 'Remove Background Using Percentage Threshold', collapsible=>1, collapsed => 1, subtitle=> 'Remove the background by specifying percentage threshold value' &>
831 <div class="panel panel-default">
832 <div class="panel-body">
834 <div class="col-sm-6">
835 <div class="form-group form-group-sm">
836 <label class="col-sm-6 control-label">Discard Lowest Percent of Pixel Values: </label>
837 <div class="col-sm-6">
838 <input class="form-control" id="drone_imagery_remove_background_lower_threshold_percentage" name="drone_imagery_remove_background_lower_threshold_percentage" type="number" max="99" min="0" placeholder="e.g. 10% of lowest pixel values (Min 0, Max 100)" />
842 <div class="col-sm-6">
843 <div class="form-group form-group-sm">
844 <label class="col-sm-6 control-label">Discard Highest Percent of Pixel Values: </label>
845 <div class="col-sm-6">
846 <input class="form-control" id="drone_imagery_remove_background_upper_threshold_percentage" name="drone_imagery_remove_background_upper_threshold_percentage" type="number" max="99" min="0" placeholder="e.g. 10% of highest pixel values (Min 0, Max 100)"/>
851 <button id="drone_imagery_remove_background_defined_percentage_submit" class="btn btn-primary">Apply Threshold</button>
859 <div id="manage_drone_imagery_remove_background_load_div">
860 <img src="/img/wheel.gif" />
863 <canvas id="drone_imagery_remove_background_original"></canvas>
866 <div id="manage_drone_imagery_plot_polygons_div" style="display:none">
868 <& /page/page_title.mas, title=>"Manage Aerial Imagery: Define Plot Polygons" &>
870 <div id="manage_drone_imagery_plot_polygons_div_title"></div>
872 <& /page/detail_page_2_col_section.mas, info_section_collapsible=>1, info_section_collapsed=>0, info_section_title => "<h4 style='display:inline'>Generate Polygon Template Tool</h4>", info_section_subtitle => 'Overlay a uniform grid over the image.', icon_class => "glyphicon glyphicon-th-large", info_section_id => "manage_drone_imagery_generate_plot_polygons_section" &>
874 <div class="well well-sm">
875 <div id="drone_imagery_plot_polygons_top_section"></div>
877 <button id="drone_imagery_plot_polygons_clear" class="btn btn-danger">Clear All Polygons</button>
878 <button id="drone_imagery_plot_polygons_clear_one" class="btn btn-danger">Remove One Polygon</button>
879 <button id="drone_imagery_plot_polygons_get_distance" class="btn btn-default">Find Distance Between Points</button>
882 <div id="manage_drone_imagery_plot_polygons_load_div">
883 <img src="/img/wheel.gif" />
886 <canvas id="drone_imagery_plot_polygons_original_stitched_div"></canvas>
888 <div id="drone_imagery_generated_polygons_div"></div>
891 <div class="well well-sm">
892 <div id="drone_imagery_trial_layout_div"></div>
896 <div id="manage_drone_imagery_calculate_phenotypes_div" style="display:none">
898 <& /page/page_title.mas, title=>"Manage Aerial Imagery: Calculate Phenotypes" &>
900 <div class="well well-sm">
902 <li>Here you can calculate phenotypes for all plot polygons at once.</li>
907 <button class="btn btn-primary" id="drone_imagery_calculate_phenotypes_zonal_stats">Zonal Statistics</button>
908 <button class="btn btn-primary" id="drone_imagery_calculate_phenotypes_sift">Calculate SIFT Features</button>
909 <button class="btn btn-primary" id="drone_imagery_calculate_phenotypes_surf">Calculate SURF Features</button>
910 <button class="btn btn-primary" id="drone_imagery_calculate_phenotypes_orb">Calculate ORB Features</button>
913 <div id="manage_drone_imagery_calculate_phenotypes_show_zonal_stats" style="overflow:scroll"></div>
914 <div id="manage_drone_imagery_calculate_phenotypes_show_fourier_transform" style="overflow:scroll"></div>
915 <div id="manage_drone_imagery_calculate_phenotypes_show_sift"></div>
916 <div id="manage_drone_imagery_calculate_phenotypes_show_surf"></div>
917 <div id="manage_drone_imagery_calculate_phenotypes_show_orb"></div>
921 <div id="manage_drone_imagery_quality_control_div" style="display:none">
923 <& /page/page_title.mas, title=>"Manage Aerial Imagery: Quality Control Plot Images" &>
925 <div class="well well-sm">
927 <li>Here you can obsolete plot images that are not correct.</li>
928 <li>This is useful when using raw images because the process is more noisy.</li>
929 <li>Clicking a checkbox will automatically obsolete the image!</li>
933 <div id="drone_imagery_quality_control_div"></div>
936 <div id="manage_drone_imagery_field_trial_time_series_div" style="display:none">
938 <& /page/page_title.mas, title=>"Manage Aerial Imagery: Field Trial Image TimeSeries" &>
940 <div id="manage_drone_imagery_field_trial_time_series_div_title"></div>
942 <div class="well well-sm">
944 <li>Here you can view the plot polygon templates on the imagery over the course of the field trial. All of the image bands are visible here (e.g. blue, green, RGB, etc).</li>
945 <li>Click on a plot polygon to go to the plot detail page.</li>
946 <li>You can zoom out on your browser (Cntrl + -).</li>
950 <div class="well well-sm">
951 <div class="panel panel-default">
952 <div class="panel-body">
953 <div id="manage_drone_imagery_field_trial_time_series_times_div"></div>
954 <div id="manage_drone_imagery_field_trial_time_series_image_type_div"></div>
959 <div id="manage_drone_imagery_field_trial_time_series_info_div"></div>
960 <div id="manage_drone_imagery_field_trial_time_series_loading_div">
961 <img src="/img/wheel.gif" />
963 <canvas id="manage_drone_imagery_field_trial_time_series_canvas_div"></canvas>
967 <div class="modal fade" id="manage_drone_imagery_field_trial_time_series_popup" name="manage_drone_imagery_field_trial_time_series_popup" tabindex="-1" role="dialog" aria-labelledby="droneImageryTImeSeriesHoverDialog" data-backdrop="static">
968 <div class="modal-dialog modal-xl" role="document">
969 <div class="modal-content">
970 <div class="modal-header">
971 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
972 <h4 class="modal-title" id="droneImageryTImeSeriesHoverDialog">Plot Information</h4>
974 <div class="modal-body">
975 <div class="container-fluid">
976 <div id="manage_drone_imagery_field_trial_time_series_popup_content"></div>
977 <div id="manage_drone_imagery_field_trial_time_series_popup_content_figure1"></div>
978 <div id="manage_drone_imagery_field_trial_time_series_popup_content_figure2"></div>
979 <div id="manage_drone_imagery_field_trial_time_series_popup_content_figure3"></div>
982 <div class="modal-footer">
983 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
989 <div id="manage_drone_imagery_loading_div" style="display:none">
990 <& /page/page_title.mas, title=>"Loading..." &>
991 <div class="well well-sm">
993 <h3>Please wait...</h3>
995 <img src="/img/wheel.gif" />
1000 <div class="modal fade" id="drone_imagery_assign_plot_dialog" name="drone_imagery_assign_plot_dialog" tabindex="-1" role="dialog" aria-labelledby="droneImageryAssignPlotDialog" data-backdrop="static">
1001 <div class="modal-dialog modal-sm" role="document">
1002 <div class="modal-content">
1003 <div class="modal-header">
1004 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
1005 <h4 class="modal-title" id="droneImageryAssignPlotDialog">Assign Plot</h4>
1007 <div class="modal-body">
1008 <div class="container-fluid">
1009 <form class="form-horizontal" id="drone_imagery_assign_plot_form">
1010 <div class="form-group">
1011 <label class="col-sm-5 control-label">Plot Name:</label>
1012 <div class="col-sm-7">
1013 <input class="form-control" id="drone_imagery_plot_polygon_assign_plot_name" name="drone_imagery_plot_polygons_autocomplete" type="text" placeholder="Auto-completes plot name..." />
1019 <div class="modal-footer">
1020 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
1021 <button type="button" class="btn btn-primary" id="drone_imagery_plot_polygon_assign_add">Assign Plot</button>
1027 <div class="modal fade" id="drone_imagery_plot_polygon_remove_polygon" name="drone_imagery_plot_polygon_remove_polygon" tabindex="-1" role="dialog" aria-labelledby="droneImageryRemovePlotPolygonDialog" data-backdrop="static">
1028 <div class="modal-dialog modal-sm" role="document">
1029 <div class="modal-content">
1030 <div class="modal-header">
1031 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
1032 <h4 class="modal-title" id="droneImageryRemovePlotPolygonDialog">Remove Plot Polygon</h4>
1034 <div class="modal-body">
1035 <div class="container-fluid">
1036 <form class="form-horizontal" id="drone_imagery_plot_polygon_remove_polygon_form">
1037 <div class="form-group">
1038 <label class="col-sm-5 control-label">Polygon Identifier:</label>
1039 <div class="col-sm-7">
1040 <input class="form-control" id="drone_imagery_plot_polygon_remove_polygon_number" name="drone_imagery_plot_polygon_remove_polygon_number" type="number" placeholder="e.g. 3" />
1046 <div class="modal-footer">
1047 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
1048 <button type="button" class="btn btn-primary" id="drone_imagery_plot_polygon_remove_polygon_submit">Remove Plot Polygon</button>
1054 <div class="modal fade" id="drone_imagery_merge_channels_dialog" name="drone_imagery_merge_channels_dialog" tabindex="-1" role="dialog" aria-labelledby="droneImageryMergeChannelsDialog" data-backdrop="static">
1055 <div class="modal-dialog modal-xl" role="document">
1056 <div class="modal-content">
1057 <div class="modal-header">
1058 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
1059 <h4 class="modal-title" id="droneImageryMergeChannelsDialog">Merge Imaging Event Bands Into Single 3-channel image</h4>
1061 <div class="modal-body">
1062 <div class="container-fluid">
1063 <form class="form-horizontal" id="drone_imagery_merge_bands_form">
1064 <div class="form-group">
1065 <label class="col-sm-5 control-label">First Band:</label>
1066 <div class="col-sm-7">
1067 <div id="drone_imagery_merge_bands_band1_select"></div>
1070 <div class="form-group">
1071 <label class="col-sm-5 control-label">Second Band:</label>
1072 <div class="col-sm-7">
1073 <div id="drone_imagery_merge_bands_band2_select"></div>
1076 <div class="form-group">
1077 <label class="col-sm-5 control-label">Third Band:</label>
1078 <div class="col-sm-7">
1079 <div id="drone_imagery_merge_bands_band3_select"></div>
1082 <div class="form-group">
1083 <label class="col-sm-5 control-label">Merge Image Type:</label>
1084 <div class="col-sm-7">
1085 <select class="form-control" id="drone_run_merge_image_type" name="drone_run_merge_image_type">
1086 <option value="">Select One</option>
1087 <option value="BGR">BGR (Band 1 = Blue, Band 2 = Green, Band 3 = Red)</option>
1088 <option value="NRN">NRN (Band 1 = NIR, Band 2 = Red, Band 3 = NIR)</option>
1089 <option value="NReN">NReN (Band 1 = NIR, Band 2 = Red Edge, Band 3 = NIR)</option>
1097 <li>TGI = {GREEN band2} - 0.39*{RED band3} - 0.61*{BLUE band1}</li>
1098 <li>VARI = ( {GREEN band2} - {RED band3} ) / ( {GREEN band2} + {RED band3} - {BLUE band1} )</li>
1099 <li>NDVI = ( {NIR band1} - {RED band 2} ) / ( {NIR band1} + {RED band2} )</li>
1100 <li>NDRE = ( {NIR band1} - {RED EDGE band 2} ) / ( {NIR band1} + {RED EDGE band2} )</li>
1104 <div class="modal-footer">
1105 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
1106 <button type="button" class="btn btn-primary" id="drone_imagery_merge_bands_submit">Merge Bands</button>
1112 <div class="modal fade" id="drone_imagery_calc_phenotypes_zonal_channel_dialog" name="drone_imagery_calc_phenotypes_zonal_channel_dialog" tabindex="-1" role="dialog" aria-labelledby="droneImageryCalcPhenotypesZonalChannelDialog" data-backdrop="static">
1113 <div class="modal-dialog modal-xl" role="document">
1114 <div class="modal-content">
1115 <div class="modal-header">
1116 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
1117 <h4 class="modal-title" id="droneImageryCalcPhenotypesZonalChannelDialog">Select the Channel to Calculate Zonal Statistics On</h4>
1119 <div class="modal-body">
1120 <div class="container-fluid">
1121 <div id="drone_imagery_calculate_phenotypes_zonal_stats_week_term_div"></div>
1125 <div class="modal-footer">
1126 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
1127 <button type="button" class="btn btn-primary" id="drone_imagery_calculate_phenotypes_zonal_stats_channel_select">Calculate Zonal Statistics</button>
1133 <div class="modal fade" id="drone_imagery_delete_drone_run_dialog" name="drone_imagery_delete_drone_run_dialog" tabindex="-1" role="dialog" aria-labelledby="droneImageryDeleteDroneRunDialog" data-backdrop="static">
1134 <div class="modal-dialog modal-xl" role="document">
1135 <div class="modal-content">
1136 <div class="modal-header">
1137 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
1138 <h4 class="modal-title" id="droneImageryDeleteDroneRunDialog">Delete a Imaging Event</h4>
1140 <div class="modal-body">
1141 <div class="container-fluid">
1144 <li>Deleting an imaging event will remove the imaging event and all image bands permanently.</li>
1145 <li>All images in the imaging event will be deleted (obsoleted).</li>
1146 <li>Phenotypes that were generated for plots in this imaging event will be deleted permanently.</li>
1151 <div class="modal-footer">
1152 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
1153 <button type="button" class="btn btn-primary" id="drone_imagery_delete_drone_run_confirm">Delete Imaging Event</button>
1159 <div class="modal fade" id="drone_imagery_calc_phenotypes_trial_dialog" name="drone_imagery_calc_phenotypes_trial_dialog" tabindex="-1" role="dialog" aria-labelledby="droneImageryCalcPhenotypesZonalChannelTrialDialog" data-backdrop="static">
1160 <div class="modal-dialog modal-xl" role="document">
1161 <div class="modal-content">
1162 <div class="modal-header">
1163 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
1164 <h4 class="modal-title" id="droneImageryCalcPhenotypesZonalChannelTrialDialog">Calculate Zonal Statistics</h4>
1166 <div class="modal-body">
1167 <div class="container-fluid">
1168 <div id="drone_imagery_week_term_div"></div>
1171 <div class="form-group">
1172 <label class="col-sm-5 control-label">Phenotype Process:</label>
1173 <div class="col-sm-7">
1174 <select class="form-control" id="drone_imagery_generate_phenotypes_process_type" name="drone_imagery_generate_phenotypes_process_type">
1175 <option value="minimal,minimal_vi">Minimal</option>
1176 <option value="extended">Extended</option>
1182 <div class="modal-footer">
1183 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
1184 <button type="button" class="btn btn-primary" id="drone_imagery_calculate_phenotypes_zonal_stats_trial_select">Calculate Zonal Statistics</button>
1190 <div class="modal fade" id="drone_imagery_minimal_vi_standard_process_dialog" name="drone_imagery_minimal_vi_standard_process_dialog" tabindex="-1" role="dialog" aria-labelledby="droneImageryMinimalVIStandardProcessDialog" data-backdrop="static">
1191 <div class="modal-dialog modal-xl" role="document">
1192 <div class="modal-content">
1193 <div class="modal-header">
1194 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
1195 <h4 class="modal-title" id="droneImageryMinimalVIStandardProcessDialog">Run Minimal Vegetative Index Standard Process</h4>
1197 <div class="modal-body">
1198 <div class="container-fluid">
1199 <div id="drone_imagery_minimal_vi_standard_process_week_term_div"></div>
1203 <div class="modal-footer">
1204 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
1205 <button type="button" class="btn btn-primary" id="drone_imagery_minimal_vi_standard_process_select">Run Minimal Vegetative Index Standard Process</button>
1211 <div class="modal fade" id="drone_imagery_extended_standard_process_dialog" name="drone_imagery_extended_standard_process_dialog" tabindex="-1" role="dialog" aria-labelledby="droneImageryExtenededStandardProcessDialog" data-backdrop="static">
1212 <div class="modal-dialog modal-xl" role="document">
1213 <div class="modal-content">
1214 <div class="modal-header">
1215 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
1216 <h4 class="modal-title" id="droneImageryExtenededStandardProcessDialog">Run Extended Standard Process</h4>
1218 <div class="modal-body">
1219 <div class="container-fluid">
1220 <div id="drone_imagery_extended_standard_process_week_term_div"></div>
1224 <div class="modal-footer">
1225 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
1226 <button type="button" class="btn btn-primary" id="drone_imagery_extended_standard_process_select">Run Extended Standard Process</button>
1232 <div class="modal fade" id="drone_imagery_download_phenotypes_dialog" name="drone_imagery_download_phenotypes_dialog" tabindex="-1" role="dialog" aria-labelledby="droneImageryDownloadPhenotypesDialog" data-backdrop="static">
1233 <div class="modal-dialog modal-xl" role="document">
1234 <div class="modal-content">
1235 <div class="modal-header">
1236 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
1237 <h4 class="modal-title" id="droneImageryDownloadPhenotypesDialog">Download drone image phenotypes and plot images</h4>
1239 <div class="modal-body">
1240 <div class="container-fluid">
1242 <&| /util/workflow.mas, id=> "drone_imagery_download_phenotypes_workflow" &>
1243 <&| /util/workflow.mas:step, title=> "Field Trial" &>
1244 <& /page/page_title.mas, title=>"Select the field trial you are interested in" &>
1246 <form class="form-horizontal">
1247 <div class="form-group">
1248 <label class="col-sm-3 control-label">Field Trial: </label>
1249 <div class="col-sm-9" >
1250 <div id="drone_imagery_download_phenotypes_trial_select_div"></div>
1255 <button class="btn btn-primary" id="drone_imagery_download_phenotypes_field_trial_select_step">Go to Next Step</button>
1258 <&| /util/workflow.mas:step, title=> "Trait Selection" &>
1259 <& /page/page_title.mas, title=>"Select the observation variable(s) you are interested in downloading" &>
1261 <form class="form-horizontal">
1262 <div class="form-group">
1263 <label class="col-sm-3 control-label">Observation Variables Phenotyped in the Selected Field Trial: </label>
1264 <div class="col-sm-9" >
1265 <div id="drone_imagery_download_phenotypes_trait_select_div"></div>
1270 <button class="btn btn-primary" id="drone_imagery_download_phenotypes_trait_select_step">Go to Next Step</button>
1273 <&| /util/workflow.mas:step, title=> "Download" &>
1274 <& /page/page_title.mas, title=>"Download!" &>
1276 <div id ="drone_imagery_download_phenotypes_file_div">
1281 <button class="btn btn-primary" id="drone_imagery_download_phenotypes_confirm_step">Submit</button>
1289 <div class="modal-footer">
1290 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
1296 <div class="modal fade" id="drone_imagery_keras_cnn_dialog" name="drone_imagery_keras_cnn_dialog" tabindex="-1" role="dialog" aria-labelledby="droneImageryKerasCNNDialog" data-backdrop="static">
1297 <div class="modal-dialog" role="document">
1298 <div class="modal-content">
1299 <div class="modal-header">
1300 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
1301 <h4 class="modal-title" id="droneImageryKerasCNNDialog">Train and Predict Using Keras CNN Model</h4>
1303 <div class="modal-body">
1304 <div class="container-fluid">
1305 <button class="btn btn-primary" id="drone_imagery_keras_cnn_train_link">Train Keras CNN Model Using Images and Phenotypes In Database</button>
1307 <button class="btn btn-primary" id="drone_imagery_keras_cnn_predict_link">Predict Phenotypes Using Images and Trained Keras Model CNN</button>
1309 <button class="btn btn-primary" id="drone_imagery_keras_cnn_autoencoder_vegetation_indices_link">Calculate NDVI and NDRE from Keras CNN Autoencoder Model</button>
1312 <div class="modal-footer">
1313 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
1319 <div class="modal fade" id="drone_imagery_train_keras_cnn_dialog" name="drone_imagery_train_keras_cnn_dialog" tabindex="-1" role="dialog" aria-labelledby="droneImageryTrainKerasCNNDialog" data-backdrop="static">
1320 <div class="modal-dialog modal-xl" role="document">
1321 <div class="modal-content">
1322 <div class="modal-header">
1323 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
1324 <h4 class="modal-title" id="droneImageryTrainKerasCNNDialog">Train Keras CNN Model</h4>
1326 <div class="modal-body">
1327 <div class="container-fluid">
1329 <&| /util/workflow.mas, id=> "drone_imagery_train_keras_model_workflow" &>
1330 <&| /util/workflow.mas:step, title=> "Intro" &>
1331 <& /page/page_title.mas, title=>"This workflow will guide you through training a keras model using images and phenotypes in the database." &>
1334 <button class="btn btn-primary" onclick="Workflow.complete(this); return false;">Go to Next Step</button>
1337 <&| /util/workflow.mas:step, title=> "Field Trial(s)" &>
1338 <& /page/page_title.mas, title=>"Select the field trial(s) you are interested in" &>
1340 <form class="form-horizontal">
1341 <div class="form-group">
1342 <label class="col-sm-3 control-label">Field Trial(s): </label>
1343 <div class="col-sm-9" >
1344 <div id="drone_imagery_train_keras_cnn_trial_select_div"></div>
1350 <button class="btn btn-primary" id="drone_imagery_train_keras_model_field_trial_select_step">Go to Next Step</button>
1353 <&| /util/workflow.mas:step, title=> "Trait Selection" &>
1354 <& /page/page_title.mas, title=>"Select the trait you are interested in predicting" &>
1356 <form class="form-horizontal">
1357 <div class="form-group">
1358 <label class="col-sm-3 control-label">Trait Phenotyped in the Selected Field Trial(s) To Predict: </label>
1359 <div class="col-sm-9" >
1360 <div id="drone_imagery_train_keras_cnn_trait_select_div"></div>
1363 <div class="form-group">
1364 <label class="col-sm-3 control-label">Traits Phenotyped in the Selected Field Trial(s) As Auxiliary Trait(s): </label>
1365 <div class="col-sm-9" >
1366 <div id="drone_imagery_train_keras_cnn_aux_trait_select_div"></div>
1372 <button class="btn btn-primary" id="drone_imagery_train_keras_model_trait_select_step">Go to Next Step</button>
1375 <&| /util/workflow.mas:step, title=> "Population Selection" &>
1376 <& /page/page_title.mas, title=>"Select the population(s) you are specifically interested in predicting. Leave blank if you want to train on images from all germplasm in the selected field trial(s)." &>
1378 <form class="form-horizontal">
1379 <div class="form-group">
1380 <label class="col-sm-5 control-label">Population(s) to include in training (Leave blank to include images from all germplasm in the selected field trials): </label>
1381 <div class="col-sm-7" >
1382 <div id="drone_imagery_train_keras_cnn_population_select_div"></div>
1388 <button class="btn btn-primary" id="drone_imagery_train_keras_model_population_select_step">Go to Next Step</button>
1391 <&| /util/workflow.mas:step, title=> "Imaging Event Selection" &>
1392 <& /page/page_title.mas, title=>"Select the imaging event(s) you are interested in using in the model" &>
1394 <table class="table table-bordered table-hover" id="drone_image_train_keras_drone_runs_table">
1397 <th>Select <br/><input type="checkbox" id="drone_image_train_keras_drone_runs_table_select_all" checked>Select All</th>
1398 <th>Imaging Event Name</th>
1399 <th>Imaging Event Type</th>
1400 <th>Description</th>
1401 <th>Imaging Event Date</th>
1402 <th>Imaging Event GDD</th>
1403 <th>Camera Type</th>
1404 <th>Field Trial Name</th>
1405 <th>Field Trial Description</th>
1412 <button class="btn btn-primary" id="drone_imagery_train_keras_model_drone_run_select_step">Go to Next Step</button>
1415 <&| /util/workflow.mas:step, title=> "Images Selection" &>
1416 <& /page/page_title.mas, title=>"Select the types of images you are interested in using in the model" &>
1418 <table class="table table-bordered table-hover" id="drone_image_train_keras_plot_polygon_image_type_table">
1421 <!--th>Select <br/><input type="checkbox" id="drone_image_train_keras_plot_polygon_image_type_table_select_all" checked>Select All</th-->
1423 <th>Field Trial</th>
1424 <th>Imaging Event Name</th>
1425 <th>Imaging Event Band Name</th>
1426 <th>Imaging Event Band Type</th>
1427 <th>Plot Polygon Type</th>
1428 <th>Number of Images</th>
1435 <button class="btn btn-primary" id="drone_imagery_train_keras_model_plot_polygon_type_select_step">Go to Next Step</button>
1438 <&| /util/workflow.mas:step, title=> "Confirm" &>
1439 <& /page/page_title.mas, title=>"Train the model!" &>
1442 <div class="form-horizontal">
1443 <div class="form-group">
1444 <label class="col-sm-4 control-label">Model Type: </label>
1445 <div class="col-sm-8" >
1446 <select class="form-control" id="drone_image_train_keras_model_type" name="drone_image_train_keras_model_type" >
1447 <option value="KerasCNNSequentialSoftmaxCategorical">Keras CNN Sequential 16-32-64-128-512 Linear Regression</option>
1448 <option value="KerasCNNMLPExample">Keras CNN and MLP Example</option>
1449 <option value="SimpleKerasTunerCNNSequentialSoftmaxCategorical">Simple Keras Tuner CNN Sequential 16-32-64-128-512 Linear Regression</option>
1450 <option value="KerasTunerCNNSequentialSoftmaxCategorical">Keras Tuner CNN Sequential 16-32-64-128-512 Linear Regression</option>
1451 <option value="KerasCNNInceptionResNetV2">Keras CNN InceptionResNetV2 Linear Regression</option>
1452 <option value="KerasCNNLSTMDenseNet121ImageNetWeights">Keras LSTM DenseNet121 ImageNet Weights Linear Regression</option>
1453 <option value="KerasCNNInceptionResNetV2ImageNetWeights">Keras CNN Pre-Trained InceptionResNetV2 ImageNet Weights Linear Regression</option>
1454 <option value="KerasCNNDenseNet121ImageNetWeights">Keras DenseNet121 ImageNet Weights Linear Regression</option>
1458 <div class="form-group">
1459 <label class="col-sm-4 control-label">Model Name: </label>
1460 <div class="col-sm-8" >
1461 <input class="form-control" type="text" id="drone_image_train_keras_model_name" name="drone_image_train_keras_model_name" />
1464 <div class="form-group">
1465 <label class="col-sm-4 control-label">Model Description: </label>
1466 <div class="col-sm-8" >
1467 <input class="form-control" type="text" id="drone_image_train_keras_model_desc" name="drone_image_train_keras_model_desc" />
1470 <div class="form-group">
1471 <label class="col-sm-4 control-label">Genotyping Protocol for GRM: </label>
1472 <div class="col-sm-8" >
1473 <div id="drone_image_train_keras_model_genotyping_protocol_div"></div>
1476 <div class="form-group">
1477 <label class="col-sm-4 control-label">Use Parents of Accessions For In-silico Hybrid: </label>
1478 <div class="col-sm-8" >
1479 <select class="form-control" id="drone_image_train_keras_model_use_parents_grm" name="drone_image_train_keras_model_use_parents_grm" >
1480 <option value="yes">Yes, GRM for parents of accessions if genotyped</option>
1481 <option value="no">No, GRM for accessions if genotyped</option>
1489 <button class="btn btn-primary" id="drone_imagery_train_keras_model_confirm_step">Train and Save Keras CNN Model</button>
1492 <div id="drone_imagery_train_keras_model_results_div">
1500 <div class="modal-footer">
1501 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
1507 <div class="modal fade" id="drone_imagery_predict_keras_cnn_dialog" name="drone_imagery_predict_keras_cnn_dialog" tabindex="-1" role="dialog" aria-labelledby="droneImageryPredictKerasCNNDialog" data-backdrop="static">
1508 <div class="modal-dialog modal-xl" role="document">
1509 <div class="modal-content">
1510 <div class="modal-header">
1511 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
1512 <h4 class="modal-title" id="droneImageryPredictKerasCNNDialog">Predict Phenotypes Using Trained Keras CNN Model</h4>
1514 <div class="modal-body">
1515 <div class="container-fluid">
1517 <&| /util/workflow.mas, id=> "drone_imagery_predict_keras_model_workflow" &>
1518 <&| /util/workflow.mas:step, title=> "Intro" &>
1519 <& /page/page_title.mas, title=>"This workflow will guide you through predicting phenotypes from trained Kera CNN Models and images in the database." &>
1522 <button class="btn btn-primary" onclick="Workflow.complete(this); return false;">Go to Next Step</button>
1525 <&| /util/workflow.mas:step, title=> "Field Trial" &>
1526 <& /page/page_title.mas, title=>"Select the field trial(s) you are interested in sourcing images from for prediction" &>
1528 <form class="form-horizontal">
1529 <div class="form-group">
1530 <label class="col-sm-3 control-label">Field Trial: </label>
1531 <div class="col-sm-9" >
1532 <div id="drone_imagery_predict_keras_cnn_trial_select_div"></div>
1538 <button class="btn btn-primary" id="drone_imagery_predict_keras_model_field_trial_select_step">Go to Next Step</button>
1541 <&| /util/workflow.mas:step, title=> "Keras CNN Model Selection" &>
1542 <& /page/page_title.mas, title=>"Select the Keras CNN Model for prediction" &>
1545 <form class="form-horizontal">
1546 <div class="form-group">
1547 <label class="col-sm-3 control-label">Trained Keras CNN Model: </label>
1548 <div class="col-sm-9" >
1549 <div id="drone_imagery_predict_keras_cnn_model_select_div"></div>
1552 <div class="form-group">
1553 <label class="col-sm-3 control-label">Traits Phenotyped in the Selected Field Trial(s) As Auxiliary Trait(s) (Currently Only For Mixed MLP/CNN Model): </label>
1554 <div class="col-sm-9" >
1555 <div id="drone_imagery_predict_keras_cnn_aux_trait_select_div"></div>
1562 <button class="btn btn-primary" id="drone_imagery_predict_keras_model_select_step">Go to Next Step</button>
1565 <&| /util/workflow.mas:step, title=> "Population Selection" &>
1566 <& /page/page_title.mas, title=>"Select the population(s) you are specifically interested in predicting. Leave blank if you want to train on images from all germplasm in the selected field trial(s)." &>
1568 <form class="form-horizontal">
1569 <div class="form-group">
1570 <label class="col-sm-5 control-label">Population(s) to include in training (Leave blank to include images from all germplasm in the selected field trials): </label>
1571 <div class="col-sm-7" >
1572 <div id="drone_imagery_predict_keras_cnn_population_select_div"></div>
1578 <button class="btn btn-primary" id="drone_imagery_predict_keras_model_population_select_step">Go to Next Step</button>
1581 <&| /util/workflow.mas:step, title=> "Imaging Event Selection" &>
1582 <& /page/page_title.mas, title=>"Select the imaging event(s) you are interested in sourcing images from for prediction" &>
1584 <table class="table table-bordered table-hover" id="drone_image_predict_keras_drone_runs_table">
1587 <th>Select <br/><input type="checkbox" id="drone_image_predict_keras_drone_runs_table_select_all" checked>Select All</th>
1588 <th>Imaging Event Name</th>
1589 <th>Imaging Event Type</th>
1590 <th>Description</th>
1591 <th>Imaging Event Date</th>
1592 <th>Imaging Event GDD</th>
1593 <th>Camera Type</th>
1594 <th>Field Trial Name</th>
1595 <th>Field Trial Description</th>
1602 <button class="btn btn-primary" id="drone_imagery_predict_keras_model_drone_run_select_step">Go to Next Step</button>
1605 <&| /util/workflow.mas:step, title=> "Images Selection" &>
1606 <& /page/page_title.mas, title=>"Select the types of images you are interested sourcing images from for prediction" &>
1608 <table class="table table-bordered table-hover" id="drone_image_predict_keras_plot_polygon_image_type_table">
1611 <!--th>Select <br/><input type="checkbox" id="drone_image_predict_keras_plot_polygon_image_type_table_select_all" checked>Select All</th-->
1613 <th>Field Trial</th>
1614 <th>Imaging Event Name</th>
1615 <th>Imaging Event Band Name</th>
1616 <th>Imaging Event Band Type</th>
1617 <th>Plot Polygon Type</th>
1618 <th>Number of Images</th>
1625 <button class="btn btn-primary" id="drone_imagery_predict_keras_model_plot_polygon_type_select_step">Go to Next Step</button>
1628 <&| /util/workflow.mas:step, title=> "Confirm" &>
1629 <& /page/page_title.mas, title=>"Predict Phenotypes!" &>
1631 <form class="form-horizontal">
1632 <div class="form-group">
1633 <label class="col-sm-3 control-label">Prediction Model: </label>
1634 <div class="col-sm-9" >
1635 <select class="form-control" id="drone_imagery_keras_model_prediction_select">
1636 <option value="standard_cnn">Standard CNN Prediction</option>
1637 <option value="cnn_prediction_mixed_model">CNN Prediction For Mixed Model Prediction</option>
1643 <div id="drone_imagery_keras_model_prediction_cnn_prediction_mixed_model_div" style="display:none">
1644 $$y_t = \beta_{CNN,pred} + rep + 1|\mbox{GermplasmName}$$
1649 <button class="btn btn-primary" id="drone_imagery_predict_keras_model_confirm_step">Submit</button>
1652 <div id="drone_imagery_predict_keras_model_results_div">
1660 <div class="modal-footer">
1661 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
1667 <div class="modal fade" id="drone_imagery_keras_cnn_autoencoder_vi_dialog" name="drone_imagery_keras_cnn_autoencoder_vi_dialog" tabindex="-1" role="dialog" aria-labelledby="droneImageryAutoencoderKerasCNNVIDialog" data-backdrop="static">
1668 <div class="modal-dialog modal-xl" role="document">
1669 <div class="modal-content">
1670 <div class="modal-header">
1671 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
1672 <h4 class="modal-title" id="droneImageryAutoencoderKerasCNNVIDialog">NDVI and NDRE from autoencoder Keras CNN</h4>
1674 <div class="modal-body">
1675 <div class="container-fluid">
1677 <&| /util/workflow.mas, id=> "drone_imagery_autoencoder_keras_model_vi_workflow" &>
1678 <&| /util/workflow.mas:step, title=> "Intro" &>
1679 <& /page/page_title.mas, title=>"This workflow will guide you through extracted NDVI and NDRE values for autoencoder Keras CNN." &>
1682 <button class="btn btn-primary" onclick="Workflow.complete(this); return false;">Go to Next Step</button>
1685 <&| /util/workflow.mas:step, title=> "Field Trial Training" &>
1686 <& /page/page_title.mas, title=>"Select the field trial(s) you are interested in sourcing images from for training" &>
1688 <form class="form-horizontal">
1689 <div class="form-group">
1690 <label class="col-sm-3 control-label">Field Trial: </label>
1691 <div class="col-sm-9" >
1692 <div id="drone_imagery_autoencoder_keras_cnn_vi_trial_training_select_div"></div>
1698 <button class="btn btn-primary" id="drone_imagery_autoencoder_keras_vi_model_field_trial_training_select_step">Go to Next Step</button>
1701 <&| /util/workflow.mas:step, title=> "Training" &>
1702 <& /page/page_title.mas, title=>"Select the imaging event(s) you are interested in sourcing images from for training" &>
1704 <table class="table table-bordered table-hover" id="drone_image_autoencoder_keras_vi_drone_runs_training_table">
1707 <th>Select <br/><input type="checkbox" id="drone_image_autoencoder_keras_vi_drone_runs_training_table_select_all" checked>Select All</th>
1708 <th>Imaging Event Name</th>
1709 <th>Imaging Event Type</th>
1710 <th>Description</th>
1711 <th>Imaging Event Date</th>
1712 <th>Imaging Event GDD</th>
1713 <th>Camera Type</th>
1714 <th>Field Trial Name</th>
1715 <th>Field Trial Description</th>
1722 <button class="btn btn-primary" id="drone_imagery_autoencoder_keras_vi_model_drone_run_training_select_step">Go to Next Step</button>
1725 <&| /util/workflow.mas:step, title=> "Images Training" &>
1726 <& /page/page_title.mas, title=>"Select the types of images you are interested sourcing images from for training" &>
1728 <table class="table table-bordered table-hover" id="drone_image_autoencoder_keras_vi_plot_polygon_image_type_training_table">
1731 <!--th>Select <br/><input type="checkbox" id="drone_image_autoencoder_keras_vi_plot_polygon_image_type_training_table_select_all" checked>Select All</th-->
1733 <th>Field Trial</th>
1734 <th>Imaging Event Name</th>
1735 <th>Imaging Event Band Name</th>
1736 <th>Imaging Event Band Type</th>
1737 <th>Plot Polygon Type</th>
1738 <th>Number of Images</th>
1745 <button class="btn btn-primary" id="drone_imagery_autoencoder_keras_vi_model_plot_polygon_type_training_select_step">Go to Next Step</button>
1748 <&| /util/workflow.mas:step, title=> "Field Trial Prediction" &>
1749 <& /page/page_title.mas, title=>"Select the field trial(s) you are interested in sourcing images from for prediction" &>
1751 <form class="form-horizontal">
1752 <div class="form-group">
1753 <label class="col-sm-3 control-label">Field Trial: </label>
1754 <div class="col-sm-9" >
1755 <div id="drone_imagery_autoencoder_keras_cnn_vi_trial_select_div"></div>
1761 <button class="btn btn-primary" id="drone_imagery_autoencoder_keras_vi_model_field_trial_select_step">Go to Next Step</button>
1764 <&| /util/workflow.mas:step, title=> "Prediction" &>
1765 <& /page/page_title.mas, title=>"Select the imaging event(s) you are interested in sourcing images from for prediction" &>
1767 <table class="table table-bordered table-hover" id="drone_image_autoencoder_keras_vi_drone_runs_table">
1770 <th>Select <br/><input type="checkbox" id="drone_image_autoencoder_keras_vi_drone_runs_table_select_all" checked>Select All</th>
1771 <th>Imaging Event Name</th>
1772 <th>Imaging Event Type</th>
1773 <th>Description</th>
1774 <th>Imaging Event Date</th>
1775 <th>Imaging Event GDD</th>
1776 <th>Camera Type</th>
1777 <th>Field Trial Name</th>
1778 <th>Field Trial Description</th>
1785 <button class="btn btn-primary" id="drone_imagery_autoencoder_keras_vi_model_drone_run_select_step">Go to Next Step</button>
1788 <&| /util/workflow.mas:step, title=> "Images Prediction" &>
1789 <& /page/page_title.mas, title=>"Select the types of images you are interested sourcing images from for prediction" &>
1791 <table class="table table-bordered table-hover" id="drone_image_autoencoder_keras_vi_plot_polygon_image_type_table">
1794 <!--th>Select <br/><input type="checkbox" id="drone_image_autoencoder_keras_vi_plot_polygon_image_type_table_select_all" checked>Select All</th-->
1796 <th>Field Trial</th>
1797 <th>Imaging Event Name</th>
1798 <th>Imaging Event Band Name</th>
1799 <th>Imaging Event Band Type</th>
1800 <th>Plot Polygon Type</th>
1801 <th>Number of Images</th>
1808 <button class="btn btn-primary" id="drone_imagery_autoencoder_keras_vi_model_plot_polygon_type_select_step">Go to Next Step</button>
1811 <&| /util/workflow.mas:step, title=> "Confirm" &>
1812 <& /page/page_title.mas, title=>"Calculate NDVI and NDRE Autoencoder Phenotypes" &>
1814 <form class="form-horizontal">
1815 <div class="form-group">
1816 <label class="col-sm-3 control-label">Autoencoder Model: </label>
1817 <div class="col-sm-9" >
1818 <select class="form-control" id="drone_imagery_keras_model_autoencoder_vi_select">
1819 <option value="keras_autoencoder_64_32_filters_16_latent">Keras Autoencoder</option>
1826 <button class="btn btn-primary" id="drone_imagery_autoencoder_keras_vi_model_confirm_step">Submit</button>
1829 <div id="drone_imagery_autoencoder_keras_vi_model_results_div">
1837 <div class="modal-footer">
1838 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
1844 <div class="modal fade" id="drone_imagery_standard_process_complete_dialog" name="drone_imagery_standard_process_complete_dialog" tabindex="-1" role="dialog" aria-labelledby="droneImageryStandardProcessCompleteDialog" data-backdrop="static">
1845 <div class="modal-dialog modal-xl" role="document">
1846 <div class="modal-content">
1847 <div class="modal-header">
1848 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
1849 <h4 class="modal-title" id="droneImageryStandardProcessCompleteDialog">Standard Process Complete</h4>
1851 <div class="modal-body">
1852 <div class="container-fluid">
1854 <span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span>
1855 It will take time to finish processing your imaging event and calculating phenotypes for all plot polygon images, vegetative indices, and processing combinations. Once it is complete, the "Processing Icon" on the Manage->Aerial Imagery page will disappear for the imaging event.
1859 <div class="modal-footer">
1860 <button type="button" class="btn btn-primary" data-dismiss="modal">Finish</button>
1866 <div class="modal fade" id="drone_imagery_plot_polygon_template_options_dialog" name="drone_imagery_plot_polygon_template_options_dialog" tabindex="-1" role="dialog" aria-labelledby="droneImageryPlotPolygonTemplateDialog" data-backdrop="static">
1867 <div class="modal-dialog modal-xl" role="document">
1868 <div class="modal-content">
1869 <div class="modal-header">
1870 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
1871 <h4 class="modal-title" id="droneImageryPlotPolygonTemplateDialog">Plot Template Options</h4>
1873 <div class="modal-body">
1874 <div class="container-fluid">
1875 <&| /page/info_section.mas, title => 'Copy/Paste Template', collapsible=>1, collapsed => 0, subtitle=> 'Copy/Paste this template onto the image.' &>
1876 <button class="btn btn-primary" id="drone_imagery_plot_polygon_template_options_paste_click">Click To Paste</button>
1880 <div class="modal-footer">
1881 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
1887 <div class="modal fade" id="drone_imagery_calculate_gdd_dialog" name="drone_imagery_calculate_gdd_dialog" tabindex="-1" role="dialog" aria-labelledby="droneImageryCalculateGDDDialog" data-backdrop="static">
1888 <div class="modal-dialog modal-lg" role="document">
1889 <div class="modal-content">
1890 <div class="modal-header">
1891 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
1892 <h4 class="modal-title" id="droneImageryCalculateGDDDialog">Calculate Growing Degree Days</h4>
1894 <div class="modal-body">
1895 <div class="container-fluid">
1896 <div class="well well-sm">
1897 Growing Degree Days (GDD) are calculated using the average high and low temperature for each day from planting date to the date of the imaging event. <a href="https://www.canr.msu.edu/news/understanding_growing_degree_days" target=_blank >More Information on GDD</a>. The average daily high and low temperature is fetched from the <a href="https://www.ncdc.noaa.gov/cdo-web/webservices/v2" target=_blank>NOAA NCDC</a>.
1900 <div id="drone_imagery_calculate_gdd_time_div"></div>
1902 <div class="form-horizontal">
1903 <div class="form-group">
1904 <label class="col-sm-3 control-label">Base Temperature:</label>
1905 <div class="col-sm-9" >
1906 <select class="form-control" id="drone_imagery_calculate_gdd_base_temperature_input">
1907 <option value="40">40F</option>
1908 <option value="41">41F</option>
1909 <option value="42">42F</option>
1910 <option value="43">43F</option>
1911 <option value="44">44F</option>
1912 <option value="45">45F</option>
1913 <option value="46">46F</option>
1914 <option value="47">47F</option>
1915 <option value="48">48F</option>
1916 <option value="49">49F</option>
1917 <option value="50">50F</option>
1918 <option value="51">51F</option>
1919 <option value="52">52F</option>
1920 <option value="53">53F</option>
1921 <option value="54">54F</option>
1922 <option value="55">55F</option>
1926 <div class="form-group">
1927 <label class="col-sm-3 control-label">Formula:</label>
1928 <div class="col-sm-9" >
1929 <select class="form-control" id="drone_imagery_calculate_gdd_formula_input">
1930 <option value="average_daily_temp_sum">GDD = sum_over_days ( ( (Max Temp + Min Temp)/2 ) - Base Temp)</option>
1938 <div class="modal-footer">
1939 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
1940 <button type="button" class="btn btn-primary" id="drone_imagery_upload_gdd_submit">Calculate</button>
1946 <div class="modal fade" id="drone_imagery_calculate_precipitation_dialog" name="drone_imagery_calculate_precipitation_dialog" tabindex="-1" role="dialog" aria-labelledby="droneImageryCalculatePrecipitationDialog" data-backdrop="static">
1947 <div class="modal-dialog modal-lg" role="document">
1948 <div class="modal-content">
1949 <div class="modal-header">
1950 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
1951 <h4 class="modal-title" id="droneImageryCalculatePrecipitationDialog">Calculate Precipitation Sum</h4>
1953 <div class="modal-body">
1954 <div class="container-fluid">
1955 <div class="well well-sm">
1956 The average daily precipitation is fetched from the <a href="https://www.ncdc.noaa.gov/cdo-web/webservices/v2" target=_blank>NOAA NCDC</a>.
1959 <div id="drone_imagery_calculate_precipitation_time_div"></div>
1961 <div class="form-horizontal">
1962 <div class="form-group">
1963 <label class="col-sm-3 control-label">Formula:</label>
1964 <div class="col-sm-9" >
1965 <select class="form-control" id="drone_imagery_calculate_precipitation_sum_formula_input">
1966 <option value="average_daily_precipitation_sum">Precipitation Sum = sum_over_days ( Average Daily Precipitation )</option>
1974 <div class="modal-footer">
1975 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
1976 <button type="button" class="btn btn-primary" id="drone_imagery_upload_precipitation_sum_submit">Calculate</button>
1982 <div class="modal fade" id="drone_imagery_compare_images_dialog" name="drone_imagery_compare_images_dialog" tabindex="-1" role="dialog" aria-labelledby="droneImageryCompareImagesDialog" data-backdrop="static">
1983 <div class="modal-dialog modal-xl" role="document">
1984 <div class="modal-content">
1985 <div class="modal-header">
1986 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
1987 <h4 class="modal-title" id="droneImageryCompareImagesDialog">Compare Images</h4>
1989 <div class="modal-body">
1990 <div class="container-fluid">
1992 <&| /util/workflow.mas, id=> "drone_imagery_compare_images_workflow" &>
1993 <&| /util/workflow.mas:step, title=> "Comparison" &>
1994 <& /page/page_title.mas, title=>"Select the comparison you are interested in" &>
1995 <form class="form-horizontal">
1996 <div class="form-group">
1997 <label class="col-sm-3 control-label">Comparison: </label>
1998 <div class="col-sm-9" >
1999 <select id="drone_imagery_compare_images_comparison_select" class="form-control">
2000 <option value="compare_pixel_values_two_images">Compare pixel values for two different aerial field images</option>
2006 <button class="btn btn-primary" id="drone_imagery_compare_images_comparison_select_step">Go to Next Step</button>
2009 <&| /util/workflow.mas:step, title=> "Field Trial(s)" &>
2010 <& /page/page_title.mas, title=>"Select the field trials you are interested in comparing" &>
2012 <form class="form-horizontal">
2013 <div class="form-group">
2014 <label class="col-sm-3 control-label">Field Trial(s): </label>
2015 <div class="col-sm-9" >
2016 <div id="drone_imagery_compare_images_trial_select_div"></div>
2024 <button class="btn btn-primary" id="drone_imagery_compare_images_field_trial_select_step">Go to Next Step</button>
2027 <&| /util/workflow.mas:step, title=> "Imaging Event(s)" &>
2028 <& /page/page_title.mas, title=>"Select the imaging events you are interested in comparing" &>
2030 <table class="table table-bordered table-hover" id="drone_image_compare_images_drone_runs_table">
2034 <th>Imaging Event Name</th>
2035 <th>Imaging Event Type</th>
2036 <th>Description</th>
2037 <th>Imaging Event Date</th>
2038 <th>Imaging Event GDD</th>
2039 <th>Camera Type</th>
2040 <th>Field Trial Name</th>
2041 <th>Field Trial Description</th>
2049 <button class="btn btn-primary" id="drone_imagery_compare_images_drone_runs_select_step">Go to Next Step</button>
2052 <&| /util/workflow.mas:step, title=> "Imaging Event Band(s)" &>
2053 <& /page/page_title.mas, title=>"Select the imaging event bands you are interested in comparing" &>
2055 <table class="table table-bordered table-hover" id="drone_image_compare_images_drone_run_bands_table">
2059 <th>Imaging Event Name</th>
2060 <th>Imaging Event Type</th>
2061 <th>Description</th>
2062 <th>Imaging Event Date</th>
2063 <th>Imaging Event GDD</th>
2064 <th>Camera Type</th>
2065 <th>Field Trial Name</th>
2066 <th>Field Trial Description</th>
2074 <button class="btn btn-primary" id="drone_imagery_compare_images_drone_run_bands_select_step">Go to Next Step</button>
2077 <&| /util/workflow.mas:step, title=> "Image Selection" &>
2078 <& /page/page_title.mas, title=>"Select the images you are interested in comparing" &>
2080 <table class="table table-bordered table-hover" id="drone_imagery_compare_images_images_type_table">
2084 <th>Field Trial</th>
2085 <th>Imaging Event Name</th>
2088 <th>Plot Polygon Type</th>
2089 <th>Number of Images</th>
2097 <button class="btn btn-primary" id="drone_imagery_compare_images_images_select_step">Go to Next Step</button>
2100 <&| /util/workflow.mas:step, title=> "Result" &>
2101 <& /page/page_title.mas, title=>"Image comparison results" &>
2103 <div id="drone_imagery_compare_images_result_div"></div>
2110 <div class="modal-footer">
2111 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
2117 <div class="modal fade" id="upload_drone_imagery_standard_process_additional_raw_images_dialog" name="upload_drone_imagery_standard_process_additional_raw_images_dialog" tabindex="-1" role="dialog" aria-labelledby="uploadDroneImageryStandardProcessAdditionalRawImagesDialog">
2118 <div class="modal-dialog modal-xl" role="document">
2119 <div class="modal-content">
2120 <div class="modal-header">
2121 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
2122 <h4 class="modal-title" id="uploadDroneImageryStandardProcessAdditionalRawImagesDialog">Upload Additional Raw Image Captures</h4>
2124 <div class="modal-body">
2125 <div class="container-fluid">
2127 <form class="form-horizontal" role="form" method="post" enctype="multipart/form-data" encoding="multipart/form-data" id="upload_drone_imagery_additional_raw_images_form" name="upload_drone_imagery_additional_raw_images_form">
2128 <div class="form-group">
2129 <label class="col-sm-3 control-label">Drone Images ZipFile (.zip): </label>
2130 <div class="col-sm-9" >
2131 <input type="file" id="upload_drone_imagery_additional_raw_images_zipfile" name="upload_drone_imagery_additional_raw_images_zipfile" encoding="multipart/form-data" />
2134 <div class="form-group">
2135 <label class="col-sm-3 control-label">Micasense Radiometric Calibration Images ZipFile (.zip with 5 images in it): </label>
2136 <div class="col-sm-9" >
2137 <input type="file" id="upload_drone_imagery_additional_raw_images_calibration_zipfile" name="upload_drone_imagery_additional_raw_images_calibration_zipfile" encoding="multipart/form-data" />
2141 <input type="hidden" id="upload_drone_imagery_additional_raw_images_drone_run_id" name="upload_drone_imagery_additional_raw_images_drone_run_id" value="" />
2142 <input type="hidden" id="upload_drone_imagery_additional_raw_images_field_trial_id" name="upload_drone_imagery_additional_raw_images_field_trial_id" value="" />
2146 <button type="button" class="btn btn-info" name="upload_drone_imagery_additional_raw_images_submit" id="upload_drone_imagery_additional_raw_images_submit">Submit</button>
2151 <div class="modal-footer">
2152 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
2158 <div class="modal fade" id="drone_imagery_standard_process_raw_images_retrain_mask_rcnn_modal" name="drone_imagery_standard_process_raw_images_retrain_mask_rcnn_modal" tabindex="-1" role="dialog" aria-labelledby="droneImageryRetrainMaskRCNNDialog" data-backdrop="static">
2159 <div class="modal-dialog modal-lg" role="document">
2160 <div class="modal-content">
2161 <div class="modal-header">
2162 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
2163 <h4 class="modal-title" id="droneImageryRetrainMaskRCNNDialog">Retrain Mask R-CNN Model</h4>
2165 <div class="modal-body">
2166 <div class="container-fluid">
2168 <div class="form-horizontal">
2169 <div class="form-group">
2170 <label class="col-sm-3 control-label">Model Name (Must be unique):</label>
2171 <div class="col-sm-9" >
2172 <input class="form-control" type="text" id="drone_imagery_standard_process_raw_images_retrain_mask_rcnn_model_name" name="drone_imagery_standard_process_raw_images_retrain_mask_rcnn_model_name" >
2175 <div class="form-group">
2176 <label class="col-sm-3 control-label">Model Description:</label>
2177 <div class="col-sm-9" >
2178 <input class="form-control" type="text" id="drone_imagery_standard_process_raw_images_retrain_mask_rcnn_model_desc" name="drone_imagery_standard_process_raw_images_retrain_mask_rcnn_model_desc" >
2181 <div class="form-group">
2182 <label class="col-sm-3 control-label">Model Type:</label>
2183 <div class="col-sm-9" >
2184 <select class="form-control" id="drone_imagery_standard_process_raw_images_retrain_mask_rcnn_model_type">
2185 <option value="Mask R-CNN">Mask R-CNN</option>
2193 <div class="modal-footer">
2194 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
2195 <button type="button" class="btn btn-primary" id="drone_imagery_standard_process_raw_images_retrain_mask_rcnn">Submit</button>
2201 <div class="modal fade" id="drone_imagery_view_imaging_vehicles_modal" name="drone_imagery_view_imaging_vehicles_modal" tabindex="-1" role="dialog" aria-labelledby="droneImageryImagingVehiclesDialog" data-backdrop="static">
2202 <div class="modal-dialog modal-lg" role="document">
2203 <div class="modal-content">
2204 <div class="modal-header">
2205 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
2206 <h4 class="modal-title" id="droneImageryImagingVehiclesDialog">Available Imaging Vehicles</h4>
2208 <div class="modal-body">
2209 <div class="container-fluid">
2211 <table class="table table-bordered table-hover" id="drone_imagery_view_imaging_vehicles_table">
2214 <th>Vehicles Name</th>
2215 <th>Description</th>
2216 <th>Battery Usage</th>
2221 <button class="btn btn-primary" name="drone_run_imaging_vehicle_add_new">Add New Imaging Vehicle</button>
2225 <div class="modal-footer">
2226 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
2232 <& /breeders_toolbox/drone_imagery/upload_drone_imagery_dialogs.mas &>
2236 jQuery(document).ready(function() {
2242 jQuery('#drone_imagery_view_imaging_vehicles_link').click(function(){
2243 jQuery('#drone_imagery_view_imaging_vehicles_table').DataTable({
2246 ajax : '/api/drone_imagery/imaging_vehicles'
2249 jQuery('#drone_imagery_view_imaging_vehicles_modal').modal('show');
2253 // Standard Process for Imaging Events
2256 var manage_drone_imagery_standard_process_field_trial_id;
2257 var manage_drone_imagery_standard_process_drone_run_project_id;
2258 var manage_drone_imagery_standard_process_drone_run_band_project_id;
2259 var manage_drone_imagery_standard_process_gcp_drone_run_band_project_id;
2260 var manage_drone_imagery_standard_process_rotate_stitched_image_id;
2261 var manage_drone_imagery_standard_process_rotate_drone_run_band_project_id;
2262 var manage_drone_imagery_standard_process_rotate_stitched_image_degrees;
2263 var manage_drone_imagery_standard_process_rotated_stitched_image_id;
2264 var manage_drone_imagery_standard_process_cropped_image_id;
2265 var manage_drone_imagery_standard_process_denoised_image_id;
2266 var manage_drone_imagery_standard_process_removed_background_image_id;
2267 var manage_drone_imagery_standard_process_current_threshold_background_removed_type;
2268 var manage_drone_imagery_standard_process_apply_drone_run_band_project_ids = [];
2269 var manage_drone_imagery_standard_process_apply_drone_run_band_vegetative_indices = [];
2270 var manage_drone_imagery_standard_process_phenotype_time = '';
2271 var manage_drone_imagery_standard_process_image_width;
2272 var manage_drone_imagery_standard_process_image_height;
2273 var manage_drone_imagery_standard_process_gcp_test_run = 'Yes';
2275 jQuery(document).on('click', 'button[name="project_drone_imagery_standard_process"]', function(){
2276 showManageDroneImagerySection('manage_drone_imagery_standard_process_div');
2278 manage_drone_imagery_standard_process_drone_run_project_id = jQuery(this).data('drone_run_project_id');
2279 manage_drone_imagery_standard_process_field_trial_id = jQuery(this).data('field_trial_id');
2280 project_drone_imagery_ground_control_points_drone_run_project_id = manage_drone_imagery_standard_process_drone_run_project_id;
2281 project_drone_imagery_ground_control_points_drone_run_project_name = jQuery(this).data('drone_run_project_name');
2283 project_drone_imagery_ground_control_points_saved_div_table = 'project_drone_imagery_standard_process_ground_control_points_saved_div';
2285 jQuery('#manage_drone_imagery_standard_process_drone_run_bands_table').DataTable({
2287 ajax : '/api/drone_imagery/drone_run_bands?select_checkbox_name=drone_run_standard_process_band_select&drone_run_project_id='+manage_drone_imagery_standard_process_drone_run_project_id
2291 jQuery('#manage_drone_imagery_standard_process_drone_run_band_step').click(function(){
2293 jQuery('input[name="drone_run_standard_process_band_select"]:checked').each(function() {
2294 selected.push([jQuery(this).val(), jQuery(this).data('background_removed_threshold_type')]);
2296 if (selected.length < 1){
2297 alert('Please select at least one imaging event band! Preferably one with high contrast such as NIR.');
2299 } else if (selected.length > 1){
2300 alert('Please select only one imaging event band! Preferably one with high contrast such as NIR.');
2303 manage_drone_imagery_standard_process_drone_run_band_project_id = selected[0][0];
2304 manage_drone_imagery_standard_process_current_threshold_background_removed_type = selected[0][1];
2306 url : '/api/drone_imagery/get_project_md_image?drone_run_band_project_id='+manage_drone_imagery_standard_process_drone_run_band_project_id+'&project_image_type_name=stitched_drone_imagery',
2307 beforeSend: function(){
2308 showManageDroneImagerySection('manage_drone_imagery_loading_div');
2310 success: function(response){
2311 console.log(response);
2312 manage_drone_imagery_standard_process_rotate_stitched_image_id = response.data[0]['image_id'];
2314 showPlotPolygonStart(manage_drone_imagery_standard_process_rotate_stitched_image_id, manage_drone_imagery_standard_process_drone_run_project_id, 'project_drone_imagery_standard_process_ground_control_points_canvas_div', 'project_drone_imagery_standard_process_ground_control_points_info_div', 'project_drone_imagery_standard_process_ground_control_points_loading_div', 0);
2316 drone_imagery_plot_polygon_click_type = 'save_ground_control_point';
2318 showManageDroneImagerySection('manage_drone_imagery_standard_process_div');
2320 Workflow.complete("#manage_drone_imagery_standard_process_drone_run_band_step");
2321 Workflow.focus('#manage_drone_imagery_standard_process_workflow', 2);
2323 error: function(response){
2324 alert('Error getting standard process image gcp step!');
2325 showManageDroneImagerySection('manage_drone_imagery_standard_process_div');
2330 url : '/api/drone_imagery/get_image_for_saving_gcp?drone_run_project_id='+manage_drone_imagery_standard_process_drone_run_project_id,
2331 success: function(response){
2332 console.log(response);
2334 project_drone_imagery_ground_control_points_saved = response.saved_gcps_full;
2335 project_drone_imagery_ground_control_points_saved_array = response.gcps_array;
2336 _redraw_ground_control_points_table();
2338 error: function(response){
2339 alert('Error getting standard process gcps!');
2343 jQuery('#manage_drone_imagery_standard_process_ground_control_points_skip_div').show();
2345 get_select_box('drone_runs_with_gcps', 'manage_drone_imagery_standard_process_ground_control_points_select', {'id':'manage_drone_imagery_standard_process_ground_control_points_select_id', 'name':'manage_drone_imagery_standard_process_ground_control_points_select_id', 'field_trial_id':manage_drone_imagery_standard_process_field_trial_id, 'empty':1});
2347 get_select_box('drone_runs', 'manage_drone_imagery_standard_process_previous_camera_rig_select', {'id':'manage_drone_imagery_standard_process_previous_camera_rig_select_id', 'name':'manage_drone_imagery_standard_process_previous_camera_rig_select_id', 'field_trial_id':manage_drone_imagery_standard_process_field_trial_id, 'empty':1});
2351 jQuery('#manage_drone_imagery_standard_process_ground_control_points_option').change(function(){
2352 if (jQuery(this).val() == 'Yes') {
2353 jQuery('#manage_drone_imagery_standard_process_ground_control_points_skip_div').hide();
2354 jQuery('#manage_drone_imagery_standard_process_ground_control_points_select_div').show();
2355 jQuery('#manage_drone_imagery_standard_process_previous_camera_rig_select_div').hide();
2357 else if (jQuery(this).val() == 'Yes_camera_rig') {
2358 jQuery('#manage_drone_imagery_standard_process_ground_control_points_skip_div').hide();
2359 jQuery('#manage_drone_imagery_standard_process_ground_control_points_select_div').hide();
2360 jQuery('#manage_drone_imagery_standard_process_previous_camera_rig_select_div').show();
2363 jQuery('#manage_drone_imagery_standard_process_ground_control_points_skip_div').show();
2364 jQuery('#manage_drone_imagery_standard_process_ground_control_points_select_div').hide();
2365 jQuery('#manage_drone_imagery_standard_process_previous_camera_rig_select_div').hide();
2370 jQuery('#manage_drone_imagery_standard_process_ground_control_points_step').click(function(){
2371 manage_drone_imagery_standard_process_gcp_drone_run_band_project_id = jQuery('#manage_drone_imagery_standard_process_ground_control_points_select_id').val();
2372 if (manage_drone_imagery_standard_process_gcp_drone_run_band_project_id == '') {
2373 alert('Please select an imaging event as a template to base GCPs on!');
2379 url: '/api/drone_imagery/get_weeks_after_planting_date?drone_run_project_id='+manage_drone_imagery_standard_process_drone_run_project_id,
2381 beforeSend: function (){
2382 jQuery('#working_modal').modal('show');
2384 success: function(response){
2385 jQuery('#working_modal').modal('hide');
2386 console.log(response);
2387 if (response.error) {
2388 alert(response.error);
2391 manage_drone_imagery_standard_process_phenotype_time = response.time_ontology_day_cvterm_id;
2395 url : '/api/drone_imagery/standard_process_apply_ground_control_points',
2397 'gcp_drone_run_project_id':manage_drone_imagery_standard_process_gcp_drone_run_band_project_id,
2398 'field_trial_id':manage_drone_imagery_standard_process_field_trial_id,
2399 'drone_run_project_id':manage_drone_imagery_standard_process_drone_run_project_id,
2400 'drone_run_band_project_id':manage_drone_imagery_standard_process_drone_run_band_project_id,
2401 'time_cvterm_id':manage_drone_imagery_standard_process_phenotype_time,
2404 success: function(response){
2405 console.log(response);
2406 if (response.error) {
2407 alert(response.error);
2409 if (response.plot_polygons) {
2410 drone_imagery_plot_polygons_display = response.plot_polygons;
2411 manage_drone_imagery_standard_process_gcp_test_run = 'No';
2413 if (response.rotated_image_id && checkonce == 1) {
2414 showPlotPolygonStart(response.rotated_image_id, manage_drone_imagery_standard_process_drone_run_project_id, 'project_drone_imagery_standard_process_ground_control_points_canvas_div', 'project_drone_imagery_standard_process_ground_control_points_info_div', 'project_drone_imagery_standard_process_ground_control_points_loading_div', 0);
2417 if (response.rotated_points) {
2418 for (var i=0; i<response.rotated_points.length; i++) {
2419 drawWaypoints([{'x':response.rotated_points[i][0], 'y':response.rotated_points[i][1]}], 'r'+i, 0);
2422 if (response.cropped_points) {
2423 for (var i=0; i<response.cropped_points[0].length; i++) {
2424 drawWaypoints([{'x':response.cropped_points[0][i]['x'], 'y':response.cropped_points[0][i]['y']}], 'c'+i, 0);
2427 if (response.old_cropped_points) {
2428 for (var i=0; i<response.old_cropped_points[0].length; i++) {
2429 drawWaypoints([{'x':response.old_cropped_points[0][i]['x'], 'y':response.old_cropped_points[0][i]['y']}], 'old'+i, 0);
2433 error: function(response){
2434 alert('Error doing standard process with ground control points!');
2438 error: function(response){
2439 alert('Error getting time terms for standard process with gcp!');
2440 jQuery('#working_modal').modal('hide');
2446 jQuery('#manage_drone_imagery_standard_process_ground_control_points_step_confirm').click(function(){
2447 if (manage_drone_imagery_standard_process_gcp_test_run == 'Yes') {
2448 alert('Please calculate the plot polygons and confirm they look good first!');
2453 url : '/api/drone_imagery/standard_process_apply_ground_control_points',
2455 'gcp_drone_run_project_id':manage_drone_imagery_standard_process_gcp_drone_run_band_project_id,
2456 'field_trial_id':manage_drone_imagery_standard_process_field_trial_id,
2457 'drone_run_project_id':manage_drone_imagery_standard_process_drone_run_project_id,
2458 'drone_run_band_project_id':manage_drone_imagery_standard_process_drone_run_band_project_id,
2459 'time_cvterm_id':manage_drone_imagery_standard_process_phenotype_time,
2460 'test_run':manage_drone_imagery_standard_process_gcp_test_run
2462 success: function(response){
2463 console.log(response);
2464 if (response.error) {
2465 alert(response.error);
2468 error: function(response){
2469 alert('Error doing standard process with ground control points confirmation!');
2472 alert('The standard process will continue in the background and may take some time. You can check the indicator on the manage aerial imagery page to see when it is complete.');
2477 jQuery('#manage_drone_imagery_standard_process_previous_camera_rig_step_confirm').click(function(){
2478 var manage_drone_imagery_standard_process_previous_camera_rig_step_drone_run_project_id = jQuery('#manage_drone_imagery_standard_process_previous_camera_rig_select_id').val();
2479 if (manage_drone_imagery_standard_process_previous_camera_rig_step_drone_run_project_id == '') {
2480 alert('Please select a previous imaging event to use as the template!');
2485 url: '/api/drone_imagery/get_weeks_after_planting_date?drone_run_project_id='+manage_drone_imagery_standard_process_drone_run_project_id,
2487 beforeSend: function (){
2488 jQuery('#working_modal').modal('show');
2490 success: function(response){
2491 jQuery('#working_modal').modal('hide');
2492 console.log(response);
2493 if (response.error) {
2494 alert(response.error);
2497 manage_drone_imagery_standard_process_phenotype_time = response.time_ontology_day_cvterm_id;
2501 url : '/api/drone_imagery/standard_process_apply_previous_imaging_event',
2503 'previous_drone_run_project_id':manage_drone_imagery_standard_process_previous_camera_rig_step_drone_run_project_id,
2504 'field_trial_id':manage_drone_imagery_standard_process_field_trial_id,
2505 'drone_run_project_id':manage_drone_imagery_standard_process_drone_run_project_id,
2506 'drone_run_band_project_id':manage_drone_imagery_standard_process_drone_run_band_project_id,
2507 'time_cvterm_id':manage_drone_imagery_standard_process_phenotype_time
2509 success: function(response){
2510 console.log(response);
2511 if (response.error) {
2512 alert(response.error);
2515 error: function(response){
2516 alert('Error doing standard process with previous imaging event!');
2520 alert('The standard process will continue in the background and may take some time. You can check the indicator on the manage aerial imagery page to see when it is complete.');
2523 error: function(response){
2524 alert('Error getting time terms for standard process with previous imaging event!');
2525 jQuery('#working_modal').modal('hide');
2532 jQuery('#manage_drone_imagery_standard_process_ground_control_points_skip_step').click(function(){
2534 url : '/api/drone_imagery/get_project_md_image?drone_run_band_project_id='+manage_drone_imagery_standard_process_drone_run_band_project_id+'&project_image_type_name=stitched_drone_imagery',
2535 beforeSend: function(){
2536 showManageDroneImagerySection('manage_drone_imagery_loading_div');
2538 success: function(response){
2539 console.log(response);
2540 manage_drone_imagery_standard_process_rotate_stitched_image_id = response.data[0]['image_id'];
2541 manage_drone_imagery_standard_process_rotate_stitched_image_degrees = 0.00;
2543 drone_imagery_plot_polygon_click_type = '';
2545 showRotateImageD3(manage_drone_imagery_standard_process_rotate_stitched_image_id, '#drone_imagery_standard_process_rotate_original_stitched_div', 'manage_drone_imagery_standard_process_rotate_load_div');
2547 showManageDroneImagerySection('manage_drone_imagery_standard_process_div');
2549 Workflow.complete("#manage_drone_imagery_standard_process_ground_control_points_skip_step");
2550 Workflow.focus('#manage_drone_imagery_standard_process_workflow', 3);
2552 error: function(response){
2553 alert('Error getting standard process image rotation step!');
2554 showManageDroneImagerySection('manage_drone_imagery_standard_process_div');
2559 d3.select("#drone_imagery_standard_process_rotate_degrees_input").on("input", function() {
2560 manage_drone_imagery_standard_process_rotate_stitched_image_degrees = this.value;
2561 droneImageryStandardProcessRotateImages(manage_drone_imagery_standard_process_rotate_stitched_image_degrees, 1, '#drone_imagery_standard_process_rotate_original_stitched_div_area');
2562 jQuery('#drone_imagery_standard_process_rotate_degrees_input_text').html(manage_drone_imagery_standard_process_rotate_stitched_image_degrees);
2565 function droneImageryStandardProcessRotateImages(angle, centered, div_id){
2566 d3.selectAll('g').each(function(d) {
2567 var x_pos = d3.select(this).attr('x_pos');
2568 var y_pos = d3.select(this).attr('y_pos');
2569 if (centered == 1) {
2570 var rotate_x_pos = manage_drone_imagery_standard_process_image_width/2;
2571 var rotate_y_pos = manage_drone_imagery_standard_process_image_height/2;
2572 d3.select(this).attr("transform", "translate("+x_pos+","+y_pos+") rotate("+angle+","+rotate_x_pos+","+rotate_y_pos+")");
2575 d3.select(this).attr("transform", "translate("+x_pos+","+y_pos+") rotate("+angle+")");
2580 jQuery('#drone_imagery_standard_process_rotate_stitched_crosshairs').click(function(){
2581 drawRotateCrosshairsD3(getRandomColor());
2584 jQuery('#drone_imagery_standard_process_rotate_stitched_restart').click(function(){
2585 showRotateImageD3(manage_drone_imagery_standard_process_rotate_stitched_image_id, '#drone_imagery_standard_process_rotate_original_stitched_div', 'manage_drone_imagery_standard_process_rotate_load_div');
2586 manage_drone_imagery_standard_process_rotate_stitched_image_degrees = 0.00;
2589 jQuery('#manage_drone_imagery_standard_process_rotate_step').click(function() {
2590 var rotate_stitched_image_degrees_text = jQuery('#drone_imagery_standard_process_rotate_degrees_input').val();
2591 if (rotate_stitched_image_degrees_text == '') {
2592 alert('Please give a number of degrees first! Can be a decimal amount.');
2595 if (isNaN(rotate_stitched_image_degrees_text)) {
2596 alert('Please give a number of degrees first! Can be a decimal amount.');
2599 manage_drone_imagery_standard_process_rotate_stitched_image_degrees = parseFloat(rotate_stitched_image_degrees_text);
2601 url : '/api/drone_imagery/rotate_image?image_id='+manage_drone_imagery_standard_process_rotate_stitched_image_id+'&drone_run_band_project_id='+manage_drone_imagery_standard_process_drone_run_band_project_id+'&angle='+manage_drone_imagery_standard_process_rotate_stitched_image_degrees*-1,
2602 beforeSend: function() {
2603 showManageDroneImagerySection('manage_drone_imagery_loading_div');
2605 success: function(response){
2606 console.log(response);
2607 manage_drone_imagery_standard_process_rotated_stitched_image_id = response.rotated_image_id;
2608 showCropImageStart(manage_drone_imagery_standard_process_rotated_stitched_image_id, 'drone_imagery_standard_process_crop_original_stitched_div', 'manage_drone_imagery_standard_process_crop_load_div');
2610 get_select_box('drone_imagery_parameter_select','plot_polygons_standard_process_previously_saved_image_cropping_templates', {'name':'drone_imagery_standard_process_previously_saved_image_cropping_select', 'id':'drone_imagery_standard_process_previously_saved_image_cropping_select', 'empty':1, 'field_trial_id':manage_drone_imagery_standard_process_field_trial_id, 'parameter':'image_cropping' });
2612 Workflow.complete("#manage_drone_imagery_standard_process_rotate_step");
2613 Workflow.focus('#manage_drone_imagery_standard_process_workflow', 4);
2615 showManageDroneImagerySection('manage_drone_imagery_standard_process_div');
2617 error: function(response){
2618 //alert('Error saving standard process rotated image image!');
2619 showManageDroneImagerySection('manage_drone_imagery_standard_process_div');
2624 jQuery(document).on('click', '#manage_drone_imagery_standard_process_cropping_step', function(){
2625 console.log(crop_points);
2626 if (crop_points.length != 4) {
2627 alert('Please click 4 points on the image to draw a rectangle first!');
2631 url : '/api/drone_imagery/crop_image?image_id='+manage_drone_imagery_standard_process_rotated_stitched_image_id+'&polygon='+JSON.stringify(crop_points)+'&drone_run_band_project_id='+manage_drone_imagery_standard_process_drone_run_band_project_id,
2632 beforeSend: function() {
2633 showManageDroneImagerySection('manage_drone_imagery_loading_div');
2635 success: function(response){
2636 console.log(response);
2637 manage_drone_imagery_standard_process_cropped_image_id = response.cropped_image_id;
2638 if (response.error) {
2639 alert(response.error);
2643 url : '/api/drone_imagery/denoise?image_id='+manage_drone_imagery_standard_process_cropped_image_id+'&drone_run_band_project_id='+manage_drone_imagery_standard_process_drone_run_band_project_id,
2644 success: function(response){
2645 console.log(response);
2646 manage_drone_imagery_standard_process_denoised_image_id = response.denoised_image_id;
2647 remove_background_current_image_id = manage_drone_imagery_standard_process_denoised_image_id;
2648 remove_background_drone_run_band_project_id = manage_drone_imagery_standard_process_drone_run_band_project_id;
2650 showRemoveBackgroundHistogramStart(manage_drone_imagery_standard_process_denoised_image_id, 'drone_imagery_standard_process_remove_background_original', 'drone_imagery_standard_process_remove_background_histogram_div', 'manage_drone_imagery_standard_process_remove_background_load_div');
2652 Workflow.complete("#manage_drone_imagery_standard_process_cropping_step");
2653 Workflow.focus('#manage_drone_imagery_standard_process_workflow', 5);
2655 showManageDroneImagerySection('manage_drone_imagery_standard_process_div');
2657 error: function(response){
2658 alert('Error standard process denoising image!');
2659 showManageDroneImagerySection('manage_drone_imagery_standard_process_div');
2664 error: function(response){
2665 alert('Error standard process cropping image!');
2666 showManageDroneImagerySection('manage_drone_imagery_standard_process_div');
2671 jQuery(document).on('click', '#drone_imagery_standard_process_cropping_use_previous_cropping', function() {
2672 var plot_polygons_use_previously_saved_cropping = jQuery('#drone_imagery_standard_process_previously_saved_image_cropping_select').val();
2674 url : '/api/drone_imagery/retrieve_parameter_template?plot_polygons_template_projectprop_id='+plot_polygons_use_previously_saved_cropping,
2675 success: function(response){
2676 console.log(response);
2678 url : '/api/drone_imagery/crop_image?image_id='+manage_drone_imagery_standard_process_rotated_stitched_image_id+'&polygon='+JSON.stringify(response.parameter[0])+'&drone_run_band_project_id='+manage_drone_imagery_standard_process_drone_run_band_project_id,
2679 beforeSend: function() {
2680 showManageDroneImagerySection('manage_drone_imagery_loading_div');
2682 success: function(response){
2683 console.log(response);
2684 manage_drone_imagery_standard_process_cropped_image_id = response.cropped_image_id;
2685 if (response.error) {
2686 alert(response.error);
2690 url : '/api/drone_imagery/denoise?image_id='+manage_drone_imagery_standard_process_cropped_image_id+'&drone_run_band_project_id='+manage_drone_imagery_standard_process_drone_run_band_project_id,
2691 success: function(response){
2692 console.log(response);
2693 manage_drone_imagery_standard_process_denoised_image_id = response.denoised_image_id;
2694 remove_background_current_image_id = manage_drone_imagery_standard_process_denoised_image_id;
2695 remove_background_drone_run_band_project_id = manage_drone_imagery_standard_process_drone_run_band_project_id;
2697 showRemoveBackgroundHistogramStart(manage_drone_imagery_standard_process_denoised_image_id, 'drone_imagery_standard_process_remove_background_original', 'drone_imagery_standard_process_remove_background_histogram_div', 'manage_drone_imagery_standard_process_remove_background_load_div');
2699 Workflow.complete("#manage_drone_imagery_standard_process_cropping_step");
2700 Workflow.focus('#manage_drone_imagery_standard_process_workflow', 5);
2702 showManageDroneImagerySection('manage_drone_imagery_standard_process_div');
2704 error: function(response){
2705 alert('Error standard process denoising image!');
2706 showManageDroneImagerySection('manage_drone_imagery_standard_process_div');
2711 error: function(response){
2712 showManageDroneImagerySection('manage_drone_imagery_standard_process_div');
2713 alert('Error cropping image!');
2717 error: function(response){
2718 alert('Error retrieving saved cropping template in standard process!');
2719 showManageDroneImagerySection('manage_drone_imagery_standard_process_div');
2725 jQuery('#drone_imagery_standard_process_remove_background_defined_percentage_submit').click(function(){
2726 var drone_imagery_remove_background_lower_percentage = Number(jQuery('#drone_imagery_standard_process_remove_background_lower_threshold_percentage').val());
2727 var drone_imagery_remove_background_upper_percentage = Number(jQuery('#drone_imagery_standard_process_remove_background_upper_threshold_percentage').val());
2729 //var threshold_value_return = calculateThresholdPercentageValues('drone_imagery_remove_background_original', drone_imagery_remove_background_lower_percentage, drone_imagery_remove_background_upper_percentage);
2731 manage_drone_imagery_standard_process_remove_background_threshold_percentage_save(manage_drone_imagery_standard_process_denoised_image_id, manage_drone_imagery_standard_process_current_threshold_background_removed_type, manage_drone_imagery_standard_process_drone_run_band_project_id, drone_imagery_remove_background_lower_percentage, drone_imagery_remove_background_upper_percentage);
2734 function manage_drone_imagery_standard_process_remove_background_threshold_percentage_save(image_id, image_type, drone_run_band_project_id, lower_threshold_percentage, upper_threshold_percentage){
2737 url: '/api/drone_imagery/remove_background_percentage_save',
2739 beforeSend: function() {
2740 showManageDroneImagerySection('manage_drone_imagery_loading_div');
2743 'image_id': image_id,
2744 'image_type_list': image_type,
2745 'drone_run_band_project_id': drone_run_band_project_id,
2746 'lower_threshold_percentage': lower_threshold_percentage,
2747 'upper_threshold_percentage': upper_threshold_percentage
2749 success: function(response){
2750 console.log(response);
2751 if(response.error) {
2752 alert(response.error);
2754 manage_drone_imagery_standard_process_removed_background_image_id = response[0]['removed_background_image_id'];
2756 showPlotPolygonStart(manage_drone_imagery_standard_process_removed_background_image_id, drone_run_band_project_id, 'drone_imagery_standard_process_plot_polygons_original_stitched_div', 'drone_imagery_standard_process_plot_polygons_top_section', 'manage_drone_imagery_standard_process_plot_polygons_load_div', 0);
2758 showPlotPolygonTableStart(manage_drone_imagery_standard_process_field_trial_id, 'drone_imagery_standard_process_trial_layout_div', 'drone_imagery_standard_process_layout_table')
2760 get_select_box('drone_imagery_parameter_select','plot_polygons_standard_process_previously_saved_plot_polygon_templates', {'name': 'plot_polygons_standard_process_template_select', 'id': 'plot_polygons_standard_process_template_select', 'empty':1, 'field_trial_id':manage_drone_imagery_standard_process_field_trial_id, 'parameter':'plot_polygons' });
2762 Workflow.complete("#drone_imagery_standard_process_remove_background_defined_percentage_submit");
2763 Workflow.focus('#manage_drone_imagery_standard_process_workflow', 6);
2765 showManageDroneImagerySection('manage_drone_imagery_standard_process_div');
2767 error: function(response){
2768 //alert('Error saving standard process removed background image!');
2769 showManageDroneImagerySection('manage_drone_imagery_standard_process_div');
2774 var plot_polygons_standard_process_default_image_type_is_background_removed = 0;
2775 jQuery('#drone_imagery_standard_process_plot_polygons_switch_image_url').click(function() {
2776 if (plot_polygons_standard_process_default_image_type_is_background_removed == 1) {
2777 showPlotPolygonStart(manage_drone_imagery_standard_process_removed_background_image_id, drone_run_band_project_id, 'drone_imagery_standard_process_plot_polygons_original_stitched_div', 'drone_imagery_standard_process_plot_polygons_top_section', 'manage_drone_imagery_standard_process_plot_polygons_load_div', 0);
2778 plot_polygons_standard_process_default_image_type_is_background_removed = 0;
2781 showPlotPolygonStart(manage_drone_imagery_standard_process_denoised_image_id, drone_run_band_project_id, 'drone_imagery_standard_process_plot_polygons_original_stitched_div', 'drone_imagery_standard_process_plot_polygons_top_section', 'manage_drone_imagery_standard_process_plot_polygons_load_div', 0);
2782 plot_polygons_standard_process_default_image_type_is_background_removed = 1;
2786 jQuery('#plot_polygons_standard_process_use_previously_saved_template').click(function() {
2787 var plot_polygons_use_previously_saved_template = jQuery('#plot_polygons_standard_process_template_select').val();
2788 if (plot_polygons_use_previously_saved_template == '') {
2789 alert('Please select a previously saved template before trying to apply it. If there is not a template listed, then you can create one using the templating tool above.');
2794 url : '/api/drone_imagery/retrieve_parameter_template?plot_polygons_template_projectprop_id='+plot_polygons_use_previously_saved_template,
2795 success: function(response){
2796 console.log(response);
2798 drone_imagery_plot_polygons_display = response.parameter;
2799 drone_imagery_plot_polygons = response.parameter;
2801 draw_canvas_image(background_image_url, 0);
2802 droneImageryDrawLayoutTable(field_trial_layout_response, drone_imagery_plot_polygons, 'drone_imagery_standard_process_trial_layout_div', 'drone_imagery_standard_process_layout_table');
2803 droneImageryRectangleLayoutTable(drone_imagery_plot_polygons, 'drone_imagery_standard_process_generated_polygons_div', 'drone_imagery_standard_process_plot_polygons_generated_assign', 'drone_imagery_standard_process_plot_polygons_submit_bottom');
2805 error: function(response){
2806 alert('Error retrieving plot polygons template in standard process!');
2812 jQuery('#drone_imagery_standard_process_plot_polygons_rectangles_apply').click(function() {
2813 plot_polygons_display_points = [];
2814 plot_polygons_ind_points = [];
2815 plot_polygons_ind_4_points = [];
2817 var num_rows_val = jQuery('#drone_imagery_standard_process_plot_polygons_num_rows').val();
2818 var num_cols_val = jQuery('#drone_imagery_standard_process_plot_polygons_num_cols').val();
2819 var section_top_row_left_offset_val = jQuery('#drone_imagery_standard_process_plot_polygons_top_row_left_offset').val();
2820 var section_top_row_right_offset_val = jQuery('#drone_imagery_standard_process_plot_polygons_top_row_right_offset').val();
2821 var section_bottom_row_left_offset_val = jQuery('#drone_imagery_standard_process_plot_polygons_bottom_row_left_offset').val();
2822 var section_left_column_top_offset_val = jQuery('#drone_imagery_standard_process_plot_polygons_left_column_top_offset').val();
2823 var section_left_column_bottom_offset_val = jQuery('#drone_imagery_standard_process_plot_polygons_left_column_bottom_offset').val();
2824 var section_right_column_bottom_offset_val = jQuery('#drone_imagery_standard_process_plot_polygons_right_col_bottom_offset').val();
2826 plotPolygonsRectanglesApply(num_rows_val, num_cols_val, section_top_row_left_offset_val, section_bottom_row_left_offset_val, section_left_column_top_offset_val, section_left_column_bottom_offset_val, section_top_row_right_offset_val, section_right_column_bottom_offset_val, 'drone_imagery_standard_process_generated_polygons_div', 'drone_imagery_standard_process_generated_polygons_table', 'drone_imagery_standard_process_plot_polygons_generated_assign', 'drone_imagery_standard_process_plot_polygons_submit_bottom', 'drone_imagery_standard_process_plot_polygons_active_templates');
2828 plotPolygonManualAssignPlotNumberTableStandard('drone_imagery_standard_process_generated_polygons_table', 'drone_imagery_standard_process_generated_polygons_table_id', 'drone_imagery_standard_process_generated_polygons_table_input', 'drone_imagery_standard_process_generated_polygons_table_input_generate_button', 'drone_imagery_standard_process_plot_polygons_submit_bottom');
2831 var drone_imagery_standard_process_plot_polygon_click_type = '';
2832 jQuery('#drone_imagery_standard_process_plot_polygons_top_left_click').click(function(){
2833 alert('Now click the top left corner of your field on the image below.');
2834 drone_imagery_standard_process_plot_polygon_click_type = 'top_left';
2836 jQuery('#drone_imagery_standard_process_plot_polygons_top_right_click').click(function(){
2837 alert('Now click the top right corner of your field on the image below.');
2838 drone_imagery_standard_process_plot_polygon_click_type = 'top_right';
2840 jQuery('#drone_imagery_standard_process_plot_polygons_bottom_left_click').click(function(){
2841 alert('Now click the bottom left corner of your field on the image below.');
2842 drone_imagery_standard_process_plot_polygon_click_type = 'bottom_left';
2844 jQuery('#drone_imagery_standard_process_plot_polygons_bottom_right_click').click(function(){
2845 alert('Now click the bottom right corner of your field on the image below.');
2846 drone_imagery_standard_process_plot_polygon_click_type = 'bottom_right';
2848 jQuery(document).on('click', '#drone_imagery_standard_process_plot_polygons_get_distance', function(){
2849 alert('Click on two points in image. The distance will be returned.');
2850 drone_imagery_standard_process_plot_polygon_click_type = 'get_distance';
2854 jQuery(document).on('click', '#drone_imagery_standard_process_plot_polygons_clear', function(){
2855 plot_polygons_display_points = [];
2856 plot_polygons_ind_points = [];
2857 plot_polygons_ind_4_points = [];
2858 drone_imagery_plot_polygons = {};
2859 drone_imagery_plot_generated_polygons = {};
2860 drone_imagery_plot_polygons_display = {};
2861 plot_polygons_generated_polygons = [];
2862 drone_imagery_plot_polygons_removed_numbers = [];
2863 plot_polygons_template_dimensions = [];
2864 ctx.clearRect(0, 0, canvas.width, canvas.height);
2865 draw_canvas_image(background_image_url, 0);
2866 jQuery('#drone_imagery_standard_process_generated_polygons_div').html('');
2867 droneImageryDrawLayoutTable(field_trial_layout_response, drone_imagery_plot_polygons, 'drone_imagery_standard_process_trial_layout_div', 'drone_imagery_standard_process_layout_table');
2868 droneImageryDrawPlotPolygonActiveTemplatesTable("drone_imagery_standard_process_plot_polygons_active_templates", plot_polygons_template_dimensions);
2871 jQuery(document).on('click', '#drone_imagery_standard_process_plot_polygons_clear_one', function(){
2872 jQuery('#drone_imagery_plot_polygon_remove_polygon').modal('show');
2876 jQuery(document).on('click', '#drone_imagery_standard_process_plot_polygons_generated_assign', function() {
2877 generatePlotPolygonAssignments('drone_imagery_standard_process_trial_layout_div', 'drone_imagery_standard_process_layout_table');
2879 jQuery('input[name="drone_imagery_plot_polygons_autocomplete"]').each(function() {
2880 var stock_name = this.value;
2881 if (stock_name != '') {
2882 var polygon = drone_imagery_plot_generated_polygons[jQuery(this).data('generated_polygon_key')];
2883 drone_imagery_plot_polygons[stock_name] = polygon;
2888 jQuery(document).on('click', 'button[name=drone_imagery_standard_process_plot_polygons_submit_bottom]', function(){
2891 url: '/api/drone_imagery/save_plot_polygons_template',
2894 'drone_run_band_project_id': manage_drone_imagery_standard_process_drone_run_band_project_id,
2895 'stock_polygons': JSON.stringify(drone_imagery_plot_polygons)
2897 success: function(response){
2898 console.log(response);
2899 if(response.error) {
2900 alert(response.error);
2902 Workflow.complete("#drone_imagery_standard_process_generated_polygons_div");
2903 Workflow.focus('#manage_drone_imagery_standard_process_workflow', 7);
2906 error: function(response){
2907 //alert('Error saving standard process assigned plot polygons!')
2911 jQuery('#manage_drone_imagery_standard_process_drone_run_bands_apply_table').DataTable({
2913 ajax : '/api/drone_imagery/drone_run_bands?select_checkbox_name=drone_run_standard_process_band_apply_select&drone_run_project_id='+manage_drone_imagery_standard_process_drone_run_project_id+'&select_all=1&disable=1'
2917 jQuery('#manage_drone_imagery_standard_process_drone_run_band_apply_step').click(function(){
2918 manage_drone_imagery_standard_process_apply_drone_run_band_project_ids = [];
2919 jQuery('input[name="drone_run_standard_process_band_apply_select"]:checked').each(function() {
2920 manage_drone_imagery_standard_process_apply_drone_run_band_project_ids.push(jQuery(this).val());
2922 if (manage_drone_imagery_standard_process_apply_drone_run_band_project_ids.length < 1){
2923 alert('Please select at least one other imaging event band!');
2926 Workflow.complete("#manage_drone_imagery_standard_process_drone_run_band_apply_step");
2927 Workflow.focus('#manage_drone_imagery_standard_process_workflow', 8);
2931 jQuery('#manage_drone_imagery_standard_process_indices_step').click(function(){
2932 manage_drone_imagery_standard_process_apply_drone_run_band_vegetative_indices = [];
2933 jQuery('input[name="drone_imagery_standard_process_apply_indices_select"]:checked').each(function() {
2934 manage_drone_imagery_standard_process_apply_drone_run_band_vegetative_indices.push(jQuery(this).val());
2936 if (manage_drone_imagery_standard_process_apply_drone_run_band_vegetative_indices.length < 1){
2937 alert('Please select at least one vegetative index!');
2942 url: '/api/drone_imagery/get_weeks_after_planting_date?drone_run_project_id='+manage_drone_imagery_standard_process_drone_run_project_id,
2944 beforeSend: function (){
2945 jQuery('#working_modal').modal('show');
2947 success: function(response){
2948 jQuery('#working_modal').modal('hide');
2949 console.log(response);
2950 if (response.error) {
2951 alert(response.error);
2954 var html = "<center><b>Field Trial Planting Date</b>: "+response.planting_date+"<br/><b>Imaging Event Date</b>: "+response.drone_run_date+"<br/><b>Number of Weeks</b>: "+response.rounded_time_difference_weeks+"<br/><b>Number of Weeks Ontology Term</b>: "+response.time_ontology_week_term+"<br/><b>Number of Days</b>:"+response.time_difference_days+"<br/><b>Number of Days Ontology Term</b>: "+response.time_ontology_day_term+"<br/><br/></center>";
2955 jQuery('#drone_imagery_standard_process_week_term_div').html(html);
2957 manage_drone_imagery_standard_process_phenotype_time = response.time_ontology_day_cvterm_id;
2959 error: function(response){
2960 alert('Error getting time terms!');
2961 jQuery('#working_modal').modal('hide');
2965 Workflow.complete("#manage_drone_imagery_standard_process_indices_step");
2966 Workflow.focus('#manage_drone_imagery_standard_process_workflow', 9);
2970 jQuery('#manage_drone_imagery_standard_process_phenotypes_step').click(function(){
2973 if (manage_drone_imagery_standard_process_phenotype_time == '') {
2974 alert('Time of phenotype not set! This should not happen! Please contact us.');
2978 jQuery('input[name="drone_imagery_standard_process_phenotypes_select"]:checked').each(function() {
2979 selected.push(jQuery(this).val());
2981 if (selected.length < 1){
2982 alert('Please select at least one phenotype!');
2987 url: '/api/drone_imagery/standard_process_apply',
2990 'drone_run_project_id': manage_drone_imagery_standard_process_drone_run_project_id,
2991 'drone_run_band_project_id': manage_drone_imagery_standard_process_drone_run_band_project_id,
2992 'apply_drone_run_band_project_ids': JSON.stringify(manage_drone_imagery_standard_process_apply_drone_run_band_project_ids),
2993 'vegetative_indices': JSON.stringify(manage_drone_imagery_standard_process_apply_drone_run_band_vegetative_indices),
2994 'phenotype_types': JSON.stringify(selected),
2995 'time_cvterm_id': manage_drone_imagery_standard_process_phenotype_time,
2996 'standard_process_type': 'minimal',
2997 'field_trial_id':manage_drone_imagery_standard_process_field_trial_id,
2998 'apply_to_all_drone_runs_from_same_camera_rig':jQuery('#drone_imagery_standard_process_camera_rig_apply_select').val()
3000 success: function(response){
3001 console.log(response);
3002 if(response.error) {
3003 alert(response.error);
3006 error: function(response){
3007 //alert('Error saving standard process assigned plot polygons!')
3011 Workflow.complete("#manage_drone_imagery_standard_process_phenotypes_step");
3012 jQuery('#drone_imagery_standard_process_complete_dialog').modal('show');
3016 jQuery('#drone_imagery_standard_process_complete_dialog').on('hidden.bs.modal', function () {
3021 // TimeSeries for field trial
3024 var manage_drone_imagery_field_trial_time_series_field_trial_id;
3025 var manage_drone_imagery_field_trial_time_series_field_trial_name;
3026 var manage_drone_imagery_field_trial_time_series_image_id_hash;
3027 var manage_drone_imagery_field_trial_time_series_image_id;
3028 var manage_drone_imagery_field_trial_time_series_drone_run_project_id;
3029 var manage_drone_imagery_field_trial_time_series_sorted_times;
3030 var manage_drone_imagery_field_trial_time_series_sorted_dates;
3031 var manage_drone_imagery_field_trial_time_series_date;
3032 var manage_drone_imagery_field_trial_time_series_time;
3033 var manage_drone_imagery_field_trial_time_series_sorted_image_types;
3034 var manage_drone_imagery_field_trial_time_series_image_type;
3035 var manage_drone_imagery_field_trial_time_series_image_type_counter = 0;
3036 var manage_drone_imagery_field_trial_time_series_time_counter = 0;
3037 var drone_imagery_plot_polygons_display_plot_field_layout;
3039 function _drone_imagery_time_series_image_show() {
3040 manage_drone_imagery_field_trial_time_series_time = manage_drone_imagery_field_trial_time_series_sorted_times[manage_drone_imagery_field_trial_time_series_time_counter];
3041 manage_drone_imagery_field_trial_time_series_date = manage_drone_imagery_field_trial_time_series_sorted_dates[manage_drone_imagery_field_trial_time_series_time_counter];
3043 manage_drone_imagery_field_trial_time_series_image_id = 0;
3044 while (manage_drone_imagery_field_trial_time_series_image_id == 0) {
3045 manage_drone_imagery_field_trial_time_series_image_type = manage_drone_imagery_field_trial_time_series_sorted_image_types[manage_drone_imagery_field_trial_time_series_image_type_counter];
3046 if (manage_drone_imagery_field_trial_time_series_image_id_hash[manage_drone_imagery_field_trial_time_series_time][manage_drone_imagery_field_trial_time_series_image_type]) {
3047 manage_drone_imagery_field_trial_time_series_image_id = manage_drone_imagery_field_trial_time_series_image_id_hash[manage_drone_imagery_field_trial_time_series_time][manage_drone_imagery_field_trial_time_series_image_type]['image_id'];
3050 if (manage_drone_imagery_field_trial_time_series_image_type_counter > manage_drone_imagery_field_trial_time_series_sorted_image_types.length) {
3051 manage_drone_imagery_field_trial_time_series_image_type_counter = 0;
3054 manage_drone_imagery_field_trial_time_series_image_type_counter = manage_drone_imagery_field_trial_time_series_image_type_counter + 1;
3059 manage_drone_imagery_field_trial_time_series_drone_run_project_id = manage_drone_imagery_field_trial_time_series_image_id_hash[manage_drone_imagery_field_trial_time_series_time][manage_drone_imagery_field_trial_time_series_image_type]['drone_run_project_id'];
3061 drone_imagery_plot_polygons_display = JSON.parse(manage_drone_imagery_field_trial_time_series_image_id_hash[manage_drone_imagery_field_trial_time_series_time][manage_drone_imagery_field_trial_time_series_image_type]['plot_polygons']);
3063 showPlotPolygonStart(manage_drone_imagery_field_trial_time_series_image_id, manage_drone_imagery_field_trial_time_series_drone_run_project_id, 'manage_drone_imagery_field_trial_time_series_canvas_div', 'manage_drone_imagery_field_trial_time_series_info_div', 'manage_drone_imagery_field_trial_time_series_loading_div', 1);
3065 var image_type_html = "<table class='table table-bordered table-hover'><thead><tr><th>Image Types (Select an image type)</th></tr></thead><tbody><tr><td>";
3066 for (var i=0; i<manage_drone_imagery_field_trial_time_series_sorted_image_types.length; i++) {
3067 if (manage_drone_imagery_field_trial_time_series_sorted_image_types[i] == manage_drone_imagery_field_trial_time_series_image_type) {
3068 image_type_html = image_type_html + "<button class='btn btn-sm btn-info' style='margin:3px'>"+manage_drone_imagery_field_trial_time_series_sorted_image_types[i]+"</button>";
3071 image_type_html = image_type_html + "<button class='btn btn-sm btn-default' style='margin:3px' name='drone_runs_trial_view_timeseries_image_type_select' data-index="+i+" >"+manage_drone_imagery_field_trial_time_series_sorted_image_types[i]+"</button>";
3074 image_type_html = image_type_html + "</td></tr></tbody></table>";
3076 var time_html = "<table class='table table-bordered table-hover'><thead><tr><th>Time Points (Select a time point)</th></tr></thead><tbody><tr><td>";
3077 for (var i=0; i<manage_drone_imagery_field_trial_time_series_sorted_dates.length; i++) {
3078 if (manage_drone_imagery_field_trial_time_series_sorted_dates[i] == manage_drone_imagery_field_trial_time_series_date) {
3079 time_html = time_html + "<button class='btn btn-sm btn-info' style='margin:3px' >"+manage_drone_imagery_field_trial_time_series_sorted_dates[i]+"</button>";
3082 time_html = time_html + "<button class='btn btn-sm btn-default' style='margin:3px' name='drone_runs_trial_view_timeseries_date_select' data-index="+i+" >"+manage_drone_imagery_field_trial_time_series_sorted_dates[i]+"</button>";
3085 time_html = time_html + "</td></tr></tbody></table>";
3087 jQuery('#manage_drone_imagery_field_trial_time_series_image_type_div').html(image_type_html);
3088 jQuery('#manage_drone_imagery_field_trial_time_series_times_div').html(time_html);
3091 jQuery(document).on('click', 'button[name="drone_runs_trial_view_timeseries_image_type_select"]', function(){
3092 manage_drone_imagery_field_trial_time_series_image_type_counter = jQuery(this).data('index');
3093 _drone_imagery_time_series_image_show();
3096 jQuery(document).on('click', 'button[name="drone_runs_trial_view_timeseries_date_select"]', function(){
3097 manage_drone_imagery_field_trial_time_series_time_counter = jQuery(this).data('index');
3098 _drone_imagery_time_series_image_show();
3101 jQuery(document).on('click', 'button[name="drone_runs_trial_view_timeseries"]', function(){
3102 manage_drone_imagery_field_trial_time_series_field_trial_id = jQuery(this).data('field_trial_id');
3103 manage_drone_imagery_field_trial_time_series_field_trial_name = jQuery(this).data('field_trial_name');
3105 jQuery('#manage_drone_imagery_field_trial_time_series_div_title').html("<center><h3>"+manage_drone_imagery_field_trial_time_series_field_trial_name+"</h3></center>");
3108 url: '/api/drone_imagery/get_image_for_time_series?field_trial_id='+manage_drone_imagery_field_trial_time_series_field_trial_id,
3109 beforeSend: function() {
3110 showManageDroneImagerySection('manage_drone_imagery_loading_div');
3112 success: function(response){
3113 console.log(response);
3114 if(response.error) {
3115 alert(response.error);
3117 showManageDroneImagerySection('manage_drone_imagery_field_trial_time_series_div');
3119 manage_drone_imagery_field_trial_time_series_image_id_hash = response.image_ids_hash;
3120 manage_drone_imagery_field_trial_time_series_sorted_times = response.sorted_times;
3121 manage_drone_imagery_field_trial_time_series_sorted_dates = response.sorted_dates;
3122 manage_drone_imagery_field_trial_time_series_sorted_image_types = response.sorted_image_types;
3123 manage_drone_imagery_field_trial_time_series_time_counter = 0;
3124 manage_drone_imagery_field_trial_time_series_image_type_counter = 0
3126 drone_imagery_plot_polygons_display_plot_field_layout = response.field_layout;
3128 _drone_imagery_time_series_image_show();
3130 error: function(response){
3131 showManageDroneImagerySection('manage_drone_imagery_field_trial_time_series_div');
3132 alert('Error getting image for time series!')
3138 // Save ground control points
3141 var project_drone_imagery_ground_control_points_drone_run_project_id;
3142 var project_drone_imagery_ground_control_points_drone_run_project_name;
3143 var project_drone_imagery_ground_control_points_image_ids;
3144 var project_drone_imagery_ground_control_points_image_types;
3145 var project_drone_imagery_ground_control_points_image_id;
3146 var project_drone_imagery_ground_control_points_image_type;
3147 var project_drone_imagery_ground_control_points_image_id_counter = 0;
3148 var project_drone_imagery_ground_control_points_saved;
3149 var project_drone_imagery_ground_control_points_saved_array;
3151 var project_drone_imagery_ground_control_points_saved_div_table;
3153 jQuery(document).on('click', 'button[name="project_drone_imagery_ground_control_points"]', function(){
3154 project_drone_imagery_ground_control_points_drone_run_project_id = jQuery(this).data('drone_run_project_id');
3155 project_drone_imagery_ground_control_points_drone_run_project_name = jQuery(this).data('drone_run_project_name');
3157 project_drone_imagery_ground_control_points_saved_div_table = 'project_drone_imagery_ground_control_points_saved_div';
3159 jQuery('#project_drone_imagery_ground_control_points_title_div').html('<center><h3>'+project_drone_imagery_ground_control_points_drone_run_project_name+'</h3></center>');
3161 showManageDroneImagerySection('project_drone_imagery_ground_control_points_div');
3164 url: '/api/drone_imagery/get_image_for_saving_gcp?drone_run_project_id='+project_drone_imagery_ground_control_points_drone_run_project_id,
3165 success: function(response){
3166 console.log(response);
3167 if(response.error) {
3168 alert(response.error);
3171 project_drone_imagery_ground_control_points_image_ids = response.image_ids;
3172 project_drone_imagery_ground_control_points_image_types = response.image_types;
3173 project_drone_imagery_ground_control_points_saved = response.saved_gcps_full;
3174 project_drone_imagery_ground_control_points_saved_array = response.gcps_array;
3176 project_drone_imagery_ground_control_points_image_id = project_drone_imagery_ground_control_points_image_ids[0];
3177 project_drone_imagery_ground_control_points_image_type = project_drone_imagery_ground_control_points_image_types[0];
3179 showPlotPolygonStart(project_drone_imagery_ground_control_points_image_id, project_drone_imagery_ground_control_points_drone_run_project_id, 'project_drone_imagery_ground_control_points_canvas_div', 'project_drone_imagery_ground_control_points_info_div', 'project_drone_imagery_ground_control_points_loading_div', 0);
3181 jQuery('#project_drone_imagery_ground_control_points_image_type_div').html('<h4>'+project_drone_imagery_ground_control_points_image_type+'</h4>');
3182 jQuery('#project_drone_imagery_ground_control_points_next_buttons').show();
3184 drone_imagery_plot_polygon_click_type = 'save_ground_control_point';
3186 _redraw_ground_control_points_table();
3188 error: function(response){
3189 alert('Error getting image for GCP saving!')
3195 jQuery('#project_drone_imagery_ground_control_points_previous_image').click(function(){
3196 if (project_drone_imagery_ground_control_points_image_id_counter > 0) {
3197 project_drone_imagery_ground_control_points_image_id_counter = project_drone_imagery_ground_control_points_image_id_counter - 1;
3198 project_drone_imagery_ground_control_points_image_id = project_drone_imagery_ground_control_points_image_ids[project_drone_imagery_ground_control_points_image_id_counter];
3199 project_drone_imagery_ground_control_points_image_type = project_drone_imagery_ground_control_points_image_types[project_drone_imagery_ground_control_points_image_id_counter];
3201 showPlotPolygonStart(project_drone_imagery_ground_control_points_image_id, project_drone_imagery_ground_control_points_drone_run_project_id, 'project_drone_imagery_ground_control_points_canvas_div', 'project_drone_imagery_ground_control_points_info_div', 'project_drone_imagery_ground_control_points_loading_div', 0);
3202 jQuery('#project_drone_imagery_ground_control_points_image_type_div').html('<h4>'+project_drone_imagery_ground_control_points_image_type+'</h4>');
3205 alert('No previous image! Go to next image first!');
3210 jQuery('#project_drone_imagery_ground_control_points_next_image').click(function(){
3211 if (project_drone_imagery_ground_control_points_image_id_counter < project_drone_imagery_ground_control_points_image_ids.length-1) {
3212 project_drone_imagery_ground_control_points_image_id_counter = project_drone_imagery_ground_control_points_image_id_counter + 1;
3213 project_drone_imagery_ground_control_points_image_id = project_drone_imagery_ground_control_points_image_ids[project_drone_imagery_ground_control_points_image_id_counter];
3214 project_drone_imagery_ground_control_points_image_type = project_drone_imagery_ground_control_points_image_types[project_drone_imagery_ground_control_points_image_id_counter];
3216 showPlotPolygonStart(project_drone_imagery_ground_control_points_image_id, project_drone_imagery_ground_control_points_drone_run_project_id, 'project_drone_imagery_ground_control_points_canvas_div', 'project_drone_imagery_ground_control_points_info_div', 'project_drone_imagery_ground_control_points_loading_div', 0);
3217 jQuery('#project_drone_imagery_ground_control_points_image_type_div').html('<h4>'+project_drone_imagery_ground_control_points_image_type+'</h4>');
3220 alert('No next image! Go to previous image first!');
3225 function _redraw_ground_control_points_table() {
3226 var html = "<table class='table table-bordered table-hover'><thead><tr><th>Saved GCP Name</th><th>X Pos</th><th>Y Pos</th><th>Latitude</th><th>Longitude</th><th>Remove</th></thead><tbody>";
3227 for (var i=0; i<project_drone_imagery_ground_control_points_saved_array.length; i++) {
3228 html = html + "<tr><td>"+project_drone_imagery_ground_control_points_saved_array[i]['name']+"</td><td>"+project_drone_imagery_ground_control_points_saved_array[i]['x_pos']+"</td><td>"+project_drone_imagery_ground_control_points_saved_array[i]['y_pos']+"</td><td>"+project_drone_imagery_ground_control_points_saved_array[i]['latitude']+"</td><td>"+project_drone_imagery_ground_control_points_saved_array[i]['longitude']+"</td><td><p style='color:red' name='project_drone_imagery_ground_control_points_delete_one' data-name='"+project_drone_imagery_ground_control_points_saved_array[i]['name']+"' data-drone_run_project_id="+project_drone_imagery_ground_control_points_drone_run_project_id+" >X</p></td></tr>";
3230 html = html + "</tbody></table>";
3231 html = html + "<button class='btn btn-default' name='project_drone_imagery_ground_control_points_draw_points'>Draw Saved GCPs</button>";
3232 jQuery('#'+project_drone_imagery_ground_control_points_saved_div_table).html(html);
3235 jQuery(document).on('click', 'p[name="project_drone_imagery_ground_control_points_delete_one"]', function(){
3236 var drone_run_project_id = jQuery(this).data('drone_run_project_id');
3237 var name = jQuery(this).data('name');
3239 if (confirm("Remove this GCP?")) {
3242 url: '/api/drone_imagery/remove_one_gcp',
3244 'drone_run_project_id' : drone_run_project_id,
3247 success: function(response){
3248 console.log(response);
3249 if (response.error) {
3250 alert(response.error);
3252 project_drone_imagery_ground_control_points_saved = response.saved_gcps_full;
3253 project_drone_imagery_ground_control_points_saved_array = response.gcps_array;
3254 _redraw_ground_control_points_table();
3256 error: function(response){
3257 alert('Error deleting GCP name!');
3263 jQuery('#project_drone_imagery_ground_control_points_form_save').click(function(){
3264 var name = jQuery('#project_drone_imagery_ground_control_points_form_input_name').val();
3265 var longitude = jQuery('#project_drone_imagery_ground_control_points_form_input_longitude').val();
3266 var latitude = jQuery('#project_drone_imagery_ground_control_points_form_input_latitude').val();
3267 var x_pos = jQuery('#project_drone_imagery_ground_control_points_form_input_x_pos').val();
3268 var y_pos = jQuery('#project_drone_imagery_ground_control_points_form_input_y_pos').val();
3271 alert('Please give a name to the GCP!');
3274 if (x_pos == '' || y_pos == '') {
3275 alert('Please give an x and y position to the GCP!');
3281 url: '/api/drone_imagery/saving_gcp',
3283 'drone_run_project_id' : project_drone_imagery_ground_control_points_drone_run_project_id,
3287 'latitude' : latitude,
3288 'longitude' : longitude
3290 success: function(response){
3291 console.log(response);
3292 if (response.error) {
3293 alert(response.error);
3295 project_drone_imagery_ground_control_points_saved = response.saved_gcps_full;
3296 project_drone_imagery_ground_control_points_saved_array = response.gcps_array;
3298 _redraw_ground_control_points_table();
3300 for(var i=0; i<project_drone_imagery_ground_control_points_saved_array.length; i++) {
3301 drawWaypoints([{'x':project_drone_imagery_ground_control_points_saved_array[i]['x_pos'], 'y':project_drone_imagery_ground_control_points_saved_array[i]['y_pos']}], project_drone_imagery_ground_control_points_saved_array[i]['name'], 0);
3304 error: function(response){
3305 alert('Error getting image for GCP saving!')
3310 jQuery(document).on('click', 'button[name="project_drone_imagery_ground_control_points_draw_points"]', function(){
3311 for(var i=0; i<project_drone_imagery_ground_control_points_saved_array.length; i++) {
3312 drawWaypoints([{'x':project_drone_imagery_ground_control_points_saved_array[i]['x_pos'], 'y':project_drone_imagery_ground_control_points_saved_array[i]['y_pos']}], project_drone_imagery_ground_control_points_saved_array[i]['name'], 0);
3317 // Standard process on raw images
3320 var manage_drone_imagery_standard_process_raw_images_field_trial_id;
3321 var manage_drone_imagery_standard_process_raw_images_drone_run_id;
3322 var manage_drone_imagery_standard_process_raw_images_drone_run_band_id;
3323 var manage_drone_imagery_standard_process_raw_images_image_id;
3324 var manage_drone_imagery_standard_process_raw_images_stack_image_ids;
3325 var manage_drone_imagery_standard_process_raw_images_rotated_image_id;
3326 var manage_drone_imagery_standard_process_raw_images_polygon = [];
3327 var manage_drone_imagery_standard_process_raw_images_previous_polygon;
3328 var manage_drone_imagery_standard_process_raw_images_rotate_angle = 0.00;
3329 var manage_drone_imagery_standard_process_raw_images_drone_imagery_plot_polygons_new = {};
3330 var manage_drone_imagery_standard_process_raw_images_previous_polygons = [];
3331 var manage_drone_imagery_standard_process_raw_images_image_select_type = '';
3333 var dronecroppingImg;
3335 jQuery(document).on('click', 'button[name="project_drone_imagery_stadard_process_raw_images_add_images"]', function(){
3336 manage_drone_imagery_standard_process_raw_images_field_trial_id = jQuery(this).data('field_trial_id');
3337 manage_drone_imagery_standard_process_raw_images_drone_run_id = jQuery(this).data('drone_run_project_id');
3338 jQuery('#upload_drone_imagery_additional_raw_images_drone_run_id').val(manage_drone_imagery_standard_process_raw_images_drone_run_id);
3339 jQuery('#upload_drone_imagery_additional_raw_images_field_trial_id').val(manage_drone_imagery_standard_process_raw_images_field_trial_id);
3340 jQuery('#upload_drone_imagery_standard_process_additional_raw_images_dialog').modal('show');
3343 jQuery('#upload_drone_imagery_additional_raw_images_submit').click(function(){
3344 standard_process_upload_additional_raw_images();
3347 function standard_process_upload_additional_raw_images() {
3348 jQuery('#upload_drone_imagery_additional_raw_images_form').attr("action", "/api/drone_imagery/upload_drone_imagery_additional_raw_images");
3349 jQuery("#upload_drone_imagery_additional_raw_images_form").submit();
3352 jQuery('#upload_drone_imagery_additional_raw_images_form').iframePostForm({
3355 jQuery('#working_modal').modal("show");
3357 complete: function (response) {
3358 console.log(response);
3359 jQuery('#working_modal').modal("hide");
3360 if (response.error) {
3361 alert(response.error);
3369 jQuery(document).on('click', 'button[name="project_drone_imagery_standard_process_raw_images"]', function() {
3370 showManageDroneImagerySection('manage_drone_imagery_standard_process_raw_images_div');
3372 manage_drone_imagery_standard_process_raw_images_field_trial_id = jQuery(this).data('field_trial_id');
3373 manage_drone_imagery_standard_process_raw_images_drone_run_id = jQuery(this).data('drone_run_project_id');
3375 get_select_box('micasense_aligned_raw_images_grid','drone_imagery_standard_process_raw_images_image_id_select_div', {'name': 'drone_imagery_standard_process_raw_images_image_id_select', 'id': 'drone_imagery_standard_process_raw_images_image_id_select', 'empty':1, 'drone_run_project_id':manage_drone_imagery_standard_process_raw_images_drone_run_id });
3377 get_select_box('plot_polygon_templates_partial','drone_imagery_standard_process_raw_images_previous_polygons_div', {'name': 'drone_imagery_standard_process_raw_images_plot_sizes_select', 'id':'drone_imagery_standard_process_raw_images_plot_sizes_select', 'drone_run_project_id':manage_drone_imagery_standard_process_raw_images_drone_run_id, 'empty':1});
3379 get_select_box('trained_keras_mask_r_cnn_models','drone_imagery_standard_process_raw_images_retrain_mask_rcnn_models_div', {'name': 'drone_imagery_standard_process_raw_images_retrain_mask_rcnn_models_select', 'id':'drone_imagery_standard_process_raw_images_retrain_mask_rcnn_models_select' });
3382 url : '/api/drone_imagery/get_drone_run_image_counts?drone_run_id='+manage_drone_imagery_standard_process_raw_images_drone_run_id,
3383 success: function(response){
3384 console.log(response);
3385 var html = '<table class="table table-bordered table-hover" id="manage_drone_imagery_standard_process_assigned_plot_images"><thead><tr><th>Plot Name</th><th>Plot Number</th><th>Image Counts</th></thead><tbody>';
3386 for (var i=0; i<response.data.length; i++) {
3387 html = html + '<tr><td>'+response.data[i]['plot_name'] + '</td><td>' + response.data[i]['plot_number'] + '</td><td>' + response.data[i]['image_counts'] + '</td></tr>';
3389 html = html +'</tbody></table>';
3390 jQuery('#drone_imagery_standard_process_raw_images_assigned_plot_images').html(html);
3391 jQuery('#manage_drone_imagery_standard_process_assigned_plot_images').DataTable();
3393 error: function(response){
3394 alert('Error retrieving imaging event image counts!')
3399 jQuery(document).on('click', 'span[name="drone_imagery_standard_process_raw_images_image_id_select"]', function() {
3400 manage_drone_imagery_standard_process_raw_images_drone_imagery_plot_polygons_new = {};
3402 plot_polygons_generated_polygons = [];
3404 if (manage_drone_imagery_standard_process_raw_images_image_select_type == 'another_image') {
3405 var manage_drone_imagery_standard_process_raw_images_another_image_previous_polygons_string = jQuery(this).data('polygons');
3406 var manage_drone_imagery_standard_process_raw_images_another_image_id = jQuery(this).data('image_id');
3408 manage_drone_imagery_standard_process_raw_images_image_select_type = '';
3410 if (!manage_drone_imagery_standard_process_raw_images_image_id) {
3411 alert('Please select an image from the images above first!');
3416 url : '/api/drone_imagery/get_image?size=original_converted&image_id='+manage_drone_imagery_standard_process_raw_images_another_image_id,
3417 success: function(response){
3418 console.log(response);
3420 var canvas = document.getElementById('drone_imagery_standard_process_raw_images_show_another_image');
3421 ctx = canvas.getContext('2d');
3422 var image = new Image();
3423 image.onload = function () {
3424 canvas.width = this.naturalWidth;
3425 canvas.height = this.naturalHeight;
3426 ctx.drawImage(this, 0, 0);
3428 var manage_drone_imagery_standard_process_raw_images_another_image_previous_polygons = [];
3429 if (manage_drone_imagery_standard_process_raw_images_another_image_previous_polygons_string != '') {
3430 manage_drone_imagery_standard_process_raw_images_another_image_previous_polygons = JSON.parse(decodeURI(manage_drone_imagery_standard_process_raw_images_another_image_previous_polygons_string));
3432 console.log(manage_drone_imagery_standard_process_raw_images_another_image_previous_polygons);
3434 for (var i=0; i<manage_drone_imagery_standard_process_raw_images_another_image_previous_polygons.length; i++) {
3435 var previous_polygon = manage_drone_imagery_standard_process_raw_images_another_image_previous_polygons[i];
3436 console.log(previous_polygon);
3437 for (var property in previous_polygon) {
3438 if (previous_polygon.hasOwnProperty(property)) {
3439 plot_polygons_ind_4_points = previous_polygon[property];
3440 console.log(plot_polygons_ind_4_points);
3441 plot_polygons_display_points = plot_polygons_ind_4_points;
3442 if (plot_polygons_display_points.length == 4) {
3443 plot_polygons_display_points.push(plot_polygons_ind_4_points[0]);
3445 drawPolyline(plot_polygons_display_points);
3446 drawWaypoints(plot_polygons_display_points, property, 0);
3451 image.src = response.image_url;
3454 url : '/api/drone_imagery/get_image?size=original_converted&image_id='+manage_drone_imagery_standard_process_raw_images_image_id,
3455 success: function(response){
3456 console.log(response);
3458 background_image_width = response.image_width;
3459 background_image_height = response.image_height;
3461 var canvas = document.getElementById('drone_imagery_standard_process_raw_images_show');
3462 ctx = canvas.getContext('2d');
3463 var image = new Image();
3464 image.onload = function () {
3465 canvas.width = this.naturalWidth;
3466 canvas.height = this.naturalHeight;
3467 ctx.drawImage(this, 0, 0);
3469 image.src = response.image_url;
3470 dronecroppingImg = canvas;
3471 dronecroppingImg.onmousedown = GetCoordinatesCroppedImage;
3473 manage_drone_imagery_standard_process_raw_images_drone_run_band_id = response.drone_run_band_project_id;
3475 error: function(response){
3476 alert('Error retrieving image!')
3480 error: function(response){
3481 alert('Error retrieving image!')
3485 if (manage_drone_imagery_standard_process_raw_images_image_select_type == 'another_image_second') {
3486 var manage_drone_imagery_standard_process_raw_images_another_image_previous_polygons_string = jQuery(this).data('polygons');
3487 var manage_drone_imagery_standard_process_raw_images_another_image_id = jQuery(this).data('image_id');
3489 manage_drone_imagery_standard_process_raw_images_image_select_type = '';
3491 if (!manage_drone_imagery_standard_process_raw_images_image_id) {
3492 alert('Please select an image from the images above first!');
3497 url : '/api/drone_imagery/get_image?size=original_converted&image_id='+manage_drone_imagery_standard_process_raw_images_another_image_id,
3498 success: function(response){
3499 console.log(response);
3501 var canvas = document.getElementById('drone_imagery_standard_process_raw_images_show_another_image_second');
3502 ctx = canvas.getContext('2d');
3503 var image = new Image();
3504 image.onload = function () {
3505 canvas.width = this.naturalWidth;
3506 canvas.height = this.naturalHeight;
3507 ctx.drawImage(this, 0, 0);
3509 var manage_drone_imagery_standard_process_raw_images_another_image_previous_polygons = [];
3510 if (manage_drone_imagery_standard_process_raw_images_another_image_previous_polygons_string != '') {
3511 manage_drone_imagery_standard_process_raw_images_another_image_previous_polygons = JSON.parse(decodeURI(manage_drone_imagery_standard_process_raw_images_another_image_previous_polygons_string));
3513 console.log(manage_drone_imagery_standard_process_raw_images_another_image_previous_polygons);
3515 for (var i=0; i<manage_drone_imagery_standard_process_raw_images_another_image_previous_polygons.length; i++) {
3516 var previous_polygon = manage_drone_imagery_standard_process_raw_images_another_image_previous_polygons[i];
3517 console.log(previous_polygon);
3518 for (var property in previous_polygon) {
3519 if (previous_polygon.hasOwnProperty(property)) {
3520 plot_polygons_ind_4_points = previous_polygon[property];
3521 console.log(plot_polygons_ind_4_points);
3522 plot_polygons_display_points = plot_polygons_ind_4_points;
3523 if (plot_polygons_display_points.length == 4) {
3524 plot_polygons_display_points.push(plot_polygons_ind_4_points[0]);
3526 drawPolyline(plot_polygons_display_points);
3527 drawWaypoints(plot_polygons_display_points, property, 0);
3532 image.src = response.image_url;
3535 url : '/api/drone_imagery/get_image?size=original_converted&image_id='+manage_drone_imagery_standard_process_raw_images_image_id,
3536 success: function(response){
3537 console.log(response);
3539 background_image_width = response.image_width;
3540 background_image_height = response.image_height;
3542 var canvas = document.getElementById('drone_imagery_standard_process_raw_images_show');
3543 ctx = canvas.getContext('2d');
3544 var image = new Image();
3545 image.onload = function () {
3546 canvas.width = this.naturalWidth;
3547 canvas.height = this.naturalHeight;
3548 ctx.drawImage(this, 0, 0);
3550 image.src = response.image_url;
3551 dronecroppingImg = canvas;
3552 dronecroppingImg.onmousedown = GetCoordinatesCroppedImage;
3554 manage_drone_imagery_standard_process_raw_images_drone_run_band_id = response.drone_run_band_project_id;
3556 error: function(response){
3557 alert('Error retrieving image!')
3561 error: function(response){
3562 alert('Error retrieving image!')
3567 manage_drone_imagery_standard_process_raw_images_image_id = jQuery(this).data('image_id');
3568 manage_drone_imagery_standard_process_raw_images_rotated_image_id = jQuery(this).data('image_id');
3569 manage_drone_imagery_standard_process_raw_images_stack_image_ids = jQuery(this).data('image_ids');
3570 var manage_drone_imagery_standard_process_raw_images_previous_polygons_string = jQuery(this).data('polygons');
3571 if (manage_drone_imagery_standard_process_raw_images_previous_polygons_string != '') {
3572 manage_drone_imagery_standard_process_raw_images_previous_polygons = JSON.parse(decodeURI(manage_drone_imagery_standard_process_raw_images_previous_polygons_string));
3574 console.log(manage_drone_imagery_standard_process_raw_images_previous_polygons);
3577 url : '/api/drone_imagery/get_image?size=original_converted&image_id='+manage_drone_imagery_standard_process_raw_images_image_id,
3578 success: function(response){
3579 console.log(response);
3581 background_image_width = response.image_width;
3582 background_image_height = response.image_height;
3584 var canvas = document.getElementById('drone_imagery_standard_process_raw_images_show');
3585 ctx = canvas.getContext('2d');
3586 var image = new Image();
3587 image.onload = function () {
3588 canvas.width = this.naturalWidth;
3589 canvas.height = this.naturalHeight;
3590 ctx.drawImage(this, 0, 0);
3592 image.src = response.image_url;
3593 dronecroppingImg = canvas;
3594 dronecroppingImg.onmousedown = GetCoordinatesCroppedImage;
3596 manage_drone_imagery_standard_process_raw_images_drone_run_band_id = response.drone_run_band_project_id;
3598 error: function(response){
3599 alert('Error retrieving image!')
3605 jQuery('#drone_imagery_standard_process_raw_images_draw_polygons').click(function(){
3606 var manage_drone_imagery_standard_process_raw_images_num_rows = jQuery('#drone_imagery_standard_process_raw_images_number_rows').val();
3607 var manage_drone_imagery_standard_process_raw_images_num_columns = jQuery('#drone_imagery_standard_process_raw_images_number_columns').val();
3609 if (manage_drone_imagery_standard_process_raw_images_num_rows == '') {
3610 alert('Please give the number of rows in the area of interest!');
3613 if (manage_drone_imagery_standard_process_raw_images_num_columns == '') {
3614 alert('Please give the number of columns in the area of interest!');
3618 if (crop_points.length < 4) {
3619 alert('Please select an area of interest on the image first by clicking the four corner points.');
3623 plot_polygons_num_rows_generated = parseInt(manage_drone_imagery_standard_process_raw_images_num_rows);
3624 plot_polygons_num_cols_generated = parseInt(manage_drone_imagery_standard_process_raw_images_num_columns);
3626 var section_width = background_image_width;
3627 var section_height = background_image_height;
3628 var section_top_row_left_offset = parseInt(crop_points[0]['x']);
3629 var section_bottom_row_left_offset = parseInt(crop_points[3]['x']);
3630 var section_left_column_top_offset = parseInt(crop_points[0]['y']);
3631 var section_left_column_bottom_offset = parseInt(background_image_height - crop_points[3]['y']);
3632 var section_top_row_right_offset = parseInt(background_image_width - crop_points[1]['x']);
3633 var section_right_column_bottom_offset = parseInt(background_image_height - crop_points[2]['y']);
3635 var total_gradual_left_shift = section_bottom_row_left_offset - section_top_row_left_offset;
3636 var col_left_shift_increment = total_gradual_left_shift / plot_polygons_num_rows_generated;
3638 var total_gradual_vertical_shift = section_right_column_bottom_offset - section_left_column_bottom_offset;
3639 var col_vertical_shift_increment = total_gradual_vertical_shift / plot_polygons_num_cols_generated;
3641 var col_width = (section_width - section_top_row_left_offset - section_top_row_right_offset) / plot_polygons_num_cols_generated;
3642 var row_height = (section_height - section_left_column_top_offset - section_left_column_bottom_offset) / plot_polygons_num_rows_generated;
3644 var x_pos = section_top_row_left_offset;
3645 var y_pos = section_left_column_top_offset;
3648 for (var i=0; i<plot_polygons_num_rows_generated; i++) {
3649 for (var j=0; j<plot_polygons_num_cols_generated; j++) {
3650 var x_pos_val = x_pos;
3651 var y_pos_val = y_pos;
3652 plot_polygons_generated_polygons.push([
3653 {x:x_pos_val, y:y_pos_val},
3654 {x:x_pos_val + col_width, y:y_pos_val},
3655 {x:x_pos_val + col_width, y:y_pos_val + row_height},
3656 {x:x_pos_val, y:y_pos_val + row_height}
3658 x_pos = x_pos + col_width;
3659 y_pos = y_pos - col_vertical_shift_increment;
3661 x_pos = section_top_row_left_offset + (row_num * col_left_shift_increment);
3662 y_pos = y_pos + row_height + total_gradual_vertical_shift;
3663 row_num = row_num + 1;
3665 console.log(plot_polygons_generated_polygons);
3667 plot_polygons_total_height_generated = row_height * plot_polygons_num_rows_generated;
3668 plot_polygons_number_generated = plot_polygons_generated_polygons.length;
3670 manage_drone_imagery_standard_process_raw_images_drone_imagery_plot_polygons_new = {};
3671 var drone_imagery_plot_polygons_display_new = {};
3673 for (var i=0; i<plot_polygons_generated_polygons.length; i++) {
3674 plot_polygons_ind_4_points = plot_polygons_generated_polygons[i];
3675 plot_polygons_display_points = plot_polygons_ind_4_points;
3676 if (plot_polygons_display_points.length == 4) {
3677 plot_polygons_display_points.push(plot_polygons_ind_4_points[0]);
3679 drawPolyline(plot_polygons_display_points);
3680 drawWaypoints(plot_polygons_display_points, i, 0);
3681 drone_imagery_plot_generated_polygons[i] = plot_polygons_ind_4_points;
3682 manage_drone_imagery_standard_process_raw_images_drone_imagery_plot_polygons_new[i] = plot_polygons_ind_4_points;
3683 drone_imagery_plot_polygons_display[i] = plot_polygons_display_points;
3684 drone_imagery_plot_polygons_display_new[i] = plot_polygons_display_points;
3687 plot_polygons_template_dimensions.push({
3688 'num_rows':plot_polygons_num_rows_generated,
3689 'num_cols':plot_polygons_num_cols_generated,
3690 'total_plot_polygons':plot_polygons_num_rows_generated*plot_polygons_num_cols_generated,
3691 'plot_polygons':manage_drone_imagery_standard_process_raw_images_drone_imagery_plot_polygons_new,
3692 'plot_polygons_display':drone_imagery_plot_polygons_display_new
3694 console.log(plot_polygons_template_dimensions);
3696 var table_html = '<table class="table table-bordered table-hover"><thead><tr><th>Generated Index</th><th>Plot Number</th></tr></thead><tbody>';
3697 for (var gen_index in manage_drone_imagery_standard_process_raw_images_drone_imagery_plot_polygons_new) {
3698 if (manage_drone_imagery_standard_process_raw_images_drone_imagery_plot_polygons_new.hasOwnProperty(gen_index)) {
3699 table_html = table_html + '<tr><td>'+gen_index+'</td><td><input type="text" class="form-control" placeholder="e.g. 1001" name="manage_drone_imagery_standard_process_raw_images_given_plot_number" data-generated_index="'+gen_index+'"></td></tr>';
3702 table_html = table_html + '</tbody></table>';
3704 jQuery('#drone_imagery_standard_process_raw_images_polygon_assign_table').html(table_html);
3707 jQuery('#drone_imagery_standard_process_raw_images_assign_plot').click(function(){
3709 var manage_drone_imagery_standard_process_raw_images_partial_template_name = jQuery('#drone_imagery_standard_process_raw_images_partial_template_name').val();
3710 if (manage_drone_imagery_standard_process_raw_images_partial_template_name == '') {
3711 alert('Please give a partial template name');
3714 var manage_drone_imagery_standard_process_raw_images_given_plot_numbers = {};
3715 jQuery('input[name="manage_drone_imagery_standard_process_raw_images_given_plot_number"]').each(function() {
3716 if (jQuery(this).val() != '') {
3717 manage_drone_imagery_standard_process_raw_images_given_plot_numbers[jQuery(this).data('generated_index')] = jQuery(this).val();
3720 if (Object.keys(manage_drone_imagery_standard_process_raw_images_given_plot_numbers).length < 1) {
3721 alert('Please give the plot numbers corresponding to the generated index numbers of the plot polygons!');
3726 url : '/api/drone_imagery/manual_assign_plot_polygon_save_partial_template',
3729 'field_trial_id':manage_drone_imagery_standard_process_raw_images_field_trial_id,
3730 'drone_run_project_id':manage_drone_imagery_standard_process_raw_images_drone_run_id,
3731 'image_ids':manage_drone_imagery_standard_process_raw_images_stack_image_ids,
3732 'polygon':JSON.stringify(manage_drone_imagery_standard_process_raw_images_drone_imagery_plot_polygons_new),
3733 'polygon_plot_numbers':JSON.stringify(manage_drone_imagery_standard_process_raw_images_given_plot_numbers),
3734 'angle_rotated':manage_drone_imagery_standard_process_raw_images_rotate_angle,
3735 'partial_template_name':manage_drone_imagery_standard_process_raw_images_partial_template_name
3737 success: function(response){
3738 console.log(response);
3739 if (response.error) {
3740 alert(response.error);
3741 } else if (response.warning) {
3742 alert(response.warning);
3744 get_select_box('plot_polygon_templates_partial','drone_imagery_standard_process_raw_images_previous_polygons_div', {'name': 'drone_imagery_standard_process_raw_images_plot_sizes_select', 'id':'drone_imagery_standard_process_raw_images_plot_sizes_select', 'drone_run_project_id':manage_drone_imagery_standard_process_raw_images_drone_run_id, 'empty':1});
3746 get_select_box('micasense_aligned_raw_images_grid','drone_imagery_standard_process_raw_images_image_id_select_div', {'name': 'drone_imagery_standard_process_raw_images_image_id_select', 'id': 'drone_imagery_standard_process_raw_images_image_id_select', 'empty':1, 'drone_run_project_id':manage_drone_imagery_standard_process_raw_images_drone_run_id });
3749 url : '/api/drone_imagery/get_drone_run_image_counts?drone_run_id='+manage_drone_imagery_standard_process_raw_images_drone_run_id,
3750 success: function(response){
3751 console.log(response);
3752 var html = '<table class="table table-bordered table-hover" id="manage_drone_imagery_standard_process_assigned_plot_images"><thead><tr><th>Plot Name</th><th>Plot Number</th><th>Image Counts</th></thead><tbody>';
3753 for (var i=0; i<response.data.length; i++) {
3754 html = html + '<tr><td>'+response.data[i]['plot_name'] + '</td><td>' + response.data[i]['plot_number'] + '</td><td>' + response.data[i]['image_counts'] + '</td></tr>';
3756 html = html +'</tbody></table>';
3757 jQuery('#drone_imagery_standard_process_raw_images_assigned_plot_images').html(html);
3758 jQuery('#manage_drone_imagery_standard_process_assigned_plot_images').DataTable();
3760 error: function(response){
3761 alert('Error retrieving imaging event image counts!')
3765 //alert('Plot-images saved!');
3768 error: function(response){
3769 alert('Error saving partial template!')
3774 url : '/api/drone_imagery/manual_assign_plot_polygon',
3777 'field_trial_id':manage_drone_imagery_standard_process_raw_images_field_trial_id,
3778 'drone_run_project_id':manage_drone_imagery_standard_process_raw_images_drone_run_id,
3779 'image_ids':manage_drone_imagery_standard_process_raw_images_stack_image_ids,
3780 'polygon':JSON.stringify(manage_drone_imagery_standard_process_raw_images_drone_imagery_plot_polygons_new),
3781 'polygon_plot_numbers':JSON.stringify(manage_drone_imagery_standard_process_raw_images_given_plot_numbers),
3782 'angle_rotated':manage_drone_imagery_standard_process_raw_images_rotate_angle,
3783 'partial_template_name':manage_drone_imagery_standard_process_raw_images_partial_template_name
3785 success: function(response){
3786 console.log(response);
3787 if (response.error) {
3788 alert(response.error);
3789 } else if (response.warning) {
3790 alert(response.warning);
3792 //alert('Plot-images saved!');
3795 error: function(response){
3796 alert('Error cropping and saving plot images!')
3802 jQuery('#drone_imagery_standard_process_raw_images_rotate_image').click(function(){
3803 var rotate_stitched_image_degrees = parseFloat(jQuery('#drone_imagery_standard_process_raw_images_rotate_degrees_input').val());
3804 applyShowRotateImage(manage_drone_imagery_standard_process_raw_images_image_id, manage_drone_imagery_standard_process_raw_images_drone_run_band_id, rotate_stitched_image_degrees, 'drone_imagery_standard_process_raw_images_show');
3805 manage_drone_imagery_standard_process_raw_images_rotate_angle = rotate_stitched_image_degrees;
3808 jQuery('#drone_imagery_standard_process_raw_images_clear_polygon').click(function(){
3810 manage_drone_imagery_standard_process_raw_images_drone_imagery_plot_polygons_new = {};
3811 plot_polygons_generated_polygons = [];
3814 url : '/api/drone_imagery/get_image?size=original_converted&image_id='+manage_drone_imagery_standard_process_raw_images_image_id,
3815 success: function(response){
3816 console.log(response);
3818 var canvas = document.getElementById('drone_imagery_standard_process_raw_images_show');
3819 ctx = canvas.getContext('2d');
3820 var image = new Image();
3821 image.onload = function () {
3822 canvas.width = this.naturalWidth;
3823 canvas.height = this.naturalHeight;
3824 ctx.drawImage(this, 0, 0);
3826 image.src = response.image_url;
3827 dronecroppingImg = canvas;
3828 dronecroppingImg.onmousedown = GetCoordinatesCroppedImage;
3830 error: function(response){
3831 alert('Error retrieving image!')
3836 jQuery('#drone_imagery_standard_process_raw_images_save_polygon').click(function() {
3837 if (crop_points.length != 4) {
3838 alert('Click the four corners of the plot in the image first!');
3842 manage_drone_imagery_standard_process_raw_images_polygon = crop_points;
3846 jQuery('#drone_imagery_standard_process_raw_images_paste_polygon').click(function(){
3847 if (manage_drone_imagery_standard_process_raw_images_polygon.length != 4) {
3848 alert('First save a plot-polygon!');
3852 drone_imagery_standard_process_plot_polygon_click_type = 'standard_process_raw_images_paste_polygon';
3853 alert('Now click a point on the image where to paste the top-left corner of the saved polygon.');
3857 jQuery('#drone_imagery_standard_process_raw_images_paste_previous_polygon').click(function(){
3858 manage_drone_imagery_standard_process_raw_images_previous_polygon = jQuery('#drone_imagery_standard_process_raw_images_plot_sizes_select').val();
3859 console.log(manage_drone_imagery_standard_process_raw_images_previous_polygon);
3860 if (manage_drone_imagery_standard_process_raw_images_previous_polygon == '') {
3861 alert('To do this first select a previously used polygon, if there exists one!');
3864 drone_imagery_standard_process_plot_polygon_click_type = 'standard_process_raw_images_paste_previous_polygon';
3865 alert('Now click a point on the image where to paste the top-left corner of the saved polygon.');
3872 var drone_imagery_standard_process_raw_images_retrain_mask_rcnn_model_name = '';
3873 var drone_imagery_standard_process_raw_images_retrain_mask_rcnn_model_desc = '';
3874 var drone_imagery_standard_process_raw_images_retrain_mask_rcnn_model_type = '';
3875 var drone_imagery_standard_process_raw_images_retrain_mask_rcnn_model_id = '';
3877 jQuery('#drone_imagery_standard_process_raw_images_retrain_mask_rcnn_modal_button').click(function(){
3878 jQuery('#drone_imagery_standard_process_raw_images_retrain_mask_rcnn_modal').modal('show');
3882 jQuery('#drone_imagery_standard_process_raw_images_retrain_mask_rcnn').click(function(){
3883 drone_imagery_standard_process_raw_images_retrain_mask_rcnn_model_name = jQuery('#drone_imagery_standard_process_raw_images_retrain_mask_rcnn_model_name').val();
3884 drone_imagery_standard_process_raw_images_retrain_mask_rcnn_model_desc = jQuery('#drone_imagery_standard_process_raw_images_retrain_mask_rcnn_model_desc').val();
3885 drone_imagery_standard_process_raw_images_retrain_mask_rcnn_model_type = jQuery('#drone_imagery_standard_process_raw_images_retrain_mask_rcnn_models_select').val();
3887 if (drone_imagery_standard_process_raw_images_retrain_mask_rcnn_model_name == '' || drone_imagery_standard_process_raw_images_retrain_mask_rcnn_model_desc == '') {
3888 alert('Please give a model name and description');
3894 url: '/api/drone_imagery/retrain_mask_rcnn?model_name='+drone_imagery_standard_process_raw_images_retrain_mask_rcnn_model_name+'&model_description='+drone_imagery_standard_process_raw_images_retrain_mask_rcnn_model_desc+'&model_type='+drone_imagery_standard_process_raw_images_retrain_mask_rcnn_model_type,
3896 beforeSend: function() {
3897 jQuery('#working_modal').modal('show');
3899 success: function(response){
3900 jQuery('#working_modal').modal('hide');
3901 console.log(response);
3902 if (response.error) {
3903 alert(response.error);
3906 error: function(response){
3907 jQuery('#working_modal').modal('hide');
3908 alert('Error training mask rcnn!');
3914 jQuery('#drone_imagery_standard_process_raw_images_retrain_mask_rcnn_predict_button').click(function(){
3915 drone_imagery_standard_process_raw_images_retrain_mask_rcnn_model_id = jQuery('#drone_imagery_standard_process_raw_images_retrain_mask_rcnn_models_select').val();
3919 url: '/api/drone_imagery/predict_mask_rcnn?model_id='+drone_imagery_standard_process_raw_images_retrain_mask_rcnn_model_id+'&image_id='+manage_drone_imagery_standard_process_raw_images_image_id,
3921 beforeSend: function() {
3922 jQuery('#working_modal').modal('show');
3924 success: function(response){
3925 jQuery('#working_modal').modal('hide');
3926 console.log(response);
3927 if (response.error) {
3928 alert(response.error);
3931 error: function(response){
3932 jQuery('#working_modal').modal('hide');
3933 alert('Error predicting mask rcnn!');
3938 jQuery('#drone_imagery_standard_process_raw_images_paste_previous_polygon_in_place').click(function(){
3939 for (var i=0; i<manage_drone_imagery_standard_process_raw_images_previous_polygons.length; i++) {
3940 var previous_polygon = manage_drone_imagery_standard_process_raw_images_previous_polygons[i];
3941 for (var property in previous_polygon) {
3942 if (previous_polygon.hasOwnProperty(property)) {
3943 plot_polygons_ind_4_points = previous_polygon[property];
3944 plot_polygons_display_points = plot_polygons_ind_4_points;
3945 if (plot_polygons_display_points.length == 4) {
3946 plot_polygons_display_points.push(plot_polygons_ind_4_points[0]);
3948 drawPolyline(plot_polygons_display_points);
3949 drawWaypoints(plot_polygons_display_points, property, 0);
3955 jQuery('#drone_imagery_standard_process_raw_images_paste_previous_polygon_view_image').click(function(){
3956 manage_drone_imagery_standard_process_raw_images_image_select_type = 'another_image';
3957 alert('Now choose the image from the grid above');
3960 jQuery('#drone_imagery_standard_process_raw_images_paste_previous_polygon_view_image_second').click(function(){
3961 manage_drone_imagery_standard_process_raw_images_image_select_type = 'another_image_second';
3962 alert('Now choose the image from the grid above');
3966 // Phenotype calc buttons
3969 jQuery(document).on('click', 'button[name="project_drone_imagery_phenotype_run"]', function(){
3970 manage_drone_imagery_standard_process_drone_run_project_id = jQuery(this).data('drone_run_project_id');
3974 url: '/api/drone_imagery/get_weeks_after_planting_date?drone_run_project_id='+manage_drone_imagery_standard_process_drone_run_project_id,
3976 beforeSend: function (){
3977 jQuery('#working_modal').modal('show');
3979 success: function(response){
3980 jQuery('#working_modal').modal('hide');
3981 console.log(response);
3982 if (response.error) {
3983 alert(response.error);
3986 var html = "<center><b>Field Trial Planting Date</b>: "+response.planting_date+"<br/><b>Imaging Event Date</b>: "+response.drone_run_date+"<br/><b>Number of Weeks</b>: "+response.rounded_time_difference_weeks+"<br/><b>Number of Weeks Ontology Term</b>: "+response.time_ontology_week_term+"<br/><b>Number of Days</b>:"+response.time_difference_days+"<br/><b>Number of Days Ontology Term</b>: "+response.time_ontology_day_term+"<br/><br/></center>";
3987 jQuery('#drone_imagery_week_term_div').html(html);
3989 manage_drone_imagery_standard_process_phenotype_time = response.time_ontology_day_cvterm_id;
3991 error: function(response){
3992 alert('Error getting time terms!');
3993 jQuery('#working_modal').modal('hide');
3997 jQuery('#drone_imagery_calc_phenotypes_trial_dialog').modal('show');
4000 jQuery('#drone_imagery_calculate_phenotypes_zonal_stats_trial_select').click(function(){
4001 if (manage_drone_imagery_standard_process_phenotype_time == '') {
4002 alert('Time of phenotype not set! This should not happen so please contact us!');
4006 alert("Phenotype generation will occur in the background. You can check the indicator on this page by refreshing the page.");
4010 url: '/api/drone_imagery/generate_phenotypes?drone_run_project_id='+manage_drone_imagery_standard_process_drone_run_project_id+'&time_cvterm_id='+manage_drone_imagery_standard_process_phenotype_time+'&standard_process_type='+jQuery('#drone_imagery_generate_phenotypes_process_type').val(),
4012 success: function(response){
4013 console.log(response);
4014 if (response.error) {
4015 alert(response.error);
4017 if (response.success) {
4018 alert('Drone image phenotypes stored!');
4021 error: function(response){
4022 alert('Error generating drone image phenotypes!');
4030 // Minimal VI Standard Process ()
4033 var manage_drone_imagery_standard_process_minimal_vi_drone_run_project_id;
4034 var manage_drone_imagery_standard_process_minimal_vi_phenotype_time = '';
4036 jQuery(document).on('click', 'button[name=project_drone_imagery_standard_process_minimal_vi]', function(){
4037 manage_drone_imagery_standard_process_minimal_vi_drone_run_project_id = jQuery(this).data('drone_run_project_id');
4041 url: '/api/drone_imagery/get_weeks_after_planting_date?drone_run_project_id='+manage_drone_imagery_standard_process_minimal_vi_drone_run_project_id,
4043 beforeSend: function (){
4044 jQuery('#working_modal').modal('show');
4046 success: function(response){
4047 jQuery('#working_modal').modal('hide');
4048 console.log(response);
4049 if (response.error) {
4050 alert(response.error);
4053 var html = "<center><b>Field Trial Planting Date</b>: "+response.planting_date+"<br/><b>Imaging Event Date</b>: "+response.drone_run_date+"<br/><b>Number of Weeks</b>: "+response.rounded_time_difference_weeks+"<br/><b>Number of Weeks Ontology Term</b>: "+response.time_ontology_week_term+"<br/><b>Number of Days</b>:"+response.time_difference_days+"<br/><b>Number of Days Ontology Term</b>: "+response.time_ontology_day_term+"<br/><br/></center>";
4054 jQuery('#drone_imagery_minimal_vi_standard_process_week_term_div').html(html);
4055 manage_drone_imagery_standard_process_minimal_vi_phenotype_time = response.time_ontology_day_cvterm_id;
4057 error: function(response){
4058 alert('Error getting time terms!');
4059 jQuery('#working_modal').modal('hide');
4063 jQuery('#drone_imagery_minimal_vi_standard_process_dialog').modal('show');
4066 jQuery('#drone_imagery_minimal_vi_standard_process_select').click(function() {
4067 if (manage_drone_imagery_standard_process_minimal_vi_phenotype_time == '') {
4068 alert('Time of phenotype not set for minimal vi process! This should not happen so please contact us');
4072 alert("Minimal vegetative index standard process will occur in the background. You can check the indicator on this page by refreshing the page.");
4076 url: '/api/drone_imagery/standard_process_minimal_vi_apply?drone_run_project_id='+manage_drone_imagery_standard_process_minimal_vi_drone_run_project_id,
4078 success: function(response){
4079 console.log(response);
4080 if (response.error) {
4081 alert(response.error);
4083 alert('Minimal vegetative index standard process complete! Phenotype generation may still be occurring.');
4087 error: function(response){
4088 alert('Error running minimal vegetative index standard process!');
4094 url: '/api/drone_imagery/generate_phenotypes?drone_run_project_id='+manage_drone_imagery_standard_process_minimal_vi_drone_run_project_id+'&time_cvterm_id='+manage_drone_imagery_standard_process_minimal_vi_phenotype_time+'&standard_process_type=minimal_vi',
4096 success: function(response){
4097 console.log(response);
4098 if (response.error) {
4099 alert(response.error);
4101 if (response.success) {
4102 alert('Drone image phenotypes stored for minimal vegetative index standard process!');
4105 error: function(response){
4106 alert('Error generating drone image phenotypes for minial vegetative index standard process!');
4114 // Extended Standard Process
4117 var manage_drone_imagery_standard_process_extended_drone_run_project_id;
4118 var manage_drone_imagery_standard_process_extended_phenotype_time = '';
4120 jQuery(document).on('click', 'button[name="project_drone_imagery_standard_process_extended"]', function() {
4121 manage_drone_imagery_standard_process_extended_drone_run_project_id = jQuery(this).data('drone_run_project_id');
4124 url: '/api/drone_imagery/get_weeks_after_planting_date?drone_run_project_id='+manage_drone_imagery_standard_process_extended_drone_run_project_id,
4126 beforeSend: function (){
4127 jQuery('#working_modal').modal('show');
4129 success: function(response){
4130 jQuery('#working_modal').modal('hide');
4131 console.log(response);
4132 if (response.error) {
4133 alert(response.error);
4136 var html = "<center><b>Field Trial Planting Date</b>: "+response.planting_date+"<br/><b>Imaging Event Date</b>: "+response.drone_run_date+"<br/><b>Number of Weeks</b>: "+response.rounded_time_difference_weeks+"<br/><b>Number of Weeks Ontology Term</b>: "+response.time_ontology_week_term+"<br/><b>Number of Days</b>:"+response.time_difference_days+"<br/><b>Number of Days Ontology Term</b>: "+response.time_ontology_day_term+"<br/><br/></center>";
4137 jQuery('#drone_imagery_extended_standard_process_week_term_div').html(html);
4138 manage_drone_imagery_standard_process_extended_phenotype_time = response.time_ontology_day_cvterm_id;
4140 error: function(response){
4141 alert('Error getting time terms!');
4142 jQuery('#working_modal').modal('hide');
4145 jQuery('#drone_imagery_extended_standard_process_dialog').modal('show');
4148 jQuery('#drone_imagery_extended_standard_process_select').click(function(){
4149 if (manage_drone_imagery_standard_process_extended_phenotype_time == '') {
4150 alert('Time of phenotype not set for extended standard process! This should not happen so please contact us!');
4154 alert("Extended standard process will occur in the background. You can check the indicator on this page by refreshing the page.");
4158 url: '/api/drone_imagery/standard_process_extended_apply?drone_run_project_id='+manage_drone_imagery_standard_process_extended_drone_run_project_id+'&time_days_cvterm_id='+manage_drone_imagery_standard_process_extended_phenotype_time+'&standard_process_type=extended',
4160 success: function(response){
4161 console.log(response);
4162 if (response.error) {
4163 alert(response.error);
4166 error: function(response){
4167 alert('Error running extended standard process!');
4175 // Download Phenotypes
4178 var manage_drone_imagery_download_phenotypes_field_trial_id = undefined;
4179 var manage_drone_imagery_download_phenotypes_trait_ids = [];
4181 jQuery('#download_phenotypes_drone_imagery_link').click(function(){
4182 jQuery('#drone_imagery_download_phenotypes_dialog').modal('show');
4183 get_select_box('trials', 'drone_imagery_download_phenotypes_trial_select_div', { 'name' : 'drone_imagery_download_phenotypes_field_trial_id', 'id' : 'drone_imagery_download_phenotypes_field_trial_id', 'empty':1, 'multiple':0 });
4185 manage_drone_imagery_download_phenotypes_field_trial_id = undefined;
4186 manage_drone_imagery_download_phenotypes_trait_ids = [];
4189 jQuery('#drone_imagery_download_phenotypes_field_trial_select_step').click(function(){
4190 manage_drone_imagery_download_phenotypes_field_trial_id = jQuery('#drone_imagery_download_phenotypes_field_trial_id').val();
4191 if (manage_drone_imagery_download_phenotypes_field_trial_id == '') {
4192 alert('Please select a field trial first!');
4194 get_select_box('traits', 'drone_imagery_download_phenotypes_trait_select_div', { 'name' : 'drone_imagery_download_phenotypes_trait_id_select', 'id' : 'drone_imagery_download_phenotypes_trait_id_select', 'empty':0, 'multiple':1, 'size': 20, 'trial_ids':manage_drone_imagery_download_phenotypes_field_trial_id, 'stock_type':'plot' });
4196 Workflow.complete("#drone_imagery_download_phenotypes_field_trial_select_step");
4197 Workflow.focus('#drone_imagery_download_phenotypes_workflow', 1);
4202 jQuery('#drone_imagery_download_phenotypes_trait_select_step').click(function(){
4203 manage_drone_imagery_download_phenotypes_trait_ids = jQuery('#drone_imagery_download_phenotypes_trait_id_select').val();
4204 if (manage_drone_imagery_download_phenotypes_trait_ids == null || manage_drone_imagery_download_phenotypes_trait_ids == undefined) {
4205 alert('Please select at least one observation variable!');
4208 if (manage_drone_imagery_download_phenotypes_trait_ids.length < 1){
4209 alert('Please select at least one observation variable!');
4211 Workflow.complete("#drone_imagery_download_phenotypes_trait_select_step");
4212 Workflow.focus('#drone_imagery_download_phenotypes_workflow', 2);
4217 jQuery('#drone_imagery_download_phenotypes_confirm_step').click(function() {
4220 url: '/api/drone_imagery/analysis_query',
4223 'observation_variable_id_list':JSON.stringify(manage_drone_imagery_download_phenotypes_trait_ids),
4224 'field_trial_id_list':JSON.stringify([manage_drone_imagery_download_phenotypes_field_trial_id]),
4227 beforeSend: function (){
4228 jQuery('#working_modal').modal('show');
4230 success: function(response){
4231 jQuery('#working_modal').modal('hide');
4232 console.log(response);
4233 if(response.error) {
4234 alert(response.error);
4236 jQuery('#drone_imagery_download_phenotypes_file_div').html('Download File: <a href="'+response.file+'">'+response.file+'</a>');
4238 error: function(response){
4239 alert('Error downloading drone image phenotypes!');
4240 jQuery('#working_modal').modal('hide');
4246 // Growing Degree Days Calculation
4249 var manage_drone_imagery_calculate_gdd_field_trial_id;
4250 var manage_drone_imagery_calculate_gdd_drone_run_project_id;
4251 var manage_drone_imagery_calculate_gdd_phenotype_time;
4253 jQuery(document).on('click', 'button[name=drone_imagery_drone_run_calculate_gdd]', function() {
4254 manage_drone_imagery_calculate_gdd_field_trial_id = jQuery(this).data('field_trial_id');
4255 manage_drone_imagery_calculate_gdd_drone_run_project_id = jQuery(this).data('drone_run_project_id');
4258 url : '/api/drone_imagery/get_weeks_after_planting_date?drone_run_project_id='+manage_drone_imagery_calculate_gdd_drone_run_project_id,
4259 success: function(response){
4260 console.log(response);
4261 var html = "<center><b>Field Trial Planting Date</b>: "+response.planting_date+"<br/><b>Imaging Event Date</b>: "+response.drone_run_date+"<br/><b>Number of Weeks</b>: "+response.rounded_time_difference_weeks+"<br/><b>Number of Weeks Ontology Term</b>: "+response.time_ontology_week_term+"<br/><b>Number of Days</b>:"+response.time_difference_days+"<br/><b>Number of Days Ontology Term</b>: "+response.time_ontology_day_term+"<br/><br/></center>";
4262 jQuery('#drone_imagery_calculate_gdd_time_div').html(html);
4263 manage_drone_imagery_calculate_gdd_phenotype_time = response.time_ontology_day_cvterm_id;
4265 jQuery('#drone_imagery_calculate_gdd_dialog').modal('show');
4267 error: function(response){
4268 alert('Error getting gdd!')
4273 jQuery('#drone_imagery_upload_gdd_submit').click(function(){
4274 var manage_drone_imagery_calculate_gdd_base_temp = jQuery('#drone_imagery_calculate_gdd_base_temperature_input').val();
4275 var manage_drone_imagery_calculate_gdd_formula = jQuery('#drone_imagery_calculate_gdd_formula_input').val();
4277 url : '/api/drone_imagery/growing_degree_days?drone_run_project_id='+manage_drone_imagery_calculate_gdd_drone_run_project_id+'&formula='+manage_drone_imagery_calculate_gdd_formula+'&gdd_base_temperature='+manage_drone_imagery_calculate_gdd_base_temp+'&field_trial_id='+manage_drone_imagery_calculate_gdd_field_trial_id,
4278 beforeSend: function(){
4279 jQuery('#working_modal').modal('show');
4281 success: function(response){
4282 console.log(response);
4283 jQuery('#working_modal').modal('hide');
4286 error: function(response){
4287 jQuery('#working_modal').modal('hide');
4288 alert('Error calculating growing degree days!');
4294 // Precipitation Sum Calculation
4297 var manage_drone_imagery_calculate_precipitation_field_trial_id;
4298 var manage_drone_imagery_calculate_precipitation_drone_run_project_id;
4299 var manage_drone_imagery_calculate_precipitation_phenotype_time;
4301 jQuery(document).on('click', 'button[name=drone_imagery_drone_run_calculate_precipitation_sum]', function() {
4302 manage_drone_imagery_calculate_precipitation_field_trial_id = jQuery(this).data('field_trial_id');
4303 manage_drone_imagery_calculate_precipitation_drone_run_project_id = jQuery(this).data('drone_run_project_id');
4306 url : '/api/drone_imagery/get_weeks_after_planting_date?drone_run_project_id='+manage_drone_imagery_calculate_precipitation_drone_run_project_id,
4307 success: function(response){
4308 console.log(response);
4309 var html = "<center><b>Field Trial Planting Date</b>: "+response.planting_date+"<br/><b>Imaging Event Date</b>: "+response.drone_run_date+"<br/><b>Number of Weeks</b>: "+response.rounded_time_difference_weeks+"<br/><b>Number of Weeks Ontology Term</b>: "+response.time_ontology_week_term+"<br/><b>Number of Days</b>:"+response.time_difference_days+"<br/><b>Number of Days Ontology Term</b>: "+response.time_ontology_day_term+"<br/><br/></center>";
4310 jQuery('#drone_imagery_calculate_precipitation_time_div').html(html);
4311 manage_drone_imagery_calculate_precipitation_phenotype_time = response.time_ontology_day_cvterm_id;
4313 jQuery('#drone_imagery_calculate_precipitation_dialog').modal('show');
4315 error: function(response){
4316 alert('Error getting gdd!')
4321 jQuery('#drone_imagery_upload_precipitation_sum_submit').click(function(){
4322 var manage_drone_imagery_calculate_precipitation_sum_formula = jQuery('#drone_imagery_calculate_precipitation_sum_formula_input').val();
4324 url : '/api/drone_imagery/precipitation_sum?drone_run_project_id='+manage_drone_imagery_calculate_precipitation_drone_run_project_id+'&formula='+manage_drone_imagery_calculate_precipitation_sum_formula+'&field_trial_id='+manage_drone_imagery_calculate_precipitation_field_trial_id,
4325 beforeSend: function(){
4326 jQuery('#working_modal').modal('show');
4328 success: function(response){
4329 console.log(response);
4330 jQuery('#working_modal').modal('hide');
4333 error: function(response){
4334 jQuery('#working_modal').modal('hide');
4335 alert('Error calculating precipitation sum!');
4341 // Keras CNN Training JS
4344 var manage_drone_imagery_train_keras_drone_run_ids = [];
4345 var manage_drone_imagery_train_keras_field_trial_id_array = [];
4346 var manage_drone_imagery_train_keras_field_trial_id_string = '';
4347 var manage_drone_imagery_train_keras_trait_id;
4348 var manage_drone_imagery_train_keras_aux_trait_ids;
4349 var manage_drone_imagery_train_keras_plot_polygon_type_ids = [];
4350 var manage_drone_imagery_train_keras_temporary_model_file = '';
4351 var manage_drone_imagery_train_keras_temporary_model_input_file = '';
4352 var manage_drone_imagery_train_keras_temporary_model_input_aux_file = '';
4353 var manage_drone_imagery_train_keras_class_map = '';
4355 var manage_drone_imagery_predict_keras_drone_run_ids = [];
4356 var manage_drone_imagery_predict_keras_field_trial_id_array = [];
4357 var manage_drone_imagery_predict_keras_field_trial_id_string = '';
4358 var manage_drone_imagery_predict_keras_plot_polygon_type_ids = [];
4359 var manage_drone_imagery_predict_keras_model_id = '';
4360 var manage_drone_imagery_predict_keras_aux_trait_ids;
4362 var manage_drone_imagery_autoencoder_keras_vi_field_trial_id_training_array = [];
4363 var manage_drone_imagery_autoencoder_keras_vi_field_trial_id_training_string = '';
4364 var manage_drone_imagery_autoencoder_keras_vi_drone_run_ids_training = [];
4365 var manage_drone_imagery_autoencoder_keras_vi_plot_polygon_type_ids_training = [];
4366 var manage_drone_imagery_autoencoder_keras_vi_field_trial_id_array = [];
4367 var manage_drone_imagery_autoencoder_keras_vi_field_trial_id_string = '';
4368 var manage_drone_imagery_autoencoder_keras_vi_drone_run_ids = [];
4369 var manage_drone_imagery_autoencoder_keras_vi_plot_polygon_type_ids = [];
4370 var manage_drone_imagery_autoencoder_keras_vi_time_cvterm_id = '';
4372 jQuery('#keras_cnn_drone_imagery_link').click(function(){
4373 jQuery('#drone_imagery_keras_cnn_dialog').modal('show');
4376 jQuery('#drone_imagery_keras_cnn_train_link').click(function(){
4377 get_select_box('trials', 'drone_imagery_train_keras_cnn_trial_select_div', { 'name' : 'drone_imagery_train_keras_cnn_field_trial_id', 'id' : 'drone_imagery_train_keras_cnn_field_trial_id', 'empty':1, 'multiple':1 });
4379 jQuery('#drone_imagery_train_keras_cnn_dialog').modal('show');
4382 jQuery('#drone_imagery_train_keras_model_field_trial_select_step').click(function(){
4383 manage_drone_imagery_train_keras_field_trial_id_array = [];
4384 manage_drone_imagery_train_keras_field_trial_id_string = '';
4385 manage_drone_imagery_train_keras_field_trial_id_array = jQuery('#drone_imagery_train_keras_cnn_field_trial_id').val();
4386 manage_drone_imagery_train_keras_field_trial_id_string = manage_drone_imagery_train_keras_field_trial_id_array.join(",");
4387 if (manage_drone_imagery_train_keras_field_trial_id_string == '') {
4388 alert('Please select a field trial first!');
4390 get_select_box('traits', 'drone_imagery_train_keras_cnn_trait_select_div', { 'name' : 'drone_imagery_train_keras_cnn_trait_id', 'id' : 'drone_imagery_train_keras_cnn_trait_id', 'empty':1, 'trial_ids':manage_drone_imagery_train_keras_field_trial_id_string, 'stock_type':'plot' });
4392 get_select_box('traits', 'drone_imagery_train_keras_cnn_aux_trait_select_div', { 'name' : 'drone_imagery_train_keras_cnn_aux_trait_ids', 'id' : 'drone_imagery_train_keras_cnn_aux_trait_ids', 'empty':1, 'multiple':1, 'trial_ids':manage_drone_imagery_train_keras_field_trial_id_string, 'stock_type':'plot' });
4394 jQuery('#drone_image_train_keras_drone_runs_table').DataTable({
4397 ajax : '/api/drone_imagery/drone_runs?select_checkbox_name=train_keras_drone_imagery_drone_run_select&checkbox_select_all=1&field_trial_ids='+manage_drone_imagery_train_keras_field_trial_id_string
4400 Workflow.complete("#drone_imagery_train_keras_model_field_trial_select_step");
4401 Workflow.focus('#drone_imagery_train_keras_model_workflow', 2);
4406 jQuery('#drone_imagery_train_keras_model_trait_select_step').click(function(){
4407 manage_drone_imagery_train_keras_trait_id = undefined;
4408 manage_drone_imagery_train_keras_aux_trait_ids = undefined;
4409 manage_drone_imagery_train_keras_trait_id = jQuery('#drone_imagery_train_keras_cnn_trait_id').val();
4410 manage_drone_imagery_train_keras_aux_trait_ids = jQuery('#drone_imagery_train_keras_cnn_aux_trait_ids').val();
4411 if (manage_drone_imagery_train_keras_trait_id == undefined || manage_drone_imagery_train_keras_trait_id == 'null' || manage_drone_imagery_train_keras_trait_id == '') {
4412 alert('Please select a phenotyped trait first!');
4415 get_select_box('stocks', 'drone_imagery_train_keras_cnn_population_select_div', { 'name' : 'drone_imagery_train_keras_cnn_population_id', 'id' : 'drone_imagery_train_keras_cnn_population_id', 'empty':1, 'multiple':1, 'stock_type_name':'population' });
4417 Workflow.complete("#drone_imagery_train_keras_model_trait_select_step");
4418 Workflow.focus('#drone_imagery_train_keras_model_workflow', 3);
4423 jQuery('#drone_imagery_train_keras_model_population_select_step').click(function(){
4424 Workflow.complete("#drone_imagery_train_keras_model_population_select_step");
4425 Workflow.focus('#drone_imagery_train_keras_model_workflow', 4);
4428 jQuery('#drone_imagery_train_keras_model_drone_run_select_step').click(function(){
4429 manage_drone_imagery_train_keras_drone_run_ids = [];
4430 jQuery('input[name="train_keras_drone_imagery_drone_run_select"]:checked').each(function() {
4431 manage_drone_imagery_train_keras_drone_run_ids.push(jQuery(this).val());
4433 if (manage_drone_imagery_train_keras_drone_run_ids.length < 1){
4434 alert('Please select at least one imaging event!');
4437 jQuery('#drone_image_train_keras_plot_polygon_image_type_table').DataTable({
4440 ajax : '/api/drone_imagery/plot_polygon_types?checkbox_select_standard_4=1&select_checkbox_name=train_keras_drone_imagery_plot_polygon_type_select&field_trial_ids='+manage_drone_imagery_train_keras_field_trial_id_string+'&drone_run_ids='+JSON.stringify(manage_drone_imagery_train_keras_drone_run_ids)
4443 Workflow.complete("#drone_imagery_train_keras_model_drone_run_select_step");
4444 Workflow.focus('#drone_imagery_train_keras_model_workflow', 5);
4449 jQuery('#drone_image_train_keras_drone_runs_table_select_all').change(function(){
4450 jQuery('input[name="train_keras_drone_imagery_drone_run_select"]').each(function() {
4451 jQuery(this).prop('checked', jQuery('#drone_image_train_keras_drone_runs_table_select_all').prop("checked"));
4455 jQuery('#drone_image_train_keras_plot_polygon_image_type_table_select_all').change(function() {
4456 jQuery('input[name="train_keras_drone_imagery_plot_polygon_type_select"]').each(function() {
4457 jQuery(this).prop('checked', jQuery('#drone_image_train_keras_plot_polygon_image_type_table_select_all').prop("checked"));
4461 jQuery('#drone_imagery_train_keras_model_plot_polygon_type_select_step').click(function(){
4462 manage_drone_imagery_train_keras_plot_polygon_type_ids = [];
4463 jQuery('input[name="train_keras_drone_imagery_plot_polygon_type_select"]:checked').each(function() {
4464 manage_drone_imagery_train_keras_plot_polygon_type_ids.push(jQuery(this).val());
4466 if (manage_drone_imagery_train_keras_plot_polygon_type_ids.length < 1){
4467 alert('Please select at least one plot polygon type!');
4469 Workflow.complete("#drone_imagery_train_keras_model_plot_polygon_type_select_step");
4470 Workflow.focus('#drone_imagery_train_keras_model_workflow', 6);
4473 get_select_box('genotyping_protocol', 'drone_image_train_keras_model_genotyping_protocol_div', { 'name' : 'drone_image_train_keras_model_genotyping_protocol_select', 'id' : 'drone_image_train_keras_model_genotyping_protocol_select', 'empty':1 });
4478 jQuery('#drone_imagery_train_keras_model_confirm_step').click(function(){
4479 manage_drone_imagery_train_keras_temporary_model_file = '';
4480 manage_drone_imagery_train_keras_temporary_model_input_file = '';
4481 manage_drone_imagery_train_keras_temporary_model_input_aux_file = '';
4482 manage_drone_imagery_train_keras_class_map = '';
4484 var drone_imagery_keras_model_name = jQuery('#drone_image_train_keras_model_name').val();
4485 var drone_imagery_keras_model_desc = jQuery('#drone_image_train_keras_model_desc').val();
4486 var drone_imagery_keras_model_type = jQuery('#drone_image_train_keras_model_type').val();
4487 if (drone_imagery_keras_model_type =='' || drone_imagery_keras_model_name == '' || drone_imagery_keras_model_desc == '') {
4488 alert('Please give a model type, name, and description!');
4491 else if (manage_drone_imagery_train_keras_plot_polygon_type_ids.length / manage_drone_imagery_train_keras_drone_run_ids.length != 4) {
4492 alert('This only works for Micasense 5-band camera currently, where plot images are extracted for blue, green, red, NIR, and red-edge bands, and the standard process has been completed! So only select imaging events that meet this criteria!');
4497 url : '/api/drone_imagery/train_keras_model',
4500 'field_trial_ids' : manage_drone_imagery_train_keras_field_trial_id_string,
4501 'trait_id' : manage_drone_imagery_train_keras_trait_id,
4502 'aux_trait_id' : manage_drone_imagery_train_keras_aux_trait_ids,
4503 'drone_run_ids' : JSON.stringify(manage_drone_imagery_train_keras_drone_run_ids),
4504 'plot_polygon_type_ids' : JSON.stringify(manage_drone_imagery_train_keras_plot_polygon_type_ids),
4506 'model_name' : drone_imagery_keras_model_name,
4507 'model_description' : drone_imagery_keras_model_desc,
4508 'model_type' : drone_imagery_keras_model_type,
4509 'population_id' : jQuery('#drone_imagery_train_keras_cnn_population_id').val(),
4510 'nd_protocol_id' : jQuery('#drone_image_train_keras_model_genotyping_protocol_select').val(),
4511 'use_parents_grm' : jQuery('#drone_image_train_keras_model_use_parents_grm').val()
4513 beforeSend: function() {
4514 jQuery("#working_modal").modal("show");
4516 success: function(response){
4517 console.log(response);
4518 jQuery("#working_modal").modal("hide");
4520 if (response.error) {
4521 alert(response.error);
4524 alert("Trained Keras CNN Model saved!");
4527 var html = "<hr><a href='"+response.loss_history_file+"' target=_blank>Loss History</a><hr><h4>Results</h4><br/><br/>";
4528 html = html + "<table class='table table-bordered table-hover'><thead><tr><th>Results</th></tr></thead><tbody>";
4529 for (var i=0; i<response.results.length; i++) {
4530 html = html + "<tr><td>"+response.results[i]+"</td></tr>";
4532 html = html + "</tbody></table>";
4534 //html = html + '<hr><h3>Save Model for Predictions</h3><div class="form-horizontal"><div class="form-group"><label class="col-sm-6 control-label">Model Name: </label><div class="col-sm-6"><input class="form-control" id="drone_imagery_save_keras_model_name" name="drone_imagery_save_keras_model_name" type="text" /></div></div><div class="form-group"><label class="col-sm-6 control-label">Model Description: </label><div class="col-sm-6"><input class="form-control" id="drone_imagery_save_keras_model_desc" name="drone_imagery_save_keras_model_desc" type="text" /></div></div></div><button class="btn btn-primary" id="drone_imagery_keras_model_save">Save Model (Required For Using For Prediction)</button>';
4536 manage_drone_imagery_train_keras_temporary_model_input_file = response.model_input_file;
4537 manage_drone_imagery_train_keras_temporary_model_input_aux_file = response.model_input_aux_file;
4538 manage_drone_imagery_train_keras_temporary_model_file = response.model_temp_file;
4539 manage_drone_imagery_train_keras_class_map = response.class_map;
4541 jQuery('#drone_imagery_train_keras_model_results_div').html(html);
4543 error: function(response){
4544 jQuery("#working_modal").modal("hide");
4545 alert('Error training keras model!')
4551 jQuery(document).on('click', '#drone_imagery_keras_model_save', function() {
4552 var manage_drone_imagery_train_keras_model_save_name = jQuery('#drone_imagery_save_keras_model_name').val();
4553 var manage_drone_imagery_train_keras_model_save_desc = jQuery('#drone_imagery_save_keras_model_desc').val();
4554 if (manage_drone_imagery_train_keras_model_save_name == '' || manage_drone_imagery_train_keras_model_save_desc == '') {
4555 alert('A model name and description are required for saving!');
4560 url : '/api/drone_imagery/save_keras_model?field_trial_ids='+manage_drone_imagery_train_keras_field_trial_id_string+'&drone_run_ids='+JSON.stringify(manage_drone_imagery_train_keras_drone_run_ids)+'&plot_polygon_type_ids='+JSON.stringify(manage_drone_imagery_train_keras_plot_polygon_type_ids)+'&model_file='+manage_drone_imagery_train_keras_temporary_model_file+'&model_input_file='+manage_drone_imagery_train_keras_temporary_model_input_file+'&model_input_aux_file='+manage_dromanage_drone_imagery_train_keras_temporary_model_input_aux_file+'&model_name='+manage_drone_imagery_train_keras_model_save_name+'&model_description='+manage_drone_imagery_train_keras_model_save_desc+'&class_map='+JSON.stringify(manage_drone_imagery_train_keras_class_map)+'&trait_id='+manage_drone_imagery_train_keras_trait_id,
4561 beforeSend: function() {
4562 jQuery("#working_modal").modal("show");
4564 success: function(response){
4565 console.log(response);
4566 jQuery("#working_modal").modal("hide");
4567 if (response.error) {
4568 alert(response.error);
4571 alert('Trained Keras CNN Model Saved! You can now use it for prediction!');
4574 error: function(response){
4575 jQuery("#working_modal").modal("hide");
4576 alert('Error saving keras model!')
4582 jQuery('#drone_imagery_keras_cnn_predict_link').click(function(){
4583 get_select_box('trials', 'drone_imagery_predict_keras_cnn_trial_select_div', { 'name' : 'drone_imagery_predict_keras_cnn_field_trial_id', 'id' : 'drone_imagery_predict_keras_cnn_field_trial_id', 'empty':1, 'multiple':0 });
4584 get_select_box('trained_keras_cnn_models', 'drone_imagery_predict_keras_cnn_model_select_div', { 'name' : 'drone_imagery_predict_keras_cnn_model_id', 'id' : 'drone_imagery_predict_keras_cnn_model_id', 'empty':1 });
4586 jQuery('#drone_imagery_predict_keras_cnn_dialog').modal('show');
4589 jQuery('#drone_imagery_predict_keras_model_field_trial_select_step').click(function(){
4590 manage_drone_imagery_predict_keras_field_trial_id_array = [];
4591 manage_drone_imagery_predict_keras_field_trial_id_string = '';
4592 manage_drone_imagery_predict_keras_field_trial_id_string = jQuery('#drone_imagery_predict_keras_cnn_field_trial_id').val();
4593 //manage_drone_imagery_predict_keras_field_trial_id_array = jQuery('#drone_imagery_predict_keras_cnn_field_trial_id').val();
4594 //manage_drone_imagery_predict_keras_field_trial_id_string = manage_drone_imagery_predict_keras_field_trial_id_array.join(",");
4595 if (manage_drone_imagery_predict_keras_field_trial_id_string == '') {
4596 alert('Please select a field trial first!');
4599 jQuery('#drone_image_predict_keras_drone_runs_table').DataTable({
4602 ajax : '/api/drone_imagery/drone_runs?select_checkbox_name=predict_keras_drone_imagery_drone_run_select&checkbox_select_all=1&field_trial_ids='+manage_drone_imagery_predict_keras_field_trial_id_string
4605 get_select_box('traits', 'drone_imagery_predict_keras_cnn_aux_trait_select_div', { 'name' : 'drone_imagery_predict_keras_cnn_aux_trait_ids', 'id' : 'drone_imagery_predict_keras_cnn_aux_trait_ids', 'empty':1, 'multiple':1, 'trial_ids':manage_drone_imagery_predict_keras_field_trial_id_string, 'stock_type':'plot' });
4607 Workflow.complete("#drone_imagery_predict_keras_model_field_trial_select_step");
4608 Workflow.focus('#drone_imagery_predict_keras_model_workflow', 2);
4613 jQuery('#drone_image_predict_keras_drone_runs_table_select_all').change(function(){
4614 jQuery('input[name="predict_keras_drone_imagery_drone_run_select"]').each(function() {
4615 jQuery(this).prop('checked', jQuery('#drone_image_predict_keras_drone_runs_table_select_all').prop("checked"));
4619 jQuery('#drone_imagery_predict_keras_model_select_step').click(function(){
4620 manage_drone_imagery_predict_keras_model_id = '';
4621 manage_drone_imagery_predict_keras_aux_trait_ids = undefined;
4622 manage_drone_imagery_predict_keras_model_id = jQuery('#drone_imagery_predict_keras_cnn_model_id').val();
4623 manage_drone_imagery_predict_keras_aux_trait_ids = jQuery('#drone_imagery_predict_keras_cnn_aux_trait_ids').val();
4624 if (manage_drone_imagery_predict_keras_model_id == '') {
4625 alert('Please select a trained Keras CNN model before proceeding!');
4628 get_select_box('stocks', 'drone_imagery_predict_keras_cnn_population_select_div', { 'name' : 'drone_imagery_predict_keras_cnn_population_id', 'id' : 'drone_imagery_predict_keras_cnn_population_id', 'empty':1, 'multiple':1, 'stock_type_name':'population' });
4630 Workflow.complete("#drone_imagery_predict_keras_model_select_step");
4631 Workflow.focus('#drone_imagery_predict_keras_model_workflow', 3);
4636 jQuery('#drone_imagery_predict_keras_model_population_select_step').click(function(){
4637 Workflow.complete("#drone_imagery_predict_keras_model_population_select_step");
4638 Workflow.focus('#drone_imagery_predict_keras_model_workflow', 4);
4641 jQuery('#drone_imagery_predict_keras_model_drone_run_select_step').click(function(){
4642 manage_drone_imagery_predict_keras_drone_run_ids = [];
4643 jQuery('input[name="predict_keras_drone_imagery_drone_run_select"]:checked').each(function() {
4644 manage_drone_imagery_predict_keras_drone_run_ids.push(jQuery(this).val());
4646 if (manage_drone_imagery_predict_keras_drone_run_ids.length < 1){
4647 alert('Please select at least one imaging event!');
4650 jQuery('#drone_image_predict_keras_plot_polygon_image_type_table').DataTable({
4653 ajax : '/api/drone_imagery/plot_polygon_types?checkbox_select_standard_4=1&select_checkbox_name=predict_keras_drone_imagery_plot_polygon_type_select&field_trial_ids='+manage_drone_imagery_predict_keras_field_trial_id_string+'&drone_run_ids='+JSON.stringify(manage_drone_imagery_predict_keras_drone_run_ids)
4656 Workflow.complete("#drone_imagery_predict_keras_model_drone_run_select_step");
4657 Workflow.focus('#drone_imagery_predict_keras_model_workflow', 5);
4662 jQuery('#drone_image_predict_keras_plot_polygon_image_type_table_select_all').change(function() {
4663 jQuery('input[name="predict_keras_drone_imagery_plot_polygon_type_select"]').each(function() {
4664 jQuery(this).prop('checked', jQuery('#drone_image_predict_keras_plot_polygon_image_type_table_select_all').prop("checked"));
4668 jQuery('#drone_imagery_predict_keras_model_plot_polygon_type_select_step').click(function(){
4669 manage_drone_imagery_predict_keras_plot_polygon_type_ids = [];
4670 jQuery('input[name="predict_keras_drone_imagery_plot_polygon_type_select"]:checked').each(function() {
4671 manage_drone_imagery_predict_keras_plot_polygon_type_ids.push(jQuery(this).val());
4673 if (manage_drone_imagery_predict_keras_plot_polygon_type_ids.length < 1){
4674 alert('Please select at least one plot polygon type!');
4676 Workflow.complete("#drone_imagery_predict_keras_model_plot_polygon_type_select_step");
4677 Workflow.focus('#drone_imagery_predict_keras_model_workflow', 6);
4682 jQuery('#drone_imagery_keras_model_prediction_select').change(function(){
4683 if (jQuery(this).val() == 'cnn_prediction_mixed_model') {
4684 jQuery('#drone_imagery_keras_model_prediction_cnn_prediction_mixed_model_div').show();
4687 jQuery('#drone_imagery_keras_model_prediction_cnn_prediction_mixed_model_div').hide();
4691 jQuery('#drone_imagery_predict_keras_model_confirm_step').click(function(){
4693 url : '/api/drone_imagery/predict_keras_model',
4696 'field_trial_ids' : manage_drone_imagery_predict_keras_field_trial_id_string,
4697 'drone_run_ids' : JSON.stringify(manage_drone_imagery_predict_keras_drone_run_ids),
4698 'plot_polygon_type_ids' : JSON.stringify(manage_drone_imagery_predict_keras_plot_polygon_type_ids),
4699 'model_id' : manage_drone_imagery_predict_keras_model_id,
4700 'model_prediction_type' : jQuery('#drone_imagery_keras_model_prediction_select').val(),
4701 'population_id' : jQuery('#drone_imagery_predict_keras_cnn_population_id').val(),
4702 'aux_trait_ids' : manage_drone_imagery_predict_keras_aux_trait_ids
4704 beforeSend: function() {
4705 jQuery("#working_modal").modal("show");
4707 success: function(response){
4708 console.log(response);
4709 jQuery("#working_modal").modal("hide");
4710 if (response.error) {
4711 alert(response.error);
4714 var html = "<hr><h4>Prediction Results: "+response.trained_trait_name+"</h4>";
4715 html = html + "<table class='table table-bordered table-hover'><thead><tr><th>Stock</th><th>Prediction</th><th>True Phenotype Value</th></tr></thead><tbody>";
4716 for (var i=0; i<response.results.length; i++) {
4717 html = html + "<tr><td><a href='/stock/"+response.results[i][1]+"/view' target=_blank>"+response.results[i][0]+"</a></td><td>"+response.results[i][2]+"</td><td>"+response.results[i][3]+"</td></tr>";
4719 html = html + "</tbody></table>";
4721 html = html + "<a href='"+response.activation_output+"' target=_blank>Download Activation Result</a><a href='"+response.corr_plot+"' target=_blank>Download Correlation</a>";
4723 if (response.evaluation_results.length > 0) {
4724 html = html + "<hr><h4>Model Evaluation Results</h4><br/><br/>";
4725 html = html + "<table class='table table-bordered table-hover'><thead><tr><th>Results</th></tr></thead><tbody>";
4726 for (var i=0; i<response.evaluation_results.length; i++) {
4727 html = html + "<tr><td>"+response.evaluation_results[i]+"</td></tr>";
4729 html = html + "</tbody></table>";
4732 jQuery('#drone_imagery_predict_keras_model_results_div').html(html);
4734 error: function(response){
4735 jQuery("#working_modal").modal("hide");
4736 alert('Error predicting keras model!')
4741 jQuery('#drone_imagery_keras_cnn_autoencoder_vegetation_indices_link').click(function(){
4742 get_select_box('trials', 'drone_imagery_autoencoder_keras_cnn_vi_trial_training_select_div', { 'name' : 'drone_imagery_autoencoder_keras_cnn_vi_field_trial_id_training', 'id' : 'drone_imagery_autoencoder_keras_cnn_vi_field_trial_id_training', 'empty':1, 'multiple':1 });
4743 get_select_box('trials', 'drone_imagery_autoencoder_keras_cnn_vi_trial_select_div', { 'name' : 'drone_imagery_autoencoder_keras_cnn_vi_field_trial_id', 'id' : 'drone_imagery_autoencoder_keras_cnn_vi_field_trial_id', 'empty':1, 'multiple':0 });
4745 jQuery('#drone_imagery_keras_cnn_autoencoder_vi_dialog').modal('show');
4748 jQuery('#drone_imagery_autoencoder_keras_vi_model_field_trial_training_select_step').click(function(){
4749 manage_drone_imagery_autoencoder_keras_vi_field_trial_id_training_array = jQuery('#drone_imagery_autoencoder_keras_cnn_vi_field_trial_id_training').val();
4750 manage_drone_imagery_autoencoder_keras_vi_field_trial_id_training_string = manage_drone_imagery_autoencoder_keras_vi_field_trial_id_training_array.join();
4752 if (manage_drone_imagery_autoencoder_keras_vi_field_trial_id_training_array.length < 1) {
4753 alert('Please select atleast one field trial!');
4755 else if (manage_drone_imagery_autoencoder_keras_vi_field_trial_id_training_string == '') {
4756 alert('Please select a field trial first!');
4760 jQuery('#drone_image_autoencoder_keras_vi_drone_runs_training_table').DataTable({
4763 ajax : '/api/drone_imagery/drone_runs?select_checkbox_name=autoencoder_keras_drone_imagery_drone_run_training_select&checkbox_select_all=1&field_trial_ids='+manage_drone_imagery_autoencoder_keras_vi_field_trial_id_training_string
4766 Workflow.complete("#drone_imagery_autoencoder_keras_vi_model_field_trial_training_select_step");
4767 Workflow.focus('#drone_imagery_autoencoder_keras_model_vi_workflow', 2);
4772 jQuery('#drone_image_autoencoder_keras_vi_drone_runs_training_table_select_all').change(function(){
4773 jQuery('input[name="autoencoder_keras_drone_imagery_drone_run_training_select"]').each(function() {
4774 jQuery(this).prop('checked', jQuery('#drone_image_autoencoder_keras_vi_drone_runs_training_table_select_all').prop("checked"));
4778 jQuery('#drone_imagery_autoencoder_keras_vi_model_drone_run_training_select_step').click(function(){
4779 manage_drone_imagery_autoencoder_keras_vi_drone_run_ids_training = [];
4780 jQuery('input[name="autoencoder_keras_drone_imagery_drone_run_training_select"]:checked').each(function() {
4781 manage_drone_imagery_autoencoder_keras_vi_drone_run_ids_training.push(jQuery(this).val());
4783 if (manage_drone_imagery_autoencoder_keras_vi_drone_run_ids_training.length < 1){
4784 alert('Please select atleast one imaging event!');
4787 jQuery('#drone_image_autoencoder_keras_vi_plot_polygon_image_type_training_table').DataTable({
4790 ajax : '/api/drone_imagery/plot_polygon_types?checkbox_select_standard_ndvi_ndre=1&select_checkbox_name=autoencoder_keras_vi_drone_imagery_plot_polygon_type_training_select&field_trial_ids='+manage_drone_imagery_autoencoder_keras_vi_field_trial_id_training_string+'&drone_run_ids='+JSON.stringify(manage_drone_imagery_autoencoder_keras_vi_drone_run_ids_training)
4793 Workflow.complete("#drone_imagery_autoencoder_keras_vi_model_drone_run_training_select_step");
4794 Workflow.focus('#drone_imagery_autoencoder_keras_model_vi_workflow', 3);
4799 jQuery('#drone_image_autoencoder_keras_vi_plot_polygon_image_type_training_table_select_all').change(function() {
4800 jQuery('input[name="autoencoder_keras_vi_drone_imagery_plot_polygon_type_training_select"]').each(function() {
4801 jQuery(this).prop('checked', jQuery('#drone_image_autoencoder_keras_vi_plot_polygon_image_type_training_table_select_all').prop("checked"));
4805 jQuery('#drone_imagery_autoencoder_keras_vi_model_plot_polygon_type_training_select_step').click(function(){
4806 manage_drone_imagery_autoencoder_keras_vi_plot_polygon_type_ids_training = [];
4807 jQuery('input[name="autoencoder_keras_vi_drone_imagery_plot_polygon_type_training_select"]:checked').each(function() {
4808 manage_drone_imagery_autoencoder_keras_vi_plot_polygon_type_ids_training.push(jQuery(this).val());
4810 if (manage_drone_imagery_autoencoder_keras_vi_plot_polygon_type_ids_training.length < 1){
4811 alert('Please select at least one plot polygon type!');
4813 Workflow.complete("#drone_imagery_autoencoder_keras_vi_model_plot_polygon_type_training_select_step");
4814 Workflow.focus('#drone_imagery_autoencoder_keras_model_vi_workflow', 4);
4819 jQuery('#drone_imagery_autoencoder_keras_vi_model_field_trial_select_step').click(function(){
4820 manage_drone_imagery_autoencoder_keras_vi_field_trial_id_array = [];
4821 manage_drone_imagery_autoencoder_keras_vi_field_trial_id_string = '';
4822 manage_drone_imagery_autoencoder_keras_vi_field_trial_id_string = jQuery('#drone_imagery_autoencoder_keras_cnn_vi_field_trial_id').val();
4824 if (manage_drone_imagery_autoencoder_keras_vi_field_trial_id_string == '') {
4825 alert('Please select a field trial first!');
4828 jQuery('#drone_image_autoencoder_keras_vi_drone_runs_table').DataTable({
4831 ajax : '/api/drone_imagery/drone_runs?select_checkbox_name=autoencoder_keras_drone_imagery_drone_run_select&checkbox_select_all=1&field_trial_ids='+manage_drone_imagery_autoencoder_keras_vi_field_trial_id_string
4834 Workflow.complete("#drone_imagery_autoencoder_keras_vi_model_field_trial_select_step");
4835 Workflow.focus('#drone_imagery_autoencoder_keras_model_vi_workflow', 5);
4840 jQuery('#drone_image_autoencoder_keras_vi_drone_runs_table_select_all').change(function(){
4841 jQuery('input[name="autoencoder_keras_drone_imagery_drone_run_select"]').each(function() {
4842 jQuery(this).prop('checked', jQuery('#drone_image_autoencoder_keras_vi_drone_runs_table_select_all').prop("checked"));
4846 jQuery('#drone_imagery_autoencoder_keras_vi_model_drone_run_select_step').click(function(){
4847 manage_drone_imagery_autoencoder_keras_vi_drone_run_ids = [];
4848 jQuery('input[name="autoencoder_keras_drone_imagery_drone_run_select"]:checked').each(function() {
4849 manage_drone_imagery_autoencoder_keras_vi_drone_run_ids.push(jQuery(this).val());
4851 if (manage_drone_imagery_autoencoder_keras_vi_drone_run_ids.length < 1){
4852 alert('Please select one imaging event!');
4853 } else if (manage_drone_imagery_autoencoder_keras_vi_drone_run_ids.length > 1){
4854 alert('Please select only one imaging event!');
4859 url: '/api/drone_imagery/get_weeks_after_planting_date?drone_run_project_id='+manage_drone_imagery_autoencoder_keras_vi_drone_run_ids[0],
4861 beforeSend: function (){
4862 jQuery('#working_modal').modal('show');
4864 success: function(response){
4865 jQuery('#working_modal').modal('hide');
4866 console.log(response);
4867 if (response.error) {
4868 alert(response.error);
4871 manage_drone_imagery_autoencoder_keras_vi_time_cvterm_id = response.time_ontology_day_cvterm_id;
4873 error: function(response){
4874 alert('Error getting time term!');
4875 jQuery('#working_modal').modal('hide');
4879 jQuery('#drone_image_autoencoder_keras_vi_plot_polygon_image_type_table').DataTable({
4882 ajax : '/api/drone_imagery/plot_polygon_types?checkbox_select_standard_ndvi_ndre=1&select_checkbox_name=autoencoder_keras_vi_drone_imagery_plot_polygon_type_select&field_trial_ids='+manage_drone_imagery_autoencoder_keras_vi_field_trial_id_string+'&drone_run_ids='+JSON.stringify(manage_drone_imagery_autoencoder_keras_vi_drone_run_ids)
4885 Workflow.complete("#drone_imagery_autoencoder_keras_vi_model_drone_run_select_step");
4886 Workflow.focus('#drone_imagery_autoencoder_keras_model_vi_workflow', 6);
4891 jQuery('#drone_image_autoencoder_keras_vi_plot_polygon_image_type_table_select_all').change(function() {
4892 jQuery('input[name="autoencoder_keras_vi_drone_imagery_plot_polygon_type_select"]').each(function() {
4893 jQuery(this).prop('checked', jQuery('#drone_image_autoencoder_keras_vi_plot_polygon_image_type_table_select_all').prop("checked"));
4897 jQuery('#drone_imagery_autoencoder_keras_vi_model_plot_polygon_type_select_step').click(function(){
4898 manage_drone_imagery_autoencoder_keras_vi_plot_polygon_type_ids = [];
4899 jQuery('input[name="autoencoder_keras_vi_drone_imagery_plot_polygon_type_select"]:checked').each(function() {
4900 manage_drone_imagery_autoencoder_keras_vi_plot_polygon_type_ids.push(jQuery(this).val());
4902 if (manage_drone_imagery_autoencoder_keras_vi_plot_polygon_type_ids.length < 1){
4903 alert('Please select at least one plot polygon type!');
4905 Workflow.complete("#drone_imagery_autoencoder_keras_vi_model_plot_polygon_type_select_step");
4906 Workflow.focus('#drone_imagery_autoencoder_keras_model_vi_workflow', 7);
4911 jQuery('#drone_imagery_autoencoder_keras_vi_model_confirm_step').click(function(){
4913 url : '/api/drone_imagery/perform_autoencoder_vi',
4916 'training_field_trial_ids' : manage_drone_imagery_autoencoder_keras_vi_field_trial_id_training_string,
4917 'training_drone_run_ids' : JSON.stringify(manage_drone_imagery_autoencoder_keras_vi_drone_run_ids_training),
4918 'training_plot_polygon_type_ids' : JSON.stringify(manage_drone_imagery_autoencoder_keras_vi_plot_polygon_type_ids_training),
4919 'field_trial_ids' : manage_drone_imagery_autoencoder_keras_vi_field_trial_id_string,
4920 'drone_run_ids' : JSON.stringify(manage_drone_imagery_autoencoder_keras_vi_drone_run_ids),
4921 'plot_polygon_type_ids' : JSON.stringify(manage_drone_imagery_autoencoder_keras_vi_plot_polygon_type_ids),
4922 'autoencoder_model_type' : jQuery('#drone_imagery_keras_model_autoencoder_vi_select').val(),
4923 'time_cvterm_id' : manage_drone_imagery_autoencoder_keras_vi_time_cvterm_id
4925 beforeSend: function() {
4926 jQuery("#working_modal").modal("show");
4928 success: function(response){
4929 console.log(response);
4930 jQuery("#working_modal").modal("hide");
4931 if (response.error) {
4932 alert(response.error);
4935 alert('Autoencoder phenotypes saved!');
4938 jQuery('#drone_imagery_autoencoder_keras_vi_model_results_div').html(html);
4940 error: function(response){
4941 jQuery("#working_modal").modal("hide");
4942 alert('Error autoencoder keras CNN VI!')
4948 // Image Rotating JS
4951 var rotate_stitched_image_id;
4952 var rotate_drone_run_band_project_id;
4953 var rotate_stitched_image_degrees;
4954 var manage_drone_imagery_standard_process_rotate_svg;
4956 jQuery(document).on('click', 'button[name="project_drone_imagery_rotate_image"]', function() {
4957 showManageDroneImagerySection('manage_drone_imagery_rotate_div');
4959 rotate_stitched_image_id = jQuery(this).data('stitched_image_id');
4960 rotate_drone_run_band_project_id = jQuery(this).data('drone_run_band_project_id');
4961 rotate_stitched_image_degrees = 0.00;
4963 showRotateImage(rotate_stitched_image_id, 'drone_imagery_rotate_original_stitched_div', 'manage_drone_imagery_rotate_load_div');
4966 jQuery('#drone_imagery_rotate_stitched_view').click(function(){
4967 rotate_stitched_image_degrees = parseFloat(jQuery('#drone_imagery_rotate_degrees_input').val());
4968 applyShowRotateImage(rotate_stitched_image_id, rotate_drone_run_band_project_id, rotate_stitched_image_degrees, 'drone_imagery_rotate_original_stitched_div');
4971 jQuery('#drone_imagery_rotate_stitched_restart').click(function(){
4972 showRotateImage(rotate_stitched_image_id, 'drone_imagery_rotate_original_stitched_div', 'manage_drone_imagery_rotate_load_div');
4973 rotate_stitched_image_degrees = 0.00;
4976 function applyShowRotateImage(rotate_stitched_image_id, rotate_drone_run_band_project_id, rotate_stitched_image_degrees, canvas_div_id) {
4978 url : '/api/drone_imagery/rotate_image?image_id='+rotate_stitched_image_id+'&drone_run_band_project_id='+rotate_drone_run_band_project_id+'&angle='+rotate_stitched_image_degrees+'&view_only=1',
4979 beforeSend: function() {
4980 jQuery("#working_modal").modal("show");
4982 success: function(response){
4983 console.log(response);
4984 jQuery("#working_modal").modal("hide");
4986 var canvas = document.getElementById(canvas_div_id);
4987 ctx = canvas.getContext('2d');
4988 var image = new Image();
4989 image.onload = function () {
4990 canvas.width = this.naturalWidth;
4991 canvas.height = this.naturalHeight;
4992 ctx.drawImage(this, 0, 0);
4994 image.src = response.rotated_image_url;
4996 manage_drone_imagery_standard_process_raw_images_rotated_image_id = response.rotated_image_id;
4998 error: function(response){
4999 jQuery("#working_modal").modal("hide");
5000 alert('Error getting rotated image!')
5005 function showRotateImage(rotate_stitched_image_id, canvas_div_id, load_div_id) {
5007 url : '/api/drone_imagery/get_image?image_id='+rotate_stitched_image_id,
5008 beforeSend: function() {
5009 jQuery("#working_modal").modal("show");
5011 success: function(response){
5012 console.log(response);
5013 jQuery("#working_modal").modal("hide");
5015 var canvas = document.getElementById(canvas_div_id);
5016 ctx = canvas.getContext('2d');
5017 var image = new Image();
5018 image.onload = function () {
5019 canvas.width = this.naturalWidth;
5020 canvas.height = this.naturalHeight;
5021 ctx.drawImage(this, 0, 0);
5022 jQuery('#'+load_div_id).hide();
5024 image.src = response.image_url;
5027 error: function(response){
5028 jQuery("#working_modal").modal("hide");
5029 alert('Error retrieving image!')
5034 function showRotateImageD3(rotate_stitched_image_id, canvas_div_id, load_div_id) {
5036 url : '/api/drone_imagery/get_image?image_id='+rotate_stitched_image_id,
5037 beforeSend: function() {
5038 jQuery("#working_modal").modal("show");
5040 success: function(response){
5041 console.log(response);
5042 jQuery("#working_modal").modal("hide");
5044 manage_drone_imagery_standard_process_image_width = response.image_width;
5045 manage_drone_imagery_standard_process_image_height = response.image_height;
5047 manage_drone_imagery_standard_process_rotate_svg = d3.select(canvas_div_id).append("svg")
5048 .attr("width", manage_drone_imagery_standard_process_image_width)
5049 .attr("height", manage_drone_imagery_standard_process_image_height)
5050 .attr("id", canvas_div_id+'_area')
5051 .on("click", function(){
5052 console.log(d3.mouse(this));
5056 var imageGroup = manage_drone_imagery_standard_process_rotate_svg.append("g")
5057 .datum({position: x_pos,y_pos})
5058 .attr("x_pos", x_pos)
5059 .attr("y_pos", y_pos)
5060 .attr("transform", d => "translate("+x_pos+","+y_pos+")");
5062 var imageElem = imageGroup.append("image")
5063 .attr("xlink:href", response.image_url)
5064 .attr("height", manage_drone_imagery_standard_process_image_height)
5065 .attr("width", manage_drone_imagery_standard_process_image_width);
5067 jQuery('#'+load_div_id).hide();
5069 error: function(response){
5070 jQuery("#working_modal").modal("hide");
5071 alert('Error retrieving image!')
5076 function getRandomColor() {
5077 var letters = '0123456789ABCDEF';
5079 for (var i = 0; i < 6; i++) {
5080 color += letters[Math.floor(Math.random() * 16)];
5085 jQuery('#drone_imagery_rotate_stitched_crosshairs').click(function(){
5086 drawRotateCrosshairs(getRandomColor(), 'drone_imagery_rotate_original_stitched_div');
5089 function drawRotateCrosshairs(color, canvas_div_id) {
5090 var canvas = document.getElementById(canvas_div_id);
5091 var rotate_image_width = canvas.width;
5092 var rotate_image_height = canvas.height;
5093 var ctx = canvas.getContext("2d");
5096 ctx.moveTo(rotate_image_width/2,0);
5097 ctx.lineTo(rotate_image_width/2, rotate_image_height);
5098 ctx.strokeStyle = color;
5103 ctx.moveTo(rotate_image_width*1/4,0);
5104 ctx.lineTo(rotate_image_width*1/4, rotate_image_height);
5105 ctx.strokeStyle = color;
5110 ctx.moveTo(rotate_image_width*3/4,0);
5111 ctx.lineTo(rotate_image_width*3/4, rotate_image_height);
5112 ctx.strokeStyle = color;
5117 ctx.moveTo(0,rotate_image_height/2);
5118 ctx.lineTo(rotate_image_width, rotate_image_height/2);
5119 ctx.strokeStyle = color;
5124 ctx.moveTo(0,rotate_image_height*1/4);
5125 ctx.lineTo(rotate_image_width, rotate_image_height*1/4);
5126 ctx.strokeStyle = color;
5131 ctx.moveTo(0,rotate_image_height*3/4);
5132 ctx.lineTo(rotate_image_width, rotate_image_height*3/4);
5133 ctx.strokeStyle = color;
5138 function drawRotateCrosshairsD3(color) {
5139 var row_line_width = 250;
5140 var col_line_width = 250;
5141 var number_col_lines = manage_drone_imagery_standard_process_image_width/col_line_width;
5142 var number_row_lines = manage_drone_imagery_standard_process_image_height/row_line_width;
5143 var current_row_val = row_line_width;
5144 var current_col_val = col_line_width;
5145 for (var i=0; i<number_col_lines; i++) {
5146 manage_drone_imagery_standard_process_rotate_svg.append('line')
5147 .style("stroke", color)
5148 .style("stroke-width", 5)
5149 .attr("x1", current_col_val)
5151 .attr("x2", current_col_val)
5152 .attr("y2", manage_drone_imagery_standard_process_image_height);
5153 current_col_val = current_col_val + col_line_width;
5155 for (var i=0; i<number_col_lines; i++) {
5156 manage_drone_imagery_standard_process_rotate_svg.append('line')
5157 .style("stroke", color)
5158 .style("stroke-width", 5)
5160 .attr("y1", current_row_val)
5161 .attr("x2", manage_drone_imagery_standard_process_image_width)
5162 .attr("y2", current_row_val);
5163 current_row_val = current_row_val + row_line_width;
5167 jQuery('#drone_imagery_rotate_stitched_submit').click(function() {
5168 var rotate_stitched_image_degrees_text = jQuery('#drone_imagery_rotate_degrees_input').val();
5169 if (rotate_stitched_image_degrees_text == '') {
5170 alert('Please give a number of degrees first! Can be a decimal amount.');
5173 if (isNaN(rotate_stitched_image_degrees_text)) {
5174 alert('Please give a number of degrees first! Can be a decimal amount.');
5177 rotate_stitched_image_degrees = parseFloat(rotate_stitched_image_degrees_text);
5179 url : '/api/drone_imagery/rotate_image?image_id='+rotate_stitched_image_id+'&drone_run_band_project_id='+rotate_drone_run_band_project_id+'&angle='+rotate_stitched_image_degrees,
5180 beforeSend: function() {
5181 jQuery("#working_modal").modal("show");
5183 success: function(response){
5184 console.log(response);
5185 jQuery("#working_modal").modal("hide");
5188 error: function(response){
5189 jQuery("#working_modal").modal("hide");
5190 alert('Error saving rotated image image!')
5196 // Image Cropping JS
5200 var stitched_image_id;
5201 var rotated_stitched_image_id;
5203 var drone_run_project_id;
5204 var drone_run_band_project_id;
5205 var crop_points = [];
5206 var crop_display_points = [];
5207 var dronecroppingImg;
5209 jQuery(document).on('click', 'button[name="project_drone_imagery_crop_image"]', function() {
5210 trial_id = jQuery(this).data('field_trial_id');
5211 stitched_image_id = jQuery(this).data('stitched_image_id');
5212 stitched_image = jQuery(this).data('stitched_image');
5213 drone_run_project_id = jQuery(this).data('drone_run_project_id');
5214 drone_run_band_project_id = jQuery(this).data('drone_run_band_project_id');
5215 rotated_stitched_image_id = jQuery(this).data('rotated_stitched_image_id');
5217 get_select_box('drone_imagery_parameter_select','plot_polygons_previously_saved_image_cropping_templates', {'name':'drone_imagery_previously_saved_image_cropping_select', 'id':'drone_imagery_previously_saved_image_cropping_select', 'empty':1, 'field_trial_id':trial_id, 'parameter':'image_cropping' });
5219 showManageDroneImagerySection('manage_drone_imagery_crop_div');
5221 showCropImageStart(rotated_stitched_image_id, 'drone_imagery_crop_original_stitched_div', 'manage_drone_imagery_crop_load_div');
5224 function showCropImageStart(rotated_stitched_image_id, canvas_div_id, load_div_id) {
5226 crop_display_points = [];
5228 url : '/api/drone_imagery/get_image?image_id='+rotated_stitched_image_id,
5229 beforeSend: function() {
5230 jQuery("#working_modal").modal("show");
5232 success: function(response){
5233 console.log(response);
5234 jQuery("#working_modal").modal("hide");
5236 var canvas = document.getElementById(canvas_div_id);
5237 ctx = canvas.getContext('2d');
5238 var image = new Image();
5239 image.onload = function () {
5240 canvas.width = this.naturalWidth;
5241 canvas.height = this.naturalHeight;
5242 ctx.drawImage(this, 0, 0);
5243 jQuery('#'+load_div_id).hide();
5245 image.src = response.image_url;
5246 dronecroppingImg = canvas;
5247 dronecroppingImg.onmousedown = GetCoordinatesCroppedImage;
5249 error: function(response){
5250 jQuery("#working_modal").modal("hide");
5251 alert('Error retrieving image!')
5256 function FindPosition(oElement) {
5257 if(typeof( oElement.offsetParent ) != "undefined") {
5258 for(var posX = 0, posY = 0; oElement; oElement = oElement.offsetParent) {
5259 posX += oElement.offsetLeft;
5260 posY += oElement.offsetTop;
5262 return [ posX, posY ];
5264 return [ oElement.x, oElement.y ];
5268 function GetCoordinatesCroppedImage(e) {
5272 ImgPos = FindPosition(dronecroppingImg);
5273 if (!e) var e = window.event;
5274 if (e.pageX || e.pageY) {
5278 else if (e.clientX || e.clientY) {
5279 PosX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
5280 PosY = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
5282 PosX = PosX - ImgPos[0];
5283 PosY = PosY - ImgPos[1];
5285 if (drone_imagery_standard_process_plot_polygon_click_type == 'standard_process_raw_images_paste_polygon') {
5286 plotPolygonsTemplatePasteRawImage(PosX, PosY, manage_drone_imagery_standard_process_raw_images_polygon);
5287 drone_imagery_standard_process_plot_polygon_click_type = '';
5289 else if (drone_imagery_standard_process_plot_polygon_click_type == 'standard_process_raw_images_paste_previous_polygon') {
5290 manage_drone_imagery_standard_process_raw_images_drone_imagery_plot_polygons_new = {};
5291 var manage_drone_imagery_standard_process_raw_images_previous_polygon_template = JSON.parse(decodeURI(manage_drone_imagery_standard_process_raw_images_previous_polygon));
5293 manage_drone_imagery_standard_process_raw_images_previous_polygon = [];
5294 for (var index in manage_drone_imagery_standard_process_raw_images_previous_polygon_template) {
5295 if (manage_drone_imagery_standard_process_raw_images_previous_polygon_template.hasOwnProperty(index)) {
5296 manage_drone_imagery_standard_process_raw_images_previous_polygon.push(manage_drone_imagery_standard_process_raw_images_previous_polygon_template[index]);
5299 console.log(manage_drone_imagery_standard_process_raw_images_previous_polygon);
5301 var PosX_shift = manage_drone_imagery_standard_process_raw_images_previous_polygon[0][0]['x']-PosX;
5302 var PosY_shift = manage_drone_imagery_standard_process_raw_images_previous_polygon[0][0]['y']-PosY;
5304 for (var i=0; i<manage_drone_imagery_standard_process_raw_images_previous_polygon.length; i++) {
5305 plot_polygons_ind_4_points = manage_drone_imagery_standard_process_raw_images_previous_polygon[i];
5306 plot_polygons_display_points = plot_polygons_ind_4_points;
5307 if (plot_polygons_display_points.length == 4) {
5308 plot_polygons_display_points.push(plot_polygons_ind_4_points[0]);
5310 console.log(plot_polygons_display_points);
5311 var plot_polygons_display_points_shifted = [];
5312 for (var j=0; j<plot_polygons_display_points.length; j++) {
5313 plot_polygons_display_points_shifted.push({'x':plot_polygons_display_points[j]['x']-PosX_shift, 'y':plot_polygons_display_points[j]['y']-PosY_shift});
5315 plot_polygons_display_points = plot_polygons_display_points_shifted;
5316 drawPolyline(plot_polygons_display_points);
5317 drawWaypoints(plot_polygons_display_points, i, 0);
5318 drone_imagery_plot_generated_polygons[i] = plot_polygons_display_points;
5319 manage_drone_imagery_standard_process_raw_images_drone_imagery_plot_polygons_new[i] = plot_polygons_display_points;
5320 drone_imagery_plot_polygons_display[i] = plot_polygons_display_points;
5323 crop_points = manage_drone_imagery_standard_process_raw_images_drone_imagery_plot_polygons_new;
5325 var table_html = '<table class="table table-bordered table-hover"><thead><tr><th>Generated Index</th><th>Plot Number</th></tr></thead><tbody>';
5326 for (var gen_index in manage_drone_imagery_standard_process_raw_images_drone_imagery_plot_polygons_new) {
5327 if (manage_drone_imagery_standard_process_raw_images_drone_imagery_plot_polygons_new.hasOwnProperty(gen_index)) {
5328 table_html = table_html + '<tr><td>'+gen_index+'</td><td><input type="text" class="form-control" placeholder="e.g. 1001" name="manage_drone_imagery_standard_process_raw_images_given_plot_number" data-generated_index="'+gen_index+'"></td></tr>';
5331 table_html = table_html + '</tbody></table>';
5333 jQuery('#drone_imagery_standard_process_raw_images_polygon_assign_table').html(table_html);
5335 drone_imagery_standard_process_plot_polygon_click_type = '';
5338 if (crop_points.length < 4){
5339 crop_points.push({x:PosX, y:PosY});
5340 crop_display_points.push({x:PosX, y:PosY});
5342 crop_display_points.push({x:PosX, y:PosY});
5343 console.log(crop_points);
5345 if (crop_display_points.length > 5){
5347 crop_display_points = [];
5349 drawPolyline(crop_display_points);
5350 drawWaypoints(crop_display_points, undefined, 0);
5354 function drawPolyline(points){
5355 if (points.length == 4) {
5356 points.push(points[0]);
5358 for(var i=0;i<points.length;i++){
5360 ctx.moveTo(points[0].x,points[0].y);
5361 for(var i=1;i<points.length;i++){
5362 ctx.lineTo(points[i].x,points[i].y);
5364 ctx.strokeStyle='blue';
5370 function drawWaypoints(points, label, random_factor){
5371 var plot_polygon_random_number = Math.random() * random_factor;
5372 if (points.length > 0 && label != undefined) {
5373 if (drone_imagery_plot_polygons_removed_numbers.includes(label)) {
5374 ctx.font = "bold 18px Arial";
5375 ctx.fillStyle = 'blue';
5376 ctx.fillText('NA', points[0].x + 3, points[0].y + 14 + plot_polygon_random_number);
5378 ctx.font = "bold 18px Arial";
5379 ctx.fillStyle = 'red';
5380 ctx.fillText(label, parseInt(points[0].x) + 3, parseInt(points[0].y) + 14 + plot_polygon_random_number);
5381 //ctx.fillText(label.toString().substring(label.length - 3), points[0].x + 3, points[0].y + 14 + plot_polygon_random_number);
5384 for(var i=0;i<points.length;i++){
5386 ctx.arc(points[i].x,points[i].y,4,0,Math.PI*2);
5388 ctx.strokeStyle='black';
5391 ctx.fillStyle='white';
5396 jQuery(document).on('click', '#drone_imagery_crop_stitched_submit', function(){
5398 url : '/api/drone_imagery/crop_image?image_id='+rotated_stitched_image_id+'&polygon='+JSON.stringify(crop_points)+'&drone_run_band_project_id='+drone_run_band_project_id,
5399 beforeSend: function() {
5400 jQuery("#working_modal").modal("show");
5402 success: function(response){
5403 console.log(response);
5404 jQuery("#working_modal").modal("hide");
5407 error: function(response){
5408 jQuery("#working_modal").modal("hide");
5409 alert('Error cropping image!')
5414 jQuery(document).on('click', '#drone_imagery_cropping_use_previous_cropping', function() {
5415 var plot_polygons_use_previously_saved_cropping = jQuery('#drone_imagery_previously_saved_image_cropping_select').val();
5417 url : '/api/drone_imagery/retrieve_parameter_template?plot_polygons_template_projectprop_id='+plot_polygons_use_previously_saved_cropping,
5418 success: function(response){
5419 console.log(response);
5421 url : '/api/drone_imagery/crop_image?image_id='+rotated_stitched_image_id+'&polygon='+JSON.stringify(response.parameter[0])+'&drone_run_band_project_id='+drone_run_band_project_id,
5422 beforeSend: function() {
5423 jQuery("#working_modal").modal("show");
5425 success: function(response){
5426 console.log(response);
5427 jQuery("#working_modal").modal("hide");
5430 error: function(response){
5431 jQuery("#working_modal").modal("hide");
5432 alert('Error cropping image!')
5436 error: function(response){
5437 alert('Error retrieving saved cropping template!');
5447 var gridData = new Array();
5449 jQuery(document).on('click', 'button[name="project_drone_imagery_denoise"]', function() {
5450 var trial_id = jQuery(this).data('field_trial_id');
5451 var drone_run_project_id = jQuery(this).data('drone_run_project_id');
5452 var drone_run_band_project_id = jQuery(this).data('drone_run_band_project_id');
5453 var cropped_stitched_image_id = jQuery(this).data('cropped_stitched_image_id');
5454 var stitched_image = jQuery(this).data('stitched_image');
5455 var cropped_stitched_image = jQuery(this).data('cropped_stitched_image');
5458 url : '/api/drone_imagery/denoise?image_id='+cropped_stitched_image_id+'&drone_run_band_project_id='+drone_run_band_project_id,
5459 beforeSend: function() {
5460 jQuery("#working_modal").modal("show");
5462 success: function(response){
5463 console.log(response);
5464 jQuery("#working_modal").modal("hide");
5467 error: function(response){
5468 jQuery("#working_modal").modal("hide");
5469 alert('Error denoising image!')
5476 //Define Plot Polygons JS
5480 var background_image_url;
5481 var background_image_width;
5482 var background_image_height;
5483 var plot_polygons_display_points = [];
5484 var plot_polygons_ind_points = [];
5485 var plot_polygons_ind_4_points = [];
5486 var drone_imagery_plot_polygons = {};
5487 var drone_imagery_plot_generated_polygons = {};
5488 var drone_imagery_plot_polygons_display = {};
5489 var plot_polygons_generated_polygons = [];
5490 var drone_imagery_plot_polygons_removed_numbers = [];
5491 var field_trial_layout_response = {};
5492 var plot_polygon_name;
5493 var plotpolygonsImg;
5494 var drone_imagery_plot_polygons_available_stock_names = [];
5496 var cropped_stitched_image_id;
5497 var denoised_stitched_image_id;
5498 var background_removed_stitched_image_id;
5499 var drone_run_project_id;
5500 var drone_run_project_name;
5501 var drone_run_band_project_id;
5502 var assign_plot_polygons_type;
5504 jQuery(document).on('click', 'button[name="project_drone_imagery_plot_polygons"]', function(){
5505 trial_id = jQuery(this).data('field_trial_id');
5506 cropped_stitched_image_id = jQuery(this).data('cropped_stitched_image_id');
5507 denoised_stitched_image_id = jQuery(this).data('denoised_stitched_image_id');
5508 background_removed_stitched_image_id = jQuery(this).data('background_removed_stitched_image_id');
5509 drone_run_project_id = jQuery(this).data('drone_run_project_id');
5510 drone_run_project_name = jQuery(this).data('drone_run_project_name');
5511 drone_run_band_project_id = jQuery(this).data('drone_run_band_project_id');
5512 assign_plot_polygons_type = jQuery(this).data('assign_plot_polygons_type');
5514 get_select_box('drone_imagery_parameter_select','plot_polygons_previously_saved_plot_polygon_templates', {'empty':1, 'field_trial_id':trial_id, 'parameter':'plot_polygons' });
5516 plot_polygons_display_points = [];
5517 plot_polygons_ind_points = [];
5518 plot_polygons_ind_4_points = [];
5519 drone_imagery_plot_polygons = {};
5520 drone_imagery_plot_generated_polygons = {};
5521 drone_imagery_plot_polygons_display = {};
5522 field_trial_layout_response = {};
5524 jQuery('#manage_drone_imagery_plot_polygons_div_title').html('<center><h4>'+drone_run_project_name+'</h4></center>');
5526 showManageDroneImagerySection('manage_drone_imagery_plot_polygons_div');
5528 showPlotPolygonStart(background_removed_stitched_image_id, drone_run_band_project_id, 'drone_imagery_plot_polygons_original_stitched_div', 'drone_imagery_plot_polygons_top_section', 'manage_drone_imagery_plot_polygons_load_div', 0);
5530 showPlotPolygonTableStart(trial_id, 'drone_imagery_trial_layout_div', 'drone_imagery_layout_table');
5533 function showPlotPolygonTableStart(trial_id, layout_div, layout_table){
5535 url : '/ajax/breeders/trial/'+trial_id+'/layout_table',
5536 beforeSend: function() {
5537 jQuery("#working_modal").modal("show");
5539 success: function(response){
5540 console.log(response);
5541 field_trial_layout_response = response;
5542 var layout = field_trial_layout_response.output;
5543 for (var i=1; i<layout.length; i++) {
5544 drone_imagery_plot_polygons_available_stock_names.push(layout[i][0]);
5546 droneImageryDrawLayoutTable(response, {}, layout_div, layout_table);
5547 jQuery("#working_modal").modal("hide");
5549 error: function(response){
5550 jQuery("#working_modal").modal("hide");
5551 alert('Error retrieving trial layout and design!')
5556 function showPlotPolygonStart(background_removed_stitched_image_id, drone_run_band_project_id, canvas_div_id, info_div_id, load_div_id, hover_plot_layout){
5558 // url : '/api/drone_imagery/get_contours?image_id='+background_removed_stitched_image_id+'&drone_run_band_project_id='+drone_run_band_project_id,
5559 // beforeSend: function() {
5560 // jQuery("#working_modal").modal("show");
5562 // success: function(response){
5563 // console.log(response);
5564 // jQuery("#working_modal").modal("hide");
5565 // background_image_url = response.image_url;
5567 // background_image_width = response.image_width;
5568 // background_image_height = response.image_height;
5570 // var top_section_html = '<h4>Total Image Width: '+response.image_width+'px. Total Image Height: '+response.image_height+'px.</h4>';
5571 // top_section_html = top_section_html + '<button class="btn btn-default btn-sm" id="drone_imagery_plot_polygons_switch" data-image_url="'+response.image_url+'" data-image_fullpath="'+response.image_fullpath+'" data-contours_image_url="'+response.contours_image_url+'" data-contours_image_fullpath="'+response.contours_image_fullpath+'">Switch Image View</button><br/><br/>';
5572 // jQuery('#'+info_div_id).html(top_section_html);
5574 // canvas = document.getElementById(canvas_div_id);
5575 // ctx = canvas.getContext('2d');
5576 // draw_canvas_image(background_image_url, 0);
5578 // plotpolygonsImg = document.getElementById(canvas_div_id);
5579 //plotpolygonsImg.onmousedown = GetCoordinatesPlotPolygons;
5580 // plotpolygonsImg.onmousedown = GetCoordinatesPlotPolygonsPoint;
5582 // jQuery('#'+load_div_id).hide();
5585 // error: function(response){
5586 // jQuery("#working_modal").modal("hide");
5587 // alert('Error retrieving contours for image!')
5592 url : '/api/drone_imagery/get_image?image_id='+background_removed_stitched_image_id,
5593 beforeSend: function() {
5594 jQuery("#working_modal").modal("show");
5596 success: function(response){
5597 console.log(response);
5598 jQuery("#working_modal").modal("hide");
5600 background_image_url = response.image_url;
5602 background_image_width = response.image_width;
5603 background_image_height = response.image_height;
5605 var top_section_html = '<h4>Total Image Width: '+response.image_width+'px. Total Image Height: '+response.image_height+'px.</h4>';
5607 jQuery('#'+info_div_id).html(top_section_html);
5609 canvas = document.getElementById(canvas_div_id);
5610 ctx = canvas.getContext('2d');
5611 draw_canvas_image(background_image_url, 0);
5613 plotpolygonsImg = document.getElementById(canvas_div_id);
5614 if (hover_plot_layout == 1) {
5615 console.log('hover plot');
5616 plotpolygonsImg.onmousemove = handleMouseMovePlotLayoutHover;
5617 plotpolygonsImg.onmousedown = handleMouseMovePlotLayoutHoverClick;
5620 //plotpolygonsImg.onmousedown = GetCoordinatesPlotPolygons;
5621 plotpolygonsImg.onmousedown = GetCoordinatesPlotPolygonsPoint;
5624 jQuery('#'+load_div_id).hide();
5626 error: function(response){
5627 jQuery("#working_modal").modal("hide");
5628 alert('Error retrieving plot polygon image!')
5633 var handleMouseMovePlotLayoutHoverPlotInfo = {};
5634 var handleMouseMovePlotLayoutHoverTraitId;
5635 var handleMouseMovePlotLayoutHoverPlotPolygonsSeen = {};
5636 function handleMouseMovePlotLayoutHover(e){
5640 ImgPos = FindPosition(plotpolygonsImg);
5641 if (!e) var e = window.event;
5642 if (e.pageX || e.pageY) {
5646 else if (e.clientX || e.clientY) {
5647 PosX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
5648 PosY = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
5650 PosX = PosX - ImgPos[0];
5651 PosY = PosY - ImgPos[1];
5653 //ctx.clearRect(0,0,background_image_width,background_image_height);
5655 var hovering_plot_name;
5656 for (key in drone_imagery_plot_polygons_display) {
5657 if (drone_imagery_plot_polygons_display.hasOwnProperty(key)) {
5658 var s = drone_imagery_plot_polygons_display[key];
5661 ctx.moveTo(s[0].x,s[0].y);
5662 for(var i=1;i<s.length;i++){
5663 ctx.lineTo(s[i].x,s[i].y);
5667 if (ctx.isPointInPath(PosX,PosY)){
5668 hovering_plot_name = key;
5673 //draw_canvas_image(background_image_url, 0);
5675 for (key in drone_imagery_plot_polygons_display) {
5676 if (drone_imagery_plot_polygons_display.hasOwnProperty(key)) {
5678 if (key == hovering_plot_name && drone_imagery_plot_polygons_display_plot_field_layout.hasOwnProperty(key)) {
5679 var plot_info = drone_imagery_plot_polygons_display_plot_field_layout[key];
5680 handleMouseMovePlotLayoutHoverPlotInfo = plot_info;
5683 if (!handleMouseMovePlotLayoutHoverPlotPolygonsSeen.hasOwnProperty(key)) {
5684 var plot_polygons_display_points_again = drone_imagery_plot_polygons_display[key];
5685 drawPolyline(plot_polygons_display_points_again);
5686 drawWaypoints(plot_polygons_display_points_again, key, undefined);
5687 handleMouseMovePlotLayoutHoverPlotPolygonsSeen[key] = 1;
5693 function handleMouseMovePlotLayoutHoverClick(e) {
5694 console.log(handleMouseMovePlotLayoutHoverPlotInfo);
5695 var html = "<center><h4>Go To <a href='/stock/"+handleMouseMovePlotLayoutHoverPlotInfo.plot_id+"/view' target='_blank'>"+handleMouseMovePlotLayoutHoverPlotInfo.plot_name+" Detail Page</a></h4></center><hr>";
5697 html = html + '<div class="form-horizontal"><div class="form-group"><label class="col-sm-3 control-label">Select a Trait:</label><div class="col-sm-9" ><div id="drone_imagery_time_series_hover_trait_select_div"></div></div></div></div>';
5699 jQuery('#manage_drone_imagery_field_trial_time_series_popup_content').html(html);
5701 get_select_box('traits', 'drone_imagery_time_series_hover_trait_select_div', {'id':'drone_imagery_time_series_hover_trait_select_id', 'name':'drone_imagery_time_series_hover_trait_select_id', 'stock_id':handleMouseMovePlotLayoutHoverPlotInfo.accession_id, 'empty':1});
5703 jQuery('#manage_drone_imagery_field_trial_time_series_popup_content_figure1').html("");
5704 jQuery('#manage_drone_imagery_field_trial_time_series_popup_content_figure2').html("");
5705 jQuery('#manage_drone_imagery_field_trial_time_series_popup_content_figure3').html("");
5707 jQuery('#manage_drone_imagery_field_trial_time_series_popup').modal('show');
5710 jQuery(document).on('change', '#drone_imagery_time_series_hover_trait_select_id', function() {
5711 handleMouseMovePlotLayoutHoverTraitId = jQuery(this).val();
5713 jQuery('#manage_drone_imagery_field_trial_time_series_popup_content_figure1').html("");
5714 jQuery('#manage_drone_imagery_field_trial_time_series_popup_content_figure2').html("");
5715 jQuery('#manage_drone_imagery_field_trial_time_series_popup_content_figure3').html("");
5718 url : '/api/drone_imagery/accession_phenotype_histogram?accession_id='+handleMouseMovePlotLayoutHoverPlotInfo.accession_id+'&trait_id='+handleMouseMovePlotLayoutHoverTraitId+'&plot_id='+handleMouseMovePlotLayoutHoverPlotInfo.plot_id+'&figure_type=all_pheno_of_this_accession',
5719 beforeSend: function() {
5720 jQuery("#working_modal").modal("show");
5722 success: function(response){
5723 console.log(response);
5724 jQuery("#working_modal").modal("hide");
5726 if (response.error) {
5727 alert(response.error);
5731 jQuery('#manage_drone_imagery_field_trial_time_series_popup_content_figure2').html("<div class='well well-sm'><center><h3>Performance of accession: <a href='/stock/"+handleMouseMovePlotLayoutHoverPlotInfo.accession_id+"/view' target=_blank>"+handleMouseMovePlotLayoutHoverPlotInfo.accession_name+"</a> in the current field plot compared to all phenotypes of this accession</h3><p>The mean value of this accession is in green.<p><p>The value of the current field plot is drawn in red.</p><img src='"+response.figure+"' width='500' height='400'></center></div>");
5733 error: function(response){
5734 jQuery("#working_modal").modal("hide");
5735 alert('Error retrieving accession phenotype plot!')
5740 url : '/api/drone_imagery/accession_phenotype_histogram?field_trial_id='+manage_drone_imagery_field_trial_time_series_field_trial_id+'&trait_id='+handleMouseMovePlotLayoutHoverTraitId+'&plot_id='+handleMouseMovePlotLayoutHoverPlotInfo.plot_id+'&accession_id='+handleMouseMovePlotLayoutHoverPlotInfo.accession_id+'&figure_type=all_pheno_of_this_trial',
5741 beforeSend: function() {
5742 jQuery("#working_modal").modal("show");
5744 success: function(response){
5745 console.log(response);
5746 jQuery("#working_modal").modal("hide");
5748 if (response.error) {
5749 alert(response.error);
5753 jQuery('#manage_drone_imagery_field_trial_time_series_popup_content_figure1').html("<div class='well well-sm'><center><h3>Performance of accession: <a href='/stock/"+handleMouseMovePlotLayoutHoverPlotInfo.accession_id+"/view' target=_blank>"+handleMouseMovePlotLayoutHoverPlotInfo.accession_name+"</a> in the current field plot compared to all other phenotypes in this field trial</h3><p>The mean value of this accession is in green.<p><p>The value of the current field plot is drawn in red</p><img src='"+response.figure+"' width='500' height='400'></center></div>");
5755 error: function(response){
5756 jQuery("#working_modal").modal("hide");
5757 alert('Error retrieving accession phenotype plot for field trial!')
5762 url : '/api/drone_imagery/accession_phenotype_histogram?trait_id='+handleMouseMovePlotLayoutHoverTraitId+'&plot_id='+handleMouseMovePlotLayoutHoverPlotInfo.plot_id+'&accession_id='+handleMouseMovePlotLayoutHoverPlotInfo.accession_id+'&figure_type=all_pheno_in_database',
5763 beforeSend: function() {
5764 jQuery("#working_modal").modal("show");
5766 success: function(response){
5767 console.log(response);
5768 jQuery("#working_modal").modal("hide");
5770 if (response.error) {
5771 alert(response.error);
5775 jQuery('#manage_drone_imagery_field_trial_time_series_popup_content_figure3').html("<div class='well well-sm'><center><h3>Performance of accession: <a href='/stock/"+handleMouseMovePlotLayoutHoverPlotInfo.accession_id+"/view' target=_blank>"+handleMouseMovePlotLayoutHoverPlotInfo.accession_name+"</a> in the current plot compared to all other phenotypes in the database</h3><p>The mean value of this accession is in green.<p><p>The value of the current field plot is drawn in red</p><img src='"+response.figure+"' width='500' height='400'></center></div>");
5777 error: function(response){
5778 jQuery("#working_modal").modal("hide");
5779 alert('Error retrieving accession phenotype plot for field trial!')
5784 var drone_imagery_plot_polygon_click_type = '';
5785 jQuery('#drone_imagery_plot_polygons_top_left_click').click(function(){
5786 alert('Now click the top left corner of your field on the image below.');
5787 drone_imagery_plot_polygon_click_type = 'top_left';
5789 jQuery('#drone_imagery_plot_polygons_top_right_click').click(function(){
5790 alert('Now click the top right corner of your field on the image below.');
5791 drone_imagery_plot_polygon_click_type = 'top_right';
5793 jQuery('#drone_imagery_plot_polygons_bottom_left_click').click(function(){
5794 alert('Now click the bottom left corner of your field on the image below.');
5795 drone_imagery_plot_polygon_click_type = 'bottom_left';
5797 jQuery('#drone_imagery_plot_polygons_bottom_right_click').click(function(){
5798 alert('Now click the bottom right corner of your field on the image below.');
5799 drone_imagery_plot_polygon_click_type = 'bottom_right';
5801 jQuery(document).on('click', '#drone_imagery_plot_polygons_get_distance', function(){
5802 alert('Click on two points in image. The distance will be returned.');
5803 drone_imagery_plot_polygon_click_type = 'get_distance';
5807 var drone_imagery_plot_polygon_current_background_toggle = 1;
5808 jQuery(document).on('click', '#drone_imagery_plot_polygons_switch', function(){
5810 if (drone_imagery_plot_polygon_current_background_toggle == 0) {
5811 drone_imagery_plot_polygon_current_background_toggle = 1;
5812 image_url = jQuery(this).data('contours_image_url');
5813 } else if (drone_imagery_plot_polygon_current_background_toggle == 1) {
5814 drone_imagery_plot_polygon_current_background_toggle = 0;
5815 image_url = jQuery(this).data('image_url');
5817 draw_canvas_image(image_url, plot_polygons_total_height_generated/plot_polygons_num_rows_generated);
5822 jQuery('#plot_polygons_use_previously_saved_template').click(function() {
5823 var plot_polygons_use_previously_saved_template = jQuery('#drone_imagery_plot_polygon_select').val();
5824 if (plot_polygons_use_previously_saved_template == '') {
5825 alert('Please select a previously saved template before trying to apply it. If there is not a template listed, then you can create one using the templating tool above.');
5830 url : '/api/drone_imagery/retrieve_parameter_template?plot_polygons_template_projectprop_id='+plot_polygons_use_previously_saved_template,
5831 success: function(response){
5832 console.log(response);
5834 drone_imagery_plot_polygons_display = response.parameter;
5835 drone_imagery_plot_polygons = response.parameter;
5837 draw_canvas_image(background_image_url, 0);
5838 droneImageryDrawLayoutTable(field_trial_layout_response, drone_imagery_plot_polygons, 'drone_imagery_trial_layout_div', 'drone_imagery_layout_table');
5839 droneImageryRectangleLayoutTable(drone_imagery_plot_polygons, 'drone_imagery_generated_polygons_div', 'drone_imagery_plot_polygons_generated_assign', 'drone_imagery_plot_polygons_submit_bottom');
5841 error: function(response){
5842 alert('Error retrieving plot polygons template!');
5848 var plot_polygons_num_rows_generated;
5849 var plot_polygons_num_cols_generated;
5850 var plot_polygons_number_generated;
5851 var plot_polygons_total_height_generated;
5852 var plot_polygons_template_dimensions = [];
5854 jQuery('#drone_imagery_plot_polygons_rectangles_apply').click(function() {
5855 plot_polygons_display_points = [];
5856 plot_polygons_ind_points = [];
5857 plot_polygons_ind_4_points = [];
5859 var num_rows_val = jQuery('#drone_imagery_plot_polygons_num_rows').val();
5860 var num_cols_val = jQuery('#drone_imagery_plot_polygons_num_cols').val();
5861 var section_top_row_left_offset_val = jQuery('#drone_imagery_plot_polygons_top_row_left_offset').val();
5862 var section_bottom_row_left_offset_val = jQuery('#drone_imagery_plot_polygons_bottom_row_left_offset').val();
5863 var section_left_column_top_offset_val = jQuery('#drone_imagery_plot_polygons_left_column_top_offset').val();
5864 var section_left_column_bottom_offset_val = jQuery('#drone_imagery_plot_polygons_left_column_bottom_offset').val();
5865 var section_top_row_right_offset_val = jQuery('#drone_imagery_plot_polygons_top_row_right_offset').val();
5866 var section_right_column_bottom_offset_val = jQuery('#drone_imagery_plot_polygons_right_col_bottom_offset').val();
5868 plotPolygonsRectanglesApply(num_rows_val, num_cols_val, section_top_row_left_offset_val, section_bottom_row_left_offset_val, section_left_column_top_offset_val, section_left_column_bottom_offset_val, section_top_row_right_offset_val, section_right_column_bottom_offset_val, 'drone_imagery_generated_polygons_div', 'drone_imagery_generated_polygons_table', 'drone_imagery_plot_polygons_generated_assign', 'drone_imagery_plot_polygons_submit_bottom', 'drone_imagery_plot_polygons_active_templates');
5870 plotPolygonManualAssignPlotNumberTableStandard('drone_imagery_standard_process_generated_polygons_table', 'drone_imagery_standard_process_generated_polygons_table_id', 'drone_imagery_standard_process_generated_polygons_table_input', 'drone_imagery_standard_process_generated_polygons_table_input_generate_button', 'drone_imagery_standard_process_plot_polygons_submit_bottom');
5873 function plotPolygonManualAssignPlotNumberTableStandard(div_id, table_id, input_name, generate_assign_button, save_button) {
5874 var html = '<div class="panel panel-default"><div class="panel-body">';
5875 html = html + '<table class="table table-bordered table-hover" id="'+table_id+'"><thead><tr><th>Polygon Number</th><th>Plot Number</th></tr></thead><tbody>';
5876 for(var i=0; i<plot_polygons_generated_polygons.length; i++) {
5877 html = html + '<tr><td>'+i+'</td><td><input type="number" class="form-control" data-polygon_number="'+i+'" name="'+input_name+'" /></td></tr>';
5879 html = html + '</tbody></table><hr>';
5880 html = html + '<button class="btn btn-primary" id="'+generate_assign_button+'">Generate Assignments From Manual Input (Does Not Save)</button> <button class="btn btn-primary" name="'+save_button+'">Finish and Save Polygons To Plots</button></div></div>';
5882 jQuery('#'+div_id).html(html);
5883 jQuery('#'+table_id).DataTable({'paging':false});
5886 function plotPolygonsRectanglesApply(num_rows_val, num_cols_val, section_top_row_left_offset_val, section_bottom_row_left_offset_val, section_left_column_top_offset_val, section_left_column_bottom_offset_val, section_top_row_right_offset_val, section_right_column_bottom_offset_val, plot_polygons_assignment_info, plot_polygons_assignment_table, plot_polygons_generate_assignment_button, plot_polygon_assignment_submit_button, drone_imagery_plot_polygons_active_templates) {
5887 if (num_rows_val == ''){
5888 alert('Please give the number of rows!');
5891 if (num_cols_val == ''){
5892 alert('Please give the number of columns!');
5895 if (section_top_row_left_offset_val == ''){
5896 alert('Please give the top-most rows left margin! This can be 0 if there is no offset.');
5899 if (section_bottom_row_left_offset_val == ''){
5900 alert('Please give the bottom-most rows left margin! This can be 0 if there is no offset.');
5903 if (section_left_column_top_offset_val == ''){
5904 alert('Please give the left-most columns top margin! This can be 0 if there is no offset.');
5907 if (section_left_column_bottom_offset_val == ''){
5908 alert('Please give the left-most columns bottom margin! This can be 0 if there is no offset.');
5911 if (section_top_row_right_offset_val == ''){
5912 alert('Please give the top-most rows right margin! This can be 0 if there is no offset.');
5915 if (section_right_column_bottom_offset_val == ''){
5916 alert('Please give the right-most columns bottom margin! This can be 0 if there is no offset.');
5920 plot_polygons_num_rows_generated = parseInt(num_rows_val);
5921 plot_polygons_num_cols_generated = parseInt(num_cols_val);
5923 var section_width = background_image_width;
5924 var section_height = background_image_height;
5925 var section_top_row_left_offset = parseInt(section_top_row_left_offset_val);
5926 var section_bottom_row_left_offset = parseInt(section_bottom_row_left_offset_val);
5927 var section_left_column_top_offset = parseInt(section_left_column_top_offset_val);
5928 var section_left_column_bottom_offset = parseInt(section_left_column_bottom_offset_val);
5929 var section_top_row_right_offset = parseInt(section_top_row_right_offset_val);
5930 var section_right_column_bottom_offset = parseInt(section_right_column_bottom_offset_val);
5932 var total_gradual_left_shift = section_bottom_row_left_offset - section_top_row_left_offset;
5933 var col_left_shift_increment = total_gradual_left_shift / plot_polygons_num_rows_generated;
5935 var total_gradual_vertical_shift = section_right_column_bottom_offset - section_left_column_bottom_offset;
5936 var col_vertical_shift_increment = total_gradual_vertical_shift / plot_polygons_num_cols_generated;
5938 var col_width = (section_width - section_top_row_left_offset - section_top_row_right_offset) / plot_polygons_num_cols_generated;
5939 var row_height = (section_height - section_left_column_top_offset - section_left_column_bottom_offset) / plot_polygons_num_rows_generated;
5941 var x_pos = section_top_row_left_offset;
5942 var y_pos = section_left_column_top_offset;
5945 for (var i=0; i<plot_polygons_num_rows_generated; i++) {
5946 for (var j=0; j<plot_polygons_num_cols_generated; j++) {
5947 var x_pos_val = x_pos;
5948 var y_pos_val = y_pos;
5949 plot_polygons_generated_polygons.push([
5950 {x:x_pos_val, y:y_pos_val},
5951 {x:x_pos_val + col_width, y:y_pos_val},
5952 {x:x_pos_val + col_width, y:y_pos_val + row_height},
5953 {x:x_pos_val, y:y_pos_val + row_height}
5955 x_pos = x_pos + col_width;
5956 y_pos = y_pos - col_vertical_shift_increment;
5958 x_pos = section_top_row_left_offset + (row_num * col_left_shift_increment);
5959 y_pos = y_pos + row_height + total_gradual_vertical_shift;
5960 row_num = row_num + 1;
5962 //console.log(plot_polygons_generated_polygons);
5964 plot_polygons_total_height_generated = row_height * plot_polygons_num_rows_generated;
5965 plot_polygons_number_generated = plot_polygons_generated_polygons.length;
5967 var drone_imagery_plot_polygons_new = {};
5968 var drone_imagery_plot_polygons_display_new = {};
5970 for (var i=0; i<plot_polygons_generated_polygons.length; i++) {
5971 plot_polygons_ind_4_points = plot_polygons_generated_polygons[i];
5972 plot_polygons_display_points = plot_polygons_ind_4_points;
5973 if (plot_polygons_display_points.length == 4) {
5974 plot_polygons_display_points.push(plot_polygons_ind_4_points[0]);
5976 drawPolyline(plot_polygons_display_points);
5977 drawWaypoints(plot_polygons_display_points, i, 0);
5978 drone_imagery_plot_generated_polygons[i] = plot_polygons_ind_4_points;
5979 drone_imagery_plot_polygons_new[i] = plot_polygons_ind_4_points;
5980 drone_imagery_plot_polygons_display[i] = plot_polygons_display_points;
5981 drone_imagery_plot_polygons_display_new[i] = plot_polygons_display_points;
5984 plot_polygons_template_dimensions.push({
5985 'num_rows':plot_polygons_num_rows_generated,
5986 'num_cols':plot_polygons_num_cols_generated,
5987 'total_plot_polygons':plot_polygons_num_rows_generated*plot_polygons_num_cols_generated,
5988 'plot_polygons':drone_imagery_plot_polygons_new,
5989 'plot_polygons_display':drone_imagery_plot_polygons_display_new
5992 droneImageryDrawPlotPolygonActiveTemplatesTable(drone_imagery_plot_polygons_active_templates, plot_polygons_template_dimensions);
5994 droneImageryRectangleLayoutTable(drone_imagery_plot_generated_polygons, plot_polygons_assignment_info, plot_polygons_generate_assignment_button, plot_polygon_assignment_submit_button);
5997 function plotPolygonsTemplatePaste(posx, posy, plot_polygon_template_id, plot_polygons_assignment_info, plot_polygons_generate_assignment_button, plot_polygon_assignment_submit_button, drone_imagery_plot_polygons_active_templates) {
5998 var plot_polygon_template_to_paste = plot_polygons_template_dimensions[plot_polygon_template_id];
6000 var plot_polygons_previous_plot_polygons = plot_polygon_template_to_paste['plot_polygons'];
6001 plot_polygons_num_rows_generated = plot_polygon_template_to_paste['num_rows'];
6002 plot_polygons_num_cols_generated = plot_polygon_template_to_paste['num_cols'];
6004 var section_width = background_image_width;
6005 var section_height = background_image_height;
6007 var plot_polygon_top_left_position = plot_polygons_previous_plot_polygons[0][0];
6008 var plot_polygon_template_paste_x_diff = plot_polygon_top_left_position['x'] - posx;
6009 var plot_polygon_template_paste_y_diff = plot_polygon_top_left_position['y'] - posy;
6011 for (var i in plot_polygons_previous_plot_polygons) {
6012 plot_polygons_generated_polygons.push([
6013 {x:plot_polygons_previous_plot_polygons[i][0]['x'] - plot_polygon_template_paste_x_diff, y:plot_polygons_previous_plot_polygons[i][0]['y']- plot_polygon_template_paste_y_diff},
6014 {x:plot_polygons_previous_plot_polygons[i][1]['x'] - plot_polygon_template_paste_x_diff, y:plot_polygons_previous_plot_polygons[i][1]['y'] - plot_polygon_template_paste_y_diff},
6015 {x:plot_polygons_previous_plot_polygons[i][2]['x'] - plot_polygon_template_paste_x_diff, y:plot_polygons_previous_plot_polygons[i][2]['y'] - plot_polygon_template_paste_y_diff},
6016 {x:plot_polygons_previous_plot_polygons[i][3]['x'] - plot_polygon_template_paste_x_diff, y:plot_polygons_previous_plot_polygons[i][3]['y'] - plot_polygon_template_paste_y_diff}
6020 plot_polygons_number_generated = plot_polygons_generated_polygons.length;
6021 console.log(plot_polygons_generated_polygons);
6023 var drone_imagery_plot_polygons_new = {};
6024 var drone_imagery_plot_polygons_display_new = {};
6026 for (var i=0; i<plot_polygons_generated_polygons.length; i++) {
6027 plot_polygons_ind_4_points = plot_polygons_generated_polygons[i];
6028 plot_polygons_display_points = plot_polygons_ind_4_points;
6029 if (plot_polygons_display_points.length == 4) {
6030 plot_polygons_display_points.push(plot_polygons_ind_4_points[0]);
6032 drawPolyline(plot_polygons_display_points);
6033 drawWaypoints(plot_polygons_display_points, i, 0);
6034 drone_imagery_plot_generated_polygons[i] = plot_polygons_ind_4_points;
6035 drone_imagery_plot_polygons_new[i] = plot_polygons_ind_4_points;
6036 drone_imagery_plot_polygons_display[i] = plot_polygons_display_points;
6037 drone_imagery_plot_polygons_display_new[i] = plot_polygons_display_points;
6040 plot_polygons_template_dimensions.push({
6041 'num_rows':plot_polygons_num_rows_generated,
6042 'num_cols':plot_polygons_num_cols_generated,
6043 'total_plot_polygons':plot_polygons_num_rows_generated*plot_polygons_num_cols_generated,
6044 'plot_polygons':drone_imagery_plot_polygons_new,
6045 'plot_polygons_display':drone_imagery_plot_polygons_display_new
6048 droneImageryDrawPlotPolygonActiveTemplatesTable(drone_imagery_plot_polygons_active_templates, plot_polygons_template_dimensions);
6050 droneImageryRectangleLayoutTable(drone_imagery_plot_generated_polygons, plot_polygons_assignment_info, plot_polygons_generate_assignment_button, plot_polygon_assignment_submit_button);
6053 function plotPolygonsTemplatePasteRawImage(posx, posy, polygon) {
6054 var plot_polygon_top_left_position = polygon[0];
6055 var plot_polygon_template_paste_x_diff = plot_polygon_top_left_position['x'] - posx;
6056 var plot_polygon_template_paste_y_diff = plot_polygon_top_left_position['y'] - posy;
6059 {x:polygon[0]['x'] - plot_polygon_template_paste_x_diff, y:polygon[0]['y'] - plot_polygon_template_paste_y_diff},
6060 {x:polygon[1]['x'] - plot_polygon_template_paste_x_diff, y:polygon[1]['y'] - plot_polygon_template_paste_y_diff},
6061 {x:polygon[2]['x'] - plot_polygon_template_paste_x_diff, y:polygon[2]['y'] - plot_polygon_template_paste_y_diff},
6062 {x:polygon[3]['x'] - plot_polygon_template_paste_x_diff, y:polygon[3]['y'] - plot_polygon_template_paste_y_diff}
6065 plot_polygons_ind_4_points = JSON.parse(JSON.stringify(crop_points));
6066 plot_polygons_display_points = plot_polygons_ind_4_points;
6067 if (plot_polygons_display_points.length == 4) {
6068 plot_polygons_display_points.push(plot_polygons_ind_4_points[0]);
6070 drawPolyline(plot_polygons_display_points);
6071 drawWaypoints(plot_polygons_display_points, 1, 0);
6074 function droneImageryDrawPlotPolygonActiveTemplatesTable(div_id, plot_polygons_template_dimensions){
6075 var html = '<table class="table table-bordered table-hover"><thead><tr><th>Template Number</th><th>Rows</th><th>Columns</th><th>Total Polygons</th><th>Options</th></tr></thead><tbody>';
6076 for (var i=0; i<plot_polygons_template_dimensions.length; i++) {
6077 html = html + '<tr><td>'+i+'</td><td>'+plot_polygons_template_dimensions[i]['num_rows']+'</td><td>'+plot_polygons_template_dimensions[i]['num_cols']+'</td><td>'+plot_polygons_template_dimensions[i]['total_plot_polygons']+'</td><td><button class="btn btn-sm btn-primary" name="drone_imagery_plot_polygon_template_options" data-plot_polygon_template_id="'+i+'" >Options</button></td></tr>';
6079 html = html + '</tbody></table>';
6080 jQuery('#'+div_id).html(html);
6083 var drone_imagery_current_plot_polygon_index_options_id = '';
6084 jQuery(document).on('click', 'button[name="drone_imagery_plot_polygon_template_options"]', function(){
6085 jQuery('#drone_imagery_plot_polygon_template_options_dialog').modal('show');
6086 drone_imagery_current_plot_polygon_index_options_id = jQuery(this).data('plot_polygon_template_id');
6089 jQuery('#drone_imagery_plot_polygon_template_options_paste_click').click(function(){
6090 jQuery('#drone_imagery_plot_polygon_template_options_dialog').modal('hide');
6091 alert('Click on where the top left corner of the template will be pasted.');
6092 drone_imagery_plot_polygon_click_type = 'plot_polygon_template_paste';
6095 jQuery('input[name=drone_imagery_plot_polygons_autocomplete]').autocomplete({
6096 source: drone_imagery_plot_polygons_available_stock_names
6099 jQuery(document).on('click', '#drone_imagery_plot_polygons_clear', function(){
6100 plot_polygons_display_points = [];
6101 plot_polygons_ind_points = [];
6102 plot_polygons_ind_4_points = [];
6103 drone_imagery_plot_polygons = {};
6104 drone_imagery_plot_generated_polygons = {};
6105 drone_imagery_plot_polygons_display = {};
6106 plot_polygons_generated_polygons = [];
6107 drone_imagery_plot_generated_polygons = [];
6108 plot_polygons_template_dimensions = [];
6109 drone_imagery_plot_polygons_removed_numbers = [];
6110 ctx.clearRect(0, 0, canvas.width, canvas.height);
6111 draw_canvas_image(background_image_url, 0);
6112 jQuery('#drone_imagery_generated_polygons_div').html('');
6113 droneImageryDrawLayoutTable(field_trial_layout_response, drone_imagery_plot_polygons, 'drone_imagery_trial_layout_div', 'drone_imagery_layout_table');
6114 droneImageryDrawPlotPolygonActiveTemplatesTable("drone_imagery_plot_polygons_active_templates", plot_polygons_template_dimensions);
6115 plotPolygonManualAssignPlotNumberTableStandard('drone_imagery_standard_process_generated_polygons_table', 'drone_imagery_standard_process_generated_polygons_table_id', 'drone_imagery_standard_process_generated_polygons_table_input', 'drone_imagery_standard_process_generated_polygons_table_input_generate_button', 'drone_imagery_standard_process_plot_polygons_submit_bottom');
6118 jQuery(document).on('click', '#drone_imagery_plot_polygons_clear_one', function(){
6119 jQuery('#drone_imagery_plot_polygon_remove_polygon').modal('show');
6123 jQuery("#drone_imagery_plot_polygon_remove_polygon_form").submit( function() {
6124 event.preventDefault();
6125 var polygon_number = jQuery('#drone_imagery_plot_polygon_remove_polygon_number').val();
6126 drone_imagery_plot_polygons_removed_numbers.push(polygon_number);
6127 draw_canvas_image(background_image_url, plot_polygons_total_height_generated/plot_polygons_num_rows_generated);
6128 plotPolygonManualAssignPlotNumberTableStandard('drone_imagery_standard_process_generated_polygons_table', 'drone_imagery_standard_process_generated_polygons_table_id', 'drone_imagery_standard_process_generated_polygons_table_input', 'drone_imagery_standard_process_generated_polygons_table_input_generate_button', 'drone_imagery_standard_process_plot_polygons_submit_bottom');
6132 jQuery('#drone_imagery_plot_polygon_remove_polygon_submit').click(function(){
6133 var polygon_number = jQuery('#drone_imagery_plot_polygon_remove_polygon_number').val();
6134 drone_imagery_plot_polygons_removed_numbers.push(polygon_number);
6135 draw_canvas_image(background_image_url, plot_polygons_total_height_generated/plot_polygons_num_rows_generated);
6136 plotPolygonManualAssignPlotNumberTableStandard('drone_imagery_standard_process_generated_polygons_table', 'drone_imagery_standard_process_generated_polygons_table_id', 'drone_imagery_standard_process_generated_polygons_table_input', 'drone_imagery_standard_process_generated_polygons_table_input_generate_button', 'drone_imagery_standard_process_plot_polygons_submit_bottom');
6140 function draw_canvas_image(image_url, random_scaling) {
6141 var image = new Image();
6142 image.onload = function () {
6143 canvas.width = this.naturalWidth;
6144 canvas.height = this.naturalHeight;
6145 ctx.drawImage(this, 0, 0);
6147 for (key in drone_imagery_plot_polygons_display) {
6148 if (drone_imagery_plot_polygons_display.hasOwnProperty(key)) {
6149 var plot_polygons_display_points_again = drone_imagery_plot_polygons_display[key];
6150 drawPolyline(plot_polygons_display_points_again);
6151 drawWaypoints(plot_polygons_display_points_again, key, random_scaling);
6155 image.src = image_url;
6158 function GetCoordinatesPlotPolygons(e) {
6162 ImgPos = FindPosition(plotpolygonsImg);
6163 if (!e) var e = window.event;
6164 if (e.pageX || e.pageY) {
6168 else if (e.clientX || e.clientY) {
6169 PosX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
6170 PosY = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
6172 PosX = PosX - ImgPos[0];
6173 PosY = PosY - ImgPos[1];
6174 if (plot_polygons_ind_points.length <= 4){
6175 plot_polygons_ind_points.push({x:PosX, y:PosY});
6176 plot_polygons_display_points.push({x:PosX, y:PosY});
6178 if (plot_polygons_ind_points.length == 4) {
6179 plot_polygons_ind_4_points = plot_polygons_ind_points;
6181 } else if (plot_polygons_ind_points.length > 4) {
6182 if (plot_polygons_display_points.length == 5) {
6183 jQuery('#drone_imagery_assign_plot_dialog').modal('show');
6185 plot_polygons_ind_points = [];
6187 drawPolyline(plot_polygons_display_points);
6188 drawWaypoints(plot_polygons_display_points, undefined, 0);
6191 var plot_polygons_get_distance_point_1x = '';
6192 var plot_polygons_get_distance_point_1y = '';
6194 function GetCoordinatesPlotPolygonsPoint(e) {
6198 ImgPos = FindPosition(plotpolygonsImg);
6199 if (!e) var e = window.event;
6200 if (e.pageX || e.pageY) {
6204 else if (e.clientX || e.clientY) {
6205 PosX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
6206 PosY = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
6208 PosX = PosX - ImgPos[0];
6209 PosY = PosY - ImgPos[1];
6211 if (drone_imagery_plot_polygon_click_type == '' && drone_imagery_standard_process_plot_polygon_click_type == '') {
6212 alert('X Coordinate: '+PosX+'. Y Coordinate: '+PosY+'.');
6214 else if (drone_imagery_plot_polygon_click_type == 'top_left') {
6215 drone_imagery_plot_polygon_click_type = '';
6216 jQuery('#drone_imagery_plot_polygons_left_column_top_offset').val(PosY);
6217 jQuery('#drone_imagery_plot_polygons_top_row_left_offset').val(PosX);
6219 else if (drone_imagery_plot_polygon_click_type == 'top_right') {
6220 drone_imagery_plot_polygon_click_type = '';
6221 jQuery('#drone_imagery_plot_polygons_top_row_right_offset').val(background_image_width-PosX);
6223 else if (drone_imagery_plot_polygon_click_type == 'bottom_left') {
6224 drone_imagery_plot_polygon_click_type = '';
6225 jQuery('#drone_imagery_plot_polygons_bottom_row_left_offset').val(PosX);
6226 jQuery('#drone_imagery_plot_polygons_left_column_bottom_offset').val(background_image_height-PosY);
6228 else if (drone_imagery_plot_polygon_click_type == 'bottom_right') {
6229 drone_imagery_plot_polygon_click_type = '';
6230 jQuery('#drone_imagery_plot_polygons_right_col_bottom_offset').val(background_image_height-PosY);
6232 else if (drone_imagery_plot_polygon_click_type == 'get_distance') {
6233 if (plot_polygons_get_distance_point_1x != '') {
6234 var distance = Math.round(Math.sqrt(Math.pow(plot_polygons_get_distance_point_1x - PosX, 2) + Math.pow(plot_polygons_get_distance_point_1y - PosY, 2)));
6235 alert('Distance='+distance+'. X1='+plot_polygons_get_distance_point_1x+'. Y1='+plot_polygons_get_distance_point_1y+'. X2='+PosX+'. Y2='+PosY);
6236 plot_polygons_get_distance_point_1x = '';
6237 plot_polygons_get_distance_point_1y = '';
6238 drone_imagery_plot_polygon_click_type = '';
6240 plot_polygons_get_distance_point_1x = PosX;
6241 plot_polygons_get_distance_point_1y = PosY;
6244 else if (drone_imagery_plot_polygon_click_type == 'plot_polygon_template_paste') {
6245 drone_imagery_plot_polygon_click_type = '';
6247 if (manage_drone_imagery_standard_process_field_trial_id == undefined) {
6248 plotPolygonsTemplatePaste(PosX, PosY, parseInt(drone_imagery_current_plot_polygon_index_options_id), 'drone_imagery_generated_polygons_div', 'drone_imagery_plot_polygons_generated_assign', 'drone_imagery_plot_polygons_submit_bottom');
6251 plotPolygonsTemplatePaste(PosX, PosY, parseInt(drone_imagery_current_plot_polygon_index_options_id), 'drone_imagery_standard_process_generated_polygons_div', 'drone_imagery_standard_process_plot_polygons_generated_assign', 'drone_imagery_standard_process_plot_polygons_submit_bottom');
6253 plotPolygonManualAssignPlotNumberTableStandard('drone_imagery_standard_process_generated_polygons_table', 'drone_imagery_standard_process_generated_polygons_table_id', 'drone_imagery_standard_process_generated_polygons_table_input', 'drone_imagery_standard_process_generated_polygons_table_input_generate_button', 'drone_imagery_standard_process_plot_polygons_submit_bottom');
6255 else if (drone_imagery_standard_process_plot_polygon_click_type == 'top_left') {
6256 drone_imagery_standard_process_plot_polygon_click_type = '';
6257 jQuery('#drone_imagery_standard_process_plot_polygons_left_column_top_offset').val(PosY);
6258 jQuery('#drone_imagery_standard_process_plot_polygons_top_row_left_offset').val(PosX);
6260 else if (drone_imagery_standard_process_plot_polygon_click_type == 'top_right') {
6261 drone_imagery_standard_process_plot_polygon_click_type = '';
6262 jQuery('#drone_imagery_standard_process_plot_polygons_top_row_right_offset').val(background_image_width-PosX);
6264 else if (drone_imagery_standard_process_plot_polygon_click_type == 'bottom_left') {
6265 drone_imagery_standard_process_plot_polygon_click_type = '';
6266 jQuery('#drone_imagery_standard_process_plot_polygons_bottom_row_left_offset').val(PosX);
6267 jQuery('#drone_imagery_standard_process_plot_polygons_left_column_bottom_offset').val(background_image_height-PosY);
6269 else if (drone_imagery_standard_process_plot_polygon_click_type == 'bottom_right') {
6270 drone_imagery_standard_process_plot_polygon_click_type = '';
6271 jQuery('#drone_imagery_standard_process_plot_polygons_right_col_bottom_offset').val(background_image_height-PosY);
6273 else if (drone_imagery_standard_process_plot_polygon_click_type == 'get_distance') {
6274 if (plot_polygons_get_distance_point_1x != '') {
6275 var distance = Math.round(Math.sqrt(Math.pow(plot_polygons_get_distance_point_1x - PosX, 2) + Math.pow(plot_polygons_get_distance_point_1y - PosY, 2)));
6276 alert('Distance='+distance+'. X1='+plot_polygons_get_distance_point_1x+'. Y1='+plot_polygons_get_distance_point_1y+'. X2='+PosX+'. Y2='+PosY);
6277 plot_polygons_get_distance_point_1x = '';
6278 plot_polygons_get_distance_point_1y = '';
6279 drone_imagery_plot_polygon_click_type = '';
6281 plot_polygons_get_distance_point_1x = PosX;
6282 plot_polygons_get_distance_point_1y = PosY;
6285 else if (drone_imagery_plot_polygon_click_type == 'save_ground_control_point') {
6286 //alert('X Coordinate: '+PosX+'. Y Coordinate: '+PosY+'.');
6287 jQuery('#project_drone_imagery_ground_control_points_form_input_x_pos').val(PosX);
6288 jQuery('#project_drone_imagery_ground_control_points_form_input_y_pos').val(PosY);
6289 jQuery('#project_drone_imagery_ground_control_points_form_dialog').modal('show');
6293 jQuery('#drone_imagery_assign_plot_dialog').on('shown.bs.modal', function (e) {
6294 jQuery("#drone_imagery_plot_polygon_assign_plot_name").focus();
6297 jQuery('#drone_imagery_assign_plot_dialog').on('hide.bs.modal', function (e) {
6298 drawPolyline(plot_polygons_display_points);
6299 drawWaypoints(plot_polygons_display_points, plot_polygon_name, 0);
6300 drone_imagery_plot_polygons_display[plot_polygon_name] = plot_polygons_display_points;
6301 plot_polygons_display_points = [];
6304 jQuery('#drone_imagery_plot_polygon_assign_add').click(function(){
6305 plot_polygon_name = jQuery('#drone_imagery_plot_polygon_assign_plot_name').val();
6306 if (plot_polygon_name == ''){
6307 alert('Please give a name name (plot name, plant name, etc)');
6309 drone_imagery_plot_polygons[plot_polygon_name] = plot_polygons_ind_4_points;
6310 jQuery('#drone_imagery_assign_plot_dialog').modal('hide');
6311 console.log(drone_imagery_plot_polygons);
6312 droneImageryDrawLayoutTable(field_trial_layout_response, drone_imagery_plot_polygons, 'drone_imagery_trial_layout_div', 'drone_imagery_layout_table');
6315 jQuery('#drone_imagery_assign_plot_form').on('keyup keypress', function(e) {
6316 var keyCode = e.keyCode || e.which;
6317 if (keyCode === 13) {
6319 jQuery("#drone_imagery_plot_polygon_assign_add").trigger( "click" );
6324 jQuery(document).on('click', 'button[name=drone_imagery_plot_polygons_submit_bottom]', function(){
6326 jQuery('input[name="drone_imagery_plot_polygons_autocomplete"]').each(function() {
6327 var stock_name = this.value;
6328 if (stock_name != '') {
6329 var polygon = drone_imagery_plot_generated_polygons[jQuery(this).data('generated_polygon_key')];
6330 drone_imagery_plot_polygons[stock_name] = polygon;
6334 submit_assignment_plot_polygons();
6337 function submit_assignment_plot_polygons() {
6340 url: '/api/drone_imagery/assign_plot_polygons',
6343 'image_id': background_removed_stitched_image_id,
6344 'drone_run_band_project_id': drone_run_band_project_id,
6345 'stock_polygons': JSON.stringify(drone_imagery_plot_polygons),
6346 'assign_plot_polygons_type': assign_plot_polygons_type
6348 beforeSend: function() {
6349 jQuery("#working_modal").modal("show");
6351 success: function(response){
6352 console.log(response);
6353 if(response.error) {
6354 alert(response.error);
6357 jQuery("#working_modal").modal("hide");
6360 error: function(response){
6361 jQuery("#working_modal").modal("hide");
6362 alert('Error saving assigned plot polygons!')
6367 jQuery(document).on('click', '#drone_imagery_plot_polygons_generated_assign', function() {
6368 generatePlotPolygonAssignments('drone_imagery_trial_layout_div', 'drone_imagery_layout_table');
6370 jQuery('input[name="drone_imagery_plot_polygons_autocomplete"]').each(function() {
6371 var stock_name = this.value;
6372 if (stock_name != '') {
6373 var polygon = drone_imagery_plot_generated_polygons[jQuery(this).data('generated_polygon_key')];
6374 drone_imagery_plot_polygons[stock_name] = polygon;
6379 jQuery(document).on('click', '#drone_imagery_standard_process_generated_polygons_table_input_generate_button', function(){
6380 generatePlotPolygonAssignmentsStandardManual('drone_imagery_standard_process_trial_layout_div', 'drone_imagery_standard_process_layout_table');
6383 function generatePlotPolygonAssignmentsStandardManual(trial_layout_div, trial_layout_table) {
6384 var plot_polygons_layout = field_trial_layout_response.output;
6385 var plot_polygons_plot_numbers = [];
6386 var plot_polygons_plot_numbers_plot_names = {};
6387 for (var i=1; i<plot_polygons_layout.length; i++) {
6388 var plot_polygons_plot_number = parseInt(plot_polygons_layout[i][2]);
6389 plot_polygons_plot_numbers.push(plot_polygons_plot_number);
6390 plot_polygons_plot_numbers_plot_names[plot_polygons_plot_number] = plot_polygons_layout[i][0];
6393 var plot_polygon_new_display = {};
6394 jQuery('input[name="drone_imagery_standard_process_generated_polygons_table_input"]').each(function() {
6395 var plot_number = jQuery(this).val();
6396 var polygon_number = jQuery(this).data('polygon_number');
6398 if (drone_imagery_plot_polygons_removed_numbers.includes(polygon_number.toString())) {
6399 console.log("Skipping "+polygon_number);
6400 plot_polygon_new_display[polygon_number] = drone_imagery_plot_polygons_display[polygon_number];
6402 plot_polygon_new_display[plot_polygons_plot_numbers_plot_names[plot_number]] = drone_imagery_plot_polygons_display[polygon_number];
6403 drone_imagery_plot_polygons[plot_polygons_plot_numbers_plot_names[plot_number]] = drone_imagery_plot_generated_polygons[polygon_number];
6407 droneImageryDrawLayoutTable(field_trial_layout_response, drone_imagery_plot_polygons, trial_layout_div, trial_layout_table);
6409 drone_imagery_plot_polygons_display = plot_polygon_new_display;
6410 draw_canvas_image(background_image_url, plot_polygons_total_height_generated/plot_polygons_num_rows_generated);
6413 function generatePlotPolygonAssignments(trial_layout_div, trial_layout_table) {
6414 var plot_polygons_first_plot_start = jQuery('#drone_imagery_plot_polygons_first_plot_start').val();
6415 var plot_polygons_second_plot_follows = jQuery('#drone_imagery_plot_polygons_second_plot_follows').val();
6416 var plot_polygons_plot_orientation = jQuery('#drone_imagery_plot_polygons_plot_orientation').val();
6418 var plot_polygons_layout = field_trial_layout_response.output;
6419 var plot_polygons_plot_numbers = [];
6420 var plot_polygons_plot_numbers_plot_names = {};
6421 for (var i=1; i<plot_polygons_layout.length; i++) {
6422 var plot_polygons_plot_number = parseInt(plot_polygons_layout[i][2]);
6423 plot_polygons_plot_numbers.push(plot_polygons_plot_number);
6424 plot_polygons_plot_numbers_plot_names[plot_polygons_plot_number] = plot_polygons_layout[i][0];
6426 plot_polygons_plot_numbers = plot_polygons_plot_numbers.sort(function (a, b) { return a - b; });
6427 var plot_polygons_current_plot_number_index = 0;
6429 var plot_polygons_template_index = 0;
6430 var plot_polygons_template_current = plot_polygons_template_dimensions[plot_polygons_template_index];
6431 var plot_polygons_template_current_num_cols = plot_polygons_template_current.num_cols;
6432 var plot_polygons_template_current_num_rows = plot_polygons_template_current.num_rows;
6433 var plot_polygons_template_current_total_plot_polygons = plot_polygons_template_current.total_plot_polygons;
6434 var plot_polygons_template_current_plot_polygon_index = 0;
6436 var plot_polygon_new_display = {};
6437 if (plot_polygons_first_plot_start == 'top_left') {
6438 var generated_polygon_key_first_plot_number = 0;
6439 if (plot_polygons_second_plot_follows == 'left' || plot_polygons_second_plot_follows == 'up') {
6440 alert('Second plot cannot follow left or up from first plot if the first plot starts at the top left, because that is physically impossible.');
6443 if (plot_polygons_second_plot_follows == 'right') {
6444 if (plot_polygons_plot_orientation == 'zigzag') {
6445 var plot_polygon_current_polygon_index = generated_polygon_key_first_plot_number;
6446 for (var j=generated_polygon_key_first_plot_number; j<plot_polygons_plot_numbers.length + drone_imagery_plot_polygons_removed_numbers.length; j++){
6447 if (drone_imagery_plot_polygons_removed_numbers.includes(plot_polygon_current_polygon_index.toString())) {
6448 console.log("Skipping "+plot_polygon_current_polygon_index);
6449 plot_polygon_new_display[plot_polygon_current_polygon_index] = drone_imagery_plot_polygons_display[plot_polygon_current_polygon_index];
6451 plot_polygon_new_display[plot_polygons_plot_numbers_plot_names[plot_polygons_plot_numbers[plot_polygons_current_plot_number_index]]] = drone_imagery_plot_polygons_display[plot_polygon_current_polygon_index];
6452 drone_imagery_plot_polygons[plot_polygons_plot_numbers_plot_names[plot_polygons_plot_numbers[plot_polygons_current_plot_number_index]]] = drone_imagery_plot_generated_polygons[plot_polygon_current_polygon_index];
6453 plot_polygons_current_plot_number_index = plot_polygons_current_plot_number_index + 1;
6454 plot_polygons_template_current_plot_polygon_index = plot_polygons_template_current_plot_polygon_index + 1;
6456 plot_polygon_current_polygon_index = plot_polygon_current_polygon_index + 1;
6458 if (plot_polygons_template_current_plot_polygon_index == plot_polygons_template_current_total_plot_polygons) {
6459 plot_polygons_template_index = plot_polygons_template_index + 1;
6460 plot_polygons_template_current = plot_polygons_template_dimensions[plot_polygons_template_index];
6461 if (plot_polygons_template_current != undefined) {
6462 plot_polygons_template_current_num_cols = plot_polygons_template_current.num_cols;
6463 plot_polygons_template_current_num_rows = plot_polygons_template_current.num_rows;
6464 plot_polygons_template_current_total_plot_polygons = plot_polygons_template_current.total_plot_polygons;
6465 plot_polygons_template_current_plot_polygon_index = 0;
6470 if (plot_polygons_plot_orientation == 'serpentine') {
6471 var plot_polygon_current_polygon_index = generated_polygon_key_first_plot_number;
6472 var plot_polygon_column_count = 0;
6473 var plot_polygon_zigzig_polygon_index = generated_polygon_key_first_plot_number;
6474 var going_right = 1;
6475 var plot_polygon_previous_template_plot_count = 0;
6476 for (var j=generated_polygon_key_first_plot_number; j<plot_polygons_plot_numbers.length + drone_imagery_plot_polygons_removed_numbers.length; j++){
6478 if (going_right == 1) {
6479 plot_polygon_current_polygon_index = plot_polygon_zigzig_polygon_index;
6481 if (going_right == 0) {
6482 plot_polygon_current_polygon_index = plot_polygon_previous_template_plot_count + plot_polygons_template_current_num_cols - plot_polygon_column_count - 1;
6485 if (drone_imagery_plot_polygons_removed_numbers.includes(plot_polygon_current_polygon_index.toString())) {
6486 console.log("Skipping "+plot_polygon_current_polygon_index);
6487 plot_polygon_new_display[plot_polygon_current_polygon_index] = drone_imagery_plot_polygons_display[plot_polygon_current_polygon_index];
6489 plot_polygon_new_display[plot_polygons_plot_numbers_plot_names[plot_polygons_plot_numbers[plot_polygons_current_plot_number_index]]] = drone_imagery_plot_polygons_display[plot_polygon_current_polygon_index];
6490 drone_imagery_plot_polygons[plot_polygons_plot_numbers_plot_names[plot_polygons_plot_numbers[plot_polygons_current_plot_number_index]]] = drone_imagery_plot_generated_polygons[plot_polygon_current_polygon_index];
6491 plot_polygons_current_plot_number_index = plot_polygons_current_plot_number_index + 1;
6492 plot_polygons_template_current_plot_polygon_index = plot_polygons_template_current_plot_polygon_index + 1;
6495 plot_polygon_zigzig_polygon_index = plot_polygon_zigzig_polygon_index + 1;
6496 plot_polygon_column_count = plot_polygon_column_count + 1;
6498 if (plot_polygon_column_count == plot_polygons_template_current_num_cols) {
6499 plot_polygon_column_count = 0;
6500 if (going_right == 1) {
6505 plot_polygon_previous_template_plot_count = plot_polygon_previous_template_plot_count + plot_polygons_template_current_num_cols;
6508 if (plot_polygons_template_current_plot_polygon_index == plot_polygons_template_current_total_plot_polygons) {
6509 plot_polygons_template_index = plot_polygons_template_index + 1;
6510 plot_polygons_template_current = plot_polygons_template_dimensions[plot_polygons_template_index];
6511 if (plot_polygons_template_current != undefined) {
6512 plot_polygons_template_current_num_cols = plot_polygons_template_current.num_cols;
6513 plot_polygons_template_current_num_rows = plot_polygons_template_current.num_rows;
6514 plot_polygons_template_current_total_plot_polygons = plot_polygons_template_current.total_plot_polygons;
6515 plot_polygons_template_current_plot_polygon_index = 0;
6521 if (plot_polygons_second_plot_follows == 'down') {
6522 alert('Down not implemented if first plot starts in top left. Please contact us or try rotating your image differently before assigning plot polygons (e.g. rotate image 90 degrees clock-wise, then first plot starts in top right and you can go left for plot assignment).');
6526 if (plot_polygons_first_plot_start == 'top_right') {
6527 var generated_polygon_key_first_plot_number = plot_polygons_template_current_num_cols - 1;
6528 if (plot_polygons_second_plot_follows == 'right' || plot_polygons_second_plot_follows == 'up') {
6529 alert('Second plot cannot follow right or up from first plot if the first plot starts at the top right, because that is physically impossible.');
6532 if (plot_polygons_second_plot_follows == 'left') {
6533 if (plot_polygons_plot_orientation == 'zigzag') {
6534 console.log(generated_polygon_key_first_plot_number);
6535 var plot_polygon_current_polygon_index = generated_polygon_key_first_plot_number;
6536 var plot_polygon_column_count = 0;
6537 var plot_polygon_previous_template_plot_count = 0;
6538 for (var j=generated_polygon_key_first_plot_number; j<generated_polygon_key_first_plot_number + plot_polygons_plot_numbers.length + drone_imagery_plot_polygons_removed_numbers.length; j++){
6540 plot_polygon_current_polygon_index = plot_polygon_previous_template_plot_count + plot_polygons_template_current_num_cols - plot_polygon_column_count - 1;
6542 if (drone_imagery_plot_polygons_removed_numbers.includes(plot_polygon_current_polygon_index.toString())) {
6543 console.log("Skipping "+plot_polygon_current_polygon_index);
6544 plot_polygon_new_display[plot_polygon_current_polygon_index] = drone_imagery_plot_polygons_display[plot_polygon_current_polygon_index];
6546 plot_polygon_new_display[plot_polygons_plot_numbers_plot_names[plot_polygons_plot_numbers[plot_polygons_current_plot_number_index]]] = drone_imagery_plot_polygons_display[plot_polygon_current_polygon_index];
6547 drone_imagery_plot_polygons[plot_polygons_plot_numbers_plot_names[plot_polygons_plot_numbers[plot_polygons_current_plot_number_index]]] = drone_imagery_plot_generated_polygons[plot_polygon_current_polygon_index];
6548 plot_polygons_current_plot_number_index = plot_polygons_current_plot_number_index + 1;
6549 plot_polygons_template_current_plot_polygon_index = plot_polygons_template_current_plot_polygon_index + 1;
6552 plot_polygon_column_count = plot_polygon_column_count + 1;
6554 if (plot_polygon_column_count == plot_polygons_template_current_num_cols) {
6555 plot_polygon_column_count = 0;
6556 plot_polygon_previous_template_plot_count = plot_polygon_previous_template_plot_count + plot_polygons_template_current_num_cols;
6559 if (plot_polygons_template_current_plot_polygon_index == plot_polygons_template_current_total_plot_polygons) {
6560 plot_polygons_template_index = plot_polygons_template_index + 1;
6561 plot_polygons_template_current = plot_polygons_template_dimensions[plot_polygons_template_index];
6562 if (plot_polygons_template_current != undefined) {
6563 plot_polygons_template_current_num_cols = plot_polygons_template_current.num_cols;
6564 plot_polygons_template_current_num_rows = plot_polygons_template_current.num_rows;
6565 plot_polygons_template_current_total_plot_polygons = plot_polygons_template_current.total_plot_polygons;
6566 plot_polygons_template_current_plot_polygon_index = 0;
6571 if (plot_polygons_plot_orientation == 'serpentine') {
6572 var plot_polygon_current_polygon_index = generated_polygon_key_first_plot_number;
6573 var plot_polygon_column_count = 0;
6574 var plot_polygon_zigzig_polygon_index = generated_polygon_key_first_plot_number;
6576 var plot_polygon_previous_template_plot_count = 0;
6577 for (var j=generated_polygon_key_first_plot_number; j<generated_polygon_key_first_plot_number + plot_polygons_plot_numbers.length + drone_imagery_plot_polygons_removed_numbers.length; j++){
6579 if (going_left == 0) {
6580 plot_polygon_current_polygon_index = plot_polygon_previous_template_plot_count + plot_polygon_column_count;
6582 if (going_left == 1) {
6583 plot_polygon_current_polygon_index = plot_polygon_previous_template_plot_count + plot_polygons_template_current_num_cols - plot_polygon_column_count - 1;
6586 if (drone_imagery_plot_polygons_removed_numbers.includes(plot_polygon_current_polygon_index.toString())) {
6587 console.log("Skipping "+plot_polygon_current_polygon_index);
6588 plot_polygon_new_display[plot_polygon_current_polygon_index] = drone_imagery_plot_polygons_display[plot_polygon_current_polygon_index];
6590 plot_polygon_new_display[plot_polygons_plot_numbers_plot_names[plot_polygons_plot_numbers[plot_polygons_current_plot_number_index]]] = drone_imagery_plot_polygons_display[plot_polygon_current_polygon_index];
6591 drone_imagery_plot_polygons[plot_polygons_plot_numbers_plot_names[plot_polygons_plot_numbers[plot_polygons_current_plot_number_index]]] = drone_imagery_plot_generated_polygons[plot_polygon_current_polygon_index];
6592 plot_polygons_current_plot_number_index = plot_polygons_current_plot_number_index + 1;
6593 plot_polygons_template_current_plot_polygon_index = plot_polygons_template_current_plot_polygon_index + 1;
6596 plot_polygon_zigzig_polygon_index = plot_polygon_zigzig_polygon_index + 1;
6597 plot_polygon_column_count = plot_polygon_column_count + 1;
6599 if (plot_polygon_column_count == plot_polygons_template_current_num_cols) {
6600 plot_polygon_column_count = 0;
6601 if (going_left == 1) {
6606 plot_polygon_previous_template_plot_count = plot_polygon_previous_template_plot_count + plot_polygons_template_current_num_cols;
6609 if (plot_polygons_template_current_plot_polygon_index == plot_polygons_template_current_total_plot_polygons) {
6610 plot_polygons_template_index = plot_polygons_template_index + 1;
6611 plot_polygons_template_current = plot_polygons_template_dimensions[plot_polygons_template_index];
6612 if (plot_polygons_template_current != undefined) {
6613 plot_polygons_template_current_num_cols = plot_polygons_template_current.num_cols;
6614 plot_polygons_template_current_num_rows = plot_polygons_template_current.num_rows;
6615 plot_polygons_template_current_total_plot_polygons = plot_polygons_template_current.total_plot_polygons;
6616 plot_polygons_template_current_plot_polygon_index = 0;
6622 if (plot_polygons_second_plot_follows == 'down') {
6623 alert('Down not implemented if your first plot starts in top right. Please contact us or try rotating your image differently before assigning plot polygons (e.g. rotate image 90 degrees clockwise, then first plot starts in bottom right corner and plot assignment can follow going left).');
6627 if (plot_polygons_first_plot_start == 'bottom_left') {
6628 var generated_polygon_key_first_plot_number = plot_polygons_number_generated - (plot_polygons_num_border_rows_bottom * plot_polygons_num_cols_generated) - plot_polygons_num_border_rows_right;
6629 if (plot_polygons_second_plot_follows == 'left' || plot_polygons_second_plot_follows == 'down') {
6630 alert('Second plot cannot follow left or down from the first plot if the first plot starts at the bottom left, because that is physically impossible.');
6633 if (plot_polygons_second_plot_follows == 'right') {
6634 if (plot_polygons_plot_orientation == 'serpentine') {
6635 var plot_polygon_current_polygon_index = generated_polygon_key_first_plot_number;
6636 var plot_polygon_column_count = 0;
6637 var going_right = 1;
6638 var plot_polygon_row_count = 0;
6639 for (var j=0; j<plot_polygons_plot_numbers.length; j++){
6641 if (going_right == 0) {
6642 plot_polygon_current_polygon_index = plot_polygons_number_generated - (plot_polygons_num_border_rows_bottom * plot_polygons_num_cols_generated) - (plot_polygon_row_count * plot_polygons_num_cols_generated) - plot_polygons_num_border_rows_right - plot_polygon_column_count - 1;
6644 if (going_right == 1) {
6645 plot_polygon_current_polygon_index = plot_polygons_number_generated - (plot_polygons_num_border_rows_bottom * plot_polygons_num_cols_generated) - (plot_polygon_row_count * plot_polygons_num_cols_generated) - plot_polygons_num_cols_generated + plot_polygons_num_border_rows_left + plot_polygon_column_count;
6648 if (drone_imagery_plot_polygons_removed_numbers.includes(plot_polygon_current_polygon_index.toString())) {
6649 console.log("Skipping "+plot_polygon_current_polygon_index);
6650 plot_polygon_new_display[plot_polygon_current_polygon_index] = drone_imagery_plot_polygons_display[plot_polygon_current_polygon_index];
6652 plot_polygon_new_display[plot_polygons_plot_numbers_plot_names[plot_polygons_plot_numbers[plot_polygons_current_plot_number_index]]] = drone_imagery_plot_polygons_display[plot_polygon_current_polygon_index];
6653 drone_imagery_plot_polygons[plot_polygons_plot_numbers_plot_names[plot_polygons_plot_numbers[plot_polygons_current_plot_number_index]]] = drone_imagery_plot_generated_polygons[plot_polygon_current_polygon_index];
6654 plot_polygons_current_plot_number_index = plot_polygons_current_plot_number_index + 1;
6657 plot_polygon_column_count = plot_polygon_column_count + 1;
6659 if (plot_polygon_column_count == (plot_polygons_num_cols_generated - plot_polygons_num_border_rows_left - plot_polygons_num_border_rows_right)) {
6660 plot_polygon_column_count = 0;
6661 plot_polygon_row_count = plot_polygon_row_count + 1;
6662 if (going_right == 1) {
6670 if (plot_polygons_plot_orientation == 'zigzag') {
6671 var plot_polygon_current_polygon_index = generated_polygon_key_first_plot_number;
6672 var plot_polygon_column_count = 0;
6673 var plot_polygon_row_count = 0;
6674 for (var j=0; j<plot_polygons_plot_numbers.length; j++){
6676 plot_polygon_current_polygon_index = plot_polygons_number_generated - (plot_polygons_num_border_rows_bottom * plot_polygons_num_cols_generated) - (plot_polygon_row_count * plot_polygons_num_cols_generated) - plot_polygons_num_cols_generated + plot_polygons_num_border_rows_left + plot_polygon_column_count;
6678 if (drone_imagery_plot_polygons_removed_numbers.includes(plot_polygon_current_polygon_index.toString())) {
6679 console.log("Skipping "+plot_polygon_current_polygon_index);
6680 plot_polygon_new_display[plot_polygon_current_polygon_index] = drone_imagery_plot_polygons_display[plot_polygon_current_polygon_index];
6682 plot_polygon_new_display[plot_polygons_plot_numbers_plot_names[plot_polygons_plot_numbers[plot_polygons_current_plot_number_index]]] = drone_imagery_plot_polygons_display[plot_polygon_current_polygon_index];
6683 drone_imagery_plot_polygons[plot_polygons_plot_numbers_plot_names[plot_polygons_plot_numbers[plot_polygons_current_plot_number_index]]] = drone_imagery_plot_generated_polygons[plot_polygon_current_polygon_index];
6684 plot_polygons_current_plot_number_index = plot_polygons_current_plot_number_index + 1;
6687 plot_polygon_column_count = plot_polygon_column_count + 1;
6689 if (plot_polygon_column_count == (plot_polygons_num_cols_generated - plot_polygons_num_border_rows_left - plot_polygons_num_border_rows_right)) {
6690 plot_polygon_column_count = 0;
6691 plot_polygon_row_count = plot_polygon_row_count + 1;
6696 if (plot_polygons_second_plot_follows == 'up') {
6697 alert('Up not implemented if your first plot starts in bottom left. Please contact us or try rotating your image differently before assigning plot polygons (e.g. rotate image clockwise 90 degrees, then first plot starts in top-left corner and plot assignment can follow going right).');
6701 if (plot_polygons_first_plot_start == 'bottom_right') {
6702 var generated_polygon_key_first_plot_number = plot_polygons_number_generated - (plot_polygons_num_border_rows_bottom * plot_polygons_num_cols_generated) - plot_polygons_num_border_rows_right - 1;
6703 if (plot_polygons_second_plot_follows == 'right' || plot_polygons_second_plot_follows == 'down') {
6704 alert('Second plot cannot follow right or down from the first plot if the first plot starts at the bottom right, because that is physically impossible.');
6707 if (plot_polygons_second_plot_follows == 'left') {
6708 if (plot_polygons_plot_orientation == 'zigzag') {
6709 var plot_polygon_current_polygon_index = generated_polygon_key_first_plot_number;
6710 var plot_polygon_column_count = 0;
6711 for (var j=0; j<plot_polygons_plot_numbers.length; j++){
6713 if (drone_imagery_plot_polygons_removed_numbers.includes(plot_polygon_current_polygon_index.toString())) {
6714 console.log("Skipping "+plot_polygon_current_polygon_index);
6715 plot_polygon_new_display[plot_polygon_current_polygon_index] = drone_imagery_plot_polygons_display[plot_polygon_current_polygon_index];
6717 plot_polygon_new_display[plot_polygons_plot_numbers_plot_names[plot_polygons_plot_numbers[plot_polygons_current_plot_number_index]]] = drone_imagery_plot_polygons_display[plot_polygon_current_polygon_index];
6718 drone_imagery_plot_polygons[plot_polygons_plot_numbers_plot_names[plot_polygons_plot_numbers[plot_polygons_current_plot_number_index]]] = drone_imagery_plot_generated_polygons[plot_polygon_current_polygon_index];
6719 plot_polygons_current_plot_number_index = plot_polygons_current_plot_number_index + 1;
6722 plot_polygon_current_polygon_index = plot_polygon_current_polygon_index - 1;
6723 plot_polygon_column_count = plot_polygon_column_count + 1;
6725 if (plot_polygon_column_count == (plot_polygons_num_cols_generated - plot_polygons_num_border_rows_left - plot_polygons_num_border_rows_right)) {
6726 plot_polygon_current_polygon_index = plot_polygon_current_polygon_index - plot_polygons_num_border_rows_left - plot_polygons_num_border_rows_right;
6727 plot_polygon_column_count = 0;
6731 if (plot_polygons_plot_orientation == 'serpentine') {
6732 var plot_polygon_current_polygon_index = generated_polygon_key_first_plot_number;
6733 var plot_polygon_column_count = 0;
6734 var plot_polygon_zigzig_polygon_index = generated_polygon_key_first_plot_number;
6736 var plot_polygon_row_count = 0;
6737 for (var j=0; j<plot_polygons_plot_numbers.length; j++){
6739 if (going_left == 1) {
6740 plot_polygon_current_polygon_index = plot_polygon_zigzig_polygon_index;
6742 if (going_left == 0) {
6743 plot_polygon_current_polygon_index = plot_polygons_number_generated - (plot_polygons_num_border_rows_bottom * plot_polygons_num_cols_generated) - (plot_polygon_row_count * plot_polygons_num_cols_generated) - plot_polygons_num_cols_generated + plot_polygons_num_border_rows_left + plot_polygon_column_count;
6746 if (drone_imagery_plot_polygons_removed_numbers.includes(plot_polygon_current_polygon_index.toString())) {
6747 console.log("Skipping "+plot_polygon_current_polygon_index);
6748 plot_polygon_new_display[plot_polygon_current_polygon_index] = drone_imagery_plot_polygons_display[plot_polygon_current_polygon_index];
6750 plot_polygon_new_display[plot_polygons_plot_numbers_plot_names[plot_polygons_plot_numbers[plot_polygons_current_plot_number_index]]] = drone_imagery_plot_polygons_display[plot_polygon_current_polygon_index];
6751 drone_imagery_plot_polygons[plot_polygons_plot_numbers_plot_names[plot_polygons_plot_numbers[plot_polygons_current_plot_number_index]]] = drone_imagery_plot_generated_polygons[plot_polygon_current_polygon_index];
6752 plot_polygons_current_plot_number_index = plot_polygons_current_plot_number_index + 1;
6755 plot_polygon_zigzig_polygon_index = plot_polygon_zigzig_polygon_index - 1;
6756 plot_polygon_column_count = plot_polygon_column_count + 1;
6758 if (plot_polygon_column_count == (plot_polygons_num_cols_generated - plot_polygons_num_border_rows_left - plot_polygons_num_border_rows_right)) {
6759 plot_polygon_zigzig_polygon_index = plot_polygon_zigzig_polygon_index - plot_polygons_num_border_rows_left - plot_polygons_num_border_rows_right;
6760 plot_polygon_column_count = 0;
6761 plot_polygon_row_count = plot_polygon_row_count + 1;
6762 if (going_left == 1) {
6771 if (plot_polygons_second_plot_follows == 'up') {
6772 alert('Up not implemented if your first plot starts in bottom right. Please contact us or try rotating your image differently before assigning plot polygons (e.g. rotate image 90 degrees clockwise, then first plot starts in bottom left corner and plot assignment can follow going right).');
6777 console.log(drone_imagery_plot_polygons);
6778 droneImageryDrawLayoutTable(field_trial_layout_response, drone_imagery_plot_polygons, trial_layout_div, trial_layout_table);
6780 drone_imagery_plot_polygons_display = plot_polygon_new_display;
6781 draw_canvas_image(background_image_url, plot_polygons_total_height_generated/plot_polygons_num_rows_generated);
6784 function droneImageryRectangleLayoutTable(generated_polygons, plot_polygons_layout_assignment_info, plot_polygons_generate_assignment_button, plot_polygon_assignment_submit_button) {
6785 var html = '<hr><div class="well well-sm"><h2>Or Auto Assign Plot Polygons to Field Trial Plots</h2>';
6786 html = html + '<div class="panel panel-default"><div class="panel-body"><div class="form form-horizontal">';
6787 html = html + '<div class="row"><div class="col-sm-6"><div class="form-group form-group-sm"><label class="col-sm-6 control-label">Location of First Plot (e.g. plot number 1): </label><div class="col-sm-6"><select class="form-control" id="drone_imagery_plot_polygons_first_plot_start" name="drone_imagery_plot_polygons_first_plot_start"><option value="top_left">Top Left</option><option value="top_right">Top Right</option><option value="bottom_left" disabled>Bottom Left</option><option value="bottom_right" disabled>Bottom Right</option></select></div></div></div><div class="col-sm-6"><div class="form-group form-group-sm"><label class="col-sm-6 control-label">Second Plot Follows First Plot Going: </label><div class="col-sm-6"><select class="form-control" id="drone_imagery_plot_polygons_second_plot_follows" name="drone_imagery_plot_polygons_second_plot_follows"><option value="right">Right</option><option value="up">Up</option><option value="down">Down</option><option value="left">Left</option></select></div></div></div></div>';
6788 html = html + '<div class="row"><div class="col-sm-6"><div class="form-group form-group-sm"><label class="col-sm-6 control-label">Plot Number Orientation: </label><div class="col-sm-6"><select class="form-control" id="drone_imagery_plot_polygons_plot_orientation" name="drone_imagery_plot_polygons_plot_orientation"><option value="serpentine">Serpentine</option><option value="zigzag">Zigzag (Not Serpentine)</option></select></div></div></div></div>';
6789 html = html + '<button class="btn btn-primary" id="'+plot_polygons_generate_assignment_button+'">Generate Assignments (Does Not Save)</button> <button class="btn btn-primary" name="'+plot_polygon_assignment_submit_button+'">Finish and Save Polygons To Plots</button></div>';
6790 html = html + '</div></div></div></div>';
6791 jQuery('#'+plot_polygons_layout_assignment_info).html(html);
6793 jQuery('input[name=drone_imagery_plot_polygons_autocomplete]').autocomplete({
6794 source: drone_imagery_plot_polygons_available_stock_names
6798 function droneImageryDrawLayoutTable(response, plot_polygons, layout_div_id, layout_table_div_id) {
6799 var output = response.output;
6800 var header = output[0];
6801 var html = '<table class="table table-borders table-hover" id="'+layout_table_div_id+'"><thead><tr>';
6802 for (var i=0; i<header.length; i++){
6803 html = html + '<td>'+header[i]+'</td>';
6805 html = html + '<td>Polygon Assigned</td>';
6806 html = html + '</tr></thead><tbody>';
6807 for (var i=1; i<output.length; i++){
6808 html = html + '<tr>';
6809 for (var j=0; j<output[i].length; j++){
6810 html = html + '<td>'+output[i][j]+'</td>';
6812 if (output[i][0] in plot_polygons && plot_polygons[output[i][0]] != undefined){
6813 html = html + '<td>Yes</td>';
6815 html = html + '<td></td>';
6817 html = html + '</tr>';
6819 html = html + '</tbody></table>';
6820 jQuery('#'+layout_div_id).html(html);
6821 jQuery('#'+layout_table_div_id).DataTable();
6825 //Remove Background Histogram
6828 var removeBackgroundHistogramImg;
6829 var removeBackgroundDisplayImg;
6830 var removeBackgroundThresholdPeak1;
6831 var removeBackgroundThresholdPeak1pixels;
6832 var removeBackgroundThresholdPeak2;
6833 var removeBackgroundThresholdPeak2pixels;
6834 var removeBackgroundThresholdValue;
6835 var remove_background_denoised_stitched_image_id;
6836 var remove_background_current_image_id;
6837 var remove_background_current_image_type;
6838 var remove_background_drone_run_band_project_id;
6840 jQuery(document).on('click', 'button[name=project_drone_imagery_remove_background]', function(){
6841 showManageDroneImagerySection('manage_drone_imagery_remove_background_div');
6843 remove_background_denoised_stitched_image_id = jQuery(this).data('denoised_stitched_image_id');
6844 remove_background_drone_run_band_project_id = jQuery(this).data('drone_run_band_project_id');
6845 remove_background_current_image_id = jQuery(this).data('remove_background_current_image_id');
6846 remove_background_current_image_type = jQuery(this).data('remove_background_current_image_type');
6848 showRemoveBackgroundHistogramStart(remove_background_current_image_id, 'drone_imagery_remove_background_original', 'drone_imagery_remove_background_histogram_div', 'manage_drone_imagery_remove_background_load_div');
6851 function showRemoveBackgroundHistogramStart(remove_background_current_image_id, canvas_div_id, histogram_canvas_div_id, load_div_id) {
6853 url : '/api/drone_imagery/get_image?image_id='+remove_background_current_image_id,
6854 beforeSend: function() {
6855 jQuery("#working_modal").modal("show");
6857 success: function(response){
6858 console.log(response);
6859 jQuery("#working_modal").modal("hide");
6861 var canvas = document.getElementById(canvas_div_id);
6862 removeBackgroundDisplayImg = canvas;
6863 ctx = canvas.getContext('2d');
6864 var image = new Image();
6865 image.onload = function () {
6866 canvas.width = this.naturalWidth;
6867 canvas.height = this.naturalHeight;
6868 ctx.drawImage(this, 0, 0);
6870 var src = cv.imread(canvas_div_id);
6871 cv.cvtColor(src, src, cv.COLOR_RGBA2GRAY, 0);
6872 var srcVec = new cv.MatVector();
6873 srcVec.push_back(src);
6874 var accumulate = false;
6876 var histSize = [256];
6877 var ranges = [0, 255];
6878 var hist = new cv.Mat();
6879 var mask = new cv.Mat();
6880 var color = new cv.Scalar(255, 255, 255);
6882 var hist_height = src.rows/2;
6884 cv.calcHist(srcVec, channels, mask, hist, histSize, ranges, accumulate);
6885 var result = cv.minMaxLoc(hist, mask);
6886 var max = result.maxVal;
6887 var dst = new cv.Mat.zeros(hist_height, histSize[0] * scale, cv.CV_8UC3);
6889 for (let i = 0; i < histSize[0]; i++) {
6890 var binVal = hist.data32F[i] * hist_height / max;
6891 var point1 = new cv.Point(i * scale, hist_height - 1);
6892 var point2 = new cv.Point((i + 1) * scale - 1, hist_height - binVal);
6893 cv.rectangle(dst, point1, point2, color, cv.FILLED);
6895 cv.imshow(histogram_canvas_div_id, dst);
6896 src.delete(); dst.delete(); srcVec.delete(); mask.delete(); hist.delete();
6898 removeBackgroundHistogramImg = document.getElementById(histogram_canvas_div_id);
6899 removeBackgroundHistogramImg.onmousemove = GetCoordinatesRemoveBackgrounHistogram;
6900 removeBackgroundHistogramImg.onmousedown = GetCoordinatesRemoveBackgrounHistogramDrawLine;
6902 jQuery('#'+load_div_id).hide();
6905 image.src = response.image_url;
6908 error: function(response){
6909 jQuery("#working_modal").modal("hide");
6910 alert('Error retrieving image!')
6915 jQuery('#drone_imagery_remove_background_find_minimum').click(function(){
6916 if (!removeBackgroundThresholdPeak1 || !removeBackgroundThresholdPeak2) {
6917 alert('Please click on the two right-most peaks in the histogram first!');
6919 showRemoveBackgroundHistogramMinimum(remove_background_current_image_id, 'drone_imagery_remove_background_original', 'drone_imagery_remove_background_histogram_div');
6923 function showRemoveBackgroundHistogramMinimum(remove_background_current_image_id, canvas_div_id, histogram_canvas_div_id) {
6925 url : '/api/drone_imagery/get_image?image_id='+remove_background_current_image_id,
6926 beforeSend: function() {
6927 jQuery("#working_modal").modal("show");
6929 success: function(response){
6930 console.log(response);
6931 jQuery("#working_modal").modal("hide");
6933 var canvas = document.getElementById(canvas_div_id);
6934 ctx = canvas.getContext('2d');
6935 var image = new Image();
6936 image.onload = function () {
6937 canvas.width = this.naturalWidth;
6938 canvas.height = this.naturalHeight;
6939 ctx.drawImage(this, 0, 0);
6941 var src = cv.imread(canvas_div_id);
6942 cv.cvtColor(src, src, cv.COLOR_RGBA2GRAY, 0);
6943 var srcVec = new cv.MatVector();
6944 srcVec.push_back(src);
6945 var accumulate = false;
6947 var histSize = [256];
6948 var ranges = [0, 255];
6949 var hist = new cv.Mat();
6950 var mask = new cv.Mat();
6951 var color = new cv.Scalar(255, 255, 255);
6953 var hist_height = src.rows/2;
6955 cv.calcHist(srcVec, channels, mask, hist, histSize, ranges, accumulate);
6956 var result = cv.minMaxLoc(hist, mask);
6957 var max = result.maxVal;
6958 var dst = new cv.Mat.zeros(hist_height, histSize[0] * scale, cv.CV_8UC3);
6960 var minimum_x_val = 0;
6961 var minimum_x_val_pix = 0;
6962 var minimum_y_val = 1000000000000000000000000000;
6964 if (removeBackgroundThresholdPeak1pixels > removeBackgroundThresholdPeak2pixels) {
6965 var removeBackgroundThresholdPeak1pixels_original = removeBackgroundThresholdPeak1pixels;
6966 removeBackgroundThresholdPeak1pixels = removeBackgroundThresholdPeak2pixels;
6967 removeBackgroundThresholdPeak2pixels = removeBackgroundThresholdPeak1pixels_original;
6970 for (let i = 0; i < histSize[0]; i++) {
6971 var binVal = hist.data32F[i] * hist_height / max;
6973 var x_start = i * scale;
6974 if (x_start >= removeBackgroundThresholdPeak1pixels && x_start <= removeBackgroundThresholdPeak2pixels){
6975 //console.log('x: '+i.toString()+' y: '+binVal.toString());
6976 if (binVal < minimum_y_val) {
6977 minimum_y_val = binVal;
6979 minimum_x_val_pix = x_start;
6983 var point1 = new cv.Point(x_start, hist_height - 1);
6984 var point2 = new cv.Point((i + 1) * scale - 1, hist_height - binVal);
6985 cv.rectangle(dst, point1, point2, color, cv.FILLED);
6987 cv.imshow('drone_imagery_remove_background_histogram_div', dst);
6988 src.delete(); dst.delete(); srcVec.delete(); mask.delete(); hist.delete();
6990 removeBackgroundHistogramImg = document.getElementById(histogram_canvas_div_id);
6991 removeBackgroundHistogramImg.onmousemove = GetCoordinatesRemoveBackgrounHistogram;
6992 removeBackgroundHistogramImg.onmousedown = GetCoordinatesRemoveBackgrounHistogramDrawLine;
6994 jQuery('div[name="drone_imagery_remove_background_threshold"]').html('<h5>Selected Threshold Value: '+ minimum_x_val );
6996 removeBackgroundHistogramImgDrawLine(removeBackgroundHistogramImg, removeBackgroundThresholdPeak1pixels, removeBackgroundHistogramImg.height, '#ff0000');
6997 removeBackgroundHistogramImgDrawLine(removeBackgroundHistogramImg, removeBackgroundThresholdPeak2pixels, removeBackgroundHistogramImg.height, '#ff0000');
6998 removeBackgroundHistogramImgDrawLine(removeBackgroundHistogramImg, minimum_x_val_pix, removeBackgroundHistogramImg.height, '#0000ff');
7000 removeBackgroundThresholdValue = minimum_x_val;
7002 removeBackgroundHistogramImgReDraw();
7004 image.src = response.image_url;
7006 error: function(response){
7007 jQuery("#working_modal").modal("hide");
7008 alert('Error retrieving image!')
7013 jQuery('#drone_imagery_remove_background_start_over').click(function(){
7014 removeBackgroundThresholdPeak1 = undefined;
7015 removeBackgroundThresholdPeak2 = undefined;
7016 removeBackgroundThresholdPeak1pixels = undefined;
7017 removeBackgroundThresholdPeak2pixels = undefined;
7019 showRemoveBackgroundHistogramStart(remove_background_current_image_id, 'drone_imagery_remove_background_original', 'drone_imagery_remove_background_histogram_div', 'manage_drone_imagery_remove_background_load_div');
7022 function removeBackgroundHistogramImgDrawLine(removeBackgroundHistogramImg, position, image_height, color) {
7023 var ctx = removeBackgroundHistogramImg.getContext("2d");
7025 ctx.moveTo(position,0);
7026 ctx.lineTo(position, image_height);
7027 ctx.strokeStyle = color;
7031 function removeBackgroundHistogramImgReDraw() {
7034 url: '/api/drone_imagery/remove_background_display',
7037 'image_id': remove_background_current_image_id,
7038 'drone_run_band_project_id': remove_background_drone_run_band_project_id,
7039 'lower_threshold': removeBackgroundThresholdValue,
7040 'upper_threshold': '255',
7042 success: function(response){
7043 console.log(response);
7044 if(response.error) {
7045 alert(response.error);
7048 var canvas = removeBackgroundDisplayImg;
7049 ctx = canvas.getContext('2d');
7050 var image = new Image();
7051 image.onload = function () {
7052 canvas.width = this.naturalWidth;
7053 canvas.height = this.naturalHeight;
7054 ctx.drawImage(this, 0, 0);
7056 image.src = response.removed_background_image_url;
7058 error: function(response){
7059 alert('Error saving removed background display image!')
7064 function GetCoordinatesRemoveBackgrounHistogram(e) {
7068 ImgPos = FindPosition(removeBackgroundHistogramImg);
7069 if (!e) var e = window.event;
7070 if (e.pageX || e.pageY) {
7074 else if (e.clientX || e.clientY) {
7075 PosX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
7076 PosY = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
7078 PosX = PosX - ImgPos[0];
7079 PosY = PosY - ImgPos[1];
7081 jQuery('div[name="drone_imagery_remove_background_threshold_current"]').html('<h5>Current Mouse Value: '+ (((PosX+1)/3)-1) );
7084 function GetCoordinatesRemoveBackgrounHistogramDrawLine(e) {
7087 var image_width = removeBackgroundHistogramImg.width;
7088 var image_height = removeBackgroundHistogramImg.height;
7091 ImgPos = FindPosition(removeBackgroundHistogramImg);
7092 if (!e) var e = window.event;
7093 if (e.pageX || e.pageY) {
7097 else if (e.clientX || e.clientY) {
7098 PosX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
7099 PosY = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
7101 PosX = PosX - ImgPos[0];
7102 PosY = PosY - ImgPos[1];
7104 if (!removeBackgroundThresholdPeak1 || !removeBackgroundThresholdPeak2) {
7105 removeBackgroundHistogramImgDrawLine(removeBackgroundHistogramImg, PosX, image_height, '#ff0000');
7107 var threshold_value = Math.round( (((PosX+1)/3)-1) );
7108 if (removeBackgroundThresholdPeak1) {
7109 removeBackgroundThresholdPeak2 = threshold_value;
7110 removeBackgroundThresholdPeak2pixels = PosX;
7112 removeBackgroundThresholdPeak1 = threshold_value;
7113 removeBackgroundThresholdPeak1pixels = PosX;
7118 jQuery('#drone_imagery_remove_background_submit').click(function(){
7119 manage_drone_imagery_remove_background_threshold_save(remove_background_current_image_id, remove_background_current_image_type, remove_background_drone_run_band_project_id, removeBackgroundThresholdValue, '255');
7122 jQuery('#drone_imagery_remove_background_defined_submit').click(function(){
7123 var remove_background_drone_run_band_lower_threshold = jQuery('#drone_imagery_remove_background_lower_threshold').val();
7124 var remove_background_drone_run_band_upper_threshold = jQuery('#drone_imagery_remove_background_upper_threshold').val();
7125 manage_drone_imagery_remove_background_threshold_save(remove_background_current_image_id, remove_background_current_image_type, remove_background_drone_run_band_project_id, remove_background_drone_run_band_lower_threshold, remove_background_drone_run_band_upper_threshold);
7128 function calculateThresholdPercentageValues(canvas_div_id, drone_imagery_remove_background_lower_percentage, drone_imagery_remove_background_upper_percentage) {
7129 var src = cv.imread(canvas_div_id);
7130 cv.cvtColor(src, src, cv.COLOR_RGBA2GRAY, 0);
7131 var srcVec = new cv.MatVector();
7132 srcVec.push_back(src);
7133 var total_pixels = src.cols * src.rows;
7134 var accumulate = false;
7136 var histSize = [256];
7137 var ranges = [0, 255];
7138 var hist = new cv.Mat();
7139 var mask = new cv.Mat();
7141 cv.calcHist(srcVec, channels, mask, hist, histSize, ranges, accumulate);
7143 var drone_imagery_remove_background_lower_percentage_threshold;
7144 var drone_imagery_remove_background_upper_percentage_threshold;
7145 for (let i = 0; i < histSize[0]; i++) {
7146 var binVal = hist.data32F[i];
7147 summing = summing + binVal;
7148 var percentage = summing / total_pixels;
7149 if (percentage >= drone_imagery_remove_background_lower_percentage) {
7150 drone_imagery_remove_background_lower_percentage_threshold = i;
7155 for (let i = 0; i < histSize[0]; i++) {
7156 var binVal = hist.data32F[i];
7157 summing = summing + binVal;
7158 var percentage = summing / total_pixels;
7159 if (percentage >= 1-drone_imagery_remove_background_upper_percentage) {
7160 drone_imagery_remove_background_upper_percentage_threshold = i;
7164 return [drone_imagery_remove_background_lower_percentage_threshold*100, drone_imagery_remove_background_upper_percentage_threshold*100];
7167 jQuery('#drone_imagery_remove_background_defined_percentage_submit').click(function(){
7168 var drone_imagery_remove_background_lower_percentage = Number(jQuery('#drone_imagery_remove_background_lower_threshold_percentage').val())/100;
7169 var drone_imagery_remove_background_upper_percentage = Number(jQuery('#drone_imagery_remove_background_upper_threshold_percentage').val())/100;
7171 var threshold_value_return = calculateThresholdPercentageValues('drone_imagery_remove_background_original', drone_imagery_remove_background_lower_percentage, drone_imagery_remove_background_upper_percentage);
7173 manage_drone_imagery_remove_background_threshold_save(remove_background_current_image_id, remove_background_current_image_type, remove_background_drone_run_band_project_id, threshold_value_return[0], threshold_value_return[1]);
7176 function manage_drone_imagery_remove_background_threshold_save(image_id, image_type, drone_run_band_project_id, lower_threshold, upper_threshold){
7179 url: '/api/drone_imagery/remove_background_save',
7182 'image_id': image_id,
7183 'image_type': image_type,
7184 'drone_run_band_project_id': drone_run_band_project_id,
7185 'lower_threshold': lower_threshold,
7186 'upper_threshold': upper_threshold
7188 beforeSend: function() {
7189 jQuery("#working_modal").modal("show");
7191 success: function(response){
7192 console.log(response);
7193 if(response.error) {
7194 alert(response.error);
7197 jQuery("#working_modal").modal("hide");
7200 error: function(response){
7201 jQuery("#working_modal").modal("hide");
7202 alert('Error saving removed background image!')
7208 //Calculate Phenotypes JS
7211 var manage_drone_imagery_calculate_phenotypes_drone_run_id;
7212 var manage_drone_imagery_calculate_phenotypes_drone_run_band_id;
7213 var manage_drone_imagery_calculate_phenotypes_drone_run_band_type;
7214 var manage_drone_imagery_calculate_phenotypes_plot_polygons_type;
7215 var manage_drone_image_calculate_phenotypes_zonal_time_cvterm_id = '';
7217 jQuery(document).on('click', 'button[name=project_drone_imagery_get_phenotypes]', function() {
7218 showManageDroneImagerySection('manage_drone_imagery_calculate_phenotypes_div');
7220 manage_drone_imagery_calculate_phenotypes_drone_run_id = jQuery(this).data('drone_run_project_id');
7221 manage_drone_imagery_calculate_phenotypes_drone_run_band_id = jQuery(this).data('drone_run_band_project_id');
7222 manage_drone_imagery_calculate_phenotypes_drone_run_band_type = jQuery(this).data('drone_run_band_project_type');
7223 manage_drone_imagery_calculate_phenotypes_plot_polygons_type = jQuery(this).data('plot_polygons_type');
7226 jQuery('#drone_imagery_calculate_phenotypes_sift').click(function(){
7230 url: '/api/drone_imagery/calculate_phenotypes?method=sift',
7233 'drone_run_band_project_id': manage_drone_imagery_calculate_phenotypes_drone_run_band_id,
7234 'drone_run_band_project_type': manage_drone_imagery_calculate_phenotypes_drone_run_band_type,
7235 'plot_polygons_type': manage_drone_imagery_calculate_phenotypes_plot_polygons_type
7237 beforeSend: function() {
7238 jQuery("#working_modal").modal("show");
7240 success: function(response){
7241 console.log(response);
7242 if(response.error) {
7243 alert(response.error);
7247 var html = '<table class="table table-bordered table-hover"><thead><tr><th>Observation Unit</th><th>SIFT Features Image</th></tr></thead><tbody>';
7248 for (var i=0; i<response.results.length; i++) {
7249 html = html + '<tr><td><a target="_blank" href="/stock/' + response.results[i].stock_id + '/view" >' + response.results[i].stock_uniquename + '</a></td><td>' + response.results[i].image + '</td></tr>';
7251 jQuery('#manage_drone_imagery_calculate_phenotypes_show_sift').html(html);
7253 jQuery("#working_modal").modal("hide");
7255 error: function(response){
7256 jQuery("#working_modal").modal("hide");
7257 alert('Error calculating sift features!')
7263 jQuery('#drone_imagery_calculate_phenotypes_orb').click(function(){
7267 url: '/api/drone_imagery/calculate_phenotypes?method=orb',
7270 'drone_run_band_project_id': manage_drone_imagery_calculate_phenotypes_drone_run_band_id,
7271 'drone_run_band_project_type': manage_drone_imagery_calculate_phenotypes_drone_run_band_type,
7272 'plot_polygons_type': manage_drone_imagery_calculate_phenotypes_plot_polygons_type
7274 beforeSend: function() {
7275 jQuery("#working_modal").modal("show");
7277 success: function(response){
7278 console.log(response);
7279 if(response.error) {
7280 alert(response.error);
7284 var html = '<table class="table table-bordered table-hover"><thead><tr><th>Observation Unit</th><th>ORB Features Image</th></tr></thead><tbody>';
7285 for (var i=0; i<response.results.length; i++) {
7286 html = html + '<tr><td><a target="_blank" href="/stock/' + response.results[i].stock_id + '/view" >' + response.results[i].stock_uniquename + '</a></td><td>' + response.results[i].image + '</td></tr>';
7288 jQuery('#manage_drone_imagery_calculate_phenotypes_show_orb').html(html);
7290 jQuery("#working_modal").modal("hide");
7292 error: function(response){
7293 jQuery("#working_modal").modal("hide");
7294 alert('Error calculating ORB features!')
7300 jQuery('#drone_imagery_calculate_phenotypes_surf').click(function(){
7304 url: '/api/drone_imagery/calculate_phenotypes?method=surf',
7307 'drone_run_band_project_id': manage_drone_imagery_calculate_phenotypes_drone_run_band_id,
7308 'drone_run_band_project_type': manage_drone_imagery_calculate_phenotypes_drone_run_band_type,
7309 'plot_polygons_type': manage_drone_imagery_calculate_phenotypes_plot_polygons_type
7311 beforeSend: function() {
7312 jQuery("#working_modal").modal("show");
7314 success: function(response){
7315 console.log(response);
7316 if(response.error) {
7317 alert(response.error);
7321 var html = '<table class="table table-bordered table-hover"><thead><tr><th>Observation Unit</th><th>SURF Features Image</th></tr></thead><tbody>';
7322 for (var i=0; i<response.results.length; i++) {
7323 html = html + '<tr><td><a target="_blank" href="/stock/' + response.results[i].stock_id + '/view" >' + response.results[i].stock_uniquename + '</a></td><td>' + response.results[i].image + '</td></tr>';
7325 jQuery('#manage_drone_imagery_calculate_phenotypes_show_surf').html(html);
7327 jQuery("#working_modal").modal("hide");
7329 error: function(response){
7330 jQuery("#working_modal").modal("hide");
7331 alert('Error calculating surf features!')
7337 jQuery('#drone_imagery_calculate_phenotypes_zonal_stats').click(function(){
7341 url: '/api/drone_imagery/get_weeks_after_planting_date?drone_run_project_id='+manage_drone_imagery_calculate_phenotypes_drone_run_id,
7343 beforeSend: function (){
7344 jQuery('#working_modal').modal('show');
7346 success: function(response){
7347 jQuery('#working_modal').modal('hide');
7348 console.log(response);
7349 if (response.error) {
7350 alert(response.error);
7353 var html = "<center><b>Field Trial Planting Date</b>: "+response.planting_date+"<br/><b>Imaging Event Date</b>: "+response.drone_run_date+"<br/><b>Number of Weeks</b>: "+response.rounded_time_difference_weeks+"<br/><b>Number of Weeks Ontology Term</b>: "+response.time_ontology_week_term+"<br/><b>Number of Days</b>:"+response.time_difference_days+"<br/><b>Number of Days Ontology Term</b>: "+response.time_ontology_day_term+"<br/><br/></center>";
7354 jQuery('#drone_imagery_calculate_phenotypes_zonal_stats_week_term_div').html(html);
7355 manage_drone_image_calculate_phenotypes_zonal_time_cvterm_id = response.time_ontology_day_cvterm_id;
7357 error: function(response){
7358 alert('Error getting time terms!');
7359 jQuery('#working_modal').modal('hide');
7363 jQuery('#drone_imagery_calc_phenotypes_zonal_channel_dialog').modal('show');
7366 jQuery('#drone_imagery_calculate_phenotypes_zonal_stats_channel_select').click(function(){
7367 if (manage_drone_image_calculate_phenotypes_zonal_time_cvterm_id == '') {
7368 alert('Time of phenotype not set for calculate zonal stats. This should not happen so please contact us!');
7374 url: '/api/drone_imagery/calculate_phenotypes?method=zonal',
7377 'drone_run_band_project_id': manage_drone_imagery_calculate_phenotypes_drone_run_band_id,
7378 'drone_run_band_project_type': manage_drone_imagery_calculate_phenotypes_drone_run_band_type,
7379 'time_cvterm_id': manage_drone_image_calculate_phenotypes_zonal_time_cvterm_id,
7380 'plot_polygons_type': manage_drone_imagery_calculate_phenotypes_plot_polygons_type,
7382 beforeSend: function() {
7383 jQuery("#working_modal").modal("show");
7385 success: function(response){
7386 console.log(response);
7387 jQuery("#working_modal").modal("hide");
7389 if(response.error) {
7390 alert(response.error);
7394 var html = '<table class="table table-bordered table-hover" id="manage_drone_imagery_zonal_stats_table"><thead><tr><th>Observation Unit</th><th>Image</th>';
7395 for (var i=0; i<response.result_header.length; i++) {
7396 html = html + '<th>'+response.result_header[i]+'</th>';
7398 html = html + '</tr></thead><tbody>';
7399 for (var i=0; i<response.results.length; i++) {
7400 html = html + '<tr><td><a target="_blank" href="/stock/' + response.results[i].stock_id + '/view" >' + response.results[i].stock_uniquename + '</a></td><td>' + response.results[i].image + '</td>';
7401 for (var j=0; j<response.results[i].result.length; j++){
7402 html = html + '<td>'+response.results[i].result[j]+'</td>';
7404 html = html + '</tr>';
7406 jQuery('#manage_drone_imagery_calculate_phenotypes_show_zonal_stats').html(html);
7407 jQuery('#manage_drone_imagery_zonal_stats_table').DataTable();
7409 jQuery('#drone_imagery_calc_phenotypes_zonal_channel_dialog').modal('hide');
7412 error: function(response){
7413 jQuery("#working_modal").modal("hide");
7414 alert('Error calculating zonal stats!')
7420 //RGB/3band Image Vegetative Index
7423 var manage_drone_imagery_vi_rgb_drone_run_band_project_id;
7424 var manage_drone_imagery_vi_rgb_denoised_stitched_image_id;
7425 var manage_drone_imagery_vi_drone_run_band_type;
7426 var manage_drone_imagery_vi_selected_index;
7427 var manage_drone_imagery_vi_selected_image_type;
7429 jQuery(document).on('click', 'button[name="project_drone_imagery_rgb_vegetative"]', function(){
7430 manage_drone_imagery_vi_rgb_drone_run_band_project_id = jQuery(this).data('drone_run_band_project_id');
7431 manage_drone_imagery_vi_rgb_denoised_stitched_image_id = jQuery(this).data('denoised_stitched_image_id');
7432 manage_drone_imagery_vi_drone_run_band_type = jQuery(this).data('drone_run_band_project_type');
7434 showManageDroneImagerySection('manage_drone_imagery_vegetative_index_div');
7436 jQuery('#manage_drone_imagery_vegetative_index_tgi_rgb_div').show();
7437 jQuery('#manage_drone_imagery_vegetative_index_tgi_bgr_div').hide();
7438 jQuery('#manage_drone_imagery_vegetative_index_vari_rgb_div').show();
7439 jQuery('#manage_drone_imagery_vegetative_index_vari_bgr_div').hide();
7440 jQuery('#manage_drone_imagery_vegetative_index_ndvi_div').hide();
7441 jQuery('#manage_drone_imagery_vegetative_index_ndre_div').hide();
7444 jQuery(document).on('click', 'button[name="project_drone_imagery_3_band_bgr_vegetative"]', function(){
7445 manage_drone_imagery_vi_rgb_drone_run_band_project_id = jQuery(this).data('drone_run_band_project_id');
7446 manage_drone_imagery_vi_rgb_denoised_stitched_image_id = jQuery(this).data('denoised_stitched_image_id');
7447 manage_drone_imagery_vi_drone_run_band_type = jQuery(this).data('drone_run_band_project_type');
7449 showManageDroneImagerySection('manage_drone_imagery_vegetative_index_div');
7451 jQuery('#manage_drone_imagery_vegetative_index_tgi_rgb_div').hide();
7452 jQuery('#manage_drone_imagery_vegetative_index_tgi_bgr_div').show();
7453 jQuery('#manage_drone_imagery_vegetative_index_vari_rgb_div').hide();
7454 jQuery('#manage_drone_imagery_vegetative_index_vari_bgr_div').show();
7455 jQuery('#manage_drone_imagery_vegetative_index_ndvi_div').hide();
7456 jQuery('#manage_drone_imagery_vegetative_index_ndre_div').hide();
7459 jQuery(document).on('click', 'button[name="project_drone_imagery_3_band_nrn_vegetative"]', function(){
7460 manage_drone_imagery_vi_rgb_drone_run_band_project_id = jQuery(this).data('drone_run_band_project_id');
7461 manage_drone_imagery_vi_rgb_denoised_stitched_image_id = jQuery(this).data('denoised_stitched_image_id');
7462 manage_drone_imagery_vi_drone_run_band_type = jQuery(this).data('drone_run_band_project_type');
7464 showManageDroneImagerySection('manage_drone_imagery_vegetative_index_div');
7466 jQuery('#manage_drone_imagery_vegetative_index_tgi_rgb_div').hide();
7467 jQuery('#manage_drone_imagery_vegetative_index_tgi_bgr_div').hide();
7468 jQuery('#manage_drone_imagery_vegetative_index_vari_rgb_div').hide();
7469 jQuery('#manage_drone_imagery_vegetative_index_vari_bgr_div').hide();
7470 jQuery('#manage_drone_imagery_vegetative_index_ndvi_div').show();
7471 jQuery('#manage_drone_imagery_vegetative_index_ndre_div').hide();
7474 jQuery(document).on('click', 'button[name="project_drone_imagery_3_band_nren_vegetative"]', function(){
7475 manage_drone_imagery_vi_rgb_drone_run_band_project_id = jQuery(this).data('drone_run_band_project_id');
7476 manage_drone_imagery_vi_rgb_denoised_stitched_image_id = jQuery(this).data('denoised_stitched_image_id');
7477 manage_drone_imagery_vi_drone_run_band_type = jQuery(this).data('drone_run_band_project_type');
7479 showManageDroneImagerySection('manage_drone_imagery_vegetative_index_div');
7481 jQuery('#manage_drone_imagery_vegetative_index_tgi_rgb_div').hide();
7482 jQuery('#manage_drone_imagery_vegetative_index_tgi_bgr_div').hide();
7483 jQuery('#manage_drone_imagery_vegetative_index_vari_rgb_div').hide();
7484 jQuery('#manage_drone_imagery_vegetative_index_vari_bgr_div').hide();
7485 jQuery('#manage_drone_imagery_vegetative_index_ndvi_div').hide();
7486 jQuery('#manage_drone_imagery_vegetative_index_ndre_div').show();
7489 jQuery('#drone_imagery_vegetative_index_TGI_bgr').click(function(){
7490 manage_drone_imagery_vi_selected_index = 'TGI';
7491 manage_drone_imagery_vi_selected_image_type = 'BGR';
7492 getVegetativeIndex('calculate_vegetative_index', manage_drone_imagery_vi_rgb_denoised_stitched_image_id, manage_drone_imagery_vi_rgb_drone_run_band_project_id, manage_drone_imagery_vi_drone_run_band_type, manage_drone_imagery_vi_selected_index, 1, manage_drone_imagery_vi_selected_image_type);
7495 jQuery('#drone_imagery_vegetative_index_TGI_rgb').click(function(){
7496 manage_drone_imagery_vi_selected_index = 'TGI';
7497 manage_drone_imagery_vi_selected_image_type = 'BGR';
7498 getVegetativeIndex('calculate_vegetative_index', manage_drone_imagery_vi_rgb_denoised_stitched_image_id, manage_drone_imagery_vi_rgb_drone_run_band_project_id, manage_drone_imagery_vi_drone_run_band_type, manage_drone_imagery_vi_selected_index, 1, manage_drone_imagery_vi_selected_image_type);
7501 jQuery('#drone_imagery_vegetative_index_VARI_bgr').click(function(){
7502 manage_drone_imagery_vi_selected_index = 'VARI';
7503 manage_drone_imagery_vi_selected_image_type = 'BGR';
7504 getVegetativeIndex('calculate_vegetative_index', manage_drone_imagery_vi_rgb_denoised_stitched_image_id, manage_drone_imagery_vi_rgb_drone_run_band_project_id, manage_drone_imagery_vi_drone_run_band_type, manage_drone_imagery_vi_selected_index, 1, manage_drone_imagery_vi_selected_image_type);
7507 jQuery('#drone_imagery_vegetative_index_VARI_rgb').click(function(){
7508 manage_drone_imagery_vi_selected_index = 'VARI';
7509 manage_drone_imagery_vi_selected_image_type = 'BGR';
7510 getVegetativeIndex('calculate_vegetative_index', manage_drone_imagery_vi_rgb_denoised_stitched_image_id, manage_drone_imagery_vi_rgb_drone_run_band_project_id, manage_drone_imagery_vi_drone_run_band_type, manage_drone_imagery_vi_selected_index, 1, manage_drone_imagery_vi_selected_image_type);
7513 jQuery('#drone_imagery_vegetative_index_NDVI').click(function(){
7514 manage_drone_imagery_vi_selected_index = 'NDVI';
7515 manage_drone_imagery_vi_selected_image_type = 'NRN';
7516 getVegetativeIndex('calculate_vegetative_index', manage_drone_imagery_vi_rgb_denoised_stitched_image_id, manage_drone_imagery_vi_rgb_drone_run_band_project_id, manage_drone_imagery_vi_drone_run_band_type, manage_drone_imagery_vi_selected_index, 1, manage_drone_imagery_vi_selected_image_type);
7519 jQuery('#drone_imagery_vegetative_index_NDRE').click(function(){
7520 manage_drone_imagery_vi_selected_index = 'NDRE';
7521 manage_drone_imagery_vi_selected_image_type = 'NReN';
7522 getVegetativeIndex('calculate_vegetative_index', manage_drone_imagery_vi_rgb_denoised_stitched_image_id, manage_drone_imagery_vi_rgb_drone_run_band_project_id, manage_drone_imagery_vi_drone_run_band_type, manage_drone_imagery_vi_selected_index, 1, manage_drone_imagery_vi_selected_image_type);
7525 jQuery('#drone_imagery_rgb_vegetative_index_submit').click(function(){
7526 getVegetativeIndex('calculate_vegetative_index', manage_drone_imagery_vi_rgb_denoised_stitched_image_id, manage_drone_imagery_vi_rgb_drone_run_band_project_id, manage_drone_imagery_vi_drone_run_band_type, manage_drone_imagery_vi_selected_index, 0, manage_drone_imagery_vi_selected_image_type);
7529 function getVegetativeIndex(url_part, image_id, drone_run_band_project_id, drone_run_band_project_type, index, view_only, manage_drone_imagery_vi_selected_image_type) {
7532 url: '/api/drone_imagery/'+url_part,
7535 'image_id': image_id,
7536 'drone_run_band_project_id': drone_run_band_project_id,
7537 'vegetative_index': index,
7538 'drone_run_band_project_type': drone_run_band_project_type,
7539 'view_only': view_only,
7540 'image_type': manage_drone_imagery_vi_selected_image_type
7542 beforeSend: function() {
7543 jQuery("#working_modal").modal("show");
7545 success: function(response){
7546 console.log(response);
7547 jQuery("#working_modal").modal("hide");
7549 if(response.error) {
7550 alert(response.error);
7553 if (view_only == 1) {
7554 var canvas = document.getElementById('drone_imagery_vegetative_index_original_stitched_div');
7555 ctx = canvas.getContext('2d');
7556 var image = new Image();
7557 image.onload = function () {
7558 canvas.width = this.naturalWidth;
7559 canvas.height = this.naturalHeight;
7560 ctx.drawImage(this, 0, 0);
7562 image.src = response.index_image_url;
7567 error: function(response){
7568 alert('Error getting vegetative index!')
7574 // Apply Masks From Background Removed Vegetative Index to Denoised Image
7577 jQuery(document).on('click', 'button[name="project_drone_imagery_apply_tgi_removed_background_mask_to_denoised_image"]', function(){
7578 drone_imagery_mask_remove_background(jQuery(this).data('denoised_stitched_image_id'), jQuery(this).data('background_removed_tgi_stitched_image_id'), jQuery(this).data('drone_run_band_project_id'), 'denoised_background_removed_thresholded_tgi_mask_original');
7581 jQuery(document).on('click', 'button[name="project_drone_imagery_apply_vari_removed_background_mask_to_denoised_image"]', function(){
7582 drone_imagery_mask_remove_background(jQuery(this).data('denoised_stitched_image_id'), jQuery(this).data('background_removed_vari_stitched_image_id'), jQuery(this).data('drone_run_band_project_id'), 'denoised_background_removed_thresholded_vari_mask_original');
7585 jQuery(document).on('click', 'button[name="project_drone_imagery_apply_ndvi_removed_background_mask_to_denoised_image"]', function(){
7586 drone_imagery_mask_remove_background(jQuery(this).data('denoised_stitched_image_id'), jQuery(this).data('background_removed_ndvi_stitched_image_id'), jQuery(this).data('drone_run_band_project_id'), 'denoised_background_removed_thresholded_ndvi_mask_original');
7589 jQuery(document).on('click', 'button[name="project_drone_imagery_apply_ndre_removed_background_mask_to_denoised_image"]', function(){
7590 drone_imagery_mask_remove_background(jQuery(this).data('denoised_stitched_image_id'), jQuery(this).data('background_removed_ndre_stitched_image_id'), jQuery(this).data('drone_run_band_project_id'), 'denoised_background_removed_thresholded_ndre_mask_original');
7593 jQuery(document).on('click', 'button[name="project_drone_imagery_apply_tgi_mask_to_denoised_image"]', function(){
7594 drone_imagery_mask_remove_background(jQuery(this).data('denoised_stitched_image_id'), jQuery(this).data('tgi_stitched_image_id'), jQuery(this).data('drone_run_band_project_id'), 'denoised_background_removed_tgi_mask_original');
7597 jQuery(document).on('click', 'button[name="project_drone_imagery_apply_vari_mask_to_denoised_image"]', function(){
7598 drone_imagery_mask_remove_background(jQuery(this).data('denoised_stitched_image_id'), jQuery(this).data('vari_stitched_image_id'), jQuery(this).data('drone_run_band_project_id'), 'denoised_background_removed_vari_mask_original');
7601 jQuery(document).on('click', 'button[name="project_drone_imagery_apply_ndvi_mask_to_denoised_image"]', function(){
7602 drone_imagery_mask_remove_background(jQuery(this).data('denoised_stitched_image_id'), jQuery(this).data('ndvi_stitched_image_id'), jQuery(this).data('drone_run_band_project_id'), 'denoised_background_removed_ndvi_mask_original');
7605 jQuery(document).on('click', 'button[name="project_drone_imagery_apply_ndre_mask_to_denoised_image"]', function(){
7606 drone_imagery_mask_remove_background(jQuery(this).data('denoised_stitched_image_id'), jQuery(this).data('ndre_stitched_image_id'), jQuery(this).data('drone_run_band_project_id'), 'denoised_background_removed_ndre_mask_original');
7609 function drone_imagery_mask_remove_background(image_id, mask_image_id, drone_run_band_project_id, mask_type) {
7612 url: '/api/drone_imagery/mask_remove_background',
7615 'image_id': image_id,
7616 'mask_image_id': mask_image_id,
7617 'drone_run_band_project_id': drone_run_band_project_id,
7618 'mask_type': mask_type
7620 beforeSend: function() {
7621 jQuery("#working_modal").modal("show");
7623 success: function(response){
7624 console.log(response);
7625 jQuery("#working_modal").modal("hide");
7627 if(response.error) {
7628 alert(response.error);
7633 error: function(response){
7634 alert('Error removing background using mask of vegetative index!' + mask_type);
7640 // Run and save Fourier Transform HPF30
7643 var manage_drone_imagery_ft_hpf30_drone_run_band_project_id = '';
7644 var manage_drone_imagery_ft_hpf30_image_id = '';
7645 var manage_drone_imagery_ft_hpf30_drone_run_band_type = '';
7646 var manage_drone_imagery_ft_hpf30_selected_image_type = '';
7648 jQuery(document).on('click', 'button[name="project_drone_imagery_fourier_transform_hpf30"]', function(){
7649 manage_drone_imagery_ft_hpf30_drone_run_band_project_id = jQuery(this).data('drone_run_band_project_id');
7650 manage_drone_imagery_ft_hpf30_image_id = jQuery(this).data('image_id');
7651 manage_drone_imagery_ft_hpf30_drone_run_band_type = jQuery(this).data('drone_run_band_project_type');
7652 manage_drone_imagery_ft_hpf30_selected_image_type = jQuery(this).data('selected_image_type');
7653 getFourierTransform(30, manage_drone_imagery_ft_hpf30_image_id, manage_drone_imagery_ft_hpf30_drone_run_band_project_id, manage_drone_imagery_ft_hpf30_drone_run_band_type, manage_drone_imagery_ft_hpf30_selected_image_type, 'frequency');
7656 function getFourierTransform(high_pass_filter, image_id, drone_run_band_project_id, drone_run_band_project_type, selected_image_type, high_pass_filter_type) {
7659 url: '/api/drone_imagery/calculate_fourier_transform',
7662 'image_id': image_id,
7663 'drone_run_band_project_id': drone_run_band_project_id,
7664 'drone_run_band_project_type': drone_run_band_project_type,
7665 'high_pass_filter': high_pass_filter,
7666 'high_pass_filter_type': high_pass_filter_type,
7667 'image_type': selected_image_type
7669 beforeSend: function() {
7670 jQuery("#working_modal").modal("show");
7672 success: function(response){
7673 console.log(response);
7674 jQuery("#working_modal").modal("hide");
7676 if(response.error) {
7677 alert(response.error);
7682 error: function(response){
7683 jQuery("#working_modal").modal("hide");
7684 alert('Error getting fourier transform!')
7690 // Merge bands into single image
7693 var drone_imagery_merge_channels_drone_run_project_id;
7694 var drone_imagery_merge_channels_drone_run_project_name;
7695 jQuery(document).on('click', 'button[name="project_drone_imagery_merge_channels"]', function() {
7696 drone_imagery_merge_channels_drone_run_project_id = jQuery(this).data('drone_run_project_id');
7697 drone_imagery_merge_channels_drone_run_project_name = jQuery(this).data('drone_run_project_name');
7699 jQuery('#drone_imagery_merge_channels_dialog').modal('show');
7701 get_select_box('drone_imagery_drone_run_band','drone_imagery_merge_bands_band1_select', {'id':'drone_run_merge_band_select_1', 'name':'drone_run_merge_band_select_1', 'empty':1, 'drone_run_project_id':drone_imagery_merge_channels_drone_run_project_id });
7702 get_select_box('drone_imagery_drone_run_band','drone_imagery_merge_bands_band2_select', {'id':'drone_run_merge_band_select_2', 'name':'drone_run_merge_band_select_2', 'empty':1, 'drone_run_project_id':drone_imagery_merge_channels_drone_run_project_id });
7703 get_select_box('drone_imagery_drone_run_band','drone_imagery_merge_bands_band3_select', {'id':'drone_run_merge_band_select_3', 'name':'drone_run_merge_band_select_3', 'empty':1, 'drone_run_project_id':drone_imagery_merge_channels_drone_run_project_id });
7706 jQuery('#drone_imagery_merge_bands_submit').click(function(){
7707 var band_1_drone_run_band_project_id = jQuery('#drone_run_merge_band_select_1').val();
7708 var band_2_drone_run_band_project_id = jQuery('#drone_run_merge_band_select_2').val();
7709 var band_3_drone_run_band_project_id = jQuery('#drone_run_merge_band_select_3').val();
7710 var merged_image_type = jQuery('#drone_run_merge_image_type').val();
7711 if (merged_image_type == '') {
7712 alert('Please select a merged image type first!');
7718 url: '/api/drone_imagery/merge_bands',
7721 'band_1_drone_run_band_project_id': band_1_drone_run_band_project_id,
7722 'band_2_drone_run_band_project_id': band_2_drone_run_band_project_id,
7723 'band_3_drone_run_band_project_id': band_3_drone_run_band_project_id,
7724 'drone_run_project_id': drone_imagery_merge_channels_drone_run_project_id,
7725 'drone_run_project_name': drone_imagery_merge_channels_drone_run_project_name,
7726 'merged_image_type' : merged_image_type
7728 beforeSend: function() {
7729 jQuery("#working_modal").modal("show");
7731 success: function(response){
7732 console.log(response);
7733 jQuery("#working_modal").modal("hide");
7735 if(response.error) {
7736 alert(response.error);
7741 error: function(response){
7742 jQuery("#working_modal").modal("hide");
7743 alert('Error merging bands!')
7749 // Compare Aerial Field Images
7752 var drone_imagery_compare_images_comparison_type = '';
7753 var drone_imagery_compare_images_field_trial_ids = [];
7754 var drone_imagery_compare_images_field_trial_id_string = '';
7755 var drone_imagery_compare_images_drone_run_ids = [];
7756 var drone_imagery_compare_images_drone_run_band_ids = [];
7757 var drone_imagery_compare_images_image_types = [];
7759 jQuery('#drone_imagery_compare_field_images_link').click(function(){
7760 jQuery('#drone_imagery_compare_images_dialog').modal('show');
7762 drone_imagery_compare_images_comparison_type = '';
7763 drone_imagery_compare_images_field_trial_ids = [];
7764 drone_imagery_compare_images_field_trial_id_string = '';
7765 drone_imagery_compare_images_drone_run_ids = [];
7766 drone_imagery_compare_images_image_types = [];
7769 jQuery('#drone_imagery_compare_images_comparison_select_step').click(function(){
7770 get_select_box('trials', 'drone_imagery_compare_images_trial_select_div', { 'name' : 'drone_imagery_compare_images_field_trial_id', 'id' : 'drone_imagery_compare_images_field_trial_id', 'empty':1, 'multiple':1 });
7772 Workflow.complete("#drone_imagery_compare_images_comparison_select_step");
7773 Workflow.focus('#drone_imagery_compare_images_workflow', 1);
7777 jQuery('#drone_imagery_compare_images_field_trial_select_step').click(function(){
7778 drone_imagery_compare_images_field_trial_ids = [];
7779 drone_imagery_compare_images_field_trial_id_string = '';
7780 drone_imagery_compare_images_field_trial_ids = jQuery('#drone_imagery_compare_images_field_trial_id').val();
7781 drone_imagery_compare_images_field_trial_id_string = drone_imagery_compare_images_field_trial_ids.join(",");
7782 if (drone_imagery_compare_images_field_trial_id_string == '') {
7783 alert('Please select a field trial first!');
7785 jQuery('#drone_image_compare_images_drone_runs_table').DataTable({
7787 ajax : '/api/drone_imagery/drone_runs?select_checkbox_name=drone_imagery_compare_images_drone_run_select&field_trial_ids='+drone_imagery_compare_images_field_trial_id_string
7790 Workflow.complete("#drone_imagery_compare_images_field_trial_select_step");
7791 Workflow.focus('#drone_imagery_compare_images_workflow', 2);
7796 jQuery('#drone_imagery_compare_images_drone_runs_select_step').click(function(){
7797 drone_imagery_compare_images_drone_run_ids = [];
7798 jQuery('input[name="drone_imagery_compare_images_drone_run_select"]:checked').each(function() {
7799 drone_imagery_compare_images_drone_run_ids.push(jQuery(this).val());
7801 if (drone_imagery_compare_images_drone_run_ids.length < 1){
7802 alert('Please select at least one imaging event!');
7803 } else if (drone_imagery_compare_images_drone_run_ids.length > 2){
7804 alert('Please select a maximum of two imaging events, given that we can only compare two images at a time here.');
7806 jQuery('#drone_image_compare_images_drone_run_bands_table').DataTable({
7808 ajax : '/api/drone_imagery/drone_run_bands?select_checkbox_name=drone_run_compare_images_band_select&drone_run_project_ids='+JSON.stringify(drone_imagery_compare_images_drone_run_ids)
7811 Workflow.complete("#drone_imagery_compare_images_drone_runs_select_step");
7812 Workflow.focus('#drone_imagery_compare_images_workflow', 3);
7817 jQuery('#drone_imagery_compare_images_drone_run_bands_select_step').click(function(){
7818 drone_imagery_compare_images_drone_run_band_ids = [];
7819 jQuery('input[name="drone_run_compare_images_band_select"]:checked').each(function() {
7820 drone_imagery_compare_images_drone_run_band_ids.push(jQuery(this).val());
7822 if (drone_imagery_compare_images_drone_run_band_ids.length < 1){
7823 alert('Please select at least one imaging event band!');
7824 } else if (drone_imagery_compare_images_drone_run_band_ids.length > 2){
7825 alert('Please select a maximum of two imaging event bands, given that we can only compare two images at a time here.');
7827 jQuery('#drone_imagery_compare_images_images_type_table').DataTable({
7830 ajax : '/api/drone_imagery/plot_polygon_types?select_checkbox_name=drone_imagery_compare_images_plot_polygon_type_select&field_trial_ids='+drone_imagery_compare_images_field_trial_id_string+'&drone_run_ids='+JSON.stringify(drone_imagery_compare_images_drone_run_ids)+'&field_trial_images_only=1+&drone_run_band_ids='+JSON.stringify(drone_imagery_compare_images_drone_run_band_ids)
7833 Workflow.complete("#drone_imagery_compare_images_drone_run_bands_select_step");
7834 Workflow.focus('#drone_imagery_compare_images_workflow', 4);
7839 jQuery('#drone_imagery_compare_images_images_select_step').click(function(){
7840 drone_imagery_compare_images_image_types = [];
7841 jQuery('input[name="drone_imagery_compare_images_plot_polygon_type_select"]:checked').each(function() {
7842 drone_imagery_compare_images_image_types.push(jQuery(this).val());
7844 if (drone_imagery_compare_images_image_types.length < 1){
7845 alert('Please select at least one image type!');
7846 } else if (drone_imagery_compare_images_image_types.length > 2){
7847 alert('Please select a maximum of two image types, given that we can only compare two images at a time here.');
7850 url : '/api/drone_imagery/compare_images?drone_run_ids='+JSON.stringify(drone_imagery_compare_images_drone_run_ids)+'&drone_run_band_ids='+JSON.stringify(drone_imagery_compare_images_drone_run_band_ids)+'&image_type_ids='+JSON.stringify(drone_imagery_compare_images_image_types)+'&comparison_type='+jQuery('#drone_imagery_compare_images_comparison_select').val(),
7851 beforeSend: function() {
7852 jQuery("#working_modal").modal("show");
7854 success: function(response){
7855 console.log(response);
7856 jQuery("#working_modal").modal("hide");
7858 var html = '<a target=_blank href="'+response.result+'">File</a>';
7859 jQuery('#drone_imagery_compare_images_result_div').html(html);
7861 Workflow.complete("#drone_imagery_compare_images_images_select_step");
7862 Workflow.focus('#drone_imagery_compare_images_workflow', 5);
7864 error: function(response){
7865 jQuery("#working_modal").modal("hide");
7866 alert('Error comparing images!')
7874 // Delete imaging event
7877 var manage_drone_imagery_delete_drone_run_project_id;
7878 jQuery(document).on('click', 'button[name="project_drone_imagery_delete_drone_run"]', function(){
7879 manage_drone_imagery_delete_drone_run_project_id = jQuery(this).data('drone_run_project_id');
7880 jQuery('#drone_imagery_delete_drone_run_dialog').modal('show');
7883 jQuery('#drone_imagery_delete_drone_run_confirm').click(function(){
7886 url: '/api/drone_imagery/delete_drone_run?drone_run_project_id='+manage_drone_imagery_delete_drone_run_project_id,
7887 beforeSend: function() {
7888 jQuery("#working_modal").modal("show");
7890 success: function(response){
7891 console.log(response);
7892 jQuery("#working_modal").modal("hide");
7894 if(response.error) {
7895 alert(response.error);
7897 if(response.success) {
7898 alert('Imaging event deleted successfully!');
7902 error: function(response){
7903 jQuery("#working_modal").modal("hide");
7904 alert('Error deleting imaging event!')
7910 // Quality Control Plot Images
7913 var manage_drone_imagery_quality_control_field_trial_id;
7914 var manage_drone_imagery_quality_control_drone_run_id;
7916 jQuery(document).on('click', 'button[name="project_drone_imagery_quality_control_check"]',function() {
7917 showManageDroneImagerySection('manage_drone_imagery_quality_control_div');
7919 alert('Clicking any of these checkboxes will obsolete the image and cannot be readily reversed!');
7921 manage_drone_imagery_quality_control_field_trial_id = jQuery(this).data('field_trial_id');
7922 manage_drone_imagery_quality_control_drone_run_id = jQuery(this).data('drone_run_project_id');
7926 url: '/api/drone_imagery/quality_control_get_images?drone_run_project_id='+manage_drone_imagery_quality_control_drone_run_id,
7927 beforeSend: function() {
7928 jQuery("#working_modal").modal("show");
7930 success: function(response){
7931 console.log(response);
7932 jQuery("#working_modal").modal("hide");
7934 if (response.error) {
7935 alert(response.error);
7937 var html = '<table class="table table-hover table-bordered"><thead><tr><th>Plot Name</th><td>Images (Select to obsolete)</td></tr></thead><tbody>';
7938 for(var i=0; i<response.result.length; i++) {
7939 html = html + '<tr><td>'+response.result[i][0]+'</td><td>'+response.result[i][1]+'</td></tr>';
7941 html = html + '</tbody></table>';
7942 jQuery('#drone_imagery_quality_control_div').html(html);
7944 error: function(response){
7945 jQuery("#working_modal").modal("hide");
7946 alert('Error getting images for quality check!');
7952 jQuery(document).on('change', 'input[name="manage_drone_imagery_quality_control_image_select"]', function(){
7953 var image_id = jQuery(this).val();
7954 var checked = this.checked;
7958 url: '/api/drone_imagery/obsolete_image_change?image_id='+image_id,
7959 success: function(response){
7960 console.log(response);
7962 error: function(response){
7963 alert('Error obsoleting image!');
7968 function showManageDroneImagerySection(section_div_id) {
7969 console.log(section_div_id);
7970 if (section_div_id == 'manage_drone_imagery_crop_div') {
7971 jQuery('#manage_drone_imagery_crop_div').show();
7972 jQuery('#manage_drone_imagery_top_div').hide();
7973 jQuery('#manage_drone_imagery_plot_polygons_div').hide();
7974 jQuery('#manage_drone_imagery_calculate_phenotypes_div').hide();
7975 jQuery('#manage_drone_imagery_remove_background_div').hide();
7976 jQuery('#manage_drone_imagery_rotate_div').hide();
7977 jQuery('#manage_drone_imagery_vegetative_index_div').hide();
7978 jQuery('#manage_drone_imagery_standard_process_div').hide();
7979 jQuery('#manage_drone_imagery_standard_process_raw_images_div').hide();
7980 jQuery('#manage_drone_imagery_standard_process_raw_images_interactive_div').hide();
7981 jQuery('#project_drone_imagery_ground_control_points_div').hide();
7982 jQuery('#manage_drone_imagery_quality_control_div').hide();
7983 jQuery('#manage_drone_imagery_field_trial_time_series_div').hide();
7984 jQuery('#manage_drone_imagery_loading_div').hide();
7985 } else if (section_div_id == 'manage_drone_imagery_top_div'){
7986 jQuery('#manage_drone_imagery_crop_div').hide();
7987 jQuery('#manage_drone_imagery_top_div').show();
7988 jQuery('#manage_drone_imagery_plot_polygons_div').hide();
7989 jQuery('#manage_drone_imagery_calculate_phenotypes_div').hide();
7990 jQuery('#manage_drone_imagery_remove_background_div').hide();
7991 jQuery('#manage_drone_imagery_rotate_div').hide();
7992 jQuery('#manage_drone_imagery_vegetative_index_div').hide();
7993 jQuery('#manage_drone_imagery_standard_process_div').hide();
7994 jQuery('#manage_drone_imagery_standard_process_raw_images_div').hide();
7995 jQuery('#manage_drone_imagery_standard_process_raw_images_interactive_div').hide();
7996 jQuery('#project_drone_imagery_ground_control_points_div').hide();
7997 jQuery('#manage_drone_imagery_quality_control_div').hide();
7998 jQuery('#manage_drone_imagery_field_trial_time_series_div').hide();
7999 jQuery('#manage_drone_imagery_loading_div').hide();
8000 } else if (section_div_id == 'manage_drone_imagery_plot_polygons_div'){
8001 jQuery('#manage_drone_imagery_crop_div').hide();
8002 jQuery('#manage_drone_imagery_top_div').hide();
8003 jQuery('#manage_drone_imagery_plot_polygons_div').show();
8004 jQuery('#manage_drone_imagery_calculate_phenotypes_div').hide();
8005 jQuery('#manage_drone_imagery_remove_background_div').hide();
8006 jQuery('#manage_drone_imagery_rotate_div').hide();
8007 jQuery('#manage_drone_imagery_vegetative_index_div').hide();
8008 jQuery('#manage_drone_imagery_standard_process_div').hide();
8009 jQuery('#manage_drone_imagery_standard_process_raw_images_div').hide();
8010 jQuery('#manage_drone_imagery_standard_process_raw_images_interactive_div').hide();
8011 jQuery('#project_drone_imagery_ground_control_points_div').hide();
8012 jQuery('#manage_drone_imagery_quality_control_div').hide();
8013 jQuery('#manage_drone_imagery_field_trial_time_series_div').hide();
8014 jQuery('#manage_drone_imagery_loading_div').hide();
8015 } else if (section_div_id == 'manage_drone_imagery_calculate_phenotypes_div'){
8016 jQuery('#manage_drone_imagery_crop_div').hide();
8017 jQuery('#manage_drone_imagery_top_div').hide();
8018 jQuery('#manage_drone_imagery_plot_polygons_div').hide();
8019 jQuery('#manage_drone_imagery_calculate_phenotypes_div').show();
8020 jQuery('#manage_drone_imagery_remove_background_div').hide();
8021 jQuery('#manage_drone_imagery_rotate_div').hide();
8022 jQuery('#manage_drone_imagery_vegetative_index_div').hide();
8023 jQuery('#manage_drone_imagery_standard_process_div').hide();
8024 jQuery('#manage_drone_imagery_standard_process_raw_images_div').hide();
8025 jQuery('#manage_drone_imagery_standard_process_raw_images_interactive_div').hide();
8026 jQuery('#project_drone_imagery_ground_control_points_div').hide();
8027 jQuery('#manage_drone_imagery_quality_control_div').hide();
8028 jQuery('#manage_drone_imagery_field_trial_time_series_div').hide();
8029 jQuery('#manage_drone_imagery_loading_div').hide();
8030 } else if (section_div_id == 'manage_drone_imagery_remove_background_div'){
8031 jQuery('#manage_drone_imagery_crop_div').hide();
8032 jQuery('#manage_drone_imagery_top_div').hide();
8033 jQuery('#manage_drone_imagery_plot_polygons_div').hide();
8034 jQuery('#manage_drone_imagery_calculate_phenotypes_div').hide();
8035 jQuery('#manage_drone_imagery_remove_background_div').show();
8036 jQuery('#manage_drone_imagery_rotate_div').hide();
8037 jQuery('#manage_drone_imagery_vegetative_index_div').hide();
8038 jQuery('#manage_drone_imagery_standard_process_div').hide();
8039 jQuery('#manage_drone_imagery_standard_process_raw_images_div').hide();
8040 jQuery('#manage_drone_imagery_standard_process_raw_images_interactive_div').hide();
8041 jQuery('#project_drone_imagery_ground_control_points_div').hide();
8042 jQuery('#manage_drone_imagery_quality_control_div').hide();
8043 jQuery('#manage_drone_imagery_field_trial_time_series_div').hide();
8044 jQuery('#manage_drone_imagery_loading_div').hide();
8045 } else if (section_div_id == 'manage_drone_imagery_rotate_div'){
8046 jQuery('#manage_drone_imagery_crop_div').hide();
8047 jQuery('#manage_drone_imagery_top_div').hide();
8048 jQuery('#manage_drone_imagery_plot_polygons_div').hide();
8049 jQuery('#manage_drone_imagery_calculate_phenotypes_div').hide();
8050 jQuery('#manage_drone_imagery_remove_background_div').hide();
8051 jQuery('#manage_drone_imagery_rotate_div').show();
8052 jQuery('#manage_drone_imagery_vegetative_index_div').hide();
8053 jQuery('#manage_drone_imagery_standard_process_div').hide();
8054 jQuery('#manage_drone_imagery_standard_process_raw_images_div').hide();
8055 jQuery('#manage_drone_imagery_standard_process_raw_images_interactive_div').hide();
8056 jQuery('#project_drone_imagery_ground_control_points_div').hide();
8057 jQuery('#manage_drone_imagery_quality_control_div').hide();
8058 jQuery('#manage_drone_imagery_field_trial_time_series_div').hide();
8059 jQuery('#manage_drone_imagery_loading_div').hide();
8060 } else if (section_div_id == 'manage_drone_imagery_vegetative_index_div'){
8061 jQuery('#manage_drone_imagery_crop_div').hide();
8062 jQuery('#manage_drone_imagery_top_div').hide();
8063 jQuery('#manage_drone_imagery_plot_polygons_div').hide();
8064 jQuery('#manage_drone_imagery_calculate_phenotypes_div').hide();
8065 jQuery('#manage_drone_imagery_remove_background_div').hide();
8066 jQuery('#manage_drone_imagery_rotate_div').hide();
8067 jQuery('#manage_drone_imagery_vegetative_index_div').show();
8068 jQuery('#manage_drone_imagery_standard_process_div').hide();
8069 jQuery('#manage_drone_imagery_standard_process_raw_images_div').hide();
8070 jQuery('#manage_drone_imagery_standard_process_raw_images_interactive_div').hide();
8071 jQuery('#project_drone_imagery_ground_control_points_div').hide();
8072 jQuery('#manage_drone_imagery_quality_control_div').hide();
8073 jQuery('#manage_drone_imagery_field_trial_time_series_div').hide();
8074 jQuery('#manage_drone_imagery_loading_div').hide();
8075 } else if (section_div_id == 'manage_drone_imagery_standard_process_div'){
8076 jQuery('#manage_drone_imagery_crop_div').hide();
8077 jQuery('#manage_drone_imagery_top_div').hide();
8078 jQuery('#manage_drone_imagery_plot_polygons_div').hide();
8079 jQuery('#manage_drone_imagery_calculate_phenotypes_div').hide();
8080 jQuery('#manage_drone_imagery_remove_background_div').hide();
8081 jQuery('#manage_drone_imagery_rotate_div').hide();
8082 jQuery('#manage_drone_imagery_vegetative_index_div').hide();
8083 jQuery('#manage_drone_imagery_standard_process_div').show();
8084 jQuery('#manage_drone_imagery_standard_process_raw_images_div').hide();
8085 jQuery('#manage_drone_imagery_standard_process_raw_images_interactive_div').hide();
8086 jQuery('#project_drone_imagery_ground_control_points_div').hide();
8087 jQuery('#manage_drone_imagery_quality_control_div').hide();
8088 jQuery('#manage_drone_imagery_field_trial_time_series_div').hide();
8089 jQuery('#manage_drone_imagery_loading_div').hide();
8090 } else if (section_div_id == 'manage_drone_imagery_standard_process_raw_images_div'){
8091 jQuery('#manage_drone_imagery_crop_div').hide();
8092 jQuery('#manage_drone_imagery_top_div').hide();
8093 jQuery('#manage_drone_imagery_plot_polygons_div').hide();
8094 jQuery('#manage_drone_imagery_calculate_phenotypes_div').hide();
8095 jQuery('#manage_drone_imagery_remove_background_div').hide();
8096 jQuery('#manage_drone_imagery_rotate_div').hide();
8097 jQuery('#manage_drone_imagery_vegetative_index_div').hide();
8098 jQuery('#manage_drone_imagery_standard_process_div').hide();
8099 jQuery('#manage_drone_imagery_standard_process_raw_images_div').show();
8100 jQuery('#manage_drone_imagery_standard_process_raw_images_interactive_div').hide();
8101 jQuery('#project_drone_imagery_ground_control_points_div').hide();
8102 jQuery('#manage_drone_imagery_quality_control_div').hide();
8103 jQuery('#manage_drone_imagery_field_trial_time_series_div').hide();
8104 jQuery('#manage_drone_imagery_loading_div').hide();
8105 } else if (section_div_id == 'manage_drone_imagery_standard_process_raw_images_interactive_div'){
8106 jQuery('#manage_drone_imagery_crop_div').hide();
8107 jQuery('#manage_drone_imagery_top_div').hide();
8108 jQuery('#manage_drone_imagery_plot_polygons_div').hide();
8109 jQuery('#manage_drone_imagery_calculate_phenotypes_div').hide();
8110 jQuery('#manage_drone_imagery_remove_background_div').hide();
8111 jQuery('#manage_drone_imagery_rotate_div').hide();
8112 jQuery('#manage_drone_imagery_vegetative_index_div').hide();
8113 jQuery('#manage_drone_imagery_standard_process_div').hide();
8114 jQuery('#manage_drone_imagery_standard_process_raw_images_div').hide();
8115 jQuery('#manage_drone_imagery_standard_process_raw_images_interactive_div').show();
8116 jQuery('#project_drone_imagery_ground_control_points_div').hide();
8117 jQuery('#manage_drone_imagery_quality_control_div').hide();
8118 jQuery('#manage_drone_imagery_field_trial_time_series_div').hide();
8119 jQuery('#manage_drone_imagery_loading_div').hide();
8120 } else if (section_div_id == 'manage_drone_imagery_quality_control_div'){
8121 jQuery('#manage_drone_imagery_crop_div').hide();
8122 jQuery('#manage_drone_imagery_top_div').hide();
8123 jQuery('#manage_drone_imagery_plot_polygons_div').hide();
8124 jQuery('#manage_drone_imagery_calculate_phenotypes_div').hide();
8125 jQuery('#manage_drone_imagery_remove_background_div').hide();
8126 jQuery('#manage_drone_imagery_rotate_div').hide();
8127 jQuery('#manage_drone_imagery_vegetative_index_div').hide();
8128 jQuery('#manage_drone_imagery_standard_process_div').hide();
8129 jQuery('#manage_drone_imagery_standard_process_raw_images_div').hide();
8130 jQuery('#manage_drone_imagery_standard_process_raw_images_interactive_div').hide();
8131 jQuery('#project_drone_imagery_ground_control_points_div').hide();
8132 jQuery('#manage_drone_imagery_quality_control_div').show();
8133 jQuery('#manage_drone_imagery_field_trial_time_series_div').hide();
8134 jQuery('#manage_drone_imagery_loading_div').hide();
8135 } else if (section_div_id == 'project_drone_imagery_ground_control_points_div'){
8136 jQuery('#manage_drone_imagery_crop_div').hide();
8137 jQuery('#manage_drone_imagery_top_div').hide();
8138 jQuery('#manage_drone_imagery_plot_polygons_div').hide();
8139 jQuery('#manage_drone_imagery_calculate_phenotypes_div').hide();
8140 jQuery('#manage_drone_imagery_remove_background_div').hide();
8141 jQuery('#manage_drone_imagery_rotate_div').hide();
8142 jQuery('#manage_drone_imagery_vegetative_index_div').hide();
8143 jQuery('#manage_drone_imagery_standard_process_div').hide();
8144 jQuery('#manage_drone_imagery_standard_process_raw_images_div').hide();
8145 jQuery('#manage_drone_imagery_standard_process_raw_images_interactive_div').hide();
8146 jQuery('#project_drone_imagery_ground_control_points_div').show();
8147 jQuery('#manage_drone_imagery_quality_control_div').hide();
8148 jQuery('#manage_drone_imagery_field_trial_time_series_div').hide();
8149 jQuery('#manage_drone_imagery_loading_div').hide();
8150 } else if (section_div_id == 'manage_drone_imagery_field_trial_time_series_div'){
8151 jQuery('#manage_drone_imagery_crop_div').hide();
8152 jQuery('#manage_drone_imagery_top_div').hide();
8153 jQuery('#manage_drone_imagery_plot_polygons_div').hide();
8154 jQuery('#manage_drone_imagery_calculate_phenotypes_div').hide();
8155 jQuery('#manage_drone_imagery_remove_background_div').hide();
8156 jQuery('#manage_drone_imagery_rotate_div').hide();
8157 jQuery('#manage_drone_imagery_vegetative_index_div').hide();
8158 jQuery('#manage_drone_imagery_standard_process_div').hide();
8159 jQuery('#manage_drone_imagery_standard_process_raw_images_div').hide();
8160 jQuery('#manage_drone_imagery_standard_process_raw_images_interactive_div').hide();
8161 jQuery('#project_drone_imagery_ground_control_points_div').hide();
8162 jQuery('#manage_drone_imagery_quality_control_div').hide();
8163 jQuery('#manage_drone_imagery_field_trial_time_series_div').show();
8164 jQuery('#manage_drone_imagery_loading_div').hide();
8166 else if (section_div_id == 'manage_drone_imagery_loading_div'){
8167 jQuery('#manage_drone_imagery_crop_div').hide();
8168 jQuery('#manage_drone_imagery_top_div').hide();
8169 jQuery('#manage_drone_imagery_plot_polygons_div').hide();
8170 jQuery('#manage_drone_imagery_calculate_phenotypes_div').hide();
8171 jQuery('#manage_drone_imagery_remove_background_div').hide();
8172 jQuery('#manage_drone_imagery_rotate_div').hide();
8173 jQuery('#manage_drone_imagery_vegetative_index_div').hide();
8174 jQuery('#manage_drone_imagery_standard_process_div').hide();
8175 jQuery('#manage_drone_imagery_standard_process_raw_images_div').hide();
8176 jQuery('#manage_drone_imagery_standard_process_raw_images_interactive_div').hide();
8177 jQuery('#project_drone_imagery_ground_control_points_div').hide();
8178 jQuery('#manage_drone_imagery_quality_control_div').hide();
8179 jQuery('#manage_drone_imagery_field_trial_time_series_div').hide();
8180 jQuery('#manage_drone_imagery_loading_div').show();
8182 window.scrollTo(0,0);