[vtkusers] QT/C++ problem
Jothy
jothybasu at gmail.com
Fri Aug 20 11:24:13 EDT 2010
A small correction is set to:
mImageViewerSagittal->SetRenderWindow(ui->qvtkWidget*Sagittal*->GetRenderWindow());
still problem is not solved!
On Fri, Aug 20, 2010 at 4:17 PM, Jothy <jothybasu at gmail.com> wrote:
> Hi all,
>
> Here is the problematic part of the code which I wrote using QtCreator. I
> am trying to render axial and sagittal. But only the first "call" is called!
>
>
> Source:
> void MainWindow::on_actionImport_CT_triggered()
>
> {
>
> this->ReadCT();
>
> this->ShowAxial();
>
> this->ShowAxial();
>
> }
>
> void MainWindow::ReadCT()
>
> {
>
> QString Folder=QFileDialog::getExistingDirectory();
>
> std::string FolderStr;
>
> FolderStr=Folder.toStdString();
>
> mDicomReader=vtkDICOMImageReader::New();
>
> mDicomReader->SetDirectoryName(FolderStr.c_str());
>
> mDicomReader->Update();
>
> }
>
> void MainWindow::ShowAxial()
>
> {
>
> mImageViewerAxial=vtkImageViewer2::New();
>
> mImageViewerAxial->SetInputConnection(this->mDicomReader->GetOutputPort());
>
> mImageViewerAxial->SetSlice(20);
>
> mImageViewerAxial->SetSliceOrientationToXY();
>
> mRenderWindowInteractorAxial= vtkRenderWindowInteractor::New();
>
> mImageViewerAxial->SetupInteractor(mRenderWindowInteractorAxial);
>
> mImageViewerAxial->SetRenderWindow(ui->qvtkWidgetAxial->GetRenderWindow());
>
> mImageViewerAxial->Render();
>
> mImageViewerAxial->GetRenderer()->ResetCamera();
>
> mImageViewerAxial->Render();
>
> mRenderWindowInteractorAxial->Start();
>
> }
>
> void MainWindow::ShowSagittal()
>
> {
>
> mImageViewerSagittal=vtkImageViewer2::New();
>
> mImageViewerSagittal->SetInput(this->mDicomReader->GetOutput());
>
> mImageViewerSagittal->SetSlice(10);
>
> mImageViewerSagittal->SetSliceOrientationToXZ();
>
> mRenderWindowInteractorSagittal =vtkRenderWindowInteractor::New();
>
> mImageViewerSagittal->SetupInteractor(mRenderWindowInteractorSagittal);
>
> mImageViewerSagittal->SetRenderWindow(ui->qvtkWidget*Sagittal*->GetRenderWindow());
>
> mImageViewerSagittal->Render();
>
> mImageViewerSagittal->GetRenderer()->ResetCamera();
>
> mImageViewerSagittal->Render();
>
> mRenderWindowInteractorSagittal->Start();
>
> }
>
>
>
> Header:
> class MainWindow : public QMainWindow
>
> {
>
> Q_OBJECT
>
> public:
>
> explicit MainWindow(QWidget *parent = 0);
>
> ~MainWindow();
>
> void ReadCT();
>
> void ShowAxial();
>
> void ShowSagittal();
>
> private:
>
> Ui::MainWindow *ui;
>
> vtkImageData* mImageData;
>
> vtkImageViewer2* mImageViewerAxial;
>
> vtkImageViewer2* mImageViewerSagittal;
>
> vtkDICOMImageReader* mDicomReader;
>
> vtkRenderWindowInteractor* mRenderWindowInteractorAxial;
>
> vtkRenderWindowInteractor* mRenderWindowInteractorSagittal;
>
> private slots:
>
> void on_verticalScrollBar_actionTriggered(int action);
>
> void on_actionImport_CT_triggered();
>
> };
>
> Thank you
>
> Jothy
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100820/e623a09d/attachment.htm>
More information about the vtkusers
mailing list