AW: [Insight-users] Show 3d image data by vtk, cont'

jiang jiang at TI . Uni-Trier . DE
Tue, 30 Sep 2003 10:19:37 +0200


Hi Luis,
As you said, I use the library VtkQt that developed by M. Koenig to combine
VTK and QT. It works fine. However my problem is not solved. When the data
is transfered from ITK to VTK, and rendered by VTK, there is only one blue
block with some black points, not the images I readed. And there are only
two images in the series, but the block is very thick, much more than the
depth of two images.
Does anybody do the similar work as me? Please tell me how can I solve this
problem?

Thanks a lot!

Chunyan Jiang

-----Ursprungliche Nachricht-----
Von: Luis Ibanez [mailto:luis . ibanez at kitware . com]
Gesendet: Donnerstag, 25. September 2003 17:25
An: jiang
Cc: ITK
Betreff: Re: [Insight-users] Show 3d image data by vtk, cont'



Hi Jiang,

Please look at Sebastien's page on how to combine
VTK & QT

http://www . barre . nom . fr/vtk/links-classes . html#qt

Using any of the components indicated in this page
will save you a lot of time.



Also, instead of connecting the vtkImageImport
filter by yourself, it will be much simpler to
use the pseudo-filters in

InsightApplications/Auxiliary/vtk

             itkImageToVTKImageFilter

They put together an ITK & VTK Importer/Exporter
and do all the pipeline connections.  It will be
equivalent to your code, but much cleaner.



Regards,


   Luis



-----------------------
jiang wrote:
> Hi Luis,
> Thank you for your hint. I modify my code according the example
> itkImageToVTKImage, and try to render it by VTK:
>
> 	vtkRenderer *renderer = vtkRenderer::New();
> 	vtkRenderWindow *renWin = vtkRenderWindow::New();
>       renWin->AddRenderer(renderer);
>
> //	renWin->SetParentId(mainFm); It doesn't work! :(
>
> 	vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
>       iren->SetRenderWindow(renWin); // It also doesn't work
>
> 	typedef itk::VTKImageExport<ImageNDType> ExportType;
> 	ExportType::Pointer connector;
> 	connector= ExportType::New();
> 	connector->SetInput( reader->GetOutput() );//reader gets a series of
DICOM
> files.
> /*Create a pipeline ITK-->VTK*/
> 	vtkImageImport* importer = vtkImageImport::New();
>
>
importer->SetUpdateInformationCallback(connector->GetUpdateInformationCallba
> ck());
>
>
importer->SetPipelineModifiedCallback(connector->GetPipelineModifiedCallback
> ());
> 	importer->SetWholeExtentCallback(connector->GetWholeExtentCallback());
> 	importer->SetSpacingCallback(connector->GetSpacingCallback());
> 	importer->SetOriginCallback(connector->GetOriginCallback());
> 	importer->SetScalarTypeCallback(connector->GetScalarTypeCallback());
>
>
importer->SetNumberOfComponentsCallback(connector->GetNumberOfComponentsCall
> back());
>
>
importer->SetPropagateUpdateExtentCallback(connector->GetPropagateUpdateExte
> ntCallback());
> 	importer->SetUpdateDataCallback(connector->GetUpdateDataCallback());
> 	importer->SetDataExtentCallback(connector->GetDataExtentCallback());
>
importer->SetBufferPointerCallback(connector->GetBufferPointerCallback());
> 	importer->SetCallbackUserData(connector->GetCallbackUserData());
> /*Create a pipeline ITK-->VTK*/
>
> 	vtkStructuredPoints* structPts= vtkStructuredPoints::New();
> 	vtkImageToStructuredPoints* its=vtkImageToStructuredPoints::New();
> 	its->SetInput(importer->GetOutput());
> 	structPts=its->GetOutput();
>
> 	vtkDataSetMapper* mapper=vtkDataSetMapper::New();
> 	mapper->SetInput(structPts);
>
> 	vtkActor* actor=vtkActor::New();
> 	actor->SetMapper(mapper);
>
> 	renderer->AddActor(actor);
>     renderer->SetBackground(1,1,1);
> 	renWin->Render();
>
> 	iren->Start();
>
>
>
> However, in the vtk window, there is only one blue square is shown, no
> image. I want to show this vtk window in the QtFrame. But
> renWin->SetParentId(mainFm); doesn't work. And iren also doesn't work.
> I'm sure the reader works correct. I displayed one image from it. It is
> fine.
>
> Could you tell me what is wrong in my code?
>
> Thank you very much!
>
>
> Chunyan
>
>
>
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>