input_set_use1serule = arcpy.GetParameterAsText(14) input_set_truncate_pruned_tree_to_false = arcpy.GetParameterAsText(15) input_user_seed = arcpy.GetParameterAsText(16) input_ram = arcpy.GetParameterAsText(17) out_conf_matrix = arcpy.GetParameterAsText(18) out_model = arcpy.GetParameterAsText(19) # Generate OTB commands command_list = [] # State which classifier is being used input_classifier = '-classifier dt' command_list.append(input_classifier) # Generate command for input imagery otb_input_images = generate_command('-io.il ', True, input_images, True) command_list.append(otb_input_images) # Generate command for input shapefiles otb_input_train_shp = generate_command('-io.vd ', True, input_shapefiles, True) command_list.append(otb_input_train_shp) # Generate command for XML Stats if len(input_xml_stats) > 0: otb_input_xml_stats = generate_command('-io.imstat ', True, input_xml_stats, False) command_list.append(otb_input_xml_stats) # Generate command for default elevation otb_input_default_elev = generate_command('-elev.default ', False, input_default_elev, False)
input_name_discrimination_field = arcpy.GetParameterAsText(8) input_number_of_neighbors = arcpy.GetParameterAsText(9) input_user_seed = arcpy.GetParameterAsText(10) input_ram = arcpy.GetParameterAsText(11) out_conf_matrix = arcpy.GetParameterAsText(12) out_model = arcpy.GetParameterAsText(13) # Generate OTB commands command_list = [] # State which classifier is being used input_classifier = '-classifier libsvm' command_list.append(input_classifier) # Generate command for input shapefiles otb_input_train_shp = generate_command('-io.vd ', True, input_train_shp, True) command_list.append(otb_input_train_shp) # Generate command for XML Stats if len(input_xml_stats) > 0: otb_input_xml_stats = generate_command('-io.imstat ', True, input_xml_stats, False) command_list.append(otb_input_xml_stats) # Generate command for default elevation otb_input_default_elev = generate_command('-elev.default ', False, input_default_elev, False) command_list.append(otb_input_default_elev) # Generate command for max train class sample otb_input_max_class_train_sample = generate_command('-sample.mt ', False, input_max_class_train_sample, False) command_list.append(otb_input_max_class_train_sample)
input_weak_count = arcpy.GetParameterAsText(10) input_weight_trim_rate = arcpy.GetParameterAsText(11) input_max_depth_tree = arcpy.GetParameterAsText(12) input_ram = arcpy.GetParameterAsText(13) out_conf_matrix = arcpy.GetParameterAsText(14) out_model = arcpy.GetParameterAsText(15) # Generate OTB commands command_list = [] # State which classifier is being used input_classifier = '-classifier boost' command_list.append(input_classifier) # Generate command for input imagery otb_input_images = generate_command('-io.il ', True, input_images, True) command_list.append(otb_input_images) # Generate command for input shapefiles otb_input_train_shp = generate_command('-io.vd ', True, input_shapefiles, True) command_list.append(otb_input_train_shp) # Generate command for XML Stats if len(input_xml_stats) > 0: otb_input_xml_stats = generate_command('-io.imstat ', True, input_xml_stats, False) command_list.append(otb_input_xml_stats) # Generate command for default elevation otb_input_default_elev = generate_command('-elev.default ', False, input_default_elev, False)
if not os.path.exists(otb_dir): raise Exception('OTB files not found!') # Input vars input_image = arcpy.GetParameterAsText(0) input_ref_image = arcpy.GetParameterAsText(1) input_value_for_nodata = arcpy.GetParameterAsText(2) input_ram = arcpy.GetParameterAsText(3) output_matrix_output = arcpy.GetParameterAsText(4) # Generate OTB commands command_list = [] # Generate command for input classified image otb_input_train_shp = generate_command('-in ', True, input_image, False) command_list.append(otb_input_train_shp) # Generate command for truth type otb_input_truth_type = generate_command('-ref ', False, 'raster', False) command_list.append(otb_input_truth_type) # Generate command for input ref image otb_input_ref_image = generate_command('-ref.raster.in ', True, input_ref_image, False) command_list.append(otb_input_ref_image) # Generate command for value for nodata pixels otb_input_value_for_nodata = generate_command('-ref.raster.nodata ', False, input_value_for_nodata, False) command_list.append(otb_input_value_for_nodata) # Generate command for matrix output
raise Exception('OTB files not found!') # Input vars input_image = arcpy.GetParameterAsText(0) input_mask = arcpy.GetParameterAsText(1) input_model = arcpy.GetParameterAsText(2) input_ram = arcpy.GetParameterAsText(3) input_statistics = arcpy.GetParameterAsText(4) input_no_data_label = arcpy.GetParameterAsText(5) input_output_image = arcpy.GetParameterAsText(6) input_output_conf = arcpy.GetParameterAsText(7) # Generate OTB commands command_list = [] otb_input_image = generate_command('-in ', True, input_image) command_list.append(otb_input_image) otb_input_mask = generate_command('-mask ', True, input_mask) command_list.append(otb_input_mask) otb_input_model = generate_command('-model ', True, input_model) command_list.append(otb_input_model) otb_input_ram = generate_command('-ram ', False, input_ram) command_list.append(otb_input_ram) if len(input_statistics) > 0: otb_input_statistics = generate_command('-imstat ', True, input_statistics) command_list.append(otb_input_statistics)
input_images = arcpy.GetParameterAsText(0) input_model = arcpy.GetParameterAsText(1) input_ram = arcpy.GetParameterAsText(2) input_output_batch_prefix = arcpy.GetParameterAsText(3) input_output_folder = arcpy.GetParameterAsText(4) input_output_conf = arcpy.GetParameterAsText(5) # Generate OTB commands command_list = [] for idx, input_image in enumerate(input_images.split(';')): input_image = input_image.rstrip("'") input_image = input_image.lstrip("'") otb_input_image = generate_command('-in ', True, input_image) command_list.append(otb_input_image) otb_input_model = generate_command('-model ', True, input_model) command_list.append(otb_input_model) otb_input_ram = generate_command('-ram ', False, input_ram) command_list.append(otb_input_ram) output_file = str(idx) + '_' + input_output_batch_prefix + '.tif' input_output_image = os.path.join(input_output_folder, output_file) otb_input_output_image = generate_command('-out ', True, input_output_image, False) command_list.append(otb_input_output_image) if str(input_output_conf) == 'true':
input_image = arcpy.GetParameterAsText(0) input_ram = arcpy.GetParameterAsText(1) input_validity_mask = arcpy.GetParameterAsText(2) input_training_set_size = arcpy.GetParameterAsText(3) input_number_of_classes = arcpy.GetParameterAsText(4) input_max_num_iterations = arcpy.GetParameterAsText(5) input_sampler_type = arcpy.GetParameterAsText(6) input_mask_value = arcpy.GetParameterAsText(7) input_seed = arcpy.GetParameterAsText(8) output_centroid_file = arcpy.GetParameterAsText(9) output_file = arcpy.GetParameterAsText(10) command_list = [] # Generate command for input image otb_input_image = generate_command('-in ', True, input_image, False) command_list.append(otb_input_image) # Generate command for RAM limit otb_input_ram = generate_command('-ram ', False, input_ram, False) command_list.append(otb_input_ram) # Generate command for validity mask if len(input_validity_mask) > 0: otb_input_validity_mask = generate_command('-vm ', True, input_validity_mask, False) command_list.append(otb_input_validity_mask) # Generate command for training set size otb_input_training_set_size = generate_command('-ts ', False, input_training_set_size, False)
input_parameter_optimization = arcpy.GetParameterAsText(13) input_probability_estimation = arcpy.GetParameterAsText(14) input_user_seed = arcpy.GetParameterAsText(15) input_ram = arcpy.GetParameterAsText(16) out_conf_matrix = arcpy.GetParameterAsText(17) out_model = arcpy.GetParameterAsText(18) # Generate OTB commands command_list = [] # State which classifier is being used input_classifier = '-classifier libsvm' command_list.append(input_classifier) # Generate command for input shapefiles otb_input_train_shp = generate_command('-io.vd ', True, input_train_shp, True) command_list.append(otb_input_train_shp) # Generate command for XML Stats if len(input_xml_stats) > 0: otb_input_xml_stats = generate_command('-io.imstat ', True, input_xml_stats, False) command_list.append(otb_input_xml_stats) # Generate command for default elevation otb_input_default_elev = generate_command('-elev.default ', False, input_default_elev, False) command_list.append(otb_input_default_elev) # Generate command for max train class sample otb_input_max_class_train_sample = generate_command(
input_maximum_number_trees = arcpy.GetParameterAsText(14) input_oob_error = arcpy.GetParameterAsText(15) input_user_seed = arcpy.GetParameterAsText(16) input_ram = arcpy.GetParameterAsText(17) out_conf_matrix = arcpy.GetParameterAsText(18) out_model = arcpy.GetParameterAsText(19) # Generate OTB commands command_list = [] # State which classifier is being used input_classifier = '-classifier rf' command_list.append(input_classifier) # Generate command for input imagery otb_input_images = generate_command('-io.il ', True, input_images, True) command_list.append(otb_input_images) # Generate command for input shapefiles otb_input_train_shp = generate_command('-io.vd ', True, input_train_shp, True) command_list.append(otb_input_train_shp) # Generate command for XML Stats if len(input_xml_stats) > 0: otb_input_xml_stats = generate_command('-io.imstat ', True, input_xml_stats, False) command_list.append(otb_input_xml_stats) # Generate command for default elevation otb_input_default_elev = generate_command('-elev.default ', False, input_default_elev, False) command_list.append(otb_input_default_elev)
otb_dir_devenv = os.path.join(otb_dir, 'start_devenv.bat') if not os.path.exists(otb_dir): raise Exception('OTB files not found!') # Input vars input_before_image = arcpy.GetParameterAsText(0) input_after_image = arcpy.GetParameterAsText(1) input_ram = arcpy.GetParameterAsText(2) output_change_map = arcpy.GetParameterAsText(3) # Generate OTB commands command_list = [] # Generate command for input image (before) otb_input_before_image = generate_command('-in1 ', True, input_before_image, False) command_list.append(otb_input_before_image) # Generate command for input image (after) otb_input_after_image = generate_command('-in2 ', True, input_after_image, False) command_list.append(otb_input_after_image) # Generate command for ram usage otb_input_ram = generate_command('-ram ', False, input_ram, False) command_list.append(otb_input_ram) # Generate command for output change map otb_output_change_map = generate_command('-out ', True, output_change_map, False) command_list.append(otb_output_change_map)