Sunday, 15 September 2013

Unable to read analyze 7.5 image in c

Unable to read analyze 7.5 image in c

I was trying to read voxel information of a 3D analyze image. Sample code:
#include <stdio.h>
void main() {
unsigned int R,G,B;
unsigned char data[3];
FILE *fp, *ft;
fp = fopen("67.img", "rb");
ft = fopen("OUT.txt", "w");
while (fread(data, 3, 1, fp) == 1) {
R = data[0];
G = data[1];
B = data[2];
fprintf(ft, "%u,%u,%u", R, G, B);
}
}
But in the "Out.txt" I am not getting expected RGB values. I am a newbie
in C. Please help me.

No comments:

Post a Comment