[vtkusers] Need help loading image from memory

Hossein Nazem hossein.nazem at gmail.com
Wed Jan 30 09:25:24 EST 2013


hi all
i'm trying to load a volume from memory by means of setvoidarray.
its a 3d array of int (512*512*295) and i use vs2012 win7 x64.
there is no compile error but in run time when i trace program to
the line"da->SetVoidArray(buffer,512*512*295,1);" (by F10 or F11) ,
tracing terminate!
nothing happen and no runtime error!
any help is appreciated
here is my code:

void rendering::LoadFromMemory(INT16 buffer[512][512][295], int width,
int height, int slices, double voxelsizeX, double voxelsizeY, double
voxelsizeZ, double originX, double originY, double originZ)
{
	input = 0;
	if (!input)
	{
		input = vtkImageData::New();
	}
	vtkDataArray* da ;
	da = 0;
	da->SetVoidArray(buffer,512*512*295,1);
	input->GetPointData()->SetScalars(da);
	input->SetDimensions(width, height, slices);
	input->SetSpacing(voxelsizeX, voxelsizeY, voxelsizeZ);
	input->SetOrigin(originX, originX, originZ);
}



More information about the vtkusers mailing list