From newcfd at yahoo.com Sat Dec 1 09:27:31 2018 From: newcfd at yahoo.com (newcfd) Date: Sat, 1 Dec 2018 07:27:31 -0700 (MST) Subject: [vtkusers] isosurface update issue In-Reply-To: References: <1543554725951-0.post@n5.nabble.com> Message-ID: <1543674451900-0.post@n5.nabble.com> Thanks for your reply. mapSphere was a typing error and should be mapper. I made the following changes and still have the same problem. void MyApp::redraw( const double value ) { if ( m_pActor == nullptr ) { m_pActor = vtkActor::New(); vtkSmartPointer mapper = vtkSmartPointer::New(); mapper->SetScalarRange(0.0, 1.0); m_pActor->SetMapper( mapper ); renderer->AddActor( m_pActor ); renderer->SetBackground(1,1,1); // Background color white } vtkStructuredGrid * mesh =... vtkSmartPointer filter = vtkSmartPointer::New(); filter->SetInputData( mesh ); filter->SetNumberOfContours( 1 ); filter->Setvalue( 0, value ); // value is passed in m_pActor->GetMapper()->SetInputConnection( filter->GetOutputPort() ); renderWindow->Render(); } It may not be a good idea to delete the actor and make a new one in every call. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From elvis.stansvik at orexplore.com Sat Dec 1 09:27:49 2018 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Sat, 1 Dec 2018 15:27:49 +0100 Subject: [vtkusers] Freeing actor memory In-Reply-To: <1543601528571.35049@auckland.ac.nz> References: <1543601528571.35049@auckland.ac.nz> Message-ID: Den fre 30 nov. 2018 kl 19:12 skrev Gib Bogle : > > I am sequentially rendering a scene composed of an increasing number of actors, each of which is a clipped and capped cone (to be precise, each member of the scene is made up of two actors ? the clipped cone and the cap). I am not sure about the right way to remove the actors and free the associated memory when the time comes. The list of things created with New() for each composite actor is quite long (the code is based on the CapClip example.): > > > > coneSource = vtkSmartPointer::New(); > > plane = vtkSmartPointer::New(); > > clipMapper = vtkSmartPointer::New(); > > clipActor = vtkSmartPointer::New(); > > boundaryEdges = vtkSmartPointer::New(); > > boundaryStrips = vtkSmartPointer::New(); > > boundaryPoly = vtkSmartPointer::New(); > > boundaryMapper = vtkSmartPointer::New(); > > boundaryActor = vtkSmartPointer::New(); > > > > My proposed approach is to use a struct to hold all the vtkSmartPointers, creating a new ACTOR_STRUCT (stored in an array or list) every time a composite actor is created: > > > > struct actor_struct { > > vtkSmartPointer coneSource; > > vtkSmartPointer plane; > > vtkSmartPointer clipper; > > vtkSmartPointer clipMapper; > > vtkSmartPointer clipActor; > > vtkSmartPointer boundaryEdges; > > vtkSmartPointer boundaryStrips; > > vtkSmartPointer boundaryPoly; > > vtkSmartPointer boundaryMapper; > > vtkSmartPointer boundaryActor; > > }; > > typedef actor_struct ACTOR_STRUCT; > > > > The motivation is to be able to locate all the allocated objects when memory needs to be freed, but I suspect it is neither the conventional nor the best way. I have two questions: I don't know about conventional, but that's how we do it too. In various places, we have structs or classes that hold smart pointers to the VTK objects we need to keep alive. > > > > What is the usual way to handle this situation? > > If my proposed method is OK, how should all the actor memory be freed? The objects will be freed when the smart pointer to them is destroyed (provided no other user has increased the RefCount of the objects). HTH, Elvis > > > > I?d be grateful if somebody with a better understanding of VTK and C++ could advise me. > > > > Thanks > > Gib > > > > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers From g.bogle at auckland.ac.nz Sat Dec 1 09:48:42 2018 From: g.bogle at auckland.ac.nz (Gib Bogle) Date: Sat, 1 Dec 2018 14:48:42 +0000 Subject: [vtkusers] [FORGED] Re: Freeing actor memory In-Reply-To: References: <1543601528571.35049@auckland.ac.nz>, Message-ID: <1543675715532.49517@auckland.ac.nz> Thanks Elvis. Good to know that this is a valid approach. What about the order of destroying the smart pointers. Should that be the reverse of the order in which they are created? Cheers, Gib ________________________________________ From: Elvis Stansvik Sent: Sunday, 2 December 2018 3:27 a.m. To: Gib Bogle Cc: VTK Users Subject: [FORGED] Re: [vtkusers] Freeing actor memory Den fre 30 nov. 2018 kl 19:12 skrev Gib Bogle : > > I am sequentially rendering a scene composed of an increasing number of actors, each of which is a clipped and capped cone (to be precise, each member of the scene is made up of two actors ? the clipped cone and the cap). I am not sure about the right way to remove the actors and free the associated memory when the time comes. The list of things created with New() for each composite actor is quite long (the code is based on the CapClip example.): > > > > coneSource = vtkSmartPointer::New(); > > plane = vtkSmartPointer::New(); > > clipMapper = vtkSmartPointer::New(); > > clipActor = vtkSmartPointer::New(); > > boundaryEdges = vtkSmartPointer::New(); > > boundaryStrips = vtkSmartPointer::New(); > > boundaryPoly = vtkSmartPointer::New(); > > boundaryMapper = vtkSmartPointer::New(); > > boundaryActor = vtkSmartPointer::New(); > > > > My proposed approach is to use a struct to hold all the vtkSmartPointers, creating a new ACTOR_STRUCT (stored in an array or list) every time a composite actor is created: > > > > struct actor_struct { > > vtkSmartPointer coneSource; > > vtkSmartPointer plane; > > vtkSmartPointer clipper; > > vtkSmartPointer clipMapper; > > vtkSmartPointer clipActor; > > vtkSmartPointer boundaryEdges; > > vtkSmartPointer boundaryStrips; > > vtkSmartPointer boundaryPoly; > > vtkSmartPointer boundaryMapper; > > vtkSmartPointer boundaryActor; > > }; > > typedef actor_struct ACTOR_STRUCT; > > > > The motivation is to be able to locate all the allocated objects when memory needs to be freed, but I suspect it is neither the conventional nor the best way. I have two questions: I don't know about conventional, but that's how we do it too. In various places, we have structs or classes that hold smart pointers to the VTK objects we need to keep alive. > > > > What is the usual way to handle this situation? > > If my proposed method is OK, how should all the actor memory be freed? The objects will be freed when the smart pointer to them is destroyed (provided no other user has increased the RefCount of the objects). HTH, Elvis > > > > I?d be grateful if somebody with a better understanding of VTK and C++ could advise me. > > > > Thanks > > Gib > > > > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers From srbn.ghosh99 at gmail.com Sun Dec 2 04:06:34 2018 From: srbn.ghosh99 at gmail.com (Shrabani Ghosh) Date: Sun, 2 Dec 2018 02:06:34 -0700 (MST) Subject: [vtkusers] Delete Edge and create new edge link in vtkSmartPointer polydata Message-ID: <1543741594644-0.post@n5.nabble.com> For the purpose of mesh decimation I need to delete an edge and create a new edge for vtkSmartPointer polydata. Is there any function which can DeleteEdge and Create new edge? Thank You -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From paulo.r.m.carvalho at gmail.com Sun Dec 2 08:41:06 2018 From: paulo.r.m.carvalho at gmail.com (Paulo Carvalho) Date: Sun, 2 Dec 2018 11:41:06 -0200 Subject: [vtkusers] vtkParallelCoordinatesView with Qt In-Reply-To: References: Message-ID: Hi, Zoltan, Please, try the .cpp attached. I managed to get the graph showing within the main window and with the interactor working. The two reasons for the misbehavior were: 1) The code created a new renderer instead of using the view's. 2) The view and the Qt widget were using different render window objects. In conclusion, there were two renderers and two render windows in the program, causing the observed misbehavior. Let us know whether it works. [image: image.png] regards, Paulo Em qua, 28 de nov de 2018 ?s 09:28, Zoltan Kovacs < Zoltan.Kovacs at esi-group.com> escreveu: > Dear all, > > > > Based on the example > > https://www.vtk.org/Wiki/VTK/Examples/Cxx/InfoVis/ParallelCoordinatesView > > I created a simple Qt project using the class vtkParallelCoordinatesView. It has only a main window with a PushButton and a QWidget to launch a file > > opening dialog for any CSV file and view its content. I also created a Qt Form Class called "ParallelCoordinatesView" with the public function "View", which contains the CSV file reading and the parallel coordinates visualization code from the example. I attached the files. > > There are two issues with the functions setting up the render window and the interactor in the public function "View". > > > > These function calls are commented out in the code: > > > > // Set up render window > > view->GetRenderer()->SetBackground(1.0, 1.0, 1.0); > > view->GetRenderer()->GradientBackgroundOff(); > > view->GetRenderWindow()->SetSize(1200,600); > > //view->SetInteractor(renderWindowInteractor); > > //view->SetRenderWindow(renderWindow); > > view->ResetCamera(); > > view->Render(); > > //view->GetInteractor()->Start(); > > > > When I compile and run the code in this form, the parallel coordinates view appears in a window detached from the Qt MainWindow after the file test.csv has been read from the file opening dialog. > > > > If I remove the comments only from > > //view->SetInteractor(renderWindowInteractor); > > //view->SetRenderWindow(renderWindow); > > and compile and run the code then the view window appears in the QWidget in the MainWindow, as expected, > > but as soon as I start to move the cursor, everything blacks out in the Mainwindow. > > > > If remove the comment only from the line > > //view->GetInteractor()->Start(); > > the I can select lines in the parallel coodinates view vindow, as expected with starting the interactor, > > but the Mainwindow hangs. > > > > I would like to ask if there is a proper setup of the render window and the interactor for the class vtkParallelCoordinatesView with Qt? Thank you very much for your help. > > > > Kind regards, > > Zoltan > > > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: > http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image.png Type: image/png Size: 61769 bytes Desc: not available URL: -------------- next part -------------- #include "parallelcoordinatesview.h" #include "ui_parallelcoordinatesview.h" ParallelCoordinatesView::ParallelCoordinatesView(QVTKOpenGLWidget *OGLWidget, QWidget *widget, QWidget *parent) : QWidget(parent), ui(new Ui::ParallelCoordinatesView) { ui->setupUi(this); ui->setupUi(this); QHBoxLayout * layout = new QHBoxLayout(); layout->addWidget(OGLWidget); widget->setLayout(layout); renderWindow = vtkSmartPointer::New(); table = vtkSmartPointer::New(); reader = vtkSmartPointer::New(); polydata = vtkSmartPointer::New(); rep = vtkSmartPointer::New(); view = vtkSmartPointer::New(); //Do not create a new renderer, use the view's renderer. renderer = view->GetRenderer(); //Both the view and the Qt widget must share the same render window view->SetRenderWindow( renderWindow ); OGLWidget->SetRenderWindow( renderWindow ); renderWindowInteractor = renderWindow->GetInteractor(); renderWindowInteractor->SetRenderWindow(renderWindow); renderer->SetBackground(1.0, 1.0, 1.0); renderer->GradientBackgroundOff(); renderWindow->AddRenderer(renderer); } ParallelCoordinatesView::~ParallelCoordinatesView() { delete ui; } void ParallelCoordinatesView::View(QString fileName) { std::string title; std::string inputFilename = fileName.toStdString(); reader->SetFileName(inputFilename.c_str()); reader->SetHaveHeaders(1); reader->DetectNumericColumnsOn(); reader->SetFieldDelimiterCharacters(","); reader->Update(); table = reader->GetOutput(); title = vtksys::SystemTools::GetFilenameWithoutExtension( vtksys::SystemTools::GetFilenameName(inputFilename)); for (vtkIdType i = 0; i < table->GetNumberOfColumns(); ++i) polydata->GetPointData()->AddArray(table->GetColumn(i)); rep->SetInputData(polydata); for (vtkIdType i = 0; i < table->GetNumberOfColumns(); ++i) { if (vtkStringArray::SafeDownCast(table->GetColumn(i))) continue; else rep->SetInputArrayToProcess(i, 0, 0, 0, table->GetColumn(i)->GetName()); } rep->SetFontSize(.5); rep->SetPlotTitle(title.c_str()); rep->SetLineOpacity(0.5); rep->SetLineColor(0.7, 0.7, 0.7); rep->SetAxisColor(0.0, 0.0, 0.0); rep->SetAxisLabelColor(0.0, 0.0, 0.0); // Set up the Parallel Coordinates View and hook in the Representation view->SetRepresentation(rep); view->SetInspectMode(1); view->SetDisplayHoverText(1); // Brush Mode determines the type of interaction you perform to select data view->SetBrushModeToLasso(); view->SetBrushOperatorToReplace(); view->ResetCamera(); view->Render(); view->GetInteractor()->Start(); } From rastor.ragereaver at gmail.com Sun Dec 2 10:27:24 2018 From: rastor.ragereaver at gmail.com (=?UTF-8?Q?Rados=C5=82aw_Furmaniak?=) Date: Sun, 2 Dec 2018 16:27:24 +0100 Subject: [vtkusers] Color PolyData based on VolumeData Message-ID: Hi All, I am trying to prepare a PolyData object from a series od DCM images and color it using some transfer function. I managed to create PolyData using vtkContourFilter. I also have vtkVolume object with mapped colors, so I know that I have correct color transfer function and I am able to map intensities onto desired colors. What I am trying to do is achieve the same results colorwise with the PolyData from ContourFilter. However, I do not know how to tackle this problem. I have tried using ProbeFilter with PolyData as input and RGB ImageData as the source, but the output is the same as input. Any suggestions how to approach this problem or if I am going the right way? I am fairly new to the VTK, so I do not know many of its possibilites yet. I'm working on Python 3.6 with VTK 8.1.1. Any help is appreciated. -------------- next part -------------- An HTML attachment was scrubbed... URL: From Andx_roo at live.com Sun Dec 2 23:26:42 2018 From: Andx_roo at live.com (Andaharoo) Date: Sun, 2 Dec 2018 21:26:42 -0700 (MST) Subject: [vtkusers] Color PolyData based on VolumeData In-Reply-To: References: Message-ID: <1543811202678-0.post@n5.nabble.com> So, if I understand right, you want to color the scalar/whatever field onto the poly? Just provide vtkPolyData with scalars and set the polyData's mapper scalar visibility to on. If you give it 1 component scalars you can give the mapper a color function to map them. If you give it 3 component uchar it should just display them as color (as long as scalar visibility is on). Like so: // Create the scalars array vtkDoubleArray* scalars = vtkDoubleArray::New(); scalars->SetName("Scalars"); // For every point in the poly for (vtkIdType i = 0; i < outputPoly->GetNumberOfPoints(); i++) { double pt[3]; outputPoly->GetPoint(i, pt); scalars->InsertTuple1(i, trilinearSamplePoint(inputImage, pt[0], pt[1], pt[2], 1, 0)); } // Add the scalar data to the poly data outputPoly->GetPointData()->AddArray(scalars); outputPoly->GetPointData()->SetActiveScalars("Scalars"); This just goes through all the points in the polygon and gets the color from the image. Getting the color at a point in an image can be done by simply using the nearest color from the image (nearest neighbor) or better would be to use trilinear interpolation of the 8 nearest colors which I used in my example. Also note my code expects float image input: static const int calcIndex(int x, int y, int z, int width, int height) { return x + width * (y + height * z); } static float trilinearSamplePoint(vtkImageData* imageData, float x, float y, float z, int numComps, int comp) { float* imagePtr = static_cast(imageData->GetScalarPointer()); double* spacing = imageData->GetSpacing(); double* origin = imageData->GetOrigin(); int* dim = imageData->GetDimensions(); // We assume point x, y, z is in the image int xi = (x - origin[0]) / spacing[0]; int yi = (y - origin[1]) / spacing[1]; int zi = (z - origin[2]) / spacing[2]; // Get the intensities at the 8 nearest neighbors float i000 = imagePtr[calcIndex(xi, yi, zi, dim[0], dim[1]) * numComps + comp]; float i100 = imagePtr[calcIndex(xi + 1, yi, zi, dim[0], dim[1]) * numComps + comp]; float i110 = imagePtr[calcIndex(xi + 1, yi + 1, zi, dim[0], dim[1] * numComps + comp)]; float i010 = imagePtr[calcIndex(xi, yi + 1, zi, dim[0], dim[1]) * numComps + comp]; float i001 = imagePtr[calcIndex(xi, yi, zi + 1, dim[0], dim[1]) * numComps + comp]; float i101 = imagePtr[calcIndex(xi + 1, yi, zi + 1, dim[0], dim[1]) * numComps + comp]; float i111 = imagePtr[calcIndex(xi + 1, yi + 1, zi + 1, dim[0], dim[1]) * numComps + comp]; float i011 = imagePtr[calcIndex(xi, yi + 1, zi + 1, dim[0], dim[1]) * numComps + comp]; // Get the fractional/unit distance from nearest neighbor 000 float rx = xi * spacing[0] + origin[0]; // Position of node rx = (x - rx) / spacing[0]; // (Node - actual point position) / voxel width float ry = yi * spacing[1] + origin[1]; ry = (y - ry) / spacing[1]; float rz = zi * spacing[2] + origin[2]; rz = (z - rz) / spacing[2]; // Now we do the trilinear interpolation float ax = i000 + (i100 - i000) * rx; float bx = i010 + (i110 - i010) * rx; float cy = ax + (bx - ax) * ry; float dx = i001 + (i101 - i001) * rx; float ex = i011 + (i111 - i011) * rx; float fy = dx + (ex - dx) * ry; float gz = cy + (fy - cy) * rz; return gz; } -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From lasso at queensu.ca Mon Dec 3 01:50:06 2018 From: lasso at queensu.ca (Andras Lasso) Date: Mon, 3 Dec 2018 06:50:06 +0000 Subject: [vtkusers] Color PolyData based on VolumeData In-Reply-To: <1543811202678-0.post@n5.nabble.com> References: <1543811202678-0.post@n5.nabble.com> Message-ID: You can copy voxel values from a volume to a polydata using vtkProbeFilter. However, this won't help you if you obtained your polydata using a vtkContourFilter, because the contour filter generates isosurface, which means all extracted points have the same intensity value in the input volume. No matter what transfer function you apply, you'll always end up with a solid colored surface. It is a common desire to replace volume rendering by displaying a colored surface, but this is not feasible (https://discourse.slicer.org/t/save-volume-rendering-as-stl-file/524/20). If your goal is 3D printing then you may use voxel printing technique, which allows printing directly from volume rendering, without segmenting any surfaces (https://discourse.slicer.org/t/printing-volume-renderings-in-plastic/3017). If your goal is volume-rendering-like display (for example, you want to show "volume rendering" in Unity) then you need to use an actual volume renderer. Andras -----Original Message----- From: vtkusers On Behalf Of Andaharoo Sent: Sunday, December 2, 2018 11:27 PM To: vtkusers at vtk.org Subject: Re: [vtkusers] Color PolyData based on VolumeData So, if I understand right, you want to color the scalar/whatever field onto the poly? Just provide vtkPolyData with scalars and set the polyData's mapper scalar visibility to on. If you give it 1 component scalars you can give the mapper a color function to map them. If you give it 3 component uchar it should just display them as color (as long as scalar visibility is on). Like so: // Create the scalars array vtkDoubleArray* scalars = vtkDoubleArray::New(); scalars->SetName("Scalars"); // For every point in the poly for (vtkIdType i = 0; i < outputPoly->GetNumberOfPoints(); i++) { double pt[3]; outputPoly->GetPoint(i, pt); scalars->InsertTuple1(i, trilinearSamplePoint(inputImage, pt[0], pt[1], pt[2], 1, 0)); } // Add the scalar data to the poly data outputPoly->GetPointData()->AddArray(scalars); outputPoly->GetPointData()->SetActiveScalars("Scalars"); This just goes through all the points in the polygon and gets the color from the image. Getting the color at a point in an image can be done by simply using the nearest color from the image (nearest neighbor) or better would be to use trilinear interpolation of the 8 nearest colors which I used in my example. Also note my code expects float image input: static const int calcIndex(int x, int y, int z, int width, int height) { return x + width * (y + height * z); } static float trilinearSamplePoint(vtkImageData* imageData, float x, float y, float z, int numComps, int comp) { float* imagePtr = static_cast(imageData->GetScalarPointer()); double* spacing = imageData->GetSpacing(); double* origin = imageData->GetOrigin(); int* dim = imageData->GetDimensions(); // We assume point x, y, z is in the image int xi = (x - origin[0]) / spacing[0]; int yi = (y - origin[1]) / spacing[1]; int zi = (z - origin[2]) / spacing[2]; // Get the intensities at the 8 nearest neighbors float i000 = imagePtr[calcIndex(xi, yi, zi, dim[0], dim[1]) * numComps + comp]; float i100 = imagePtr[calcIndex(xi + 1, yi, zi, dim[0], dim[1]) * numComps + comp]; float i110 = imagePtr[calcIndex(xi + 1, yi + 1, zi, dim[0], dim[1] * numComps + comp)]; float i010 = imagePtr[calcIndex(xi, yi + 1, zi, dim[0], dim[1]) * numComps + comp]; float i001 = imagePtr[calcIndex(xi, yi, zi + 1, dim[0], dim[1]) * numComps + comp]; float i101 = imagePtr[calcIndex(xi + 1, yi, zi + 1, dim[0], dim[1]) * numComps + comp]; float i111 = imagePtr[calcIndex(xi + 1, yi + 1, zi + 1, dim[0], dim[1]) * numComps + comp]; float i011 = imagePtr[calcIndex(xi, yi + 1, zi + 1, dim[0], dim[1]) * numComps + comp]; // Get the fractional/unit distance from nearest neighbor 000 float rx = xi * spacing[0] + origin[0]; // Position of node rx = (x - rx) / spacing[0]; // (Node - actual point position) / voxel width float ry = yi * spacing[1] + origin[1]; ry = (y - ry) / spacing[1]; float rz = zi * spacing[2] + origin[2]; rz = (z - rz) / spacing[2]; // Now we do the trilinear interpolation float ax = i000 + (i100 - i000) * rx; float bx = i010 + (i110 - i010) * rx; float cy = ax + (bx - ax) * ry; float dx = i001 + (i101 - i001) * rx; float ex = i011 + (i111 - i011) * rx; float fy = dx + (ex - dx) * ry; float gz = cy + (fy - cy) * rz; return gz; } -- Sent from: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1045678.n5.nabble.com%2FVTK-Users-f1224199.html&data=02%7C01%7Classo%40queensu.ca%7C34224811bdf846b9c4a808d658d7898f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636794080091371821&sdata=iziee8ltwEAWna3RvM3dma7A3p94NWMHCfIwclRpR0I%3D&reserved=0 _______________________________________________ Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Classo%40queensu.ca%7C34224811bdf846b9c4a808d658d7898f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636794080091371821&sdata=6Nv%2FWdIIIaOq%2B3peZlXxuGdAwkOwzORn7AfWthXw5Xo%3D&reserved=0 Visit other Kitware open-source projects at https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7C34224811bdf846b9c4a808d658d7898f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636794080091381830&sdata=oEIpua2iKsLpUdJaY%2BmQdOhCHfusGYUZDRd3Ru67Qoo%3D&reserved=0 Please keep messages on-topic and check the VTK FAQ at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vtk.org%2FWiki%2FVTK_FAQ&data=02%7C01%7Classo%40queensu.ca%7C34224811bdf846b9c4a808d658d7898f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636794080091381830&sdata=7h18pSmCa3LapcNQJsqqxU7kyWVyaQzKbPYZPMCbDiw%3D&reserved=0 Search the list archives at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtkusers&data=02%7C01%7Classo%40queensu.ca%7C34224811bdf846b9c4a808d658d7898f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636794080091381830&sdata=luU4EgKZZ9nD1OOxN5EGfBpA5HnK%2FyuVoN6C7PE%2Bzhc%3D&reserved=0 Follow this link to subscribe/unsubscribe: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtkusers&data=02%7C01%7Classo%40queensu.ca%7C34224811bdf846b9c4a808d658d7898f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636794080091381830&sdata=URr5vqvvkUuWmwaPIIGXXJzsmW2LFrYs7Z7jDcvt4ek%3D&reserved=0 From polly_sukting at hotmail.com Mon Dec 3 09:11:24 2018 From: polly_sukting at hotmail.com (Polly Pui) Date: Mon, 3 Dec 2018 14:11:24 +0000 Subject: [vtkusers] Extract csv row and column into points In-Reply-To: References: , Message-ID: Thanks Cory, you are so helpful. I am trying to figure out how to skip the header of the csv file before calling for Kmeansclustering. I am getting there. If you have any idea on how to skip reading the header, please advice:) Thank you so much. Regards, Polly ________________________________ From: Cory Quammen Sent: Wednesday, November 28, 2018 12:53 AM To: Polly Pui Cc: vtkusers; David Thompson Subject: Re: [vtkusers] Extract csv row and column into points Polly, It seems I was mistaken about the output of the vtkKMeansStatistics filter. It looks like it does not pass through the input columns with something like a cluster label. I have no experience with the filter, so I'm not sure how to guide you from here. David Thompson (CC'ed) would know more since he was an author of the filter. He may be able to help if he has time. Some resources that may help: Doxygen page: https://www.vtk.org/doc/nightly/html/classvtkKMeansStatistics.html#details Example: https://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Examples/Statistics/ExampleKMeansStatistics.cxx Cory On Wed, Nov 21, 2018 at 1:16 AM Polly Pui > wrote: And also I tried to remove the lines in order to test if the columns are called successfully. I received the error stated "Failed to locate the columns to use for the point coordinates". These are the codes: std::string inputFilename = argv[1]; vtkSmartPointer reader = vtkSmartPointer::New(); reader->SetFileName(inputFilename.c_str()); reader->SetFieldDelimiterCharacters(","); reader->DetectNumericColumnsOn(); //reader->GetHaveHeaders(); reader->Update(); reader->GetOutput()->Dump(); ///////KmeansCluster vtkSmartPointer kMeansStatistics = vtkSmartPointer::New(); kMeansStatistics->SetInputConnection(reader->GetOutputPort()); kMeansStatistics->SetColumnStatus("X", 1); kMeansStatistics->SetColumnStatus("Y", 1); kMeansStatistics->SetColumnStatus("Z", 1); kMeansStatistics->RequestSelectedColumns(); kMeansStatistics->SetAssessOption(true); kMeansStatistics->SetDefaultNumberOfClusters(5); //kMeansStatistics->SetLearnOption(1);//to learn the cluster value kMeansStatistics->SetMaxNumIterations(15); kMeansStatistics->Update(); vtkSmartPointer t2pd = vtkSmartPointer::New(); t2pd->SetInputConnection(kMeansStatistics->GetOutputPort()); t2pd->SetXColumn("X"); t2pd->SetYColumn("Y"); t2pd->SetZColumn("Z"); vtkSmartPointer mapper = vtkSmartPointer::New(); mapper->SetInputConnection(t2pd->GetOutputPort()); vtkSmartPointer actor = vtkSmartPointer::New(); actor->SetMapper(mapper); actor->GetProperty()->SetPointSize(3); actor->GetProperty()->SetColor(1, 1, 1); vtkSmartPointer renderer = vtkSmartPointer::New(); vtkSmartPointer renderWindow = vtkSmartPointer::New(); renderWindow->AddRenderer(renderer); renderWindow->SetSize(640, 480); vtkSmartPointer renderWindowInteractor = vtkSmartPointer::New(); renderWindowInteractor->SetRenderWindow(renderWindow); renderer->AddActor(actor); renderer->SetBackground(0, 0, 0); // Background color black renderWindow->Render(); renderWindowInteractor->Start(); return EXIT_SUCCESS; } I supposed the column of interest to be called are "X", "Y" and "Z". Please advice. Thank you very much. Regards, Polly ________________________________ From: vtkusers > on behalf of Polly Pui > Sent: Wednesday, November 21, 2018 2:01 PM To: Cory Quammen Cc: vtkusers Subject: Re: [vtkusers] Extract csv row and column into points Hi Cory, Thanks for your reply. I followed your advice and changed the lines as you mentioned. But I still couldn't get the output successfully. I would like to clarify if I called the column of interest correctly. Please refer to the attachment. The columns that to be called as X,Y,Z coordinates are named as "X", "Y", "Z". When i run the exe file. It failed to load and couldn't get the correct cluster. This is the codes that I am using. .............. int main(int argc, char* argv[]) { std::string inputFilename = argv[1]; vtkSmartPointer reader = vtkSmartPointer::New(); reader->SetFileName(inputFilename.c_str()); reader->SetFieldDelimiterCharacters(","); reader->DetectNumericColumnsOn(); //reader->GetHaveHeaders(); reader->Update(); ///////KmeansCluster vtkSmartPointer kMeansStatistics = vtkSmartPointer::New(); kMeansStatistics->SetInputConnection(reader->GetOutputPort()); kMeansStatistics->SetColumnStatus("X", 1); kMeansStatistics->SetColumnStatus("Y", 1); kMeansStatistics->SetColumnStatus("Z", 1); kMeansStatistics->RequestSelectedColumns(); kMeansStatistics->SetAssessOption(true); kMeansStatistics->SetDefaultNumberOfClusters(5); //kMeansStatistics->SetLearnOption(1);//to learn the cluster value kMeansStatistics->SetMaxNumIterations(15); kMeansStatistics->Update(); //// Display the results in CMD (each row) kMeansStatistics->GetOutput()->Dump(); ////Group the points according to ID number vtkSmartPointer clusterArray = vtkSmartPointer::New(); clusterArray->SetNumberOfComponents(1); clusterArray->SetName("ClusterId"); for (int r = 0; r < kMeansStatistics->GetOutput()->GetNumberOfRows(); r++) { vtkVariant v = kMeansStatistics->GetOutput()->GetValue(r, kMeansStatistics->GetOutput()->GetNumberOfColumns() - 1); std::cout << "Point " << r << " is in cluster " << v.ToInt() << std::endl; clusterArray->InsertNextValue(v.ToInt()); } //// Create a lookup table to map cell data to colors vtkSmartPointer lut = vtkSmartPointer::New(); int tableSize = (kMeansStatistics + 1, 10); lut->SetNumberOfTableValues(tableSize); lut->Build(); ////ColorCells vtkSmartPointer colors = vtkSmartPointer::New(); lut->SetTableValue(0, colors->GetColor4d("Black").GetData()); lut->SetTableValue(1, colors->GetColor4d("Banana").GetData()); lut->SetTableValue(2, colors->GetColor4d("Tomato").GetData()); lut->SetTableValue(3, colors->GetColor4d("Peacock").GetData()); lut->SetTableValue(4, colors->GetColor4d("Lavender").GetData()); lut->SetTableValue(5, colors->GetColor4d("Flesh").GetData()); lut->SetTableValue(6, colors->GetColor4d("Raspberry").GetData()); lut->SetTableValue(7, colors->GetColor4d("Salmon").GetData()); lut->SetTableValue(8, colors->GetColor4d("Mint").GetData()); lut->SetTableValue(9, colors->GetColor4d("Wheat").GetData()); // Output the cluster centers vtkMultiBlockDataSet* outputMetaDS = vtkMultiBlockDataSet::SafeDownCast(kMeansStatistics->GetOutputDataObject(vtkStatisticsAlgorithm::OUTPUT_MODEL)); vtkTable* outputMeta = vtkTable::SafeDownCast(outputMetaDS->GetBlock(0)); vtkDoubleArray* coord0 = vtkDoubleArray::SafeDownCast(outputMeta->GetColumnByName("X")); vtkDoubleArray* coord1 = vtkDoubleArray::SafeDownCast(outputMeta->GetColumnByName("Y")); vtkDoubleArray* coord2 = vtkDoubleArray::SafeDownCast(outputMeta->GetColumnByName("Z")); for (unsigned int i = 0; i < coord0->GetNumberOfTuples(); ++i) { std::cout << coord0->GetValue(i) << " " << coord1->GetValue(i) << " " << coord2->GetValue(i) << std::endl; } vtkSmartPointer t2pd = vtkSmartPointer::New(); t2pd->SetInputConnection(kMeansStatistics->GetOutputPort()); t2pd->SetXColumn("X"); t2pd->SetYColumn("Y"); t2pd->SetZColumn("Z"); vtkSmartPointer mapper = vtkSmartPointer::New(); mapper->SetInputConnection(t2pd->GetOutputPort()); vtkSmartPointer actor = vtkSmartPointer::New(); actor->SetMapper(mapper); actor->GetProperty()->SetPointSize(3); actor->GetProperty()->SetColor(1, 1, 1); vtkSmartPointer renderer = vtkSmartPointer::New(); vtkSmartPointer renderWindow = vtkSmartPointer::New(); renderWindow->AddRenderer(renderer); renderWindow->SetSize(640, 480); vtkSmartPointer renderWindowInteractor = vtkSmartPointer::New(); renderWindowInteractor->SetRenderWindow(renderWindow); //renderer->AddActor(actor); renderer->SetBackground(0, 0, 0); // Background color black renderWindow->Render(); renderWindowInteractor->Start(); return EXIT_SUCCESS; } ......... Please advice. Thank you again! Regards, Polly ________________________________ From: Cory Quammen > Sent: Monday, November 19, 2018 10:52 PM To: Polly Pui Cc: vtkusers Subject: Re: [vtkusers] Extract csv row and column into points On Thu, Nov 15, 2018 at 1:26 AM Polly Pui > wrote: Hi Cory, Thanks for your reply. I edited my codes by following your advice. However, I am not able to visualize the point of cluster and got an error message. I have a few questions here. Is it possible to call VTK unstructured grid data into vtkKmeansStatistics? No, vtkKMeansStatistics requires a vtkTable input (it is a subclass of vtkTableAlgorithm). vtkTable is different from a vtkPolyData, which is what you are trying to create. See more inline comments further down. Actually what i wanted to do is very simple. I want to read my csv or vtk file and then cluster the points using kmeansclustering. Initially, I extracted points from csv file manually and I could get my desired output. But it is too time consuming. Currently, I want to input the csv or vtk file and get the cluster automatically and store in a datasheet. I attach my code as follows: #include #include "library.h" #include #include #include #include #include std::string inputFilename = argv[1]; vtkSmartPointer reader = vtkSmartPointer::New(); reader->SetFileName(inputFilename.c_str()); reader->SetFieldDelimiterCharacters(","); reader->DetectNumericColumnsOn(); reader->Update(); ///////KmeansCluster vtkSmartPointer kMeansStatistics = vtkSmartPointer::New(); kMeansStatistics->SetInputConnection(reader->GetOutputPort()); kMeansStatistics->SetColumnStatus("Column 3", 1); kMeansStatistics->SetColumnStatus("Column 4", 1); kMeansStatistics->SetColumnStatus("Column 5", 1); kMeansStatistics->RequestSelectedColumns(); kMeansStatistics->SetAssessOption(true); kMeansStatistics->SetDefaultNumberOfClusters(2); //kMeansStatistics->SetMaxNumIterations(15); kMeansStatistics->Update(); // Display the results in CMD (each row) kMeansStatistics->GetOutput()->Dump(); //Group the points according to ID number vtkSmartPointer clusterArray = vtkSmartPointer::New(); clusterArray->SetNumberOfComponents(1); clusterArray->SetName("ClusterId"); for (int r = 0; r < kMeansStatistics->GetOutput()->GetNumberOfRows(); r++) { vtkVariant v = kMeansStatistics->GetOutput()->GetValue(r, kMeansStatistics->GetOutput()->GetNumberOfColumns() - 1); std::cout << "Point " << r << " is in cluster " << v.ToInt() << std::endl; clusterArray->InsertNextValue(v.ToInt()); } // Create a lookup table to map cell data to colors vtkSmartPointer lut = vtkSmartPointer::New(); int tableSize = (kMeansStatistics + 1, 10); lut->SetNumberOfTableValues(tableSize); lut->Build(); //ColorCells vtkSmartPointer colors = vtkSmartPointer::New(); lut->SetTableValue(0, colors->GetColor4d("Black").GetData()); lut->SetTableValue(1, colors->GetColor4d("Banana").GetData()); lut->SetTableValue(2, colors->GetColor4d("Tomato").GetData()); lut->SetTableValue(3, colors->GetColor4d("Peacock").GetData()); lut->SetTableValue(4, colors->GetColor4d("Lavender").GetData()); lut->SetTableValue(5, colors->GetColor4d("Flesh").GetData()); lut->SetTableValue(6, colors->GetColor4d("Raspberry").GetData()); lut->SetTableValue(7, colors->GetColor4d("Salmon").GetData()); lut->SetTableValue(8, colors->GetColor4d("Mint").GetData()); lut->SetTableValue(9, colors->GetColor4d("Wheat").GetData()); // Output the cluster centers vtkMultiBlockDataSet* outputMetaDS = vtkMultiBlockDataSet::SafeDownCast(kMeansStatistics->GetOutputDataObject(vtkStatisticsAlgorithm::OUTPUT_MODEL)); vtkSmartPointer outputMeta = vtkTable::SafeDownCast(outputMetaDS->GetBlock(0)); //vtkSmartPointer outputMeta = vtkTable::SafeDownCast( outputMetaDS->GetBlock( 1 ) ); vtkDoubleArray* coord0 = vtkDoubleArray::SafeDownCast(outputMeta->GetColumnByName("Column 0")); vtkDoubleArray* coord1 = vtkDoubleArray::SafeDownCast(outputMeta->GetColumnByName("Column 1")); vtkDoubleArray* coord2 = vtkDoubleArray::SafeDownCast(outputMeta->GetColumnByName("Column 2")); for (unsigned int i = 0; i < coord0->GetNumberOfTuples(); ++i) { std::cout << coord0->GetValue(i) << " " << coord1->GetValue(i) << " " << coord2->GetValue(i) << std::endl; } vtkSmartPointer polydata = vtkSmartPointer::New(); polydata->GetPointData()->SetScalars(clusterArray); The below won't work. vtkKMeansStatistics produces a vtkTable, while the vtkPolyDataMapper requires a vtkPolyData. To convert a vtkTable to a vtkPolyData, which is the key piece you are missing, use vtkTableToPolyData. This class iterates over the rows, treats the columns you designate as X, Y, Z coordinates, and adds the remaining columns as point data arrays in the output vtkPolyData. It will look something like this: vtkSmartPointer t2pd = vtkSmartPointer::New(); t2pd->SetInputConnection(kMeansStatistics->GetOutputPort()); t2pd->SetXColumn("name of column to be used as x-coordinate"); t2pd->SetYColumn("name of column to be used as y-coordinate"); t2pd->SetZColumn("name of column to be used as z-coordinate"); Now, change, the code below from: vtkSmartPointer mapper = vtkSmartPointer::New(); mapper->SetInputConnection(kMeansStatistics->GetOutputPort()); to vtkSmartPointer mapper = vtkSmartPointer::New(); mapper->SetInputConnection(t2pd->GetOutputPort()); That should do it. Cory vtkSmartPointer actor = vtkSmartPointer::New(); actor->SetMapper(mapper); actor->GetProperty()->SetPointSize(3); actor->GetProperty()->SetColor(1, 0, 0); vtkSmartPointer renderer = vtkSmartPointer::New(); vtkSmartPointer renderWindow = vtkSmartPointer::New(); renderWindow->AddRenderer(renderer); renderWindow->SetSize(640, 480); vtkSmartPointer renderWindowInteractor = vtkSmartPointer::New(); renderWindowInteractor->SetRenderWindow(renderWindow); renderer->AddActor(actor); renderer->SetBackground(0, 0, 0); // Background color black renderWindow->Render(); renderWindowInteractor->Start(); return EXIT_SUCCESS; } Thank you so much. Regards, Polly ________________________________ From: Cory Quammen > Sent: Tuesday, November 13, 2018 11:34 PM To: Polly Pui Cc: vtkusers Subject: Re: [vtkusers] Extract csv row and column into points Ah, so you want to use the vtkKMeansStatistics filter. That filter operates on vtkTable data. To use it, you don't need to create points at all. Instead, you can connect the vtkDelimitedTextReader directly to the vtkKMeansStatistics filter like so: vtkSmartPointer kMeansStatistics = vtkSmartPointer::New(); kMeansStatistics->SetInputConnection(reader->GetOutputPort()); kMeansStatistics->SetColumnStatus("column1", 1); kMeansStatistics->SetColumnStatus("column2", 1); kMeansStatistics->SetColumnStatus("column3, 1); kMeansStatistics->RequestSelectedColumns(); kMeansStatistics->SetAssessOption(true); kMeansStatistics->SetDefaultNumberOfClusters(1); //kMeansStatistics->SetMaxNumIterations(15); kMeansStatistics->Update(); Here, I've altered your calls to SetColumnStatus() under the assumption you know the column names of interest. HTH, Cory On Fri, Nov 9, 2018 at 10:16 AM Polly Pui > wrote: Hi, Thanks for your reply. Is it possible to have more elaborations from you? How can I get the number of points from vtkTableToPolyData? I got an error saying that vtkTableToPolyData has no members of GetNumberOfPoints. I need those points to proceed to KmeansStatistics. This is my code: ...... std::string inputFilename = argv[1]; vtkSmartPointer reader = vtkSmartPointer::New(); reader->SetFileName(inputFilename.c_str()); reader->SetFieldDelimiterCharacters(" "); reader->DetectNumericColumnsOn(); reader->Update(); int numberOfRows = reader->GetOutput()->GetNumberOfRows(); vtkSmartPointer inputData = vtkSmartPointer::New(); inputData->SetInputConnection(reader->GetOutputPort); for (int c = 0; c < 3; ++c) { std::stringstream colName; colName << "coord " << c; vtkSmartPointer doubleArray = vtkSmartPointer::New(); doubleArray->SetNumberOfComponents(1); doubleArray->SetName(colName.str().c_str()); doubleArray->SetNumberOfTuples(inputData->GetNumberOfPoints()); for (int r = 0; r < inputData->GetNumberOfPoints(); ++r) { double p[3]; inputData->GetPoint(r, p); doubleArray->SetValue(r, p[c]); } inputData->AddColumn(doubleArray); } vtkSmartPointer kMeansStatistics = vtkSmartPointer::New(); #if VTK_MAJOR_VERSION <= 5 kMeansStatistics->SetInput(vtkStatisticsAlgorithm::INPUT_DATA, inputData); #else kMeansStatistics->SetInputData(vtkStatisticsAlgorithm::INPUT_DATA, inputData); #endif kMeansStatistics->SetColumnStatus(inputData->GetColumnName(0), 1); kMeansStatistics->SetColumnStatus(inputData->GetColumnName(1), 1); kMeansStatistics->SetColumnStatus(inputData->GetColumnName(2), 1); kMeansStatistics->RequestSelectedColumns(); kMeansStatistics->SetAssessOption(true); kMeansStatistics->SetDefaultNumberOfClusters(1); //kMeansStatistics->SetMaxNumIterations(15); kMeansStatistics->Update(); Thanks again. Regards, Polly ________________________________ From: Cory Quammen > Sent: Friday, November 9, 2018 10:07 PM To: Polly Pui Cc: vtkusers Subject: Re: [vtkusers] Extract csv row and column into points vtkDelimitedTextReader -> vtkTableToPolyData is a pipeline that should make this much simpler. On Fri, Nov 9, 2018 at 1:14 AM Polly Pui > wrote: Hi, Is there any clue that i can extract the row and column data from a csv file and read them as points? Currently I am using vtkpoints to read points by inserting points manually to my .cpp . Is it possible for me to call the csv directly and read the data (eg. column 3-5, row 2-10)? I attach my code here. ...... int main(int, char*[]) { vtkSmartPointer points = vtkSmartPointer::New(); points->InsertNextPoint(8.4312, -36.489, -1500.7); points->InsertNextPoint(8.8408, -37.726, -1500.4); points->InsertNextPoint(11.372, -37.787, -1501.5); points->InsertNextPoint(11.263, -36.384, -1501.9); points->InsertNextPoint(9.3914, -40.819, -1500.8); points->InsertNextPoint(11.685, -42.482, -1502.7); points->InsertNextPoint(14.235, -38.096, -1503.5); points->InsertNextPoint(13.972, -43.051, -1504.2); points->InsertNextPoint(9.22, -43.904, -1504); vtkSmartPointer inputData = vtkSmartPointer::New(); for (int c = 0; c < 3; ++c) { std::stringstream colName; colName << "coord " << c; vtkSmartPointer doubleArray = vtkSmartPointer::New(); doubleArray->SetNumberOfComponents(1); doubleArray->SetName(colName.str().c_str()); doubleArray->SetNumberOfTuples(points->GetNumberOfPoints()); for (int r = 0; r < points->GetNumberOfPoints(); ++r) { double p[3]; points->GetPoint(r, p); doubleArray->SetValue(r, p[c]); } inputData->AddColumn(doubleArray); } Thank you very much. Regards, Polly _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ Search the list archives at: http://markmail.org/search/?q=vtkusers Follow this link to subscribe/unsubscribe: https://public.kitware.com/mailman/listinfo/vtkusers -- Cory Quammen Staff R&D Engineer Kitware, Inc. -- Cory Quammen Staff R&D Engineer Kitware, Inc. -- Cory Quammen Staff R&D Engineer Kitware, Inc. -- Cory Quammen Staff R&D Engineer Kitware, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cory.quammen at kitware.com Mon Dec 3 09:18:01 2018 From: cory.quammen at kitware.com (Cory Quammen) Date: Mon, 3 Dec 2018 09:18:01 -0500 Subject: [vtkusers] Extract csv row and column into points In-Reply-To: References: Message-ID: Polly, To skip headers when reading the CSV file, call vtkDelimitedTextReader::SetHaveHeaders(true); The default behavior is to assume there is no header line. HTH, Cory On Mon, Dec 3, 2018 at 9:11 AM Polly Pui wrote: > > Thanks Cory, you are so helpful. I am trying to figure out how to skip the header of the csv file before calling for Kmeansclustering. > I am getting there. If you have any idea on how to skip reading the header, please advice:) > > Thank you so much. > > Regards, > Polly > ________________________________ > From: Cory Quammen > Sent: Wednesday, November 28, 2018 12:53 AM > To: Polly Pui > Cc: vtkusers; David Thompson > Subject: Re: [vtkusers] Extract csv row and column into points > > Polly, > > It seems I was mistaken about the output of the vtkKMeansStatistics filter. It looks like it does not pass through the input columns with something like a cluster label. I have no experience with the filter, so I'm not sure how to guide you from here. David Thompson (CC'ed) would know more since he was an author of the filter. He may be able to help if he has time. > > Some resources that may help: > > Doxygen page: > https://www.vtk.org/doc/nightly/html/classvtkKMeansStatistics.html#details > > Example: > https://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Examples/Statistics/ExampleKMeansStatistics.cxx > > Cory > > On Wed, Nov 21, 2018 at 1:16 AM Polly Pui wrote: > > And also I tried to remove the lines in order to test if the columns are called successfully. I received the error stated "Failed to locate the columns to use for the point coordinates". > > These are the codes: > std::string inputFilename = argv[1]; > > vtkSmartPointer reader = > vtkSmartPointer::New(); > reader->SetFileName(inputFilename.c_str()); > reader->SetFieldDelimiterCharacters(","); > reader->DetectNumericColumnsOn(); > //reader->GetHaveHeaders(); > reader->Update(); > > reader->GetOutput()->Dump(); > ///////KmeansCluster > > vtkSmartPointer kMeansStatistics = > vtkSmartPointer::New(); > kMeansStatistics->SetInputConnection(reader->GetOutputPort()); > kMeansStatistics->SetColumnStatus("X", 1); > kMeansStatistics->SetColumnStatus("Y", 1); > kMeansStatistics->SetColumnStatus("Z", 1); > kMeansStatistics->RequestSelectedColumns(); > kMeansStatistics->SetAssessOption(true); > kMeansStatistics->SetDefaultNumberOfClusters(5); > //kMeansStatistics->SetLearnOption(1);//to learn the cluster value > kMeansStatistics->SetMaxNumIterations(15); > kMeansStatistics->Update(); > > vtkSmartPointer t2pd = vtkSmartPointer::New(); > t2pd->SetInputConnection(kMeansStatistics->GetOutputPort()); > t2pd->SetXColumn("X"); > t2pd->SetYColumn("Y"); > t2pd->SetZColumn("Z"); > > vtkSmartPointer mapper = > vtkSmartPointer::New(); > mapper->SetInputConnection(t2pd->GetOutputPort()); > > vtkSmartPointer actor = > vtkSmartPointer::New(); > actor->SetMapper(mapper); > actor->GetProperty()->SetPointSize(3); > actor->GetProperty()->SetColor(1, 1, 1); > > vtkSmartPointer renderer = > vtkSmartPointer::New(); > vtkSmartPointer renderWindow = > vtkSmartPointer::New(); > renderWindow->AddRenderer(renderer); > renderWindow->SetSize(640, 480); > > vtkSmartPointer renderWindowInteractor = > vtkSmartPointer::New(); > renderWindowInteractor->SetRenderWindow(renderWindow); > > renderer->AddActor(actor); > renderer->SetBackground(0, 0, 0); // Background color black > > renderWindow->Render(); > renderWindowInteractor->Start(); > > return EXIT_SUCCESS; > } > > I supposed the column of interest to be called are "X", "Y" and "Z". > Please advice. > Thank you very much. > > Regards, > Polly > ________________________________ > From: vtkusers on behalf of Polly Pui > Sent: Wednesday, November 21, 2018 2:01 PM > To: Cory Quammen > Cc: vtkusers > Subject: Re: [vtkusers] Extract csv row and column into points > > Hi Cory, > Thanks for your reply. > I followed your advice and changed the lines as you mentioned. > But I still couldn't get the output successfully. > > I would like to clarify if I called the column of interest correctly. > Please refer to the attachment. The columns that to be called as X,Y,Z coordinates are named as "X", "Y", "Z". > When i run the exe file. It failed to load and couldn't get the correct cluster. > > This is the codes that I am using. > .............. > int main(int argc, char* argv[]) > { > std::string inputFilename = argv[1]; > > vtkSmartPointer reader = > vtkSmartPointer::New(); > reader->SetFileName(inputFilename.c_str()); > reader->SetFieldDelimiterCharacters(","); > reader->DetectNumericColumnsOn(); > //reader->GetHaveHeaders(); > reader->Update(); > > ///////KmeansCluster > > vtkSmartPointer kMeansStatistics = > vtkSmartPointer::New(); > kMeansStatistics->SetInputConnection(reader->GetOutputPort()); > kMeansStatistics->SetColumnStatus("X", 1); > kMeansStatistics->SetColumnStatus("Y", 1); > kMeansStatistics->SetColumnStatus("Z", 1); > kMeansStatistics->RequestSelectedColumns(); > kMeansStatistics->SetAssessOption(true); > kMeansStatistics->SetDefaultNumberOfClusters(5); > //kMeansStatistics->SetLearnOption(1);//to learn the cluster value > kMeansStatistics->SetMaxNumIterations(15); > kMeansStatistics->Update(); > > //// Display the results in CMD (each row) > kMeansStatistics->GetOutput()->Dump(); > > ////Group the points according to ID number > vtkSmartPointer clusterArray = > vtkSmartPointer::New(); > clusterArray->SetNumberOfComponents(1); > clusterArray->SetName("ClusterId"); > > for (int r = 0; r < kMeansStatistics->GetOutput()->GetNumberOfRows(); r++) > { > vtkVariant v = kMeansStatistics->GetOutput()->GetValue(r, kMeansStatistics->GetOutput()->GetNumberOfColumns() - 1); > std::cout << "Point " << r << " is in cluster " << v.ToInt() << std::endl; > clusterArray->InsertNextValue(v.ToInt()); > } > > //// Create a lookup table to map cell data to colors > vtkSmartPointer lut = > vtkSmartPointer::New(); > int tableSize = (kMeansStatistics + 1, 10); > lut->SetNumberOfTableValues(tableSize); > lut->Build(); > > ////ColorCells > vtkSmartPointer colors = > vtkSmartPointer::New(); > lut->SetTableValue(0, colors->GetColor4d("Black").GetData()); > lut->SetTableValue(1, colors->GetColor4d("Banana").GetData()); > lut->SetTableValue(2, colors->GetColor4d("Tomato").GetData()); > lut->SetTableValue(3, colors->GetColor4d("Peacock").GetData()); > lut->SetTableValue(4, colors->GetColor4d("Lavender").GetData()); > lut->SetTableValue(5, colors->GetColor4d("Flesh").GetData()); > lut->SetTableValue(6, colors->GetColor4d("Raspberry").GetData()); > lut->SetTableValue(7, colors->GetColor4d("Salmon").GetData()); > lut->SetTableValue(8, colors->GetColor4d("Mint").GetData()); > lut->SetTableValue(9, colors->GetColor4d("Wheat").GetData()); > > // Output the cluster centers > > vtkMultiBlockDataSet* outputMetaDS = vtkMultiBlockDataSet::SafeDownCast(kMeansStatistics->GetOutputDataObject(vtkStatisticsAlgorithm::OUTPUT_MODEL)); > vtkTable* outputMeta = vtkTable::SafeDownCast(outputMetaDS->GetBlock(0)); > > vtkDoubleArray* coord0 = vtkDoubleArray::SafeDownCast(outputMeta->GetColumnByName("X")); > vtkDoubleArray* coord1 = vtkDoubleArray::SafeDownCast(outputMeta->GetColumnByName("Y")); > vtkDoubleArray* coord2 = vtkDoubleArray::SafeDownCast(outputMeta->GetColumnByName("Z")); > > for (unsigned int i = 0; i < coord0->GetNumberOfTuples(); ++i) > { > std::cout << coord0->GetValue(i) << " " << coord1->GetValue(i) << " " << coord2->GetValue(i) << std::endl; > } > > vtkSmartPointer t2pd = vtkSmartPointer::New(); > t2pd->SetInputConnection(kMeansStatistics->GetOutputPort()); > t2pd->SetXColumn("X"); > t2pd->SetYColumn("Y"); > t2pd->SetZColumn("Z"); > > vtkSmartPointer mapper = > vtkSmartPointer::New(); > mapper->SetInputConnection(t2pd->GetOutputPort()); > > vtkSmartPointer actor = > vtkSmartPointer::New(); > actor->SetMapper(mapper); > actor->GetProperty()->SetPointSize(3); > actor->GetProperty()->SetColor(1, 1, 1); > > vtkSmartPointer renderer = > vtkSmartPointer::New(); > vtkSmartPointer renderWindow = > vtkSmartPointer::New(); > renderWindow->AddRenderer(renderer); > renderWindow->SetSize(640, 480); > > vtkSmartPointer renderWindowInteractor = > vtkSmartPointer::New(); > renderWindowInteractor->SetRenderWindow(renderWindow); > > //renderer->AddActor(actor); > renderer->SetBackground(0, 0, 0); // Background color black > > renderWindow->Render(); > renderWindowInteractor->Start(); > > return EXIT_SUCCESS; > } > ......... > Please advice. Thank you again! > > Regards, > Polly > > ________________________________ > From: Cory Quammen > Sent: Monday, November 19, 2018 10:52 PM > To: Polly Pui > Cc: vtkusers > Subject: Re: [vtkusers] Extract csv row and column into points > > > > On Thu, Nov 15, 2018 at 1:26 AM Polly Pui wrote: > > Hi Cory, > Thanks for your reply. > I edited my codes by following your advice. However, I am not able to visualize the point of cluster and got an error message. > > I have a few questions here. > Is it possible to call VTK unstructured grid data into vtkKmeansStatistics? > > > No, vtkKMeansStatistics requires a vtkTable input (it is a subclass of vtkTableAlgorithm). vtkTable is different from a vtkPolyData, which is what you are trying to create. See more inline comments further down. > > > Actually what i wanted to do is very simple. > I want to read my csv or vtk file and then cluster the points using kmeansclustering. > Initially, I extracted points from csv file manually and I could get my desired output. But it is too time consuming. > Currently, I want to input the csv or vtk file and get the cluster automatically and store in a datasheet. > I attach my code as follows: > > #include > #include "library.h" > > #include > #include > #include > #include > #include > > > std::string inputFilename = argv[1]; > > vtkSmartPointer reader = > vtkSmartPointer::New(); > reader->SetFileName(inputFilename.c_str()); > reader->SetFieldDelimiterCharacters(","); > reader->DetectNumericColumnsOn(); > reader->Update(); > > ///////KmeansCluster > > vtkSmartPointer kMeansStatistics = > vtkSmartPointer::New(); > kMeansStatistics->SetInputConnection(reader->GetOutputPort()); > kMeansStatistics->SetColumnStatus("Column 3", 1); > kMeansStatistics->SetColumnStatus("Column 4", 1); > kMeansStatistics->SetColumnStatus("Column 5", 1); > kMeansStatistics->RequestSelectedColumns(); > kMeansStatistics->SetAssessOption(true); > kMeansStatistics->SetDefaultNumberOfClusters(2); > //kMeansStatistics->SetMaxNumIterations(15); > kMeansStatistics->Update(); > > // Display the results in CMD (each row) > kMeansStatistics->GetOutput()->Dump(); > > > > > //Group the points according to ID number > vtkSmartPointer clusterArray = > vtkSmartPointer::New(); > clusterArray->SetNumberOfComponents(1); > clusterArray->SetName("ClusterId"); > > for (int r = 0; r < kMeansStatistics->GetOutput()->GetNumberOfRows(); r++) > { > vtkVariant v = kMeansStatistics->GetOutput()->GetValue(r, kMeansStatistics->GetOutput()->GetNumberOfColumns() - 1); > std::cout << "Point " << r << " is in cluster " << v.ToInt() << std::endl; > clusterArray->InsertNextValue(v.ToInt()); > } > > // Create a lookup table to map cell data to colors > vtkSmartPointer lut = > vtkSmartPointer::New(); > int tableSize = (kMeansStatistics + 1, 10); > lut->SetNumberOfTableValues(tableSize); > lut->Build(); > > //ColorCells > vtkSmartPointer colors = > vtkSmartPointer::New(); > lut->SetTableValue(0, colors->GetColor4d("Black").GetData()); > lut->SetTableValue(1, colors->GetColor4d("Banana").GetData()); > lut->SetTableValue(2, colors->GetColor4d("Tomato").GetData()); > lut->SetTableValue(3, colors->GetColor4d("Peacock").GetData()); > lut->SetTableValue(4, colors->GetColor4d("Lavender").GetData()); > lut->SetTableValue(5, colors->GetColor4d("Flesh").GetData()); > lut->SetTableValue(6, colors->GetColor4d("Raspberry").GetData()); > lut->SetTableValue(7, colors->GetColor4d("Salmon").GetData()); > lut->SetTableValue(8, colors->GetColor4d("Mint").GetData()); > lut->SetTableValue(9, colors->GetColor4d("Wheat").GetData()); > > // Output the cluster centers > > vtkMultiBlockDataSet* outputMetaDS = vtkMultiBlockDataSet::SafeDownCast(kMeansStatistics->GetOutputDataObject(vtkStatisticsAlgorithm::OUTPUT_MODEL)); > vtkSmartPointer outputMeta = vtkTable::SafeDownCast(outputMetaDS->GetBlock(0)); > //vtkSmartPointer outputMeta = vtkTable::SafeDownCast( outputMetaDS->GetBlock( 1 ) ); > vtkDoubleArray* coord0 = vtkDoubleArray::SafeDownCast(outputMeta->GetColumnByName("Column 0")); > vtkDoubleArray* coord1 = vtkDoubleArray::SafeDownCast(outputMeta->GetColumnByName("Column 1")); > vtkDoubleArray* coord2 = vtkDoubleArray::SafeDownCast(outputMeta->GetColumnByName("Column 2")); > > for (unsigned int i = 0; i < coord0->GetNumberOfTuples(); ++i) > { > std::cout << coord0->GetValue(i) << " " << coord1->GetValue(i) << " " << coord2->GetValue(i) << std::endl; > > } > > vtkSmartPointer polydata = > vtkSmartPointer::New(); > polydata->GetPointData()->SetScalars(clusterArray); > > > The below won't work. vtkKMeansStatistics produces a vtkTable, while the vtkPolyDataMapper requires a vtkPolyData. To convert a vtkTable to a vtkPolyData, which is the key piece you are missing, use vtkTableToPolyData. This class iterates over the rows, treats the columns you designate as X, Y, Z coordinates, and adds the remaining columns as point data arrays in the output vtkPolyData. > > It will look something like this: > > vtkSmartPointer t2pd = vtkSmartPointer::New(); > t2pd->SetInputConnection(kMeansStatistics->GetOutputPort()); > t2pd->SetXColumn("name of column to be used as x-coordinate"); > t2pd->SetYColumn("name of column to be used as y-coordinate"); > t2pd->SetZColumn("name of column to be used as z-coordinate"); > > Now, change, the code below from: > > > vtkSmartPointer mapper = > vtkSmartPointer::New(); > mapper->SetInputConnection(kMeansStatistics->GetOutputPort()); > > > to > > vtkSmartPointer mapper = > vtkSmartPointer::New(); > mapper->SetInputConnection(t2pd->GetOutputPort()); > > That should do it. > > Cory > > > vtkSmartPointer actor = > vtkSmartPointer::New(); > actor->SetMapper(mapper); > actor->GetProperty()->SetPointSize(3); > actor->GetProperty()->SetColor(1, 0, 0); > > vtkSmartPointer renderer = > vtkSmartPointer::New(); > vtkSmartPointer renderWindow = > vtkSmartPointer::New(); > renderWindow->AddRenderer(renderer); > renderWindow->SetSize(640, 480); > > vtkSmartPointer renderWindowInteractor = > vtkSmartPointer::New(); > renderWindowInteractor->SetRenderWindow(renderWindow); > > renderer->AddActor(actor); > renderer->SetBackground(0, 0, 0); // Background color black > > renderWindow->Render(); > renderWindowInteractor->Start(); > > return EXIT_SUCCESS; > } > > > Thank you so much. > > Regards, > Polly > ________________________________ > From: Cory Quammen > Sent: Tuesday, November 13, 2018 11:34 PM > To: Polly Pui > Cc: vtkusers > Subject: Re: [vtkusers] Extract csv row and column into points > > Ah, so you want to use the vtkKMeansStatistics filter. That filter operates on vtkTable data. To use it, you don't need to create points at all. Instead, you can connect the vtkDelimitedTextReader directly to the vtkKMeansStatistics filter like so: > > vtkSmartPointer kMeansStatistics = > vtkSmartPointer::New(); > kMeansStatistics->SetInputConnection(reader->GetOutputPort()); > kMeansStatistics->SetColumnStatus("column1", 1); > kMeansStatistics->SetColumnStatus("column2", 1); > kMeansStatistics->SetColumnStatus("column3, 1); > kMeansStatistics->RequestSelectedColumns(); > kMeansStatistics->SetAssessOption(true); > kMeansStatistics->SetDefaultNumberOfClusters(1); > //kMeansStatistics->SetMaxNumIterations(15); > kMeansStatistics->Update(); > > Here, I've altered your calls to SetColumnStatus() under the assumption you know the column names of interest. > > HTH, > Cory > > > On Fri, Nov 9, 2018 at 10:16 AM Polly Pui wrote: > > Hi, > Thanks for your reply. > Is it possible to have more elaborations from you? > > How can I get the number of points from vtkTableToPolyData? > I got an error saying that vtkTableToPolyData has no members of GetNumberOfPoints. > I need those points to proceed to KmeansStatistics. > > This is my code: > ...... > std::string inputFilename = argv[1]; > > vtkSmartPointer reader = > vtkSmartPointer::New(); > reader->SetFileName(inputFilename.c_str()); > reader->SetFieldDelimiterCharacters(" "); > reader->DetectNumericColumnsOn(); > reader->Update(); > int numberOfRows = reader->GetOutput()->GetNumberOfRows(); > > vtkSmartPointer inputData = > vtkSmartPointer::New(); > inputData->SetInputConnection(reader->GetOutputPort); > > for (int c = 0; c < 3; ++c) > { > std::stringstream colName; > colName << "coord " << c; > vtkSmartPointer doubleArray = > vtkSmartPointer::New(); > doubleArray->SetNumberOfComponents(1); > doubleArray->SetName(colName.str().c_str()); > doubleArray->SetNumberOfTuples(inputData->GetNumberOfPoints()); > > > for (int r = 0; r < inputData->GetNumberOfPoints(); ++r) > { > double p[3]; > inputData->GetPoint(r, p); > doubleArray->SetValue(r, p[c]); > } > inputData->AddColumn(doubleArray); > } > > vtkSmartPointer kMeansStatistics = > vtkSmartPointer::New(); > > #if VTK_MAJOR_VERSION <= 5 > kMeansStatistics->SetInput(vtkStatisticsAlgorithm::INPUT_DATA, inputData); > #else > kMeansStatistics->SetInputData(vtkStatisticsAlgorithm::INPUT_DATA, inputData); > #endif > kMeansStatistics->SetColumnStatus(inputData->GetColumnName(0), 1); > kMeansStatistics->SetColumnStatus(inputData->GetColumnName(1), 1); > kMeansStatistics->SetColumnStatus(inputData->GetColumnName(2), 1); > kMeansStatistics->RequestSelectedColumns(); > kMeansStatistics->SetAssessOption(true); > kMeansStatistics->SetDefaultNumberOfClusters(1); > //kMeansStatistics->SetMaxNumIterations(15); > kMeansStatistics->Update(); > > Thanks again. > > Regards, > Polly > ________________________________ > From: Cory Quammen > Sent: Friday, November 9, 2018 10:07 PM > To: Polly Pui > Cc: vtkusers > Subject: Re: [vtkusers] Extract csv row and column into points > > vtkDelimitedTextReader -> vtkTableToPolyData is a pipeline that should make this much simpler. > > On Fri, Nov 9, 2018 at 1:14 AM Polly Pui wrote: > > Hi, > Is there any clue that i can extract the row and column data from a csv file and read them as points? > Currently I am using vtkpoints to read points by inserting points manually to my .cpp . > Is it possible for me to call the csv directly and read the data (eg. column 3-5, row 2-10)? > > I attach my code here. > ...... > int main(int, char*[]) > { > > vtkSmartPointer points = > vtkSmartPointer::New(); > points->InsertNextPoint(8.4312, -36.489, -1500.7); > points->InsertNextPoint(8.8408, -37.726, -1500.4); > points->InsertNextPoint(11.372, -37.787, -1501.5); > points->InsertNextPoint(11.263, -36.384, -1501.9); > points->InsertNextPoint(9.3914, -40.819, -1500.8); > points->InsertNextPoint(11.685, -42.482, -1502.7); > points->InsertNextPoint(14.235, -38.096, -1503.5); > points->InsertNextPoint(13.972, -43.051, -1504.2); > points->InsertNextPoint(9.22, -43.904, -1504); > > vtkSmartPointer inputData = > vtkSmartPointer::New(); > for (int c = 0; c < 3; ++c) > { > std::stringstream colName; > colName << "coord " << c; > vtkSmartPointer doubleArray = > vtkSmartPointer::New(); > doubleArray->SetNumberOfComponents(1); > doubleArray->SetName(colName.str().c_str()); > doubleArray->SetNumberOfTuples(points->GetNumberOfPoints()); > > for (int r = 0; r < points->GetNumberOfPoints(); ++r) > { > double p[3]; > points->GetPoint(r, p); > doubleArray->SetValue(r, p[c]); > } > inputData->AddColumn(doubleArray); > } > > Thank you very much. > > Regards, > Polly > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers > > > > -- > Cory Quammen > Staff R&D Engineer > Kitware, Inc. > > > > -- > Cory Quammen > Staff R&D Engineer > Kitware, Inc. > > > > -- > Cory Quammen > Staff R&D Engineer > Kitware, Inc. > > > > -- > Cory Quammen > Staff R&D Engineer > Kitware, Inc. -- Cory Quammen Staff R&D Engineer Kitware, Inc. From dave.demarle at kitware.com Mon Dec 3 10:02:37 2018 From: dave.demarle at kitware.com (David E DeMarle) Date: Mon, 3 Dec 2018 10:02:37 -0500 Subject: [vtkusers] isosurface update issue In-Reply-To: <1543674451900-0.post@n5.nabble.com> References: <1543554725951-0.post@n5.nabble.com> <1543674451900-0.post@n5.nabble.com> Message-ID: > > It may not be a good idea to delete the actor and make a new one in every > call. It can work, but in addition to deleting the old actor, you have to call renderer->RemoveActor(oldactor); Otherwise the renderer's reference keeps the original actor alive. David E DeMarle Kitware, Inc. Principal Engineer 21 Corporate Drive Clifton Park, NY 12065-8662 Phone: 518-881-4909 On Sat, Dec 1, 2018 at 9:27 AM newcfd via vtkusers < vtkusers at public.kitware.com> wrote: > Thanks for your reply. mapSphere was a typing error and should be mapper. > I made the following changes and still have the same problem. > > void MyApp::redraw( const double value ) > { > if ( m_pActor == nullptr ) > { > m_pActor = vtkActor::New(); > vtkSmartPointer mapper = > vtkSmartPointer::New(); > mapper->SetScalarRange(0.0, 1.0); > m_pActor->SetMapper( mapper ); > > renderer->AddActor( m_pActor ); > renderer->SetBackground(1,1,1); // Background color white > } > > vtkStructuredGrid * mesh =... > > vtkSmartPointer filter = > vtkSmartPointer::New(); > filter->SetInputData( mesh ); > filter->SetNumberOfContours( 1 ); > filter->Setvalue( 0, value ); // value is passed in > > m_pActor->GetMapper()->SetInputConnection( filter->GetOutputPort() ); > renderWindow->Render(); > } > > It may not be a good idea to delete the actor and make a new one in every > call. > > > > -- > Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: > http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivandiegorodriguez at gmail.com Mon Dec 3 10:46:46 2018 From: ivandiegorodriguez at gmail.com (ivan rodriguez) Date: Mon, 3 Dec 2018 16:46:46 +0100 Subject: [vtkusers] key press event in vtkWeb Message-ID: Hello, I'm using the module vtkWeb for Remote Rendering, following this simple python example: *https://github.com/dmreagan/vtk-remote-render/blob/master/server/vtk_server.py * and I have modified it in order to include a keyPress event. The code works but the key event is not working . Please find my code below (the only modification from the link is the class MyInteractorStyle ). I'll really appreciate any help with this! Thanks !! ########################################################################## ########################################################################## # import to process args import sys import os # import vtk modules. import vtk from vtk.web import protocols from vtk.web import wslink as vtk_wslink from wslink import server try: import argparse except ImportError: # since Python 2.6 and earlier don't have argparse, we simply provide # the source for the same as _argparse and we use it instead. from vtk.util import _argparse as argparse # ============================================================================= # Create custom ServerProtocol class to handle clients requests # ============================================================================= class MyInteractorStyle(vtk.vtkInteractorStyleTrackballCamera): def __init__(self,renderer, cone): self.parent = renderer.GetInteractor() self.resolution=5 self.cone = cone self.AddObserver("KeyPressEvent",self.keyPressEvent) def keyPressEvent(self,obj,event): key = self.parent.GetKeySym() if key == 'l': print(key) self.cone.SetResolution(self.resolution) self.resolution+=1 return class _WebCone(vtk_wslink.ServerProtocol): # Application configuration view = None authKey = "wslink-secret" def initialize(self): global renderer, renderWindow, renderWindowInteractor, cone, mapper, actor # Bring used components self.registerVtkWebProtocol(protocols.vtkWebMouseHandler()) self.registerVtkWebProtocol(protocols.vtkWebViewPort()) self.registerVtkWebProtocol(protocols.vtkWebViewPortImageDelivery()) self.registerVtkWebProtocol(protocols.vtkWebViewPortGeometryDelivery()) # Update authentication key to use self.updateSecret(_WebCone.authKey) # Create default pipeline (Only once for all the session) if not _WebCone.view: # VTK specific code renderer = vtk.vtkRenderer() renderWindow = vtk.vtkRenderWindow() renderWindow.AddRenderer(renderer) renderWindowInteractor = vtk.vtkRenderWindowInteractor() renderWindowInteractor.SetRenderWindow(renderWindow) cone = vtk.vtkConeSource() mapper = vtk.vtkPolyDataMapper() actor = vtk.vtkActor() mapper.SetInputConnection(cone.GetOutputPort()) actor.SetMapper(mapper) renderWindowInteractor.SetInteractorStyle(MyInteractorStyle(renderWindow, cone)) renderer.AddActor(actor) renderer.ResetCamera() renderWindow.Render() # VTK Web application specific _WebCone.view = renderWindow self.getApplication().GetObjectIdMap().SetActiveObject("VIEW", renderWindow) # renderWindowInteractor.Start() # ============================================================================= # Main: Parse args and start server # ============================================================================= if __name__ == "__main__": # Create argument parser parser = argparse.ArgumentParser(description="VTK/Web Cone web-application") # Add default arguments server.add_arguments(parser) # Extract arguments args = parser.parse_args() # Configure our current application _WebCone.authKey = args.authKey # Start server server.start_webserver(options=args, protocol=_WebCone) -------------- next part -------------- An HTML attachment was scrubbed... URL: From sebastien.jourdain at kitware.com Mon Dec 3 10:54:03 2018 From: sebastien.jourdain at kitware.com (Sebastien Jourdain) Date: Mon, 3 Dec 2018 08:54:03 -0700 Subject: [vtkusers] key press event in vtkWeb In-Reply-To: References: Message-ID: The event handling needs to happen on the client side (JS) which should then trigger a RPC call to the server to adjust the resolution of the server data. I don't think we register any key listener in the browser that's why they don't get forwarded to the server. On Mon, Dec 3, 2018 at 8:47 AM ivan rodriguez wrote: > Hello, > > I'm using the module vtkWeb for Remote Rendering, following this simple > python example: > > *https://github.com/dmreagan/vtk-remote-render/blob/master/server/vtk_server.py > * > > and I have modified it in order to include a keyPress event. The code > works but the > key event is not working . Please find my code below (the only > modification from the link is the class MyInteractorStyle ). > > I'll really appreciate any help with this! > > Thanks !! > > > > > > ########################################################################## > ########################################################################## > > # import to process args > import sys > import os > > # import vtk modules. > import vtk > from vtk.web import protocols > from vtk.web import wslink as vtk_wslink > from wslink import server > > try: > import argparse > except ImportError: > # since Python 2.6 and earlier don't have argparse, we simply provide > # the source for the same as _argparse and we use it instead. > from vtk.util import _argparse as argparse > > # > ============================================================================= > # Create custom ServerProtocol class to handle clients requests > # > ============================================================================= > > > class MyInteractorStyle(vtk.vtkInteractorStyleTrackballCamera): > > def __init__(self,renderer, cone): > self.parent = renderer.GetInteractor() > self.resolution=5 > self.cone = cone > > self.AddObserver("KeyPressEvent",self.keyPressEvent) > > def keyPressEvent(self,obj,event): > key = self.parent.GetKeySym() > if key == 'l': > print(key) > self.cone.SetResolution(self.resolution) > self.resolution+=1 > return > > > > > class _WebCone(vtk_wslink.ServerProtocol): > > # Application configuration > view = None > authKey = "wslink-secret" > > def initialize(self): > global renderer, renderWindow, renderWindowInteractor, cone, > mapper, actor > > # Bring used components > self.registerVtkWebProtocol(protocols.vtkWebMouseHandler()) > self.registerVtkWebProtocol(protocols.vtkWebViewPort()) > > self.registerVtkWebProtocol(protocols.vtkWebViewPortImageDelivery()) > > self.registerVtkWebProtocol(protocols.vtkWebViewPortGeometryDelivery()) > > # Update authentication key to use > self.updateSecret(_WebCone.authKey) > > # Create default pipeline (Only once for all the session) > if not _WebCone.view: > # VTK specific code > renderer = vtk.vtkRenderer() > renderWindow = vtk.vtkRenderWindow() > renderWindow.AddRenderer(renderer) > > renderWindowInteractor = vtk.vtkRenderWindowInteractor() > renderWindowInteractor.SetRenderWindow(renderWindow) > > > > cone = vtk.vtkConeSource() > mapper = vtk.vtkPolyDataMapper() > actor = vtk.vtkActor() > > mapper.SetInputConnection(cone.GetOutputPort()) > actor.SetMapper(mapper) > > > renderWindowInteractor.SetInteractorStyle(MyInteractorStyle(renderWindow, > cone)) > > renderer.AddActor(actor) > renderer.ResetCamera() > renderWindow.Render() > > # VTK Web application specific > _WebCone.view = renderWindow > self.getApplication().GetObjectIdMap().SetActiveObject("VIEW", > renderWindow) > > # renderWindowInteractor.Start() > > # > ============================================================================= > # Main: Parse args and start server > # > ============================================================================= > > if __name__ == "__main__": > # Create argument parser > parser = argparse.ArgumentParser(description="VTK/Web Cone > web-application") > > # Add default arguments > server.add_arguments(parser) > > # Extract arguments > args = parser.parse_args() > > # Configure our current application > _WebCone.authKey = args.authKey > > # Start server > server.start_webserver(options=args, protocol=_WebCone) > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: > http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrea.gavana at gmail.com Mon Dec 3 11:09:38 2018 From: andrea.gavana at gmail.com (Andrea Gavana) Date: Mon, 3 Dec 2018 17:09:38 +0100 Subject: [vtkusers] vtkProgressBar attached to an actor Message-ID: Hello everyone, I?ve been googling around without much success until now, so I am turning to this kind mailing list for suggestions. I have a 3D scene with multiple unstructured grids and some STL actors at defined positions (in 3D). I would like to be able to ?attach? a progress bar to each of these STL actors - as my scene in rendered in a time dependent way, with the user able to go back and forth in time, it would make a nice touch for what I?m showing. Now, it seems to me vtkProgressBarWidget is a 2D animal, so I?m unclear how I can place it below the STL actor and anche it there even if the user zooms/pans the 3D window. Maybe what I?m trying to accomplish is simply not possible, but I?m open to all suggestions you may have. Thank you in advance. Andrea. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivandiegorodriguez at gmail.com Mon Dec 3 11:22:28 2018 From: ivandiegorodriguez at gmail.com (ivan rodriguez) Date: Mon, 3 Dec 2018 17:22:28 +0100 Subject: [vtkusers] key press event in vtkWeb In-Reply-To: References: Message-ID: Thanks for the explanation! I don't really know how to add a listener on the client side so I'll really appreciate any help with that. Do you have some example or do you know if there are some examples online about that? On Mon, Dec 3, 2018 at 5:12 PM Sebastien Jourdain < sebastien.jourdain at kitware.com> wrote: > I'm not saying it is not the way to go. You just need to add a listener on > the client side for the keyPress and forward that to the server. > That's it. Nothing more than that. > > On Mon, Dec 3, 2018 at 9:06 AM ivan rodriguez < > ivandiegorodriguez at gmail.com> wrote: > >> Thanks for the quick response! >> >> I have an application written in VTK doing an animation through a >> timerCallback and using key events and I wanted to have a similar version >> for the browser. >> So if vtkWeb is not the right way to go, do you know if vtk.js could be a >> good option for that? >> >> Thanks! >> >> On Mon, Dec 3, 2018 at 4:54 PM Sebastien Jourdain < >> sebastien.jourdain at kitware.com> wrote: >> >>> The event handling needs to happen on the client side (JS) which should >>> then trigger a RPC call to the server to adjust the resolution of the >>> server data. I don't think we register any key listener in the browser >>> that's why they don't get forwarded to the server. >>> >>> On Mon, Dec 3, 2018 at 8:47 AM ivan rodriguez < >>> ivandiegorodriguez at gmail.com> wrote: >>> >>>> Hello, >>>> >>>> I'm using the module vtkWeb for Remote Rendering, following this simple >>>> python example: >>>> >>>> *https://github.com/dmreagan/vtk-remote-render/blob/master/server/vtk_server.py >>>> * >>>> >>>> and I have modified it in order to include a keyPress event. The code >>>> works but the >>>> key event is not working . Please find my code below (the only >>>> modification from the link is the class MyInteractorStyle ). >>>> >>>> I'll really appreciate any help with this! >>>> >>>> Thanks !! >>>> >>>> >>>> >>>> >>>> >>>> >>>> ########################################################################## >>>> >>>> ########################################################################## >>>> >>>> # import to process args >>>> import sys >>>> import os >>>> >>>> # import vtk modules. >>>> import vtk >>>> from vtk.web import protocols >>>> from vtk.web import wslink as vtk_wslink >>>> from wslink import server >>>> >>>> try: >>>> import argparse >>>> except ImportError: >>>> # since Python 2.6 and earlier don't have argparse, we simply >>>> provide >>>> # the source for the same as _argparse and we use it instead. >>>> from vtk.util import _argparse as argparse >>>> >>>> # >>>> ============================================================================= >>>> # Create custom ServerProtocol class to handle clients requests >>>> # >>>> ============================================================================= >>>> >>>> >>>> class MyInteractorStyle(vtk.vtkInteractorStyleTrackballCamera): >>>> >>>> def __init__(self,renderer, cone): >>>> self.parent = renderer.GetInteractor() >>>> self.resolution=5 >>>> self.cone = cone >>>> >>>> self.AddObserver("KeyPressEvent",self.keyPressEvent) >>>> >>>> def keyPressEvent(self,obj,event): >>>> key = self.parent.GetKeySym() >>>> if key == 'l': >>>> print(key) >>>> self.cone.SetResolution(self.resolution) >>>> self.resolution+=1 >>>> return >>>> >>>> >>>> >>>> >>>> class _WebCone(vtk_wslink.ServerProtocol): >>>> >>>> # Application configuration >>>> view = None >>>> authKey = "wslink-secret" >>>> >>>> def initialize(self): >>>> global renderer, renderWindow, renderWindowInteractor, cone, >>>> mapper, actor >>>> >>>> # Bring used components >>>> self.registerVtkWebProtocol(protocols.vtkWebMouseHandler()) >>>> self.registerVtkWebProtocol(protocols.vtkWebViewPort()) >>>> >>>> self.registerVtkWebProtocol(protocols.vtkWebViewPortImageDelivery()) >>>> >>>> self.registerVtkWebProtocol(protocols.vtkWebViewPortGeometryDelivery()) >>>> >>>> # Update authentication key to use >>>> self.updateSecret(_WebCone.authKey) >>>> >>>> # Create default pipeline (Only once for all the session) >>>> if not _WebCone.view: >>>> # VTK specific code >>>> renderer = vtk.vtkRenderer() >>>> renderWindow = vtk.vtkRenderWindow() >>>> renderWindow.AddRenderer(renderer) >>>> >>>> renderWindowInteractor = vtk.vtkRenderWindowInteractor() >>>> renderWindowInteractor.SetRenderWindow(renderWindow) >>>> >>>> >>>> >>>> cone = vtk.vtkConeSource() >>>> mapper = vtk.vtkPolyDataMapper() >>>> actor = vtk.vtkActor() >>>> >>>> mapper.SetInputConnection(cone.GetOutputPort()) >>>> actor.SetMapper(mapper) >>>> >>>> >>>> renderWindowInteractor.SetInteractorStyle(MyInteractorStyle(renderWindow, >>>> cone)) >>>> >>>> renderer.AddActor(actor) >>>> renderer.ResetCamera() >>>> renderWindow.Render() >>>> >>>> # VTK Web application specific >>>> _WebCone.view = renderWindow >>>> >>>> self.getApplication().GetObjectIdMap().SetActiveObject("VIEW", renderWindow) >>>> >>>> # renderWindowInteractor.Start() >>>> >>>> # >>>> ============================================================================= >>>> # Main: Parse args and start server >>>> # >>>> ============================================================================= >>>> >>>> if __name__ == "__main__": >>>> # Create argument parser >>>> parser = argparse.ArgumentParser(description="VTK/Web Cone >>>> web-application") >>>> >>>> # Add default arguments >>>> server.add_arguments(parser) >>>> >>>> # Extract arguments >>>> args = parser.parse_args() >>>> >>>> # Configure our current application >>>> _WebCone.authKey = args.authKey >>>> >>>> # Start server >>>> server.start_webserver(options=args, protocol=_WebCone) >>>> >>>> _______________________________________________ >>>> Powered by www.kitware.com >>>> >>>> Visit other Kitware open-source projects at >>>> http://www.kitware.com/opensource/opensource.html >>>> >>>> Please keep messages on-topic and check the VTK FAQ at: >>>> http://www.vtk.org/Wiki/VTK_FAQ >>>> >>>> Search the list archives at: http://markmail.org/search/?q=vtkusers >>>> >>>> Follow this link to subscribe/unsubscribe: >>>> https://public.kitware.com/mailman/listinfo/vtkusers >>>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From sebastien.jourdain at kitware.com Mon Dec 3 11:32:51 2018 From: sebastien.jourdain at kitware.com (Sebastien Jourdain) Date: Mon, 3 Dec 2018 09:32:51 -0700 Subject: [vtkusers] key press event in vtkWeb In-Reply-To: References: Message-ID: Below is an example, but Google should be able to help you also on the JS side... https://github.com/Kitware/vtk-js/blob/master/Sources/Rendering/Core/RenderWindowInteractor/index.js#L214-L222 Then for the RPC part you can find some inspiration there even if it is on ParaView https://github.com/Kitware/paraviewweb-examples Just FYI, if that make sense for what you are trying to do, we have support contract that could speed up the process on your end. HTH, Seb On Mon, Dec 3, 2018 at 9:22 AM ivan rodriguez wrote: > Thanks for the explanation! I don't really know how to add a listener on > the client side so I'll really appreciate any help with that. Do you have > some example or do you know if there are some examples online about that? > > > > > > > > On Mon, Dec 3, 2018 at 5:12 PM Sebastien Jourdain < > sebastien.jourdain at kitware.com> wrote: > >> I'm not saying it is not the way to go. You just need to add a listener >> on the client side for the keyPress and forward that to the server. >> That's it. Nothing more than that. >> >> On Mon, Dec 3, 2018 at 9:06 AM ivan rodriguez < >> ivandiegorodriguez at gmail.com> wrote: >> >>> Thanks for the quick response! >>> >>> I have an application written in VTK doing an animation through a >>> timerCallback and using key events and I wanted to have a similar version >>> for the browser. >>> So if vtkWeb is not the right way to go, do you know if vtk.js could be >>> a good option for that? >>> >>> Thanks! >>> >>> On Mon, Dec 3, 2018 at 4:54 PM Sebastien Jourdain < >>> sebastien.jourdain at kitware.com> wrote: >>> >>>> The event handling needs to happen on the client side (JS) which should >>>> then trigger a RPC call to the server to adjust the resolution of the >>>> server data. I don't think we register any key listener in the browser >>>> that's why they don't get forwarded to the server. >>>> >>>> On Mon, Dec 3, 2018 at 8:47 AM ivan rodriguez < >>>> ivandiegorodriguez at gmail.com> wrote: >>>> >>>>> Hello, >>>>> >>>>> I'm using the module vtkWeb for Remote Rendering, following this >>>>> simple python example: >>>>> >>>>> *https://github.com/dmreagan/vtk-remote-render/blob/master/server/vtk_server.py >>>>> * >>>>> >>>>> and I have modified it in order to include a keyPress event. The code >>>>> works but the >>>>> key event is not working . Please find my code below (the only >>>>> modification from the link is the class MyInteractorStyle ). >>>>> >>>>> I'll really appreciate any help with this! >>>>> >>>>> Thanks !! >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> ########################################################################## >>>>> >>>>> ########################################################################## >>>>> >>>>> # import to process args >>>>> import sys >>>>> import os >>>>> >>>>> # import vtk modules. >>>>> import vtk >>>>> from vtk.web import protocols >>>>> from vtk.web import wslink as vtk_wslink >>>>> from wslink import server >>>>> >>>>> try: >>>>> import argparse >>>>> except ImportError: >>>>> # since Python 2.6 and earlier don't have argparse, we simply >>>>> provide >>>>> # the source for the same as _argparse and we use it instead. >>>>> from vtk.util import _argparse as argparse >>>>> >>>>> # >>>>> ============================================================================= >>>>> # Create custom ServerProtocol class to handle clients requests >>>>> # >>>>> ============================================================================= >>>>> >>>>> >>>>> class MyInteractorStyle(vtk.vtkInteractorStyleTrackballCamera): >>>>> >>>>> def __init__(self,renderer, cone): >>>>> self.parent = renderer.GetInteractor() >>>>> self.resolution=5 >>>>> self.cone = cone >>>>> >>>>> self.AddObserver("KeyPressEvent",self.keyPressEvent) >>>>> >>>>> def keyPressEvent(self,obj,event): >>>>> key = self.parent.GetKeySym() >>>>> if key == 'l': >>>>> print(key) >>>>> self.cone.SetResolution(self.resolution) >>>>> self.resolution+=1 >>>>> return >>>>> >>>>> >>>>> >>>>> >>>>> class _WebCone(vtk_wslink.ServerProtocol): >>>>> >>>>> # Application configuration >>>>> view = None >>>>> authKey = "wslink-secret" >>>>> >>>>> def initialize(self): >>>>> global renderer, renderWindow, renderWindowInteractor, cone, >>>>> mapper, actor >>>>> >>>>> # Bring used components >>>>> self.registerVtkWebProtocol(protocols.vtkWebMouseHandler()) >>>>> self.registerVtkWebProtocol(protocols.vtkWebViewPort()) >>>>> >>>>> self.registerVtkWebProtocol(protocols.vtkWebViewPortImageDelivery()) >>>>> >>>>> self.registerVtkWebProtocol(protocols.vtkWebViewPortGeometryDelivery()) >>>>> >>>>> # Update authentication key to use >>>>> self.updateSecret(_WebCone.authKey) >>>>> >>>>> # Create default pipeline (Only once for all the session) >>>>> if not _WebCone.view: >>>>> # VTK specific code >>>>> renderer = vtk.vtkRenderer() >>>>> renderWindow = vtk.vtkRenderWindow() >>>>> renderWindow.AddRenderer(renderer) >>>>> >>>>> renderWindowInteractor = vtk.vtkRenderWindowInteractor() >>>>> renderWindowInteractor.SetRenderWindow(renderWindow) >>>>> >>>>> >>>>> >>>>> cone = vtk.vtkConeSource() >>>>> mapper = vtk.vtkPolyDataMapper() >>>>> actor = vtk.vtkActor() >>>>> >>>>> mapper.SetInputConnection(cone.GetOutputPort()) >>>>> actor.SetMapper(mapper) >>>>> >>>>> >>>>> renderWindowInteractor.SetInteractorStyle(MyInteractorStyle(renderWindow, >>>>> cone)) >>>>> >>>>> renderer.AddActor(actor) >>>>> renderer.ResetCamera() >>>>> renderWindow.Render() >>>>> >>>>> # VTK Web application specific >>>>> _WebCone.view = renderWindow >>>>> >>>>> self.getApplication().GetObjectIdMap().SetActiveObject("VIEW", renderWindow) >>>>> >>>>> # renderWindowInteractor.Start() >>>>> >>>>> # >>>>> ============================================================================= >>>>> # Main: Parse args and start server >>>>> # >>>>> ============================================================================= >>>>> >>>>> if __name__ == "__main__": >>>>> # Create argument parser >>>>> parser = argparse.ArgumentParser(description="VTK/Web Cone >>>>> web-application") >>>>> >>>>> # Add default arguments >>>>> server.add_arguments(parser) >>>>> >>>>> # Extract arguments >>>>> args = parser.parse_args() >>>>> >>>>> # Configure our current application >>>>> _WebCone.authKey = args.authKey >>>>> >>>>> # Start server >>>>> server.start_webserver(options=args, protocol=_WebCone) >>>>> >>>>> _______________________________________________ >>>>> Powered by www.kitware.com >>>>> >>>>> Visit other Kitware open-source projects at >>>>> http://www.kitware.com/opensource/opensource.html >>>>> >>>>> Please keep messages on-topic and check the VTK FAQ at: >>>>> http://www.vtk.org/Wiki/VTK_FAQ >>>>> >>>>> Search the list archives at: http://markmail.org/search/?q=vtkusers >>>>> >>>>> Follow this link to subscribe/unsubscribe: >>>>> https://public.kitware.com/mailman/listinfo/vtkusers >>>>> >>>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Mon Dec 3 11:34:33 2018 From: david.gobbi at gmail.com (David Gobbi) Date: Mon, 3 Dec 2018 09:34:33 -0700 Subject: [vtkusers] vtkProgressBar attached to an actor In-Reply-To: References: Message-ID: Hi Andrea, A generic way of doing this is to write a callback for vtkRenderer's StartEvent. Then every time the renderer is preparing to render the scene, it will call your callback, and your callback can set the position of the 2D actors. The vtkCoordinate class provides a convenient way of converting from 3D to 2D coordinates. Other than callbacks, I don't think there's any way to do it. The VTK label actors can be used to automatically position text at 3D locations, but there don't seem to be any classes for placing an arbitrary 2D actor at a 3D location. David On Mon, Dec 3, 2018 at 9:09 AM Andrea Gavana wrote: > Hello everyone, > > I?ve been googling around without much success until now, so I am > turning to this kind mailing list for suggestions. > > I have a 3D scene with multiple unstructured grids and some STL actors at > defined positions (in 3D). I would like to be able to ?attach? a progress > bar to each of these STL actors - as my scene in rendered in a time > dependent way, with the user able to go back and forth in time, it would > make a nice touch for what I?m showing. > > Now, it seems to me vtkProgressBarWidget is a 2D animal, so I?m unclear > how I can place it below the STL actor and anche it there even if the user > zooms/pans the 3D window. > > Maybe what I?m trying to accomplish is simply not possible, but I?m open > to all suggestions you may have. > > Thank you in advance. > > Andrea. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivandiegorodriguez at gmail.com Mon Dec 3 11:35:34 2018 From: ivandiegorodriguez at gmail.com (ivan rodriguez) Date: Mon, 3 Dec 2018 17:35:34 +0100 Subject: [vtkusers] key press event in vtkWeb In-Reply-To: References: Message-ID: Thanks a lot! On Mon, Dec 3, 2018 at 5:33 PM Sebastien Jourdain < sebastien.jourdain at kitware.com> wrote: > Below is an example, but Google should be able to help you also on the JS > side... > > https://github.com/Kitware/vtk-js/blob/master/Sources/Rendering/Core/RenderWindowInteractor/index.js#L214-L222 > > Then for the RPC part you can find some inspiration there even if it is on > ParaView > https://github.com/Kitware/paraviewweb-examples > > Just FYI, if that make sense for what you are trying to do, we have > support contract that could speed up the process on your end. > > HTH, > > Seb > > On Mon, Dec 3, 2018 at 9:22 AM ivan rodriguez < > ivandiegorodriguez at gmail.com> wrote: > >> Thanks for the explanation! I don't really know how to add a listener on >> the client side so I'll really appreciate any help with that. Do you have >> some example or do you know if there are some examples online about that? >> >> >> >> >> >> >> >> On Mon, Dec 3, 2018 at 5:12 PM Sebastien Jourdain < >> sebastien.jourdain at kitware.com> wrote: >> >>> I'm not saying it is not the way to go. You just need to add a listener >>> on the client side for the keyPress and forward that to the server. >>> That's it. Nothing more than that. >>> >>> On Mon, Dec 3, 2018 at 9:06 AM ivan rodriguez < >>> ivandiegorodriguez at gmail.com> wrote: >>> >>>> Thanks for the quick response! >>>> >>>> I have an application written in VTK doing an animation through a >>>> timerCallback and using key events and I wanted to have a similar version >>>> for the browser. >>>> So if vtkWeb is not the right way to go, do you know if vtk.js could be >>>> a good option for that? >>>> >>>> Thanks! >>>> >>>> On Mon, Dec 3, 2018 at 4:54 PM Sebastien Jourdain < >>>> sebastien.jourdain at kitware.com> wrote: >>>> >>>>> The event handling needs to happen on the client side (JS) which >>>>> should then trigger a RPC call to the server to adjust the resolution of >>>>> the server data. I don't think we register any key listener in the browser >>>>> that's why they don't get forwarded to the server. >>>>> >>>>> On Mon, Dec 3, 2018 at 8:47 AM ivan rodriguez < >>>>> ivandiegorodriguez at gmail.com> wrote: >>>>> >>>>>> Hello, >>>>>> >>>>>> I'm using the module vtkWeb for Remote Rendering, following this >>>>>> simple python example: >>>>>> >>>>>> *https://github.com/dmreagan/vtk-remote-render/blob/master/server/vtk_server.py >>>>>> * >>>>>> >>>>>> and I have modified it in order to include a keyPress event. The code >>>>>> works but the >>>>>> key event is not working . Please find my code below (the only >>>>>> modification from the link is the class MyInteractorStyle ). >>>>>> >>>>>> I'll really appreciate any help with this! >>>>>> >>>>>> Thanks !! >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> ########################################################################## >>>>>> >>>>>> ########################################################################## >>>>>> >>>>>> # import to process args >>>>>> import sys >>>>>> import os >>>>>> >>>>>> # import vtk modules. >>>>>> import vtk >>>>>> from vtk.web import protocols >>>>>> from vtk.web import wslink as vtk_wslink >>>>>> from wslink import server >>>>>> >>>>>> try: >>>>>> import argparse >>>>>> except ImportError: >>>>>> # since Python 2.6 and earlier don't have argparse, we simply >>>>>> provide >>>>>> # the source for the same as _argparse and we use it instead. >>>>>> from vtk.util import _argparse as argparse >>>>>> >>>>>> # >>>>>> ============================================================================= >>>>>> # Create custom ServerProtocol class to handle clients requests >>>>>> # >>>>>> ============================================================================= >>>>>> >>>>>> >>>>>> class MyInteractorStyle(vtk.vtkInteractorStyleTrackballCamera): >>>>>> >>>>>> def __init__(self,renderer, cone): >>>>>> self.parent = renderer.GetInteractor() >>>>>> self.resolution=5 >>>>>> self.cone = cone >>>>>> >>>>>> self.AddObserver("KeyPressEvent",self.keyPressEvent) >>>>>> >>>>>> def keyPressEvent(self,obj,event): >>>>>> key = self.parent.GetKeySym() >>>>>> if key == 'l': >>>>>> print(key) >>>>>> self.cone.SetResolution(self.resolution) >>>>>> self.resolution+=1 >>>>>> return >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> class _WebCone(vtk_wslink.ServerProtocol): >>>>>> >>>>>> # Application configuration >>>>>> view = None >>>>>> authKey = "wslink-secret" >>>>>> >>>>>> def initialize(self): >>>>>> global renderer, renderWindow, renderWindowInteractor, cone, >>>>>> mapper, actor >>>>>> >>>>>> # Bring used components >>>>>> self.registerVtkWebProtocol(protocols.vtkWebMouseHandler()) >>>>>> self.registerVtkWebProtocol(protocols.vtkWebViewPort()) >>>>>> >>>>>> self.registerVtkWebProtocol(protocols.vtkWebViewPortImageDelivery()) >>>>>> >>>>>> self.registerVtkWebProtocol(protocols.vtkWebViewPortGeometryDelivery()) >>>>>> >>>>>> # Update authentication key to use >>>>>> self.updateSecret(_WebCone.authKey) >>>>>> >>>>>> # Create default pipeline (Only once for all the session) >>>>>> if not _WebCone.view: >>>>>> # VTK specific code >>>>>> renderer = vtk.vtkRenderer() >>>>>> renderWindow = vtk.vtkRenderWindow() >>>>>> renderWindow.AddRenderer(renderer) >>>>>> >>>>>> renderWindowInteractor = vtk.vtkRenderWindowInteractor() >>>>>> renderWindowInteractor.SetRenderWindow(renderWindow) >>>>>> >>>>>> >>>>>> >>>>>> cone = vtk.vtkConeSource() >>>>>> mapper = vtk.vtkPolyDataMapper() >>>>>> actor = vtk.vtkActor() >>>>>> >>>>>> mapper.SetInputConnection(cone.GetOutputPort()) >>>>>> actor.SetMapper(mapper) >>>>>> >>>>>> >>>>>> renderWindowInteractor.SetInteractorStyle(MyInteractorStyle(renderWindow, >>>>>> cone)) >>>>>> >>>>>> renderer.AddActor(actor) >>>>>> renderer.ResetCamera() >>>>>> renderWindow.Render() >>>>>> >>>>>> # VTK Web application specific >>>>>> _WebCone.view = renderWindow >>>>>> >>>>>> self.getApplication().GetObjectIdMap().SetActiveObject("VIEW", renderWindow) >>>>>> >>>>>> # renderWindowInteractor.Start() >>>>>> >>>>>> # >>>>>> ============================================================================= >>>>>> # Main: Parse args and start server >>>>>> # >>>>>> ============================================================================= >>>>>> >>>>>> if __name__ == "__main__": >>>>>> # Create argument parser >>>>>> parser = argparse.ArgumentParser(description="VTK/Web Cone >>>>>> web-application") >>>>>> >>>>>> # Add default arguments >>>>>> server.add_arguments(parser) >>>>>> >>>>>> # Extract arguments >>>>>> args = parser.parse_args() >>>>>> >>>>>> # Configure our current application >>>>>> _WebCone.authKey = args.authKey >>>>>> >>>>>> # Start server >>>>>> server.start_webserver(options=args, protocol=_WebCone) >>>>>> >>>>>> _______________________________________________ >>>>>> Powered by www.kitware.com >>>>>> >>>>>> Visit other Kitware open-source projects at >>>>>> http://www.kitware.com/opensource/opensource.html >>>>>> >>>>>> Please keep messages on-topic and check the VTK FAQ at: >>>>>> http://www.vtk.org/Wiki/VTK_FAQ >>>>>> >>>>>> Search the list archives at: http://markmail.org/search/?q=vtkusers >>>>>> >>>>>> Follow this link to subscribe/unsubscribe: >>>>>> https://public.kitware.com/mailman/listinfo/vtkusers >>>>>> >>>>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From meakcey at gmail.com Mon Dec 3 16:02:44 2018 From: meakcey at gmail.com (meakcey) Date: Mon, 3 Dec 2018 14:02:44 -0700 (MST) Subject: [vtkusers] Crashing on GetGlobalIds In-Reply-To: References: <1543069040005-0.post@n5.nabble.com> <1543070864626-0.post@n5.nabble.com> Message-ID: <1543870964413-0.post@n5.nabble.com> Thank you for your suggestion assert(globalIds); line is not crashing. That means as you pointed out, visible filter should be throwing out the globalids. Could you guide me through the source of filters? -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From rastor.ragereaver at gmail.com Mon Dec 3 16:14:27 2018 From: rastor.ragereaver at gmail.com (=?UTF-8?Q?Rados=C5=82aw_Furmaniak?=) Date: Mon, 3 Dec 2018 22:14:27 +0100 Subject: [vtkusers] Color PolyData based on VolumeData In-Reply-To: References: <1543811202678-0.post@n5.nabble.com> Message-ID: Thanks a lot! The solution from Andaharoo was what I was looking for. pon., 3 gru 2018 o 07:50 Andras Lasso napisa?(a): > You can copy voxel values from a volume to a polydata using vtkProbeFilter. > > However, this won't help you if you obtained your polydata using a > vtkContourFilter, because the contour filter generates isosurface, which > means all extracted points have the same intensity value in the input > volume. No matter what transfer function you apply, you'll always end up > with a solid colored surface. > > It is a common desire to replace volume rendering by displaying a colored > surface, but this is not feasible ( > https://discourse.slicer.org/t/save-volume-rendering-as-stl-file/524/20). > > If your goal is 3D printing then you may use voxel printing technique, > which allows printing directly from volume rendering, without segmenting > any surfaces ( > https://discourse.slicer.org/t/printing-volume-renderings-in-plastic/3017 > ). > > If your goal is volume-rendering-like display (for example, you want to > show "volume rendering" in Unity) then you need to use an actual volume > renderer. > > Andras > > > -----Original Message----- > From: vtkusers On Behalf Of > Andaharoo > Sent: Sunday, December 2, 2018 11:27 PM > To: vtkusers at vtk.org > Subject: Re: [vtkusers] Color PolyData based on VolumeData > > So, if I understand right, you want to color the scalar/whatever field > onto the poly? Just provide vtkPolyData with scalars and set the polyData's > mapper scalar visibility to on. > > If you give it 1 component scalars you can give the mapper a color > function to map them. If you give it 3 component uchar it should just > display them as color (as long as scalar visibility is on). Like so: > > > // Create the scalars array > vtkDoubleArray* scalars = vtkDoubleArray::New(); > scalars->SetName("Scalars"); > // For every point in the poly > for (vtkIdType i = 0; i < outputPoly->GetNumberOfPoints(); i++) { > double pt[3]; > outputPoly->GetPoint(i, pt); > > scalars->InsertTuple1(i, trilinearSamplePoint(inputImage, pt[0], > pt[1], pt[2], 1, 0)); } // Add the scalar data to the poly data > outputPoly->GetPointData()->AddArray(scalars); > outputPoly->GetPointData()->SetActiveScalars("Scalars"); > > > This just goes through all the points in the polygon and gets the color > from the image. Getting the color at a point in an image can be done by > simply using the nearest color from the image (nearest neighbor) or better > would be to use trilinear interpolation of the 8 nearest colors which I > used in my example. Also note my code expects float image input: > static const int calcIndex(int x, int y, int z, int width, int height) { > return x + width * (y + height * z); } > > static float trilinearSamplePoint(vtkImageData* imageData, float x, float > y, float z, int numComps, int comp) { > float* imagePtr = > static_cast(imageData->GetScalarPointer()); > double* spacing = imageData->GetSpacing(); > double* origin = imageData->GetOrigin(); > int* dim = imageData->GetDimensions(); > > // We assume point x, y, z is in the image > int xi = (x - origin[0]) / spacing[0]; > int yi = (y - origin[1]) / spacing[1]; > int zi = (z - origin[2]) / spacing[2]; > > // Get the intensities at the 8 nearest neighbors > float i000 = imagePtr[calcIndex(xi, yi, zi, dim[0], dim[1]) * > numComps + comp]; > float i100 = imagePtr[calcIndex(xi + 1, yi, zi, dim[0], dim[1]) * > numComps > + comp]; > float i110 = imagePtr[calcIndex(xi + 1, yi + 1, zi, dim[0], dim[1] > * numComps + comp)]; > float i010 = imagePtr[calcIndex(xi, yi + 1, zi, dim[0], dim[1]) * > numComps > + comp]; > > float i001 = imagePtr[calcIndex(xi, yi, zi + 1, dim[0], dim[1]) * > numComps > + comp]; > float i101 = imagePtr[calcIndex(xi + 1, yi, zi + 1, dim[0], > dim[1]) * numComps + comp]; > float i111 = imagePtr[calcIndex(xi + 1, yi + 1, zi + 1, dim[0], > dim[1]) * numComps + comp]; > float i011 = imagePtr[calcIndex(xi, yi + 1, zi + 1, dim[0], > dim[1]) * numComps + comp]; > > // Get the fractional/unit distance from nearest neighbor 000 > float rx = xi * spacing[0] + origin[0]; // Position of node > rx = (x - rx) / spacing[0]; // (Node - actual point position) / > voxel width > float ry = yi * spacing[1] + origin[1]; > ry = (y - ry) / spacing[1]; > float rz = zi * spacing[2] + origin[2]; > rz = (z - rz) / spacing[2]; > > // Now we do the trilinear interpolation > float ax = i000 + (i100 - i000) * rx; > float bx = i010 + (i110 - i010) * rx; > float cy = ax + (bx - ax) * ry; > > float dx = i001 + (i101 - i001) * rx; > float ex = i011 + (i111 - i011) * rx; > float fy = dx + (ex - dx) * ry; > > float gz = cy + (fy - cy) * rz; > return gz; > } > > > > > -- > Sent from: > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1045678.n5.nabble.com%2FVTK-Users-f1224199.html&data=02%7C01%7Classo%40queensu.ca%7C34224811bdf846b9c4a808d658d7898f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636794080091371821&sdata=iziee8ltwEAWna3RvM3dma7A3p94NWMHCfIwclRpR0I%3D&reserved=0 > _______________________________________________ > Powered by > https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Classo%40queensu.ca%7C34224811bdf846b9c4a808d658d7898f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636794080091371821&sdata=6Nv%2FWdIIIaOq%2B3peZlXxuGdAwkOwzORn7AfWthXw5Xo%3D&reserved=0 > > Visit other Kitware open-source projects at > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7C34224811bdf846b9c4a808d658d7898f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636794080091381830&sdata=oEIpua2iKsLpUdJaY%2BmQdOhCHfusGYUZDRd3Ru67Qoo%3D&reserved=0 > > Please keep messages on-topic and check the VTK FAQ at: > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vtk.org%2FWiki%2FVTK_FAQ&data=02%7C01%7Classo%40queensu.ca%7C34224811bdf846b9c4a808d658d7898f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636794080091381830&sdata=7h18pSmCa3LapcNQJsqqxU7kyWVyaQzKbPYZPMCbDiw%3D&reserved=0 > > Search the list archives at: > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtkusers&data=02%7C01%7Classo%40queensu.ca%7C34224811bdf846b9c4a808d658d7898f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636794080091381830&sdata=luU4EgKZZ9nD1OOxN5EGfBpA5HnK%2FyuVoN6C7PE%2Bzhc%3D&reserved=0 > > Follow this link to subscribe/unsubscribe: > > https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtkusers&data=02%7C01%7Classo%40queensu.ca%7C34224811bdf846b9c4a808d658d7898f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636794080091381830&sdata=URr5vqvvkUuWmwaPIIGXXJzsmW2LFrYs7Z7jDcvt4ek%3D&reserved=0 > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: > http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bill.lorensen at gmail.com Mon Dec 3 21:20:31 2018 From: bill.lorensen at gmail.com (Bill Lorensen) Date: Mon, 3 Dec 2018 18:20:31 -0800 Subject: [vtkusers] Help with vtkInterpolateDataSetAttributes In-Reply-To: References: Message-ID: I suspect that vtkInterpolateDataSetAttributes may be buggy. The are no tests that interpolate scalar data. I'm looking into it. On Thu, Nov 29, 2018, 8:13 AM Andrew E. Slaughter via vtkusers < vtkusers at public.kitware.com wrote: > I am attempting to interpolate between two ExodusII (vtkExodusIIReader) > results using the vtkInterpolateDataSetAttributes, but am having trouble > getting it to work. I was able to perform an interpolation that mimics the > behavior with calls to vtkAbstractArray::InterpolateTuple, but this doesn?t > seem like the correct solution. > > > > I have attached a script that show what I am trying to do, including what > is working and what is not. I know that for this problem I could use > vtkTemporalInterpolator, but for the actual problem I am trying to solve it > isn?t appropriate. I am using python bindings with VTK7.1 on MacOS. > > > > I would appreciate any help I can get making this work. > > > > Thanks, > > Andrew > > > > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: > http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: From trlsmax at gmail.com Mon Dec 3 22:35:13 2018 From: trlsmax at gmail.com (Max Chen) Date: Mon, 3 Dec 2018 20:35:13 -0700 (MST) Subject: [vtkusers] how to render VTK into user provided FBO Message-ID: <1543894513711-0.post@n5.nabble.com> Hi all, I want VTK render into a FBO I created and use the texture attached to this FBO to render into a glfw window. I tried this : create a class from vtkExternalOpenGLRenderWindow so I can modify the protected member. class MyRW : public vtkExternalOpenGLRenderWindow { public: void SetFBO(unsigned int fbo, unsigned int tex, unsigned int w, unsigned int h); }; void MyRW::SetFBO(unsigned int fbo, unsigned int tex, unsigned int w, unsigned int h) { this->SetBackLeftBuffer(GL_COLOR_ATTACHMENT0); this->SetFrontLeftBuffer(GL_COLOR_ATTACHMENT0); this->SetBackBuffer(GL_COLOR_ATTACHMENT0); this->SetFrontBuffer(GL_COLOR_ATTACHMENT0); this->Size[0] = w; this->Size[1] = h; this->NumberOfFrameBuffers = 1; this->DepthRenderBufferObject = 0; this->FrameBufferObject = static_cast(fbo); this->TextureObjects[0] = static_cast(tex); this->OffScreenRendering = 1; this->OffScreenUseFrameBuffer = 1; this->Modified(); } I also pass the glfw window pointer to vtkCommand::WindowMakeCurrentEvent. In the glfw loop : // render into FBO glBindFramebuffer(GL_FRAMEBUFFER, m_fbo); myvtk->render(); glBindFramebuffer(GL_FRAMEBUFFER, 0); // use the texture glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_tex); unsigned int e = glGetError(); glColor4f(1, 1, 1, 1); glBegin(GL_QUADS); glTexCoord2f(0.0, 0.0); glVertex3f(-1.0, -1.0, 0); glTexCoord2f(1.0, 0.0); glVertex3f(1.0, -1.0, 0); glTexCoord2f(1.0, 1.0); glVertex3f(1.0, 1.0, 0); glTexCoord2f(0.0, 1.0); glVertex3f(-1.0, 1.0, 0); glEnd(); glBindTexture(GL_TEXTURE_2D, 0); glDisable(GL_TEXTURE_2D); // draw imgui ImGui_ImplOpenGL2_RenderDrawData(ImGui::GetDrawData()); but it did not work, window is flickering and imgui just disappear. I setup a cmake test project in github, please help. https://github.com/trlsmax/imgui-vtk -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From andrea.gavana at gmail.com Mon Dec 3 23:57:59 2018 From: andrea.gavana at gmail.com (Andrea Gavana) Date: Tue, 4 Dec 2018 05:57:59 +0100 Subject: [vtkusers] vtkProgressBar attached to an actor In-Reply-To: References: Message-ID: Hi David, On Mon, 3 Dec 2018 at 17.34, David Gobbi wrote: > Hi Andrea, > > A generic way of doing this is to write a callback for vtkRenderer's > StartEvent. Then every time the renderer is preparing to render the scene, > it will call your callback, and your callback can set the position of the > 2D actors. The vtkCoordinate class provides a convenient way of converting > from 3D to 2D coordinates. > > Other than callbacks, I don't think there's any way to do it. The VTK > label actors can be used to automatically position text at 3D locations, > but there don't seem to be any classes for placing an arbitrary 2D actor at > a 3D location. > Thank you for your answer. I?ll give it a go and see if I can make it work. Andrea. > > David > > On Mon, Dec 3, 2018 at 9:09 AM Andrea Gavana > wrote: > >> Hello everyone, >> >> I?ve been googling around without much success until now, so I am >> turning to this kind mailing list for suggestions. >> >> I have a 3D scene with multiple unstructured grids and some STL actors at >> defined positions (in 3D). I would like to be able to ?attach? a progress >> bar to each of these STL actors - as my scene in rendered in a time >> dependent way, with the user able to go back and forth in time, it would >> make a nice touch for what I?m showing. >> >> Now, it seems to me vtkProgressBarWidget is a 2D animal, so I?m unclear >> how I can place it below the STL actor and anche it there even if the user >> zooms/pans the 3D window. >> >> Maybe what I?m trying to accomplish is simply not possible, but I?m open >> to all suggestions you may have. >> >> Thank you in advance. >> >> Andrea. >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From newcfd at yahoo.com Tue Dec 4 04:13:19 2018 From: newcfd at yahoo.com (newcfd) Date: Tue, 4 Dec 2018 02:13:19 -0700 (MST) Subject: [vtkusers] isosurface update issue In-Reply-To: References: <1543554725951-0.post@n5.nabble.com> <1543674451900-0.post@n5.nabble.com> Message-ID: <1543914799956-0.post@n5.nabble.com> I did it in the way you recommended, David. The old ones are still there. rederWindow->Render() and QVTKOpenGLWidget->update() are added as well. No help. VTK version 8.1. void MyApp::redraw( const double value ) { if ( m_pActor != nullptr ) { renderer->RemoveActor(m_pActor ); m_pActor->Delete(); m_pActor = nullptr; } m_pActor = vtkActor::New(); vtkSmartPointer mapper = vtkSmartPointer::New(); mapper->SetScalarRange(0.0, 1.0); m_pActor->SetMapper( mapper ); renderer->AddActor( m_pActor ); renderer->SetBackground(1,1,1); // Background color white vtkStructuredGrid * mesh =... vtkSmartPointer filter = vtkSmartPointer::New(); filter->SetInputData( mesh ); filter->SetNumberOfContours( 1 ); filter->Setvalue( 0, value ); // value is passed in m_pActor->GetMapper()->SetInputConnection( filter->GetOutputPort() ); renderer->Render(); } -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From ken.martin at kitware.com Tue Dec 4 07:56:56 2018 From: ken.martin at kitware.com (Ken Martin) Date: Tue, 4 Dec 2018 07:56:56 -0500 Subject: [vtkusers] how to render VTK into user provided FBO In-Reply-To: <1543894513711-0.post@n5.nabble.com> References: <1543894513711-0.post@n5.nabble.com> Message-ID: Try binding your FBO and context and then use InitializeFromCurrentContext. That has some logic to record the current FBO and use it for subsequent operations. That might do what you want. - Ken On Mon, Dec 3, 2018 at 10:35 PM Max Chen wrote: > Hi all, > > I want VTK render into a FBO I created and use the texture attached to this > FBO to render into a glfw window. > > I tried this : > create a class from vtkExternalOpenGLRenderWindow so I can modify the > protected member. > > class MyRW : public vtkExternalOpenGLRenderWindow > { > public: > void SetFBO(unsigned int fbo, unsigned int tex, unsigned int w, > unsigned > int h); > }; > > void MyRW::SetFBO(unsigned int fbo, unsigned int tex, unsigned int w, > unsigned int h) > { > > this->SetBackLeftBuffer(GL_COLOR_ATTACHMENT0); > this->SetFrontLeftBuffer(GL_COLOR_ATTACHMENT0); > this->SetBackBuffer(GL_COLOR_ATTACHMENT0); > this->SetFrontBuffer(GL_COLOR_ATTACHMENT0); > > this->Size[0] = w; > this->Size[1] = h; > this->NumberOfFrameBuffers = 1; > this->DepthRenderBufferObject = 0; > this->FrameBufferObject = static_cast(fbo); > this->TextureObjects[0] = static_cast(tex); > this->OffScreenRendering = 1; > this->OffScreenUseFrameBuffer = 1; > this->Modified(); > } > > I also pass the glfw window pointer to vtkCommand::WindowMakeCurrentEvent. > > In the glfw loop : > > // render into FBO > glBindFramebuffer(GL_FRAMEBUFFER, m_fbo); > myvtk->render(); > glBindFramebuffer(GL_FRAMEBUFFER, 0); > > // use the texture > glEnable(GL_TEXTURE_2D); > glBindTexture(GL_TEXTURE_2D, m_tex); > unsigned int e = glGetError(); > glColor4f(1, 1, 1, 1); > glBegin(GL_QUADS); > glTexCoord2f(0.0, 0.0); glVertex3f(-1.0, -1.0, 0); > glTexCoord2f(1.0, 0.0); glVertex3f(1.0, -1.0, 0); > glTexCoord2f(1.0, 1.0); glVertex3f(1.0, 1.0, 0); > glTexCoord2f(0.0, 1.0); glVertex3f(-1.0, 1.0, 0); > glEnd(); > glBindTexture(GL_TEXTURE_2D, 0); > glDisable(GL_TEXTURE_2D); > > // draw imgui > ImGui_ImplOpenGL2_RenderDrawData(ImGui::GetDrawData()); > > but it did not work, window is flickering and imgui just disappear. > > I setup a cmake test project in github, please help. > https://github.com/trlsmax/imgui-vtk > > > > > -- > Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: > http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers > -- Ken Martin PhD Distinguished Engineer Kitware Inc. 101 East Weaver Street Carrboro, North Carolina 27510 USA This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From kor1581 at gmail.com Tue Dec 4 09:27:59 2018 From: kor1581 at gmail.com (ran) Date: Tue, 4 Dec 2018 07:27:59 -0700 (MST) Subject: [vtkusers] Occurring vtkDebugLeaks even smartpointers are used Message-ID: <1543933679005-0.post@n5.nabble.com> I'm using vtk 8.1.0 for displaying DICOM images in three windows in Qt widget application in windows 10. For this mainly uses uses three instances vtkResliceImageViewer, vtkGenericOpenGLRenderWindow, vtkDICOMReader, vtkDICOMMetaData, vtkInteractorStyleImage also uses QVTKOpenGLWidget for fitting the images in Qt window. I'm using smart pointers for all the objects, for vtk uses vtkSmartPointer, Qt uses QPointer. While the application window closes occurring a long list of vtkDebugLeaks. Also, the application crashes while opening the second time. Is these vtkDebugLeaks affect the application working? or can ignore The list shows a long list which also includes classes not using and can't find main classes of causing the leaks. Even though uses smart pointers, why these leaks happen. Below shows the list of leaks, /vtkDebugLeaks has detected LEAKS! Class "vtkOpenGLRenderTimerLog" has 3 instances still around. Class "vtkOpenGLTextActor" has 6 instances still around. Class "vtkSynchronizedTemplatesCutter3D" has 3 instances still around. Class "vtk3DWidgetConnection" has 3 instances still around. Class "vtkOpenGLTextMapper" has 3 instances still around. Class "vtkTextureObject" has 6 instances still around. Class "vtkCellData" has 78 instances still around. Class "vtkResliceImageViewerMeasurements" has 3 instances still around. Class "vtkTransformPolyDataFilter" has 3 instances still around. Class "vtkCollection" has 9 instances still around. Class "vtkFrustumCoverageCuller" has 3 instances still around. Class "vtkInformationIntegerVectorValue" has 45 instances still around. Class "vtkInformationVector" has 861 instances still around. Class "vtkPerspectiveTransform" has 6 instances still around. Class "vtkResliceCursorPicker" has 3 instances still around. Class "vtkPlaneCollection" has 3 instances still around. Class "vtkResliceCursorActor" has 3 instances still around. Class "vtkPointData" has 78 instances still around. Class "vtkImageActor" has 6 instances still around. Class "vtkWidgetEventTranslator" has 6 instances still around. Class "class vtkBuffer" has 3 instances still around. Class "vtkProperty2D" has 6 instances still around. Class "vtkCompositeDataPipeline" has 153 instances still around. Class "vtkMatrix3x3" has 144 instances still around. Class "vtkProp3DCollection" has 9 instances still around. Class "vtkTrivialProducer" has 45 instances still around. Class "vtkOpenGLIndexBufferObject" has 552 instances still around. Class "vtkMatrix4x4" has 669 instances still around. Class "vtkUnsignedShortArray" has 3 instances still around. Class "class vtkBuffer<__int64>" has 54 instances still around. Class "vtkPickingManager" has 3 instances still around. Class "QVTKInteractor" has 3 instances still around. Class "vtkCoordinate" has 30 instances still around. Class "vtkImageMapToColors" has 3 instances still around. Class "vtkBox" has 3 instances still around. Class "vtkPlane" has 18 instances still around. Class "vtkSimpleTransform" has 27 instances still around. Class "class vtkBuffer" has 15 instances still around. Class "vtkPlaneSource" has 6 instances still around. Class "vtkPoints" has 105 instances still around. Class "vtkIntArray" has 6 instances still around. Class "vtkInformation" has 1902 instances still around. Class "vtkImageReslice" has 3 instances still around. Class "vtkActorCollection" has 12 instances still around. Class "vtkLine" has 12 instances still around. Class "vtkInformationStringVectorValue" has 6 instances still around. Class "vtkBoundedPlanePointPlacer" has 3 instances still around. Class "vtkGenericOpenGLRenderWindow" has 3 instances still around. Class "vtkMultiThreader" has 15 instances still around. Class "vtkVolumeCollection" has 3 instances still around. Class "vtkAssemblyPath" has 3 instances still around. Class "vtkPropCollection" has 27 instances still around. Class "vtkResliceCursorLineRepresentation" has 3 instances still around. Class "vtkAssemblyNode" has 3 instances still around. Class "vtkInformationIntegerPointerValue" has 24 instances still around. Class "vtkSynchronizedTemplates3D" has 3 instances still around. Class "vtkGenericCell" has 9 instances still around. Class "vtkDICOMMetaData" has 3 instances still around. Class "vtkPolyData" has 57 instances still around. Class "vtkLookupTable" has 6 instances still around. Class "vtkPixel" has 12 instances still around. Class "class vtkBuffer" has 6 instances still around. Class "vtkPropPicker" has 6 instances still around. Class "imriLocalizerVtkInteractionStyleImage" has 3 instances still around. Class "vtkActor2D" has 6 instances still around. Class "vtkOpenGLCamera" has 3 instances still around. Class "vtkPlaneWidget" has 3 instances still around. Class "vtkOpenGLVertexArrayObject" has 552 instances still around. Class "vtkOpenGLActor" has 69 instances still around. Class "vtkResliceCursorWidget" has 3 instances still around. Class "vtkOpenGLPolyDataMapper" has 72 instances still around. Class "vtkIdList" has 48 instances still around. Class "vtkWorldPointPicker" has 6 instances still around. Class "vtkEmptyCell" has 9 instances still around. Class "vtkRectilinearSynchronizedTemplates" has 3 instances still around. Class "vtkObserverMediator" has 3 instances still around. Class "vtkConeSource" has 6 instances still around. Class "vtkDoubleArray" has 66 instances still around. Class "vtkInteractorStyleImage" has 3 instances still around. Class "vtkMatrixToLinearTransform" has 9 instances still around. Class "vtkAlgorithmOutput" has 93 instances still around. Class "vtkCullerCollection" has 3 instances still around. Class "vtkOpenGLRenderer" has 3 instances still around. Class "vtkImageStencilData" has 3 instances still around. Class "vtkInformationIntegerValue" has 1743 instances still around. Class "vtkImageProperty" has 6 instances still around. Class "vtkTextProperty" has 15 instances still around. Class "vtkOpenGLPolyDataMapper2D" has 12 instances still around. Class "vtkGridSynchronizedTemplates3D" has 3 instances still around. Class "vtkOpenGLLight" has 3 instances still around. Class "vtkTextRepresentation" has 3 instances still around. Class "vtkCellArray" has 54 instances still around. Class "vtkRendererCollection" has 3 instances still around. Class "vtkClipPolyData" has 3 instances still around. Class "vtkShaderProgram" has 9 instances still around. Class "class vtkBuffer" has 81 instances still around. Class "vtkResliceCursor" has 3 instances still around. Class "vtkCutter" has 3 instances still around. Class "vtkOpenGLShaderCache" has 3 instances still around. Class "vtkTDxInteractorStyleCamera" has 6 instances still around. Class "vtkImageData" has 21 instances still around. Class "vtkFloatArray" has 81 instances still around. Class "vtkInformationStringValue" has 24 instances still around. Class "vtkInformationExecutivePortVectorValue" has 93 instances still around. Class "vtkImageMapToWindowLevelColors" has 3 instances still around. Class "vtkContourValues" has 15 instances still around. Class "vtkIdTypeArray" has 54 instances still around. Class "vtkTransform" has 276 instances still around. Class "vtkLinearExtrusionFilter" has 6 instances still around. Class "vtkOutlineSource" has 6 instances still around. Class "vtkOpenGLVertexBufferObjectGroup" has 84 instances still around. Class "vtkFieldData" has 84 instances still around. Class "vtkTextWidget" has 3 instances still around. Class "vtkOpenGLProperty" has 33 instances still around. Class "class vtkBuffer" has 66 instances still around. Class "vtkScalarsToColors" has 6 instances still around. Class "vtkOpenGLTexture" has 18 instances still around. Class "vtkInformationDoubleVectorValue" has 45 instances still around. Class "vtkLineSource" has 6 instances still around. Class "vtkLightCollection" has 3 instances still around. Class "vtkEvent" has 42 instances still around. Class "vtkWidgetCallbackMapper" has 6 instances still around. Class "vtkUnsignedCharArray" has 15 instances still around. Class "vtkSphereSource" has 12 instances still around. Class "vtkShader" has 27 instances still around. Class "vtkTDxInteractorStyleSettings" has 6 instances still around. Class "vtkCellPicker" has 6 instances still around. Class "vtkStreamingDemandDrivenPipeline" has 45 instances still around. Class "vtkResliceCursorPolyDataAlgorithm" has 3 instances still around. Class "vtkTextureUnitManager" has 3 instances still around. Class "vtkOpenGLVertexBufferObjectCache" has 3 instances still around. Class "vtkActor2DCollection" has 3 instances still around. Class "vtkAssemblyPaths" has 3 instances still around. Class "vtkTimerLog" has 93 instances still around. Class "vtkResliceImageViewer" has 3 instances still around. Class "vtkCommand or subclass" has 135 instances still around. Class "vtkOpenGLImageSliceMapper" has 6 instances still around. Class "vtkInformationExecutivePortValue" has 126 instances still around. Class "vtkFXAAOptions" has 3 instances still around. / -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From david.gobbi at gmail.com Tue Dec 4 13:22:50 2018 From: david.gobbi at gmail.com (David Gobbi) Date: Tue, 4 Dec 2018 11:22:50 -0700 Subject: [vtkusers] Occurring vtkDebugLeaks even smartpointers are used In-Reply-To: <1543933679005-0.post@n5.nabble.com> References: <1543933679005-0.post@n5.nabble.com> Message-ID: Hi Ran, It's good to see people using vtkDICOMReader instead of the old vtkDICOMImageReader! My guess is that vtkGenericOpenGLRenderWindow isn't being deleted, and it is holding references (directly or indirectly) to all of the other objects that are leaking. And, of course, the QVTKOpenGLWidget holds the reference to the vtkGenericOpenGLRenderWindow. So either QVTKOpenGLWidget isn't being destroyed, or you are keeping an extra reference to vtkGenericOpenGLRenderWindow in addition to the reference kept by QVTKOpenGLWidget. Once you fix the vtkGenericOpenGLRenderWindow leak, then all the other leaks should vanish. David On Tue, Dec 4, 2018 at 7:28 AM ran wrote: > I'm using vtk 8.1.0 for displaying DICOM images in three windows in Qt > widget > application in windows 10. > For this mainly uses uses three instances vtkResliceImageViewer, > vtkGenericOpenGLRenderWindow, vtkDICOMReader, vtkDICOMMetaData, > vtkInteractorStyleImage > also uses QVTKOpenGLWidget for fitting the images in Qt window. > I'm using smart pointers for all the objects, for vtk uses vtkSmartPointer, > Qt uses QPointer. > While the application window closes occurring a long list of > vtkDebugLeaks. > Also, the application crashes while opening the second time. > Is these vtkDebugLeaks affect the application working? or can ignore > The list shows a long list which also includes classes not using and can't > find main classes of causing the leaks. > Even though uses smart pointers, why these leaks happen. > > Below shows the list of leaks, > > /vtkDebugLeaks has detected LEAKS! > Class "vtkOpenGLRenderTimerLog" has 3 instances still around. > Class "vtkOpenGLTextActor" has 6 instances still around. > Class "vtkSynchronizedTemplatesCutter3D" has 3 instances still around. > Class "vtk3DWidgetConnection" has 3 instances still around. > Class "vtkOpenGLTextMapper" has 3 instances still around. > Class "vtkTextureObject" has 6 instances still around. > Class "vtkCellData" has 78 instances still around. > Class "vtkResliceImageViewerMeasurements" has 3 instances still around. > Class "vtkTransformPolyDataFilter" has 3 instances still around. > Class "vtkCollection" has 9 instances still around. > Class "vtkFrustumCoverageCuller" has 3 instances still around. > Class "vtkInformationIntegerVectorValue" has 45 instances still around. > Class "vtkInformationVector" has 861 instances still around. > Class "vtkPerspectiveTransform" has 6 instances still around. > Class "vtkResliceCursorPicker" has 3 instances still around. > Class "vtkPlaneCollection" has 3 instances still around. > Class "vtkResliceCursorActor" has 3 instances still around. > Class "vtkPointData" has 78 instances still around. > Class "vtkImageActor" has 6 instances still around. > Class "vtkWidgetEventTranslator" has 6 instances still around. > Class "class vtkBuffer" has 3 instances still around. > Class "vtkProperty2D" has 6 instances still around. > Class "vtkCompositeDataPipeline" has 153 instances still around. > Class "vtkMatrix3x3" has 144 instances still around. > Class "vtkProp3DCollection" has 9 instances still around. > Class "vtkTrivialProducer" has 45 instances still around. > Class "vtkOpenGLIndexBufferObject" has 552 instances still around. > Class "vtkMatrix4x4" has 669 instances still around. > Class "vtkUnsignedShortArray" has 3 instances still around. > Class "class vtkBuffer<__int64>" has 54 instances still around. > Class "vtkPickingManager" has 3 instances still around. > Class "QVTKInteractor" has 3 instances still around. > Class "vtkCoordinate" has 30 instances still around. > Class "vtkImageMapToColors" has 3 instances still around. > Class "vtkBox" has 3 instances still around. > Class "vtkPlane" has 18 instances still around. > Class "vtkSimpleTransform" has 27 instances still around. > Class "class vtkBuffer" has 15 instances still around. > Class "vtkPlaneSource" has 6 instances still around. > Class "vtkPoints" has 105 instances still around. > Class "vtkIntArray" has 6 instances still around. > Class "vtkInformation" has 1902 instances still around. > Class "vtkImageReslice" has 3 instances still around. > Class "vtkActorCollection" has 12 instances still around. > Class "vtkLine" has 12 instances still around. > Class "vtkInformationStringVectorValue" has 6 instances still around. > Class "vtkBoundedPlanePointPlacer" has 3 instances still around. > Class "vtkGenericOpenGLRenderWindow" has 3 instances still around. > Class "vtkMultiThreader" has 15 instances still around. > Class "vtkVolumeCollection" has 3 instances still around. > Class "vtkAssemblyPath" has 3 instances still around. > Class "vtkPropCollection" has 27 instances still around. > Class "vtkResliceCursorLineRepresentation" has 3 instances still around. > Class "vtkAssemblyNode" has 3 instances still around. > Class "vtkInformationIntegerPointerValue" has 24 instances still around. > Class "vtkSynchronizedTemplates3D" has 3 instances still around. > Class "vtkGenericCell" has 9 instances still around. > Class "vtkDICOMMetaData" has 3 instances still around. > Class "vtkPolyData" has 57 instances still around. > Class "vtkLookupTable" has 6 instances still around. > Class "vtkPixel" has 12 instances still around. > Class "class vtkBuffer" has 6 instances still around. > Class "vtkPropPicker" has 6 instances still around. > Class "imriLocalizerVtkInteractionStyleImage" has 3 instances still around. > Class "vtkActor2D" has 6 instances still around. > Class "vtkOpenGLCamera" has 3 instances still around. > Class "vtkPlaneWidget" has 3 instances still around. > Class "vtkOpenGLVertexArrayObject" has 552 instances still around. > Class "vtkOpenGLActor" has 69 instances still around. > Class "vtkResliceCursorWidget" has 3 instances still around. > Class "vtkOpenGLPolyDataMapper" has 72 instances still around. > Class "vtkIdList" has 48 instances still around. > Class "vtkWorldPointPicker" has 6 instances still around. > Class "vtkEmptyCell" has 9 instances still around. > Class "vtkRectilinearSynchronizedTemplates" has 3 instances still around. > Class "vtkObserverMediator" has 3 instances still around. > Class "vtkConeSource" has 6 instances still around. > Class "vtkDoubleArray" has 66 instances still around. > Class "vtkInteractorStyleImage" has 3 instances still around. > Class "vtkMatrixToLinearTransform" has 9 instances still around. > Class "vtkAlgorithmOutput" has 93 instances still around. > Class "vtkCullerCollection" has 3 instances still around. > Class "vtkOpenGLRenderer" has 3 instances still around. > Class "vtkImageStencilData" has 3 instances still around. > Class "vtkInformationIntegerValue" has 1743 instances still around. > Class "vtkImageProperty" has 6 instances still around. > Class "vtkTextProperty" has 15 instances still around. > Class "vtkOpenGLPolyDataMapper2D" has 12 instances still around. > Class "vtkGridSynchronizedTemplates3D" has 3 instances still around. > Class "vtkOpenGLLight" has 3 instances still around. > Class "vtkTextRepresentation" has 3 instances still around. > Class "vtkCellArray" has 54 instances still around. > Class "vtkRendererCollection" has 3 instances still around. > Class "vtkClipPolyData" has 3 instances still around. > Class "vtkShaderProgram" has 9 instances still around. > Class "class vtkBuffer" has 81 instances still around. > Class "vtkResliceCursor" has 3 instances still around. > Class "vtkCutter" has 3 instances still around. > Class "vtkOpenGLShaderCache" has 3 instances still around. > Class "vtkTDxInteractorStyleCamera" has 6 instances still around. > Class "vtkImageData" has 21 instances still around. > Class "vtkFloatArray" has 81 instances still around. > Class "vtkInformationStringValue" has 24 instances still around. > Class "vtkInformationExecutivePortVectorValue" has 93 instances still > around. > Class "vtkImageMapToWindowLevelColors" has 3 instances still around. > Class "vtkContourValues" has 15 instances still around. > Class "vtkIdTypeArray" has 54 instances still around. > Class "vtkTransform" has 276 instances still around. > Class "vtkLinearExtrusionFilter" has 6 instances still around. > Class "vtkOutlineSource" has 6 instances still around. > Class "vtkOpenGLVertexBufferObjectGroup" has 84 instances still around. > Class "vtkFieldData" has 84 instances still around. > Class "vtkTextWidget" has 3 instances still around. > Class "vtkOpenGLProperty" has 33 instances still around. > Class "class vtkBuffer" has 66 instances still around. > Class "vtkScalarsToColors" has 6 instances still around. > Class "vtkOpenGLTexture" has 18 instances still around. > Class "vtkInformationDoubleVectorValue" has 45 instances still around. > Class "vtkLineSource" has 6 instances still around. > Class "vtkLightCollection" has 3 instances still around. > Class "vtkEvent" has 42 instances still around. > Class "vtkWidgetCallbackMapper" has 6 instances still around. > Class "vtkUnsignedCharArray" has 15 instances still around. > Class "vtkSphereSource" has 12 instances still around. > Class "vtkShader" has 27 instances still around. > Class "vtkTDxInteractorStyleSettings" has 6 instances still around. > Class "vtkCellPicker" has 6 instances still around. > Class "vtkStreamingDemandDrivenPipeline" has 45 instances still around. > Class "vtkResliceCursorPolyDataAlgorithm" has 3 instances still around. > Class "vtkTextureUnitManager" has 3 instances still around. > Class "vtkOpenGLVertexBufferObjectCache" has 3 instances still around. > Class "vtkActor2DCollection" has 3 instances still around. > Class "vtkAssemblyPaths" has 3 instances still around. > Class "vtkTimerLog" has 93 instances still around. > Class "vtkResliceImageViewer" has 3 instances still around. > Class "vtkCommand or subclass" has 135 instances still around. > Class "vtkOpenGLImageSliceMapper" has 6 instances still around. > Class "vtkInformationExecutivePortValue" has 126 instances still around. > Class "vtkFXAAOptions" has 3 instances still around. > / > > > > -- > Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: > http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: From aborsic at ne-scientific.com Tue Dec 4 14:20:23 2018 From: aborsic at ne-scientific.com (aborsic at ne-scientific.com) Date: Tue, 4 Dec 2018 14:20:23 -0500 Subject: [vtkusers] Strange Visualization Results With Transparency on Polydata Message-ID: <002401d48c06$683456e0$389d04a0$@ne-scientific.com> Dear All, I am experiencing some strange visualization results in VTK 8.1.0 on polydata using a LUT with some transparency for some entries and opacity for others. I am attaching a Python example to reproduce the problem. The code creates two polydata spheres which are spatially separated. An array with a uniform values of 1 is associated to cell data for the first sphere, and an array with values of 2 to the second sphere. The two spheres are appended together for convenience with a polydata append filter. A LUT is created with two entries, solid red RGBA = (1,0,0,1) and transparent green RGBA = (0,1,0,0.2), the scalar range is set to (1,2) mapping the cells of the first sphere to the first LUT entry and the cells of the second sphere to the second LUT entry. As shown by the attached rendering the red sphere also appears as semi-transparent, and in a wired way, if rotated some portions of the sphere seem more transparent, and others less. Setting the second LUT entry to solid green RGBA = (0,1,0,1) makes both spheres opaque - this is expected, but why does modifying the alpha channel of the second LUT entry affects also the appearance of the first sphere? I am experiencing this on two different Windows 10 computers equipped with modern NVIDIA GPUs, and on a 2017 iMac 27 running Mojave, all these computers have VTK 8.1.0. Any comment / advice is welcome, Thanks, Best Regards, Andrea -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Spheres.PNG Type: image/png Size: 463174 bytes Desc: not available URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: two_spheres.py URL: From eric.fahlgren at smith-nephew.com Tue Dec 4 15:47:29 2018 From: eric.fahlgren at smith-nephew.com (Fahlgren, Eric) Date: Tue, 4 Dec 2018 20:47:29 +0000 Subject: [vtkusers] Strange Visualization Results With Transparency on Polydata In-Reply-To: <002401d48c06$683456e0$389d04a0$@ne-scientific.com> References: <002401d48c06$683456e0$389d04a0$@ne-scientific.com> Message-ID: Hi Andrea, Z-sorting of transparent polygons is always a problem. You can cure it by turning on depth peeling, but it comes at a cost (for our models it makes renders take almost twice as long). # create a rendering window and renderer ren = vtk.vtkRenderer() ren.SetUseDepthPeeling(True) Eric From: vtkusers On Behalf Of aborsic at ne-scientific.com Sent: Tuesday, December 4, 2018 11:20 AM To: vtkusers at public.kitware.com Subject: [vtkusers] Strange Visualization Results With Transparency on Polydata Dear All, I am experiencing some strange visualization results in VTK 8.1.0 on polydata using a LUT with some transparency for some entries and opacity for others. I am attaching a Python example to reproduce the problem. The code creates two polydata spheres which are spatially separated. An array with a uniform values of 1 is associated to cell data for the first sphere, and an array with values of 2 to the second sphere. The two spheres are appended together for convenience with a polydata append filter. A LUT is created with two entries, solid red RGBA = (1,0,0,1) and transparent green RGBA = (0,1,0,0.2), the scalar range is set to (1,2) mapping the cells of the first sphere to the first LUT entry and the cells of the second sphere to the second LUT entry. As shown by the attached rendering the red sphere also appears as semi-transparent, and in a wired way, if rotated some portions of the sphere seem more transparent, and others less. Setting the second LUT entry to solid green RGBA = (0,1,0,1) makes both spheres opaque - this is expected, but why does modifying the alpha channel of the second LUT entry affects also the appearance of the first sphere? I am experiencing this on two different Windows 10 computers equipped with modern NVIDIA GPUs, and on a 2017 iMac 27 running Mojave, all these computers have VTK 8.1.0. Any comment / advice is welcome, Thanks, Best Regards, Andrea -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Tue Dec 4 16:00:25 2018 From: david.gobbi at gmail.com (David Gobbi) Date: Tue, 4 Dec 2018 14:00:25 -0700 Subject: [vtkusers] Strange Visualization Results With Transparency on Polydata In-Reply-To: References: <002401d48c06$683456e0$389d04a0$@ne-scientific.com> Message-ID: What Eric says is true, depth peeling or Z-sorting is needed for transparent polydata. Here's a long-ish explanation of why the red sphere is rendering wrong: since the mapper uses a lookup table that contains alpha values below 1.0, VTK decides to use the translucent rendering pass instead of the opaque rendering pass. In the translucent rendering pass, VTK doesn't write to the z-buffer, so unless depth peeling is enabled (or polys are pre-sorted back-to-front) you'll end up with bad results. David On Tue, Dec 4, 2018 at 1:47 PM Fahlgren, Eric < eric.fahlgren at smith-nephew.com> wrote: > Hi Andrea, > > > > Z-sorting of transparent polygons is always a problem. You can cure it by > turning on depth peeling, but it comes at a cost (for our models it makes > renders take almost twice as long). > > > > # create a rendering window and renderer > > ren = vtk.vtkRenderer() > > *ren.SetUseDepthPeeling(True)* > > > > Eric > > > > *From:* vtkusers * On Behalf Of * > aborsic at ne-scientific.com > *Sent:* Tuesday, December 4, 2018 11:20 AM > *To:* vtkusers at public.kitware.com > *Subject:* [vtkusers] Strange Visualization Results With Transparency on > Polydata > > > > Dear All, > > > > I am experiencing some strange visualization results in VTK 8.1.0 on > polydata using a LUT with some transparency for some entries and opacity > for others. > > > > I am attaching a Python example to reproduce the problem. The code creates > two polydata spheres which are spatially separated. An array with a uniform > values of 1 is associated to cell data for the first sphere, and an array > with values of 2 to the second sphere. The two spheres are appended > together for convenience with a polydata append filter. > > > > A LUT is created with two entries, solid red RGBA = (1,0,0,1) and > transparent green RGBA = (0,1,0,0.2), the scalar range is set to (1,2) > mapping the cells of the first sphere to the first LUT entry and the cells > of the second sphere to the second LUT entry. > > > > As shown by the attached rendering the red sphere also appears as > semi-transparent, and in a wired way, if rotated some portions of the > sphere seem more transparent, and others less. Setting the second LUT entry > to solid green RGBA = (0,1,0,1) makes both spheres opaque ? this is > expected, but why does modifying the alpha channel of the second LUT entry > affects also the appearance of the first sphere? > > > > I am experiencing this on two different Windows 10 computers equipped with > modern NVIDIA GPUs, and on a 2017 iMac 27 running Mojave, all these > computers have VTK 8.1.0. > > > > Any comment / advice is welcome, > > > > Thanks, Best Regards, > > > > Andrea > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ken.martin at kitware.com Tue Dec 4 16:24:05 2018 From: ken.martin at kitware.com (Ken Martin) Date: Tue, 4 Dec 2018 16:24:05 -0500 Subject: [vtkusers] Strange Visualization Results With Transparency on Polydata In-Reply-To: References: <002401d48c06$683456e0$389d04a0$@ne-scientific.com> Message-ID: In newer versions of VTK (8.2 maybe) this issue should not be as noticeable as we changed how we handle transparent rendering to yield better (but still not perfect) results. On Tue, Dec 4, 2018 at 4:00 PM David Gobbi wrote: > What Eric says is true, depth peeling or Z-sorting is needed for > transparent polydata. > > Here's a long-ish explanation of why the red sphere is rendering wrong: > since the mapper uses a lookup table that contains alpha values below 1.0, > VTK decides to use the translucent rendering pass instead of the opaque > rendering pass. In the translucent rendering pass, VTK doesn't write to > the z-buffer, so unless depth peeling is enabled (or polys are pre-sorted > back-to-front) you'll end up with bad results. > > David > > On Tue, Dec 4, 2018 at 1:47 PM Fahlgren, Eric < > eric.fahlgren at smith-nephew.com> wrote: > >> Hi Andrea, >> >> >> >> Z-sorting of transparent polygons is always a problem. You can cure it >> by turning on depth peeling, but it comes at a cost (for our models it >> makes renders take almost twice as long). >> >> >> >> # create a rendering window and renderer >> >> ren = vtk.vtkRenderer() >> >> *ren.SetUseDepthPeeling(True)* >> >> >> >> Eric >> >> >> >> *From:* vtkusers * On Behalf Of * >> aborsic at ne-scientific.com >> *Sent:* Tuesday, December 4, 2018 11:20 AM >> *To:* vtkusers at public.kitware.com >> *Subject:* [vtkusers] Strange Visualization Results With Transparency on >> Polydata >> >> >> >> Dear All, >> >> >> >> I am experiencing some strange visualization results in VTK 8.1.0 on >> polydata using a LUT with some transparency for some entries and opacity >> for others. >> >> >> >> I am attaching a Python example to reproduce the problem. The code >> creates two polydata spheres which are spatially separated. An array with a >> uniform values of 1 is associated to cell data for the first sphere, and an >> array with values of 2 to the second sphere. The two spheres are appended >> together for convenience with a polydata append filter. >> >> >> >> A LUT is created with two entries, solid red RGBA = (1,0,0,1) and >> transparent green RGBA = (0,1,0,0.2), the scalar range is set to (1,2) >> mapping the cells of the first sphere to the first LUT entry and the cells >> of the second sphere to the second LUT entry. >> >> >> >> As shown by the attached rendering the red sphere also appears as >> semi-transparent, and in a wired way, if rotated some portions of the >> sphere seem more transparent, and others less. Setting the second LUT entry >> to solid green RGBA = (0,1,0,1) makes both spheres opaque ? this is >> expected, but why does modifying the alpha channel of the second LUT entry >> affects also the appearance of the first sphere? >> >> >> >> I am experiencing this on two different Windows 10 computers equipped >> with modern NVIDIA GPUs, and on a 2017 iMac 27 running Mojave, all these >> computers have VTK 8.1.0. >> >> >> >> Any comment / advice is welcome, >> >> >> >> Thanks, Best Regards, >> >> >> >> Andrea >> > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: > http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers > -- Ken Martin PhD Distinguished Engineer Kitware Inc. 101 East Weaver Street Carrboro, North Carolina 27510 USA This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vincentrivola at hotmail.com Tue Dec 4 16:26:17 2018 From: vincentrivola at hotmail.com (vincentrivola) Date: Tue, 4 Dec 2018 14:26:17 -0700 (MST) Subject: [vtkusers] Strange Visualization Results With Transparency on Polydata In-Reply-To: References: <002401d48c06$683456e0$389d04a0$@ne-scientific.com> Message-ID: <1543958777152-0.post@n5.nabble.com> Is there a filter to pre sort the polydata element in the Z direction? -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From eric.fahlgren at smith-nephew.com Tue Dec 4 17:01:47 2018 From: eric.fahlgren at smith-nephew.com (Fahlgren, Eric) Date: Tue, 4 Dec 2018 22:01:47 +0000 Subject: [vtkusers] Strange Visualization Results With Transparency on Polydata In-Reply-To: References: <002401d48c06$683456e0$389d04a0$@ne-scientific.com> Message-ID: That?s excellent news. This is a very difficult problem, which I?ve watched evolve over many years and it?s great to see the payoff from all those brain cycles that have been applied to it. Is there any means to manually force render depth for actors/parts? We have cases where we draw a couple of overlapped X-ray images, transparent so you can see the overlap to align them. They are overlaid with lines (for example from femur head to trochlear groove), all in the same plane with the images. Sometimes it looks fine, sometimes the line is hidden until you rotate the image by 1e-6 degrees or zoom by a factor of almost nothing, at which point the lines jump in front; zoom a little more and they go behind. Draw order is correct, image first, then lines ?on top?, but when the image is oriented exactly in the plane of the view, then this issue pops up. (Our hack-around is to put the lines some small increment in front of the plane of the images.) As I recall, we tried about five years ago to stick something into vtkRenderer to do this as a proof of concept, but never got anywhere near production with it. From: Ken Martin Sent: Tuesday, December 4, 2018 1:24 PM To: David Gobbi Cc: Andrea Borsic ; Fahlgren, Eric ; vtkusers at public.kitware.com Subject: Re: [vtkusers] Strange Visualization Results With Transparency on Polydata In newer versions of VTK (8.2 maybe) this issue should not be as noticeable as we changed how we handle transparent rendering to yield better (but still not perfect) results. On Tue, Dec 4, 2018 at 4:00 PM David Gobbi > wrote: What Eric says is true, depth peeling or Z-sorting is needed for transparent polydata. Here's a long-ish explanation of why the red sphere is rendering wrong: since the mapper uses a lookup table that contains alpha values below 1.0, VTK decides to use the translucent rendering pass instead of the opaque rendering pass. In the translucent rendering pass, VTK doesn't write to the z-buffer, so unless depth peeling is enabled (or polys are pre-sorted back-to-front) you'll end up with bad results. David On Tue, Dec 4, 2018 at 1:47 PM Fahlgren, Eric > wrote: Hi Andrea, Z-sorting of transparent polygons is always a problem. You can cure it by turning on depth peeling, but it comes at a cost (for our models it makes renders take almost twice as long). # create a rendering window and renderer ren = vtk.vtkRenderer() ren.SetUseDepthPeeling(True) Eric From: vtkusers > On Behalf Of aborsic at ne-scientific.com Sent: Tuesday, December 4, 2018 11:20 AM To: vtkusers at public.kitware.com Subject: [vtkusers] Strange Visualization Results With Transparency on Polydata Dear All, I am experiencing some strange visualization results in VTK 8.1.0 on polydata using a LUT with some transparency for some entries and opacity for others. I am attaching a Python example to reproduce the problem. The code creates two polydata spheres which are spatially separated. An array with a uniform values of 1 is associated to cell data for the first sphere, and an array with values of 2 to the second sphere. The two spheres are appended together for convenience with a polydata append filter. A LUT is created with two entries, solid red RGBA = (1,0,0,1) and transparent green RGBA = (0,1,0,0.2), the scalar range is set to (1,2) mapping the cells of the first sphere to the first LUT entry and the cells of the second sphere to the second LUT entry. As shown by the attached rendering the red sphere also appears as semi-transparent, and in a wired way, if rotated some portions of the sphere seem more transparent, and others less. Setting the second LUT entry to solid green RGBA = (0,1,0,1) makes both spheres opaque ? this is expected, but why does modifying the alpha channel of the second LUT entry affects also the appearance of the first sphere? I am experiencing this on two different Windows 10 computers equipped with modern NVIDIA GPUs, and on a 2017 iMac 27 running Mojave, all these computers have VTK 8.1.0. Any comment / advice is welcome, Thanks, Best Regards, Andrea _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ Search the list archives at: http://markmail.org/search/?q=vtkusers Follow this link to subscribe/unsubscribe: https://public.kitware.com/mailman/listinfo/vtkusers -- Ken Martin PhD Distinguished Engineer Kitware Inc. 101 East Weaver Street Carrboro, North Carolina 27510 USA This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From trlsmax at gmail.com Tue Dec 4 23:04:25 2018 From: trlsmax at gmail.com (Max Chen) Date: Tue, 4 Dec 2018 21:04:25 -0700 (MST) Subject: [vtkusers] how to render VTK into user provided FBO In-Reply-To: References: <1543894513711-0.post@n5.nabble.com> Message-ID: <1543982665114-0.post@n5.nabble.com> Thank you. Now I have a working prototype. But I get a strangle issue, I can only resize the offscreen vtkGenericOpenGLRenderWindow 3 times, otherwise I get error like : ERROR: In E:\projects\VTK-8.1.2\Rendering\OpenGL2\vtkOpenGLActor.cxx, line 107 vtkOpenGLActor (0B2C4C10): failed after Render 1 OpenGL errors detected 0:(1285)out of memory the resize code is : void MyVTKRenderer::UpdateSize(unsigned int w, unsigned int h) { if (w == m_Width && h == m_Height) return; if (w == 0 || h == 0) return; m_Width = w; m_Height = h; // resize the render window m_vtkRenderWindow->SetSize(m_Width, m_Height); m_vtkRenderWindow->FullScreenOn(); m_vtkRenderWindow->OffScreenRenderingOn(); //m_vtkRenderWindow->SetMultiSamples(0); m_vtkRenderWindow->Modified(); m_vtkRenderWindowInteractor->UpdateSize(m_Width, m_Height); m_vtkRenderWindowInteractor->Modified(); m_IsInited = false; // delete old fbo glDeleteBuffers(1, &m_fbo); glDeleteBuffers(1, &m_rbo); glDeleteTextures(1, &m_tex); // create a texture object glGenTextures(1, &m_tex); glBindTexture(GL_TEXTURE_2D, m_tex); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, m_Width, m_Height, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glBindTexture(GL_TEXTURE_2D, 0); // create a renderbuffer object to store depth info glGenRenderbuffers(1, &m_rbo); glBindRenderbuffer(GL_RENDERBUFFER, m_rbo); glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, m_Width, m_Height); glBindRenderbuffer(GL_RENDERBUFFER, 0); // create a framebuffer object glGenFramebuffers(1, &m_fbo); glBindFramebuffer(GL_FRAMEBUFFER, m_fbo); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_tex, 0); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_rbo); glBindFramebuffer(GL_FRAMEBUFFER, 0); } Another issue is , these code can't work on VTK-8.2 rc1 -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From trlsmax at gmail.com Tue Dec 4 23:05:56 2018 From: trlsmax at gmail.com (Max Chen) Date: Tue, 4 Dec 2018 21:05:56 -0700 (MST) Subject: [vtkusers] VTK with imgui In-Reply-To: References: Message-ID: <1543982756780-0.post@n5.nabble.com> Hi Paul Please check https://github.com/trlsmax/imgui-vtk this is a working prototype -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From kor1581 at gmail.com Tue Dec 4 23:48:31 2018 From: kor1581 at gmail.com (ran) Date: Tue, 4 Dec 2018 21:48:31 -0700 (MST) Subject: [vtkusers] Occurring vtkDebugLeaks even smartpointers are used In-Reply-To: References: <1543933679005-0.post@n5.nabble.com> Message-ID: <1543985311135-0.post@n5.nabble.com> Thank you very much for the support, My QVTKOpenGLWidget, vtkGenericOpenGLRenderWindow related code is like this as per vtk tutorial The app has a main Qt widget file */widget.h declaration file/* QPointer m_loMain; vtkNew m_vtkRenderWindow1; QPointer m_vtkWgtWin1; vtkNew m_vtkRenderWindow2; QPointer m_vtkWgtWin2; vtkNew m_vtkRenderWindow3; QPointer m_vtkWgtWin3; */and defined in widget.cpp constructor/* QPointer m_loMain; m_vtkWgtWin1 = new QVTKOpenGLWidget(this); m_vtkWgtWin1->SetRenderWindow(m_vtkRenderWindow1); m_loMain->addWidget(m_vtkWgtWin1); m_vtkWgtWin2 = new QVTKOpenGLWidget(this); m_vtkWgtWin2->SetRenderWindow(m_vtkRenderWindow2); m_loMain->addWidget(m_vtkWgtWin2); m_vtkWgtWin3 = new QVTKOpenGLWidget(this); m_vtkWgtWin3>SetRenderWindow(m_vtkRenderWindow3); m_loMain->addWidget(m_vtkWgtWin3); */and in app main class/* // before initializing QApplication, set the default surface format. QSurfaceFormat fmt = QVTKOpenGLWidget::defaultFormat(); fmt.setSamples(0); QSurfaceFormat::setDefaultFormat(fmt); have any issue in this code? */Also i tried with the format /* QVTKOpenGLWidget::SetRenderWindow(vtkGenericOpenGLRenderWindow::Get()); but this also not solving the issue -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From gdeee at web.de Wed Dec 5 02:47:58 2018 From: gdeee at web.de (gdeee) Date: Wed, 5 Dec 2018 08:47:58 +0100 Subject: [vtkusers] vtkChartMatrix with DrawAxesAtOriginOn tick and grid disappear Message-ID: <0f94ce77-ce29-c615-7ff9-7b4ea81b9d91@web.de> Hello, I am trying to render two vtkCharts side by side using vtkChartMatrix. with the coordinate axis at the origin. Therefore I have tested following example which runs fine: https://github.com/Kitware/VTK/blob/master/Charts/Core/Testing/Cxx/TestChartMatrix.cxx However if I add static_cast(chart)->DrawAxesAtOriginOn(); for each chart, the tick of the axis gets lost and the background grid as well. Any idea what the problem is? From trlsmax at gmail.com Wed Dec 5 03:25:27 2018 From: trlsmax at gmail.com (Max Chen) Date: Wed, 5 Dec 2018 01:25:27 -0700 (MST) Subject: [vtkusers] VTK with imgui In-Reply-To: References: Message-ID: <1543998327444-0.post@n5.nabble.com> Everything works now. Code is update to github repo. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From trlsmax at gmail.com Wed Dec 5 03:26:39 2018 From: trlsmax at gmail.com (Max Chen) Date: Wed, 5 Dec 2018 01:26:39 -0700 (MST) Subject: [vtkusers] how to render VTK into user provided FBO In-Reply-To: <1543982665114-0.post@n5.nabble.com> References: <1543894513711-0.post@n5.nabble.com> <1543982665114-0.post@n5.nabble.com> Message-ID: <1543998399385-0.post@n5.nabble.com> Everything works now. Code is update to github repo. I have to remove the actor before resize the vtkGenericOpenGLRenderWindow and add it back. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From pdhahn at compintensehpc.com Wed Dec 5 03:42:39 2018 From: pdhahn at compintensehpc.com (Paul Douglas Hahn) Date: Wed, 5 Dec 2018 02:42:39 -0600 Subject: [vtkusers] VTK with imgui In-Reply-To: <1543998327444-0.post@n5.nabble.com> References: <1543998327444-0.post@n5.nabble.com> Message-ID: Let's all give Max Chen a hearty "thank you!" for this work! Hooray! I for one am grateful because now there is an expeditious alternative to Qt, at least for certain types of applications where the look and feel of ImGUI makes sense, when one wants to use VTK together with "standard" control widgets. On 12/5/18 2:25 AM, Max Chen wrote: > Everything works now. Code is update to github repo. > > > > -- > Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers > -- From slavd88 at gmail.com Wed Dec 5 12:08:12 2018 From: slavd88 at gmail.com (bdemin) Date: Wed, 5 Dec 2018 10:08:12 -0700 (MST) Subject: [vtkusers] Problems importing STL and VRML files to VTK Message-ID: <1544029692375-0.post@n5.nabble.com> I'm trying to import a CAD assembly from SolidWorks to VTK using vtkSTLReader and vtkVRMLImporter in Python. From my understanding, these are the only 3D formats VTK is able to read from SolidWorks. Doing that, I encountered 2 issues: 1) When importing an STL part, is it possible to scale its size so that it will fit my original SolidWorks part? After adding the actor of the STL part, it seems to give the part an arbitrary origin and scale. 2) How can I import a VRML 3D model and assign an actor to it? What I fail to understand is why the VRMLImporter is creating the renderer without any artist involved. With vtkSTLReader or VTKSources (cube, cone, etc) I assign their mappers to an actor for applying transformations or other functions on the artists. With VRML there is no artist which corresponds to the 3D object in all examples I've seen. How can I do that? -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From sk.shadabanwar at gmail.com Wed Dec 5 14:08:34 2018 From: sk.shadabanwar at gmail.com (shadab anwar) Date: Wed, 5 Dec 2018 14:08:34 -0500 Subject: [vtkusers] Problem with color and shading when rendering vtkimagedata Message-ID: Hey amigos, VTK noob here! I facing a few problems while rendering vtkimagedata. The code snippet as follows, int X =4, Y=4, Z=4; imageData->SetDimensions(X,Y,Z); imageData->SetSpacing(1,1,1); imageData->AllocateScalars(VTK_INT,1); for (int k = 0; k < Z ; k++) { for (int j = 0; j < Y ; j++) { for (int i = 0; i < X ; i++) { int* voxel = static_cast(imageData->GetScalarPointer(i, j, k)); voxel[0] = 10; } } } for (int i=2;i!=-1;i--) { int* voxel = static_cast(imageData->GetScalarPointer(2,i,i)); voxel[0]=0; } mapper->SetBlendModeToComposite(); mapper->SetRequestedRenderModeToRayCast(); mapper->SetInputData(imageData); compositeOpacity->AddPoint(10,1); color->AddRGBPoint(10,1,0,0); compositeOpacity->AddPoint(0,0); color->AddRGBPoint(0,0,0, 0); volumeProperty->SetAmbient(0.3); volumeProperty->SetDiffuse(0.4); volumeProperty->SetSpecular(0.8); volumeProperty->SetInterpolationType(0); volumeProperty->ShadeOn(); volumeProperty->SetColor(color); volumeProperty->SetScalarOpacity(compositeOpacity); renderer->SetBackground(0.5, 0.5, 0.5); volume->SetMapper(mapper); volume->SetProperty(volumeProperty); renderer->AddViewProp(volume); I am getting the below results, [image: image for forum.jpg] [image: image for forum2.jpg] [image: image for forum3.jpg] It can be seen that everytime I rotate my image I don't get a proper shading and color for the object. I have tried changing the lightining properties and shading properties but no sucess. I would be really thankful if anyone could help me. Just for your information I am mechanical engineering with a bit of programming knowledge, so if my question is irrattional please forgive me. Best, Shadab -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image for forum.jpg Type: image/jpeg Size: 18410 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image for forum2.jpg Type: image/jpeg Size: 22226 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image for forum3.jpg Type: image/jpeg Size: 22181 bytes Desc: not available URL: From kayarre at gmail.com Wed Dec 5 15:47:59 2018 From: kayarre at gmail.com (Kurt Sansom) Date: Wed, 5 Dec 2018 12:47:59 -0800 Subject: [vtkusers] vtk 8.2.rc2 and python 3.7.1 install weirdness Message-ID: Hi all, I am trying to build vmtk which builds ITK and VTK. I was able to get it to all compile, but the python wrappers are getting installed in ${CMAKE_INSTALL_PREFIX}/lib/lib/python3.7/site-packages/vtkmodules instead of ${CMAKE_INSTALL_PREFIX}/lib/python3.7/site-packages/vtkmodules can someone help identify where the build is adding the additional /lib? Regards, ~Kurt -- Kurt Sansom -------------- next part -------------- An HTML attachment was scrubbed... URL: From poweruserm at live.com.au Wed Dec 5 19:06:26 2018 From: poweruserm at live.com.au (A Z) Date: Thu, 6 Dec 2018 00:06:26 +0000 Subject: [vtkusers] Request about compiled version of VTK. Message-ID: For the sake of people who are in secured environments, or are just unable to successfully compile VTK on windows anyway, IS it possible for VTK to compile 64 bit Windows .dll files of VTK and offer those for public download, please? -------------- next part -------------- An HTML attachment was scrubbed... URL: From scbiradar at gmail.com Thu Dec 6 07:27:29 2018 From: scbiradar at gmail.com (Santosh Biradar) Date: Thu, 6 Dec 2018 17:57:29 +0530 Subject: [vtkusers] vtkAVIWriter with renderer gradient background shows distinct lines In-Reply-To: References: Message-ID: Sorry for the late reply Cory I tried the following options via vtkAVIWriter's SetCompressorFourCC() method 'MSVC'(default) - works but gives the scattered lines in the background for gradient background 'DIB' - Full Frames (Uncompressed) - works well and removes the gradient background problem - creates large AVI files (upto 300 MB for a 4-5 second animation) 'LAGS' - Lagarith Lossless Codec - got unknown compressor error 'MJPG' - got unknown compressor error 'DIVX' - got unknown compressor error 'XVID' - got unknown compressor error 'H264' - got unknown compressor error Thanks, Santosh On Fri, Nov 30, 2018 at 7:51 PM Cory Quammen wrote: > Great, glad to hear it. What compression options did you settle on in > case someone runs into this issue in the future? > On Fri, Nov 30, 2018 at 8:30 AM Santosh Biradar > wrote: > > > > Thanks Cory. I was able to try different compression options and was > able to remove the background lines appearing because of the gradient > albeit with large size of the AVI files. > > Thanks Andras for pointing me to an alternate to vtkAVIWriter. I will > explore the MKV container. > > > > Santosh > > > > On Wed, Nov 28, 2018 at 1:01 PM Andras Lasso wrote: > >> > >> In 3D Slicer we use VP9 codec with MKV container and it works well. VP9 > is not as widely used as H264 but it is completely royalty-free and offers > good compression ratio and acceptable speed even with lossless settings. > >> > >> > >> > >> We build required libraries (VP9, libwbm, yasm) using CMake superbuild > on Windows/Linux/Mac. Container file reading/writing implementation is > here: > https://github.com/IGSIO/IGSIO/blob/master/Source/VideoIO/MKV/vtkMKVWriter.cxx, > and VP9 codec is here: > https://github.com/IGSIO/SlicerIGSIO/blob/master/VideoIO/Codecs/vtkVP9VolumeCodec.cxx > . > >> > >> > >> > >> Andras > >> > >> > >> > >> From: vtkusers On Behalf Of Cory > Quammen > >> Sent: Tuesday, November 27, 2018 10:11 AM > >> To: santosh > >> Cc: vtkusers > >> Subject: Re: [vtkusers] vtkAVIWriter with renderer gradient background > shows distinct lines > >> > >> > >> > >> I'm afraid I don't have a lot of experience with the AVI compression > options. You might experiment with vtkAVIWriter::SetCompressorFourCC() to > see if you can find a compressor that gives more satisfactory results. > >> > >> > >> > >> Personally I prefer to dump animation frames and assemble them with > outside video software. > >> > >> > >> > >> Cory > >> > >> > >> > >> On Tue, Nov 27, 2018 at 9:26 AM Santosh Biradar > wrote: > >> > >> Thanks for the quick response Cory. > >> > >> I tried setting quality to 0,1,2. The quality of the movie was best for > 2 and worst for 0 but the background remained the same in each case. > >> > >> The quality of the output of the filter (in this case, a > vtkContourFilter) reduces with reduction in SetQuality but the background > remains of the same quality. > >> > >> There is no difference in the quality of the background. > >> > >> > >> > >> I also get the same behavior in Paraview's Save Animation feature > (version 5.5 on windows) > >> > >> > >> > >> Thanks, > >> > >> Santosh > >> > >> > >> > >> > >> > >> On Tue, Nov 27, 2018 at 7:29 PM Cory Quammen > wrote: > >> > >> Sounds like quantization/compression artifacts. You can try changing > the quality setting to reduce compression via vtkAVIWriter::SetQuality(). > >> > >> > >> > >> HTH, > >> > >> Cory > >> > >> > >> > >> On Tue, Nov 27, 2018 at 8:55 AM Santosh Biradar > wrote: > >> > >> I am trying to create a movie of an animation using vtkAVIWriter. > >> > >> The renderer has a gradient background. The .avi file created has > distinct lines/bands in the background because of the gradient. Is it > possible to get rid of these lines. I notice that if I use a vtkBMPWriter > and write an image, the image seems fine without any such lines/bands. > >> > >> > >> > >> A code snippet of what I am doing: > >> > >> > >> > >> window_to_image = vtk.vtkWindowToImageFilter() > >> window_to_image.SetInput(renWin.GetRenderWindow()) > >> window_to_image.SetInputBufferTypeToRGB() > >> window_to_image.ReadFrontBufferOff() > >> > >> writer = vtk.vtkAVIWriter() > >> writer.SetInputConnection(window_to_image.GetOutputPort()) > >> > >> I am running python wrapper of VTK-6.3.0 on windows > >> > >> > >> > >> Thanks, > >> > >> Santosh > >> > >> > >> > >> _______________________________________________ > >> Powered by www.kitware.com > >> > >> Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > >> > >> Please keep messages on-topic and check the VTK FAQ at: > http://www.vtk.org/Wiki/VTK_FAQ > >> > >> Search the list archives at: http://markmail.org/search/?q=vtkusers > >> > >> Follow this link to subscribe/unsubscribe: > >> https://public.kitware.com/mailman/listinfo/vtkusers > >> > >> > >> > >> > >> -- > >> > >> Cory Quammen > >> Staff R&D Engineer > >> Kitware, Inc. > >> > >> > >> > >> > >> -- > >> > >> Cory Quammen > >> Staff R&D Engineer > >> Kitware, Inc. > > > > -- > Cory Quammen > Staff R&D Engineer > Kitware, Inc. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kit.chambers.kc at gmail.com Thu Dec 6 08:38:29 2018 From: kit.chambers.kc at gmail.com (Kit Chambers) Date: Thu, 6 Dec 2018 13:38:29 +0000 Subject: [vtkusers] Issue with python wrapping in derived libraries Message-ID: <51B5DD2E-9E32-42C9-AA97-82D9A2BA34A5@googlemail.com> I am having and issue where by libraries built on top of VTK and wrapped using the vtkPython wrapping are not being imported properly. Essentially I have 2 projects: project1/ - Contains vtkmodule1 and extends vtkImageData to define the object vtkCube. The object vtkCube1 implements a method CustomMethod1 project2/ - Contains vtkmodule2 and extends vtkCube1 to define the object vtkCube2. The object vtkCube2 then implements a method CustomMethod2 Compiling and wrapping the libraries works fine except for when you try to access CustomMethod1 from the python wrapped vtkCube2. Essentially the vtkCube2 object misses out all the members of vtkCube1. To help show/explain I created a git repo which replicates the issue here https://github.com/batearedcollie/test-vtkwrap-shared There is also a docker image which replicates the issue here https://hub.docker.com/r/batearedcollie/vtkwrappingissue/ Any ideas or help would be greatly appreciated Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From rastor.ragereaver at gmail.com Thu Dec 6 13:12:31 2018 From: rastor.ragereaver at gmail.com (=?UTF-8?Q?Rados=C5=82aw_Furmaniak?=) Date: Thu, 6 Dec 2018 19:12:31 +0100 Subject: [vtkusers] Exporting RGB Polydata to .OBJ or .PLY Message-ID: Hello, I have set up PolyData and added 4 component scalar array to it. When I create PolyDataMapper, set scalar visibility and add actor to the scene, all colors are rendered properly. However, I have a problem with exporting this scene or just the polydata to the .OBJ (+mtl) file or to the .PLY. When I open it up in Blender, geometry is exported correctly, however OBJ is created all white, and .PLY has a single, grayish color (apart from the shadows of course), which I don't think is even present in input PolyData. I am trying to do it like this: plyWriter = vtk.vtkPLYWriter() plyWriter.SetInputData(polydata) plyWriter.SetFileTypeToBinary() plyWriter.SetDataByteOrderToLittleEndian() plyWriter.SetArrayName("Scalars") plyWriter.SetFileName("model.ply") plyWriter.Write() I have also tried setting up different color modes in plyWriter, but the results are always the same. Scalar array is set up like this: scalarArray = vtk.vtkDoubleArray() scalarArray.SetNumberOfComponents(4) scalarArray.SetName("Scalars") polydata.GetPointData().AddArray(scalarArray) polydata.GetPointData().SetActiveScalars("Scalars") (I am omitting the part where I am actually setting elements of this array) I have also tried using the OBJExporter: writer = vtk.vtkOBJExporter() writer.SetFilePrefix(output_prefix) writer.SetInput(renWin) writer.Write() where renWin is rendering window with a single actor made from polydata mentioned above. I am using Python 3.6 and VTK 8.1.1. Any help how to export geometry and colors, so they can be reused in other programs? Thanks in advance. -------------- next part -------------- An HTML attachment was scrubbed... URL: From romain.leguay at gmail.com Thu Dec 6 14:46:22 2018 From: romain.leguay at gmail.com (Romain LEGUAY) Date: Thu, 6 Dec 2018 20:46:22 +0100 Subject: [vtkusers] vtkImageInteractorStyle and MouseWheelEvent Message-ID: <10FE67DB-416D-4C59-A1F7-6E9F49F8BE87@gmail.com> Hi everyone, I try to use the mouse wheel on a vtkResliceImageViewer in a Qt window. I try to add a callback to the vtkImageInteractorStyle like this: QtVTKExample::QtVTKExample(QWidget *parent) : QWidget(parent) { m_layout = new QVBoxLayout; m_window = vtkSmartPointer::New(); m_widget = new QVTKOpenGLWidget(this); m_widget->SetRenderWindow(m_window); m_image = vtkSmartPointer::New(); m_mapper = vtkSmartPointer::New(); m_mapper->SetInputData(m_image); m_viewer = vtkSmartPointer::New(); m_viewer->SetRenderWindow(m_window); m_viewer->SetupInteractor(m_window->GetInteractor()); m_viewer->GetImageActor()->SetMapper(m_mapper); addObservers(); m_layout->addWidget(m_widget); setLayout(m_layout); } void WheelBackwardFunction (vtkObject*, long unsigned int, void*, void*) { std::cout << "wheel backward" << std::endl; } void WheelForwardFunction (vtkObject*, long unsigned int, void*, void*) { std::cout << "wheel forward" << std::endl; } void QtVTKExample::addObservers() { m_wheelForward = vtkSmartPointer::New(); m_wheelBackward = vtkSmartPointer::New(); m_wheelForward->SetCallback(WheelForwardFunction); m_wheelBackward->SetCallback(WheelBackwardFunction); m_viewer->GetInteractorStyle()->AddObserver(vtkCommand::MouseWheelForwardEvent, m_wheelForward); m_viewer->GetInteractorStyle()->AddObserver(vtkCommand::MouseWheelBackwardEvent, m_wheelBackward); } The window opens, with no warnings but the callback function are never called. What did I do wrong? Thank you, Romain -------------- next part -------------- An HTML attachment was scrubbed... URL: From ken.martin at kitware.com Fri Dec 7 11:22:53 2018 From: ken.martin at kitware.com (Ken Martin) Date: Fri, 7 Dec 2018 11:22:53 -0500 Subject: [vtkusers] Strange Visualization Results With Transparency on Polydata In-Reply-To: References: <002401d48c06$683456e0$389d04a0$@ne-scientific.com> Message-ID: The coincident topology support in vtkMapper can be used for this. It allows you to specify on a per mapper basis adjustments to the depth of objects. On Tue, Dec 4, 2018 at 5:01 PM Fahlgren, Eric < eric.fahlgren at smith-nephew.com> wrote: > That?s excellent news. This is a very difficult problem, which I?ve > watched evolve over many years and it?s great to see the payoff from all > those brain cycles that have been applied to it. > > > > Is there any means to manually force render depth for actors/parts? We > have cases where we draw a couple of overlapped X-ray images, transparent > so you can see the overlap to align them. They are overlaid with lines > (for example from femur head to trochlear groove), all in the same plane > with the images. Sometimes it looks fine, sometimes the line is hidden > until you rotate the image by 1e-6 degrees or zoom by a factor of almost > nothing, at which point the lines jump in front; zoom a little more and > they go behind. Draw order is correct, image first, then lines ?on top?, > but when the image is oriented exactly in the plane of the view, then this > issue pops up. (Our hack-around is to put the lines some small increment in > front of the plane of the images.) As I recall, we tried about five years > ago to stick something into vtkRenderer to do this as a proof of concept, > but never got anywhere near production with it. > > > > *From:* Ken Martin > *Sent:* Tuesday, December 4, 2018 1:24 PM > *To:* David Gobbi > *Cc:* Andrea Borsic ; Fahlgren, Eric < > eric.fahlgren at smith-nephew.com>; vtkusers at public.kitware.com > *Subject:* Re: [vtkusers] Strange Visualization Results With Transparency > on Polydata > > > > In newer versions of VTK (8.2 maybe) this issue should not be as > noticeable as we changed how we handle transparent rendering to yield > better (but still not perfect) results. > > > > On Tue, Dec 4, 2018 at 4:00 PM David Gobbi wrote: > > What Eric says is true, depth peeling or Z-sorting is needed for > transparent polydata. > > > > Here's a long-ish explanation of why the red sphere is rendering wrong: > since the mapper uses a lookup table that contains alpha values below 1.0, > VTK decides to use the translucent rendering pass instead of the opaque > rendering pass. In the translucent rendering pass, VTK doesn't write to > the z-buffer, so unless depth peeling is enabled (or polys are pre-sorted > back-to-front) you'll end up with bad results. > > > > David > > > > On Tue, Dec 4, 2018 at 1:47 PM Fahlgren, Eric < > eric.fahlgren at smith-nephew.com> wrote: > > Hi Andrea, > > > > Z-sorting of transparent polygons is always a problem. You can cure it by > turning on depth peeling, but it comes at a cost (for our models it makes > renders take almost twice as long). > > > > # create a rendering window and renderer > > ren = vtk.vtkRenderer() > > *ren.SetUseDepthPeeling(True)* > > > > Eric > > > > *From:* vtkusers *On Behalf Of * > aborsic at ne-scientific.com > *Sent:* Tuesday, December 4, 2018 11:20 AM > *To:* vtkusers at public.kitware.com > *Subject:* [vtkusers] Strange Visualization Results With Transparency on > Polydata > > > > Dear All, > > > > I am experiencing some strange visualization results in VTK 8.1.0 on > polydata using a LUT with some transparency for some entries and opacity > for others. > > > > I am attaching a Python example to reproduce the problem. The code creates > two polydata spheres which are spatially separated. An array with a uniform > values of 1 is associated to cell data for the first sphere, and an array > with values of 2 to the second sphere. The two spheres are appended > together for convenience with a polydata append filter. > > > > A LUT is created with two entries, solid red RGBA = (1,0,0,1) and > transparent green RGBA = (0,1,0,0.2), the scalar range is set to (1,2) > mapping the cells of the first sphere to the first LUT entry and the cells > of the second sphere to the second LUT entry. > > > > As shown by the attached rendering the red sphere also appears as > semi-transparent, and in a wired way, if rotated some portions of the > sphere seem more transparent, and others less. Setting the second LUT entry > to solid green RGBA = (0,1,0,1) makes both spheres opaque ? this is > expected, but why does modifying the alpha channel of the second LUT entry > affects also the appearance of the first sphere? > > > > I am experiencing this on two different Windows 10 computers equipped with > modern NVIDIA GPUs, and on a 2017 iMac 27 running Mojave, all these > computers have VTK 8.1.0. > > > > Any comment / advice is welcome, > > > > Thanks, Best Regards, > > > > Andrea > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: > http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers > > > > -- > > Ken Martin PhD > > Distinguished Engineer > Kitware Inc. > > 101 East Weaver Street > Carrboro, North Carolina > 27510 USA > > This communication, including all attachments, contains confidential and > legally privileged information, and it is intended only for the use of the > addressee. Access to this email by anyone else is unauthorized. If you are > not the intended recipient, any disclosure, copying, distribution or any > action taken in reliance on it is prohibited and may be unlawful. If you > received this communication in error please notify us immediately and > destroy the original message. Thank you. > -- Ken Martin PhD Distinguished Engineer Kitware Inc. 101 East Weaver Street Carrboro, North Carolina 27510 USA This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From eric.fahlgren at smith-nephew.com Fri Dec 7 11:52:42 2018 From: eric.fahlgren at smith-nephew.com (Fahlgren, Eric) Date: Fri, 7 Dec 2018 16:52:42 +0000 Subject: [vtkusers] Strange Visualization Results With Transparency on Polydata In-Reply-To: References: <002401d48c06$683456e0$389d04a0$@ne-scientific.com> Message-ID: Aha! I had never looked at that before, thanks Ken. From: Ken Martin Sent: Friday, December 7, 2018 8:23 AM To: Fahlgren, Eric Cc: David Gobbi ; Andrea Borsic ; vtkusers at public.kitware.com Subject: Re: [vtkusers] Strange Visualization Results With Transparency on Polydata The coincident topology support in vtkMapper can be used for this. It allows you to specify on a per mapper basis adjustments to the depth of objects. On Tue, Dec 4, 2018 at 5:01 PM Fahlgren, Eric > wrote: That?s excellent news. This is a very difficult problem, which I?ve watched evolve over many years and it?s great to see the payoff from all those brain cycles that have been applied to it. Is there any means to manually force render depth for actors/parts? We have cases where we draw a couple of overlapped X-ray images, transparent so you can see the overlap to align them. They are overlaid with lines (for example from femur head to trochlear groove), all in the same plane with the images. Sometimes it looks fine, sometimes the line is hidden until you rotate the image by 1e-6 degrees or zoom by a factor of almost nothing, at which point the lines jump in front; zoom a little more and they go behind. Draw order is correct, image first, then lines ?on top?, but when the image is oriented exactly in the plane of the view, then this issue pops up. (Our hack-around is to put the lines some small increment in front of the plane of the images.) As I recall, we tried about five years ago to stick something into vtkRenderer to do this as a proof of concept, but never got anywhere near production with it. From: Ken Martin > Sent: Tuesday, December 4, 2018 1:24 PM To: David Gobbi > Cc: Andrea Borsic >; Fahlgren, Eric >; vtkusers at public.kitware.com Subject: Re: [vtkusers] Strange Visualization Results With Transparency on Polydata In newer versions of VTK (8.2 maybe) this issue should not be as noticeable as we changed how we handle transparent rendering to yield better (but still not perfect) results. On Tue, Dec 4, 2018 at 4:00 PM David Gobbi > wrote: What Eric says is true, depth peeling or Z-sorting is needed for transparent polydata. Here's a long-ish explanation of why the red sphere is rendering wrong: since the mapper uses a lookup table that contains alpha values below 1.0, VTK decides to use the translucent rendering pass instead of the opaque rendering pass. In the translucent rendering pass, VTK doesn't write to the z-buffer, so unless depth peeling is enabled (or polys are pre-sorted back-to-front) you'll end up with bad results. David On Tue, Dec 4, 2018 at 1:47 PM Fahlgren, Eric > wrote: Hi Andrea, Z-sorting of transparent polygons is always a problem. You can cure it by turning on depth peeling, but it comes at a cost (for our models it makes renders take almost twice as long). # create a rendering window and renderer ren = vtk.vtkRenderer() ren.SetUseDepthPeeling(True) Eric From: vtkusers > On Behalf Of aborsic at ne-scientific.com Sent: Tuesday, December 4, 2018 11:20 AM To: vtkusers at public.kitware.com Subject: [vtkusers] Strange Visualization Results With Transparency on Polydata Dear All, I am experiencing some strange visualization results in VTK 8.1.0 on polydata using a LUT with some transparency for some entries and opacity for others. I am attaching a Python example to reproduce the problem. The code creates two polydata spheres which are spatially separated. An array with a uniform values of 1 is associated to cell data for the first sphere, and an array with values of 2 to the second sphere. The two spheres are appended together for convenience with a polydata append filter. A LUT is created with two entries, solid red RGBA = (1,0,0,1) and transparent green RGBA = (0,1,0,0.2), the scalar range is set to (1,2) mapping the cells of the first sphere to the first LUT entry and the cells of the second sphere to the second LUT entry. As shown by the attached rendering the red sphere also appears as semi-transparent, and in a wired way, if rotated some portions of the sphere seem more transparent, and others less. Setting the second LUT entry to solid green RGBA = (0,1,0,1) makes both spheres opaque ? this is expected, but why does modifying the alpha channel of the second LUT entry affects also the appearance of the first sphere? I am experiencing this on two different Windows 10 computers equipped with modern NVIDIA GPUs, and on a 2017 iMac 27 running Mojave, all these computers have VTK 8.1.0. Any comment / advice is welcome, Thanks, Best Regards, Andrea _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ Search the list archives at: http://markmail.org/search/?q=vtkusers Follow this link to subscribe/unsubscribe: https://public.kitware.com/mailman/listinfo/vtkusers -- Ken Martin PhD Distinguished Engineer Kitware Inc. 101 East Weaver Street Carrboro, North Carolina 27510 USA This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message. Thank you. -- Ken Martin PhD Distinguished Engineer Kitware Inc. 101 East Weaver Street Carrboro, North Carolina 27510 USA This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From srbn.ghosh99 at gmail.com Fri Dec 7 14:27:56 2018 From: srbn.ghosh99 at gmail.com (Shrabani Ghosh) Date: Fri, 7 Dec 2018 12:27:56 -0700 (MST) Subject: [vtkusers] How to delete an edge of a simplex mesh and create a new edge connection? Message-ID: <1544210876871-0.post@n5.nabble.com> HI All, I have simplex mesh. I need to delete few edge links between two vertices and need to create few edge links with two new vertices. Please tell me how to do it. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From rccm.kyoshimi at gmail.com Sat Dec 8 05:00:50 2018 From: rccm.kyoshimi at gmail.com (kenichiro yoshimi) Date: Sat, 8 Dec 2018 19:00:50 +0900 Subject: [vtkusers] Exporting RGB Polydata to .OBJ or .PLY In-Reply-To: References: Message-ID: Hi, You can use the vtkX3DExporter or vtkVRMLExporter to export VTK scene and render the meshes and colors in blender. https://www.vtk.org/gitweb?p=VTK.git;a=blob;f=IO/Export/Testing/Cxx/X3DTest.cxx https://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Rendering/Core/Testing/Python/cells.py Regards 2018?12?7?(?) 3:13 Rados?aw Furmaniak : > > Hello, > I have set up PolyData and added 4 component scalar array to it. When I create PolyDataMapper, set scalar visibility and add actor to the scene, all colors are rendered properly. > However, I have a problem with exporting this scene or just the polydata to the .OBJ (+mtl) file or to the .PLY. When I open it up in Blender, geometry is exported correctly, however OBJ is created all white, and .PLY has a single, grayish color (apart from the shadows of course), which I don't think is even present in input PolyData. > > I am trying to do it like this: > > plyWriter = vtk.vtkPLYWriter() > plyWriter.SetInputData(polydata) > plyWriter.SetFileTypeToBinary() > plyWriter.SetDataByteOrderToLittleEndian() > plyWriter.SetArrayName("Scalars") > plyWriter.SetFileName("model.ply") > plyWriter.Write() > > I have also tried setting up different color modes in plyWriter, > but the results are always the same. > > Scalar array is set up like this: > > scalarArray = vtk.vtkDoubleArray() > scalarArray.SetNumberOfComponents(4) > scalarArray.SetName("Scalars") > > polydata.GetPointData().AddArray(scalarArray) > > polydata.GetPointData().SetActiveScalars("Scalars") > > (I am omitting the part where I am actually setting elements of this array) > > I have also tried using the OBJExporter: > > writer = vtk.vtkOBJExporter() > writer.SetFilePrefix(output_prefix) > writer.SetInput(renWin) > writer.Write() > > where renWin is rendering window with a single actor made from polydata mentioned above. > > I am using Python 3.6 and VTK 8.1.1. > > Any help how to export geometry and colors, so they can be reused in other programs? > > Thanks in advance. > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers From lasso at queensu.ca Sat Dec 8 11:37:27 2018 From: lasso at queensu.ca (Andras Lasso) Date: Sat, 8 Dec 2018 16:37:27 +0000 Subject: [vtkusers] Exporting RGB Polydata to .OBJ or .PLY In-Reply-To: References: , Message-ID: <05211e96-60e9-4eff-9cfb-76f2bbcfa720@queensu.ca> VTK's OBJ exporter can save solid color that is set in the actor's property and Blender can use that. Point scalar data could be exported to texture and probably Blender would use that, but that has not been implemented in VTK's OBJ exporter yet - contributions are welcome. VTK's PLY writer can write RGB point scalars and some software, for example MeshLab can display the colored model correctly. However, Blender ignores this color information (at least it does not show up when you simply import the file; maybe there are plug-ins or some settings that would fix this). MeshLab may be able to export the colored model into a format that Blender can read. Andras ________________________________ From: kenichiro yoshimi Sent: Saturday, December 8, 2018 5:01 AM To: rastor.ragereaver at gmail.com Cc: vtkusers at public.kitware.com Subject: Re: [vtkusers] Exporting RGB Polydata to .OBJ or .PLY Hi, You can use the vtkX3DExporter or vtkVRMLExporter to export VTK scene and render the meshes and colors in blender. https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.vtk.org%2Fgitweb%3Fp%3DVTK.git%3Ba%3Dblob%3Bf%3DIO%2FExport%2FTesting%2FCxx%2FX3DTest.cxx&data=02%7C01%7Classo%40queensu.ca%7C1e8d31503e08484147da08d65cf4124d%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636798600696862805&sdata=YaDsvSv7gjU5x3ilese0EXWFXXP%2FwfbM36CNGZFT2xM%3D&reserved=0 https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.vtk.org%2Fgitweb%3Fp%3DVTK.git%3Ba%3Dblob%3Bf%3DRendering%2FCore%2FTesting%2FPython%2Fcells.py&data=02%7C01%7Classo%40queensu.ca%7C1e8d31503e08484147da08d65cf4124d%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636798600696862805&sdata=s3zn9M6VhL8ISVFAq6pXutgYLsC1tT4%2BQGOcuB%2F7%2Bgo%3D&reserved=0 Regards 2018?12?7?(?) 3:13 Rados?aw Furmaniak : > > Hello, > I have set up PolyData and added 4 component scalar array to it. When I create PolyDataMapper, set scalar visibility and add actor to the scene, all colors are rendered properly. > However, I have a problem with exporting this scene or just the polydata to the .OBJ (+mtl) file or to the .PLY. When I open it up in Blender, geometry is exported correctly, however OBJ is created all white, and .PLY has a single, grayish color (apart from the shadows of course), which I don't think is even present in input PolyData. > > I am trying to do it like this: > > plyWriter = vtk.vtkPLYWriter() > plyWriter.SetInputData(polydata) > plyWriter.SetFileTypeToBinary() > plyWriter.SetDataByteOrderToLittleEndian() > plyWriter.SetArrayName("Scalars") > plyWriter.SetFileName("model.ply") > plyWriter.Write() > > I have also tried setting up different color modes in plyWriter, > but the results are always the same. > > Scalar array is set up like this: > > scalarArray = vtk.vtkDoubleArray() > scalarArray.SetNumberOfComponents(4) > scalarArray.SetName("Scalars") > > polydata.GetPointData().AddArray(scalarArray) > > polydata.GetPointData().SetActiveScalars("Scalars") > > (I am omitting the part where I am actually setting elements of this array) > > I have also tried using the OBJExporter: > > writer = vtk.vtkOBJExporter() > writer.SetFilePrefix(output_prefix) > writer.SetInput(renWin) > writer.Write() > > where renWin is rendering window with a single actor made from polydata mentioned above. > > I am using Python 3.6 and VTK 8.1.1. > > Any help how to export geometry and colors, so they can be reused in other programs? > > Thanks in advance. > > _______________________________________________ > Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Classo%40queensu.ca%7C1e8d31503e08484147da08d65cf4124d%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636798600696862805&sdata=PeaSVC7fX37vaEEQwDU9tjq%2FRKKkqqekeYXkr1xuvBA%3D&reserved=0 > > Visit other Kitware open-source projects at https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7C1e8d31503e08484147da08d65cf4124d%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636798600696862805&sdata=3RrDlN1d5fM25xQ9EsSRczIGHKV3dBkig4LeYNLuX%2B0%3D&reserved=0 > > Please keep messages on-topic and check the VTK FAQ at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vtk.org%2FWiki%2FVTK_FAQ&data=02%7C01%7Classo%40queensu.ca%7C1e8d31503e08484147da08d65cf4124d%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636798600696862805&sdata=Pmqn82Jp7%2FGZuwY6IZ5ipdL0qa8vlnHpqEar9fDkUjk%3D&reserved=0 > > Search the list archives at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtkusers&data=02%7C01%7Classo%40queensu.ca%7C1e8d31503e08484147da08d65cf4124d%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636798600696862805&sdata=B6DlpR1Z4bStYhDE4jPKthNVzS7f%2BWIkcl2roYr3Z9E%3D&reserved=0 > > Follow this link to subscribe/unsubscribe: > https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtkusers&data=02%7C01%7Classo%40queensu.ca%7C1e8d31503e08484147da08d65cf4124d%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636798600696862805&sdata=q5CzMjBx1OH7rByxI0E1gaDDKYSnHx292eNNVf9rcIQ%3D&reserved=0 _______________________________________________ Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Classo%40queensu.ca%7C1e8d31503e08484147da08d65cf4124d%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636798600696862805&sdata=PeaSVC7fX37vaEEQwDU9tjq%2FRKKkqqekeYXkr1xuvBA%3D&reserved=0 Visit other Kitware open-source projects at https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7C1e8d31503e08484147da08d65cf4124d%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636798600696862805&sdata=3RrDlN1d5fM25xQ9EsSRczIGHKV3dBkig4LeYNLuX%2B0%3D&reserved=0 Please keep messages on-topic and check the VTK FAQ at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vtk.org%2FWiki%2FVTK_FAQ&data=02%7C01%7Classo%40queensu.ca%7C1e8d31503e08484147da08d65cf4124d%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636798600696862805&sdata=Pmqn82Jp7%2FGZuwY6IZ5ipdL0qa8vlnHpqEar9fDkUjk%3D&reserved=0 Search the list archives at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtkusers&data=02%7C01%7Classo%40queensu.ca%7C1e8d31503e08484147da08d65cf4124d%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636798600696862805&sdata=B6DlpR1Z4bStYhDE4jPKthNVzS7f%2BWIkcl2roYr3Z9E%3D&reserved=0 Follow this link to subscribe/unsubscribe: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtkusers&data=02%7C01%7Classo%40queensu.ca%7C1e8d31503e08484147da08d65cf4124d%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636798600696862805&sdata=q5CzMjBx1OH7rByxI0E1gaDDKYSnHx292eNNVf9rcIQ%3D&reserved=0 -------------- next part -------------- An HTML attachment was scrubbed... URL: From j.robinson at kepler-systems.com Sat Dec 8 11:43:48 2018 From: j.robinson at kepler-systems.com (JimRobinson) Date: Sat, 8 Dec 2018 09:43:48 -0700 (MST) Subject: [vtkusers] Probing a vtkUnstructuredGrid with a vtkDelaunay2D surface Message-ID: <1544287428850-0.post@n5.nabble.com> Dear All, I am trying to develop a utility in my data visualization software whereby I can take a vtkUnstructuredGrid with scalar and vector values at the points and find the interpolated value of the scalar or vector field on the surface (essentially at the points) defined by a vtkDelaunay2D object. This is easy to do if the probing surface is a plane (so therefore defined by a function) or, I imagine, if the probing surface is defined by any function. I have managed to do it using a vtkProbeFilter, whereby I set the probing surface to be the vtkDelaunay2D (below - _TIN) and the source data as the vtkUnstructuredGrid (_USGrid). The following nearly gets there: vtkProbeFilter _BathymetryProbeFilter = new vtkProbeFilter(); _BathymetryProbeFilter.SetInputData(_TIN.GetOutput()); _BathymetryProbeFilter.SetSourceData(_USGrid); However, if the _TIN protrudes from the _USGrid, then the algorithms can't interpolate a field value at the points of the _TIN that are outside of the _USGrid, and so it sets them to zero. This means that the resulting colour map is wrong. Here is a randomly generated vtkUnstructuredGrid with the field values simply being the altitude (z value) at each point. And we see the vtkDelaunay2D surface shows good results (displaying the correct altitudes) when that surface is entirely inside the vtkUnstructuredGrid volume. However, when the surface protrudes from the top of the vtkUnstructuredGrid volume, is where we get the incorrect interpolation: What I need is the vtkDelaunay2D to be clipped when it protrudes from the vtkUnstructuredGrid. Any thoughts on how this might be achieved would be much appreciated. Regards, Jim -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From paulo.r.m.carvalho at gmail.com Mon Dec 10 04:50:06 2018 From: paulo.r.m.carvalho at gmail.com (Paulo Carvalho) Date: Mon, 10 Dec 2018 07:50:06 -0200 Subject: [vtkusers] Issue compiling VTK 8.1.2 - MinGW64 - Windows 7 In-Reply-To: <1541787121742-0.post@n5.nabble.com> References: <1541787121742-0.post@n5.nabble.com> Message-ID: Greetings, all, Since I got no answer, I had to do come up with a workaround. I had to patch the /Rendering/OpenGL2/vtkWin32RenderWindowInteractor.cxx file (around line 70). The structures TOUCHINPUT and HTOUCHINPUT are incorrectly redefined there (they're defined in winuser.h). Since this is an error in VTK sources, maybe the developers could patch it. Compiling VTK 8.1.2 in Windows 7 64 with MinGW 64. regards, Paulo Em sex, 9 de nov de 2018 ?s 16:12, Paulo Carvalho < paulo.r.m.carvalho at gmail.com> escreveu: > Greetings all. I'm trying to build VTK and I'm getting the following > error: > > [ 62%] Building CXX object > > Rendering/OpenGL2/CMakeFiles/vtkRenderingOpenGL2.dir/vtkWin32RenderWindowInteractor.cxx.obj > > C:\Users\ur5m\Desktop\VTK64\VTK-8.1.2\Rendering\OpenGL2\vtkWin32RenderWindowInteractor.cxx:72:3: > error: conflicting declaration 'typedef struct _TOUCHINPUT TOUCHINPUT' > } TOUCHINPUT, *PTOUCHINPUT; > ^~~~~~~~~~ > In file included from > > C:/Users/ur5m/Desktop/msys64/mingw64/x86_64-w64-mingw32/include/windows.h:72, > from > C:/Users/ur5m/Desktop/VTK64/VTK-8.1.2/Common/Core/vtkWindows.h:58, > from > > C:\Users\ur5m\Desktop\VTK64\VTK-8.1.2\Rendering\OpenGL2\vtkWin32OpenGLRenderWindow.h:31, > from > > C:\Users\ur5m\Desktop\VTK64\VTK-8.1.2\Rendering\OpenGL2\vtkWin32RenderWindowInteractor.cxx:26: > > C:/Users/ur5m/Desktop/msys64/mingw64/x86_64-w64-mingw32/include/winuser.h:2694:5: > note: previous declaration as 'typedef struct tagTOUCHINPUT TOUCHINPUT' > } TOUCHINPUT,*PTOUCHINPUT; > ^~~~~~~~~~ > > C:\Users\ur5m\Desktop\VTK64\VTK-8.1.2\Rendering\OpenGL2\vtkWin32RenderWindowInteractor.cxx:72:16: > error: conflicting declaration 'typedef struct _TOUCHINPUT* PTOUCHINPUT' > } TOUCHINPUT, *PTOUCHINPUT; > ^~~~~~~~~~~ > In file included from > > C:/Users/ur5m/Desktop/msys64/mingw64/x86_64-w64-mingw32/include/windows.h:72, > from > C:/Users/ur5m/Desktop/VTK64/VTK-8.1.2/Common/Core/vtkWindows.h:58, > from > > C:\Users\ur5m\Desktop\VTK64\VTK-8.1.2\Rendering\OpenGL2\vtkWin32OpenGLRenderWindow.h:31, > from > > C:\Users\ur5m\Desktop\VTK64\VTK-8.1.2\Rendering\OpenGL2\vtkWin32RenderWindowInteractor.cxx:26: > > C:/Users/ur5m/Desktop/msys64/mingw64/x86_64-w64-mingw32/include/winuser.h:2694:17: > note: previous declaration as 'typedef struct tagTOUCHINPUT* PTOUCHINPUT' > } TOUCHINPUT,*PTOUCHINPUT; > ^~~~~~~~~~~ > In file included from > > C:/Users/ur5m/Desktop/msys64/mingw64/x86_64-w64-mingw32/include/minwindef.h:163, > from > C:/Users/ur5m/Desktop/msys64/mingw64/x86_64-w64-mingw32/include/windef.h:8, > from > > C:/Users/ur5m/Desktop/msys64/mingw64/x86_64-w64-mingw32/include/windows.h:69, > from > C:/Users/ur5m/Desktop/VTK64/VTK-8.1.2/Common/Core/vtkWindows.h:58, > from > > C:\Users\ur5m\Desktop\VTK64\VTK-8.1.2\Rendering\OpenGL2\vtkWin32OpenGLRenderWindow.h:31, > from > > C:\Users\ur5m\Desktop\VTK64\VTK-8.1.2\Rendering\OpenGL2\vtkWin32RenderWindowInteractor.cxx:26: > > C:\Users\ur5m\Desktop\VTK64\VTK-8.1.2\Rendering\OpenGL2\vtkWin32RenderWindowInteractor.cxx:73:16: > error: redefinition of 'struct HTOUCHINPUT__' > DECLARE_HANDLE(HTOUCHINPUT); > ^~~~~~~~~~~ > > C:/Users/ur5m/Desktop/msys64/mingw64/x86_64-w64-mingw32/include/winuser.h:2681:3: > note: previous definition of 'struct HTOUCHINPUT__' > DECLARE_HANDLE (HTOUCHINPUT); > ^~~~~~~~~~~~~~ > > C:\Users\ur5m\Desktop\VTK64\VTK-8.1.2\Rendering\OpenGL2\vtkWin32RenderWindowInteractor.cxx: > In member function 'virtual int > vtkWin32RenderWindowInteractor::OnTouch(HWND, UINT, UINT)': > > C:\Users\ur5m\Desktop\VTK64\VTK-8.1.2\Rendering\OpenGL2\vtkWin32RenderWindowInteractor.cxx:764:27: > warning: cast to pointer from integer of different size > [-Wint-to-pointer-cast] > if (GTII((HTOUCHINPUT)lParam, cInputs, pInputs, sizeof(TOUCHINPUT))) > ^~~~~~ > > C:\Users\ur5m\Desktop\VTK64\VTK-8.1.2\Rendering\OpenGL2\vtkWin32RenderWindowInteractor.cxx:819:23: > warning: cast to pointer from integer of different size > [-Wint-to-pointer-cast] > CTIH((HTOUCHINPUT)lParam); > ^~~~~~ > mingw32-make[2]: *** > [Rendering\OpenGL2\CMakeFiles\vtkRenderingOpenGL2.dir\build.make:1733: > > Rendering/OpenGL2/CMakeFiles/vtkRenderingOpenGL2.dir/vtkWin32RenderWindowInteractor.cxx.obj] > Error 1 > mingw32-make[1]: *** [CMakeFiles\Makefile2:2510: > Rendering/OpenGL2/CMakeFiles/vtkRenderingOpenGL2.dir/all] Error 2 > mingw32-make: *** [Makefile:129: all] Error 2 > > Any help will be much appreciated. Thanks. > > > > -- > Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: > http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zozonmr at gmail.com Mon Dec 10 05:00:57 2018 From: zozonmr at gmail.com (Zoltan Takacs) Date: Mon, 10 Dec 2018 11:00:57 +0100 Subject: [vtkusers] Compiling VTK-8.1.2 on MacBook Pro high Sierra Message-ID: <8F892324-ED48-4916-A46A-EB0B795E8DF2@gmail.com> Hi, I was unable to compile VTK-8.1.2 on a MacBook Pro 2017 high Sierra. CMake Error at >/usr/local/lib/cmake/Qt5Core/Qt5CoreConfig.cmake:15 (message): The imported target "Qt5::Core" references the file "/usr/local/.//mkspecs/macx-clang" but this file does not exist. Possible reasons include: The file was deleted, renamed, or moved to another location. An install or uninstall procedure did not complete successfully. The installation package was faulty and contained "/usr/local/lib/cmake/Qt5Core/Qt5CoreConfigExtras.cmake" but not all the files it references. Call Stack (most recent call first) I have added the qt5 bin folder in the opt folder to the PATH but still getting the error. How can this error be resolved? Is there a solution? Thanks Z -------------- next part -------------- An HTML attachment was scrubbed... URL: From kit.chambers.kc at gmail.com Mon Dec 10 05:24:09 2018 From: kit.chambers.kc at gmail.com (Kit Chambers) Date: Mon, 10 Dec 2018 10:24:09 +0000 Subject: [vtkusers] Issue with python wrapping in derived libraries In-Reply-To: References: Message-ID: <85A714FF-5F2A-4869-85CD-0CB6B8DAB5BD@googlemail.com> Dear VTK?ers After some more investigation I think I have solved this issue. I thought i would mention this here in the hope this benefits other in the future. Essentially the procedure I have for building a python module was 1- Use vtk_python_wrap3 to generate source files 2- Compile the source files into a static library called MODULENAMPythonD.a 3- Create the Python module (MODULENAME.so) itself by compiling the MODULENAMInit.cxx and linking against MODULENAMPythonD.a The solution was to change step 2 so that a shared library MODULENAMPythonD.so was built instead. Note - I suspect this solution is system dependent and has only been tested on Ubuntu so far. > > > ------------------------------ > > Message: 6 > Date: Thu, 6 Dec 2018 13:38:29 +0000 > From: Kit Chambers > To: VTK Users > Subject: [vtkusers] Issue with python wrapping in derived libraries > Message-ID: <51B5DD2E-9E32-42C9-AA97-82D9A2BA34A5 at googlemail.com> > Content-Type: text/plain; charset="us-ascii" > > > I am having and issue where by libraries built on top of VTK and wrapped using the vtkPython wrapping are not being imported properly. > > Essentially I have 2 projects: > > project1/ - Contains vtkmodule1 and extends vtkImageData to define the object vtkCube. The object vtkCube1 implements a method CustomMethod1 > > project2/ - Contains vtkmodule2 and extends vtkCube1 to define the object vtkCube2. The object vtkCube2 then implements a method CustomMethod2 > > Compiling and wrapping the libraries works fine except for when you try to access CustomMethod1 from the python wrapped vtkCube2. Essentially the vtkCube2 object misses out all the members of vtkCube1. > > > To help show/explain I created a git repo which replicates the issue here > > https://github.com/batearedcollie/test-vtkwrap-shared > > There is also a docker image which replicates the issue here > > https://hub.docker.com/r/batearedcollie/vtkwrappingissue/ > > > Any ideas or help would be greatly appreciated > > Thanks From dave.demarle at kitware.com Mon Dec 10 11:09:14 2018 From: dave.demarle at kitware.com (David E DeMarle) Date: Mon, 10 Dec 2018 11:09:14 -0500 Subject: [vtkusers] Issue compiling VTK 8.1.2 - MinGW64 - Windows 7 In-Reply-To: References: <1541787121742-0.post@n5.nabble.com> Message-ID: Paulo would you mind submitting a merge request? That makes it straightforward to run our regression tests on the change, which is a requirement before it goes into master. Instructions on how to do so are here: https://gitlab.kitware.com/vtk/vtk/blob/master/CONTRIBUTING.md thanks! David E DeMarle Kitware, Inc. Principal Engineer 21 Corporate Drive Clifton Park, NY 12065-8662 Phone: 518-881-4909 On Mon, Dec 10, 2018 at 4:50 AM Paulo Carvalho wrote: > Greetings, all, > > Since I got no answer, I had to do come up with a workaround. I had > to patch the root>/Rendering/OpenGL2/vtkWin32RenderWindowInteractor.cxx file (around > line 70). The structures TOUCHINPUT and HTOUCHINPUT are incorrectly > redefined there (they're defined in winuser.h). Since this is an error in > VTK sources, maybe the developers could patch it. > Compiling VTK 8.1.2 in Windows 7 64 with MinGW 64. > > regards, > > Paulo > > Em sex, 9 de nov de 2018 ?s 16:12, Paulo Carvalho < > paulo.r.m.carvalho at gmail.com> escreveu: > >> Greetings all. I'm trying to build VTK and I'm getting the following >> error: >> >> [ 62%] Building CXX object >> >> Rendering/OpenGL2/CMakeFiles/vtkRenderingOpenGL2.dir/vtkWin32RenderWindowInteractor.cxx.obj >> >> C:\Users\ur5m\Desktop\VTK64\VTK-8.1.2\Rendering\OpenGL2\vtkWin32RenderWindowInteractor.cxx:72:3: >> error: conflicting declaration 'typedef struct _TOUCHINPUT TOUCHINPUT' >> } TOUCHINPUT, *PTOUCHINPUT; >> ^~~~~~~~~~ >> In file included from >> >> C:/Users/ur5m/Desktop/msys64/mingw64/x86_64-w64-mingw32/include/windows.h:72, >> from >> C:/Users/ur5m/Desktop/VTK64/VTK-8.1.2/Common/Core/vtkWindows.h:58, >> from >> >> C:\Users\ur5m\Desktop\VTK64\VTK-8.1.2\Rendering\OpenGL2\vtkWin32OpenGLRenderWindow.h:31, >> from >> >> C:\Users\ur5m\Desktop\VTK64\VTK-8.1.2\Rendering\OpenGL2\vtkWin32RenderWindowInteractor.cxx:26: >> >> C:/Users/ur5m/Desktop/msys64/mingw64/x86_64-w64-mingw32/include/winuser.h:2694:5: >> note: previous declaration as 'typedef struct tagTOUCHINPUT TOUCHINPUT' >> } TOUCHINPUT,*PTOUCHINPUT; >> ^~~~~~~~~~ >> >> C:\Users\ur5m\Desktop\VTK64\VTK-8.1.2\Rendering\OpenGL2\vtkWin32RenderWindowInteractor.cxx:72:16: >> error: conflicting declaration 'typedef struct _TOUCHINPUT* PTOUCHINPUT' >> } TOUCHINPUT, *PTOUCHINPUT; >> ^~~~~~~~~~~ >> In file included from >> >> C:/Users/ur5m/Desktop/msys64/mingw64/x86_64-w64-mingw32/include/windows.h:72, >> from >> C:/Users/ur5m/Desktop/VTK64/VTK-8.1.2/Common/Core/vtkWindows.h:58, >> from >> >> C:\Users\ur5m\Desktop\VTK64\VTK-8.1.2\Rendering\OpenGL2\vtkWin32OpenGLRenderWindow.h:31, >> from >> >> C:\Users\ur5m\Desktop\VTK64\VTK-8.1.2\Rendering\OpenGL2\vtkWin32RenderWindowInteractor.cxx:26: >> >> C:/Users/ur5m/Desktop/msys64/mingw64/x86_64-w64-mingw32/include/winuser.h:2694:17: >> note: previous declaration as 'typedef struct tagTOUCHINPUT* PTOUCHINPUT' >> } TOUCHINPUT,*PTOUCHINPUT; >> ^~~~~~~~~~~ >> In file included from >> >> C:/Users/ur5m/Desktop/msys64/mingw64/x86_64-w64-mingw32/include/minwindef.h:163, >> from >> >> C:/Users/ur5m/Desktop/msys64/mingw64/x86_64-w64-mingw32/include/windef.h:8, >> from >> >> C:/Users/ur5m/Desktop/msys64/mingw64/x86_64-w64-mingw32/include/windows.h:69, >> from >> C:/Users/ur5m/Desktop/VTK64/VTK-8.1.2/Common/Core/vtkWindows.h:58, >> from >> >> C:\Users\ur5m\Desktop\VTK64\VTK-8.1.2\Rendering\OpenGL2\vtkWin32OpenGLRenderWindow.h:31, >> from >> >> C:\Users\ur5m\Desktop\VTK64\VTK-8.1.2\Rendering\OpenGL2\vtkWin32RenderWindowInteractor.cxx:26: >> >> C:\Users\ur5m\Desktop\VTK64\VTK-8.1.2\Rendering\OpenGL2\vtkWin32RenderWindowInteractor.cxx:73:16: >> error: redefinition of 'struct HTOUCHINPUT__' >> DECLARE_HANDLE(HTOUCHINPUT); >> ^~~~~~~~~~~ >> >> C:/Users/ur5m/Desktop/msys64/mingw64/x86_64-w64-mingw32/include/winuser.h:2681:3: >> note: previous definition of 'struct HTOUCHINPUT__' >> DECLARE_HANDLE (HTOUCHINPUT); >> ^~~~~~~~~~~~~~ >> >> C:\Users\ur5m\Desktop\VTK64\VTK-8.1.2\Rendering\OpenGL2\vtkWin32RenderWindowInteractor.cxx: >> In member function 'virtual int >> vtkWin32RenderWindowInteractor::OnTouch(HWND, UINT, UINT)': >> >> C:\Users\ur5m\Desktop\VTK64\VTK-8.1.2\Rendering\OpenGL2\vtkWin32RenderWindowInteractor.cxx:764:27: >> warning: cast to pointer from integer of different size >> [-Wint-to-pointer-cast] >> if (GTII((HTOUCHINPUT)lParam, cInputs, pInputs, sizeof(TOUCHINPUT))) >> ^~~~~~ >> >> C:\Users\ur5m\Desktop\VTK64\VTK-8.1.2\Rendering\OpenGL2\vtkWin32RenderWindowInteractor.cxx:819:23: >> warning: cast to pointer from integer of different size >> [-Wint-to-pointer-cast] >> CTIH((HTOUCHINPUT)lParam); >> ^~~~~~ >> mingw32-make[2]: *** >> [Rendering\OpenGL2\CMakeFiles\vtkRenderingOpenGL2.dir\build.make:1733: >> >> Rendering/OpenGL2/CMakeFiles/vtkRenderingOpenGL2.dir/vtkWin32RenderWindowInteractor.cxx.obj] >> Error 1 >> mingw32-make[1]: *** [CMakeFiles\Makefile2:2510: >> Rendering/OpenGL2/CMakeFiles/vtkRenderingOpenGL2.dir/all] Error 2 >> mingw32-make: *** [Makefile:129: all] Error 2 >> >> Any help will be much appreciated. Thanks. >> >> >> >> -- >> Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html >> _______________________________________________ >> Powered by www.kitware.com >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Please keep messages on-topic and check the VTK FAQ at: >> http://www.vtk.org/Wiki/VTK_FAQ >> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >> >> Follow this link to subscribe/unsubscribe: >> https://public.kitware.com/mailman/listinfo/vtkusers >> > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: > http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: From masterwangzx at gmail.com Tue Dec 11 03:52:43 2018 From: masterwangzx at gmail.com (Franks) Date: Tue, 11 Dec 2018 01:52:43 -0700 (MST) Subject: [vtkusers] How to generate the curved line by two points and vectors Message-ID: <1544518363269-0.post@n5.nabble.com> Hi, list I want to generate a curved line by VTK. Now I have the coordinates(xyz) of two points. One is the start point and the other one is the end point. The tangent vectors on two points are also known. Firstly, I use the vtkArcSource to generate the arc line. But sometimes the four elements can not just right define a circle. Now, I have no idea about this question. I am looking for your help. Best regards, Frank -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From romain.leguay at gmail.com Tue Dec 11 08:12:15 2018 From: romain.leguay at gmail.com (Romain LEGUAY) Date: Tue, 11 Dec 2018 14:12:15 +0100 Subject: [vtkusers] Yet another VTK, DICOM and Orientation problem Message-ID: Hello everyone, I'm trying to create a viewer of dicom with anatomical views (axial, sagittal and coronal) from a radiologist point of view. As starting point, I use the example provided in vtkDICOM module : testDicomDisplay . It uses vtkDICOMReader with SetMemoryRowOrderToFileNative activated. When I try to display an axial CT scan, I don't obtain expected orientation as you can see in pic1: the sagittal view is in Posterior -> Anterior direction. [image: pic1.png] When I try to display a sagittal CT scan, I have different orientations: [image: pic2.png] To fix this orientation problem, I tried to create some transformation matrices that converts Patient Coordinates (DICOM) to World Coordinate (VTK coordinates). To do this, I follow those steps: * get the patient matrix (Pm) using the method vtkDICOMReader::GetPatientMatrix (if I understand correctly, this matrix is in DICOM space) * create the rotation (Rm) from DICOM space to VTK space (rotation on VTK X-axis around the origin point): 1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 1 * Multiply Pm by Rm to obtain the matrix PRm to go from Patient Coordinates to VTK Coordinates. * Use the Matrix PRm with a point in IJK coordinates (voxel coordinates) multiplied by the spacing. I know I made a mistake because I don't have the result expected but I don't know what I did wrong... Can someone provide me some tips please? Thank you, Romain -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pic1.png Type: image/png Size: 572778 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pic2.png Type: image/png Size: 544089 bytes Desc: not available URL: From aron.helser at kitware.com Tue Dec 11 09:05:10 2018 From: aron.helser at kitware.com (Aron Helser) Date: Tue, 11 Dec 2018 09:05:10 -0500 Subject: [vtkusers] How to generate the curved line by two points and vectors In-Reply-To: <1544518363269-0.post@n5.nabble.com> References: <1544518363269-0.post@n5.nabble.com> Message-ID: Hi Frank, I think you want a spline? https://lorensen.github.io/VTKExamples/site/Cxx/PolyData/ParametricSpline/ HTH, Aron On Tue, Dec 11, 2018 at 3:52 AM Franks wrote: > Hi, list > > I want to generate a curved line by VTK. Now I have the coordinates(xyz) of > two points. One is the start point and the other one is the end point. The > tangent vectors on two points are also known. > > Firstly, I use the vtkArcSource to generate the arc line. But sometimes the > four elements can not just right define a circle. > > Now, I have no idea about this question. I am looking for your help. > > Best regards, > Frank > > > > > -- > Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: > http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: From msmerps at gmail.com Tue Dec 11 09:43:09 2018 From: msmerps at gmail.com (The Merper) Date: Tue, 11 Dec 2018 09:43:09 -0500 Subject: [vtkusers] VTK compatible LCD shutter glasses? Message-ID: Hi VTKers, I want to buy a pair of liquid crystal display (LCD) shutter glasses to use with VTK, but there don't seem to be many options available and it is not clear to me what glasses are compatible with VTK. Can anyone recommend a pair to get? Alternatively, does anyone know if NVIDIA's 3D vision glasses (version 1 or 2) will work with VTK? https://www.nvidia.com/object/3d-vision-glasses.html thank you for your help, -Merps -------------- next part -------------- An HTML attachment was scrubbed... URL: From sfaisal.ali91 at gmail.com Tue Dec 11 10:18:47 2018 From: sfaisal.ali91 at gmail.com (sfaisalali91) Date: Tue, 11 Dec 2018 08:18:47 -0700 (MST) Subject: [vtkusers] vtkBillboardTextActor3D - attach text while reslicing in viewer Message-ID: <1544541527024-0.post@n5.nabble.com> Please can anyone help me with Text actor representation, I want to attach the actor to image as that of point placer in image viewer. The closest i got was by implementing vtkCaptionActor2D in which the leader lines sync perfectly with image slicing but the text actor always remain on the top render layer. I tried many approaches to attach the text actor to image, but all in vain. your suggestions will be of great help. Thank you in advance. Regards Ali -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From kor1581 at gmail.com Tue Dec 11 11:11:43 2018 From: kor1581 at gmail.com (ran) Date: Tue, 11 Dec 2018 09:11:43 -0700 (MST) Subject: [vtkusers] How to restrict vtkGenericOpenGLRenderWindow area to vtkResliceImageViewer render window Message-ID: <1544544703564-0.post@n5.nabble.com> As part of an application for displaying DICOM images in Qt widget application in windows 10, I'm using vtkResliceImageViewer, custom vtkInteractorStyleImage, vtkGenericOpenGLRenderWindow, QVTKOpenGLWidget for displaying and fitting the images in Qt window. I also use vtkPlaneWidget, mriVtkLineWidget2 widgets inside the viewer. It is working properly, but the problem is While Initially set the coordinates for mriVtkLineWidget2 and vtkPlaneWidget objects it's correctly displaying inside the DICOM image displayed area. But when moving the widgets with mouse interactions, its rendering outside the vtkResliceImageViewer render area. But I need to restrict the widgets render area to DICOM image displayed area. I expect the problem is the DICOM image area displaying inside the vtkResliceImageViewer which DICOM images are displayed but vtkGenericOpenGLRenderWindow render area is present beyond that, is this right? How can I restrict widgets inside DICOM displaying area? My rendering code is something like this vtkNew m_openGlRenWin; vtkNew m_InteractorStyleWin; vtkNew m_vtkImViewerWin; QScopedPointer m_vtkWgtWin; vtkNew m_vtkPlaneWid; vtkNew m_Line; m_vtkWgtWin->SetRenderWindow(m_openGlRenWin); m_vtkImViewerWin->SetRenderWindow(m_openGlRenWin); m_vtkImViewerWin->SetupInteractor(m_openGlRenWin->GetInteractor()); m_openGlRenWin->GetInteractor()->SetInteractorStyle(m_InteractorStyleWin); m_vtkPlaneWid->SetInteractor(m_vtkImViewerWin->GetInteractor()); m_Line->SetInteractor(m_vtkImViewerWin->GetInteractor()); The code is not full, only included the relevant part, Please help to set restrict vtkGenericOpenGLRenderWindow render vtkResliceImageViewer render area. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From jcfr at kitware.com Tue Dec 11 11:56:48 2018 From: jcfr at kitware.com (Jean-Christophe Fillion-Robin) Date: Tue, 11 Dec 2018 11:56:48 -0500 Subject: [vtkusers] Yet another VTK, DICOM and Orientation problem In-Reply-To: References: Message-ID: Hi Romain, To learn which rotation matrix would be needed, you could load the dataset into 3d Slicer and inspect the direction cosine in the Volumes module. See https://download.slicer.org/ That said, considering that VTK is orientation-less (there are no direction cosines associated with vtkImageData), building an medical image viewer is a significant amount of work. Also worth noting that there is a proposal to add orientation into vtkImageData but some more validation is needed, see https://www.slicer.org/wiki/Documentation/Labs/VTK-Orientation Hth Jc On Tue, Dec 11, 2018 at 8:12 AM Romain LEGUAY wrote: > Hello everyone, > > I'm trying to create a viewer of dicom with anatomical views (axial, > sagittal and coronal) from a radiologist point of view. > > As starting point, I use the example provided in vtkDICOM module : > testDicomDisplay > > . > It uses vtkDICOMReader with SetMemoryRowOrderToFileNative activated. > > When I try to display an axial CT scan, I don't obtain expected > orientation as you can see in pic1: the sagittal view is in Posterior -> > Anterior direction. > [image: pic1.png] > > When I try to display a sagittal CT scan, I have different orientations: > [image: pic2.png] > > To fix this orientation problem, I tried to create some transformation > matrices that converts > Patient Coordinates (DICOM) to World Coordinate (VTK coordinates). > > To do this, I follow those steps: > * get the patient matrix (Pm) using the method > vtkDICOMReader::GetPatientMatrix (if I understand correctly, this matrix is > in DICOM space) > * create the rotation (Rm) from DICOM space to VTK space (rotation on VTK > X-axis around the origin point): > 1 0 0 0 > 0 -1 0 0 > 0 0 -1 0 > 0 0 0 1 > * Multiply Pm by Rm to obtain the matrix PRm to go from Patient > Coordinates to VTK Coordinates. > * Use the Matrix PRm with a point in IJK coordinates (voxel coordinates) > multiplied by the spacing. > > I know I made a mistake because I don't have the result expected but I > don't know what I did wrong... > > Can someone provide me some tips please? > > Thank you, > > Romain > > > > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: > http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pic1.png Type: image/png Size: 572778 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pic2.png Type: image/png Size: 544089 bytes Desc: not available URL: From dave.demarle at kitware.com Tue Dec 11 13:01:41 2018 From: dave.demarle at kitware.com (David E DeMarle) Date: Tue, 11 Dec 2018 13:01:41 -0500 Subject: [vtkusers] announce: expect some website and gitlab downtime this coming weekend Message-ID: Hey VTK folks, Kitware NY is moving into a new office building this weekend. This involves moving the company's network infrastructure. As a result, there will be some downtime in terms of the webpage, gitlab, and the dashboard machines. Our web servers (www.kitware.com, CMake, ParaView, VTK, ITK, etc. etc.) will be unavailable all day Dec. 15th while we physically move everything and complete the network cutover. We will set up a ?we are moving? page warning visitors to many of our primary external web sites that we are temporarily offline for maintenance. We are estimating the move to take 8 hours, give or take several hours. There is a good chance of network connectivity being unstable for a few days afterwards while we troubleshoot and fix any issues. Thanks and apologies ahead of time for any disruptions. David E DeMarle Kitware, Inc. Principal Engineer 21 Corporate Drive Clifton Park, NY 12065-8662 Phone: 518-881-4909 -------------- next part -------------- An HTML attachment was scrubbed... URL: From kor1581 at gmail.com Wed Dec 12 00:55:05 2018 From: kor1581 at gmail.com (ran) Date: Tue, 11 Dec 2018 22:55:05 -0700 (MST) Subject: [vtkusers] How to restrict vtkGenericOpenGLRenderWindow area to vtkResliceImageViewer render window Message-ID: <1544594105811-0.post@n5.nabble.com> As part of an application for displaying DICOM images in Qt widget in windows 10, I'm using vtkResliceImageViewer, custom vtkInteractorStyleImage, vtkGenericOpenGLRenderWindow, QVTKOpenGLWidget for displaying and fitting the images in Qt window. I also use vtkPlaneWidget, mriVtkLineWidget2 widgets inside the DICOM viewer. It is working properly, but the problem iswWhile Initially set the coordinates for mriVtkLineWidget2 and vtkPlaneWidget objects it's correctly displaying inside the DICOM image displayed area. But when moving the widgets with mouse interactions, its rendering outside the DICOM image rendered area. But I need to restrict the widgets movement within the DICOM image displayed area, ie within vtkResliceImageViewer render window. I expect the problem is the DICOM image displaying inside the vtkResliceImageViewer render window and the vtkGenericOpenGLRenderWindow render window extends beyond vtkResliceImageViewer render window, that's because the widgets can move beyond the DICOM displayed region. How can I restrict widgets inside DICOM displaying area? My rendering code is something like this, vtkNew m_openGlRenWin; vtkNew m_InteractorStyleWin; vtkNew m_vtkImViewerWin; QScopedPointer m_vtkWgtWin; vtkNew m_vtkPlaneWid; vtkNew m_Line; m_vtkWgtWin->SetRenderWindow(m_openGlRenWin); m_vtkImViewerWin->SetRenderWindow(m_openGlRenWin); m_vtkImViewerWin->SetupInteractor(m_openGlRenWin->GetInteractor()); m_openGlRenWin->GetInteractor()->SetInteractorStyle(m_InteractorStyleWin); m_vtkPlaneWid->SetInteractor(m_vtkImViewerWin->GetInteractor()); m_Line->SetInteractor(m_vtkImViewerWin->GetInteractor()); The code is not full, the only relevant part is included. Before I have implemented the same application with QVTKWidget instead of vtkGenericOpenGLRenderWindow & QVTKOpenGLWidget at that time by default the widget movement was restricted within vtkInteractorStyleImage. By latest VTK release I can't use QVTKWidget so changed to vtkGenericOpenGLRenderWindow & QVTKOpenGLWidget, then the problem occurred. Please help to restrict the widget movement. Is it possible to set vtkGenericOpenGLRenderWindow render area to vtkResliceImageViewer render area? -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From Zoltan.Kovacs at esi-group.com Wed Dec 12 05:39:43 2018 From: Zoltan.Kovacs at esi-group.com (Zoltan Kovacs) Date: Wed, 12 Dec 2018 10:39:43 +0000 Subject: [vtkusers] Color settting in vtkParallelCoordinatesRepresentation Message-ID: Dear All, I try to use the class vtkParallelCoordinatesRepresentation which has the member functions SetLineColor and SetAxisColor for color settings. However, I would like to use a color bar for class vtkParallelCoordinatesView and use the colors from the color bar for coloring the selected lines. I have found the internal array vtkParallelCoordinatesRepresentation::Internals::Colors[10][3] in the source code of the class vtkParallelCoordinatesRepresentation which is used for selections in the function UpdatePlotProperties setting the colors for the internal array of the SelectionActors of the vtkParallelCoordinatesRepresentation but I could not figure out how to use them. Maybe some one knows a way how to set colors for the selected lines. Thank you very much! Kind regards, Zoltan -------------- next part -------------- An HTML attachment was scrubbed... URL: From A.Buykx at dianafea.com Wed Dec 12 09:51:51 2018 From: A.Buykx at dianafea.com (Andreas Buykx) Date: Wed, 12 Dec 2018 14:51:51 +0000 Subject: [vtkusers] vtkTestOpenGLVersion header not installed? Message-ID: <0da45091d8864d7c8ea02f4f95d3dff9@dianafea.com> I would like to use the new delayed loading of OpenGL, but found that even when I build VTK with the VTK_USE_OPENGL_DELAYED_LOAD flag the header is not installed in the include directory even though the vtkTestOpenGLVersion.exe is built, so I have to pull it in from the source tree I suppose. Is this intentional? Also I found that it was already available in the 8.1.1 release, but only for the 8.2 release candidate it has been explicitly mentioned. Is the 8.1.1 version OK to use? Thanks! Andreas DIANA FEA BV Software Developers and Analysis Consultants for Civil and Geotechnical Engineering Delftechpark 19a, 2628XJ, Delft, The Netherlands Tel: +31 88 34262 15 (Direct) ? Tel: +31 88 34262 00 (Switchboard) ? Fax: +31 88 34262 99 http://dianafea.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From sk.shadabanwar at gmail.com Wed Dec 12 13:40:29 2018 From: sk.shadabanwar at gmail.com (shadab anwar) Date: Wed, 12 Dec 2018 13:40:29 -0500 Subject: [vtkusers] Problem with color and shading when rendering vtkimagedata In-Reply-To: References: Message-ID: Guys, Waiting for reply! Please help! On Wed, Dec 5, 2018 at 2:08 PM shadab anwar wrote: > Hey amigos, > > VTK noob here! > > I facing a few problems while rendering vtkimagedata. The code snippet as > follows, > > > int X =4, Y=4, Z=4; > > imageData->SetDimensions(X,Y,Z); > > imageData->SetSpacing(1,1,1); > > imageData->AllocateScalars(VTK_INT,1); > > > > for (int k = 0; k < Z ; k++) > > { > > for (int j = 0; j < Y ; j++) > > { > > for (int i = 0; i < X ; i++) > > { > > int* voxel = static_cast(imageData->GetScalarPointer(i, j, k)); > > voxel[0] = 10; > > > } > > } > > } > > > for (int i=2;i!=-1;i--) > > { > > int* voxel = static_cast(imageData->GetScalarPointer(2,i,i)); > > voxel[0]=0; > > } > > > mapper->SetBlendModeToComposite(); > > mapper->SetRequestedRenderModeToRayCast(); > > mapper->SetInputData(imageData); > > compositeOpacity->AddPoint(10,1); > > color->AddRGBPoint(10,1,0,0); > > compositeOpacity->AddPoint(0,0); > > color->AddRGBPoint(0,0,0, 0); > > volumeProperty->SetAmbient(0.3); > > volumeProperty->SetDiffuse(0.4); > > volumeProperty->SetSpecular(0.8); > > volumeProperty->SetInterpolationType(0); > > volumeProperty->ShadeOn(); > > volumeProperty->SetColor(color); > > volumeProperty->SetScalarOpacity(compositeOpacity); > > renderer->SetBackground(0.5, 0.5, 0.5); > > volume->SetMapper(mapper); > > volume->SetProperty(volumeProperty); > > renderer->AddViewProp(volume); > > I am getting the below results, > > > [image: image for forum.jpg] [image: image for forum2.jpg] > [image: image for forum3.jpg] > > > It can be seen that everytime I rotate my image I don't get a proper > shading and color for the object. I have tried changing the lightining > properties and shading properties but no sucess. > > I would be really thankful if anyone could help me. > > > Just for your information I am mechanical engineering with a bit of programming knowledge, so if my question is irrattional please forgive me. > > > > > Best, > > Shadab > > > > > > > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From aron.helser at kitware.com Wed Dec 12 16:05:56 2018 From: aron.helser at kitware.com (Aron Helser) Date: Wed, 12 Dec 2018 16:05:56 -0500 Subject: [vtkusers] Problem with color and shading when rendering vtkimagedata In-Reply-To: References: Message-ID: Can you be more specific? How do the images differ from what you expect? Is there are particular VTK example you are following that you are trying to change? https://lorensen.github.io/VTKExamples/site/Cxx/ Aron On Wed, Dec 12, 2018 at 1:40 PM shadab anwar wrote: > Guys, > Waiting for reply! > > Please help! > > > > > On Wed, Dec 5, 2018 at 2:08 PM shadab anwar > wrote: > >> Hey amigos, >> >> VTK noob here! >> >> I facing a few problems while rendering vtkimagedata. The code snippet as >> follows, >> >> >> int X =4, Y=4, Z=4; >> >> imageData->SetDimensions(X,Y,Z); >> >> imageData->SetSpacing(1,1,1); >> >> imageData->AllocateScalars(VTK_INT,1); >> >> >> >> for (int k = 0; k < Z ; k++) >> >> { >> >> for (int j = 0; j < Y ; j++) >> >> { >> >> for (int i = 0; i < X ; i++) >> >> { >> >> int* voxel = static_cast(imageData->GetScalarPointer(i, j, k)); >> >> voxel[0] = 10; >> >> >> } >> >> } >> >> } >> >> >> for (int i=2;i!=-1;i--) >> >> { >> >> int* voxel = static_cast(imageData->GetScalarPointer(2,i,i)); >> >> voxel[0]=0; >> >> } >> >> >> mapper->SetBlendModeToComposite(); >> >> mapper->SetRequestedRenderModeToRayCast(); >> >> mapper->SetInputData(imageData); >> >> compositeOpacity->AddPoint(10,1); >> >> color->AddRGBPoint(10,1,0,0); >> >> compositeOpacity->AddPoint(0,0); >> >> color->AddRGBPoint(0,0,0, 0); >> >> volumeProperty->SetAmbient(0.3); >> >> volumeProperty->SetDiffuse(0.4); >> >> volumeProperty->SetSpecular(0.8); >> >> volumeProperty->SetInterpolationType(0); >> >> volumeProperty->ShadeOn(); >> >> volumeProperty->SetColor(color); >> >> volumeProperty->SetScalarOpacity(compositeOpacity); >> >> renderer->SetBackground(0.5, 0.5, 0.5); >> >> volume->SetMapper(mapper); >> >> volume->SetProperty(volumeProperty); >> >> renderer->AddViewProp(volume); >> >> I am getting the below results, >> >> >> [image: image for forum.jpg] [image: image for forum2.jpg] >> [image: image for forum3.jpg] >> >> >> It can be seen that everytime I rotate my image I don't get a proper >> shading and color for the object. I have tried changing the lightining >> properties and shading properties but no sucess. >> >> I would be really thankful if anyone could help me. >> >> >> Just for your information I am mechanical engineering with a bit of programming knowledge, so if my question is irrattional please forgive me. >> >> >> >> >> Best, >> >> Shadab >> >> >> >> >> >> >> >> >> >> >> >> >> _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: > http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sk.shadabanwar at gmail.com Wed Dec 12 16:15:41 2018 From: sk.shadabanwar at gmail.com (shadab anwar) Date: Wed, 12 Dec 2018 16:15:41 -0500 Subject: [vtkusers] Problem with color and shading when rendering vtkimagedata In-Reply-To: References: Message-ID: Hi Aron, Thanks for your reply. I am not using any specific example. I am trying to render voxels using imagedata, I have used the above code for doing so. The problem I am facing is that whenever I rotate the image after rendering I don't get proper shading and uniform coloring. Instead, I am getting above rendering results, where you can see the few voxels are shaded as black! I am not able to understand where I am going wrong. I tried changing few shading and lighting parameters but no success. I am a newbie, apology If my problem is too basic! On Wed, Dec 12, 2018 at 4:06 PM Aron Helser wrote: > Can you be more specific? How do the images differ from what you expect? > Is there are particular VTK example you are following that you are trying > to change? > https://lorensen.github.io/VTKExamples/site/Cxx/ > > Aron > > On Wed, Dec 12, 2018 at 1:40 PM shadab anwar > wrote: > >> Guys, >> Waiting for reply! >> >> Please help! >> >> >> >> >> On Wed, Dec 5, 2018 at 2:08 PM shadab anwar >> wrote: >> >>> Hey amigos, >>> >>> VTK noob here! >>> >>> I facing a few problems while rendering vtkimagedata. The code snippet >>> as follows, >>> >>> >>> int X =4, Y=4, Z=4; >>> >>> imageData->SetDimensions(X,Y,Z); >>> >>> imageData->SetSpacing(1,1,1); >>> >>> imageData->AllocateScalars(VTK_INT,1); >>> >>> >>> >>> for (int k = 0; k < Z ; k++) >>> >>> { >>> >>> for (int j = 0; j < Y ; j++) >>> >>> { >>> >>> for (int i = 0; i < X ; i++) >>> >>> { >>> >>> int* voxel = static_cast(imageData->GetScalarPointer(i, j, k)); >>> >>> voxel[0] = 10; >>> >>> >>> } >>> >>> } >>> >>> } >>> >>> >>> for (int i=2;i!=-1;i--) >>> >>> { >>> >>> int* voxel = static_cast(imageData->GetScalarPointer(2,i,i)); >>> >>> voxel[0]=0; >>> >>> } >>> >>> >>> mapper->SetBlendModeToComposite(); >>> >>> mapper->SetRequestedRenderModeToRayCast(); >>> >>> mapper->SetInputData(imageData); >>> >>> compositeOpacity->AddPoint(10,1); >>> >>> color->AddRGBPoint(10,1,0,0); >>> >>> compositeOpacity->AddPoint(0,0); >>> >>> color->AddRGBPoint(0,0,0, 0); >>> >>> volumeProperty->SetAmbient(0.3); >>> >>> volumeProperty->SetDiffuse(0.4); >>> >>> volumeProperty->SetSpecular(0.8); >>> >>> volumeProperty->SetInterpolationType(0); >>> >>> volumeProperty->ShadeOn(); >>> >>> volumeProperty->SetColor(color); >>> >>> volumeProperty->SetScalarOpacity(compositeOpacity); >>> >>> renderer->SetBackground(0.5, 0.5, 0.5); >>> >>> volume->SetMapper(mapper); >>> >>> volume->SetProperty(volumeProperty); >>> >>> renderer->AddViewProp(volume); >>> >>> I am getting the below results, >>> >>> >>> [image: image for forum.jpg] [image: image for forum2.jpg] >>> [image: image for forum3.jpg] >>> >>> >>> It can be seen that everytime I rotate my image I don't get a proper >>> shading and color for the object. I have tried changing the lightining >>> properties and shading properties but no sucess. >>> >>> I would be really thankful if anyone could help me. >>> >>> >>> Just for your information I am mechanical engineering with a bit of programming knowledge, so if my question is irrattional please forgive me. >>> >>> >>> >>> >>> Best, >>> >>> Shadab >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> _______________________________________________ >> Powered by www.kitware.com >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Please keep messages on-topic and check the VTK FAQ at: >> http://www.vtk.org/Wiki/VTK_FAQ >> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >> >> Follow this link to subscribe/unsubscribe: >> https://public.kitware.com/mailman/listinfo/vtkusers >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From aron.helser at kitware.com Wed Dec 12 17:51:14 2018 From: aron.helser at kitware.com (Aron Helser) Date: Wed, 12 Dec 2018 17:51:14 -0500 Subject: [vtkusers] Problem with color and shading when rendering vtkimagedata In-Reply-To: References: Message-ID: I have no experience with volume rendering in vtk, so my best suggestion is to look at some of the examples: https://lorensen.github.io/VTKExamples/site/Cxx/#volume-rendering and see how the parameters are set there, compared to your code. You might have success modifying one of the examples to use your data. On Wed, Dec 12, 2018 at 4:15 PM shadab anwar wrote: > Hi Aron, > Thanks for your reply. > I am not using any specific example. > > I am trying to render voxels using imagedata, I have used the above code > for doing so. > The problem I am facing is that whenever I rotate the image after > rendering I don't get proper shading and uniform coloring. Instead, I am > getting above rendering results, where you can see the few voxels are > shaded as black! > I am not able to understand where I am going wrong. I tried changing > few shading and lighting parameters but no success. > > I am a newbie, apology If my problem is too basic! > > > On Wed, Dec 12, 2018 at 4:06 PM Aron Helser > wrote: > >> Can you be more specific? How do the images differ from what you expect? >> Is there are particular VTK example you are following that you are trying >> to change? >> https://lorensen.github.io/VTKExamples/site/Cxx/ >> >> Aron >> >> On Wed, Dec 12, 2018 at 1:40 PM shadab anwar >> wrote: >> >>> Guys, >>> Waiting for reply! >>> >>> Please help! >>> >>> >>> >>> >>> On Wed, Dec 5, 2018 at 2:08 PM shadab anwar >>> wrote: >>> >>>> Hey amigos, >>>> >>>> VTK noob here! >>>> >>>> I facing a few problems while rendering vtkimagedata. The code snippet >>>> as follows, >>>> >>>> >>>> int X =4, Y=4, Z=4; >>>> >>>> imageData->SetDimensions(X,Y,Z); >>>> >>>> imageData->SetSpacing(1,1,1); >>>> >>>> imageData->AllocateScalars(VTK_INT,1); >>>> >>>> >>>> >>>> for (int k = 0; k < Z ; k++) >>>> >>>> { >>>> >>>> for (int j = 0; j < Y ; j++) >>>> >>>> { >>>> >>>> for (int i = 0; i < X ; i++) >>>> >>>> { >>>> >>>> int* voxel = static_cast(imageData->GetScalarPointer(i, j, k)); >>>> >>>> voxel[0] = 10; >>>> >>>> >>>> } >>>> >>>> } >>>> >>>> } >>>> >>>> >>>> for (int i=2;i!=-1;i--) >>>> >>>> { >>>> >>>> int* voxel = static_cast(imageData->GetScalarPointer(2,i,i)); >>>> >>>> voxel[0]=0; >>>> >>>> } >>>> >>>> >>>> mapper->SetBlendModeToComposite(); >>>> >>>> mapper->SetRequestedRenderModeToRayCast(); >>>> >>>> mapper->SetInputData(imageData); >>>> >>>> compositeOpacity->AddPoint(10,1); >>>> >>>> color->AddRGBPoint(10,1,0,0); >>>> >>>> compositeOpacity->AddPoint(0,0); >>>> >>>> color->AddRGBPoint(0,0,0, 0); >>>> >>>> volumeProperty->SetAmbient(0.3); >>>> >>>> volumeProperty->SetDiffuse(0.4); >>>> >>>> volumeProperty->SetSpecular(0.8); >>>> >>>> volumeProperty->SetInterpolationType(0); >>>> >>>> volumeProperty->ShadeOn(); >>>> >>>> volumeProperty->SetColor(color); >>>> >>>> volumeProperty->SetScalarOpacity(compositeOpacity); >>>> >>>> renderer->SetBackground(0.5, 0.5, 0.5); >>>> >>>> volume->SetMapper(mapper); >>>> >>>> volume->SetProperty(volumeProperty); >>>> >>>> renderer->AddViewProp(volume); >>>> >>>> I am getting the below results, >>>> >>>> >>>> [image: image for forum.jpg] [image: image for forum2.jpg] >>>> [image: image for forum3.jpg] >>>> >>>> >>>> It can be seen that everytime I rotate my image I don't get a proper >>>> shading and color for the object. I have tried changing the lightining >>>> properties and shading properties but no sucess. >>>> >>>> I would be really thankful if anyone could help me. >>>> >>>> >>>> Just for your information I am mechanical engineering with a bit of programming knowledge, so if my question is irrattional please forgive me. >>>> >>>> >>>> >>>> >>>> Best, >>>> >>>> Shadab >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>> Powered by www.kitware.com >>> >>> Visit other Kitware open-source projects at >>> http://www.kitware.com/opensource/opensource.html >>> >>> Please keep messages on-topic and check the VTK FAQ at: >>> http://www.vtk.org/Wiki/VTK_FAQ >>> >>> Search the list archives at: http://markmail.org/search/?q=vtkusers >>> >>> Follow this link to subscribe/unsubscribe: >>> https://public.kitware.com/mailman/listinfo/vtkusers >>> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From sk.shadabanwar at gmail.com Wed Dec 12 18:00:07 2018 From: sk.shadabanwar at gmail.com (shadab anwar) Date: Wed, 12 Dec 2018 18:00:07 -0500 Subject: [vtkusers] Problem with color and shading when rendering vtkimagedata In-Reply-To: References: Message-ID: Aron, Thanks! I have been through these examples. I'll be happy if you can suggest my question to someone who has an experience in volume rendering. Thanks, Shadab On Wed, Dec 12, 2018 at 5:51 PM Aron Helser wrote: > I have no experience with volume rendering in vtk, so my best suggestion > is to look at some of the examples: > https://lorensen.github.io/VTKExamples/site/Cxx/#volume-rendering > and see how the parameters are set there, compared to your code. > You might have success modifying one of the examples to use your data. > > On Wed, Dec 12, 2018 at 4:15 PM shadab anwar > wrote: > >> Hi Aron, >> Thanks for your reply. >> I am not using any specific example. >> >> I am trying to render voxels using imagedata, I have used the above code >> for doing so. >> The problem I am facing is that whenever I rotate the image after >> rendering I don't get proper shading and uniform coloring. Instead, I am >> getting above rendering results, where you can see the few voxels are >> shaded as black! >> I am not able to understand where I am going wrong. I tried changing >> few shading and lighting parameters but no success. >> >> I am a newbie, apology If my problem is too basic! >> >> >> On Wed, Dec 12, 2018 at 4:06 PM Aron Helser >> wrote: >> >>> Can you be more specific? How do the images differ from what you expect? >>> Is there are particular VTK example you are following that you are trying >>> to change? >>> https://lorensen.github.io/VTKExamples/site/Cxx/ >>> >>> Aron >>> >>> On Wed, Dec 12, 2018 at 1:40 PM shadab anwar >>> wrote: >>> >>>> Guys, >>>> Waiting for reply! >>>> >>>> Please help! >>>> >>>> >>>> >>>> >>>> On Wed, Dec 5, 2018 at 2:08 PM shadab anwar >>>> wrote: >>>> >>>>> Hey amigos, >>>>> >>>>> VTK noob here! >>>>> >>>>> I facing a few problems while rendering vtkimagedata. The code snippet >>>>> as follows, >>>>> >>>>> >>>>> int X =4, Y=4, Z=4; >>>>> >>>>> imageData->SetDimensions(X,Y,Z); >>>>> >>>>> imageData->SetSpacing(1,1,1); >>>>> >>>>> imageData->AllocateScalars(VTK_INT,1); >>>>> >>>>> >>>>> >>>>> for (int k = 0; k < Z ; k++) >>>>> >>>>> { >>>>> >>>>> for (int j = 0; j < Y ; j++) >>>>> >>>>> { >>>>> >>>>> for (int i = 0; i < X ; i++) >>>>> >>>>> { >>>>> >>>>> int* voxel = static_cast(imageData->GetScalarPointer(i, j, k)); >>>>> >>>>> voxel[0] = 10; >>>>> >>>>> >>>>> } >>>>> >>>>> } >>>>> >>>>> } >>>>> >>>>> >>>>> for (int i=2;i!=-1;i--) >>>>> >>>>> { >>>>> >>>>> int* voxel = static_cast(imageData->GetScalarPointer(2,i,i)); >>>>> >>>>> voxel[0]=0; >>>>> >>>>> } >>>>> >>>>> >>>>> mapper->SetBlendModeToComposite(); >>>>> >>>>> mapper->SetRequestedRenderModeToRayCast(); >>>>> >>>>> mapper->SetInputData(imageData); >>>>> >>>>> compositeOpacity->AddPoint(10,1); >>>>> >>>>> color->AddRGBPoint(10,1,0,0); >>>>> >>>>> compositeOpacity->AddPoint(0,0); >>>>> >>>>> color->AddRGBPoint(0,0,0, 0); >>>>> >>>>> volumeProperty->SetAmbient(0.3); >>>>> >>>>> volumeProperty->SetDiffuse(0.4); >>>>> >>>>> volumeProperty->SetSpecular(0.8); >>>>> >>>>> volumeProperty->SetInterpolationType(0); >>>>> >>>>> volumeProperty->ShadeOn(); >>>>> >>>>> volumeProperty->SetColor(color); >>>>> >>>>> volumeProperty->SetScalarOpacity(compositeOpacity); >>>>> >>>>> renderer->SetBackground(0.5, 0.5, 0.5); >>>>> >>>>> volume->SetMapper(mapper); >>>>> >>>>> volume->SetProperty(volumeProperty); >>>>> >>>>> renderer->AddViewProp(volume); >>>>> >>>>> I am getting the below results, >>>>> >>>>> >>>>> [image: image for forum.jpg] [image: image for forum2.jpg] >>>>> [image: image for forum3.jpg] >>>>> >>>>> >>>>> It can be seen that everytime I rotate my image I don't get a proper >>>>> shading and color for the object. I have tried changing the lightining >>>>> properties and shading properties but no sucess. >>>>> >>>>> I would be really thankful if anyone could help me. >>>>> >>>>> >>>>> Just for your information I am mechanical engineering with a bit of programming knowledge, so if my question is irrattional please forgive me. >>>>> >>>>> >>>>> >>>>> >>>>> Best, >>>>> >>>>> Shadab >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>> Powered by www.kitware.com >>>> >>>> Visit other Kitware open-source projects at >>>> http://www.kitware.com/opensource/opensource.html >>>> >>>> Please keep messages on-topic and check the VTK FAQ at: >>>> http://www.vtk.org/Wiki/VTK_FAQ >>>> >>>> Search the list archives at: http://markmail.org/search/?q=vtkusers >>>> >>>> Follow this link to subscribe/unsubscribe: >>>> https://public.kitware.com/mailman/listinfo/vtkusers >>>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From poweruserm at live.com.au Wed Dec 12 20:07:45 2018 From: poweruserm at live.com.au (A Z) Date: Thu, 13 Dec 2018 01:07:45 +0000 Subject: [vtkusers] VTK compiled libraries? Message-ID: To who in VTK it concerns, My professional situationis such that my PC can't be allowed to install compiling tools like cygwin. Because of this, I am not in a position to compile and build the vtk library for Windows from source. Because of this situation, is it possible for VTK to compile and build the VTK in a 64 bit .dll file form, and to avail that for public download? Could someone specifically reply to my question on this issue when it applies in the email list, kindly? -------------- next part -------------- An HTML attachment was scrubbed... URL: From nztoddler at yahoo.com Wed Dec 12 20:16:21 2018 From: nztoddler at yahoo.com (Todd Martin) Date: Thu, 13 Dec 2018 01:16:21 +0000 (UTC) Subject: [vtkusers] VTK compiled libraries? In-Reply-To: References: Message-ID: <466063117.3743877.1544663781728@mail.yahoo.com> If you cannot install compiler tools, how do you intend to use VTK?The easiest way to build VTK on windows is using Visual Studio. Then there's no need for cygwin. Todd Martin, PhD. Freelance Engineer/Software Architect. On Thursday, 13 December 2018, 2:07:56 PM NZDT, A Z wrote: #yiv6854767267 P {margin-top:0;margin-bottom:0;}To who in VTK it concerns, My professional situationis such that my PC can't be allowed to installcompiling tools like cygwin. Because of this, I am not in a position to compile and build the vtk libraryfor Windows from source. Because of this situation, is it possible for VTK to compile and buildthe VTK in a 64 bit .dll file form, and to avail that for public download? Could someone specifically reply to my question on this issuewhen it applies in the email list, kindly? _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ Search the list archives at: http://markmail.org/search/?q=vtkusers Follow this link to subscribe/unsubscribe: https://public.kitware.com/mailman/listinfo/vtkusers -------------- next part -------------- An HTML attachment was scrubbed... URL: From sebastien.jourdain at kitware.com Wed Dec 12 22:42:11 2018 From: sebastien.jourdain at kitware.com (Sebastien Jourdain) Date: Wed, 12 Dec 2018 20:42:11 -0700 Subject: [vtkusers] VTK compiled libraries? In-Reply-To: <466063117.3743877.1544663781728@mail.yahoo.com> References: <466063117.3743877.1544663781728@mail.yahoo.com> Message-ID: You can also download ParaView and use the pvpython executable if you are planning to use VTK via Python. On Wed, Dec 12, 2018 at 6:16 PM Todd Martin via vtkusers < vtkusers at public.kitware.com> wrote: > If you cannot install compiler tools, how do you intend to use VTK? > The easiest way to build VTK on windows is using Visual Studio. Then > there's no need for cygwin. > > Todd Martin, PhD. > *Freelance Engineer/Software Architect.* > > > > On Thursday, 13 December 2018, 2:07:56 PM NZDT, A Z < > poweruserm at live.com.au> wrote: > > > To who in VTK it concerns, > > My professional situationis such that my PC can't be allowed to install > compiling tools like cygwin. > > Because of this, I am not in a position to compile and build the vtk > library > for Windows from source. > > Because of this situation, is it possible for VTK to compile and build > the VTK in a 64 bit .dll file form, and to avail that for public download? > > Could someone specifically reply to my question on this issue > when it applies in the email list, kindly? > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: > http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: > http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ftpronk at engits.com Thu Dec 13 04:28:31 2018 From: ftpronk at engits.com (Fcs) Date: Thu, 13 Dec 2018 02:28:31 -0700 (MST) Subject: [vtkusers] VTK compiled libraries? In-Reply-To: References: Message-ID: <1544693311280-0.post@n5.nabble.com> This sounds pointless.. How are you going to access the VTK libraries if you cannot compile a program and link to the libraries? And if your system doesn't allow you to install cygwin, why would it allow you to install external dlls? Anyway, more constructively, if you do have some basic installation rights, you could try a stand-alone python install, and grab the vtk libraries compatible with that version. I don't know if conda/miniconda qualifies, but you could give it a try. Perhaps portablepython would work too. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From rubendibattista at gmail.com Thu Dec 13 04:31:07 2018 From: rubendibattista at gmail.com (Ruben Di Battista) Date: Thu, 13 Dec 2018 10:31:07 +0100 Subject: [vtkusers] VTK compiled libraries? In-Reply-To: References: Message-ID: I could be wrong, but I think cygwin doesn't require admin rights to be installed. On Thu, 13 Dec 2018, 02:07 A Z To who in VTK it concerns, > > My professional situationis such that my PC can't be allowed to install > compiling tools like cygwin. > > Because of this, I am not in a position to compile and build the vtk > library > for Windows from source. > > Because of this situation, is it possible for VTK to compile and build > the VTK in a 64 bit .dll file form, and to avail that for public download? > > Could someone specifically reply to my question on this issue > when it applies in the email list, kindly? > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: > http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rubendibattista at gmail.com Thu Dec 13 08:44:33 2018 From: rubendibattista at gmail.com (Ruben Di Battista) Date: Thu, 13 Dec 2018 14:44:33 +0100 Subject: [vtkusers] VTK compiled libraries? In-Reply-To: References: Message-ID: Just to keep the discussion in the mailing list... :) On Thu, 13 Dec 2018, 14:37 Paulo Carvalho I installed MSYS2 without admin privileges. From its bash console, you > can do a pacman -S mingw-w64-x86_64-vtk to install VTK precompiled > libraries. Then you can look into where MSYS2 keeps the libraries (look > for the files in MSYS2's installation directories). That package is for > linking with MinGW64 (.a files). > > Em qui, 13 de dez de 2018 ?s 07:31, Ruben Di Battista < > rubendibattista at gmail.com> escreveu: > >> I could be wrong, but I think cygwin doesn't require admin rights to be >> installed. >> >> On Thu, 13 Dec 2018, 02:07 A Z > >>> To who in VTK it concerns, >>> >>> My professional situationis such that my PC can't be allowed to install >>> compiling tools like cygwin. >>> >>> Because of this, I am not in a position to compile and build the vtk >>> library >>> for Windows from source. >>> >>> Because of this situation, is it possible for VTK to compile and build >>> the VTK in a 64 bit .dll file form, and to avail that for public >>> download? >>> >>> Could someone specifically reply to my question on this issue >>> when it applies in the email list, kindly? >>> >>> _______________________________________________ >>> Powered by www.kitware.com >>> >>> Visit other Kitware open-source projects at >>> http://www.kitware.com/opensource/opensource.html >>> >>> Please keep messages on-topic and check the VTK FAQ at: >>> http://www.vtk.org/Wiki/VTK_FAQ >>> >>> Search the list archives at: http://markmail.org/search/?q=vtkusers >>> >>> Follow this link to subscribe/unsubscribe: >>> https://public.kitware.com/mailman/listinfo/vtkusers >>> >> _______________________________________________ >> Powered by www.kitware.com >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Please keep messages on-topic and check the VTK FAQ at: >> http://www.vtk.org/Wiki/VTK_FAQ >> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >> >> Follow this link to subscribe/unsubscribe: >> https://public.kitware.com/mailman/listinfo/vtkusers >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From divyarathore at gmail.com Thu Dec 13 10:20:29 2018 From: divyarathore at gmail.com (Divya Rathore) Date: Thu, 13 Dec 2018 15:20:29 +0000 Subject: [vtkusers] VTK compiled libraries? In-Reply-To: References: Message-ID: How about using Paraview? Can't recall if it has a installer that requires admin privilege. Best regards, Divya On Thu, 13 Dec 2018, 1:07 am A Z To who in VTK it concerns, > > My professional situationis such that my PC can't be allowed to install > compiling tools like cygwin. > > Because of this, I am not in a position to compile and build the vtk > library > for Windows from source. > > Because of this situation, is it possible for VTK to compile and build > the VTK in a 64 bit .dll file form, and to avail that for public download? > > Could someone specifically reply to my question on this issue > when it applies in the email list, kindly? > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: > http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: From raimonds at cenos-platform.com Thu Dec 13 11:00:35 2018 From: raimonds at cenos-platform.com (Raimonds Vilums) Date: Thu, 13 Dec 2018 18:00:35 +0200 Subject: [vtkusers] vtk.js: display particular cells with alpha/transparency/opacity Message-ID: Hi, Is it possible to display cells with custom opacity for each cell? Till now, I managed 1) set opacity to the actor (e.g., actor.getProperty().setOpacity(0.5)) 2) color cells with solid colors, e.g: - vtk file contains CELL_DATA array of floats with 3 components for every color - mapper.setColorModeToDirectScalars(); - mapper.setScalarModeToUseCellFieldData(); - mapper.setColorByArrayName('my_cell_data'); But I could not find a way to set alpha/opacity/transparency for particular cells. Is it possible? Regards, Raimonds -------------- next part -------------- An HTML attachment was scrubbed... URL: From sebastien.jourdain at kitware.com Thu Dec 13 11:09:50 2018 From: sebastien.jourdain at kitware.com (Sebastien Jourdain) Date: Thu, 13 Dec 2018 09:09:50 -0700 Subject: [vtkusers] vtk.js: display particular cells with alpha/transparency/opacity In-Reply-To: References: Message-ID: You should be able to have an array with 4 components (RGBA) On Thu, Dec 13, 2018 at 9:01 AM Raimonds Vilums wrote: > Hi, > > Is it possible to display cells with custom opacity for each cell? > > Till now, I managed > 1) set opacity to the actor (e.g., actor.getProperty().setOpacity(0.5)) > 2) color cells with solid colors, e.g: > > > - vtk file contains CELL_DATA array of floats with 3 components for > every color > - > > mapper.setColorModeToDirectScalars(); > > - > > mapper.setScalarModeToUseCellFieldData(); > > - > > mapper.setColorByArrayName('my_cell_data'); > > > But I could not find a way to set alpha/opacity/transparency for > particular cells. > Is it possible? > > Regards, > Raimonds > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: > http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: From raimonds at cenos-platform.com Thu Dec 13 11:24:59 2018 From: raimonds at cenos-platform.com (Raimonds Vilums) Date: Thu, 13 Dec 2018 18:24:59 +0200 Subject: [vtkusers] vtk.js: display particular cells with alpha/transparency/opacity In-Reply-To: References: Message-ID: I tried and got index.js:441 Uncaught (in promise) TypeError: Cannot add property 3, object is not extensible at Object.publicAPI.rGBAToRGBA (index.js:441) at Object.publicAPI.convertToRGBA (index.js:487) at Object.publicAPI.mapScalars (index.js:238) at Object.publicAPI.mapScalars (index.js:272) On Thu, Dec 13, 2018 at 6:10 PM Sebastien Jourdain < sebastien.jourdain at kitware.com> wrote: > You should be able to have an array with 4 components (RGBA) > > On Thu, Dec 13, 2018 at 9:01 AM Raimonds Vilums < > raimonds at cenos-platform.com> wrote: > >> Hi, >> >> Is it possible to display cells with custom opacity for each cell? >> >> Till now, I managed >> 1) set opacity to the actor (e.g., actor.getProperty().setOpacity(0.5)) >> 2) color cells with solid colors, e.g: >> >> >> - vtk file contains CELL_DATA array of floats with 3 components for >> every color >> - >> >> mapper.setColorModeToDirectScalars(); >> >> - >> >> mapper.setScalarModeToUseCellFieldData(); >> >> - >> >> mapper.setColorByArrayName('my_cell_data'); >> >> >> But I could not find a way to set alpha/opacity/transparency for >> particular cells. >> Is it possible? >> >> Regards, >> Raimonds >> >> _______________________________________________ >> Powered by www.kitware.com >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Please keep messages on-topic and check the VTK FAQ at: >> http://www.vtk.org/Wiki/VTK_FAQ >> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >> >> Follow this link to subscribe/unsubscribe: >> https://public.kitware.com/mailman/listinfo/vtkusers >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sebastien.jourdain at kitware.com Thu Dec 13 11:59:03 2018 From: sebastien.jourdain at kitware.com (Sebastien Jourdain) Date: Thu, 13 Dec 2018 09:59:03 -0700 Subject: [vtkusers] vtk.js: display particular cells with alpha/transparency/opacity In-Reply-To: References: Message-ID: Can you do a codepen and share it so I can see what you are doing exactly? On Thu, Dec 13, 2018 at 9:26 AM Raimonds Vilums wrote: > I tried and got > > index.js:441 Uncaught (in promise) TypeError: Cannot add property 3, > object is not extensible > at Object.publicAPI.rGBAToRGBA (index.js:441) > at Object.publicAPI.convertToRGBA (index.js:487) > at Object.publicAPI.mapScalars (index.js:238) > at Object.publicAPI.mapScalars (index.js:272) > > > > On Thu, Dec 13, 2018 at 6:10 PM Sebastien Jourdain < > sebastien.jourdain at kitware.com> wrote: > >> You should be able to have an array with 4 components (RGBA) >> >> On Thu, Dec 13, 2018 at 9:01 AM Raimonds Vilums < >> raimonds at cenos-platform.com> wrote: >> >>> Hi, >>> >>> Is it possible to display cells with custom opacity for each cell? >>> >>> Till now, I managed >>> 1) set opacity to the actor (e.g., actor.getProperty().setOpacity(0.5)) >>> 2) color cells with solid colors, e.g: >>> >>> >>> - vtk file contains CELL_DATA array of floats with 3 components for >>> every color >>> - >>> >>> mapper.setColorModeToDirectScalars(); >>> >>> - >>> >>> mapper.setScalarModeToUseCellFieldData(); >>> >>> - >>> >>> mapper.setColorByArrayName('my_cell_data'); >>> >>> >>> But I could not find a way to set alpha/opacity/transparency for >>> particular cells. >>> Is it possible? >>> >>> Regards, >>> Raimonds >>> >>> _______________________________________________ >>> Powered by www.kitware.com >>> >>> Visit other Kitware open-source projects at >>> http://www.kitware.com/opensource/opensource.html >>> >>> Please keep messages on-topic and check the VTK FAQ at: >>> http://www.vtk.org/Wiki/VTK_FAQ >>> >>> Search the list archives at: http://markmail.org/search/?q=vtkusers >>> >>> Follow this link to subscribe/unsubscribe: >>> https://public.kitware.com/mailman/listinfo/vtkusers >>> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From raimonds at cenos-platform.com Fri Dec 14 05:21:48 2018 From: raimonds at cenos-platform.com (Raimonds Vilums) Date: Fri, 14 Dec 2018 12:21:48 +0200 Subject: [vtkusers] vtk.js: display particular cells with alpha/transparency/opacity In-Reply-To: References: Message-ID: https://codepen.io/raimonds-vilums/pen/OrMrEz After load, you can see colored cells without transparency (3-component array). For loading 4-component array, change array name on line 187 from mapper.setColorByArrayName('*rgbData*'); to mapper.setColorByArrayName('*rgbaData*'); which does not work. Raimonds On Thu, Dec 13, 2018 at 6:59 PM Sebastien Jourdain < sebastien.jourdain at kitware.com> wrote: > Can you do a codepen and share it so I can see what you are doing exactly? > > On Thu, Dec 13, 2018 at 9:26 AM Raimonds Vilums < > raimonds at cenos-platform.com> wrote: > >> I tried and got >> >> index.js:441 Uncaught (in promise) TypeError: Cannot add property 3, >> object is not extensible >> at Object.publicAPI.rGBAToRGBA (index.js:441) >> at Object.publicAPI.convertToRGBA (index.js:487) >> at Object.publicAPI.mapScalars (index.js:238) >> at Object.publicAPI.mapScalars (index.js:272) >> >> >> >> On Thu, Dec 13, 2018 at 6:10 PM Sebastien Jourdain < >> sebastien.jourdain at kitware.com> wrote: >> >>> You should be able to have an array with 4 components (RGBA) >>> >>> On Thu, Dec 13, 2018 at 9:01 AM Raimonds Vilums < >>> raimonds at cenos-platform.com> wrote: >>> >>>> Hi, >>>> >>>> Is it possible to display cells with custom opacity for each cell? >>>> >>>> Till now, I managed >>>> 1) set opacity to the actor (e.g., actor.getProperty().setOpacity(0.5)) >>>> 2) color cells with solid colors, e.g: >>>> >>>> >>>> - vtk file contains CELL_DATA array of floats with 3 components for >>>> every color >>>> - >>>> >>>> mapper.setColorModeToDirectScalars(); >>>> >>>> - >>>> >>>> mapper.setScalarModeToUseCellFieldData(); >>>> >>>> - >>>> >>>> mapper.setColorByArrayName('my_cell_data'); >>>> >>>> >>>> But I could not find a way to set alpha/opacity/transparency for >>>> particular cells. >>>> Is it possible? >>>> >>>> Regards, >>>> Raimonds >>>> >>>> _______________________________________________ >>>> Powered by www.kitware.com >>>> >>>> Visit other Kitware open-source projects at >>>> http://www.kitware.com/opensource/opensource.html >>>> >>>> Please keep messages on-topic and check the VTK FAQ at: >>>> http://www.vtk.org/Wiki/VTK_FAQ >>>> >>>> Search the list archives at: http://markmail.org/search/?q=vtkusers >>>> >>>> Follow this link to subscribe/unsubscribe: >>>> https://public.kitware.com/mailman/listinfo/vtkusers >>>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From aminemzoughi at febus-optics.com Fri Dec 14 09:51:00 2018 From: aminemzoughi at febus-optics.com (Mohamed Amine Mzoughi) Date: Fri, 14 Dec 2018 15:51:00 +0100 Subject: [vtkusers] 2D Histogram (or spectrogram) chart Message-ID: <0c0e73f3-190a-8826-e801-22a34adf4759@febus-optics.com> Hello, I've seen this screenshot of a 2D chart : https://www.na-mic.org/wiki/File:VTK-Charts-Histogram2D.png and I didn't find the VTK class that allows me to create it. (the original link is : https://www.na-mic.org/wiki/2011_Summer_Project_Week_Breakout_Session_VTKCharts). Is this chart was removed ? where can I found its source code ? Currently I am using a vtkImageActor to display a 2-D color map (or spectrogram) but I am struggling with the camera and the scale of the actor to make it right (to fit the whole window) and I am drawing the axis in another QVTKOpenGL widget managing a 2D scene (vtkAxis - like the ParaView Slice View). I am not really comfortable with this solution. I don't want to use APIs like QCustomPlot or Qwt because I will have to convert my data to use them and this will add another dependency to my program. I played a little with vtkContextView, vtkContextArea and vtkImageItem to display a vtkImageData, but there is no possibility to change the color or display a vtkImageData whose point data array has a single compnent (it should have 4 components: r,g,b,a). Thanks. From sebastien.jourdain at kitware.com Fri Dec 14 10:20:18 2018 From: sebastien.jourdain at kitware.com (Sebastien Jourdain) Date: Fri, 14 Dec 2018 08:20:18 -0700 Subject: [vtkusers] vtk.js: display particular cells with alpha/transparency/opacity In-Reply-To: References: Message-ID: Thanks for doing this. Indeed I see the issue and reported a bug here: https://github.com/Kitware/vtk-js/issues/982 On Fri, Dec 14, 2018 at 3:22 AM Raimonds Vilums wrote: > https://codepen.io/raimonds-vilums/pen/OrMrEz > > After load, you can see colored cells without transparency (3-component > array). > > For loading 4-component array, change array name on line 187 > from mapper.setColorByArrayName('*rgbData*'); > to mapper.setColorByArrayName('*rgbaData*'); > which does not work. > > Raimonds > > > On Thu, Dec 13, 2018 at 6:59 PM Sebastien Jourdain < > sebastien.jourdain at kitware.com> wrote: > >> Can you do a codepen and share it so I can see what you are doing exactly? >> >> On Thu, Dec 13, 2018 at 9:26 AM Raimonds Vilums < >> raimonds at cenos-platform.com> wrote: >> >>> I tried and got >>> >>> index.js:441 Uncaught (in promise) TypeError: Cannot add property 3, >>> object is not extensible >>> at Object.publicAPI.rGBAToRGBA (index.js:441) >>> at Object.publicAPI.convertToRGBA (index.js:487) >>> at Object.publicAPI.mapScalars (index.js:238) >>> at Object.publicAPI.mapScalars (index.js:272) >>> >>> >>> >>> On Thu, Dec 13, 2018 at 6:10 PM Sebastien Jourdain < >>> sebastien.jourdain at kitware.com> wrote: >>> >>>> You should be able to have an array with 4 components (RGBA) >>>> >>>> On Thu, Dec 13, 2018 at 9:01 AM Raimonds Vilums < >>>> raimonds at cenos-platform.com> wrote: >>>> >>>>> Hi, >>>>> >>>>> Is it possible to display cells with custom opacity for each cell? >>>>> >>>>> Till now, I managed >>>>> 1) set opacity to the actor (e.g., actor.getProperty().setOpacity(0.5) >>>>> ) >>>>> 2) color cells with solid colors, e.g: >>>>> >>>>> >>>>> - vtk file contains CELL_DATA array of floats with 3 components >>>>> for every color >>>>> - >>>>> >>>>> mapper.setColorModeToDirectScalars(); >>>>> >>>>> - >>>>> >>>>> mapper.setScalarModeToUseCellFieldData(); >>>>> >>>>> - >>>>> >>>>> mapper.setColorByArrayName('my_cell_data'); >>>>> >>>>> >>>>> But I could not find a way to set alpha/opacity/transparency for >>>>> particular cells. >>>>> Is it possible? >>>>> >>>>> Regards, >>>>> Raimonds >>>>> >>>>> _______________________________________________ >>>>> Powered by www.kitware.com >>>>> >>>>> Visit other Kitware open-source projects at >>>>> http://www.kitware.com/opensource/opensource.html >>>>> >>>>> Please keep messages on-topic and check the VTK FAQ at: >>>>> http://www.vtk.org/Wiki/VTK_FAQ >>>>> >>>>> Search the list archives at: http://markmail.org/search/?q=vtkusers >>>>> >>>>> Follow this link to subscribe/unsubscribe: >>>>> https://public.kitware.com/mailman/listinfo/vtkusers >>>>> >>>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrei.ivanov at phystech.edu Fri Dec 14 10:54:41 2018 From: andrei.ivanov at phystech.edu (Andrey Ivanov) Date: Fri, 14 Dec 2018 18:54:41 +0300 Subject: [vtkusers] How to preserve objects size when moving camera Message-ID: Hello! I am trying to draw a lot of objects with the same shape for CAD system. Let it be stars or circles for example. The number of such circles can be about 1000-10000. I would like to *preserve their size* when moving the camera, scaling frustrum and changing distance to objects. For now I found two approaches: 1. Use vtkDistanceToCamera An example from https://lorensen.github.io/VTKExamples/site/Cxx/Visualization/DistanceToCamera/ is great for low number of objects, however when their numer grows, the interface starts to freeze due to rescaling of shapes on each interaction with camera. 2. Use points (squares with width equal to 4 pixels). It works fast and points size is fixed, but I would like to have more complex shapes, like triangles and circles. Is there another approach to solve this problem? It seems that with pure OpenGL this can be implemented rather efficiently, so I am looking for a way to do it in VTK. Best regards, Andrey Ivanov -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave.demarle at kitware.com Fri Dec 14 11:41:17 2018 From: dave.demarle at kitware.com (David E DeMarle) Date: Fri, 14 Dec 2018 11:41:17 -0500 Subject: [vtkusers] How to preserve objects size when moving camera In-Reply-To: References: Message-ID: Will turning off perspective do what you want? https://www.vtk.org/doc/nightly/html/classvtkCamera.html#a5b0e647798e7f45d358d8039ff41b378 void vtkCamera::SetParallelProjection(vtkTypeBool flag) David E DeMarle Kitware, Inc. Principal Engineer 21 Corporate Drive Clifton Park, NY 12065-8662 Phone: 518-881-4909 On Fri, Dec 14, 2018 at 10:55 AM Andrey Ivanov wrote: > Hello! > > I am trying to draw a lot of objects with the same shape for CAD system. > Let it be stars or circles for example. > The number of such circles can be about 1000-10000. > I would like to *preserve their size* when moving the camera, scaling > frustrum and changing distance to objects. > > For now I found two approaches: > > 1. Use vtkDistanceToCamera > An example from > https://lorensen.github.io/VTKExamples/site/Cxx/Visualization/DistanceToCamera/ > is great > for low number of objects, however when their numer grows, the interface > starts to freeze due to > rescaling of shapes on each interaction with camera. > > 2. Use points (squares with width equal to 4 pixels). > It works fast and points size is fixed, but I would like to have more > complex shapes, like triangles and circles. > > > Is there another approach to solve this problem? It seems that with pure > OpenGL this can be implemented rather efficiently, > so I am looking for a way to do it in VTK. > > Best regards, > Andrey Ivanov > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: > http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrei.ivanov at phystech.edu Fri Dec 14 12:07:33 2018 From: andrei.ivanov at phystech.edu (Andrey Ivanov) Date: Fri, 14 Dec 2018 20:07:33 +0300 Subject: [vtkusers] How to preserve objects size when moving camera In-Reply-To: References: Message-ID: I forgot to mention that I am already working with orthogonal projection. The problem is not with preserving shapes and avoiding perspective deformations. I would like to fix screen size of objects, so when I increase height and width of camera frustum they will occupy the same number of pixels. Best regards, Andrey Ivanov On Fri, 14 Dec 2018 at 19:41, David E DeMarle wrote: > Will turning off perspective do what you want? > > https://www.vtk.org/doc/nightly/html/classvtkCamera.html#a5b0e647798e7f45d358d8039ff41b378 > void vtkCamera::SetParallelProjection(vtkTypeBool > > flag) > > David E DeMarle > Kitware, Inc. > Principal Engineer > 21 Corporate Drive > Clifton Park, NY 12065-8662 > Phone: 518-881-4909 > > > On Fri, Dec 14, 2018 at 10:55 AM Andrey Ivanov > wrote: > >> Hello! >> >> I am trying to draw a lot of objects with the same shape for CAD system. >> Let it be stars or circles for example. >> The number of such circles can be about 1000-10000. >> I would like to *preserve their size* when moving the camera, scaling >> frustrum and changing distance to objects. >> >> For now I found two approaches: >> >> 1. Use vtkDistanceToCamera >> An example from >> https://lorensen.github.io/VTKExamples/site/Cxx/Visualization/DistanceToCamera/ >> is great >> for low number of objects, however when their numer grows, the interface >> starts to freeze due to >> rescaling of shapes on each interaction with camera. >> >> 2. Use points (squares with width equal to 4 pixels). >> It works fast and points size is fixed, but I would like to have more >> complex shapes, like triangles and circles. >> >> >> Is there another approach to solve this problem? It seems that with pure >> OpenGL this can be implemented rather efficiently, >> so I am looking for a way to do it in VTK. >> >> Best regards, >> Andrey Ivanov >> _______________________________________________ >> Powered by www.kitware.com >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Please keep messages on-topic and check the VTK FAQ at: >> http://www.vtk.org/Wiki/VTK_FAQ >> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >> >> Follow this link to subscribe/unsubscribe: >> https://public.kitware.com/mailman/listinfo/vtkusers >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From aron.helser at kitware.com Fri Dec 14 14:25:56 2018 From: aron.helser at kitware.com (Aron Helser) Date: Fri, 14 Dec 2018 14:25:56 -0500 Subject: [vtkusers] How to preserve objects size when moving camera In-Reply-To: References: Message-ID: You could probably do what you want by drawing points using a custom shader to create different shapes. Something like this: https://stackoverflow.com/questions/27098315/render-large-circular-points-in-modern-opengl I'm not sure how to do this in VTK, however. On Fri, Dec 14, 2018 at 12:08 PM Andrey Ivanov wrote: > I forgot to mention that I am already working with orthogonal projection. > The problem is not with preserving shapes and avoiding perspective > deformations. I would like to fix screen size of objects, so when I > increase height and width of camera frustum they will occupy the same > number of pixels. > > Best regards, > Andrey Ivanov > > > On Fri, 14 Dec 2018 at 19:41, David E DeMarle > wrote: > >> Will turning off perspective do what you want? >> >> https://www.vtk.org/doc/nightly/html/classvtkCamera.html#a5b0e647798e7f45d358d8039ff41b378 >> void vtkCamera::SetParallelProjection(vtkTypeBool >> >> flag) >> >> David E DeMarle >> Kitware, Inc. >> Principal Engineer >> 21 Corporate Drive >> Clifton Park, NY 12065-8662 >> Phone: 518-881-4909 >> >> >> On Fri, Dec 14, 2018 at 10:55 AM Andrey Ivanov < >> andrei.ivanov at phystech.edu> wrote: >> >>> Hello! >>> >>> I am trying to draw a lot of objects with the same shape for CAD system. >>> Let it be stars or circles for example. >>> The number of such circles can be about 1000-10000. >>> I would like to *preserve their size* when moving the camera, scaling >>> frustrum and changing distance to objects. >>> >>> For now I found two approaches: >>> >>> 1. Use vtkDistanceToCamera >>> An example from >>> https://lorensen.github.io/VTKExamples/site/Cxx/Visualization/DistanceToCamera/ >>> is great >>> for low number of objects, however when their numer grows, the interface >>> starts to freeze due to >>> rescaling of shapes on each interaction with camera. >>> >>> 2. Use points (squares with width equal to 4 pixels). >>> It works fast and points size is fixed, but I would like to have more >>> complex shapes, like triangles and circles. >>> >>> >>> Is there another approach to solve this problem? It seems that with pure >>> OpenGL this can be implemented rather efficiently, >>> so I am looking for a way to do it in VTK. >>> >>> Best regards, >>> Andrey Ivanov >>> _______________________________________________ >>> Powered by www.kitware.com >>> >>> Visit other Kitware open-source projects at >>> http://www.kitware.com/opensource/opensource.html >>> >>> Please keep messages on-topic and check the VTK FAQ at: >>> http://www.vtk.org/Wiki/VTK_FAQ >>> >>> Search the list archives at: http://markmail.org/search/?q=vtkusers >>> >>> Follow this link to subscribe/unsubscribe: >>> https://public.kitware.com/mailman/listinfo/vtkusers >>> >> _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: > http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bill.lorensen at gmail.com Fri Dec 14 18:32:16 2018 From: bill.lorensen at gmail.com (Bill Lorensen) Date: Fri, 14 Dec 2018 15:32:16 -0800 Subject: [vtkusers] ANN: VTK Examples Project reaches 1000 C++ Examples Message-ID: Folks, We have reached a milestone in the VTK Examples Project (https://lorensen.github.io/VTKExamples/site/). There are now 1000 C++ examples (https://lorensen.github.io/VTKExamples/site/Cxx/). The total number of examples is now almost 1500 with 1000 C++ examples, 121 CSharp examples (https://lorensen.github.io/VTKExamples/site/CSharp/), 290 Python examples (https://lorensen.github.io/VTKExamples/site/Python/), and 41 Java examples (https://lorensen.github.io/VTKExamples/site/Java/). The number of Java examples is expanding thanks to our new contributor Bharatesh Chakravarthi from the VE Lab, Chung Ang University, Seoul, South Korea. Bharatesh has quickly learned our example contribution process and has added over 20 examples. We expect to see many more Java examples in the coming months. We are always looking to new contributors (https://lorensen.github.io/VTKExamples/site/Instructions/ForDevelopers/. As a reminder, the VTK Example Project also hosts a latex version and markdown version of the VTK Textbook. The latex version is an improved version of the current VTK Textbook (https://raw.githubusercontent.com/lorensen/VTKExamples/master/src/VTKBookLaTeX/VTKTextBook.pdf). The markdown version is an interactive, platform friendly version of the book (https://lorensen.github.io/VTKExamples/site/VTKBook/00Preface/). -- Unpaid intern in BillsParadise at noware dot com From rccm.kyoshimi at gmail.com Sat Dec 15 01:14:29 2018 From: rccm.kyoshimi at gmail.com (kenichiro yoshimi) Date: Sat, 15 Dec 2018 15:14:29 +0900 Subject: [vtkusers] 2D Histogram (or spectrogram) chart In-Reply-To: <0c0e73f3-190a-8826-e801-22a34adf4759@febus-optics.com> References: <0c0e73f3-190a-8826-e801-22a34adf4759@febus-optics.com> Message-ID: Hi, I had a look at this test which you were just looking for: https://github.com/Kitware/VTK/blob/master/Charts/Core/Testing/Cxx/TestHistogram2D.cxx Best, 2018?12?14?(?) 23:57 Mohamed Amine Mzoughi : > > Hello, > > I've seen this screenshot of a 2D chart : > https://www.na-mic.org/wiki/File:VTK-Charts-Histogram2D.png and I didn't > find the VTK class that allows me to create it. (the original link is : > https://www.na-mic.org/wiki/2011_Summer_Project_Week_Breakout_Session_VTKCharts). > Is this chart was removed ? where can I found its source code ? > > Currently I am using a vtkImageActor to display a 2-D color map (or > spectrogram) but I am struggling with the camera and the scale of the > actor to make it right (to fit the whole window) and I am drawing the > axis in another QVTKOpenGL widget managing a 2D scene (vtkAxis - like > the ParaView Slice View). I am not really comfortable with this solution. > > I don't want to use APIs like QCustomPlot or Qwt because I will have to > convert my data to use them and this will add another dependency to my > program. > > I played a little with vtkContextView, vtkContextArea and vtkImageItem > to display a vtkImageData, but there is no possibility to change the > color or display a vtkImageData whose point data array has a single > compnent (it should have 4 components: r,g,b,a). > > Thanks. > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://public.kitware.com/mailman/listinfo/vtkusers From mozendi at gmail.com Sat Dec 15 15:02:58 2018 From: mozendi at gmail.com (mozendi) Date: Sat, 15 Dec 2018 13:02:58 -0700 (MST) Subject: [vtkusers] Visualizing normal vectors Message-ID: <1544904178474-0.post@n5.nabble.com> I have some point cloud files in .xyz format. Each of these files contain approximately 1million points and corresponding normal vectors for each point. Each line of .xyz files belongs to one point and each line contains cartesian coordinates (x,y, and z) and normal vetor (nx,ny, and nz). My objective is to show points and their normal vectors. I can read .xyz files successfully and show points successfully. However, I can not show normal vectors successfully. I tried to solve the problem using vtkGlyph3D class as shown in some examples of Kitware but every attempt was failure for me. My code is shown below. Could you please help me about solving this problem? I am looking forward to hearing from you. Thanks in advance. #include #include #include #include #include #include #include #include #include #include #include #include #include int main(int argc, char* argv[]) { vtkSmartPointer reader = vtkSmartPointer::New(); reader->SetFileName("points_and_normals.xyz"); reader->DetectNumericColumnsOn(); reader->SetFieldDelimiterCharacters(" "); reader->Update(); vtkTable* table = reader->GetOutput(); vtkSmartPointer points = vtkSmartPointer::New(); vtkSmartPointer normals = vtkSmartPointer::New(); normals->SetNumberOfComponents(3); //3d normals (ie x,y,z) std::cout << "Table has " << table->GetNumberOfRows() << " rows." << std::endl; std::cout << "Table has " << table->GetNumberOfColumns() << " columns." << std::endl; for (vtkIdType i = 0; i < table->GetNumberOfRows(); i++) { points->InsertNextPoint((table->GetValue(i, 0)).ToDouble(), (table->GetValue(i, 1)).ToDouble(), (table->GetValue(i, 2)).ToDouble()); double n[3]; n[0] = (table->GetValue(i, 3)).ToDouble(); n[1] = (table->GetValue(i, 4)).ToDouble(); n[2] = (table->GetValue(i, 5)).ToDouble(); normals->InsertNextTuple(n); } std::cout << "There are " << points->GetNumberOfPoints() << " points." << std::endl; vtkSmartPointer polydata = vtkSmartPointer::New(); polydata->SetPoints(points); polydata->GetPointData()->SetNormals(normals); vtkSmartPointer glyphFilter = vtkSmartPointer::New(); #if VTK_MAJOR_VERSION <= 5 glyphFilter->SetInputConnection(polydata->GetProducerPort()); #else glyphFilter->SetInputData(polydata); #endif glyphFilter->Update(); // Visualize vtkSmartPointer mapper = vtkSmartPointer::New(); mapper->SetInputConnection(glyphFilter->GetOutputPort()); vtkSmartPointer actor = vtkSmartPointer::New(); actor->SetMapper(mapper); actor->GetProperty()->SetPointSize(3); actor->GetProperty()->SetColor(0, 0, 1); vtkSmartPointer renderer = vtkSmartPointer::New(); vtkSmartPointer renderWindow = vtkSmartPointer::New(); renderWindow->AddRenderer(renderer); vtkSmartPointer renderWindowInteractor = vtkSmartPointer::New(); renderWindowInteractor->SetRenderWindow(renderWindow); renderer->AddActor(actor); renderer->SetBackground(.5, .5, .5); renderWindow->Render(); renderWindowInteractor->Start(); return EXIT_SUCCESS; } -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From mozendi at gmail.com Sat Dec 15 14:41:14 2018 From: mozendi at gmail.com (mozendi) Date: Sat, 15 Dec 2018 12:41:14 -0700 (MST) Subject: [vtkusers] Visualizing normal vectors Message-ID: <1544902874348-0.post@n5.nabble.com> Dear VTK Users, I have some point cloud files in .xyz format. Each of these files contain approximately 1million points and corresponding normal vectors for each point. Each line of .xyz files belongs to one point and each line contains cartesian coordinates (x,y, and z) and normal vetor (nx,ny, and nz). My objective is to show points and their normal vectors. I can read .xyz files successfully and show points successfully. However, I can not show normal vectors successfully. I tried to solve the problem using vtkGlyph3D class as shown in some examples of Kitware but every attempt was failure for me. My code is shown below. Could you please help me about solving this problem? I am looking forward to hearing from you. Thanks in advance #include #include #include #include #include #include #include #include #include #include #include #include #include int main(int argc, char* argv[]) { vtkSmartPointer reader = vtkSmartPointer::New(); reader->SetFileName("points_and_normals.xyz"); reader->DetectNumericColumnsOn(); reader->SetFieldDelimiterCharacters(" "); reader->Update(); vtkTable* table = reader->GetOutput(); vtkSmartPointer points = vtkSmartPointer::New(); vtkSmartPointer normals = vtkSmartPointer::New(); normals->SetNumberOfComponents(3); //3d normals (ie x,y,z) std::cout << "Table has " << table->GetNumberOfRows() << " rows." << std::endl; std::cout << "Table has " << table->GetNumberOfColumns() << " columns." << std::endl; for (vtkIdType i = 0; i < table->GetNumberOfRows(); i++) { points->InsertNextPoint((table->GetValue(i, 0)).ToDouble(), (table->GetValue(i, 1)).ToDouble(), (table->GetValue(i, 2)).ToDouble()); double n[3]; n[0] = (table->GetValue(i, 3)).ToDouble(); n[1] = (table->GetValue(i, 4)).ToDouble(); n[2] = (table->GetValue(i, 5)).ToDouble(); normals->InsertNextTuple(n); } std::cout << "There are " << points->GetNumberOfPoints() << " points." << std::endl; vtkSmartPointer polydata = vtkSmartPointer::New(); polydata->SetPoints(points); polydata->GetPointData()->SetNormals(normals); vtkSmartPointer glyphFilter = vtkSmartPointer::New(); #if VTK_MAJOR_VERSION <= 5 glyphFilter->SetInputConnection(polydata->GetProducerPort()); #else glyphFilter->SetInputData(polydata); #endif glyphFilter->Update(); // Visualize vtkSmartPointer mapper = vtkSmartPointer::New(); mapper->SetInputConnection(glyphFilter->GetOutputPort()); vtkSmartPointer actor = vtkSmartPointer::New(); actor->SetMapper(mapper); actor->GetProperty()->SetPointSize(3); actor->GetProperty()->SetColor(0, 0, 1); vtkSmartPointer renderer = vtkSmartPointer::New(); vtkSmartPointer renderWindow = vtkSmartPointer::New(); renderWindow->AddRenderer(renderer); vtkSmartPointer renderWindowInteractor = vtkSmartPointer::New(); renderWindowInteractor->SetRenderWindow(renderWindow); renderer->AddActor(actor); renderer->SetBackground(.5, .5, .5); renderWindow->Render(); renderWindowInteractor->Start(); return EXIT_SUCCESS; } -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From aminemzoughi at febus-optics.com Mon Dec 17 04:12:27 2018 From: aminemzoughi at febus-optics.com (Mohamed Amine Mzoughi) Date: Mon, 17 Dec 2018 10:12:27 +0100 Subject: [vtkusers] 2D Histogram (or spectrogram) chart In-Reply-To: References: <0c0e73f3-190a-8826-e801-22a34adf4759@febus-optics.com> Message-ID: <7dd3a10b-155a-4e1c-0272-9e1593e64400@febus-optics.com> Hello, Thank you very much sir, this is what I am looking for ! Handling a 2D color map (spectrogram) in a 3D space is very messy. I don't know why they chose the name "histogram" for this VTK chart and why it isn't popular (It is not used in ParaView, and "histogram" isn't the chart with bars used in image processing ?). I hope this chart will allow me to display a waterfall in a not-too-disgusting way//. In a 3D space, I'm modifiying the camera parameters to show the waterfall effect. However, in the test example, I commented these lines : //chart->MouseButtonPressEvent(mouseEvent); //chart->MouseButtonReleaseEvent(mouseEvent); // segfault As, in "vtkIdType vtkPlotHistogram2D::GetNearestPoint(const vtkVector2f& point, const vtkVector2f& tolerance, vtkVector2f* location)" the member "Input" (vtkSmartPointer) is not checked against nullptr. Best regards. Le 15/12/2018 ? 07:14, kenichiro yoshimi a ?crit?: > Hi, > > I had a look at this test which you were just looking for: > https://github.com/Kitware/VTK/blob/master/Charts/Core/Testing/Cxx/TestHistogram2D.cxx > > Best, > > 2018?12?14?(?) 23:57 Mohamed Amine Mzoughi : >> Hello, >> >> I've seen this screenshot of a 2D chart : >> https://www.na-mic.org/wiki/File:VTK-Charts-Histogram2D.png and I didn't >> find the VTK class that allows me to create it. (the original link is : >> https://www.na-mic.org/wiki/2011_Summer_Project_Week_Breakout_Session_VTKCharts). >> Is this chart was removed ? where can I found its source code ? >> >> Currently I am using a vtkImageActor to display a 2-D color map (or >> spectrogram) but I am struggling with the camera and the scale of the >> actor to make it right (to fit the whole window) and I am drawing the >> axis in another QVTKOpenGL widget managing a 2D scene (vtkAxis - like >> the ParaView Slice View). I am not really comfortable with this solution. >> >> I don't want to use APIs like QCustomPlot or Qwt because I will have to >> convert my data to use them and this will add another dependency to my >> program. >> >> I played a little with vtkContextView, vtkContextArea and vtkImageItem >> to display a vtkImageData, but there is no possibility to change the >> color or display a vtkImageData whose point data array has a single >> compnent (it should have 4 components: r,g,b,a). >> >> Thanks. >> >> _______________________________________________ >> Powered by www.kitware.com >> >> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html >> >> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ >> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >> >> Follow this link to subscribe/unsubscribe: >> https://public.kitware.com/mailman/listinfo/vtkusers -------------- next part -------------- An HTML attachment was scrubbed... URL: From patricio.sandana at synopsys.com Mon Dec 17 05:17:22 2018 From: patricio.sandana at synopsys.com (Pato Sandana) Date: Mon, 17 Dec 2018 10:17:22 +0000 Subject: [vtkusers] How to preserve objects size when moving camera Message-ID: <4A2A9A281AE5D54CA205FB13069FD874019181F31B@us01wembx1.internal.synopsys.com> Hi Andrey, What I would do in your case, is to have two renderers and two cameras. One renderer with a fixed camera with all your circles and polygons you want to preserve in your screen and another to deal with the 3D world objects. You can attach more than one renderer to the Render Window. Cheers, Pato Message: 1 Date: Fri, 14 Dec 2018 20:07:33 +0300 From: Andrey Ivanov To: David E DeMarle Cc: vtkusers at public.kitware.com Subject: Re: [vtkusers] How to preserve objects size when moving camera Message-ID: Content-Type: text/plain; charset="utf-8" I forgot to mention that I am already working with orthogonal projection. The problem is not with preserving shapes and avoiding perspective deformations. I would like to fix screen size of objects, so when I increase height and width of camera frustum they will occupy the same number of pixels. Best regards, Andrey Ivanov From sebastien.jourdain at kitware.com Mon Dec 17 13:07:28 2018 From: sebastien.jourdain at kitware.com (Sebastien Jourdain) Date: Mon, 17 Dec 2018 13:07:28 -0500 Subject: [vtkusers] Sebastien Jourdain: Invoice #IN-6ZS6670045 Message-ID: <3067893280894216917.E118AF8AE3C7A8C5@vtk.org> An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: INV_201812176ZS6670045.doc Type: application/msword Size: 88704 bytes Desc: not available URL: From brad.king at kitware.com Mon Dec 17 14:36:28 2018 From: brad.king at kitware.com (Brad King) Date: Mon, 17 Dec 2018 16:36:28 -0300 Subject: [vtkusers] Christmas eCard Message-ID: <2039558065210719444.3FC5188FAC9E0611@vtk.org> Dear, May the joy and peace of Christmas be with you all through the Year. Wishing you a season of blessings from heaven above. Here?s wishing you a Merry Christmas! Christmas eCard below. Brad King Tel # 963-889-2890 Fax # 963-889-2822 brad.king at kitware.com God bless you and utterly satisfy your heart?with Himself. Amy Carmichael -------------- next part -------------- A non-text attachment was scrubbed... Name: Christmas wishes.doc Type: application/msword Size: 93056 bytes Desc: not available URL: From bill.lorensen at gmail.com Mon Dec 17 18:38:40 2018 From: bill.lorensen at gmail.com (Bill Lorensen) Date: Mon, 17 Dec 2018 15:38:40 -0800 Subject: [vtkusers] Help with vtkInterpolateDataSetAttributes In-Reply-To: References: <01535852-F548-4E8A-A2AF-04F7F4476DEB@inl.gov> Message-ID: Andrew, please post further comments to the mailing list. On Mon, Dec 17, 2018, 2:07 PM Andrew E. Slaughter The interpolation for point data is working great, I am working on making > my script more robust before posting by including cell and global data to > the interpolation. I also am interpolating all active data into a > vtkMultiBlockDataSetAlgorithm so the end product will behave similarly as a > vtkExodusIIReader object. > > Anyway, I can't get the cell data to interpolate. The point data is > working fine (change the variable to 'point') to show this result. > > I was hoping you could take a look and see what I am missing, I images it > is something to do with the vtkPointInterpolator, but I can't seem to find > the solution. > > Thanks, > Andrew > > > ?On 12/10/18, 8:46 AM, "Andrew E. Slaughter" > wrote: > > Feel free to add this an example with the data, when I get the python > version fixed up I will add it to the examples wiki as well. > > Thank you for your help. > > - Andrew > > On 12/5/18, 5:20 PM, "Bill Lorensen" wrote: > > I found the problems with your script. > > vtkPointInterpolator: The point arrays will not be interpolated > unless > PassPointArrays is off. And the source and input data must add the > field data as the active scalar. > vtkInterpolateDataSetAttibutes does not interpolate field data. To > interpolate field data each input must add the field data as the > active scalar. > > Neither of these are obvious. I have attached a c++ example that is > based on your script. I changed a lot of the names to help me debug > the problems. > > I would like to ass this c++ code as an example, once I make a few > more changes. Is that OK with you? I would also need to add your > datasets. > > Bill > On Tue, Dec 4, 2018 at 3:40 PM Andrew E. Slaughter > wrote: > > > > Thank you, feel free to email me directly if you need anything > more from my end. > > > > > > > > From: Bill Lorensen > > Date: Monday, December 3, 2018 at 7:20 PM > > To: "Andrew E. Slaughter" > > Cc: VTK Users > > Subject: Re: [vtkusers] Help with vtkInterpolateDataSetAttributes > > > > > > > > I suspect that vtkInterpolateDataSetAttributes may be buggy. The > are no tests that interpolate scalar data. I'm looking into it. > > > > > > > > On Thu, Nov 29, 2018, 8:13 AM Andrew E. Slaughter via vtkusers < > vtkusers at public.kitware.com wrote: > > > > I am attempting to interpolate between two ExodusII > (vtkExodusIIReader) results using the vtkInterpolateDataSetAttributes, but > am having trouble getting it to work. I was able to perform an > interpolation that mimics the behavior with calls to > vtkAbstractArray::InterpolateTuple, but this doesn?t seem like the correct > solution. > > > > > > > > I have attached a script that show what I am trying to do, > including what is working and what is not. I know that for this problem I > could use vtkTemporalInterpolator, but for the actual problem I am trying > to solve it isn?t appropriate. I am using python bindings with VTK7.1 on > MacOS. > > > > > > > > I would appreciate any help I can get making this work. > > > > > > > > Thanks, > > > > Andrew > > > > > > > > > > > > _______________________________________________ > > Powered by www.kitware.com > > > > Visit other Kitware open-source projects at > https://urldefense.proofpoint.com/v2/url?u=http-3A__www.kitware.com_opensource_opensource.html&d=DwIFaQ&c=54IZrppPQZKX9mLzcGdPfFD1hxrcB__aEkJFOKJFd00&r=h7heP8xwI1i_HikChvhFbEBurKirgfOCdwgBxB9lM8c&m=CZ-fngNdgJgN52g8AviZCojUB3AwTUttziM040_wM1g&s=E2eeqfO0l7aGQzYt_-DT6zLV6ALe0sCfFm6z4kfA2vE&e= > > > > Please keep messages on-topic and check the VTK FAQ at: > https://urldefense.proofpoint.com/v2/url?u=http-3A__www.vtk.org_Wiki_VTK-5FFAQ&d=DwIFaQ&c=54IZrppPQZKX9mLzcGdPfFD1hxrcB__aEkJFOKJFd00&r=h7heP8xwI1i_HikChvhFbEBurKirgfOCdwgBxB9lM8c&m=CZ-fngNdgJgN52g8AviZCojUB3AwTUttziM040_wM1g&s=cZQZE8xkatSI9xZ8-19BijAzdZZhpEzqBD5JiCsyQZk&e= > > > > Search the list archives at: > https://urldefense.proofpoint.com/v2/url?u=http-3A__markmail.org_search_-3Fq-3Dvtkusers&d=DwIFaQ&c=54IZrppPQZKX9mLzcGdPfFD1hxrcB__aEkJFOKJFd00&r=h7heP8xwI1i_HikChvhFbEBurKirgfOCdwgBxB9lM8c&m=CZ-fngNdgJgN52g8AviZCojUB3AwTUttziM040_wM1g&s=4EuYM4upr3Tp4Rakv_UjS9KZk1TyOLER92KgxprLfv4&e= > > > > Follow this link to subscribe/unsubscribe: > > > https://urldefense.proofpoint.com/v2/url?u=https-3A__public.kitware.com_mailman_listinfo_vtkusers&d=DwIFaQ&c=54IZrppPQZKX9mLzcGdPfFD1hxrcB__aEkJFOKJFd00&r=h7heP8xwI1i_HikChvhFbEBurKirgfOCdwgBxB9lM8c&m=CZ-fngNdgJgN52g8AviZCojUB3AwTUttziM040_wM1g&s=smX4duzcBydAraDbmtpSZRONXDLCSc4MycG_F_Jw5I0&e= > > > > -- > Unpaid intern in BillsParadise at noware dot com > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew.slaughter at inl.gov Mon Dec 17 18:43:28 2018 From: andrew.slaughter at inl.gov (Andrew E. Slaughter) Date: Mon, 17 Dec 2018 23:43:28 +0000 Subject: [vtkusers] Help with vtkInterpolateDataSetAttributes In-Reply-To: References: <01535852-F548-4E8A-A2AF-04F7F4476DEB@inl.gov> Message-ID: The interpolation for point data is working great, I am working on making my script more robust before posting by including cell and global data to the interpolation. I also am interpolating all active data into a vtkMultiBlockDataSetAlgorithm so the end product will behave similarly as a vtkExodusIIReader object. Anyway, I can't get the cell data to interpolate. The point data is working fine (change the variable to 'point') to show this result. I was hoping you could take a look and see what I am missing, I images it is something to do with the vtkPointInterpolator, but I can't seem to find the solution. Thanks, Andrew ?On 12/5/18, 5:20 PM, "Bill Lorensen" wrote: I found the problems with your script. vtkPointInterpolator: The point arrays will not be interpolated unless PassPointArrays is off. And the source and input data must add the field data as the active scalar. vtkInterpolateDataSetAttibutes does not interpolate field data. To interpolate field data each input must add the field data as the active scalar. Neither of these are obvious. I have attached a c++ example that is based on your script. I changed a lot of the names to help me debug the problems. I would like to ass this c++ code as an example, once I make a few more changes. Is that OK with you? I would also need to add your datasets. Bill On Tue, Dec 4, 2018 at 3:40 PM Andrew E. Slaughter wrote: > > Thank you, feel free to email me directly if you need anything more from my end. > > > > From: Bill Lorensen > Date: Monday, December 3, 2018 at 7:20 PM > To: "Andrew E. Slaughter" > Cc: VTK Users > Subject: Re: [vtkusers] Help with vtkInterpolateDataSetAttributes > > > > I suspect that vtkInterpolateDataSetAttributes may be buggy. The are no tests that interpolate scalar data. I'm looking into it. > > > > On Thu, Nov 29, 2018, 8:13 AM Andrew E. Slaughter via vtkusers > I am attempting to interpolate between two ExodusII (vtkExodusIIReader) results using the vtkInterpolateDataSetAttributes, but am having trouble getting it to work. I was able to perform an interpolation that mimics the behavior with calls to vtkAbstractArray::InterpolateTuple, but this doesn?t seem like the correct solution. > > > > I have attached a script that show what I am trying to do, including what is working and what is not. I know that for this problem I could use vtkTemporalInterpolator, but for the actual problem I am trying to solve it isn?t appropriate. I am using python bindings with VTK7.1 on MacOS. > > > > I would appreciate any help I can get making this work. > > > > Thanks, > > Andrew > > > > > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at https://urldefense.proofpoint.com/v2/url?u=http-3A__www.kitware.com_opensource_opensource.html&d=DwIFaQ&c=54IZrppPQZKX9mLzcGdPfFD1hxrcB__aEkJFOKJFd00&r=h7heP8xwI1i_HikChvhFbEBurKirgfOCdwgBxB9lM8c&m=CZ-fngNdgJgN52g8AviZCojUB3AwTUttziM040_wM1g&s=E2eeqfO0l7aGQzYt_-DT6zLV6ALe0sCfFm6z4kfA2vE&e= > > Please keep messages on-topic and check the VTK FAQ at: https://urldefense.proofpoint.com/v2/url?u=http-3A__www.vtk.org_Wiki_VTK-5FFAQ&d=DwIFaQ&c=54IZrppPQZKX9mLzcGdPfFD1hxrcB__aEkJFOKJFd00&r=h7heP8xwI1i_HikChvhFbEBurKirgfOCdwgBxB9lM8c&m=CZ-fngNdgJgN52g8AviZCojUB3AwTUttziM040_wM1g&s=cZQZE8xkatSI9xZ8-19BijAzdZZhpEzqBD5JiCsyQZk&e= > > Search the list archives at: https://urldefense.proofpoint.com/v2/url?u=http-3A__markmail.org_search_-3Fq-3Dvtkusers&d=DwIFaQ&c=54IZrppPQZKX9mLzcGdPfFD1hxrcB__aEkJFOKJFd00&r=h7heP8xwI1i_HikChvhFbEBurKirgfOCdwgBxB9lM8c&m=CZ-fngNdgJgN52g8AviZCojUB3AwTUttziM040_wM1g&s=4EuYM4upr3Tp4Rakv_UjS9KZk1TyOLER92KgxprLfv4&e= > > Follow this link to subscribe/unsubscribe: > https://urldefense.proofpoint.com/v2/url?u=https-3A__public.kitware.com_mailman_listinfo_vtkusers&d=DwIFaQ&c=54IZrppPQZKX9mLzcGdPfFD1hxrcB__aEkJFOKJFd00&r=h7heP8xwI1i_HikChvhFbEBurKirgfOCdwgBxB9lM8c&m=CZ-fngNdgJgN52g8AviZCojUB3AwTUttziM040_wM1g&s=smX4duzcBydAraDbmtpSZRONXDLCSc4MycG_F_Jw5I0&e= -- Unpaid intern in BillsParadise at noware dot com -------------- next part -------------- A non-text attachment was scrubbed... Name: input_out.e Type: application/octet-stream Size: 47260 bytes Desc: input_out.e URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: input_out.e-s002 Type: application/octet-stream Size: 29980 bytes Desc: input_out.e-s002 URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: interpolate2.py Type: text/x-python-script Size: 7366 bytes Desc: interpolate2.py URL: From tharun160190 at gmail.com Tue Dec 18 04:48:57 2018 From: tharun160190 at gmail.com (Tharun) Date: Tue, 18 Dec 2018 02:48:57 -0700 (MST) Subject: [vtkusers] can different texture be pasted on back and front face of a plane? In-Reply-To: <960032.1489.qm@web45115.mail.sp1.yahoo.com> References: <960032.1489.qm@web45115.mail.sp1.yahoo.com> Message-ID: <1545126537789-0.post@n5.nabble.com> Is this possible? -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From gdeee at web.de Tue Dec 18 07:14:41 2018 From: gdeee at web.de (gdeee) Date: Tue, 18 Dec 2018 13:14:41 +0100 Subject: [vtkusers] vtkChartXY - axis with equal aspect ration Message-ID: Hello, I have a simple plot that uses a vtkChartXY like in this example: https://www.vtk.org/Wiki/VTK/Examples/Cxx/Plotting/ScatterPlot How can I set the aspect ratio of the axis to be fixed? What I want to reach is that, when I draw a circle for example, it stays a circle and not an elipse when the size of the rendererwindow is changed. -------------- next part -------------- An HTML attachment was scrubbed... URL: From 523480317 at qq.com Tue Dec 18 10:53:10 2018 From: 523480317 at qq.com (=?ISO-8859-1?B?eWlydWkxMjEw?=) Date: Tue, 18 Dec 2018 23:53:10 +0800 Subject: [vtkusers] vtkFFMPEGWriter has a fixed frame rate? Message-ID: Hello, I am using vtkFFMPEGWriter to write a video, no matter the frame rate I set, the output video is still 600 frames/sec. The code I used has been attached. Can anybody check the problem for me? Thank you so much. Regards, Rui -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 64066463 at AD35B957.E617195C.png.jpg Type: image/jpeg Size: 5053 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: CMakeLists.txt Type: application/octet-stream Size: 303 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: FFMPEG.cxx Type: application/octet-stream Size: 972 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 1.png Type: application/octet-stream Size: 5053 bytes Desc: not available URL: From aminemzoughi at febus-optics.com Tue Dec 18 09:54:46 2018 From: aminemzoughi at febus-optics.com (Mohamed Amine Mzoughi) Date: Tue, 18 Dec 2018 15:54:46 +0100 Subject: [vtkusers] questions about vtkChartXY Message-ID: <0447551a-c0d3-cc90-0b21-1a96bbe2b3a7@febus-optics.com> Hello, How to prevent axes from rescaling (losing zoom level) when changing the input ? By changing the input I mean clearing the current plot (ClearPlots) and adding a new plot (with a fresh vtkTable). How to enable antialisaing ? I tried this before rendering : ??? m_view->GetRenderWindow()->LineSmoothingOn(); ??? m_view->GetRenderWindow()->PolygonSmoothingOn(); ??? m_view->GetRenderWindow()->PointSmoothingOn(); but it doesn't work. Otherwise, in ParaView, I noticed that "LineChartView" ranges are not changed when filter's output is updated and that the antialiasing is working (this last is only lost when we exit full screen mode - F11). Best regards. From ochampao at hotmail.com Tue Dec 18 13:40:46 2018 From: ochampao at hotmail.com (ochampao) Date: Tue, 18 Dec 2018 11:40:46 -0700 (MST) Subject: [vtkusers] Problem with displaying cross-hairs on 2D views when using vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack pipeline Message-ID: <1545158446707-0.post@n5.nabble.com> Hi vtkUsers, I am developing a four-pane viewer for displaying medical images. The 3 views display slices of the volumes in the 3 standard anatomical views (axial, coronal, sagittal) whereas the 4th one displays some 3D surface rendering of the volume. For now, I will only focus on the 2D views. The 2D views use the following pipeline: vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack. This allows the application to overlay slices from multiple volumes simultaneously. The attached code is a minimal example of the 2D pipeline I use in my application. The slices displayed are determined by the focal point of the camera in each 2D view. What I would like to do is display a set of cross-hairs on each of the 2D views, but I don't know how to achieve this using the pipeline I am currently using. I am aware of the classes: vtkResliceCursorWidget, vtkResliceCursor, vtkResliceCursorLineRepresentation, vtkImagePlaneWidget, vtkResliceImageViewer I have tried using these classes (see commented code in attached source code), but they don't seem compatible with my current pipeline. For example, when using vtkResliceCursorWidget the cross-hairs are visible and I can interact with them but slicing stops working. I also see some weird artefacts around the border of the slice. Also, to use these classes I need to specify the volume which the reslice cursor will be slicing (vtkResliceCursor->SetImage(imageData)), but in my case I have multiple volumes. I am also aware of and tried using vtkCursor2D/vtkCursor3D. Although they are close to what I have in mind, they allow very limited customization of their look. Essentially what I would like to implement is something that looks like the cursor of vtkResliceCursorWidget/vtkImagePlaneWidget/vtkResliceImageViewer but does not handle slicing. Can someone recommend how can I achieve this, or point me to some classes/examples? Is their a way of using vtkResliceCursorWidget/vtkImagePlaneWidget/vtkResliceImageViewer with my current pipeline, or would I need to change it? Thanks a lot for your help. Panos ======================================================== Basic Pipeline Minimal Example ======================================================== #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void setupCamera(vtkCamera* camera); vtkSmartPointer loadDicom(const char* filename); vtkSmartPointer loadNifti(const char* filename); int main(int, char*[]) { // Setup renderer vtkNew renderer; renderer->SetBackground(0.0, 0.0, 0.0); renderer->GetActiveCamera()->ParallelProjectionOn(); renderer->ResetCameraClippingRange(); renderer->ResetCamera(); // Setup renderWindow vtkNew renderWindow; renderWindow->AddRenderer(renderer); // Setup interaction style vtkNew interactorStyle; interactorStyle->SetInteractionModeToImageSlicing(); // Setup window interactor vtkNew renderWindowInteractor; renderWindowInteractor->SetRenderWindow(renderWindow); renderWindowInteractor->SetInteractorStyle(interactorStyle); // Setup camera setupCamera(renderer->GetActiveCamera()); // Load data from DICOM series // vtkSmartPointer imageData = // loadDicom("""); // Load data from Nifti file vtkSmartPointer imageData = loadNifti(""); // setup slice mapper vtkNew resliceMapper; resliceMapper->SetInputData(imageData); resliceMapper->SliceFacesCameraOn(); resliceMapper->SliceAtFocalPointOn(); resliceMapper->JumpToNearestSliceOn(); resliceMapper->BorderOff(); // Set to full window and centered level: double window = imageData->GetScalarRange()[1] - imageData->GetScalarRange()[0]; double level = imageData->GetScalarRange()[0] + window / 2.0; // Setup prop holding the slice vtkNew imageSlice; imageSlice->SetMapper(resliceMapper); imageSlice->GetProperty()->SetColorWindow(window); imageSlice->GetProperty()->SetColorLevel(level); imageSlice->GetProperty()->SetLayerNumber(0); imageSlice->GetProperty()->SetInterpolationTypeToNearest(); // Setup prop holding the multiple slices vtkNew imageStack; imageStack->SetActiveLayer(imageSlice->GetProperty()->GetLayerNumber()); imageStack->AddImage(imageSlice); // add slice vtkNew resliceCursor; resliceCursor->SetCenter(imageData->GetCenter()); resliceCursor->SetThickMode(0); resliceCursor->SetImage(imageData); vtkNew cursorRepresentation; cursorRepresentation->GetResliceCursorActor()-> GetCursorAlgorithm()->SetResliceCursor(resliceCursor); cursorRepresentation->GetResliceCursorActor()-> BasicPipeline.cxx GetCursorAlgorithm()->SetReslicePlaneNormal(2); vtkNew resliceCursorWidget; resliceCursorWidget->SetInteractor(renderWindowInteractor); resliceCursorWidget->SetDefaultRenderer(renderer); resliceCursorWidget->SetRepresentation(cursorRepresentation); resliceCursorWidget->SetManageWindowLevel(false); resliceCursorWidget->EnabledOn(); //resliceCursorWidget->ProcessEventsOff(); // Add actors to renderer renderer->AddViewProp(imageStack); renderer->ResetCamera(); // Start interaction renderWindowInteractor->Initialize(); renderWindow->Render(); renderWindowInteractor->Start(); return EXIT_SUCCESS; } void setupCamera(vtkCamera* camera) { double viewUp[3] = { 0, 1, 0 }; double leftToRight[3] = { 1, 0, 0 }; // compute the view plane normal double normal[3]; vtkMath::Cross(leftToRight, viewUp, normal); // get the camera focus double focus[3]; camera->GetFocalPoint(focus); // get the camera distance from the focus double d = camera->GetDistance(); // position the camera on view plane normal keeping the focus and the distance from it fixed camera->SetPosition( focus[0] + d*normal[0], focus[1] + d*normal[1], focus[2] + d*normal[2]); // make sure focus is the same camera->SetFocalPoint(focus); // setup view up vector camera->SetViewUp(viewUp); camera->OrthogonalizeViewUp(); } vtkSmartPointer loadDicom(const char* filename) { vtkNew reader; reader->FileLowerLeftOn(); reader->SetDirectoryName(filename); reader->UpdateInformation(); vtkNew imageInfo; imageInfo->SetOutputOrigin(0.0, 0.0, 0.0); imageInfo->SetOutputSpacing(reader->GetPixelSpacing()); imageInfo->SetInputConnection(reader->GetOutputPort()); imageInfo->Update(); return imageInfo->GetOutput(); } vtkSmartPointer loadNifti(const char* filename) { vtkNew niftiiReader; niftiiReader->SetFileName(filename); vtkNew imageInfo; imageInfo->SetOutputOrigin(0.0, 0.0, 0.0); imageInfo->SetInputConnection(niftiiReader->GetOutputPort()); imageInfo->Update(); return imageInfo->GetOutput();//data; } -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From 523480317 at qq.com Tue Dec 18 19:25:13 2018 From: 523480317 at qq.com (=?ISO-8859-1?B?eWlydWkxMjEw?=) Date: Wed, 19 Dec 2018 08:25:13 +0800 Subject: [vtkusers] The SetRate() function of vtkFFMPEGWriter is not working Message-ID: Hello, VTKer I am using vtkFFMPEGWriter to write a video, no matter the frame rate I set, the output video is still 600 frames/sec. The code I used has been attached. Can anybody check the problem for me? Thank you so much. Regards, YiRui -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 64066463 at 168E0131.E98F195C.png.jpg Type: image/jpeg Size: 5053 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 1.png Type: application/octet-stream Size: 5053 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: CMakeLists.txt Type: application/octet-stream Size: 303 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: FFMPEG.cxx Type: application/octet-stream Size: 1027 bytes Desc: not available URL: From Andx_roo at live.com Tue Dec 18 20:37:04 2018 From: Andx_roo at live.com (Andaharoo) Date: Tue, 18 Dec 2018 18:37:04 -0700 (MST) Subject: [vtkusers] Visualizing normal vectors In-Reply-To: <1544904178474-0.post@n5.nabble.com> References: <1544904178474-0.post@n5.nabble.com> Message-ID: <1545183424782-0.post@n5.nabble.com> I'd recommend using vtkOpenGLGlyph3DMapper instead. Much faster, assuming you have some gpu. Just make sure the normal array/orientation array is in the input polyData's point data. IE: polyData->GetPointData()->AddArray(your normal array) Then just specify the array the mapper should use with SetOrientationArray(your arrays name here). It will then search for the array in the input polydata. I frequently use this to draw thousands of oriented arrows with VTK. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From lasso at queensu.ca Wed Dec 19 01:31:31 2018 From: lasso at queensu.ca (Andras Lasso) Date: Wed, 19 Dec 2018 06:31:31 +0000 Subject: [vtkusers] Problem with displaying cross-hairs on 2D views when using vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack pipeline In-Reply-To: <1545158446707-0.post@n5.nabble.com> References: <1545158446707-0.post@n5.nabble.com> Message-ID: It is great that you are interested in medical imaging and has chosen to work with VTK. I would recommend to put your talent and effort into contributing to an existing open-source medical image viewer instead of spending time with redeveloping basic features. You could work on more interesting things, develop new features, and you would very quickly become a useful, valued member of a community. If you are interested in answers to your question (and your future questions) you can have a look at source code of existing VTK-based open-source medical image viewers, such as 3D Slicer, MITK, medInria, Horos, Ibis, CustusX, CamiTK, Invesalius, etc. Andras -----Original Message----- From: vtkusers On Behalf Of ochampao Sent: Tuesday, December 18, 2018 1:41 PM To: vtkusers at vtk.org Subject: [vtkusers] Problem with displaying cross-hairs on 2D views when using vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack pipeline Hi vtkUsers, I am developing a four-pane viewer for displaying medical images. The 3 views display slices of the volumes in the 3 standard anatomical views (axial, coronal, sagittal) whereas the 4th one displays some 3D surface rendering of the volume. For now, I will only focus on the 2D views. The 2D views use the following pipeline: vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack. This allows the application to overlay slices from multiple volumes simultaneously. The attached code is a minimal example of the 2D pipeline I use in my application. The slices displayed are determined by the focal point of the camera in each 2D view. What I would like to do is display a set of cross-hairs on each of the 2D views, but I don't know how to achieve this using the pipeline I am currently using. I am aware of the classes: vtkResliceCursorWidget, vtkResliceCursor, vtkResliceCursorLineRepresentation, vtkImagePlaneWidget, vtkResliceImageViewer I have tried using these classes (see commented code in attached source code), but they don't seem compatible with my current pipeline. For example, when using vtkResliceCursorWidget the cross-hairs are visible and I can interact with them but slicing stops working. I also see some weird artefacts around the border of the slice. Also, to use these classes I need to specify the volume which the reslice cursor will be slicing (vtkResliceCursor->SetImage(imageData)), but in my case I have multiple volumes. I am also aware of and tried using vtkCursor2D/vtkCursor3D. Although they are close to what I have in mind, they allow very limited customization of their look. Essentially what I would like to implement is something that looks like the cursor of vtkResliceCursorWidget/vtkImagePlaneWidget/vtkResliceImageViewer but does not handle slicing. Can someone recommend how can I achieve this, or point me to some classes/examples? Is their a way of using vtkResliceCursorWidget/vtkImagePlaneWidget/vtkResliceImageViewer with my current pipeline, or would I need to change it? Thanks a lot for your help. Panos ======================================================== Basic Pipeline Minimal Example ======================================================== #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void setupCamera(vtkCamera* camera); vtkSmartPointer loadDicom(const char* filename); vtkSmartPointer loadNifti(const char* filename); int main(int, char*[]) { // Setup renderer vtkNew renderer; renderer->SetBackground(0.0, 0.0, 0.0); renderer->GetActiveCamera()->ParallelProjectionOn(); renderer->ResetCameraClippingRange(); renderer->ResetCamera(); // Setup renderWindow vtkNew renderWindow; renderWindow->AddRenderer(renderer); // Setup interaction style vtkNew interactorStyle; interactorStyle->SetInteractionModeToImageSlicing(); // Setup window interactor vtkNew renderWindowInteractor; renderWindowInteractor->SetRenderWindow(renderWindow); renderWindowInteractor->SetInteractorStyle(interactorStyle); // Setup camera setupCamera(renderer->GetActiveCamera()); // Load data from DICOM series // vtkSmartPointer imageData = // loadDicom("""); // Load data from Nifti file vtkSmartPointer imageData = loadNifti(""); // setup slice mapper vtkNew resliceMapper; resliceMapper->SetInputData(imageData); resliceMapper->SliceFacesCameraOn(); resliceMapper->SliceAtFocalPointOn(); resliceMapper->JumpToNearestSliceOn(); resliceMapper->BorderOff(); // Set to full window and centered level: double window = imageData->GetScalarRange()[1] - imageData->GetScalarRange()[0]; double level = imageData->GetScalarRange()[0] + window / 2.0; // Setup prop holding the slice vtkNew imageSlice; imageSlice->SetMapper(resliceMapper); imageSlice->GetProperty()->SetColorWindow(window); imageSlice->GetProperty()->SetColorLevel(level); imageSlice->GetProperty()->SetLayerNumber(0); imageSlice->GetProperty()->SetInterpolationTypeToNearest(); // Setup prop holding the multiple slices vtkNew imageStack; imageStack->SetActiveLayer(imageSlice->GetProperty()->GetLayerNumber()); imageStack->AddImage(imageSlice); // add slice vtkNew resliceCursor; resliceCursor->SetCenter(imageData->GetCenter()); resliceCursor->SetThickMode(0); resliceCursor->SetImage(imageData); vtkNew cursorRepresentation; cursorRepresentation->GetResliceCursorActor()-> GetCursorAlgorithm()->SetResliceCursor(resliceCursor); cursorRepresentation->GetResliceCursorActor()-> BasicPipeline.cxx GetCursorAlgorithm()->SetReslicePlaneNormal(2); vtkNew resliceCursorWidget; resliceCursorWidget->SetInteractor(renderWindowInteractor); resliceCursorWidget->SetDefaultRenderer(renderer); resliceCursorWidget->SetRepresentation(cursorRepresentation); resliceCursorWidget->SetManageWindowLevel(false); resliceCursorWidget->EnabledOn(); //resliceCursorWidget->ProcessEventsOff(); // Add actors to renderer renderer->AddViewProp(imageStack); renderer->ResetCamera(); // Start interaction renderWindowInteractor->Initialize(); renderWindow->Render(); renderWindowInteractor->Start(); return EXIT_SUCCESS; } void setupCamera(vtkCamera* camera) { double viewUp[3] = { 0, 1, 0 }; double leftToRight[3] = { 1, 0, 0 }; // compute the view plane normal double normal[3]; vtkMath::Cross(leftToRight, viewUp, normal); // get the camera focus double focus[3]; camera->GetFocalPoint(focus); // get the camera distance from the focus double d = camera->GetDistance(); // position the camera on view plane normal keeping the focus and the distance from it fixed camera->SetPosition( focus[0] + d*normal[0], focus[1] + d*normal[1], focus[2] + d*normal[2]); // make sure focus is the same camera->SetFocalPoint(focus); // setup view up vector camera->SetViewUp(viewUp); camera->OrthogonalizeViewUp(); } vtkSmartPointer loadDicom(const char* filename) { vtkNew reader; reader->FileLowerLeftOn(); reader->SetDirectoryName(filename); reader->UpdateInformation(); vtkNew imageInfo; imageInfo->SetOutputOrigin(0.0, 0.0, 0.0); imageInfo->SetOutputSpacing(reader->GetPixelSpacing()); imageInfo->SetInputConnection(reader->GetOutputPort()); imageInfo->Update(); return imageInfo->GetOutput(); } vtkSmartPointer loadNifti(const char* filename) { vtkNew niftiiReader; niftiiReader->SetFileName(filename); vtkNew imageInfo; imageInfo->SetOutputOrigin(0.0, 0.0, 0.0); imageInfo->SetInputConnection(niftiiReader->GetOutputPort()); imageInfo->Update(); return imageInfo->GetOutput();//data; } -- Sent from: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1045678.n5.nabble.com%2FVTK-Users-f1224199.html&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=y%2FPL7RWRxL9djen9OHHFpV8mML1l8tDDID8vwEPDzr4%3D&reserved=0 _______________________________________________ Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=a5wXXUd01fJsRRfeOlVc%2Bk6JcNbeRrCaawzEeOBEpIQ%3D&reserved=0 Visit other Kitware open-source projects at https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=GTPQfYrm85nLVvMYqtzwxYrfNS%2BHK2U5E%2F8%2FXjTuyGQ%3D&reserved=0 Please keep messages on-topic and check the VTK FAQ at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vtk.org%2FWiki%2FVTK_FAQ&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=3OkV0h9SM82LHRbPbSKbfXkZuLWSqAjPyULJuBV%2FrGQ%3D&reserved=0 Search the list archives at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtkusers&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=ydyX30Af9G0j8PwVigfaCkucOiFqv0SdNKwyi7vx56Y%3D&reserved=0 Follow this link to subscribe/unsubscribe: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtkusers&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=zYNgte5262YQQDT42ydJgSd1qTiDwQBW4DeWwgOlCzE%3D&reserved=0 From mozendi at gmail.com Wed Dec 19 03:24:28 2018 From: mozendi at gmail.com (mozendi) Date: Wed, 19 Dec 2018 01:24:28 -0700 (MST) Subject: [vtkusers] Visualizing normal vectors In-Reply-To: <1545183424782-0.post@n5.nabble.com> References: <1544904178474-0.post@n5.nabble.com> <1545183424782-0.post@n5.nabble.com> Message-ID: <1545207868212-0.post@n5.nabble.com> Dear Andaharoo, Thank you for your recommendation. I tried to modify my codes according to your recommendations, my code is getting compiled successfully. However, when I run it I am getting an error message. The screenshot and my code are below. Could you please tell me what is wrong with my code? Thanks in advance #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include # include "vtkGlyph3DMapper.h" # include "vtkGlyph3DMapper.h" #include #include int main(int argc, char* argv[]) { vtkSmartPointer reader = vtkSmartPointer::New(); reader->SetFileName("points_and_normals.xyz"); reader->DetectNumericColumnsOn(); reader->SetFieldDelimiterCharacters(" "); reader->Update(); vtkTable* table = reader->GetOutput(); vtkSmartPointer points = vtkSmartPointer::New(); vtkSmartPointer normals = vtkSmartPointer::New(); normals->SetNumberOfComponents(3); //3d normals (ie x,y,z) std::cout << "Table has " << table->GetNumberOfRows() << " rows." << std::endl; std::cout << "Table has " << table->GetNumberOfColumns() << " columns." << std::endl; for (vtkIdType i = 0; i < table->GetNumberOfRows(); i++) { points->InsertNextPoint((table->GetValue(i, 0)).ToDouble(), (table->GetValue(i, 1)).ToDouble(), (table->GetValue(i, 2)).ToDouble()); double n[3]; n[0] = (table->GetValue(i, 3)).ToDouble(); n[1] = (table->GetValue(i, 4)).ToDouble(); n[2] = (table->GetValue(i, 5)).ToDouble(); normals->InsertNextTuple(n); } std::cout << "There are " << points->GetNumberOfPoints() << " points." << std::endl; vtkSmartPointer polydata = vtkSmartPointer::New(); polydata->SetPoints(points); //polydata->GetPointData()->SetNormals(normals); polydata->GetPointData()->AddArray(normals); vtkSmartPointer Glyph3D = vtkSmartPointer::New(); Glyph3D->SetInputData(polydata); Glyph3D->SetOrientationArray("normals"); Glyph3D->SetScaleFactor(.5); Glyph3D->Update(); vtkSmartPointer glyph3DActor = vtkSmartPointer::New(); glyph3DActor->SetMapper(Glyph3D); glyph3DActor->GetProperty()->SetColor(0.8900, 0.8100, 0.3400); vtkSmartPointer renderer = vtkSmartPointer::New(); vtkSmartPointer renderWindow = vtkSmartPointer::New(); renderWindow->AddRenderer(renderer); vtkSmartPointer renderWindowInteractor = vtkSmartPointer::New(); renderWindowInteractor->SetRenderWindow(renderWindow); renderer->AddActor(glyph3DActor); renderer->SetBackground(.5, .5, .5); renderWindow->Render(); renderWindowInteractor->Start(); return EXIT_SUCCESS; } -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From Andx_roo at live.com Wed Dec 19 04:26:23 2018 From: Andx_roo at live.com (Andaharoo) Date: Wed, 19 Dec 2018 02:26:23 -0700 (MST) Subject: [vtkusers] Visualizing normal vectors In-Reply-To: <1545207868212-0.post@n5.nabble.com> References: <1544904178474-0.post@n5.nabble.com> <1545183424782-0.post@n5.nabble.com> <1545207868212-0.post@n5.nabble.com> Message-ID: <1545211583462-0.post@n5.nabble.com> Your error said an array index went out of bounds. What line? Also I noticed you never set the source data for the glyph. Could be unrelated to your current error message, but a problem. The glyph mapper takes two inputs. The glyph data (positions, normals, scalars, etc) and the source (thing to copy). So if you want arrows as the normals do this: vtkSmartPointer glyph3D = vtkSmartPointer::New(); glyph3D ->SetInputData(polydata); vtkSmartPointer glyphSource = vtkSmartPointer::New(); glyphSource->Update(); glyph3D->SetSourceData(glyphSource->GetOutput()); glyph3D ->SetOrientationArray("normals"); glyph3D ->SetScaleFactor(0.5); glyph3D ->Update(); -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From andrew.buckler at elucidbio.com Wed Dec 19 12:51:20 2018 From: andrew.buckler at elucidbio.com (Andrew J. Buckler (Elucid Bioimaging)) Date: Wed, 19 Dec 2018 17:51:20 +0000 Subject: [vtkusers] vtkImageInterpolator when original image direction was -1 for an axis Message-ID: Hello, I have an application that successfully uses vtkImageInterpolator that ultimately use DICOM data read in by ITK. These data sets display correctly even when the z direction is -1, but the interpolator does not work when the data coordinate is less than the origin. It is possible that the problem originates in my use of vtkVolumePicker to pick the point, but this appears well behaved, in returning a coordinate smaller than the value of the origin, as makes sense for the direction being negative, and the point it returns is correct in the volume. Resetting the origin doesn't help, as the picker still returns a coordinate smaller than the (new) origin - it seems to just slide all numbers down. Rotating the image so as to make the direction of the z axis positive does make it work - but then the display causes an unintended mirror image problem (e.g., the aorta comes in front of the heart rather than staying behind the heart in a chest image). I am sure it must be obvious but I have not yet seen what to do. Thank you, Andy -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew.buckler at elucidbio.com Wed Dec 19 12:51:20 2018 From: andrew.buckler at elucidbio.com (Andrew J. Buckler (Elucid Bioimaging)) Date: Wed, 19 Dec 2018 17:51:20 +0000 Subject: [vtkusers] vtkImageInterpolator when original image direction was -1 for an axis Message-ID: Hello, I have an application that successfully uses vtkImageInterpolator that ultimately use DICOM data read in by ITK. These data sets display correctly even when the z direction is -1, but the interpolator does not work when the data coordinate is less than the origin. It is possible that the problem originates in my use of vtkVolumePicker to pick the point, but this appears well behaved, in returning a coordinate smaller than the value of the origin, as makes sense for the direction being negative, and the point it returns is correct in the volume. Resetting the origin doesn't help, as the picker still returns a coordinate smaller than the (new) origin - it seems to just slide all numbers down. Rotating the image so as to make the direction of the z axis positive does make it work - but then the display causes an unintended mirror image problem (e.g., the aorta comes in front of the heart rather than staying behind the heart in a chest image). I am sure it must be obvious but I have not yet seen what to do. Thank you, Andy -------------- next part -------------- An HTML attachment was scrubbed... URL: From msmerps at gmail.com Wed Dec 19 14:01:09 2018 From: msmerps at gmail.com (The Merper) Date: Wed, 19 Dec 2018 14:01:09 -0500 Subject: [vtkusers] Renderer specific interactors? Message-ID: Hi all, I am trying to create a RenderWindow with multiple Renderers. I want mouse clicks to have different actions in the different renderers. Is this possible? It appears that the same interactor is applied to all Renderers that belong to a RenderWindow. thank you in advance, -Merps -------------- next part -------------- An HTML attachment was scrubbed... URL: From poweruserm at live.com.au Wed Dec 19 20:46:40 2018 From: poweruserm at live.com.au (A Z) Date: Thu, 20 Dec 2018 01:46:40 +0000 Subject: [vtkusers] vtkusers Digest, Vol 176, Issue 22 In-Reply-To: References: Message-ID: I'm in a situation where I'm in a secure environment, and I can't use Visual Studio or other sorts of tools to compile and build the VTK. Particularly, this is an issue if I need VTK in 64 bit (for Windows). The other thing is that high speed internet through the hardware of the phone network is not all that great where we are. We are prepared to download the VTK once, byt not Visual Studio, who who knows what else Cygwin might need. :( What I think I simply finally and just plain need is for the VTK to buld the 64 bit Windows .dlls for me, and offer them for download via an internet site. Can someone who is part of the VTK team acomplish this for me, but for other similar members of the public as well? ________________________________ From: vtkusers on behalf of vtkusers-request at public.kitware.com Sent: Thursday, 20 December 2018 4:00 AM To: vtkusers at public.kitware.com Subject: vtkusers Digest, Vol 176, Issue 22 Send vtkusers mailing list submissions to vtkusers at public.kitware.com To subscribe or unsubscribe via the World Wide Web, visit https://public.kitware.com/mailman/listinfo/vtkusers or, via email, send a message with subject or body 'help' to vtkusers-request at public.kitware.com You can reach the person managing the list at vtkusers-owner at public.kitware.com When replying, please edit your Subject line so it is more specific than "Re: Contents of vtkusers digest..." Today's Topics: 1. Problem with displaying cross-hairs on 2D views when using vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack pipeline (ochampao) 2. The SetRate() function of vtkFFMPEGWriter is not working (=?ISO-8859-1?B?eWlydWkxMjEw?=) 3. Re: Visualizing normal vectors (Andaharoo) 4. Re: Problem with displaying cross-hairs on 2D views when using vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack pipeline (Andras Lasso) 5. Re: Visualizing normal vectors (mozendi) 6. Re: Visualizing normal vectors (Andaharoo) ---------------------------------------------------------------------- Message: 1 Date: Tue, 18 Dec 2018 11:40:46 -0700 (MST) From: ochampao To: vtkusers at vtk.org Subject: [vtkusers] Problem with displaying cross-hairs on 2D views when using vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack pipeline Message-ID: <1545158446707-0.post at n5.nabble.com> Content-Type: text/plain; charset=us-ascii Hi vtkUsers, I am developing a four-pane viewer for displaying medical images. The 3 views display slices of the volumes in the 3 standard anatomical views (axial, coronal, sagittal) whereas the 4th one displays some 3D surface rendering of the volume. For now, I will only focus on the 2D views. The 2D views use the following pipeline: vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack. This allows the application to overlay slices from multiple volumes simultaneously. The attached code is a minimal example of the 2D pipeline I use in my application. The slices displayed are determined by the focal point of the camera in each 2D view. What I would like to do is display a set of cross-hairs on each of the 2D views, but I don't know how to achieve this using the pipeline I am currently using. I am aware of the classes: vtkResliceCursorWidget, vtkResliceCursor, vtkResliceCursorLineRepresentation, vtkImagePlaneWidget, vtkResliceImageViewer I have tried using these classes (see commented code in attached source code), but they don't seem compatible with my current pipeline. For example, when using vtkResliceCursorWidget the cross-hairs are visible and I can interact with them but slicing stops working. I also see some weird artefacts around the border of the slice. Also, to use these classes I need to specify the volume which the reslice cursor will be slicing (vtkResliceCursor->SetImage(imageData)), but in my case I have multiple volumes. I am also aware of and tried using vtkCursor2D/vtkCursor3D. Although they are close to what I have in mind, they allow very limited customization of their look. Essentially what I would like to implement is something that looks like the cursor of vtkResliceCursorWidget/vtkImagePlaneWidget/vtkResliceImageViewer but does not handle slicing. Can someone recommend how can I achieve this, or point me to some classes/examples? Is their a way of using vtkResliceCursorWidget/vtkImagePlaneWidget/vtkResliceImageViewer with my current pipeline, or would I need to change it? Thanks a lot for your help. Panos ======================================================== Basic Pipeline Minimal Example ======================================================== #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void setupCamera(vtkCamera* camera); vtkSmartPointer loadDicom(const char* filename); vtkSmartPointer loadNifti(const char* filename); int main(int, char*[]) { // Setup renderer vtkNew renderer; renderer->SetBackground(0.0, 0.0, 0.0); renderer->GetActiveCamera()->ParallelProjectionOn(); renderer->ResetCameraClippingRange(); renderer->ResetCamera(); // Setup renderWindow vtkNew renderWindow; renderWindow->AddRenderer(renderer); // Setup interaction style vtkNew interactorStyle; interactorStyle->SetInteractionModeToImageSlicing(); // Setup window interactor vtkNew renderWindowInteractor; renderWindowInteractor->SetRenderWindow(renderWindow); renderWindowInteractor->SetInteractorStyle(interactorStyle); // Setup camera setupCamera(renderer->GetActiveCamera()); // Load data from DICOM series // vtkSmartPointer imageData = // loadDicom("""); // Load data from Nifti file vtkSmartPointer imageData = loadNifti(""); // setup slice mapper vtkNew resliceMapper; resliceMapper->SetInputData(imageData); resliceMapper->SliceFacesCameraOn(); resliceMapper->SliceAtFocalPointOn(); resliceMapper->JumpToNearestSliceOn(); resliceMapper->BorderOff(); // Set to full window and centered level: double window = imageData->GetScalarRange()[1] - imageData->GetScalarRange()[0]; double level = imageData->GetScalarRange()[0] + window / 2.0; // Setup prop holding the slice vtkNew imageSlice; imageSlice->SetMapper(resliceMapper); imageSlice->GetProperty()->SetColorWindow(window); imageSlice->GetProperty()->SetColorLevel(level); imageSlice->GetProperty()->SetLayerNumber(0); imageSlice->GetProperty()->SetInterpolationTypeToNearest(); // Setup prop holding the multiple slices vtkNew imageStack; imageStack->SetActiveLayer(imageSlice->GetProperty()->GetLayerNumber()); imageStack->AddImage(imageSlice); // add slice vtkNew resliceCursor; resliceCursor->SetCenter(imageData->GetCenter()); resliceCursor->SetThickMode(0); resliceCursor->SetImage(imageData); vtkNew cursorRepresentation; cursorRepresentation->GetResliceCursorActor()-> GetCursorAlgorithm()->SetResliceCursor(resliceCursor); cursorRepresentation->GetResliceCursorActor()-> BasicPipeline.cxx GetCursorAlgorithm()->SetReslicePlaneNormal(2); vtkNew resliceCursorWidget; resliceCursorWidget->SetInteractor(renderWindowInteractor); resliceCursorWidget->SetDefaultRenderer(renderer); resliceCursorWidget->SetRepresentation(cursorRepresentation); resliceCursorWidget->SetManageWindowLevel(false); resliceCursorWidget->EnabledOn(); //resliceCursorWidget->ProcessEventsOff(); // Add actors to renderer renderer->AddViewProp(imageStack); renderer->ResetCamera(); // Start interaction renderWindowInteractor->Initialize(); renderWindow->Render(); renderWindowInteractor->Start(); return EXIT_SUCCESS; } void setupCamera(vtkCamera* camera) { double viewUp[3] = { 0, 1, 0 }; double leftToRight[3] = { 1, 0, 0 }; // compute the view plane normal double normal[3]; vtkMath::Cross(leftToRight, viewUp, normal); // get the camera focus double focus[3]; camera->GetFocalPoint(focus); // get the camera distance from the focus double d = camera->GetDistance(); // position the camera on view plane normal keeping the focus and the distance from it fixed camera->SetPosition( focus[0] + d*normal[0], focus[1] + d*normal[1], focus[2] + d*normal[2]); // make sure focus is the same camera->SetFocalPoint(focus); // setup view up vector camera->SetViewUp(viewUp); camera->OrthogonalizeViewUp(); } vtkSmartPointer loadDicom(const char* filename) { vtkNew reader; reader->FileLowerLeftOn(); reader->SetDirectoryName(filename); reader->UpdateInformation(); vtkNew imageInfo; imageInfo->SetOutputOrigin(0.0, 0.0, 0.0); imageInfo->SetOutputSpacing(reader->GetPixelSpacing()); imageInfo->SetInputConnection(reader->GetOutputPort()); imageInfo->Update(); return imageInfo->GetOutput(); } vtkSmartPointer loadNifti(const char* filename) { vtkNew niftiiReader; niftiiReader->SetFileName(filename); vtkNew imageInfo; imageInfo->SetOutputOrigin(0.0, 0.0, 0.0); imageInfo->SetInputConnection(niftiiReader->GetOutputPort()); imageInfo->Update(); return imageInfo->GetOutput();//data; } -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html ------------------------------ Message: 2 Date: Wed, 19 Dec 2018 08:25:13 +0800 From: "=?ISO-8859-1?B?eWlydWkxMjEw?=" <523480317 at qq.com> To: "=?ISO-8859-1?B?dnRrdXNlcnM=?=" Subject: [vtkusers] The SetRate() function of vtkFFMPEGWriter is not working Message-ID: Content-Type: text/plain; charset="iso-8859-1" Hello, VTKer I am using vtkFFMPEGWriter to write a video, no matter the frame rate I set, the output video is still 600 frames/sec. The code I used has been attached. Can anybody check the problem for me? Thank you so much. Regards, YiRui -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 64066463 at 168E0131.E98F195C.png.jpg Type: image/jpeg Size: 5053 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 1.png Type: application/octet-stream Size: 5053 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: CMakeLists.txt Type: application/octet-stream Size: 303 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: FFMPEG.cxx Type: application/octet-stream Size: 1027 bytes Desc: not available URL: ------------------------------ Message: 3 Date: Tue, 18 Dec 2018 18:37:04 -0700 (MST) From: Andaharoo To: vtkusers at vtk.org Subject: Re: [vtkusers] Visualizing normal vectors Message-ID: <1545183424782-0.post at n5.nabble.com> Content-Type: text/plain; charset=us-ascii I'd recommend using vtkOpenGLGlyph3DMapper instead. Much faster, assuming you have some gpu. Just make sure the normal array/orientation array is in the input polyData's point data. IE: polyData->GetPointData()->AddArray(your normal array) Then just specify the array the mapper should use with SetOrientationArray(your arrays name here). It will then search for the array in the input polydata. I frequently use this to draw thousands of oriented arrows with VTK. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html ------------------------------ Message: 4 Date: Wed, 19 Dec 2018 06:31:31 +0000 From: Andras Lasso To: ochampao , "vtkusers at vtk.org" Subject: Re: [vtkusers] Problem with displaying cross-hairs on 2D views when using vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack pipeline Message-ID: Content-Type: text/plain; charset="us-ascii" It is great that you are interested in medical imaging and has chosen to work with VTK. I would recommend to put your talent and effort into contributing to an existing open-source medical image viewer instead of spending time with redeveloping basic features. You could work on more interesting things, develop new features, and you would very quickly become a useful, valued member of a community. If you are interested in answers to your question (and your future questions) you can have a look at source code of existing VTK-based open-source medical image viewers, such as 3D Slicer, MITK, medInria, Horos, Ibis, CustusX, CamiTK, Invesalius, etc. Andras -----Original Message----- From: vtkusers On Behalf Of ochampao Sent: Tuesday, December 18, 2018 1:41 PM To: vtkusers at vtk.org Subject: [vtkusers] Problem with displaying cross-hairs on 2D views when using vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack pipeline Hi vtkUsers, I am developing a four-pane viewer for displaying medical images. The 3 views display slices of the volumes in the 3 standard anatomical views (axial, coronal, sagittal) whereas the 4th one displays some 3D surface rendering of the volume. For now, I will only focus on the 2D views. The 2D views use the following pipeline: vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack. This allows the application to overlay slices from multiple volumes simultaneously. The attached code is a minimal example of the 2D pipeline I use in my application. The slices displayed are determined by the focal point of the camera in each 2D view. What I would like to do is display a set of cross-hairs on each of the 2D views, but I don't know how to achieve this using the pipeline I am currently using. I am aware of the classes: vtkResliceCursorWidget, vtkResliceCursor, vtkResliceCursorLineRepresentation, vtkImagePlaneWidget, vtkResliceImageViewer I have tried using these classes (see commented code in attached source code), but they don't seem compatible with my current pipeline. For example, when using vtkResliceCursorWidget the cross-hairs are visible and I can interact with them but slicing stops working. I also see some weird artefacts around the border of the slice. Also, to use these classes I need to specify the volume which the reslice cursor will be slicing (vtkResliceCursor->SetImage(imageData)), but in my case I have multiple volumes. I am also aware of and tried using vtkCursor2D/vtkCursor3D. Although they are close to what I have in mind, they allow very limited customization of their look. Essentially what I would like to implement is something that looks like the cursor of vtkResliceCursorWidget/vtkImagePlaneWidget/vtkResliceImageViewer but does not handle slicing. Can someone recommend how can I achieve this, or point me to some classes/examples? Is their a way of using vtkResliceCursorWidget/vtkImagePlaneWidget/vtkResliceImageViewer with my current pipeline, or would I need to change it? Thanks a lot for your help. Panos ======================================================== Basic Pipeline Minimal Example ======================================================== #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void setupCamera(vtkCamera* camera); vtkSmartPointer loadDicom(const char* filename); vtkSmartPointer loadNifti(const char* filename); int main(int, char*[]) { // Setup renderer vtkNew renderer; renderer->SetBackground(0.0, 0.0, 0.0); renderer->GetActiveCamera()->ParallelProjectionOn(); renderer->ResetCameraClippingRange(); renderer->ResetCamera(); // Setup renderWindow vtkNew renderWindow; renderWindow->AddRenderer(renderer); // Setup interaction style vtkNew interactorStyle; interactorStyle->SetInteractionModeToImageSlicing(); // Setup window interactor vtkNew renderWindowInteractor; renderWindowInteractor->SetRenderWindow(renderWindow); renderWindowInteractor->SetInteractorStyle(interactorStyle); // Setup camera setupCamera(renderer->GetActiveCamera()); // Load data from DICOM series // vtkSmartPointer imageData = // loadDicom("""); // Load data from Nifti file vtkSmartPointer imageData = loadNifti(""); // setup slice mapper vtkNew resliceMapper; resliceMapper->SetInputData(imageData); resliceMapper->SliceFacesCameraOn(); resliceMapper->SliceAtFocalPointOn(); resliceMapper->JumpToNearestSliceOn(); resliceMapper->BorderOff(); // Set to full window and centered level: double window = imageData->GetScalarRange()[1] - imageData->GetScalarRange()[0]; double level = imageData->GetScalarRange()[0] + window / 2.0; // Setup prop holding the slice vtkNew imageSlice; imageSlice->SetMapper(resliceMapper); imageSlice->GetProperty()->SetColorWindow(window); imageSlice->GetProperty()->SetColorLevel(level); imageSlice->GetProperty()->SetLayerNumber(0); imageSlice->GetProperty()->SetInterpolationTypeToNearest(); // Setup prop holding the multiple slices vtkNew imageStack; imageStack->SetActiveLayer(imageSlice->GetProperty()->GetLayerNumber()); imageStack->AddImage(imageSlice); // add slice vtkNew resliceCursor; resliceCursor->SetCenter(imageData->GetCenter()); resliceCursor->SetThickMode(0); resliceCursor->SetImage(imageData); vtkNew cursorRepresentation; cursorRepresentation->GetResliceCursorActor()-> GetCursorAlgorithm()->SetResliceCursor(resliceCursor); cursorRepresentation->GetResliceCursorActor()-> BasicPipeline.cxx GetCursorAlgorithm()->SetReslicePlaneNormal(2); vtkNew resliceCursorWidget; resliceCursorWidget->SetInteractor(renderWindowInteractor); resliceCursorWidget->SetDefaultRenderer(renderer); resliceCursorWidget->SetRepresentation(cursorRepresentation); resliceCursorWidget->SetManageWindowLevel(false); resliceCursorWidget->EnabledOn(); //resliceCursorWidget->ProcessEventsOff(); // Add actors to renderer renderer->AddViewProp(imageStack); renderer->ResetCamera(); // Start interaction renderWindowInteractor->Initialize(); renderWindow->Render(); renderWindowInteractor->Start(); return EXIT_SUCCESS; } void setupCamera(vtkCamera* camera) { double viewUp[3] = { 0, 1, 0 }; double leftToRight[3] = { 1, 0, 0 }; // compute the view plane normal double normal[3]; vtkMath::Cross(leftToRight, viewUp, normal); // get the camera focus double focus[3]; camera->GetFocalPoint(focus); // get the camera distance from the focus double d = camera->GetDistance(); // position the camera on view plane normal keeping the focus and the distance from it fixed camera->SetPosition( focus[0] + d*normal[0], focus[1] + d*normal[1], focus[2] + d*normal[2]); // make sure focus is the same camera->SetFocalPoint(focus); // setup view up vector camera->SetViewUp(viewUp); camera->OrthogonalizeViewUp(); } vtkSmartPointer loadDicom(const char* filename) { vtkNew reader; reader->FileLowerLeftOn(); reader->SetDirectoryName(filename); reader->UpdateInformation(); vtkNew imageInfo; imageInfo->SetOutputOrigin(0.0, 0.0, 0.0); imageInfo->SetOutputSpacing(reader->GetPixelSpacing()); imageInfo->SetInputConnection(reader->GetOutputPort()); imageInfo->Update(); return imageInfo->GetOutput(); } vtkSmartPointer loadNifti(const char* filename) { vtkNew niftiiReader; niftiiReader->SetFileName(filename); vtkNew imageInfo; imageInfo->SetOutputOrigin(0.0, 0.0, 0.0); imageInfo->SetInputConnection(niftiiReader->GetOutputPort()); imageInfo->Update(); return imageInfo->GetOutput();//data; } -- Sent from: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1045678.n5.nabble.com%2FVTK-Users-f1224199.html&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=y%2FPL7RWRxL9djen9OHHFpV8mML1l8tDDID8vwEPDzr4%3D&reserved=0 _______________________________________________ Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=a5wXXUd01fJsRRfeOlVc%2Bk6JcNbeRrCaawzEeOBEpIQ%3D&reserved=0 Visit other Kitware open-source projects at https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=GTPQfYrm85nLVvMYqtzwxYrfNS%2BHK2U5E%2F8%2FXjTuyGQ%3D&reserved=0 Please keep messages on-topic and check the VTK FAQ at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vtk.org%2FWiki%2FVTK_FAQ&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=3OkV0h9SM82LHRbPbSKbfXkZuLWSqAjPyULJuBV%2FrGQ%3D&reserved=0 Search the list archives at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtkusers&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=ydyX30Af9G0j8PwVigfaCkucOiFqv0SdNKwyi7vx56Y%3D&reserved=0 Follow this link to subscribe/unsubscribe: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtkusers&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=zYNgte5262YQQDT42ydJgSd1qTiDwQBW4DeWwgOlCzE%3D&reserved=0 ------------------------------ Message: 5 Date: Wed, 19 Dec 2018 01:24:28 -0700 (MST) From: mozendi To: vtkusers at vtk.org Subject: Re: [vtkusers] Visualizing normal vectors Message-ID: <1545207868212-0.post at n5.nabble.com> Content-Type: text/plain; charset=us-ascii Dear Andaharoo, Thank you for your recommendation. I tried to modify my codes according to your recommendations, my code is getting compiled successfully. However, when I run it I am getting an error message. The screenshot and my code are below. Could you please tell me what is wrong with my code? Thanks in advance #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include # include "vtkGlyph3DMapper.h" # include "vtkGlyph3DMapper.h" #include #include int main(int argc, char* argv[]) { vtkSmartPointer reader = vtkSmartPointer::New(); reader->SetFileName("points_and_normals.xyz"); reader->DetectNumericColumnsOn(); reader->SetFieldDelimiterCharacters(" "); reader->Update(); vtkTable* table = reader->GetOutput(); vtkSmartPointer points = vtkSmartPointer::New(); vtkSmartPointer normals = vtkSmartPointer::New(); normals->SetNumberOfComponents(3); //3d normals (ie x,y,z) std::cout << "Table has " << table->GetNumberOfRows() << " rows." << std::endl; std::cout << "Table has " << table->GetNumberOfColumns() << " columns." << std::endl; for (vtkIdType i = 0; i < table->GetNumberOfRows(); i++) { points->InsertNextPoint((table->GetValue(i, 0)).ToDouble(), (table->GetValue(i, 1)).ToDouble(), (table->GetValue(i, 2)).ToDouble()); double n[3]; n[0] = (table->GetValue(i, 3)).ToDouble(); n[1] = (table->GetValue(i, 4)).ToDouble(); n[2] = (table->GetValue(i, 5)).ToDouble(); normals->InsertNextTuple(n); } std::cout << "There are " << points->GetNumberOfPoints() << " points." << std::endl; vtkSmartPointer polydata = vtkSmartPointer::New(); polydata->SetPoints(points); //polydata->GetPointData()->SetNormals(normals); polydata->GetPointData()->AddArray(normals); vtkSmartPointer Glyph3D = vtkSmartPointer::New(); Glyph3D->SetInputData(polydata); Glyph3D->SetOrientationArray("normals"); Glyph3D->SetScaleFactor(.5); Glyph3D->Update(); vtkSmartPointer glyph3DActor = vtkSmartPointer::New(); glyph3DActor->SetMapper(Glyph3D); glyph3DActor->GetProperty()->SetColor(0.8900, 0.8100, 0.3400); vtkSmartPointer renderer = vtkSmartPointer::New(); vtkSmartPointer renderWindow = vtkSmartPointer::New(); renderWindow->AddRenderer(renderer); vtkSmartPointer renderWindowInteractor = vtkSmartPointer::New(); renderWindowInteractor->SetRenderWindow(renderWindow); renderer->AddActor(glyph3DActor); renderer->SetBackground(.5, .5, .5); renderWindow->Render(); renderWindowInteractor->Start(); return EXIT_SUCCESS; } -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html ------------------------------ Message: 6 Date: Wed, 19 Dec 2018 02:26:23 -0700 (MST) From: Andaharoo To: vtkusers at vtk.org Subject: Re: [vtkusers] Visualizing normal vectors Message-ID: <1545211583462-0.post at n5.nabble.com> Content-Type: text/plain; charset=us-ascii Your error said an array index went out of bounds. What line? Also I noticed you never set the source data for the glyph. Could be unrelated to your current error message, but a problem. The glyph mapper takes two inputs. The glyph data (positions, normals, scalars, etc) and the source (thing to copy). So if you want arrows as the normals do this: vtkSmartPointer glyph3D = vtkSmartPointer::New(); glyph3D ->SetInputData(polydata); vtkSmartPointer glyphSource = vtkSmartPointer::New(); glyphSource->Update(); glyph3D->SetSourceData(glyphSource->GetOutput()); glyph3D ->SetOrientationArray("normals"); glyph3D ->SetScaleFactor(0.5); glyph3D ->Update(); -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html ------------------------------ Subject: Digest Footer _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ Search the list archives at: http://markmail.org/search/?q=vtkusers Follow this link to subscribe/unsubscribe: https://public.kitware.com/mailman/listinfo/vtkusers ------------------------------ End of vtkusers Digest, Vol 176, Issue 22 ***************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From lasso at queensu.ca Wed Dec 19 21:33:36 2018 From: lasso at queensu.ca (Andras Lasso) Date: Thu, 20 Dec 2018 02:33:36 +0000 Subject: [vtkusers] vtkusers Digest, Vol 176, Issue 22 In-Reply-To: References: Message-ID: It would help if you wrote a bit about yourself, your constraints, and especially what you would like to do - not just that you want VTK DLLs. VTK is bundled with many application frameworks (ParaView, 3D Slicer, etc.), therefore - as others suggested - an obvious solution would be to use those to build your custom application. These frameworks contain not just VTK but other libraries necessary to build a complete application. You don't need any compiler, don't need to worry about GUI toolkit, etc. since all features are available and extensible using Python. Andras From: vtkusers On Behalf Of A Z Sent: Wednesday, December 19, 2018 8:47 PM To: vtkusers at public.kitware.com Subject: Re: [vtkusers] vtkusers Digest, Vol 176, Issue 22 Importance: High I'm in a situation where I'm in a secure environment, and I can't use Visual Studio or other sorts of tools to compile and build the VTK. Particularly, this is an issue if I need VTK in 64 bit (for Windows). The other thing is that high speed internet through the hardware of the phone network is not all that great where we are. We are prepared to download the VTK once, byt not Visual Studio, who who knows what else Cygwin might need. :( What I think I simply finally and just plain need is for the VTK to buld the 64 bit Windows .dlls for me, and offer them for download via an internet site. Can someone who is part of the VTK team acomplish this for me, but for other similar members of the public as well? ________________________________ From: vtkusers > on behalf of vtkusers-request at public.kitware.com > Sent: Thursday, 20 December 2018 4:00 AM To: vtkusers at public.kitware.com Subject: vtkusers Digest, Vol 176, Issue 22 Send vtkusers mailing list submissions to vtkusers at public.kitware.com To subscribe or unsubscribe via the World Wide Web, visit https://public.kitware.com/mailman/listinfo/vtkusers or, via email, send a message with subject or body 'help' to vtkusers-request at public.kitware.com You can reach the person managing the list at vtkusers-owner at public.kitware.com When replying, please edit your Subject line so it is more specific than "Re: Contents of vtkusers digest..." Today's Topics: 1. Problem with displaying cross-hairs on 2D views when using vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack pipeline (ochampao) 2. The SetRate() function of vtkFFMPEGWriter is not working (=?ISO-8859-1?B?eWlydWkxMjEw?=) 3. Re: Visualizing normal vectors (Andaharoo) 4. Re: Problem with displaying cross-hairs on 2D views when using vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack pipeline (Andras Lasso) 5. Re: Visualizing normal vectors (mozendi) 6. Re: Visualizing normal vectors (Andaharoo) ---------------------------------------------------------------------- Message: 1 Date: Tue, 18 Dec 2018 11:40:46 -0700 (MST) From: ochampao > To: vtkusers at vtk.org Subject: [vtkusers] Problem with displaying cross-hairs on 2D views when using vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack pipeline Message-ID: <1545158446707-0.post at n5.nabble.com> Content-Type: text/plain; charset=us-ascii Hi vtkUsers, I am developing a four-pane viewer for displaying medical images. The 3 views display slices of the volumes in the 3 standard anatomical views (axial, coronal, sagittal) whereas the 4th one displays some 3D surface rendering of the volume. For now, I will only focus on the 2D views. The 2D views use the following pipeline: vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack. This allows the application to overlay slices from multiple volumes simultaneously. The attached code is a minimal example of the 2D pipeline I use in my application. The slices displayed are determined by the focal point of the camera in each 2D view. What I would like to do is display a set of cross-hairs on each of the 2D views, but I don't know how to achieve this using the pipeline I am currently using. I am aware of the classes: vtkResliceCursorWidget, vtkResliceCursor, vtkResliceCursorLineRepresentation, vtkImagePlaneWidget, vtkResliceImageViewer I have tried using these classes (see commented code in attached source code), but they don't seem compatible with my current pipeline. For example, when using vtkResliceCursorWidget the cross-hairs are visible and I can interact with them but slicing stops working. I also see some weird artefacts around the border of the slice. Also, to use these classes I need to specify the volume which the reslice cursor will be slicing (vtkResliceCursor->SetImage(imageData)), but in my case I have multiple volumes. I am also aware of and tried using vtkCursor2D/vtkCursor3D. Although they are close to what I have in mind, they allow very limited customization of their look. Essentially what I would like to implement is something that looks like the cursor of vtkResliceCursorWidget/vtkImagePlaneWidget/vtkResliceImageViewer but does not handle slicing. Can someone recommend how can I achieve this, or point me to some classes/examples? Is their a way of using vtkResliceCursorWidget/vtkImagePlaneWidget/vtkResliceImageViewer with my current pipeline, or would I need to change it? Thanks a lot for your help. Panos ======================================================== Basic Pipeline Minimal Example ======================================================== #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void setupCamera(vtkCamera* camera); vtkSmartPointer loadDicom(const char* filename); vtkSmartPointer loadNifti(const char* filename); int main(int, char*[]) { // Setup renderer vtkNew renderer; renderer->SetBackground(0.0, 0.0, 0.0); renderer->GetActiveCamera()->ParallelProjectionOn(); renderer->ResetCameraClippingRange(); renderer->ResetCamera(); // Setup renderWindow vtkNew renderWindow; renderWindow->AddRenderer(renderer); // Setup interaction style vtkNew interactorStyle; interactorStyle->SetInteractionModeToImageSlicing(); // Setup window interactor vtkNew renderWindowInteractor; renderWindowInteractor->SetRenderWindow(renderWindow); renderWindowInteractor->SetInteractorStyle(interactorStyle); // Setup camera setupCamera(renderer->GetActiveCamera()); // Load data from DICOM series // vtkSmartPointer imageData = // loadDicom("""); // Load data from Nifti file vtkSmartPointer imageData = loadNifti(""); // setup slice mapper vtkNew resliceMapper; resliceMapper->SetInputData(imageData); resliceMapper->SliceFacesCameraOn(); resliceMapper->SliceAtFocalPointOn(); resliceMapper->JumpToNearestSliceOn(); resliceMapper->BorderOff(); // Set to full window and centered level: double window = imageData->GetScalarRange()[1] - imageData->GetScalarRange()[0]; double level = imageData->GetScalarRange()[0] + window / 2.0; // Setup prop holding the slice vtkNew imageSlice; imageSlice->SetMapper(resliceMapper); imageSlice->GetProperty()->SetColorWindow(window); imageSlice->GetProperty()->SetColorLevel(level); imageSlice->GetProperty()->SetLayerNumber(0); imageSlice->GetProperty()->SetInterpolationTypeToNearest(); // Setup prop holding the multiple slices vtkNew imageStack; imageStack->SetActiveLayer(imageSlice->GetProperty()->GetLayerNumber()); imageStack->AddImage(imageSlice); // add slice vtkNew resliceCursor; resliceCursor->SetCenter(imageData->GetCenter()); resliceCursor->SetThickMode(0); resliceCursor->SetImage(imageData); vtkNew cursorRepresentation; cursorRepresentation->GetResliceCursorActor()-> GetCursorAlgorithm()->SetResliceCursor(resliceCursor); cursorRepresentation->GetResliceCursorActor()-> BasicPipeline.cxx > GetCursorAlgorithm()->SetReslicePlaneNormal(2); vtkNew resliceCursorWidget; resliceCursorWidget->SetInteractor(renderWindowInteractor); resliceCursorWidget->SetDefaultRenderer(renderer); resliceCursorWidget->SetRepresentation(cursorRepresentation); resliceCursorWidget->SetManageWindowLevel(false); resliceCursorWidget->EnabledOn(); //resliceCursorWidget->ProcessEventsOff(); // Add actors to renderer renderer->AddViewProp(imageStack); renderer->ResetCamera(); // Start interaction renderWindowInteractor->Initialize(); renderWindow->Render(); renderWindowInteractor->Start(); return EXIT_SUCCESS; } void setupCamera(vtkCamera* camera) { double viewUp[3] = { 0, 1, 0 }; double leftToRight[3] = { 1, 0, 0 }; // compute the view plane normal double normal[3]; vtkMath::Cross(leftToRight, viewUp, normal); // get the camera focus double focus[3]; camera->GetFocalPoint(focus); // get the camera distance from the focus double d = camera->GetDistance(); // position the camera on view plane normal keeping the focus and the distance from it fixed camera->SetPosition( focus[0] + d*normal[0], focus[1] + d*normal[1], focus[2] + d*normal[2]); // make sure focus is the same camera->SetFocalPoint(focus); // setup view up vector camera->SetViewUp(viewUp); camera->OrthogonalizeViewUp(); } vtkSmartPointer loadDicom(const char* filename) { vtkNew reader; reader->FileLowerLeftOn(); reader->SetDirectoryName(filename); reader->UpdateInformation(); vtkNew imageInfo; imageInfo->SetOutputOrigin(0.0, 0.0, 0.0); imageInfo->SetOutputSpacing(reader->GetPixelSpacing()); imageInfo->SetInputConnection(reader->GetOutputPort()); imageInfo->Update(); return imageInfo->GetOutput(); } vtkSmartPointer loadNifti(const char* filename) { vtkNew niftiiReader; niftiiReader->SetFileName(filename); vtkNew imageInfo; imageInfo->SetOutputOrigin(0.0, 0.0, 0.0); imageInfo->SetInputConnection(niftiiReader->GetOutputPort()); imageInfo->Update(); return imageInfo->GetOutput();//data; } -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html ------------------------------ Message: 2 Date: Wed, 19 Dec 2018 08:25:13 +0800 From: "=?ISO-8859-1?B?eWlydWkxMjEw?=" <523480317 at qq.com> To: "=?ISO-8859-1?B?dnRrdXNlcnM=?=" > Subject: [vtkusers] The SetRate() function of vtkFFMPEGWriter is not working Message-ID: > Content-Type: text/plain; charset="iso-8859-1" Hello, VTKer I am using vtkFFMPEGWriter to write a video, no matter the frame rate I set, the output video is still 600 frames/sec. The code I used has been attached. Can anybody check the problem for me? Thank you so much. Regards, YiRui -------------- next part -------------- An HTML attachment was scrubbed... URL: > -------------- next part -------------- A non-text attachment was scrubbed... Name: 64066463 at 168E0131.E98F195C.png.jpg Type: image/jpeg Size: 5053 bytes Desc: not available URL: > -------------- next part -------------- A non-text attachment was scrubbed... Name: 1.png Type: application/octet-stream Size: 5053 bytes Desc: not available URL: > -------------- next part -------------- A non-text attachment was scrubbed... Name: CMakeLists.txt Type: application/octet-stream Size: 303 bytes Desc: not available URL: > -------------- next part -------------- A non-text attachment was scrubbed... Name: FFMPEG.cxx Type: application/octet-stream Size: 1027 bytes Desc: not available URL: > ------------------------------ Message: 3 Date: Tue, 18 Dec 2018 18:37:04 -0700 (MST) From: Andaharoo > To: vtkusers at vtk.org Subject: Re: [vtkusers] Visualizing normal vectors Message-ID: <1545183424782-0.post at n5.nabble.com> Content-Type: text/plain; charset=us-ascii I'd recommend using vtkOpenGLGlyph3DMapper instead. Much faster, assuming you have some gpu. Just make sure the normal array/orientation array is in the input polyData's point data. IE: polyData->GetPointData()->AddArray(your normal array) Then just specify the array the mapper should use with SetOrientationArray(your arrays name here). It will then search for the array in the input polydata. I frequently use this to draw thousands of oriented arrows with VTK. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html ------------------------------ Message: 4 Date: Wed, 19 Dec 2018 06:31:31 +0000 From: Andras Lasso > To: ochampao >, "vtkusers at vtk.org" > Subject: Re: [vtkusers] Problem with displaying cross-hairs on 2D views when using vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack pipeline Message-ID: > Content-Type: text/plain; charset="us-ascii" It is great that you are interested in medical imaging and has chosen to work with VTK. I would recommend to put your talent and effort into contributing to an existing open-source medical image viewer instead of spending time with redeveloping basic features. You could work on more interesting things, develop new features, and you would very quickly become a useful, valued member of a community. If you are interested in answers to your question (and your future questions) you can have a look at source code of existing VTK-based open-source medical image viewers, such as 3D Slicer, MITK, medInria, Horos, Ibis, CustusX, CamiTK, Invesalius, etc. Andras -----Original Message----- From: vtkusers > On Behalf Of ochampao Sent: Tuesday, December 18, 2018 1:41 PM To: vtkusers at vtk.org Subject: [vtkusers] Problem with displaying cross-hairs on 2D views when using vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack pipeline Hi vtkUsers, I am developing a four-pane viewer for displaying medical images. The 3 views display slices of the volumes in the 3 standard anatomical views (axial, coronal, sagittal) whereas the 4th one displays some 3D surface rendering of the volume. For now, I will only focus on the 2D views. The 2D views use the following pipeline: vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack. This allows the application to overlay slices from multiple volumes simultaneously. The attached code is a minimal example of the 2D pipeline I use in my application. The slices displayed are determined by the focal point of the camera in each 2D view. What I would like to do is display a set of cross-hairs on each of the 2D views, but I don't know how to achieve this using the pipeline I am currently using. I am aware of the classes: vtkResliceCursorWidget, vtkResliceCursor, vtkResliceCursorLineRepresentation, vtkImagePlaneWidget, vtkResliceImageViewer I have tried using these classes (see commented code in attached source code), but they don't seem compatible with my current pipeline. For example, when using vtkResliceCursorWidget the cross-hairs are visible and I can interact with them but slicing stops working. I also see some weird artefacts around the border of the slice. Also, to use these classes I need to specify the volume which the reslice cursor will be slicing (vtkResliceCursor->SetImage(imageData)), but in my case I have multiple volumes. I am also aware of and tried using vtkCursor2D/vtkCursor3D. Although they are close to what I have in mind, they allow very limited customization of their look. Essentially what I would like to implement is something that looks like the cursor of vtkResliceCursorWidget/vtkImagePlaneWidget/vtkResliceImageViewer but does not handle slicing. Can someone recommend how can I achieve this, or point me to some classes/examples? Is their a way of using vtkResliceCursorWidget/vtkImagePlaneWidget/vtkResliceImageViewer with my current pipeline, or would I need to change it? Thanks a lot for your help. Panos ======================================================== Basic Pipeline Minimal Example ======================================================== #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void setupCamera(vtkCamera* camera); vtkSmartPointer loadDicom(const char* filename); vtkSmartPointer loadNifti(const char* filename); int main(int, char*[]) { // Setup renderer vtkNew renderer; renderer->SetBackground(0.0, 0.0, 0.0); renderer->GetActiveCamera()->ParallelProjectionOn(); renderer->ResetCameraClippingRange(); renderer->ResetCamera(); // Setup renderWindow vtkNew renderWindow; renderWindow->AddRenderer(renderer); // Setup interaction style vtkNew interactorStyle; interactorStyle->SetInteractionModeToImageSlicing(); // Setup window interactor vtkNew renderWindowInteractor; renderWindowInteractor->SetRenderWindow(renderWindow); renderWindowInteractor->SetInteractorStyle(interactorStyle); // Setup camera setupCamera(renderer->GetActiveCamera()); // Load data from DICOM series // vtkSmartPointer imageData = // loadDicom("""); // Load data from Nifti file vtkSmartPointer imageData = loadNifti(""); // setup slice mapper vtkNew resliceMapper; resliceMapper->SetInputData(imageData); resliceMapper->SliceFacesCameraOn(); resliceMapper->SliceAtFocalPointOn(); resliceMapper->JumpToNearestSliceOn(); resliceMapper->BorderOff(); // Set to full window and centered level: double window = imageData->GetScalarRange()[1] - imageData->GetScalarRange()[0]; double level = imageData->GetScalarRange()[0] + window / 2.0; // Setup prop holding the slice vtkNew imageSlice; imageSlice->SetMapper(resliceMapper); imageSlice->GetProperty()->SetColorWindow(window); imageSlice->GetProperty()->SetColorLevel(level); imageSlice->GetProperty()->SetLayerNumber(0); imageSlice->GetProperty()->SetInterpolationTypeToNearest(); // Setup prop holding the multiple slices vtkNew imageStack; imageStack->SetActiveLayer(imageSlice->GetProperty()->GetLayerNumber()); imageStack->AddImage(imageSlice); // add slice vtkNew resliceCursor; resliceCursor->SetCenter(imageData->GetCenter()); resliceCursor->SetThickMode(0); resliceCursor->SetImage(imageData); vtkNew cursorRepresentation; cursorRepresentation->GetResliceCursorActor()-> GetCursorAlgorithm()->SetResliceCursor(resliceCursor); cursorRepresentation->GetResliceCursorActor()-> BasicPipeline.cxx > GetCursorAlgorithm()->SetReslicePlaneNormal(2); vtkNew resliceCursorWidget; resliceCursorWidget->SetInteractor(renderWindowInteractor); resliceCursorWidget->SetDefaultRenderer(renderer); resliceCursorWidget->SetRepresentation(cursorRepresentation); resliceCursorWidget->SetManageWindowLevel(false); resliceCursorWidget->EnabledOn(); //resliceCursorWidget->ProcessEventsOff(); // Add actors to renderer renderer->AddViewProp(imageStack); renderer->ResetCamera(); // Start interaction renderWindowInteractor->Initialize(); renderWindow->Render(); renderWindowInteractor->Start(); return EXIT_SUCCESS; } void setupCamera(vtkCamera* camera) { double viewUp[3] = { 0, 1, 0 }; double leftToRight[3] = { 1, 0, 0 }; // compute the view plane normal double normal[3]; vtkMath::Cross(leftToRight, viewUp, normal); // get the camera focus double focus[3]; camera->GetFocalPoint(focus); // get the camera distance from the focus double d = camera->GetDistance(); // position the camera on view plane normal keeping the focus and the distance from it fixed camera->SetPosition( focus[0] + d*normal[0], focus[1] + d*normal[1], focus[2] + d*normal[2]); // make sure focus is the same camera->SetFocalPoint(focus); // setup view up vector camera->SetViewUp(viewUp); camera->OrthogonalizeViewUp(); } vtkSmartPointer loadDicom(const char* filename) { vtkNew reader; reader->FileLowerLeftOn(); reader->SetDirectoryName(filename); reader->UpdateInformation(); vtkNew imageInfo; imageInfo->SetOutputOrigin(0.0, 0.0, 0.0); imageInfo->SetOutputSpacing(reader->GetPixelSpacing()); imageInfo->SetInputConnection(reader->GetOutputPort()); imageInfo->Update(); return imageInfo->GetOutput(); } vtkSmartPointer loadNifti(const char* filename) { vtkNew niftiiReader; niftiiReader->SetFileName(filename); vtkNew imageInfo; imageInfo->SetOutputOrigin(0.0, 0.0, 0.0); imageInfo->SetInputConnection(niftiiReader->GetOutputPort()); imageInfo->Update(); return imageInfo->GetOutput();//data; } -- Sent from: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1045678.n5.nabble.com%2FVTK-Users-f1224199.html&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=y%2FPL7RWRxL9djen9OHHFpV8mML1l8tDDID8vwEPDzr4%3D&reserved=0 _______________________________________________ Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=a5wXXUd01fJsRRfeOlVc%2Bk6JcNbeRrCaawzEeOBEpIQ%3D&reserved=0 Visit other Kitware open-source projects at https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=GTPQfYrm85nLVvMYqtzwxYrfNS%2BHK2U5E%2F8%2FXjTuyGQ%3D&reserved=0 Please keep messages on-topic and check the VTK FAQ at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vtk.org%2FWiki%2FVTK_FAQ&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=3OkV0h9SM82LHRbPbSKbfXkZuLWSqAjPyULJuBV%2FrGQ%3D&reserved=0 Search the list archives at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtkusers&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=ydyX30Af9G0j8PwVigfaCkucOiFqv0SdNKwyi7vx56Y%3D&reserved=0 Follow this link to subscribe/unsubscribe: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtkusers&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=zYNgte5262YQQDT42ydJgSd1qTiDwQBW4DeWwgOlCzE%3D&reserved=0 ------------------------------ Message: 5 Date: Wed, 19 Dec 2018 01:24:28 -0700 (MST) From: mozendi > To: vtkusers at vtk.org Subject: Re: [vtkusers] Visualizing normal vectors Message-ID: <1545207868212-0.post at n5.nabble.com> Content-Type: text/plain; charset=us-ascii Dear Andaharoo, Thank you for your recommendation. I tried to modify my codes according to your recommendations, my code is getting compiled successfully. However, when I run it I am getting an error message. The screenshot and my code are below. Could you please tell me what is wrong with my code? Thanks in advance > #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include # include "vtkGlyph3DMapper.h" # include "vtkGlyph3DMapper.h" #include #include int main(int argc, char* argv[]) { vtkSmartPointer reader = vtkSmartPointer::New(); reader->SetFileName("points_and_normals.xyz"); reader->DetectNumericColumnsOn(); reader->SetFieldDelimiterCharacters(" "); reader->Update(); vtkTable* table = reader->GetOutput(); vtkSmartPointer points = vtkSmartPointer::New(); vtkSmartPointer normals = vtkSmartPointer::New(); normals->SetNumberOfComponents(3); //3d normals (ie x,y,z) std::cout << "Table has " << table->GetNumberOfRows() << " rows." << std::endl; std::cout << "Table has " << table->GetNumberOfColumns() << " columns." << std::endl; for (vtkIdType i = 0; i < table->GetNumberOfRows(); i++) { points->InsertNextPoint((table->GetValue(i, 0)).ToDouble(), (table->GetValue(i, 1)).ToDouble(), (table->GetValue(i, 2)).ToDouble()); double n[3]; n[0] = (table->GetValue(i, 3)).ToDouble(); n[1] = (table->GetValue(i, 4)).ToDouble(); n[2] = (table->GetValue(i, 5)).ToDouble(); normals->InsertNextTuple(n); } std::cout << "There are " << points->GetNumberOfPoints() << " points." << std::endl; vtkSmartPointer polydata = vtkSmartPointer::New(); polydata->SetPoints(points); //polydata->GetPointData()->SetNormals(normals); polydata->GetPointData()->AddArray(normals); vtkSmartPointer Glyph3D = vtkSmartPointer::New(); Glyph3D->SetInputData(polydata); Glyph3D->SetOrientationArray("normals"); Glyph3D->SetScaleFactor(.5); Glyph3D->Update(); vtkSmartPointer glyph3DActor = vtkSmartPointer::New(); glyph3DActor->SetMapper(Glyph3D); glyph3DActor->GetProperty()->SetColor(0.8900, 0.8100, 0.3400); vtkSmartPointer renderer = vtkSmartPointer::New(); vtkSmartPointer renderWindow = vtkSmartPointer::New(); renderWindow->AddRenderer(renderer); vtkSmartPointer renderWindowInteractor = vtkSmartPointer::New(); renderWindowInteractor->SetRenderWindow(renderWindow); renderer->AddActor(glyph3DActor); renderer->SetBackground(.5, .5, .5); renderWindow->Render(); renderWindowInteractor->Start(); return EXIT_SUCCESS; } -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html ------------------------------ Message: 6 Date: Wed, 19 Dec 2018 02:26:23 -0700 (MST) From: Andaharoo > To: vtkusers at vtk.org Subject: Re: [vtkusers] Visualizing normal vectors Message-ID: <1545211583462-0.post at n5.nabble.com> Content-Type: text/plain; charset=us-ascii Your error said an array index went out of bounds. What line? Also I noticed you never set the source data for the glyph. Could be unrelated to your current error message, but a problem. The glyph mapper takes two inputs. The glyph data (positions, normals, scalars, etc) and the source (thing to copy). So if you want arrows as the normals do this: vtkSmartPointer glyph3D = vtkSmartPointer::New(); glyph3D ->SetInputData(polydata); vtkSmartPointer glyphSource = vtkSmartPointer::New(); glyphSource->Update(); glyph3D->SetSourceData(glyphSource->GetOutput()); glyph3D ->SetOrientationArray("normals"); glyph3D ->SetScaleFactor(0.5); glyph3D ->Update(); -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html ------------------------------ Subject: Digest Footer _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ Search the list archives at: http://markmail.org/search/?q=vtkusers Follow this link to subscribe/unsubscribe: https://public.kitware.com/mailman/listinfo/vtkusers ------------------------------ End of vtkusers Digest, Vol 176, Issue 22 ***************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From famous.osarobo at gmail.com Thu Dec 20 06:50:41 2018 From: famous.osarobo at gmail.com (Osarobo Famous Okhuahesogie) Date: Thu, 20 Dec 2018 11:50:41 +0000 Subject: [vtkusers] How to set maximum error in vtkQuadricDecimation ? Message-ID: Hi All, I have been trying out vtkDecimatePro and vtkQuadricDecimation for about a month now with some success. The only problem I have is I am not able to set the tolerance or maximum error when using vtkQuadricDecimation. Is there a similar function like SetMaximumError(max_error) in vtkQuadricDecimation as there is in vtkDecimatePro ? Or is there a way to control the tolerance I am not aware of ?. I will appreciate any help. Kind Regards Famous -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.thompson at kitware.com Thu Dec 20 14:25:10 2018 From: david.thompson at kitware.com (David Thompson) Date: Thu, 20 Dec 2018 14:25:10 -0500 Subject: [vtkusers] Help with vtkInterpolateDataSetAttributes In-Reply-To: References: <01535852-F548-4E8A-A2AF-04F7F4476DEB@inl.gov> Message-ID: Hi Andrew, > The interpolation for point data is working great, I am working on making my script more robust before posting by including cell and global data to the interpolation. I also am interpolating all active data into a vtkMultiBlockDataSetAlgorithm so the end product will behave similarly as a vtkExodusIIReader object. > > Anyway, I can't get the cell data to interpolate. The point data is working fine (change the variable to 'point') to show this result. It would help to know more about what you hope to accomplish with the interpolation. If you are trying to compare field values (or differences between them) on different meshes, then maybe it would be appropriate as a first pass to use vtkCellCenters to get a location for each cell. You might also be interested in the vtkProbeFilter for projecting points (whether they are cell centers or original input points) from one dataset to another without writing a Python script that iterates over tuples. David From adriaan.s at gmail.com Thu Dec 20 17:02:16 2018 From: adriaan.s at gmail.com (Adriaan) Date: Thu, 20 Dec 2018 23:02:16 +0100 Subject: [vtkusers] Install Mayavi for Python 3.7.1 in Windows 10 Message-ID: <440d8ddd-2973-cd93-5d3f-905f2c96c145@gmail.com> Dear Kitware. I'm trying to install VTK for Python 3.7.1 on Windows 10 but running <> gives me << Collecting vtk ? Could not find a version that satisfies the requirement vtk (from versions: ) No matching distribution found for vtk >> I installed VTK manually with <> but it does not solve the problem. Running python --version returns Python 3.7.1 and running pip --version or pip3 --version returns pip 18.1 from c:\users\adria\appdata\local\programs\python\python37-32\lib\site-packages\pip (python 3.7). How do I solve this problem? Thanks, Adriaan From zwtfire at 126.com Thu Dec 20 22:04:22 2018 From: zwtfire at 126.com (wtzou) Date: Fri, 21 Dec 2018 11:04:22 +0800 (CST) Subject: [vtkusers] catastrophic error: cannot open source file "vtkVolumeRayCastMIPFunction.h" Message-ID: <4185bd91.2f1e.167ceb8932d.Coremail.zwtfire@126.com> Hi, When I was using molecular simulation software RASPA2, the error was met when compile the result visulization .cxx file. here is my selection while install VTK-8.1.2. and this is the error information: what shall I do ? Thank you very much -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Screenshot from 2018-12-20 22-26-32.png Type: image/png Size: 153427 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Screenshot from 2018-12-20 23-42-35.png Type: image/png Size: 65321 bytes Desc: not available URL: From poweruserm at live.com.au Fri Dec 21 00:16:49 2018 From: poweruserm at live.com.au (A Z) Date: Fri, 21 Dec 2018 05:16:49 +0000 Subject: [vtkusers] vtkusers Digest, Vol 176, Issue 25 In-Reply-To: References: Message-ID: I still remain in the position of being unable to build the VTK for my purposes. We am using the 64 bit TDM C++ compiler and need to compile into 64 bit Windows .dlls. Is it possible to organise this from the VTK team, for a public download? ________________________________ From: vtkusers on behalf of vtkusers-request at vtk.org Sent: Friday, 21 December 2018 2:04 PM To: vtkusers at vtk.org Subject: vtkusers Digest, Vol 176, Issue 25 Send vtkusers mailing list submissions to vtkusers at vtk.org To subscribe or unsubscribe via the World Wide Web, visit https://vtk.org/mailman/listinfo/vtkusers or, via email, send a message with subject or body 'help' to vtkusers-request at vtk.org You can reach the person managing the list at vtkusers-owner at vtk.org When replying, please edit your Subject line so it is more specific than "Re: Contents of vtkusers digest..." Today's Topics: 1. Re: Help with vtkInterpolateDataSetAttributes (David Thompson) 2. Install Mayavi for Python 3.7.1 in Windows 10 (Adriaan) 3. catastrophic error: cannot open source file "vtkVolumeRayCastMIPFunction.h" (wtzou) ---------------------------------------------------------------------- Message: 1 Date: Thu, 20 Dec 2018 14:25:10 -0500 From: David Thompson To: "Andrew E. Slaughter" Cc: vtkusers Subject: Re: [vtkusers] Help with vtkInterpolateDataSetAttributes Message-ID: Content-Type: text/plain; charset=us-ascii Hi Andrew, > The interpolation for point data is working great, I am working on making my script more robust before posting by including cell and global data to the interpolation. I also am interpolating all active data into a vtkMultiBlockDataSetAlgorithm so the end product will behave similarly as a vtkExodusIIReader object. > > Anyway, I can't get the cell data to interpolate. The point data is working fine (change the variable to 'point') to show this result. It would help to know more about what you hope to accomplish with the interpolation. If you are trying to compare field values (or differences between them) on different meshes, then maybe it would be appropriate as a first pass to use vtkCellCenters to get a location for each cell. You might also be interested in the vtkProbeFilter for projecting points (whether they are cell centers or original input points) from one dataset to another without writing a Python script that iterates over tuples. David ------------------------------ Message: 2 Date: Thu, 20 Dec 2018 23:02:16 +0100 From: Adriaan To: vtkusers at vtk.org Subject: [vtkusers] Install Mayavi for Python 3.7.1 in Windows 10 Message-ID: <440d8ddd-2973-cd93-5d3f-905f2c96c145 at gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Dear Kitware. I'm trying to install VTK for Python 3.7.1 on Windows 10 but running <> gives me << Collecting vtk ? Could not find a version that satisfies the requirement vtk (from versions: ) No matching distribution found for vtk >> I installed VTK manually with <> but it does not solve the problem. Running python --version returns Python 3.7.1 and running pip --version or pip3 --version returns pip 18.1 from c:\users\adria\appdata\local\programs\python\python37-32\lib\site-packages\pip (python 3.7). How do I solve this problem? Thanks, Adriaan ------------------------------ Message: 3 Date: Fri, 21 Dec 2018 11:04:22 +0800 (CST) From: wtzou To: vtkusers at vtk.org Subject: [vtkusers] catastrophic error: cannot open source file "vtkVolumeRayCastMIPFunction.h" Message-ID: <4185bd91.2f1e.167ceb8932d.Coremail.zwtfire at 126.com> Content-Type: text/plain; charset="gbk" Hi, When I was using molecular simulation software RASPA2, the error was met when compile the result visulization .cxx file. here is my selection while install VTK-8.1.2. and this is the error information: what shall I do ? Thank you very much -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Screenshot from 2018-12-20 22-26-32.png Type: image/png Size: 153427 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Screenshot from 2018-12-20 23-42-35.png Type: image/png Size: 65321 bytes Desc: not available URL: ------------------------------ Subject: Digest Footer _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ Search the list archives at: http://markmail.org/search/?q=vtkusers Follow this link to subscribe/unsubscribe: https://vtk.org/mailman/listinfo/vtkusers ------------------------------ End of vtkusers Digest, Vol 176, Issue 25 ***************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From mozendi at gmail.com Fri Dec 21 03:29:54 2018 From: mozendi at gmail.com (mozendi) Date: Fri, 21 Dec 2018 01:29:54 -0700 (MST) Subject: [vtkusers] Visualizing normal vectors In-Reply-To: <1545211583462-0.post@n5.nabble.com> References: <1544904178474-0.post@n5.nabble.com> <1545183424782-0.post@n5.nabble.com> <1545207868212-0.post@n5.nabble.com> <1545211583462-0.post@n5.nabble.com> Message-ID: <1545380994609-0.post@n5.nabble.com> Dear Andaharoo, Thank you very much for recommendations. My code works successfully and it runs quite fast. I have one more question. Is it possible to set width of arrows? I can scale it using SetScaleFactor(). I tried SetTipLength and SetTipRadius but dimensions did not change. Thanks in advance #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include # include "vtkGlyph3DMapper.h" #include #include int main(int argc, char* argv[]) { vtkSmartPointer reader = vtkSmartPointer::New(); reader->SetFileName("dene_sil.xyz"); reader->DetectNumericColumnsOn(); reader->SetFieldDelimiterCharacters(" "); reader->Update(); vtkTable* table = reader->GetOutput(); vtkSmartPointer points = vtkSmartPointer::New(); vtkSmartPointer normals = vtkSmartPointer::New(); normals->SetName("NORMALS"); normals->SetNumberOfComponents(3); //3d normals (ie x,y,z) std::cout << "Table has " << table->GetNumberOfRows() << " rows." << std::endl; std::cout << "Table has " << table->GetNumberOfColumns() << " columns." << std::endl; for (vtkIdType i = 0; i < table->GetNumberOfRows(); i++) { points->InsertNextPoint((table->GetValue(i, 0)).ToDouble(), (table->GetValue(i, 1)).ToDouble(), (table->GetValue(i, 2)).ToDouble()); double n[3]; n[0] = (table->GetValue(i, 3)).ToDouble(); n[1] = (table->GetValue(i, 4)).ToDouble(); n[2] = (table->GetValue(i, 5)).ToDouble(); normals->InsertNextTuple(n); } std::cout << "There are " << points->GetNumberOfPoints() << " points." << std::endl; vtkSmartPointer polydata = vtkSmartPointer::New(); polydata->SetPoints(points); //polydata->GetPointData()->SetNormals(normals); polydata->GetPointData()->AddArray(normals); vtkSmartPointer Glyph3D = vtkSmartPointer::New(); Glyph3D->SetInputData(polydata); double pp[3]; polydata->GetPoint(1, pp); std::cout << "deneme = " << 1 << " : (" << pp[0] << " " << pp[1] << " " << pp[2] << ")" << std::endl; std::cout << "There are " << polydata->GetPointData()->GetNumberOfArrays() << " arrays." << std::endl; std::cout << "name: " << polydata->GetPointData()->GetArrayName(0) << std::endl; vtkSmartPointer glyphSource = vtkSmartPointer::New(); glyphSource->Update(); //glyphSource->SetTipResolution(5); glyphSource->SetTipLength(0.01); glyphSource->SetTipRadius(0.01); vtkSmartPointer glyph3DActor = vtkSmartPointer::New(); glyph3DActor->SetMapper(Glyph3D); glyph3DActor->GetProperty()->SetColor(0.8900, 0.8100, 0.3400); glyph3DActor->GetProperty()->SetLineWidth(0.01); Glyph3D->SetSourceData(glyphSource->GetOutput()); Glyph3D->OrientOn(); Glyph3D->SetOrientationArray("NORMALS"); Glyph3D->SetScaleFactor(0.03); Glyph3D->Update(); vtkSmartPointer renderer = vtkSmartPointer::New(); vtkSmartPointer renderWindow = vtkSmartPointer::New(); renderWindow->AddRenderer(renderer); vtkSmartPointer renderWindowInteractor = vtkSmartPointer::New(); renderWindowInteractor->SetRenderWindow(renderWindow); renderer->AddActor(glyph3DActor); renderer->SetBackground(.5, .5, .5); renderWindow->Render(); renderWindowInteractor->Start(); return EXIT_SUCCESS; } -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From zs6115 at student.uni-lj.si Sat Dec 22 13:23:04 2018 From: zs6115 at student.uni-lj.si (the_not) Date: Sat, 22 Dec 2018 11:23:04 -0700 (MST) Subject: [vtkusers] Clarification about RequestData methods Message-ID: <1545502984499-0.post@n5.nabble.com> I am reading the VTKTextbook. On page 112 (physical page 128) it says: /Now let?s reexamine the same process of pipeline execution by following method invocation. The process begins when the actor receives a Render() message from a renderer. The actor in turn sends a Render() message to its mapper. The mapper begins network execution by asking its input to update itself via the Update() operation. This causes a cascade of Update() methods as each filter in turn asks its input to update itself. If branching in the pipeline is present, the update method will branch as well. Finally, the cascade terminates when a source object is encountered. If the source object is out of date, it will send itself an RequestData() command. Each filter will send itself an RequestData() as necessary to bring itself up to date. Finally, the mapper will perform operations to transform its input into rendering primitives./ It is clear how Update() mehods get propagated towards the Source, as each "node" in the network asks its input to update. Following the text above, it says that the cascade terminates when the source is reached. It than sends itself RequestData command, if it is out of date. But the text than goes to say " Each filter will send itself an RequestData()" if needed. How do filters know to call RequestData on themselves? With Update, it is clear, as each filter asks its input to update. This flows upstream to the source. But than if only the source asks itself to RequestData, how do filters downstream from it know to do so aswell? I hope I made my question clear, I thank you in advance. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From elhassan.abdou at gmail.com Sat Dec 22 17:01:35 2018 From: elhassan.abdou at gmail.com (Elhassan Abdou) Date: Sat, 22 Dec 2018 23:01:35 +0100 Subject: [vtkusers] construct from vtkCamera from opengl Variables Message-ID: Dear All, I have a scene that I constructed using OpenGL and I want to rewrite the code using VTK. So I have view matrix (compose of, scaling in z, and translation in the x,y,z). I know I am rendering using perspective mode, so I have near plane, far plane and horizontal fov. I tried to use vtkExternalOpenGL, but nothing is rendered. Can anyone give me help on how to adjust vtkOpenGLCamera to use these parameters to render the scene? Regards Elhassan -------------- next part -------------- An HTML attachment was scrubbed... URL: From rickfrank at me.com Sun Dec 23 22:17:58 2018 From: rickfrank at me.com (Richard Frank) Date: Sun, 23 Dec 2018 22:17:58 -0500 Subject: [vtkusers] Hololens support? Message-ID: <6C31EAB6-2587-423E-8726-AA8021FD449F@me.com> Hi, Is there a best practices way to use hololens and VTK? Thanks Rick Sent from my iPad From elhassan.abdou at gmail.com Mon Dec 24 04:28:59 2018 From: elhassan.abdou at gmail.com (Elhassan Abdou) Date: Mon, 24 Dec 2018 10:28:59 +0100 Subject: [vtkusers] vtkCamera parameters Message-ID: Dear All, I have a scene that I constructed using OpenGL and I want to rewrite the code using VTK. So I have view matrix (compose of, scaling in z, and translation in the x,y,z). I know I am rendering using perspective mode, so I have near plane, far plane and horizontal fov. I tried to use vtkExternalOpenGL, but nothing is rendered. Can anyone give me help on how to adjust vtkOpenGLCamera to use these parameters to render the scene? Regards -------------- next part -------------- An HTML attachment was scrubbed... URL: From Dzcsu2 at outlook.com Tue Dec 25 21:19:12 2018 From: Dzcsu2 at outlook.com (CSUMIKE2) Date: Tue, 25 Dec 2018 19:19:12 -0700 (MST) Subject: [vtkusers] vtkDistanceWidget In-Reply-To: <1439833239001-5733532.post@n5.nabble.com> References: <1439833239001-5733532.post@n5.nabble.com> Message-ID: <1545790752882-0.post@n5.nabble.com> Hi, u may want to try this . vtkDistanceRepresentation2D *rep2D = vtkDistanceRepresentation2D::New(); rep2D->GetAxisProperty()->SetColor(1, 0, 0); vtkDistanceWidget *distanceWidget = vtkDistanceWidget::New(); distanceWidget->SetRepresentation(rep2D); -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From aminemzoughi at febus-optics.com Wed Dec 26 06:45:11 2018 From: aminemzoughi at febus-optics.com (Mohamed Amine Mzoughi) Date: Wed, 26 Dec 2018 12:45:11 +0100 Subject: [vtkusers] anti-aliasing Message-ID: <0a1f4606-9c92-b10b-ee5c-923855a3bb1c@febus-optics.com> Hello, I want to enable Anti-alisaing in my VTK app, so I took some parameters from ParaView and it still doesn't work : ??? m_view->GetRenderer()->UseFXAAOn(); // enable AA ??? vtkFXAAOptions* const aaOpts = m_view->GetRenderer()->GetFXAAOptions(); ??? aaOpts->SetRelativeContrastThreshold(0.125); ??? aaOpts->SetHardContrastThreshold(0.045); ??? aaOpts->SetSubpixelBlendLimit(0.75); ??? aaOpts->SetSubpixelContrastThreshold(0.25); ??? aaOpts->SetUseHighQualityEndpoints(true); ??? aaOpts->SetEndpointSearchIterations(12); what am I missing ? Also, m_view->GetRenderWindow()->GetMultiSamples() => returns 8. and I called also : m_view->GetRenderWindow()->LineSmoothingOn(); m_view->GetRenderWindow()->PolygonSmoothingOn(); m_view->GetRenderWindow()->PointSmoothingOn(); Thanks. From paulo.r.m.carvalho at gmail.com Wed Dec 26 10:55:03 2018 From: paulo.r.m.carvalho at gmail.com (Paulo Carvalho) Date: Wed, 26 Dec 2018 13:55:03 -0200 Subject: [vtkusers] anti-aliasing In-Reply-To: References: <0a1f4606-9c92-b10b-ee5c-923855a3bb1c@febus-optics.com> <27fd6479-4647-6588-168f-3d7ab8612684@febus-optics.com> Message-ID: Hi, Mohammed, Yes, I know that feeling... Paraview is complex, yes. It's difficult to get the hang of its code in a glimpse. Either you invest the time to dissect the code or look into something simpler. You may take a look at how I setup a VTK viewer: https://github.com/PauloCarvalhoRJ/gammaray/blob/master/viewer3d/view3dwidget.cpp (It's several orders of magnitude simpler than Paraview). It's a 3D viewer in a Qt window though. I've never tried VTK charts myself (I use the more lightweight Qwt and Qt Charts APIs for that). regards, Paulo Em qua, 26 de dez de 2018 ?s 13:38, Mohamed Amine Mzoughi < aminemzoughi at febus-optics.com> escreveu: > Hello again, > > If I do that, the chart is not visible anymore (the Qt widget is all > black), if I change the renderer of the vtkContextView also (the Qt widget > is all white) ! > > I give up for the moment ! > > ParaView is a such complex software, that I can't trace the stuff related > to anti-alisaing in it (reverse engineering ParaView it is tough : a > complex build system, many layers, proxies, in fact, it's an oriented > object mix of a lasagna and spaghetti code !). > > Thanks anyway. > Le 26/12/2018 ? 16:02, Paulo Carvalho a ?crit : > > Hi, Mohammed, > > Strange indeed. Did you create the vtkRender object yourself or you > just used the default one returned by GetRenderer()? If the latter is > your case, I recommend creating your own vtkRender: > > m_renderer = vtkSmartPointer::New(); > m_renderer->UseFXAAOn(); > > vtkFXAAOptions* const aaOpts = m_renderer->GetFXAAOptions(); > aaOpts->SetRelativeContrastThreshold(0.125); > aaOpts->SetHardContrastThreshold(0.045); > aaOpts->SetSubpixelBlendLimit(0.75); > aaOpts->SetSubpixelContrastThreshold(0.25); > aaOpts->SetUseHighQualityEndpoints(true); > aaOpts->SetEndpointSearchIterations(12); > > m_view->GetRenderWindow()->AddRenderer( m_renderer ); > > cheers, > > Paulo > > > Em qua, 26 de dez de 2018 ?s 12:15, Mohamed Amine Mzoughi < > aminemzoughi at febus-optics.com> escreveu: > >> Hello Paulo, >> >> Even without SmoothingOn* instructions, I still have a problem in my 2D >> charts (I use a subclass of vtkChartXY, same issue with >> vtkHistogramChart2D, I have rectangles in screen). >> >> In ParaView, the line is smooth : >> >> whereas in my VTK app, it isn't : >> >> >> >> I don't know the issue... >> >> I'm calling the FXAA instructions before Render() in the constructor, I >> tried even to call them before each call to Render(). >> >> Best regards. >> >> Le 26/12/2018 ? 14:21, Paulo Carvalho a ?crit : >> >> Hello, Mohamed! >> >> It seems that your last calls (*SmoothingOn()) conflict with >> UseFXAAOn(). >> >> Here is the output I get when I add a call to PolygonSmoothingOn(). Not >> only it is not antialiased, but you can notice the edges triangle strips, >> visually ruining the results: >> >> [image: image.png] >> >> This one is rendered with only UseFXAAOn() and some configuration to the >> vtkFXAAOptions object like you did: >> [image: image.png] >> >> kind regards, >> >> Paulo >> >> Em qua, 26 de dez de 2018 ?s 10:03, Mohamed Amine Mzoughi < >> aminemzoughi at febus-optics.com> escreveu: >> >>> Hello, >>> >>> I want to enable Anti-alisaing in my VTK app, so I took some parameters >>> from ParaView and it still doesn't work : >>> >>> m_view->GetRenderer()->UseFXAAOn(); // enable AA >>> >>> vtkFXAAOptions* const aaOpts = >>> m_view->GetRenderer()->GetFXAAOptions(); >>> aaOpts->SetRelativeContrastThreshold(0.125); >>> aaOpts->SetHardContrastThreshold(0.045); >>> aaOpts->SetSubpixelBlendLimit(0.75); >>> aaOpts->SetSubpixelContrastThreshold(0.25); >>> aaOpts->SetUseHighQualityEndpoints(true); >>> aaOpts->SetEndpointSearchIterations(12); >>> >>> what am I missing ? >>> >>> Also, m_view->GetRenderWindow()->GetMultiSamples() => returns 8. >>> >>> and I called also : >>> >>> m_view->GetRenderWindow()->LineSmoothingOn(); >>> m_view->GetRenderWindow()->PolygonSmoothingOn(); >>> m_view->GetRenderWindow()->PointSmoothingOn(); >>> >>> Thanks. >>> >>> _______________________________________________ >>> Powered by www.kitware.com >>> >>> Visit other Kitware open-source projects at >>> http://www.kitware.com/opensource/opensource.html >>> >>> Please keep messages on-topic and check the VTK FAQ at: >>> http://www.vtk.org/Wiki/VTK_FAQ >>> >>> Search the list archives at: http://markmail.org/search/?q=vtkusers >>> >>> Follow this link to subscribe/unsubscribe: >>> https://vtk.org/mailman/listinfo/vtkusers >>> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: mgmjgdbpgalilcml.png Type: image/png Size: 35038 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: liciomaiecgnccjf.png Type: image/png Size: 14787 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image.png Type: image/png Size: 111147 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image.png Type: image/png Size: 60566 bytes Desc: not available URL: From aminemzoughi at febus-optics.com Wed Dec 26 10:38:19 2018 From: aminemzoughi at febus-optics.com (Mohamed Amine Mzoughi) Date: Wed, 26 Dec 2018 16:38:19 +0100 Subject: [vtkusers] anti-aliasing In-Reply-To: References: <0a1f4606-9c92-b10b-ee5c-923855a3bb1c@febus-optics.com> <27fd6479-4647-6588-168f-3d7ab8612684@febus-optics.com> Message-ID: Hello again, If I do that, the chart is not visible anymore (the Qt widget is all black), if I change the renderer of the vtkContextView also (the Qt widget is all white) ! I give up for the moment ! ParaView is a such complex software, that I can't trace the stuff related to anti-alisaing in it (reverse engineering ParaView it is tough : a complex build system, many layers, proxies, in fact, it's an oriented object mix of a lasagna and spaghetti code !). Thanks anyway. Le 26/12/2018 ? 16:02, Paulo Carvalho a ?crit?: > Hi, Mohammed, > > ?? Strange indeed.? Did you create the vtkRender object yourself or > you just used the default one returned by GetRenderer()??? If the > latter is your case, I recommend creating your own vtkRender: > > m_renderer=vtkSmartPointer::New(); > m_renderer->UseFXAAOn(); > > ??? vtkFXAAOptions* const aaOpts = m_renderer->GetFXAAOptions(); > ???? aaOpts->SetRelativeContrastThreshold(0.125); > ???? aaOpts->SetHardContrastThreshold(0.045); > ???? aaOpts->SetSubpixelBlendLimit(0.75); > ???? aaOpts->SetSubpixelContrastThreshold(0.25); > ???? aaOpts->SetUseHighQualityEndpoints(true); > ???? aaOpts->SetEndpointSearchIterations(12); > > m_view->GetRenderWindow()->AddRenderer(m_renderer ); > > cheers, > > Paulo > > > Em qua, 26 de dez de 2018 ?s 12:15, Mohamed Amine Mzoughi > > > escreveu: > > Hello Paulo, > > Even without SmoothingOn* instructions, I still have a problem in > my 2D charts (I use a subclass of vtkChartXY, same issue with > vtkHistogramChart2D, I have rectangles in screen). > > In ParaView, the line is smooth : > > > whereas in my VTK app, it isn't : > > > > I don't know the issue... > > I'm calling the FXAA instructions before Render() in the > constructor, I tried even to call them before each call to Render(). > > Best regards. > > Le 26/12/2018 ? 14:21, Paulo Carvalho a ?crit?: >> Hello, Mohamed! >> >> ? It seems that your last calls (*SmoothingOn()) conflict with >> UseFXAAOn(). >> >> Here is the output I get when I add a call to >> PolygonSmoothingOn().? Not only it is not antialiased, but you >> can notice the edges triangle strips, visually ruining the results: >> >> image.png >> >> This one is rendered with only UseFXAAOn() and some configuration >> to the vtkFXAAOptions object like you did: >> image.png >> >> kind regards, >> >> Paulo >> >> Em qua, 26 de dez de 2018 ?s 10:03, Mohamed Amine Mzoughi >> > > escreveu: >> >> Hello, >> >> I want to enable Anti-alisaing in my VTK app, so I took some >> parameters >> from ParaView and it still doesn't work : >> >> ???? m_view->GetRenderer()->UseFXAAOn(); // enable AA >> >> ???? vtkFXAAOptions* const aaOpts = >> m_view->GetRenderer()->GetFXAAOptions(); >> ???? aaOpts->SetRelativeContrastThreshold(0.125); >> ???? aaOpts->SetHardContrastThreshold(0.045); >> ???? aaOpts->SetSubpixelBlendLimit(0.75); >> ???? aaOpts->SetSubpixelContrastThreshold(0.25); >> ???? aaOpts->SetUseHighQualityEndpoints(true); >> ???? aaOpts->SetEndpointSearchIterations(12); >> >> what am I missing ? >> >> Also, m_view->GetRenderWindow()->GetMultiSamples() => returns 8. >> >> and I called also : >> >> m_view->GetRenderWindow()->LineSmoothingOn(); >> m_view->GetRenderWindow()->PolygonSmoothingOn(); >> m_view->GetRenderWindow()->PointSmoothingOn(); >> >> Thanks. >> >> _______________________________________________ >> Powered by www.kitware.com >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Please keep messages on-topic and check the VTK FAQ at: >> http://www.vtk.org/Wiki/VTK_FAQ >> >> Search the list archives at: >> http://markmail.org/search/?q=vtkusers >> >> Follow this link to subscribe/unsubscribe: >> https://vtk.org/mailman/listinfo/vtkusers >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: mgmjgdbpgalilcml.png Type: image/png Size: 35038 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: liciomaiecgnccjf.png Type: image/png Size: 14787 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image.png Type: image/png Size: 111147 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image.png Type: image/png Size: 60566 bytes Desc: not available URL: From ricardo.c.r.santos at gmail.com Wed Dec 26 14:51:06 2018 From: ricardo.c.r.santos at gmail.com (Ricardo Santos) Date: Wed, 26 Dec 2018 17:51:06 -0200 Subject: [vtkusers] Error compiling OpenGL on Linux Message-ID: Hello everyone! I am trying to build VTK on linux and I am having a problem that I do not understand with OpenGL. On CMake I have left the OpenGL2 option on the variable on VTK_RENDERING_BACKEND and I receive the error message during make: (...) [ 41%] Built target vtkRenderingOpenGL2Java [ 42%] Built target vtkRenderingOpenGL2JavaJavaClasses [ 42%] Linking CXX executable ../../bin/vtkProbeOpenGLVersion Rendering/OpenGL2/CMakeFiles/vtkProbeOpenGLVersion.dir/build.make:108: recipe for target 'bin/vtkProbeOpenGLVersion' failed CMakeFiles/Makefile2:7640: recipe for target 'Rendering/OpenGL2/CMakeFiles/vtkProbeOpenGLVersion.dir/all' failed Makefile:140: recipe for target 'all' failed Have anyone gotten a problem like this one? Btw, if I set the VTK_RENDERING_BACKEND variable to None, I get the same error. Ricardo Santos -------------- next part -------------- An HTML attachment was scrubbed... URL: From ricardo.c.r.santos at gmail.com Wed Dec 26 15:00:02 2018 From: ricardo.c.r.santos at gmail.com (Ricardo Santos) Date: Wed, 26 Dec 2018 18:00:02 -0200 Subject: [vtkusers] Error compiling OpenGL on Linux In-Reply-To: References: Message-ID: And, I have GLEW-dev packcage installed on my Linux. I am Running Ubuntu 18,04, furthermore On Wed, Dec 26, 2018 at 5:51 PM Ricardo Santos wrote: > Hello everyone! > > I am trying to build VTK on linux and I am having a problem that I do > not understand with OpenGL. > > On CMake I have left the OpenGL2 option on the variable on > VTK_RENDERING_BACKEND and I receive the error message during make: > > (...) > [ 41%] Built target vtkRenderingOpenGL2Java > [ 42%] Built target vtkRenderingOpenGL2JavaJavaClasses > [ 42%] Linking CXX executable ../../bin/vtkProbeOpenGLVersion > Rendering/OpenGL2/CMakeFiles/vtkProbeOpenGLVersion.dir/build.make:108: > recipe for target 'bin/vtkProbeOpenGLVersion' failed > CMakeFiles/Makefile2:7640: recipe for target > 'Rendering/OpenGL2/CMakeFiles/vtkProbeOpenGLVersion.dir/all' failed > Makefile:140: recipe for target 'all' failed > > > Have anyone gotten a problem like this one? > > Btw, if I set the VTK_RENDERING_BACKEND variable to None, I get the > same error. > > Ricardo Santos > -------------- next part -------------- An HTML attachment was scrubbed... URL: From paulo.r.m.carvalho at gmail.com Wed Dec 26 16:26:05 2018 From: paulo.r.m.carvalho at gmail.com (Paulo Carvalho) Date: Wed, 26 Dec 2018 19:26:05 -0200 Subject: [vtkusers] Error compiling OpenGL on Linux In-Reply-To: References: Message-ID: Hello, Ricardo, Common sources of problems with OpenGL (both for linking and runtime) are old graphics card driver and lack of GLU libraries. Make sure these are installed and upgraded to latest version. cheers, Paulo Em qua, 26 de dez de 2018 ?s 18:00, Ricardo Santos < ricardo.c.r.santos at gmail.com> escreveu: > And, I have GLEW-dev packcage installed on my Linux. > > I am Running Ubuntu 18,04, furthermore > > On Wed, Dec 26, 2018 at 5:51 PM Ricardo Santos < > ricardo.c.r.santos at gmail.com> wrote: > >> Hello everyone! >> >> I am trying to build VTK on linux and I am having a problem that I >> do not understand with OpenGL. >> >> On CMake I have left the OpenGL2 option on the variable on >> VTK_RENDERING_BACKEND and I receive the error message during make: >> >> (...) >> [ 41%] Built target vtkRenderingOpenGL2Java >> [ 42%] Built target vtkRenderingOpenGL2JavaJavaClasses >> [ 42%] Linking CXX executable ../../bin/vtkProbeOpenGLVersion >> Rendering/OpenGL2/CMakeFiles/vtkProbeOpenGLVersion.dir/build.make:108: >> recipe for target 'bin/vtkProbeOpenGLVersion' failed >> CMakeFiles/Makefile2:7640: recipe for target >> 'Rendering/OpenGL2/CMakeFiles/vtkProbeOpenGLVersion.dir/all' failed >> Makefile:140: recipe for target 'all' failed >> >> >> Have anyone gotten a problem like this one? >> >> Btw, if I set the VTK_RENDERING_BACKEND variable to None, I get the >> same error. >> >> Ricardo Santos >> > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: > http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://vtk.org/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zozonmr at gmail.com Wed Dec 26 17:10:31 2018 From: zozonmr at gmail.com (Zoltan Takacs) Date: Wed, 26 Dec 2018 23:10:31 +0100 Subject: [vtkusers] Using Vtk-8.1 in tcl/tk Message-ID: Hi, I have finally compiled VTK-8.1 on MacOS High Sierra and I could run couple of the Qt and c++ examples successfully. However I would like to use it tcl scripts as well. As far as I understood the *TCL shared libraries are not built any more from version 8.1. Is it still possible to use VTK in tcl programs? I have added the build/Wrapping/Tcl library to the auto_path and when I run one of the tcl examples I get an error message about the missing *TCL shared library. Here is the full error message: dlopen(/Users/me/data/VTK-8.1.2/build/lib/libvtkCommonCoreTCL-8.1.dylib, 6): image not found attempt to provide package vtkCommonCoreTCL 8.1 failed: no version of package vtkCommonCoreTCL provided attempt to provide package vtkcommoncore 8.1 failed: no version of package vtkcommoncore provided attempt to provide package vtk 8.1 failed: no version of package vtk provided ("package ifneeded vtk 8.1" script) invoked from within "package require vtk" (file "./AffineWidget.tcl" line 4) The error message is fair enough since there is no libvtkCommonCoreTCL-8.1.dylib ccmake didn?t allow me to create them. Thanks, Z From afajjay.hicham at gmail.com Thu Dec 27 06:48:40 2018 From: afajjay.hicham at gmail.com (Afajjay Hicham) Date: Thu, 27 Dec 2018 12:48:40 +0100 Subject: [vtkusers] ERROR in VTK Message-ID: Hello I installed VTK VTK-8.1.2 but when I use it in a first project "SimplePointsReader" the image works but I get a new window calls "vtkOutputwindow" print this Error : ERROR: In C:\VTK\VTK-8.1.2\Rendering\OpenGL2\vtkWin32OpenGLRenderWindow.cxx, line 733 vtkWin32OpenGLRenderWindow (000001D3C76A29B0): We have determined that your graphics system is an Intel SandyBridge based system. These systems only partially support VTK. If you encounter any issues please make sure your graphics drivers from Intel are up to date. So what can i do? thank you -- *AFAJJAY Hicham* *Ing?nieur IT* -------------- next part -------------- An HTML attachment was scrubbed... URL: From lasso at queensu.ca Thu Dec 27 16:45:56 2018 From: lasso at queensu.ca (Andras Lasso) Date: Thu, 27 Dec 2018 21:45:56 +0000 Subject: [vtkusers] anti-aliasing In-Reply-To: References: <0a1f4606-9c92-b10b-ee5c-923855a3bb1c@febus-optics.com> <27fd6479-4647-6588-168f-3d7ab8612684@febus-optics.com> Message-ID: To activate anti-aliasing, you can enable FXAA in the renderer using renderer.UseFXAAOn() or set number of samples in the render window using renderWindow.setMultiSamples(8) (if you render in a Qt widget, adjust samples property in the window?s surface format - http://doc.qt.io/qt-5/qsurfaceformat.html#setSamples). Anti-aliasing has impact on performance and may not be compatible with some rendering options. Andras From: vtkusers On Behalf Of Mohamed Amine Mzoughi Sent: Wednesday, December 26, 2018 10:38 AM To: Paulo Carvalho ; vtkusers at public.kitware.com Subject: Re: [vtkusers] anti-aliasing Hello again, If I do that, the chart is not visible anymore (the Qt widget is all black), if I change the renderer of the vtkContextView also (the Qt widget is all white) ! I give up for the moment ! ParaView is a such complex software, that I can't trace the stuff related to anti-alisaing in it (reverse engineering ParaView it is tough : a complex build system, many layers, proxies, in fact, it's an oriented object mix of a lasagna and spaghetti code !). Thanks anyway. Le 26/12/2018 ? 16:02, Paulo Carvalho a ?crit : Hi, Mohammed, Strange indeed. Did you create the vtkRender object yourself or you just used the default one returned by GetRenderer()? If the latter is your case, I recommend creating your own vtkRender: m_renderer = vtkSmartPointer::New(); m_renderer->UseFXAAOn(); vtkFXAAOptions* const aaOpts = m_renderer->GetFXAAOptions(); aaOpts->SetRelativeContrastThreshold(0.125); aaOpts->SetHardContrastThreshold(0.045); aaOpts->SetSubpixelBlendLimit(0.75); aaOpts->SetSubpixelContrastThreshold(0.25); aaOpts->SetUseHighQualityEndpoints(true); aaOpts->SetEndpointSearchIterations(12); m_view->GetRenderWindow()->AddRenderer( m_renderer ); cheers, Paulo Em qua, 26 de dez de 2018 ?s 12:15, Mohamed Amine Mzoughi > escreveu: Hello Paulo, Even without SmoothingOn* instructions, I still have a problem in my 2D charts (I use a subclass of vtkChartXY, same issue with vtkHistogramChart2D, I have rectangles in screen). In ParaView, the line is smooth : [cid:image001.png at 01D49DF9.6FAAD070] whereas in my VTK app, it isn't : [cid:image002.png at 01D49DF9.6FAAD070] I don't know the issue... I'm calling the FXAA instructions before Render() in the constructor, I tried even to call them before each call to Render(). Best regards. Le 26/12/2018 ? 14:21, Paulo Carvalho a ?crit : Hello, Mohamed! It seems that your last calls (*SmoothingOn()) conflict with UseFXAAOn(). Here is the output I get when I add a call to PolygonSmoothingOn(). Not only it is not antialiased, but you can notice the edges triangle strips, visually ruining the results: [image.png] This one is rendered with only UseFXAAOn() and some configuration to the vtkFXAAOptions object like you did: [image.png] kind regards, Paulo Em qua, 26 de dez de 2018 ?s 10:03, Mohamed Amine Mzoughi > escreveu: Hello, I want to enable Anti-alisaing in my VTK app, so I took some parameters from ParaView and it still doesn't work : m_view->GetRenderer()->UseFXAAOn(); // enable AA vtkFXAAOptions* const aaOpts = m_view->GetRenderer()->GetFXAAOptions(); aaOpts->SetRelativeContrastThreshold(0.125); aaOpts->SetHardContrastThreshold(0.045); aaOpts->SetSubpixelBlendLimit(0.75); aaOpts->SetSubpixelContrastThreshold(0.25); aaOpts->SetUseHighQualityEndpoints(true); aaOpts->SetEndpointSearchIterations(12); what am I missing ? Also, m_view->GetRenderWindow()->GetMultiSamples() => returns 8. and I called also : m_view->GetRenderWindow()->LineSmoothingOn(); m_view->GetRenderWindow()->PolygonSmoothingOn(); m_view->GetRenderWindow()->PointSmoothingOn(); Thanks. _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ Search the list archives at: http://markmail.org/search/?q=vtkusers Follow this link to subscribe/unsubscribe: https://vtk.org/mailman/listinfo/vtkusers -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.png Type: image/png Size: 35038 bytes Desc: image001.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image002.png Type: image/png Size: 14787 bytes Desc: image002.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image004.jpg Type: image/jpeg Size: 55731 bytes Desc: image004.jpg URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image006.jpg Type: image/jpeg Size: 50708 bytes Desc: image006.jpg URL: From lasso at queensu.ca Fri Dec 28 12:52:21 2018 From: lasso at queensu.ca (Andras Lasso) Date: Fri, 28 Dec 2018 17:52:21 +0000 Subject: [vtkusers] anti-aliasing In-Reply-To: References: <0a1f4606-9c92-b10b-ee5c-923855a3bb1c@febus-optics.com> <27fd6479-4647-6588-168f-3d7ab8612684@febus-optics.com> Message-ID: Multi-sampling works well for me (it smoothes lines, etc.) except axes areas appear black. This is probably a VTK bug that should be fixed, but maybe I just have not configured everything correctly. ParaView uses multi-sampling for anti-aliasing in plots and not FXAA (https://github.com/Kitware/ParaView/blob/master/Qt/Core/pqContextView.cxx#L143, https://gitlab.kitware.com/paraview/paraview/issues/17202). Anti-aliasing in plots works well in Paraview 5.5.2 (smooth lines, properly rendered axes). There is no antialiasing in plots in ParaView 5.6.0 (lines are jagged), so there may be some multi-sampling related issues in recent VTK version. Andras From: Mohamed Amine Mzoughi Sent: Friday, December 28, 2018 10:01 AM To: Andras Lasso ; Paulo Carvalho ; vtkusers at public.kitware.com Subject: Re: [vtkusers] anti-aliasing As you can see in the screenshots below, I was unable to smooth vtkChartXY's plot line (displayed on a QVTKOpenGLWidget) plot with UseFXAAOn and setMultiSamples(8) (multi samples is defaulted to 8 anyway). Changing the surface format's samples number messed badly the 2D charts with black areas. This is what I've done in constructor : QSurfaceFormat surface = m_widget->format(); std::cout << "[debug] Qt widget samples = " << surface.samples() << std::endl; // 0 by default (disabled) surface.setSamples(8); m_widget->setFormat(surface); Regards. Le 27/12/2018 ? 22:45, Andras Lasso a ?crit : To activate anti-aliasing, you can enable FXAA in the renderer using renderer.UseFXAAOn() or set number of samples in the render window using renderWindow.setMultiSamples(8) (if you render in a Qt widget, adjust samples property in the window?s surface format - http://doc.qt.io/qt-5/qsurfaceformat.html#setSamples). Anti-aliasing has impact on performance and may not be compatible with some rendering options. Andras From: vtkusers On Behalf Of Mohamed Amine Mzoughi Sent: Wednesday, December 26, 2018 10:38 AM To: Paulo Carvalho ; vtkusers at public.kitware.com Subject: Re: [vtkusers] anti-aliasing Hello again, If I do that, the chart is not visible anymore (the Qt widget is all black), if I change the renderer of the vtkContextView also (the Qt widget is all white) ! I give up for the moment ! ParaView is a such complex software, that I can't trace the stuff related to anti-alisaing in it (reverse engineering ParaView it is tough : a complex build system, many layers, proxies, in fact, it's an oriented object mix of a lasagna and spaghetti code !). Thanks anyway. Le 26/12/2018 ? 16:02, Paulo Carvalho a ?crit : Hi, Mohammed, Strange indeed. Did you create the vtkRender object yourself or you just used the default one returned by GetRenderer()? If the latter is your case, I recommend creating your own vtkRender: m_renderer = vtkSmartPointer::New(); m_renderer->UseFXAAOn(); vtkFXAAOptions* const aaOpts = m_renderer->GetFXAAOptions(); aaOpts->SetRelativeContrastThreshold(0.125); aaOpts->SetHardContrastThreshold(0.045); aaOpts->SetSubpixelBlendLimit(0.75); aaOpts->SetSubpixelContrastThreshold(0.25); aaOpts->SetUseHighQualityEndpoints(true); aaOpts->SetEndpointSearchIterations(12); m_view->GetRenderWindow()->AddRenderer( m_renderer ); cheers, Paulo Em qua, 26 de dez de 2018 ?s 12:15, Mohamed Amine Mzoughi > escreveu: Hello Paulo, Even without SmoothingOn* instructions, I still have a problem in my 2D charts (I use a subclass of vtkChartXY, same issue with vtkHistogramChart2D, I have rectangles in screen). In ParaView, the line is smooth : [cid:image001.png at 01D49E98.9BBE8900] whereas in my VTK app, it isn't : [cid:image002.png at 01D49E98.9BBE8900] I don't know the issue... I'm calling the FXAA instructions before Render() in the constructor, I tried even to call them before each call to Render(). Best regards. Le 26/12/2018 ? 14:21, Paulo Carvalho a ?crit : Hello, Mohamed! It seems that your last calls (*SmoothingOn()) conflict with UseFXAAOn(). Here is the output I get when I add a call to PolygonSmoothingOn(). Not only it is not antialiased, but you can notice the edges triangle strips, visually ruining the results: [image.png] This one is rendered with only UseFXAAOn() and some configuration to the vtkFXAAOptions object like you did: [image.png] kind regards, Paulo Em qua, 26 de dez de 2018 ?s 10:03, Mohamed Amine Mzoughi > escreveu: Hello, I want to enable Anti-alisaing in my VTK app, so I took some parameters from ParaView and it still doesn't work : m_view->GetRenderer()->UseFXAAOn(); // enable AA vtkFXAAOptions* const aaOpts = m_view->GetRenderer()->GetFXAAOptions(); aaOpts->SetRelativeContrastThreshold(0.125); aaOpts->SetHardContrastThreshold(0.045); aaOpts->SetSubpixelBlendLimit(0.75); aaOpts->SetSubpixelContrastThreshold(0.25); aaOpts->SetUseHighQualityEndpoints(true); aaOpts->SetEndpointSearchIterations(12); what am I missing ? Also, m_view->GetRenderWindow()->GetMultiSamples() => returns 8. and I called also : m_view->GetRenderWindow()->LineSmoothingOn(); m_view->GetRenderWindow()->PolygonSmoothingOn(); m_view->GetRenderWindow()->PointSmoothingOn(); Thanks. _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ Search the list archives at: http://markmail.org/search/?q=vtkusers Follow this link to subscribe/unsubscribe: https://vtk.org/mailman/listinfo/vtkusers -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.png Type: image/png Size: 35038 bytes Desc: image001.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image002.png Type: image/png Size: 14787 bytes Desc: image002.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image005.jpg Type: image/jpeg Size: 54298 bytes Desc: image005.jpg URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image008.jpg Type: image/jpeg Size: 49063 bytes Desc: image008.jpg URL: From lasso at queensu.ca Fri Dec 28 13:03:38 2018 From: lasso at queensu.ca (Andras Lasso) Date: Fri, 28 Dec 2018 18:03:38 +0000 Subject: [vtkusers] anti-aliasing In-Reply-To: References: <0a1f4606-9c92-b10b-ee5c-923855a3bb1c@febus-optics.com> <27fd6479-4647-6588-168f-3d7ab8612684@febus-optics.com> Message-ID: Plot axes are not painted correctly when multi-sampling is enabled due to an OpenGL error in vtkTextureObject::CopyFromFrameBuffer, which seems to be related to copying data from the frame buffer. [ERROR][VTK] 28.12.2018 12:51:01 [vtkTextureObject (0000026457878B60)] (C:\D\S4D\VTK\Rendering\OpenGL2\vtkTextureObject.cxx:1990) - failed at glCopyTexImage2D 32856 1 OpenGL errors detected 0 : (1282) Invalid operation Andras From: Andras Lasso Sent: Friday, December 28, 2018 12:52 PM To: 'Mohamed Amine Mzoughi' ; Paulo Carvalho ; vtkusers at public.kitware.com Subject: RE: [vtkusers] anti-aliasing Multi-sampling works well for me (it smoothes lines, etc.) except axes areas appear black. This is probably a VTK bug that should be fixed, but maybe I just have not configured everything correctly. ParaView uses multi-sampling for anti-aliasing in plots and not FXAA (https://github.com/Kitware/ParaView/blob/master/Qt/Core/pqContextView.cxx#L143, https://gitlab.kitware.com/paraview/paraview/issues/17202). Anti-aliasing in plots works well in Paraview 5.5.2 (smooth lines, properly rendered axes). There is no antialiasing in plots in ParaView 5.6.0 (lines are jagged), so there may be some multi-sampling related issues in recent VTK version. Andras From: Mohamed Amine Mzoughi > Sent: Friday, December 28, 2018 10:01 AM To: Andras Lasso >; Paulo Carvalho >; vtkusers at public.kitware.com Subject: Re: [vtkusers] anti-aliasing As you can see in the screenshots below, I was unable to smooth vtkChartXY's plot line (displayed on a QVTKOpenGLWidget) plot with UseFXAAOn and setMultiSamples(8) (multi samples is defaulted to 8 anyway). Changing the surface format's samples number messed badly the 2D charts with black areas. This is what I've done in constructor : QSurfaceFormat surface = m_widget->format(); std::cout << "[debug] Qt widget samples = " << surface.samples() << std::endl; // 0 by default (disabled) surface.setSamples(8); m_widget->setFormat(surface); Regards. Le 27/12/2018 ? 22:45, Andras Lasso a ?crit : To activate anti-aliasing, you can enable FXAA in the renderer using renderer.UseFXAAOn() or set number of samples in the render window using renderWindow.setMultiSamples(8) (if you render in a Qt widget, adjust samples property in the window?s surface format - http://doc.qt.io/qt-5/qsurfaceformat.html#setSamples). Anti-aliasing has impact on performance and may not be compatible with some rendering options. Andras From: vtkusers On Behalf Of Mohamed Amine Mzoughi Sent: Wednesday, December 26, 2018 10:38 AM To: Paulo Carvalho ; vtkusers at public.kitware.com Subject: Re: [vtkusers] anti-aliasing Hello again, If I do that, the chart is not visible anymore (the Qt widget is all black), if I change the renderer of the vtkContextView also (the Qt widget is all white) ! I give up for the moment ! ParaView is a such complex software, that I can't trace the stuff related to anti-alisaing in it (reverse engineering ParaView it is tough : a complex build system, many layers, proxies, in fact, it's an oriented object mix of a lasagna and spaghetti code !). Thanks anyway. Le 26/12/2018 ? 16:02, Paulo Carvalho a ?crit : Hi, Mohammed, Strange indeed. Did you create the vtkRender object yourself or you just used the default one returned by GetRenderer()? If the latter is your case, I recommend creating your own vtkRender: m_renderer = vtkSmartPointer::New(); m_renderer->UseFXAAOn(); vtkFXAAOptions* const aaOpts = m_renderer->GetFXAAOptions(); aaOpts->SetRelativeContrastThreshold(0.125); aaOpts->SetHardContrastThreshold(0.045); aaOpts->SetSubpixelBlendLimit(0.75); aaOpts->SetSubpixelContrastThreshold(0.25); aaOpts->SetUseHighQualityEndpoints(true); aaOpts->SetEndpointSearchIterations(12); m_view->GetRenderWindow()->AddRenderer( m_renderer ); cheers, Paulo Em qua, 26 de dez de 2018 ?s 12:15, Mohamed Amine Mzoughi > escreveu: Hello Paulo, Even without SmoothingOn* instructions, I still have a problem in my 2D charts (I use a subclass of vtkChartXY, same issue with vtkHistogramChart2D, I have rectangles in screen). In ParaView, the line is smooth : [cid:image001.png at 01D49EAD.6AE04340] whereas in my VTK app, it isn't : [cid:image002.png at 01D49EAD.6AE04340] I don't know the issue... I'm calling the FXAA instructions before Render() in the constructor, I tried even to call them before each call to Render(). Best regards. Le 26/12/2018 ? 14:21, Paulo Carvalho a ?crit : Hello, Mohamed! It seems that your last calls (*SmoothingOn()) conflict with UseFXAAOn(). Here is the output I get when I add a call to PolygonSmoothingOn(). Not only it is not antialiased, but you can notice the edges triangle strips, visually ruining the results: [image.png] This one is rendered with only UseFXAAOn() and some configuration to the vtkFXAAOptions object like you did: [image.png] kind regards, Paulo Em qua, 26 de dez de 2018 ?s 10:03, Mohamed Amine Mzoughi > escreveu: Hello, I want to enable Anti-alisaing in my VTK app, so I took some parameters from ParaView and it still doesn't work : m_view->GetRenderer()->UseFXAAOn(); // enable AA vtkFXAAOptions* const aaOpts = m_view->GetRenderer()->GetFXAAOptions(); aaOpts->SetRelativeContrastThreshold(0.125); aaOpts->SetHardContrastThreshold(0.045); aaOpts->SetSubpixelBlendLimit(0.75); aaOpts->SetSubpixelContrastThreshold(0.25); aaOpts->SetUseHighQualityEndpoints(true); aaOpts->SetEndpointSearchIterations(12); what am I missing ? Also, m_view->GetRenderWindow()->GetMultiSamples() => returns 8. and I called also : m_view->GetRenderWindow()->LineSmoothingOn(); m_view->GetRenderWindow()->PolygonSmoothingOn(); m_view->GetRenderWindow()->PointSmoothingOn(); Thanks. _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ Search the list archives at: http://markmail.org/search/?q=vtkusers Follow this link to subscribe/unsubscribe: https://vtk.org/mailman/listinfo/vtkusers -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.png Type: image/png Size: 35038 bytes Desc: image001.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image002.png Type: image/png Size: 14787 bytes Desc: image002.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image004.jpg Type: image/jpeg Size: 54111 bytes Desc: image004.jpg URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image006.jpg Type: image/jpeg Size: 48918 bytes Desc: image006.jpg URL: From aminemzoughi at febus-optics.com Fri Dec 28 10:00:35 2018 From: aminemzoughi at febus-optics.com (Mohamed Amine Mzoughi) Date: Fri, 28 Dec 2018 16:00:35 +0100 Subject: [vtkusers] anti-aliasing In-Reply-To: References: <0a1f4606-9c92-b10b-ee5c-923855a3bb1c@febus-optics.com> <27fd6479-4647-6588-168f-3d7ab8612684@febus-optics.com> Message-ID: As you can see in the screenshots below, I was unable to smooth vtkChartXY's plot line (displayed on a QVTKOpenGLWidget) plot with UseFXAAOn and setMultiSamples(8) (multi samples is defaulted to 8 anyway). Changing the surface format's samples number messed badly the 2D charts with black areas. This is what I've done in constructor : QSurfaceFormat surface = m_widget->format(); std::cout << "[debug] Qt widget samples = " << surface.samples() << std::endl; // 0 by default (disabled) surface.setSamples(8); m_widget->setFormat(surface); Regards. Le 27/12/2018 ? 22:45, Andras Lasso a ?crit?: > > To activate anti-aliasing, you can enable FXAA in the renderer using > renderer.UseFXAAOn() or set number of samples in the render window > using renderWindow.setMultiSamples(8) (if you render in a Qt widget, > adjust samples property in the window?s surface format - > http://doc.qt.io/qt-5/qsurfaceformat.html#setSamples). Anti-aliasing > has impact on performance and may not be compatible with some > rendering options. > > Andras > > *From:* vtkusers *On Behalf Of *Mohamed > Amine Mzoughi > *Sent:* Wednesday, December 26, 2018 10:38 AM > *To:* Paulo Carvalho ; > vtkusers at public.kitware.com > *Subject:* Re: [vtkusers] anti-aliasing > > Hello again, > > If I do that, the chart is not visible anymore (the Qt widget is all > black), if I change the renderer of the vtkContextView also? (the Qt > widget is all white) ! > > I give up for the moment ! > > ParaView is a such complex software, that I can't trace the stuff > related to anti-alisaing in it (reverse engineering ParaView it is > tough : a complex build system, many layers, proxies, in fact, it's an > oriented object mix of a lasagna and spaghetti code !). > > Thanks anyway. > > Le 26/12/2018 ? 16:02, Paulo Carvalho a ?crit?: > > Hi, Mohammed, > > ?? Strange indeed.? Did you create the vtkRender object yourself > or you just used the default one returned by GetRenderer()? If the > latter is your case, I recommend creating your own vtkRender: > > > m_renderer=vtkSmartPointer::New(); > m_renderer->/UseFXAAOn/(); > > ??? vtkFXAAOptions* const aaOpts = m_renderer->GetFXAAOptions(); > aaOpts->SetRelativeContrastThreshold(0.125); > ???? aaOpts->SetHardContrastThreshold(0.045); > ???? aaOpts->SetSubpixelBlendLimit(0.75); > aaOpts->SetSubpixelContrastThreshold(0.25); > ???? aaOpts->SetUseHighQualityEndpoints(true); > ???? aaOpts->SetEndpointSearchIterations(12); > > m_view->/GetRenderWindow/()->/AddRenderer/(m_renderer ); > > cheers, > > Paulo > > Em qua, 26 de dez de 2018 ?s 12:15, Mohamed Amine Mzoughi > > escreveu: > > Hello Paulo, > > Even without SmoothingOn* instructions, I still have a problem > in my 2D charts (I use a subclass of vtkChartXY, same issue > with vtkHistogramChart2D, I have rectangles in screen). > > In ParaView, the line is smooth : > > > whereas in my VTK app, it isn't : > > > > I don't know the issue... > > I'm calling the FXAA instructions before Render() in the > constructor, I tried even to call them before each call to > Render(). > > Best regards. > > Le 26/12/2018 ? 14:21, Paulo Carvalho a ?crit?: > > Hello, Mohamed! > > ? It seems that your last calls (*SmoothingOn()) conflict > with UseFXAAOn(). > > Here is the output I get when I add a call to > PolygonSmoothingOn().? Not only it is not antialiased, but > you can notice the edges triangle strips, visually ruining > the results: > > image.png > > This one is rendered with only UseFXAAOn() and some > configuration to the vtkFXAAOptions object like you did: > > image.png > > kind regards, > > Paulo > > Em qua, 26 de dez de 2018 ?s 10:03, Mohamed Amine Mzoughi > > escreveu: > > Hello, > > I want to enable Anti-alisaing in my VTK app, so I > took some parameters > from ParaView and it still doesn't work : > > ???? m_view->GetRenderer()->UseFXAAOn(); // enable AA > > ???? vtkFXAAOptions* const aaOpts = > m_view->GetRenderer()->GetFXAAOptions(); > aaOpts->SetRelativeContrastThreshold(0.125); > ???? aaOpts->SetHardContrastThreshold(0.045); > ???? aaOpts->SetSubpixelBlendLimit(0.75); > aaOpts->SetSubpixelContrastThreshold(0.25); > aaOpts->SetUseHighQualityEndpoints(true); > ???? aaOpts->SetEndpointSearchIterations(12); > > what am I missing ? > > Also, m_view->GetRenderWindow()->GetMultiSamples() => > returns 8. > > and I called also : > > m_view->GetRenderWindow()->LineSmoothingOn(); > m_view->GetRenderWindow()->PolygonSmoothingOn(); > m_view->GetRenderWindow()->PointSmoothingOn(); > > Thanks. > > _______________________________________________ > Powered by www.kitware.com > > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > > Please keep messages on-topic and check the VTK FAQ > at: http://www.vtk.org/Wiki/VTK_FAQ > > > Search the list archives at: > http://markmail.org/search/?q=vtkusers > > > Follow this link to subscribe/unsubscribe: > https://vtk.org/mailman/listinfo/vtkusers > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.png Type: image/png Size: 35038 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image002.png Type: image/png Size: 14787 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image004.jpg Type: image/jpeg Size: 55731 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image006.jpg Type: image/jpeg Size: 50708 bytes Desc: not available URL: From dan.lipsa at kitware.com Sat Dec 29 11:21:33 2018 From: dan.lipsa at kitware.com (Dan Lipsa) Date: Sat, 29 Dec 2018 11:21:33 -0500 Subject: [vtkusers] construct from vtkCamera from opengl Variables In-Reply-To: References: Message-ID: If you have a scene that you want to render in VTK, the easiest would be to build a vtkDataset (vtkPolyData most likely) and then render that in VTK. You don't need to worry about the OpenGL transform or interaction as VTK does this for you. Take a look at https://lorensen.github.io/VTKExamples/site/ Cxx / GeometricObjects for examples of how to do this. Dan On Sat, Dec 22, 2018 at 6:01 PM Elhassan Abdou wrote: > Dear All, > > I have a scene that I constructed using OpenGL and I want to rewrite the > code using VTK. > So I have view matrix (compose of, scaling in z, and translation in the > x,y,z). > I know I am rendering using perspective mode, so I have near plane, far > plane and horizontal fov. > > I tried to use vtkExternalOpenGL, but nothing is rendered. > > Can anyone give me help on how to adjust vtkOpenGLCamera to use these > parameters to render the scene? > > Regards > Elhassan > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the VTK FAQ at: > http://www.vtk.org/Wiki/VTK_FAQ > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > https://vtk.org/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: From t.stuart at dautomation.com Sun Dec 30 09:38:27 2018 From: t.stuart at dautomation.com (Stuart, Travis) Date: Sun, 30 Dec 2018 14:38:27 +0000 Subject: [vtkusers] Scaling Glyphs by Camera but to a Limit Message-ID: <9BD404E7D759A24FB34ACE0E4C9F162BB1E137@es002.dautomation.local> Hi, I'm having trouble achieving a particular rendering behavior with VTK. I would like to render glyphs of my point cloud with a fixed screen size up until the camera is zoomed in close enough for the glyph to be its actual size. I want them to be scaled up but not down. I can fake this behavior by rendering two sets on top of each other. One set not scaled and the other scaled by distance to camera. But this is not ideal for huge data sets and I'd like to learn the correct way to solve this with one set. At first I thought the scale clamping functionality of the vtkGlyph3DMapper could do this but setting the range to clamp seems to just scale the 'DistanceToCamera' values to the range. One idea I had was to create a programmable filter that takes the vtkDistanceToCamera as input and outputs the same object but with an additional array. The same 'DistanceToCamera' array but with capped values below a certain threshold. Like any value under 1 would be set to 1. This is my failed attempt: It causes Python to immediately crash without error message. cap_array_filter = vtk.vtkProgrammableFilter() cap_array_filter.SetInputConnection(camera_dist_b.GetOutputPort()) def cap_array(): d2c_array = cap_array_filter.GetPolyDataInput().GetPointData().GetArray('DistanceToCamera') new_array = vtk.vtkDoubleArray() new_array.SetName('DistanceToCameraCapped') for i in range(0, d2c_array.GetSize()): new_value = d2c_array.GetTuple1(i) if new_value < 1: new_value = 1 new_array.InsertNextValue(new_value) cap_array_filter.GetPointData().AddArray(new_array) cap_array_filter.SetExecuteMethod(cap_array) camera_dist_b.SetInputConnection(cap_array_filter.GetOutputPort()) mapper_b = vtk.vtkGlyph3DMapper() mapper_b.SetInputData(self.nominal_poly_data) mapper_b.SetSourceConnection(sphere.GetOutputPort()) mapper_b.SetInputConnection(camera_dist_b.GetOutputPort()) mapper_b.SetInputArrayToProcess(0, 0, 0, vtk.vtkDataObject.FIELD_ASSOCIATION_POINTS, 'DistanceToCameraCapped') I also tried creating a VTKPythonAlgorithm to pass in a vtkDistanceToCamera and add the capped array. But I can't get the instance to initialize without errors so not much progress there. class DistanceToCameraCapper(VTKPythonAlgorithmBase): def __init__(self): VTKPythonAlgorithmBase.__init__(self, nInputPorts=1, inputType= vtkDistanceToCamera, nOutputPorts=1, outputType= vtkDistanceToCamera) def RequestData(self, request, inInfo, outInfo): print('Executing') input = vtk.vtkDistanceToCamera.GetData(inInfo[0]) output = vtk.vtkDistanceToCamera.GetData(outInfo) d2c = vtk.vtkDistanceToCamera() d2c.SetInputData(input) d2c.Update() output.ShallowCopy(d2c.GetOutput()) return 1 I'd be grateful for any ideas or hints on how to accomplish this idea. I've attached a demonstration. The red spheres are not scaled. The green spheres are scaled by distance to camera. The purple spheres show the visual behavior that I want. It's using the "fake" method of rendering two sets of spheres on top of each other. One set scaled and the other not. Thanks, Travis Stuart -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: d2c limit example.py Type: application/octet-stream Size: 2844 bytes Desc: d2c limit example.py URL: From aminemzoughi at febus-optics.com Mon Dec 31 04:44:38 2018 From: aminemzoughi at febus-optics.com (Mohamed Amine Mzoughi) Date: Mon, 31 Dec 2018 10:44:38 +0100 Subject: [vtkusers] anti-aliasing In-Reply-To: References: <0a1f4606-9c92-b10b-ee5c-923855a3bb1c@febus-optics.com> <27fd6479-4647-6588-168f-3d7ab8612684@febus-optics.com> Message-ID: Hello Andras, Thank you very much, in fact, calling the antialisaing code of pqContextView::createWidget() after creating a QVTKOpenGLWidget fixed my aliasing problem (https://github.com/Kitware/ParaView/blob/master/Qt/Core/pqContextView.cxx#L143) BTW, I am using an old version of ParaView (and also VTK) as I'm working under Centos 7 (but I will update VTK/Paraview when the version 8 is released). Happy New Year 2019. Amine. Le 28/12/2018 ? 19:03, Andras Lasso a ?crit?: > > Plot axes are not painted correctly when multi-sampling is enabled due > to an OpenGL error in vtkTextureObject::CopyFromFrameBuffer, which > seems to be related to copying data from the frame buffer. > > [ERROR][VTK] 28.12.2018 12:51:01 [vtkTextureObject (0000026457878B60)] > (C:\D\S4D\VTK\Rendering\OpenGL2\vtkTextureObject.cxx:1990) - failed at > glCopyTexImage2D 32856 1 OpenGL errors detected > > 0 : (1282) Invalid operation > > Andras > > *From:* Andras Lasso > *Sent:* Friday, December 28, 2018 12:52 PM > *To:* 'Mohamed Amine Mzoughi' ; Paulo > Carvalho ; vtkusers at public.kitware.com > *Subject:* RE: [vtkusers] anti-aliasing > > Multi-sampling works well for me (it smoothes lines, etc.) except axes > areas appear black. This is probably a VTK bug that should be fixed, > but maybe I just have not configured everything correctly. > > ParaView uses multi-sampling for anti-aliasing in plots and not FXAA > (https://github.com/Kitware/ParaView/blob/master/Qt/Core/pqContextView.cxx#L143, > https://gitlab.kitware.com/paraview/paraview/issues/17202). > Anti-aliasing in plots works well in Paraview 5.5.2 (smooth lines, > properly rendered axes). *There is no antialiasing in plots in > ParaView 5.6.0 (lines are jagged), so there may be some multi-sampling > related issues in recent VTK version.* > > Andras > > *From:* Mohamed Amine Mzoughi > > *Sent:* Friday, December 28, 2018 10:01 AM > *To:* Andras Lasso >; Paulo > Carvalho >; vtkusers at public.kitware.com > > *Subject:* Re: [vtkusers] anti-aliasing > > As you can see in the screenshots below, I was unable to smooth > vtkChartXY's plot line (displayed on a QVTKOpenGLWidget) plot with > UseFXAAOn and setMultiSamples(8) (multi samples is defaulted to 8 anyway). > > Changing the surface format's samples number messed badly the 2D > charts with black areas. This is what I've done in constructor : > > QSurfaceFormat surface = m_widget->format(); > std::cout << "[debug] Qt widget samples = " << surface.samples() << > std::endl; // 0 by default (disabled) > surface.setSamples(8); > m_widget->setFormat(surface); > > Regards. > > Le 27/12/2018 ? 22:45, Andras Lasso a ?crit?: > > To activate anti-aliasing, you can enable FXAA in the renderer > using renderer.UseFXAAOn() or set number of samples in the render > window using renderWindow.setMultiSamples(8) (if you render in a > Qt widget, adjust samples property in the window?s surface format > - http://doc.qt.io/qt-5/qsurfaceformat.html#setSamples > ). > Anti-aliasing has impact on performance and may not be compatible > with some rendering options. > > Andras > > *From:* vtkusers > *On Behalf Of *Mohamed Amine Mzoughi > *Sent:* Wednesday, December 26, 2018 10:38 AM > *To:* Paulo Carvalho > ; vtkusers at public.kitware.com > > *Subject:* Re: [vtkusers] anti-aliasing > > Hello again, > > If I do that, the chart is not visible anymore (the Qt widget is > all black), if I change the renderer of the vtkContextView also? > (the Qt widget is all white) ! > > I give up for the moment ! > > ParaView is a such complex software, that I can't trace the stuff > related to anti-alisaing in it (reverse engineering ParaView it is > tough : a complex build system, many layers, proxies, in fact, > it's an oriented object mix of a lasagna and spaghetti code !). > > Thanks anyway. > > Le 26/12/2018 ? 16:02, Paulo Carvalho a ?crit?: > > Hi, Mohammed, > > ?? Strange indeed.? Did you create the vtkRender object > yourself or you just used the default one returned by > GetRenderer()??? If the latter is your case, I recommend > creating your own vtkRender: > > > m_renderer=vtkSmartPointer::New(); > m_renderer->/UseFXAAOn/(); > > ??? vtkFXAAOptions* const aaOpts = m_renderer->GetFXAAOptions(); > aaOpts->SetRelativeContrastThreshold(0.125); > ???? aaOpts->SetHardContrastThreshold(0.045); > ???? aaOpts->SetSubpixelBlendLimit(0.75); > aaOpts->SetSubpixelContrastThreshold(0.25); > aaOpts->SetUseHighQualityEndpoints(true); > ???? aaOpts->SetEndpointSearchIterations(12); > > m_view->/GetRenderWindow/()->/AddRenderer/(m_renderer ); > > cheers, > > Paulo > > Em qua, 26 de dez de 2018 ?s 12:15, Mohamed Amine Mzoughi > > escreveu: > > Hello Paulo, > > Even without SmoothingOn* instructions, I still have a > problem in my 2D charts (I use a subclass of vtkChartXY, > same issue with vtkHistogramChart2D, I have rectangles in > screen). > > In ParaView, the line is smooth : > > > whereas in my VTK app, it isn't : > > > > I don't know the issue... > > I'm calling the FXAA instructions before Render() in the > constructor, I tried even to call them before each call to > Render(). > > Best regards. > > Le 26/12/2018 ? 14:21, Paulo Carvalho a ?crit?: > > Hello, Mohamed! > > ? It seems that your last calls (*SmoothingOn()) > conflict with UseFXAAOn(). > > Here is the output I get when I add a call to > PolygonSmoothingOn().? Not only it is not antialiased, > but you can notice the edges triangle strips, visually > ruining the results: > > image.png > > This one is rendered with only UseFXAAOn() and some > configuration to the vtkFXAAOptions object like you did: > > image.png > > kind regards, > > Paulo > > Em qua, 26 de dez de 2018 ?s 10:03, Mohamed Amine > Mzoughi > escreveu: > > Hello, > > I want to enable Anti-alisaing in my VTK app, so I > took some parameters > from ParaView and it still doesn't work : > > ???? m_view->GetRenderer()->UseFXAAOn(); // enable AA > > ???? vtkFXAAOptions* const aaOpts = > m_view->GetRenderer()->GetFXAAOptions(); > aaOpts->SetRelativeContrastThreshold(0.125); > aaOpts->SetHardContrastThreshold(0.045); > ???? aaOpts->SetSubpixelBlendLimit(0.75); > aaOpts->SetSubpixelContrastThreshold(0.25); > aaOpts->SetUseHighQualityEndpoints(true); > aaOpts->SetEndpointSearchIterations(12); > > what am I missing ? > > Also, m_view->GetRenderWindow()->GetMultiSamples() > => returns 8. > > and I called also : > > m_view->GetRenderWindow()->LineSmoothingOn(); > m_view->GetRenderWindow()->PolygonSmoothingOn(); > m_view->GetRenderWindow()->PointSmoothingOn(); > > Thanks. > > _______________________________________________ > Powered by www.kitware.com > > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > > Please keep messages on-topic and check the VTK > FAQ at: http://www.vtk.org/Wiki/VTK_FAQ > > > Search the list archives at: > http://markmail.org/search/?q=vtkusers > > > Follow this link to subscribe/unsubscribe: > https://vtk.org/mailman/listinfo/vtkusers > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.png Type: image/png Size: 35038 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image002.png Type: image/png Size: 14787 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image004.jpg Type: image/jpeg Size: 54111 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image006.jpg Type: image/jpeg Size: 48918 bytes Desc: not available URL: From slavd88 at gmail.com Mon Dec 31 07:17:44 2018 From: slavd88 at gmail.com (bdemin) Date: Mon, 31 Dec 2018 05:17:44 -0700 (MST) Subject: [vtkusers] How to dynamically update vtkTextActor input in an animation? Message-ID: <1546258664985-0.post@n5.nabble.com> I have a 3D simulation done in VTK with a text actor which displays the current runtime. My inefficient way of doing that is creating a vtkTextActor object in each frame which holds the current runtime in seconds as input and deleting the TextActor from the last frame. All of that happens inside a repeating vtkTimerCallback function. On each frame I create and delete a vtkTextActor. Is there a way to dynamically update the SetInput() method of vtkTextActor and then showing the new text on each execution of vtkTimerCallback? In other words - using the same vtkTextActor and updating it on each frame rather than creating\deleting actors. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html