TopPatchesWidget<TImage>::TopPatchesWidget(TImage* const image, const unsigned int patchHalfWidth) : Image(image) { //qRegisterMetaType<itk::ImageRegion<2> >("itkImageRegion"); qRegisterMetaType<std::vector<Node> >("VectorOfNodes"); this->setupUi(this); SetupScenes(); PatchesModel = new ListModelPatches<TImage>(image, patchHalfWidth); this->listView->setModel(PatchesModel); PixmapDelegate* pixmapDelegate = new PixmapDelegate; //this->listView->setItemDelegateForColumn(0, pixmapDelegate); this->listView->setItemDelegate(pixmapDelegate); }
//BasicViewerWidget<TImage>::BasicViewerWidget(TImage* const image, Mask* const mask) : BasicViewerWidget<TImage>::BasicViewerWidget(typename TImage::Pointer image, Mask::Pointer mask) : Image(image), MaskImage(mask) { qRegisterMetaType<itk::ImageRegion<2> >("itkImageRegion"); this->setupUi(this); int dims[3]; this->ImageLayer.ImageData->GetDimensions(dims); typename TImage::Pointer tempImage = TImage::New(); ITKHelpers::DeepCopy(image.GetPointer(), tempImage.GetPointer()); typename TImage::PixelType zeroPixel(tempImage->GetNumberOfComponentsPerPixel()); zeroPixel = itk::NumericTraits<typename TImage::PixelType>::ZeroValue(zeroPixel); mask->ApplyToImage(tempImage.GetPointer(), zeroPixel); ITKVTKHelpers::ITKVectorImageToVTKImageFromDimension(tempImage.GetPointer(), this->ImageLayer.ImageData); // if(chkScaleImage->isChecked()) // { // VTKHelpers::ScaleImage(this->ImageLayer.ImageData); // } this->ImageDimension[0] = dims[0]; this->ImageDimension[1] = dims[1]; this->ImageDimension[2] = dims[2]; SetupScenes(); // this->InteractorStyle = vtkSmartPointer<InteractorStyleImageWithDrag>::New(); this->InteractorStyle = vtkSmartPointer<vtkInteractorStyleImage>::New(); this->Renderer = vtkSmartPointer<vtkRenderer>::New(); this->qvtkWidget->GetRenderWindow()->AddRenderer(this->Renderer); this->Renderer->AddViewProp(ImageLayer.ImageSlice); this->InteractorStyle->SetCurrentRenderer(this->Renderer); this->qvtkWidget->GetRenderWindow()->GetInteractor()->SetInteractorStyle(this->InteractorStyle); // this->InteractorStyle->Init(); // this->Camera = new ImageCamera(this->Renderer); this->ItkVtkCamera = new ITKVTKCamera(this->InteractorStyle, this->Renderer, this->qvtkWidget->GetRenderWindow()); this->ItkVtkCamera->SetCameraPositionPNG(); }
ManualPatchSelectionDialog<TImage>::ManualPatchSelectionDialog(TImage* const image, Mask* const mask, const itk::ImageRegion<2>& targetRegion) : Image(image), MaskImage(mask), TargetRegion(targetRegion) { // Allow the type itkImageRegion to be used in signals/slots. qRegisterMetaType<itk::ImageRegion<2> >("itkImageRegion"); this->setupUi(this); this->ImageLayer.ImageSlice->SetDragable(false); this->ImageLayer.ImageSlice->SetPickable(false); typename TImage::Pointer tempImage = TImage::New(); ITKHelpers::DeepCopy(image, tempImage.GetPointer()); typename TImage::PixelType zeroPixel(tempImage->GetNumberOfComponentsPerPixel()); zeroPixel.Fill(0); mask->ApplyToImage(tempImage.GetPointer(), zeroPixel); ITKVTKHelpers::ITKVectorImageToVTKImageFromDimension(tempImage.GetPointer(), this->ImageLayer.ImageData); SetupScenes(); this->Renderer = vtkSmartPointer<vtkRenderer>::New(); this->InteractorStyle = vtkSmartPointer<InteractorStyleImageWithDrag>::New(); this->qvtkWidget->GetRenderWindow()->AddRenderer(this->Renderer); this->Renderer->AddViewProp(ImageLayer.ImageSlice); // Per the comment in InteractorStyleImageWithDrag, the next 3 lines must be in this order this->InteractorStyle->SetCurrentRenderer(this->Renderer); this->qvtkWidget->GetRenderWindow()->GetInteractor()->SetInteractorStyle(this->InteractorStyle); this->InteractorStyle->Init(); this->PatchSelector = new MovablePatch(this->TargetRegion.GetSize()[0]/2, this->InteractorStyle, this->gfxSource); // slot_UpdateImage(); this->Renderer->ResetCamera(); this->qvtkWidget->GetRenderWindow()->Render(); // this->Camera = new ImageCamera(this->Renderer); connect(this->PatchSelector, SIGNAL(signal_PatchMoved()), this, SLOT(slot_PatchMoved())); }