[MINC-users] miset_dimension_apparent_voxel_order - should it not affect miget_voxel_value_hyperslab?
Leila Baghdadi
baghdadi at phenogenomics.ca
Mon Sep 17 09:40:07 EDT 2012
Soren,
a while ago, I checked in some changes to the minc2 git code which address the issue you are talking about! I suspect you are using a version of the code which does not have these changes.
you should be able to check your micn directory (libsrc2/hyper.c --> check mitranslate_hyperslab_origin --> mine is around line 280) and see the changes
if not please update your minc2 source and rebuild
HTH
Leila
----- Original Message -----
From: Soren Christensen <sorench at gmail.com>
Sent: Sat, 9/15/2012 9:23am
To: MINC users mailing list <minc-users at bic.mni.mcgill.ca>
Subject: [MINC-users] miset_dimension_apparent_voxel_order - should it not affect miget_voxel_value_hyperslab?
Hi,
Sorry for the multiple questions - this is a separate issue so I am
posting separately.
I am trying to use miset_dimension_apparent_voxel_order hoping it
could give my data with a fixed relationship between array direction
and spatial direction.
When I use it though, there seems to be no difference to the voxel
output. I had expected a "flip".
Where am I going wrong here?
This is what I do:
give my all y of xrow 16 in native ordering:
-2048 -2048 -2048 -1918 -1789 -1659 -1528 -1405 -1251 -1191 -996 -1168
-1237 -1025 -954 -1156 -1498 -1631 -2048 -2048 -2048 -2048 -2048 -2048
-2048 -2048 -2048 -2048 -2048 -2048 -2048 -2048
dimname is yspace
step is -1.844
now attempt to reverse y by req y to come out positive by using
miset_dimension_apparent_voxel_order. Output is now:
-2048 -2048 -2048 -1918 -1789 -1659 -1528 -1405 -1251 -1191 -996 -1168
-1237 -1025 -954 -1156 -1498 -1631 -2048 -2048 -2048 -2048 -2048 -2048
-2048 -2048 -2048 -2048 -2048 -2048 -2048 -2048 (identical)
step is -1.844 (also not changed)
(I had thought the second array would come out flipped)
mincinfo:
image dimensions: time zspace yspace xspace
dimension name length step start
-------------- ------ ---- -----
time 12 1 0
zspace 80 2 -539
yspace 32 -1.844 18.6907
xspace 32 -1.844 28.6905
Code:
mihandle_t minc_volume;
int result = miopen_volume(fname.toStdString().c_str(),
MI2_OPEN_READ, &minc_volume);
mitype_t volume_data_type[1];
miget_data_type(minc_volume,volume_data_type );
size_t start[4]={0,0,0,16};
size_t end[4]={1,1,32,1};
//get y row
signed short data[32]={0};
result=miget_voxel_value_hyperslab(minc_volume,volume_data_type[0],start,end,static_cast<void*>(data));
for (int k=0; k<32; k++)
{
std::cout << data[k] << " ";
}
std::cout << std::endl;
//what is the y step?
midimhandle_t dimensions[4];
result=miget_volume_dimensions(minc_volume,
MI_DIMCLASS_SPATIAL,MI_DIMATTR_ALL,MI_DIMORDER_FILE, 4, dimensions);
char *name_ptr[1];
miget_dimension_name(dimensions[2], name_ptr );
std::cout << "dimname is " << *name_ptr;
std::cout << std::endl;
double step[1];
miget_dimension_separation(dimensions[2],MI_ORDER_FILE,step);
std::cout << "step is " << step[0] << std::endl;
std::cout << "now attempt to reverse y by req y to come out positive ";
result=miset_dimension_apparent_voxel_order(dimensions[2],MI_POSITIVE);
result=miget_voxel_value_hyperslab(minc_volume,volume_data_type[0],start,end,static_cast<void*>(data));
for (int k=0; k<32; k++)
{
std::cout << data[k] << " ";
}
std::cout << std::endl;
miget_dimension_separation(dimensions[2],MI_ORDER_FILE,step);
std::cout << "step is " << step[0] << std::endl;
_______________________________________________
MINC-users at bic.mni.mcgill.ca
http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users
More information about the MINC-users
mailing list