[vtkusers] memory allocation in vtkClipVolume and other vtkUnstructuredGridAlgorithm

Feng Qiu fengqiu at gmail.com
Fri Nov 16 17:07:41 EST 2007


Hi,
I want to extract the part of a 512x512x451 12bit (stored in short) CT
volume of which the scalar value is inside certain range [u,v], and
convert the output to a tetrahedron mesh. I have tried to use the
vtkClipVolume and vtkThreshold classes. But both algorithms failed
when allocating memory. It seems that these two algorithms use more
than 2GB memory on my machine. Is this normal or my program not
correct? Or shall I use another algorithm?

Configuration of my machine:
Dual Xeon CPU 3.6GHz
3GB Memory
Windows XP (32bit)

Code segment (using vtkThresold):

typedef vtkImageData imgdata_type;
typedef vtkStructuredPointsReader reader_type;
typedef vtkThreshold extract_type;
typedef vtkClipDataSet clipper_type;
typedef vtkUnstructuredGrid tetramesh_type;
typedef vtkUnstructuredGridWriter writer_type;

	reader_type* pReader = reader_type::New();
	pReader->SetFileName(g_args.m_sInputFileName.c_str());
	pReader->Update();
	imgdata_type* pVol = pReader->GetOutput();

	extract_type* pExtract = extract_type::New();
	pExtract->SetInput(pVol);
	pExtract->ThresholdByUpper(1.0);
	pExtract->Update();
	tetramesh_type* pExtractVol = pExtract->GetOutput();
        ...........

Code segment (using vtkClipVolume)

typedef vtkImageData imgdata_type;
typedef vtkStructuredPointsReader reader_type;
typedef vtkClipVolume clipper_type;

	reader_type* pReader = reader_type::New();
	pReader->SetFileName(g_args.m_sInputFileName.c_str());
	pReader->Update();
	imgdata_type* pVol = pReader->GetOutput();

        clipper_type* pClipper = clipper_type::New();
        pClipper->SetFileName(g_args.m_sInputFileName.c_str());
        pClipper->SetValue(500);
	pClipper->GenerateClippedOutputOff();
	tetramesh_type* pMesh = pClipper->GetOutput();

	writer_type* pWriter = writer_type::New();
	pWriter->SetInput(pMesh);
	pWriter->SetFileName(g_args.m_sOutputFileName.c_str());
	pWriter->SetFileTypeToBinary();
	pWriter->Write();
        .......................



More information about the vtkusers mailing list