[vtkusers] vtkImageViewer2 shows only a black image under Windows
Kacper Pluta
kacper.pluta at gmail.com
Mon Sep 17 03:56:47 EDT 2012
Hi!
I'm working on a Windows port of code which was written under Linux and OS
X, and I have strange problem with vtkImageViewer2, under Windows it shows
only a black screen.
All data are loaded from raw file and mapped by vtkImageData
vtkSmartPointer< vtkImageData > CaseDataImage::GetVTKImage()
{
if(image || ReadFromCache()) {
m_ReferenceCount++;
m_ToVTK->SetWholeExtent( 0, image->row_size - 1, 0, image->col_size -
1, 0, image->depth_size - 1 );
m_ToVTK->SetDataExtentToWholeExtent();
if(GetDataType() == VFF_TYP_1_BYTE ) {
m_ToVTK->SetDataScalarTypeToUnsignedChar();
} else if (GetDataType() == VFF_TYP_2_BYTE ) {
m_ToVTK->SetDataScalarTypeToUnsignedShort();
}
m_ToVTK->SetNumberOfScalarComponents( 1 );
m_ToVTK->SetImportVoidPointer( image->image_data );
m_ToVTK->Update();
return m_ToVTK->GetOutput();
} else {
return NULL;
}
}
And vtkImageViewer2:
m_MainViewer = vtkSmartPointer< vtkImageViewer2 >::New();
m_MainViewer->SetInput( MagazinClass::imageData->GetVTKImage() );
m_MainViewer->SetColorLevel( -200.0 +
MagazinClass::imageData->GetShiftToPositive() );
m_MainViewer->SetColorWindow( 500.0 );
m_MainViewer->SetRenderWindow( vtkData2DMainSlice->GetRenderWindow() );
m_MainViewer->SetupInteractor(
vtkData2DMainSlice->GetRenderWindow()->GetInteractor() );
m_MainViewer->SetSliceOrientation( axis );
m_MainViewer->SetSlice( slice );
Strange because under Linux and OS X everything works great.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120917/9f152b79/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: demo.jpg
Type: image/jpeg
Size: 18913 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120917/9f152b79/attachment.jpg>
More information about the vtkusers
mailing list