Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Re: reading 3D array as image

Subject: CGAL users discussion list

List archive

[cgal-discuss] Re: reading 3D array as image


Chronological Thread 
  • From: elhassan Abdou <>
  • To:
  • Subject: [cgal-discuss] Re: reading 3D array as image
  • Date: Sat, 10 Dec 2011 13:27:34 +0100

Dear ALL

I stayed whole night yesterday to find a way to read my 3D array to mesh generator. The CGAL file are so awkward to be understood. I did not find any way. I will appreciate any hint . I could not find a way to hack around. Can any developer of the file reader tell us what to do. Also is this mean if I tried to use different CGAL modules I must write the results to *.inr file and make the other module use it. This will be a good KILL PERFORMANCE. 

Best
Elhassan
On Dec 10, 2011, at 1:42 AM, elhassan Abdou wrote: 

Hi

I need to put mesh generator in my framework. It does not make any sense to me to write the data to *.inr file and read it back. I allocate one dimensional pointer and put data from 3D data. I borrow the data from the raw reader.
Here is snippet of code but it does not work out. Can any one help??
The outputVolume is structure contain 3D array.
uint8_t *volumearray =new uint8_t[outputdim.z*outputdim.y*outputdim.x];
           uint8_t *vptr= volumearray;
           for (i=0; i<(outputdim.x); i++) {
                for (j=0; j<(outputdim.y); j++) {
                      for (k=0; k<(outputdim.z); k++) {
                          vptr[k*outputdim.x*outputdim.y + j*outputdim.x + i]=static_cast<uint8_t>(outputVolume->getVoxelFloat(i,j,k));
                          //++idx;
                                              }
                                          }
                                      }
                       /*for(size_t i=0;i<outputVolume->getNumVoxels();i++)
                           vptr[i]=static_cast<uint8_t>(outputVolume->getVoxelFloat(i));
                       std::cout<<volumearray[500];*/
                       CGAL::Image_3 image(_createImage(outputdim.x, outputdim.y, outputdim.z, 1, spacing.x, spacing.y, spacing.z, 1, WK_FIXED,SGN_UNSIGNED));
                       ImageIO_free(image.data());
                       image.set_data(volumearray);

Have a nice week

Elhassan Abdou
Computational Science master student
Uppsala



Elhassan Abdou
Computational Science master student
Uppsala




Archive powered by MHonArc 2.6.16.

Top of Page