almost working
get a 1x1 pixel output now
This commit is contained in:
parent
06a40cc7ee
commit
9179156132
@ -290,7 +290,7 @@ vips__foreign_nifti_map( VipsNiftiMapFn fn, void *a, void *b )
|
||||
GValue value = { 0 };
|
||||
|
||||
g_value_init( &value, vips_foreign_nifti_fields[i].type );
|
||||
result = fn( vips_foreign_nifti_fields[i].name, &value,
|
||||
result = fn( vips_foreign_nifti_fields[i].name, &value,
|
||||
vips_foreign_nifti_fields[i].offset, a, b );
|
||||
g_value_unset( &value );
|
||||
|
||||
|
@ -230,6 +230,7 @@ vips_foreign_save_nifti_header_nifti( VipsForeignSaveNifti *nifti,
|
||||
static int
|
||||
vips_foreign_save_nifti_build( VipsObject *object )
|
||||
{
|
||||
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
|
||||
VipsForeignSave *save = (VipsForeignSave *) object;
|
||||
VipsForeignSaveNifti *nifti = (VipsForeignSaveNifti *) object;
|
||||
|
||||
@ -255,6 +256,12 @@ vips_foreign_save_nifti_build( VipsObject *object )
|
||||
/* set ext, plus other stuff
|
||||
*/
|
||||
|
||||
if( nifti_set_filenames( nifti->nim, nifti->filename, FALSE, TRUE ) ) {
|
||||
vips_error( class->nickname,
|
||||
"%s", _( "unable to set nifti filename" ) );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
if( !(nifti->nim->data =
|
||||
vips_image_write_to_memory( save->ready, NULL )) )
|
||||
return( -1 );
|
||||
|
@ -454,6 +454,26 @@ transform_save_string_double( const GValue *src_value, GValue *dest_value )
|
||||
NULL ) );
|
||||
}
|
||||
|
||||
static void
|
||||
transform_float_save_string( const GValue *src_value, GValue *dest_value )
|
||||
{
|
||||
char buf[G_ASCII_DTOSTR_BUF_SIZE];
|
||||
|
||||
/* Need to be locale independent.
|
||||
*/
|
||||
g_ascii_dtostr( buf, G_ASCII_DTOSTR_BUF_SIZE,
|
||||
g_value_get_float( src_value ) );
|
||||
vips_value_set_save_string( dest_value, buf );
|
||||
}
|
||||
|
||||
static void
|
||||
transform_save_string_float( const GValue *src_value, GValue *dest_value )
|
||||
{
|
||||
g_value_set_float( dest_value,
|
||||
g_ascii_strtod( vips_value_get_save_string( src_value ),
|
||||
NULL ) );
|
||||
}
|
||||
|
||||
/* Save meta fields to the header. We have a new string type for header fields
|
||||
* to save to XML and define transform functions to go from our meta types to
|
||||
* this string type.
|
||||
@ -1847,4 +1867,8 @@ vips__meta_init_types( void )
|
||||
transform_double_save_string );
|
||||
g_value_register_transform_func( VIPS_TYPE_SAVE_STRING, G_TYPE_DOUBLE,
|
||||
transform_save_string_double );
|
||||
g_value_register_transform_func( G_TYPE_FLOAT, VIPS_TYPE_SAVE_STRING,
|
||||
transform_float_save_string );
|
||||
g_value_register_transform_func( VIPS_TYPE_SAVE_STRING, G_TYPE_FLOAT,
|
||||
transform_save_string_float );
|
||||
}
|
||||
|
@ -840,6 +840,10 @@ build_xml_meta( VipsMeta *meta, VipsDbuf *dbuf )
|
||||
|
||||
g_value_unset( &save_value );
|
||||
}
|
||||
else {
|
||||
printf( "unable to convert %s for save\n",
|
||||
g_type_name( type ) );
|
||||
}
|
||||
|
||||
return( NULL );
|
||||
}
|
||||
|
11
m4/nifti.m4
11
m4/nifti.m4
@ -24,11 +24,14 @@ if test "$with_nifti" = "no"; then
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(nifti-includes,
|
||||
AS_HELP_STRING([--with-nifti-includes=DIR], [libnifti includes are in DIR]),
|
||||
NIFTI_INCLUDES="-I$withval")
|
||||
AS_HELP_STRING([--with-nifti-includes=DIR], [libniftiio includes are in DIR]),
|
||||
NIFTI_INCLUDES="-I$withval"
|
||||
)
|
||||
AC_ARG_WITH(nifti-libraries,
|
||||
AS_HELP_STRING([--with-nifti-libraries=DIR], [libnifti libraries are in DIR]),
|
||||
NIFTI_LIBS="-L$withval -lnifti")
|
||||
AS_HELP_STRING([--with-nifti-libraries=DIR],
|
||||
[libniftiio libraries are in DIR]),
|
||||
NIFTI_LIBS="-L$withval -lniftiio"
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING(for NIFTI)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user