[MINC-development] swig wrappers for minc2
Leila Baghdadi
baghdadi at sickkids.ca
Wed Mar 22 10:42:28 EST 2006
Hello Jonathan,
Thanks very much for doing this, I am sure there is plenty of interest.
I will check your code see if I use it with minc2.0 images.
will let you know
Leila
On Tue, 2006-21-03 at 23:56 -0800, Jonathan Taylor wrote:
> hi,
>
> i don't know how much interest there is in this (i am interested at
> least), but i used swig to generate
> python wrappers for minc2. they compile (and import) fine, but i have
> nothing to test them with.
>
> in theory, the swig file could be used to generate wrappers for other
> languages....
>
> attached is the minc2.i i used, and here are the commands i used to
> build the python module.... from the
> minc-2.0.05 main directory:
>
> make distclean
> ./configure --prefix=/home/jtaylo/tmp
> make
> make install
> cd libsrc2
> swig -python minc2.i
> gcc -c *.c -I/usr/include/python2.4
> gcc -shared *.o -L/home/jtaylo/tmp/lib -lminc2 -lhdf5 -lnetcdf -o
> _minc2.so
> python -c "import minc2"
>
> got a few warnings:
> hyper.c: In function 'mirw_hyperslab_raw':
> hyper.c:420: warning: pointer targets in passing argument 3 of
> 'H5Sselect_hyperslab' differ in signedness
> m2util.c: In function 'miinit':
> m2util.c:938: warning: passing argument 5 of 'H5Tregister' from
> incompatible pointer type
> m2util.c:941: warning: passing argument 5 of 'H5Tregister' from
> incompatible pointer type
> m2util.c: In function 'miinit_enum':
> m2util.c:979: warning: passing argument 5 of 'H5Tregister' from
> incompatible pointer type
> m2util.c:981: warning: passing argument 5 of 'H5Tregister' from
> incompatible pointer type
> m2util.c:983: warning: passing argument 5 of 'H5Tregister' from
> incompatible pointer type
> m2util.c:985: warning: passing argument 5 of 'H5Tregister' from
> incompatible pointer type
> m2util.c: In function 'minc_update_thumbnail':
> m2util.c:1343: warning: pointer targets in passing argument 3 of
> 'H5Sselect_hyperslab' differ in signedness
> m2util.c:1361: warning: pointer targets in passing argument 3 of
> 'H5Sselect_hyperslab' differ in signedness
> m2util.c:1372: warning: passing argument 4 of 'H5Sselect_elements' from
> incompatible pointer type
> slice.c: In function 'mirw_slice_minmax':
> slice.c:80: warning: passing argument 4 of 'H5Sselect_elements' from
> incompatible pointer type
>
> best,
>
> jonathan
>
>
> plain text document attachment (minc2.i)
> %module minc2
> %{
> #include "minc2.h"
> %}
>
> /* ATTRIBUTE/GROUP FUNCTIONS */
>
> extern int micreate_group(mihandle_t vol, const char *path, const char *name);
> extern int midelete_attr(mihandle_t vol, const char *path, const char *name);
> extern int midelete_group(mihandle_t vol, const char *path, const char *name);
> extern int miget_attr_length(mihandle_t vol, const char *path,
> const char *name, int *length);
> extern int miget_attr_type(mihandle_t vol, const char *path, const char *name,
> mitype_t *data_type);
> extern int miget_attr_values(mihandle_t vol, mitype_t data_type,
> const char *path, const char *name,
> int length, void *values);
> extern int miset_attr_values(mihandle_t vol, mitype_t data_type,
> const char *path, const char *name, int length,
> const void *values);
>
> /* FREE FUNCTIONS */
> extern int mifree_name(char *name_ptr);
> extern int mifree_names(char **name_pptr);
>
> /* DATA TYPE/SPACE FUNCTIONS */
> extern int miget_data_class(mihandle_t vol, miclass_t *volume_class);
> extern int miget_data_type(mihandle_t vol, mitype_t *volume_data_type);
> extern int miget_data_type_size(mihandle_t vol, misize_t *voxel_size);
> extern int miget_space_name(mihandle_t vol, char **name);
> extern int miset_space_name(mihandle_t vol, const char *name);
>
> /* DIMENSION FUNCTIONS */
> extern int miget_volume_from_dimension(midimhandle_t dimension, mihandle_t *volume);
> extern int micopy_dimension(midimhandle_t dim_ptr, midimhandle_t *new_dim_ptr);
> extern int micreate_dimension(const char *name, midimclass_t dimclass, midimattr_t attr,
> unsigned long length, midimhandle_t *new_dim_ptr);
> extern int mifree_dimension_handle(midimhandle_t dim_ptr);
> extern int miget_volume_dimensions(mihandle_t volume, midimclass_t dimclass, midimattr_t attr,
> miorder_t order, int array_length,
> midimhandle_t dimensions[]);
> extern int miset_apparent_dimension_order(mihandle_t volume, int array_length, midimhandle_t dimensions[]);
> extern int miset_apparent_dimension_order_by_name(mihandle_t volume, int array_length, char **names);
> extern int miset_apparent_record_dimension_flag(mihandle_t volume, int record_flag);
> extern int miget_dimension_apparent_voxel_order(midimhandle_t dimension, miflipping_t *file_order,
> miflipping_t *sign);
> extern int miset_dimension_apparent_voxel_order(midimhandle_t dimension, miflipping_t flipping_order);
> extern int miget_dimension_class(midimhandle_t dimension, midimclass_t *dimclass);
> extern int miset_dimension_class(midimhandle_t dimension, midimclass_t dimclass);
> extern int miget_dimension_cosines(midimhandle_t dimension,
> double direction_cosines[3]);
> extern int miset_dimension_cosines(midimhandle_t dimension,
> const double direction_cosines[3]);
> extern int miset_dimension_description(midimhandle_t dimension, const char *comments);
> extern int miget_dimension_description(midimhandle_t dimension, char **comments_ptr);
> extern int miget_dimension_name(midimhandle_t dimension, char **name_ptr);
> extern int miset_dimension_name(midimhandle_t dimension, const char *name);
> extern int miget_dimension_offsets(midimhandle_t dimension, unsigned long array_length,
> unsigned long start_position, double offsets[]);
> extern int miset_dimension_offsets(midimhandle_t dimension, unsigned long array_length,
> unsigned long start_position, const double offsets[]);
> extern int miget_dimension_sampling_flag(midimhandle_t dimension, BOOLEAN *sampling_flag);
> extern int miset_dimension_sampling_flag(midimhandle_t dimension, BOOLEAN sampling_flag);
> extern int miget_dimension_separation(midimhandle_t dimension, mivoxel_order_t voxel_order,
> double *separation_ptr);
> extern int miset_dimension_separation(midimhandle_t dimension, double separation);
> extern int miget_dimension_separations(const midimhandle_t dimensions[],
> mivoxel_order_t voxel_order, int array_length,
> double separations[]);
> extern int miset_dimension_separations(const midimhandle_t dimensions[], int array_length,
> const double separations[]);
> extern int miget_dimension_size(midimhandle_t dimension, unsigned long *size_ptr);
> extern int miset_dimension_size(midimhandle_t dimension, unsigned long size);
> extern int miget_dimension_sizes(const midimhandle_t dimensions[], int array_length,
> unsigned long sizes[]);
> extern int miget_dimension_start(midimhandle_t dimension, mivoxel_order_t voxel_order,
> double *start_ptr);
> extern int miset_dimension_start(midimhandle_t dimension, double start_ptr);
> extern int miget_dimension_starts(const midimhandle_t dimensions[], mivoxel_order_t voxel_order,
> int array_length, double starts[]);
> extern int miset_dimension_starts(const midimhandle_t dimensions[], int array_length,
> const double starts[]);
> extern int miget_dimension_units(midimhandle_t dimension, char **units_ptr);
> extern int miset_dimension_units(midimhandle_t dimension, const char *units);
> extern int miget_dimension_width(midimhandle_t dimension, double *width_ptr);
> extern int miset_dimension_width(midimhandle_t dimension, double width_ptr);
> extern int miget_dimension_widths(midimhandle_t dimension, mivoxel_order_t voxel_order,
> unsigned long array_length, unsigned long start_position,
> double widths[]);
> extern int miset_dimension_widths(midimhandle_t dimension, unsigned long array_length,
> unsigned long start_position, const double widths[]);
>
>
> /* VOLUME FUNCTIONS */
> extern int micreate_volume(const char *filename, int number_of_dimensions,
> midimhandle_t dimensions[],
> mitype_t volume_type,
> miclass_t volume_class,
> mivolumeprops_t create_props,
> mihandle_t *volume);
> extern int micreate_volume_image(mihandle_t volume);
> extern int miget_volume_dimension_count(mihandle_t volume, midimclass_t dimclass,
> midimattr_t attr, int *number_of_dimensions);
> extern int miget_volume_voxel_count(mihandle_t volume, int *number_of_voxels);
> extern int miopen_volume(const char *filename, int mode, mihandle_t *volume);
> extern int miclose_volume(mihandle_t volume);
>
> extern int miget_slice_scaling_flag(mihandle_t volume,
> BOOLEAN *slice_scaling_flag);
> extern int miset_slice_scaling_flag(mihandle_t volume,
> BOOLEAN slice_scaling_flag);
>
> /* VOLUME PROPERTIES FUNCTIONS */
> extern int minew_volume_props(mivolumeprops_t *props);
> extern int mifree_volume_props(mivolumeprops_t props);
> extern int miget_volume_props(mihandle_t vol, mivolumeprops_t *props);
> extern int miset_props_multi_resolution(mivolumeprops_t props, BOOLEAN enable_flag,
> int depth);
> extern int miget_props_multi_resolution(mivolumeprops_t props, BOOLEAN *enable_flag,
> int *depth);
> extern int miselect_resolution(mihandle_t volume, int depth);
> extern int miflush_from_resolution(mihandle_t volume, int depth);
> extern int miset_props_compression_type(mivolumeprops_t props, micompression_t compression_type);
> extern int miget_props_compression_type(mivolumeprops_t props, micompression_t *compression_type);
> extern int miset_props_zlib_compression(mivolumeprops_t props, int zlib_level);
> extern int miget_props_zlib_compression(mivolumeprops_t props, int *zlib_level);
> extern int miset_props_blocking(mivolumeprops_t props, int edge_count, const int *edge_lengths);
> extern int miget_props_blocking(mivolumeprops_t props, int *edge_count, int *edge_lengths,
> int max_lengths);
> extern int miset_props_record(mivolumeprops_t props, long record_length, char *record_name);
> extern int miset_props_template(mivolumeprops_t props, int template_flag);
>
> /* SLICE/VOLUME SCALE FUNCTIONS */
> extern int miget_slice_max(mihandle_t volume,
> const unsigned long start_positions[],
> int array_length, double *slice_max);
> extern int miset_slice_max(mihandle_t volume,
> const unsigned long start_positions[],
> int array_length, double slice_max);
> extern int miget_slice_min(mihandle_t volume,
> const unsigned long start_positions[],
> int array_length, double *slice_min);
> extern int miset_slice_min(mihandle_t volume,
> const unsigned long start_positions[],
> int array_length, double slice_min);
> extern int miget_slice_range(mihandle_t volume,
> const unsigned long start_positions[],
> int array_length, double *slice_max,
> double *slice_min);
> extern int miset_slice_range(mihandle_t volume,
> const unsigned long start_positions[],
> int array_length, double slice_max,
> double slice_min);
> extern int miget_volume_max(mihandle_t volume, double *slice_max);
> extern int miset_volume_max(mihandle_t volume, double slice_max);
> extern int miget_volume_min(mihandle_t volume, double *slice_min);
> extern int miset_volume_min(mihandle_t volume, double slice_min);
> extern int miget_volume_range(mihandle_t volume, double *slice_max,
> double *slice_min);
> extern int miset_volume_range(mihandle_t volume, double slice_max,
> double slice_min);
> /* HYPERSLAB FUNCTIONS */
>
> extern int miget_real_value_hyperslab(mihandle_t volume,
> mitype_t buffer_data_type,
> const unsigned long start[],
> const unsigned long count[],
> void *buffer);
>
> extern int miset_real_value_hyperslab(mihandle_t volume,
> mitype_t buffer_data_type,
> const unsigned long start[],
> const unsigned long count[],
> const void *buffer);
>
> extern int miget_voxel_value_hyperslab(mihandle_t volume,
> mitype_t buffer_data_type,
> const unsigned long start[],
> const unsigned long count[],
> void *buffer);
>
> extern int miset_voxel_value_hyperslab(mihandle_t volume,
> mitype_t buffer_data_type,
> const unsigned long start[],
> const unsigned long count[],
> const void *buffer);
>
> extern int miget_hyperslab_normalized(mihandle_t volume,
> mitype_t buffer_data_type,
> const unsigned long start[],
> const unsigned long count[],
> double min,
> double max,
> void *buffer);
>
> /* CONVERT FUNCTIONS */
> extern int miconvert_real_to_voxel(mihandle_t volume,
> const unsigned long coords[],
> int ncoords,
> double real_value,
> double *voxel_value_ptr);
>
> extern int miconvert_voxel_to_real(mihandle_t volume,
> const unsigned long coords[],
> int ncoords,
> double voxel_value,
> double *real_value_ptr);
>
> extern int miconvert_3D_voxel_to_world(mihandle_t volume,
> const double voxel[],
> double world[]);
>
> extern int miconvert_3D_world_to_voxel(mihandle_t volume,
> const double world[],
> double voxel[]);
>
> extern int miget_real_value(mihandle_t volume,
> const unsigned long coords[],
> int ndims,
> double *value_ptr);
>
> extern int miset_real_value(mihandle_t volume,
> const unsigned long coords[],
> int ndims,
> double value);
> extern int miget_voxel_value(mihandle_t volume,
> const unsigned long coords[],
> int ndims,
> double *voxel_ptr);
>
> extern int miset_voxel_value(mihandle_t volume,
> const unsigned long coords[],
> int ndims,
> double voxel);
>
> extern int miget_volume_real_range(mihandle_t volume, double real_range[2]);
>
> /* VALID functions */
> extern int miget_volume_valid_max(mihandle_t volume, double *valid_max);
> extern int miset_volume_valid_max(mihandle_t volume, double valid_max);
> extern int miget_volume_valid_min(mihandle_t volume, double *valid_min);
> extern int miset_volume_valid_min(mihandle_t volume, double valid_min);
> extern int miget_volume_valid_range(mihandle_t volume,
> double *valid_max, double *valid_min);
> extern int miset_volume_valid_range(mihandle_t volume,
> double valid_max, double valid_min);
>
> /* RECORD functions */
> extern int miget_record_name(mihandle_t volume, char **name);
> extern int miget_record_length(mihandle_t volume, int *length);
> extern int miget_record_field_name(mihandle_t volume, int index, char **name);
> extern int miset_record_field_name(mihandle_t volume, int index,
> const char *name);
>
> /* LABEL functions */
> extern int midefine_label(mihandle_t volume, int value, const char *name);
> extern int miget_label_name(mihandle_t volume, int value, char **name);
> extern int miget_label_value(mihandle_t volume, const char *name, int *value);
>
> _______________________________________________
> MINC-development mailing list
> MINC-development at bic.mni.mcgill.ca
> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-development
More information about the MINC-development
mailing list