00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00020 #include<ImLib3D/FileConversion.hpp>
00021 #include<ImLib3D/Transformation.hpp>
00022
00023 void
00024 IP3D::ReadFromFileBruker(const string &fname,int imageNumber,Image3Dlinear<short int> &res)
00025 {
00026 typedef Image3Dlinear<short int> ImType;
00027
00028 string prefix=fname+SPrintf("/%d",imageNumber)+"/pdata/1/";
00029 string info;
00030 Read(prefix+"d3proc",info,true);
00031 uint pos;
00032 pos=info.find("##$IM_SIX=")+10;
00033 printf("pos:%d\n",(int)pos);
00034 int six=LongInt(info.substr(pos,info.size()-pos));
00035 pos=info.find("##$IM_SIY=")+10;
00036 int siy=LongInt(info.substr(pos,info.size()-pos));
00037 pos=info.find("##$IM_SIZ=")+10;
00038 int siz=LongInt(info.substr(pos,info.size()-pos));
00039 printf("CReadFromFileBruker:: XZY: %d %d %d\n",six,siy,siz);
00040 int dataSize;
00041 ImType::value_type *data=(ImType::value_type *)Read(prefix+"2dseq",&dataSize,true);
00042 if(dataSize!=six*siy*siz*(int)sizeof(ImType::value_type))
00043 {ThrowError("CReadFromFileBruker: bad file size");}
00044 IP3D::ImageFromRawData(data,Size3D(six,siz,siy),"XZY",res,true);
00045 delete [] data;
00046 if(six==siy && six==siz)
00047 {
00048 IP3D::SwapAxes(res,"XZ",res);
00049 IP3D::SwapAxes(res,"YZ",res);
00050
00051 }
00052 else
00053 {
00054
00055 IP3D::Flip(res,"Y",res);
00056 }
00057 }