// walk the options and fetch any requested outputs void VOption::get_operation( VipsOperation *operation ) { std::list<Pair *>::iterator i; for( i = options.begin(); i != options.end(); ++i ) if( ! (*i)->input ) { const char *name = (*i)->name; g_object_get_property( G_OBJECT( operation ), name, &(*i)->value ); #ifdef VIPS_DEBUG_VERBOSE printf( "get_operation: " ); vips_object_print_name( VIPS_OBJECT( operation ) ); char *str_value = g_strdup_value_contents( &(*i)->value ); printf( ".%s = %s\n", name, str_value ); g_free( str_value ); #endif /*VIPS_DEBUG_VERBOSE*/ GValue *value = &(*i)->value; GType type = G_VALUE_TYPE( value ); if( type == VIPS_TYPE_IMAGE ) { // rebox object VipsImage *image = VIPS_IMAGE( g_value_get_object( value ) ); *((*i)->vimage) = VImage( image ); } else if( type == G_TYPE_INT ) *((*i)->vint) = g_value_get_int( value ); else if( type == G_TYPE_BOOLEAN ) *((*i)->vbool) = g_value_get_boolean( value ); else if( type == G_TYPE_DOUBLE ) *((*i)->vdouble) = g_value_get_double( value ); else if( type == VIPS_TYPE_ARRAY_DOUBLE ) { int length; double *array = vips_value_get_array_double( value, &length ); int j; ((*i)->vvector)->resize( length ); for( j = 0; j < length; j++ ) (*((*i)->vvector))[j] = array[j]; } else if( type == VIPS_TYPE_BLOB ) { // our caller gets a reference *((*i)->vblob) = (VipsBlob *) g_value_dup_boxed( value ); } } }
static void * vips_foreign_load_nifti_set( const char *name, GValue *value, glong offset, void *a, void *b ) { nifti_image *nim = (nifti_image *) a; VipsImage *out = VIPS_IMAGE( b ); char vips_name[256]; vips_gvalue_read( value, (gpointer) nim + offset ); vips_snprintf( vips_name, 256, "nifti-%s", name ); vips_image_set( out, vips_name, value ); return( NULL ); }