#include "..\..\nzrClient\nzrClient.h"

 

int main(int argc, char* argv[])

{

  nzrClient   *myNZRClient;

  nzr_3D      *pHeadVolume;

  unsigned short myImage[64][64];

  unsigned char myVolume8[64][64][64];

  char myString[100];

  unsigned char myLut[4096];

 

  for (int j = 0; j< 4096;  j++)

        myLut[j] = (unsigned char) ((float ((j )/4096.0))*255.0);

 

  myNZRClient = new nzrClient;

 

  for( int k = 1 ; k<64 ; k++)

  {

    // Load the images from the file

    sprintf(myString,"quarter.%d",k);

    FILE       *inFile = fopen( myString,"r");

    if( inFile != NULL)

    {

        fread(&myImage[0][0],1,sizeof(myImage),inFile);

        fclose(inFile);

        // convert to 8 bits

        for(int i = 0; i< 64; i++)

        {

          for( int j = 0; j < 64; j++)

                {

                if( myImage[i][j] > 4095) myImage[i][j] = 4095;  // clip

                  myVolume8[k][i][j] = (unsigned char) myLut[myImage[i][j]];

                }

        }

    }

  }

  pHeadVolume = new nzr_3D;

  myNZRClient->newObject(pHeadVolume);  // set default values

  // set data parameters for the object

  pHeadVolume->cmnd.sizeX = 64;

  pHeadVolume->cmnd.sizeY = 64;

  pHeadVolume->cmnd.sizeZ = 64;

  pHeadVolume->cmnd.numberOfComponents = 1;

  pHeadVolume->cmnd.sizeOfDataElement = 1;

       

  // creates the new object and assigns id

  myNZRClient->createObject(pHeadVolume);

 

  // Send Volume data

  myNZRClient->writeObject(pHeadVolume, &myVolume8[0][0][0]);

 

  // render the 3D data on NZR display

  myNZRClient->render(pHeadVolume);

 

  // delete client

  myNZRClient->~nzrClient();

  delete pHeadVolume;

 

  return 0;

}

The above image and video was the result of the code shown on this page.

3D

Home
Products
News
Contact Us