WITVolumeViz::~WITVolumeViz() { // release memory //_overlays.clear(); VTK_SAFE_DELETE(_img); VTK_SAFE_DELETE(_lutBW); VTK_SAFE_DELETE(_lutColor); VTK_SAFE_DELETE(_pdBorder); }
void QuenchFrame::DestroySceneWindowAndPanels() { // Destroy panels _color_map_panel->Destroy(); _overlay_panel ->Destroy(); _stats_panel->Destroy(); // tony new _imagePreview->Destroy(); _perPointColor->Destroy(); // tony new // Destroy scene stuff VTK_SAFE_DELETE(_pSceneWindow); VTK_SAFE_DELETE(_istyle); _bRendererDeleted = true; }
vtkInteractorStyleQuench::~vtkInteractorStyleQuench() { //_propPicker->Delete(); VTK_SAFE_DELETE(_renderer); delete _volViz; _volViz = 0; delete _pathwayViz; _pathwayViz = 0; delete _voiViz; _voiViz = 0; delete _GestureInteractor; delete _voiEditor; }
void WITVolumeViz::updateActors() { if(!_vol) return; this->updateUserMatrices(); uint dim[4]; double voxSize[3]; _vol->getDimension(dim[0], dim[1], dim[2], dim[3]); _vol->getVoxelSize(voxSize[0], voxSize[1], voxSize[2]); VTK_SAFE_DELETE(_img); _img = vtkImageData::New(); _img->SetScalarTypeToFloat(); _img->SetNumberOfScalarComponents(dim[3]); _img->SetDimensions (dim[0], dim[1], dim[2]); _img->SetSpacing (1,1,1); if (dim[3] == 1) _img->SetScalarTypeToFloat(); else _img->SetScalarTypeToUnsignedChar(); _img->AllocateScalars(); vtkScalarsToColors *lut = _lutBW; if (dim[3] == 1) // more common case { // create the sagital actor vtkImageMapToColors *sagittalColors = vtkImageMapToColors::New(); sagittalColors->SetInput(_img); sagittalColors->SetLookupTable(lut); // create the axial actor vtkImageMapToColors *axialColors = vtkImageMapToColors::New(); axialColors->SetInput(_img); axialColors->SetLookupTable(lut); // create the coronal actor vtkImageMapToColors *coronalColors = vtkImageMapToColors::New(); coronalColors->SetInput(_img); coronalColors->SetLookupTable(lut); // Apply the color map to all registered actors this->setSliceActorsToColors(sagittalColors, axialColors, coronalColors); sagittalColors->Delete(); axialColors->Delete(); coronalColors->Delete(); } else { // Apply user matrix to each registered actor for(std::map<vtkRenderWindow*, ActorSet*>::iterator it = this->windowToActorSet.begin(); it != this->windowToActorSet.end(); it++) { ActorSet *as = it->second; as->sag->SetInput(_img); as->axial->SetInput(_img); as->cor->SetInput(_img); } } // Find the local pos based on world pos DTIVoxel lPos = DTIVoxel(3); WorldToLocal(_vol->getTransformMatrix(), _vPos, dim, lPos); sagExtent[0] = lPos[0]; sagExtent[1] = lPos[0]; sagExtent[2] = 0; sagExtent[3] = dim[1]-1; sagExtent[4] = 0; sagExtent[5] = dim[2] - 1; axialExtent[0] = 0; axialExtent[1] = dim[0] - 1; axialExtent[2] = 0; axialExtent[3] = dim[1]-1; axialExtent[4] = lPos[2]; axialExtent[5] = lPos[2]; corExtent[0] = 0; corExtent[1] = dim[0]-1; corExtent[2] = lPos[1]; corExtent[3] = lPos[1]; corExtent[4] = 0; corExtent[5] = dim[2] - 1; // set the extent to which the image should be mapped // Apply user matrix to each registered actor for(std::map<vtkRenderWindow*, ActorSet*>::iterator it = this->windowToActorSet.begin(); it != this->windowToActorSet.end(); it++) { ActorSet *as = it->second; as->sag->SetDisplayExtent(sagExtent); as->axial->SetDisplayExtent(axialExtent); as->cor->SetDisplayExtent(corExtent); as->sag->Modified(); as->cor->Modified(); as->axial->Modified(); // set the position in the as->text text actor as->text->GetTextProperty()->SetFontSize(16); as->text->GetTextProperty()->SetFontFamilyToArial(); as->text->GetTextProperty()->SetJustificationToLeft(); as->text->GetPositionCoordinate()->SetValue(2,0); //as->text->GetTextProperty()->BoldOn(); //as->text->GetTextProperty()->ItalicOn(); as->text->GetTextProperty()->SetColor(0,0,0); as->text->Modified(); } }