Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7552523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:46:41+00:00 2026-05-30T10:46:41+00:00

I want to create a 3D visualizer of .raw volume medical datasets using marching

  • 0

I want to create a 3D visualizer of .raw volume medical datasets using marching tetrahedra.

I found this implementation on GPL license that looks nice and is based on the info by Paul Bourke, but I don’t know how to make work with a .raw file, which I’ve found people load as a 3d texture.

//assuming that the data at hand is a 256x256x256 unsigned byte data
int XDIM=256, YDIM=256, ZDIM=256;
const int size = XDIM*YDIM*ZDIM;
bool LoadVolumeFromFile(const char* fileName) {

    FILE *pFile = fopen(fileName,"rb");
   if(NULL == pFile) {
    return false;
   }

   GLubyte* pVolume=new GLubyte[size]; //<- here pVolume is a 1D byte array 
   fread(pVolume,sizeof(GLubyte),size,pFile);
   fclose(pFile);

   // now pVolume is passed to a 3d texture 

    //load data into a 3D texture


glGenTextures(1, &textureID);
   glBindTexture(GL_TEXTURE_3D, textureID);

   // set the texture parameters
   glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP);
   glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP);
   glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP);
   glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
   glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

   glTexImage3D(GL_TEXTURE_3D,0,GL_INTENSITY,XDIM,YDIM,ZDIM,0,GL_LUMINANCE,GL_UNSIGNED_BYTE,pVolume);
   delete [] pVolume;
   return true;




}

I don’t know if I should either:
a) access the values directly from pValue
b) access them after loading them to a 3D texture

I have no idea of how I’m supposed to index pVolume to get the isosurface intensity at each x,y,z. if pVolume is a 1D array. I know x,y coordinates are mapped from a 1D array using a divide and a module, but how would I map x,y,z?

On the other hand, If I load the .raw file as a 3d texture would

glTexCoord3f

give me the isovalue at a given x,y,z?

Clarification: The question isn’t “can OpenGL draw an isosurface directly from this?” the question is how to index the isolevels on the .raw geometry, which is needed to evaluate each tetrahedron properly. On the image one can see that each tetrahedron case is marked based on whether the isosurface is above or below it. The isosurface is indexed on it’s x,y,z coordinates on the .raw file, how can I access it for each x,y,z on the dataset? Will glTexCoord3f give me its intensity on a given x,y,z? Is it better to do a x,y,z conversion from the pVolume array directly?

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T10:46:42+00:00Added an answer on May 30, 2026 at 10:46 am

    The isosurface is indexed on it’s x,y,z coordinates on the .raw file, how can I access it for each x,y,z on the dataset?

    By loading the image as a 3D array and indexing it. Not by loading it as an OpenGL texture.

    Will glTexCoord3f give me its intensity on a given x,y,z?

    No. As the documentation states, glTexCoord3f simply provides a set of texture coordinates to the next vertex to be issued. It returns nothing, it doesn’t cause anything to happen yet. All it does is set state within OpenGL.

    Is it better to do a x,y,z conversion from the pVolume array directly?

    Yes. Information in OpenGL should generally travel in one direction: from the user to the screen. OpenGL functions exist for you to feed OpenGL information that it will use to render something. That’s how OpenGL works best.

    Any kind of back-tracking (reading images back to the CPU, etc) is a slow path.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want create a pdf using iText. The method which does this is a
I want to create a component using core service in SDL Tridion 2011 using
I want create subdomains like this: domain.com/type/city An examples: domain.com/restaurants/new_york domain.com/hotels/new_york domain.com/restaurants/chicago I have
I want create a drop shadow around the canvas component in flex. Technically speaking
I want create a excel with Apache POI in java and I must insert
i want create image animation , i have 50 images with png format now
I want create module which update list of usb devices automatically (not only mass
I want to create a hover effect for an element but want the pre-hover
I want to create a common header user control for various master pages in
I want to create an automated performance metric gathering tool, to get various metrics

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.