int main( int argc, char *argv[] ) { FILE *file; Status status; char *input_filename, *output_filename; int n_triangles, n_objects; Point centre; object_struct *object, **object_list; polygons_struct *polygons; Real x, y, z, rx, ry, rz; status = OK; initialize_argument_processing( argc, argv ); if( !get_string_argument( "", &input_filename ) || !get_string_argument( "", &output_filename ) ) { (void) fprintf( stderr, "Usage: input_filename output_filename [n_triangles]\n" ); return( 1 ); } (void) get_int_argument( 128, &n_triangles ); if( open_file( input_filename, READ_FILE, ASCII_FORMAT, &file ) != OK ) return( 1 ); n_objects = 0; while( input_real( file, &x ) == OK && input_real( file, &y ) == OK && input_real( file, &z ) == OK && input_real( file, &rx ) == OK && input_real( file, &ry ) == OK && input_real( file, &rz ) == OK ) { object = create_object( POLYGONS ); polygons = get_polygons_ptr(object); fill_Point( centre, x, y, z ); create_tetrahedral_sphere( ¢re, rx, ry, rz, n_triangles, polygons ); compute_polygon_normals( polygons ); ADD_ELEMENT_TO_ARRAY( object_list, n_objects, object, 10 ); } status = output_graphics_file( output_filename, BINARY_FORMAT, n_objects, object_list ); return( status != OK ); }
int main( int argc, char *argv[] ) { int degrees_freedom; Real t, p; initialize_argument_processing( argc, argv ); (void) get_int_argument( 8, °rees_freedom ); (void) get_real_argument( 1.0, &t ); p = evaluate_probability_t( degrees_freedom, t ); print( "%g: p < %g\n", t, p ); return( 0 ); }
int main( int argc, char *argv[] ) { STRING input_filename, output_filename; int n_objects, start_poly; File_formats format; object_struct **object_list; polygons_struct *polygons; initialize_argument_processing( argc, argv ); if( !get_string_argument( NULL, &input_filename ) || !get_string_argument( NULL, &output_filename ) ) { print_error( "Usage: %s input.obj output.obj\n", argv[0] ); return( 1 ); } (void) get_int_argument( 0, &start_poly ); if( input_graphics_file( input_filename, &format, &n_objects, &object_list ) != OK || n_objects != 1 || get_object_type(object_list[0]) != POLYGONS ) { print_error( "Error reading %s.\n", input_filename ); return( 1 ); } polygons = get_polygons_ptr( object_list[0] ); check_polygons_neighbours_computed( polygons ); create_tristrip( polygons, start_poly ); return( 0 ); }
int main( int argc, char *argv[] ) { Volume volume; BOOLEAN world_space; int continuity; Real x, y, z; char *input_filename; static char *dim_names[] = { MIxspace, MIyspace, MIzspace }; initialize_argument_processing( argc, argv ); if( !get_string_argument( "", &input_filename ) ) { print( "Need args.\n" ); return( 1 ); } (void) get_int_argument( 0, &continuity ); world_space = (argc > 3); if( input_volume( input_filename, 3, dim_names, NC_UNSPECIFIED, FALSE, 0.0, 0.0, TRUE, &volume, (minc_input_options *) NULL ) != OK ) return( 1 ); print( "Enter x, y, z: " ); while( input_real( stdin, &x ) == OK && input_real( stdin, &y ) == OK && input_real( stdin, &z ) == OK ) { check( volume, world_space, continuity, x, y, z ); print( "\nEnter x, y, z: " ); } return( 0 ); }
int main( int argc, char *argv[] ) { STRING src_filename, dest_filename; int n_objects, n_iters; File_formats format; object_struct **object_list; polygons_struct *polygons; Real step_ratio; initialize_argument_processing( argc, argv ); if( !get_string_argument( NULL, &src_filename ) || !get_string_argument( NULL, &dest_filename ) ) { print_error( "Usage: %s input.obj output.obj [step] [n_iters]\n", argv[0] ); return( 1 ); } (void) get_real_argument( 0.2, &step_ratio ); (void) get_int_argument( 1000, &n_iters ); if( input_graphics_file( src_filename, &format, &n_objects, &object_list ) != OK || n_objects != 1 || get_object_type(object_list[0]) != POLYGONS ) return( 1 ); polygons = get_polygons_ptr( object_list[0] ); flatten_polygons( polygons, step_ratio, n_iters ); (void) output_graphics_file( dest_filename, format, 1, object_list ); return( 0 ); }
int main( int argc, char *argv[] ) { STRING input_filename, output_filename; STRING model_filename; File_formats src_format, model_format; int n_src_objects, n_model_objects; object_struct **src_objects, **model_objects; polygons_struct *original, *model; Real movement_threshold, ratio; int n_iters, method, grid_size; initialize_argument_processing( argc, argv ); if( !get_string_argument( NULL, &input_filename ) || !get_string_argument( NULL, &model_filename ) || !get_string_argument( NULL, &output_filename ) ) { print_error( "Usage: %s input.obj model.obj output.obj\n", argv[0] ); return( 1 ); } (void) get_int_argument( 1, &n_iters ); (void) get_real_argument( 1.0, &ratio ); (void) get_int_argument( 0, &method ); (void) get_int_argument( 30, &grid_size ); (void) get_real_argument( 0.0, &movement_threshold ); if( input_graphics_file( input_filename, &src_format, &n_src_objects, &src_objects ) != OK || n_src_objects != 1 || get_object_type(src_objects[0]) != POLYGONS ) { print_error( "Error in %s\n", input_filename ); return( 1 ); } if( input_graphics_file( model_filename, &model_format, &n_model_objects, &model_objects ) != OK || n_model_objects != 1 || get_object_type(model_objects[0]) != POLYGONS ) { print_error( "Error in %s\n", model_filename ); return( 1 ); } original = get_polygons_ptr( src_objects[0] ); model = get_polygons_ptr( model_objects[0] ); if( !objects_are_same_topology( original->n_points, original->n_items, original->end_indices, original->indices, model->n_points, model->n_items, model->end_indices, model->indices ) ) { print_error( "Mismatched topology.\n" ); return( 1 ); } reparameterize( original, model, method, grid_size, ratio, movement_threshold, n_iters ); if( output_graphics_file( output_filename, src_format, n_src_objects, src_objects ) != OK ) return( 1 ); delete_object_list( n_src_objects, src_objects ); output_alloc_to_file( NULL ); return( 0 ); }
virtual bool get_bool_argument() { return get_int_argument(); }
int main( int argc, char *argv[] ) { Volume volume; STRING input_filename, output_filename; int n_slices, n_components; pixels_struct *pixels; nc_type vol_type; BOOLEAN two_d_allowed; initialize_argument_processing( argc, argv ); if( !get_string_argument( NULL, &output_filename ) || !get_int_argument( 0, &n_components ) ) { print( "Usage: %s output.mnc 3|4|23|24 input1.rgb input2.rgb ...\n", argv[0] ); return( 1 ); } if( n_components > 100 ) { vol_type = NC_FLOAT; n_components -= 100; } else vol_type = NC_BYTE; if( n_components > 20 ) { two_d_allowed = TRUE; n_components -= 20; } else { two_d_allowed = FALSE; } n_slices = 0; pixels = NULL; while( get_string_argument( "", &input_filename ) ) { SET_ARRAY_SIZE( pixels, n_slices, n_slices+1, DEFAULT_CHUNK_SIZE ); if( input_rgb_file( input_filename, &pixels[n_slices] ) != OK ) return( 1 ); ++n_slices; } volume = convert_pixels_to_volume( n_components, n_slices, (two_d_allowed && n_slices == 1) ? 2 : 3, vol_type, pixels ); if( volume != NULL ) { (void) output_volume( output_filename, NC_UNSPECIFIED, FALSE, 0.0, 0.0, volume, "Converted from pixels", (minc_output_options *) NULL ); delete_volume( volume ); } return( 0 ); }