[vtkusers] need help about vtkBMPReader

med ali daalyusmo at yahoo.fr
Fri Jun 10 06:48:00 EDT 2005


hi,
 
thanks for your help
 
can you tell me if this part of code is right or not 
 i have wrote this :
 
 
////////////////////**********************  constructImageData***************/////////////////////////////
void TimacBase::constructImageData(CImageBoxFL *img_box)
{
  imageData->SetScalarTypeToUnsignedChar();
  imageData->SetNumberOfScalarComponents(3);
  imageData->SetDimensions(16, 16, 16);
  imageData->AllocateScalars();
  int i = 0;
  int j = 0;
  unsigned char r = 0;
  unsigned char g = 0;
  unsigned char b = 0;
  unsigned char *data = (unsigned char *) imageData->GetScalarPointer();
  int k = 0;
  for (k= 0; k<16; ++k) 
  {
  data=img_box->tab[k].imgAff->data;  // tab is an array og images 
  }
} 

David Cole <david.cole at kitware.com> a écrit :
If you need a 3d volume of bitmaps that are all the same x,y size, just do the same thing, but add an iteration over the z-dimension. The vtkImageData object supports 3 dimensions. Then, for each distinct value of z, you'll be jamming a separate bitmap into a given z-slice of the vtkImageData.

In the example, change the SetDimensions call to include more than one z value:
  imageData->SetDimensions(16, 16, 16);

Then add another loop to fill in the z data:
  int k = 0;
  for (k= 0; k<16; ++k) // as outer loop; i and j loops in here; conecptually, first slice filled is z=0, next z=1 and so on...

Then simply use the imageData object as the input to your algorithm, just like you would have used the output of the BMP reader...


David


 

David Cole <david.cole at kitware.com> a écrit :If you need a 3d volume of bitmaps that are all the same x,y size, just do the same thing, but add an iteration over the z-dimension. The vtkImageData object supports 3 dimensions. Then, for each distinct value of z, you'll be jamming a separate bitmap into a given z-slice of the vtkImageData.

In the example, change the SetDimensions call to include more than one z value:
  imageData->SetDimensions(16, 16, 16);

Then add another loop to fill in the z data:
  int k = 0;
  for (k= 0; k<16; ++k) // as outer loop; i and j loops in here; conecptually, first slice filled is z=0, next z=1 and so on...

Then simply use the imageData object as the input to your algorithm, just like you would have used the output of the BMP reader...


David




		
---------------------------------
 Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
 Téléchargez le ici !  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050610/c3537344/attachment.htm>


More information about the vtkusers mailing list