[vtkusers] Padding a Volume

Adam D. Burry aburry at igotechnologies.com
Wed Dec 12 19:43:21 EST 2001


Hi:

I'm trying to pad a vtkStructuredPoints so that the dimensions are a
power of two. The reason is that I want to be able to extract texture
slices using vtkExtractVOI, but I do not want the texture resampling
everytime I do it.

This poster seems to have been doing the exact same thing and having as
much success:

	http://public.kitware.com/pipermail/vtkusers/2000-July/003700.html

Does anyone know what I'm doing wrong? Perhaps vtkImageConstantPad will
simply not work on a volume?

My code looks something like this:

	// ... pVolumeReader previously set up

	// Update to get the extent data
	pVolumeReader->Update();

	// Want extents to be power of two to save textures the heartache.
	// Logically this is not required, it's an efficiency thing.
	int pExtents[6];
	m_pVolumeReader->GetOutput()->GetWholeExtent( pExtents );
	for ( int i = 1; i < 6; i += 2 )
	{
		pExtents[i] = powerOfTwo( pExtents[i] + 1 ) - 1;
	}

	// Pad the data
	vtkImageConstantPad* pImageConstantPad = vtkImageConstantPad::New();
	pImageConstantPad->SetOutputWholeExtent( pExtents );
	pImageConstantPad->SetInput( m_pVolumeReader->GetOutput() );

        vtkExtractVOI* pSliceData = vtkExtractVOI::New();
	pSliceData->SetVOI( x_dim1, x_dim2, y_dim1, y_dim2, z_dim1, z_dim2 );
        pSliceData->SetInput( pImageConstantPad->GetOutput() );

	// Set texture, build plane, etc...

Thanks.

Adam

--
Mr. Adam D. Burry, Software Developer
aburry at igotechnologies.com



More information about the vtkusers mailing list