 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
48 if ( fimg.fail() )
return -1;
51 cout <<
"DEBUG readDX: Start reading text image" << endl;
54 long i(0), j(0), n(0);
65 while ( !fimg.eof() ) {
67 if ( tag ==
"counts" && n < 1 ) {
68 if ( i < 3 ) size[i++] = str.integer();
70 n = size[0]*size[1]*size[2];
74 cout <<
"DEBUG readDX: size=" << p->
size() << endl;
77 if ( tag ==
"origin" && i < 3 )
78 ori[i++] = str.integer();
79 if ( tag ==
"delta" && i < 3 ) {
80 if ( i == j-1 ) sam[i] = str.real();
84 if ( readdata && tag ==
"times" && i < n )
85 p->
set(i++, str.real());
86 if ( str ==
"counts" || str ==
"origin" || str ==
"delta" || str ==
"times" ) {
89 if ( str ==
"delta" ) j++;
90 if ( str ==
"times" ) fimg >> str;
97 if ( p->
sizeZ() > 1 ) str =
"zyx";
98 else if ( p->
sizeY() > 1 ) str =
"yxz";
116 if ( fimg.fail() )
return -1;
118 long i, j, x, y, z, n = p->
size()[0]*p->
size()[1]*p->
size()[2];
120 fimg <<
"# Written by Bsoft" << endl;
121 fimg <<
"# " << p->
label() << endl;
123 fimg <<
"object 1 class gridpositions counts " << p->
sizeX()
124 <<
" " << p->
sizeY() <<
" " << p->
sizeZ() << endl;
127 fimg <<
"delta " << p->
sampling(0)[0] <<
" 0.0 0.0" << endl;
128 fimg <<
"delta 0.0 " << p->
sampling(0)[1] <<
" 0.0" << endl;
129 fimg <<
"delta 0.0 0.0 " << p->
sampling(0)[2] << endl;
131 fimg <<
"object 2 class gridconnections counts " << p->
sizeX()
132 <<
" " << p->
sizeY() <<
" " << p->
sizeZ() << endl;
134 fimg <<
"object 3 class array type double rank 0 times " << n;
135 for ( j=x=0; x<p->
sizeX(); x++ ) {
136 for ( y=0; y<p->
sizeY(); y++ ) {
137 for ( z=0; z<p->
sizeZ(); z++, j++ ) {
138 if ( j%3 ) fimg <<
" ";
147 fimg <<
"attribute \"dep\" string \"positions\"" << endl;
148 fimg <<
"object \"regular positions regular connections\" class field" << endl;
149 fimg <<
"component \"positions\" value 1" << endl;
150 fimg <<
"component \"connections\" value 2" << endl;
151 fimg <<
"component \"data\" value 3" << endl;
void reslice(const char *order)
void set(long j, double v)
Sets a single value at the given index.
Vector3< long > size() const
void origin(double x, double y, double z)
Header file for reading and writing OpenDX files.
General image parameter class.
unsigned char * data_alloc()
void origin(double ox, double oy, double oz)
long index(long nx, long ny) const
int writeDX(Bimage *p)
Writing a DX image format.
void sampling(long nn, Vector3< double > u)
int readDX(Bimage *p, int readdata)
Reading an OpenDX image format.