2014-11-07 3 views
1

CGAL은 디스크에서 기존 이미지 파일을 읽는 기능 read에 의해 Image_3 개체를 인스턴스화하는 방법을 제공합니다. 어떻게 그렇게 할CGAL에서 높이, 너비, 깊이 및 데이터 포인터를 전달하여 Image_3 인스턴스 만들기

CGAL::Image_3 im; 
int Height = 512; 
int Width = 512; 
int Depth = 100; 
int* dataptr = new int [Height*Width*Depth]; 
memset(dataptr, 0, sizeof(int)*Height*Width*Depth); 
MyCreate(im, Height, Width, Depth, dataptr); // <== my function to instance this object. 

: 나는 height,width,depth이 같은 data pointer와 그것을 예를 할 수 있는지 궁금하네요?

답변

0

당신은 다음과 같은 코드가 아닌 문서화 된 조각 (실제로 테스트하지) 사용할 수 있습니다. 나는 CGAL-4.5/src/CGAL_ImageIO/Image_3.cpp의 기능 Image_3::read_vtk_image_data (의 코드를 적응

// create and fill the _image struct 
_image* image = ::_initImage(); 
image->vectMode = VM_SCALAR; 
image->xdim = Height; 
image->ydim = Width 
image->zdim = Depth; 
image->vdim = 1; 
image->vx = 1.; 
image->vy = 1.; 
image->vz = 1.; 
image->endianness = ::_getEndianness(); 
image->wdim = sizeof(int); 
image->wordKind = WK_FIXED; 
image->sign = SGN_SIGNED; 
image->data = dataptr; 

// then create the CGAL::Image_3 object: 
CGAL::Image_3 im(image);