From shayan.moradkhani at gmail.com Sun Jul 1 09:31:12 2018 From: shayan.moradkhani at gmail.com (shayan moradkhani) Date: Sun, 1 Jul 2018 06:31:12 -0700 (MST) Subject: [vtkusers] vtkOBJReader example for C++ In-Reply-To: References: <1530090854298-0.post@n5.nabble.com> Message-ID: <1530451872333-0.post@n5.nabble.com> hi, i have been loading obj files in vtk successfully. however, i want to get the center coordinates of the loaded model to move the whole object by moving its center. is there any way to do that? thanks Shayan -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From minpu.code at gmail.com Sun Jul 1 19:49:05 2018 From: minpu.code at gmail.com (pnt1614) Date: Sun, 1 Jul 2018 16:49:05 -0700 (MST) Subject: [vtkusers] machining simulation and collision detection In-Reply-To: References: <1530181664677-0.post@n5.nabble.com> Message-ID: <1530488945540-0.post@n5.nabble.com> This filter is used in Slicer and do you know how to use this filter in VTK? -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From bill.lorensen at gmail.com Sun Jul 1 21:44:56 2018 From: bill.lorensen at gmail.com (Bill Lorensen) Date: Sun, 1 Jul 2018 18:44:56 -0700 Subject: [vtkusers] machining simulation and collision detection In-Reply-To: <1530488945540-0.post@n5.nabble.com> References: <1530181664677-0.post@n5.nabble.com> <1530488945540-0.post@n5.nabble.com> Message-ID: I am converting it to vtk. On Sun, Jul 1, 2018, 4:49 PM pnt1614 wrote: > This filter is used in Slicer and do you know how to use this filter in > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From scofieldzhu.zcg at gmail.com Mon Jul 2 01:41:59 2018 From: scofieldzhu.zcg at gmail.com (scofield zhu) Date: Mon, 2 Jul 2018 13:41:59 +0800 Subject: [vtkusers] vtkAlgorithm::PRESERVES_RANGES/PRESERVES_BOUNDS is missed when migrating from vtk5.6 to vtk7.1 Message-ID: hi all: I find vtkAlgorithm::PRESERVES_RANGES/PRESERVES_BOUNDS missed when i migrated my project from vtk5.6 to vtk7.1. how I handle this situation? what's their replacement in vtk7.1? please help! -------------- next part -------------- An HTML attachment was scrubbed... URL: From shayan.moradkhani at gmail.com Mon Jul 2 07:30:18 2018 From: shayan.moradkhani at gmail.com (shayan moradkhani) Date: Mon, 2 Jul 2018 04:30:18 -0700 (MST) Subject: [vtkusers] vtkOBJReader example for C++ In-Reply-To: <1530451872333-0.post@n5.nabble.com> References: <1530090854298-0.post@n5.nabble.com> <1530451872333-0.post@n5.nabble.com> Message-ID: <1530531018255-0.post@n5.nabble.com> int main(int, char *[]) { std::string filename = "Part3.obj"; vtkSmartPointer reader = vtkSmartPointer::New(); reader->SetFileName(filename.c_str()); reader->Update(); // Visualize vtkSmartPointer mapper = vtkSmartPointer::New(); mapper->SetInputConnection(reader->GetOutputPort()); vtkSmartPointer actor = vtkSmartPointer::New(); actor->SetMapper(mapper); actor->GetProperty()->SetColor(1.0000, 0.3882, 0.2784); vtkSmartPointer renderer = vtkSmartPointer::New(); renderer->AddActor(actor); renderer->SetBackground(.1, .3, .3); // Background color green // Zoom in a little by accessing the camera and invoking its "Zoom" method. renderer->ResetCamera(); //renderer->GetActiveCamera()->Zoom(1.5); vtkSmartPointer renderWindow = vtkSmartPointer::New(); renderWindow->SetSize(800, 600); renderWindow->AddRenderer(renderer); vtkSmartPointer renderWindowInteractor = vtkSmartPointer::New(); renderWindowInteractor->SetRenderWindow(renderWindow); renderWindowInteractor->Start(); return EXIT_SUCCESS; } this is what i have. however, when i load in vtk, i have no idead where the model is loaded (with respect to the global coordinate system). if i could get its center, it would be easier i guess to apply transformation on the object -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From nztoddler at yahoo.com Mon Jul 2 08:09:02 2018 From: nztoddler at yahoo.com (Todd Martin) Date: Mon, 2 Jul 2018 12:09:02 +0000 (UTC) Subject: [vtkusers] vtkOBJReader example for C++ In-Reply-To: <1530531018255-0.post@n5.nabble.com> References: <1530090854298-0.post@n5.nabble.com> <1530451872333-0.post@n5.nabble.com> <1530531018255-0.post@n5.nabble.com> Message-ID: <1689355449.1323620.1530533342072@mail.yahoo.com> You probably need to do something like ?reader->GetOutput()->GetBounds() or reader->GetOutput()->GetCenter() Todd Martin, PhD. Freelance Engineer/Software Architect. On Monday, July 2, 2018, 11:30:42 PM GMT+12, shayan moradkhani wrote: int main(int, char *[]) { ??? std::string filename = "Part3.obj"; ??? vtkSmartPointer reader = vtkSmartPointer::New(); ??? reader->SetFileName(filename.c_str()); ??? reader->Update(); ??? // Visualize ??? vtkSmartPointer mapper = ??? ??? vtkSmartPointer::New(); ??? mapper->SetInputConnection(reader->GetOutputPort()); ??? ??? vtkSmartPointer actor = ??? ??? vtkSmartPointer::New(); ??? actor->SetMapper(mapper); ??? actor->GetProperty()->SetColor(1.0000, 0.3882, 0.2784); ??? ??? vtkSmartPointer renderer = ??? ??? vtkSmartPointer::New(); ??? renderer->AddActor(actor); ??? renderer->SetBackground(.1, .3, .3); // Background color green??? ??? // Zoom in a little by accessing the camera and invoking its "Zoom" method. ??? renderer->ResetCamera(); ??? //renderer->GetActiveCamera()->Zoom(1.5); ??? vtkSmartPointer renderWindow = ??? ??? vtkSmartPointer::New(); ??? renderWindow->SetSize(800, 600); ??? renderWindow->AddRenderer(renderer); ??? vtkSmartPointer renderWindowInteractor = ??? ??? vtkSmartPointer::New(); ??? renderWindowInteractor->SetRenderWindow(renderWindow); ??? renderWindowInteractor->Start(); ??? return EXIT_SUCCESS; } this is what i have. however, when i load in vtk, i have no idead where the model is loaded (with respect to the global coordinate system). if i could get its center, it would be easier i guess to apply transformation on the object -- 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 mark.ostroot at lickenbrocktech.com Mon Jul 2 11:51:16 2018 From: mark.ostroot at lickenbrocktech.com (mark.ostroot at lickenbrocktech.com) Date: Mon, 02 Jul 2018 08:51:16 -0700 Subject: [vtkusers] 3D volume camera clipping help In-Reply-To: <20180628124659.c7db654a879d86b78cfcacc46040d57b.bf74ba9286.mailapi@email09.godaddy.com> Message-ID: <20180702085116.c7db654a879d86b78cfcacc46040d57b.94cc80fe56.mailapi@email09.godaddy.com> Hello Aashish, I ended up getting the new VTK master version working with my code, and the clipping problem went away! I was wondering if you knew an estimate of when the next release should be, or if you knew what commit fixed that bug, so I can apply a patch on our VTK version in house. Thank you for your help, Mark O --------- Original Message --------- Subject: RE: Re: Re: [vtkusers] 3D volume camera clipping help From: mark.ostroot at lickenbrocktech.com Date: 6/28/18 12:46 pm To: "Aashish Chaudhary" Cc: vtkusers at vtk.org I'm not quite certain what you mean, but I have cleaned the project I'm running so there shouldn't be anything old left over. Additionally the master branch of vtk is installed to a new directory, which is where all of my code is now linking to. --------- Original Message --------- Subject: Re: Re: [vtkusers] 3D volume camera clipping help From: "Aashish Chaudhary" Date: 6/28/18 11:36 am To: mark.ostroot at lickenbrocktech.com Cc: vtkusers at vtk.org would it be possible for you to do clear build (remove any other cache) and get rid of old build files? On Thu, Jun 28, 2018 at 2:07 PM wrote: Hello Aashish, I am getting some unresolved external symbols from the new libraries, specifically some issues with vtk volume set property and qvtkopenglwidget. I'm fairly certain I'm linking to the new libraries correctly, maybe I'm missing something obvious? Some excerpts from visual studio: error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl vtkVolume::SetProperty(class vtkVolumeProperty *)" (__imp_?SetProperty at vtkVolume@@QEAAXPEAVvtkVolumeProperty@@@Z) referenced in function "private: void __cdecl QTVTKRender::InitializeRendering(void)" (?InitializeRendering at QTVTKRender@@AEAAXXZ) error LNK2019: unresolved external symbol "__declspec(dllimport) public: class vtkVolumeProperty * __cdecl vtkVolume::GetProperty(void)" (__imp_?GetProperty at vtkVolume@@QEAAPEAVvtkVolumeProperty@@XZ) referenced in function "public: void __cdecl QTVTKRender::updateShading(class QAction *)" (?updateShading at QTVTKRender@@QEAAXPEAVQAction@@@Z) error LNK2001: unresolved external symbol "public: virtual class QVTKInteractor * __cdecl QVTKOpenGLWidget::GetInteractor(void)" (?GetInteractor at QVTKOpenGLWidget@@UEAAPEAVQVTKInteractor@@XZ) error LNK2001: unresolved external symbol "protected: virtual void __cdecl QVTKOpenGLWidget::cleanupContext(void)" (?cleanupContext at QVTKOpenGLWidget@@MEAAXXZ) error LNK2001: unresolved external symbol "protected: virtual void __cdecl QVTKOpenGLWidget::initializeGL(void)" (?initializeGL at QVTKOpenGLWidget@@MEAAXXZ) 2> SelectionTool.cpp error LNK2001: unresolved external symbol "protected: virtual void __cdecl QVTKOpenGLWidget::mouseDoubleClickEvent(class QMouseEvent *)" (?mouseDoubleClickEvent at QVTKOpenGLWidget@@MEAAXPEAVQMouseEvent@@@Z) error LNK2001: unresolved external symbol "protected: virtual void __cdecl QVTKOpenGLWidget::mouseMoveEvent(class QMouseEvent *)" (?mouseMoveEvent at QVTKOpenGLWidget@@MEAAXPEAVQMouseEvent@@@Z) error LNK2001: unresolved external symbol "protected: virtual void __cdecl QVTKOpenGLWidget::mousePressEvent(class QMouseEvent *)" (?mousePressEvent at QVTKOpenGLWidget@@MEAAXPEAVQMouseEvent@@@Z) error LNK2001: unresolved external symbol "protected: virtual void __cdecl QVTKOpenGLWidget::mouseReleaseEvent(class QMouseEvent *)" (?mouseReleaseEvent at QVTKOpenGLWidget@@MEAAXPEAVQMouseEvent@@@Z) error LNK2001: unresolved external symbol "protected: virtual void __cdecl QVTKOpenGLWidget::paintGL(void)" (?paintGL at QVTKOpenGLWidget@@MEAAXXZ) error LNK2001: unresolved external symbol "protected: virtual bool __cdecl QVTKOpenGLWidget::renderVTK(void)" (?renderVTK at QVTKOpenGLWidget@@MEAA_NXZ) error LNK2001: unresolved external symbol "protected: virtual void __cdecl QVTKOpenGLWidget::resizeGL(int,int)" (?resizeGL at QVTKOpenGLWidget@@MEAAXHH at Z) Thanks in advance, Mark O --------- Original Message --------- Subject: RE: Re: [vtkusers] 3D volume camera clipping help From: mark.ostroot at lickenbrocktech.com Date: 6/27/18 1:39 pm To: "Aashish Chaudhary" Cc: vtkusers at vtk.org Dear Aashish, I am grabbing the latest from master and compiling from source, I will test to see if this fixes my issue and let you know. -Mark --------- Original Message --------- Subject: Re: [vtkusers] 3D volume camera clipping help From: "Aashish Chaudhary" Date: 6/27/18 12:48 pm To: mark.ostroot at lickenbrocktech.com Cc: vtkusers at vtk.org Dear Mark, We had a bug which could have resulted in what you are observing. Would it be possible for you to try current master and see if this goes away? - Aashish On Wed, Jun 27, 2018 at 3:39 PM wrote: Hello, I have a 3D volume of some CT Data that works fine at the original aspect Ratio. I have some code that adjusts the aspect ratio of the volume by using the VtkReSlicer. Which works well for applying a new aspect ratio. My issue is that whenever my aspect ratio is non-Cubic I get some clipping of my volume at certain angles when it is being rotated around. I have tried using the "ResetCameraClippingRange" function, but this seems to have no effect on my Rendered volume. I know that the clipping range bounds are computed from the actor dimensions and they don't seem to change when I change the aspect ratio. Does anyone have any ideas on what I may be missing? Some noteworthy information: C++ application VTK version 8.1.1 Render window is a QT openGL Widget Thanks in advance, Mark O _______________________________________________ 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 aashish.chaudhary at kitware.com Mon Jul 2 12:12:44 2018 From: aashish.chaudhary at kitware.com (Aashish Chaudhary) Date: Mon, 2 Jul 2018 12:12:44 -0400 Subject: [vtkusers] 3D volume camera clipping help In-Reply-To: <20180702085116.c7db654a879d86b78cfcacc46040d57b.94cc80fe56.mailapi@email09.godaddy.com> References: <20180628124659.c7db654a879d86b78cfcacc46040d57b.bf74ba9286.mailapi@email09.godaddy.com> <20180702085116.c7db654a879d86b78cfcacc46040d57b.94cc80fe56.mailapi@email09.godaddy.com> Message-ID: This is great news. thanks for the update and I am glad to help. I am not sure about the VTK release. I have cc'd Dave D and Sankhesh who might know more on it. Thanks, On Mon, Jul 2, 2018 at 11:51 AM wrote: > Hello Aashish, > > I ended up getting the new VTK master version working with my code, and > the clipping problem went away! I was wondering if you knew an estimate of > when the next release should be, or if you knew what commit fixed that bug, > so I can apply a patch on our VTK version in house. > Thank you for your help, > Mark O > > > > > --------- Original Message --------- > > Subject: RE: Re: Re: [vtkusers] 3D volume camera clipping help > From: mark.ostroot at lickenbrocktech.com > > Date: 6/28/18 12:46 pm > To: "Aashish Chaudhary" > Cc: vtkusers at vtk.org > > > I'm not quite certain what you mean, but I have cleaned the project I'm > running so there shouldn't be anything old left over. Additionally the > master branch of vtk is installed to a new directory, which is where all of > my code is now linking to. > > > --------- Original Message --------- > Subject: Re: Re: [vtkusers] 3D volume camera clipping help > From: "Aashish Chaudhary" > Date: 6/28/18 11:36 am > To: mark.ostroot at lickenbrocktech.com > Cc: vtkusers at vtk.org > > would it be possible for you to do clear build (remove any other cache) > and get rid of old build files? > > On Thu, Jun 28, 2018 at 2:07 PM wrote: > >> Hello Aashish, >> >> I am getting some unresolved external symbols from the new libraries, >> specifically some issues with vtk volume set property and qvtkopenglwidget. >> I'm fairly certain I'm linking to the new libraries correctly, maybe I'm >> missing something obvious? >> >> Some excerpts from visual studio: >> >> error LNK2019: unresolved external symbol "__declspec(dllimport) public: >> void __cdecl vtkVolume::SetProperty(class vtkVolumeProperty *)" >> (__imp_?SetProperty at vtkVolume@@QEAAXPEAVvtkVolumeProperty@@@Z) >> referenced in function "private: void __cdecl >> QTVTKRender::InitializeRendering(void)" (?InitializeRendering at QTVTKRender >> @@AEAAXXZ) >> >> error LNK2019: unresolved external symbol "__declspec(dllimport) public: >> class vtkVolumeProperty * __cdecl vtkVolume::GetProperty(void)" >> (__imp_?GetProperty at vtkVolume@@QEAAPEAVvtkVolumeProperty@@XZ) referenced >> in function "public: void __cdecl QTVTKRender::updateShading(class QAction >> *)" (?updateShading at QTVTKRender@@QEAAXPEAVQAction@@@Z) >> >> error LNK2001: unresolved external symbol "public: virtual class >> QVTKInteractor * __cdecl QVTKOpenGLWidget::GetInteractor(void)" >> (?GetInteractor at QVTKOpenGLWidget@@UEAAPEAVQVTKInteractor@@XZ) >> error LNK2001: unresolved external symbol "protected: virtual void >> __cdecl QVTKOpenGLWidget::cleanupContext(void)" >> (?cleanupContext at QVTKOpenGLWidget@@MEAAXXZ) >> error LNK2001: unresolved external symbol "protected: virtual void >> __cdecl QVTKOpenGLWidget::initializeGL(void)" >> (?initializeGL at QVTKOpenGLWidget@@MEAAXXZ) >> 2> SelectionTool.cpp >> >> error LNK2001: unresolved external symbol "protected: virtual void >> __cdecl QVTKOpenGLWidget::mouseDoubleClickEvent(class QMouseEvent *)" >> (?mouseDoubleClickEvent at QVTKOpenGLWidget@@MEAAXPEAVQMouseEvent@@@Z) >> >> error LNK2001: unresolved external symbol "protected: virtual void >> __cdecl QVTKOpenGLWidget::mouseMoveEvent(class QMouseEvent *)" >> (?mouseMoveEvent at QVTKOpenGLWidget@@MEAAXPEAVQMouseEvent@@@Z) >> error LNK2001: unresolved external symbol "protected: virtual void >> __cdecl QVTKOpenGLWidget::mousePressEvent(class QMouseEvent *)" >> (?mousePressEvent at QVTKOpenGLWidget@@MEAAXPEAVQMouseEvent@@@Z) >> error LNK2001: unresolved external symbol "protected: virtual void >> __cdecl QVTKOpenGLWidget::mouseReleaseEvent(class QMouseEvent *)" >> (?mouseReleaseEvent at QVTKOpenGLWidget@@MEAAXPEAVQMouseEvent@@@Z) >> error LNK2001: unresolved external symbol "protected: virtual void >> __cdecl QVTKOpenGLWidget::paintGL(void)" (?paintGL at QVTKOpenGLWidget >> @@MEAAXXZ) >> error LNK2001: unresolved external symbol "protected: virtual bool >> __cdecl QVTKOpenGLWidget::renderVTK(void)" (?renderVTK at QVTKOpenGLWidget >> @@MEAA_NXZ) >> error LNK2001: unresolved external symbol "protected: virtual void >> __cdecl QVTKOpenGLWidget::resizeGL(int,int)" (?resizeGL at QVTKOpenGLWidget >> @@MEAAXHH at Z) >> >> Thanks in advance, >> >> Mark O >> >> --------- Original Message --------- >> Subject: RE: Re: [vtkusers] 3D volume camera clipping help >> From: mark.ostroot at lickenbrocktech.com >> Date: 6/27/18 1:39 pm >> To: "Aashish Chaudhary" >> Cc: vtkusers at vtk.org >> >> Dear Aashish, >> I am grabbing the latest from master and compiling from source, I will >> test to see if this fixes my issue and let you know. >> >> -Mark >> >> >> --------- Original Message --------- >> Subject: Re: [vtkusers] 3D volume camera clipping help >> From: "Aashish Chaudhary" >> Date: 6/27/18 12:48 pm >> To: mark.ostroot at lickenbrocktech.com >> Cc: vtkusers at vtk.org >> >> Dear Mark, >> >> We had a bug which could have resulted in what you are observing. Would >> it be possible for you to try current master and see if this goes away? >> >> - Aashish >> >> On Wed, Jun 27, 2018 at 3:39 PM wrote: >> >>> Hello, >>> >>> I have a 3D volume of some CT Data that works fine at the original >>> aspect Ratio. I have some code that adjusts the aspect ratio of the volume >>> by using the VtkReSlicer. Which works well for applying a new aspect ratio. >>> My issue is that whenever my aspect ratio is non-Cubic I get some clipping >>> of my volume at certain angles when it is being rotated around. I have >>> tried using the "ResetCameraClippingRange" function, but this seems to have >>> no effect on my Rendered volume. I know that the clipping range bounds are >>> computed from the actor dimensions and they don't seem to change when I >>> change the aspect ratio. Does anyone have any ideas on what I may be >>> missing? >>> >>> >>> Some noteworthy information: >>> C++ application >>> VTK version 8.1.1 >>> Render window is a QT openGL Widget >>> >>> Thanks in advance, >>> Mark O >>> >>> >>> _______________________________________________ >>> 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 ustungozde at gmail.com Mon Jul 2 16:33:21 2018 From: ustungozde at gmail.com (blue) Date: Mon, 2 Jul 2018 13:33:21 -0700 (MST) Subject: [vtkusers] Png Files to One .Raw Files Message-ID: <1530563601130-0.post@n5.nabble.com> Hello; I have this images: But I want to convert these images to a .raw file How can I do it ? -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From ustungozde at gmail.com Mon Jul 2 16:35:47 2018 From: ustungozde at gmail.com (blue) Date: Mon, 2 Jul 2018 13:35:47 -0700 (MST) Subject: [vtkusers] How to Run Dicom2raw.py Message-ID: <1530563747375-0.post@n5.nabble.com> Hello; I found this code in github : import dicom import os import numpy import sys dicomPath = "./../nn/" lstFilesDCM = [] # create an empty list for dirName, subdirList, fileList in os.walk(dicomPath): # file name should be ordered correctly allInOne = "" for filename in fileList: if "".join(filename).endswith((".dcm", ".DCM")): # check whether the file's DICOM path = dicomPath + "".join(filename) dataset = dicom.read_file(path) for n,val in enumerate(dataset.pixel_array.flat): dataset.pixel_array.flat[n] = val / 60 if val < 0: dataset.pixel_array.flat[n] = 0 dataset.PixelData = numpy.uint8(dataset.pixel_array).tostring() # convert int16 to int8 allInOne += dataset.PixelData print "slice " + "".join(filename) + " done" newFile = open("./all_in_one.raw", "wb") newFile.write(allInOne) newFile.close() print "RAW file generated" But I can not run this code How it is work -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From j.robinson at kepler-systems.com Mon Jul 2 12:35:41 2018 From: j.robinson at kepler-systems.com (James Robinson) Date: Mon, 2 Jul 2018 17:35:41 +0100 Subject: [vtkusers] Contouring streamtracer (lines) Message-ID: <00f301d41222$b8336130$289a2390$@kepler-systems.com> Dear All, I am trying to use VTK in its Activiz format (version 5.8.0) in C#. It is working reasonably well 9very well in places) - but I am trying to do some visualisation of vector data. I have been trying for a week now (or more) doing online searches for sample code etc. to no avail. Ideally what I would like to achieve was described in this article on ParaView: https://blog.kitware.com/paraview-technique-curved-and-nicely-spaced-arrow-g lyphs/ Beautiful work, but the description of how it was achieved is somewhat cryptic when viewed from the perspective of trying to replicate it in Activiz. If I could get one of the following visualisation tools developed it would be fit for my purpose: 1. Ideal - as per the link above. 2. Flow arrow glyphs that are coloured and scaled according to the vector field magnitude. 3. Minimum: Standard streamtracer lines with colour according to vector magnitude. For test purposes I am reading in a set of data points in 3D with pressure values (a history) for each point. I am meshing the points into a linear tet mesh (using VTK class - vtkDelaunay3D) and then extract the resulting mesh as a vtkUnstructuredGrid. Then I am using the pressure field to calculate a pressure gradient at the nodes (points) of the tet mesh. As the pressure data has a set of values for a series of timesteps, the resulting gradient values are also per node per timestep. I associate the pressure data and the resulting gradient data with the vtkUnstructuredGrid (called _vtkUSGrid) as follows: //========================================================================== = //========================================================================== = void AddDataSet(RiverDataSet dataset) { switch (dataset.Type) // POINT or CELL { case "POINT": _vtkUSGrid.GetPointData().AddArray(dataset.Values); break; case "CELL": _vtkUSGrid.GetCellData().AddArray(dataset.Values); break; } _vtkUSGrid.Update(); _vtkUSGrid.Modified(); Where dataset is a class that I have written to manage various data sets. Note all data sets (scalars and vector) are added in this manner. The resulting scalar (e.g. pressure) visualisation works perfectly. In addition, I manage to extract the streamtracers from the data and can see the evolution of that vector field in time. The vtkStreamTracer (which I refer to as streamlines in the code) are created as follows: //========================================================================== = //========================================================================== = private void CreateStreamLine() { StreamTracer = new vtkStreamTracer(); StreamTracer.SetInput(_USGrid); _FlowPlaneSource = new vtkPlaneSource(); StreamTracer.SetSourceConnection(_FlowPlaneSource.GetOutputPort()); double Initial_and_minimum_step = 0.05; // 5% of cell size StreamTracer.SetInitialIntegrationStep(Initial_and_minimum_step); StreamTracer.SetMaximumPropagation(100); StreamTracer.SetIntegrationDirectionToBackward(); StreamTracer.SetIntegratorTypeToRungeKutta45(); StreamTracer.SetComputeVorticity(true); //vtkContourFilter contourFilter = new vtkContourFilter(); //contourFilter.SetInputArrayToProcess(StreamTracer.) //contourFilter.SetInputConnection(StreamTracer.GetOutputPort()); _StreamTube = new vtkTubeFilter(); _StreamTube.SetInput(StreamTracer.GetOutput()); //_StreamTube.SetInput(contourFilter.GetOutput()); _StreamTube.SetNumberOfSides(12); _StreamTube.SetVaryRadiusToVaryRadiusByVector(); vtkPolyDataMapper StreamLineMapper = vtkPolyDataMapper.New(); StreamLineMapper.SetInput(_StreamTube.GetOutput()); StreamLineMapper.ScalarVisibilityOn(); StreamLineMapper.SetScalarModeToUsePointData(); StreamLineMapper.SetLookupTable(_ColourMap_LUT); _StreamlineActor = new vtkActor(); _StreamlineActor.SetMapper(StreamLineMapper); AddActor(_StreamlineActor); _StreamlineActor.VisibilityOff(); CreateStreamlinePointLocator(); } Note that in this code I have made an attempt (but commented it out) to introduce contours on the streamlines as a first step to achieve the ideal objective (as stated above) - but as I can't even get them to come out in colour the attempt at creating definite (line) contours is futile for the moment. Each time I change timestep I set the data upon which the stream lines are to be calculated to the appropriate set of gradients: //========================================================================== = //========================================================================== = private void UpDate_FlowActor(string Type, bool bRender = false) { switch (Type) { case "NONE": // No data set visible _StreamlineActor.VisibilityOff(); break; case "POINT": _USGrid.GetPointData().SetActiveVectors(_DataSet.CurrentVectorDataSet.Name); _StreamlineActor.GetMapper().SelectColorArray(_DataSet.CurrentVectorDataSet. Name); _StreamlineActor.GetMapper().GetInput().GetPointData().SetActiveVectors(_Dat aSet.CurrentVectorDataSet.Name); // _StreamlineActor.GetMapper().ColorByArrayComponent(_DataSet.CurrentVectorDat aSet.Name, 0); _StreamlineActor.GetMapper().SetColorModeToMapScalars(); break; case "CELL": _USGrid.GetCellData().SetActiveVectors(_DataSet.CurrentVectorDataSet.Name); _StreamlineActor.GetMapper().SelectColorArray(_DataSet.CurrentVectorDataSet. Name); _StreamlineActor.GetMapper().GetInput().GetCellData().SetActiveVectors(_Data Set.CurrentVectorDataSet.Name); // _StreamlineActor.GetMapper().ColorByArrayComponent(_DataSet.CurrentVectorDat aSet.Name, 0); _StreamlineActor.GetMapper().SetColorModeToMapScalars(); break; default: _StreamlineActor.VisibilityOff(); break; } _StreamlineActor.Modified(); if (bRender) { ReRender(); } } Any advice would be most welcomed. (And I can supply any additional code - but the overall project is too large to share). Many thanks in advance, Kind regards, Jim Robinson PhD -------------- next part -------------- An HTML attachment was scrubbed... URL: From scofieldzhu.zcg at gmail.com Mon Jul 2 22:25:01 2018 From: scofieldzhu.zcg at gmail.com (scofield zhu) Date: Tue, 3 Jul 2018 10:25:01 +0800 Subject: [vtkusers] Fwd: vtkAlgorithm::PRESERVES_RANGES/PRESERVES_BOUNDS is missed when migrating from vtk5.6 to vtk7.1 In-Reply-To: References: Message-ID: ---------- Forwarded message --------- From: scofield zhu Date: Mon, Jul 2, 2018 at 1:41 PM Subject: vtkAlgorithm::PRESERVES_RANGES/PRESERVES_BOUNDS is missed when migrating from vtk5.6 to vtk7.1 To: hi all: I find vtkAlgorithm::PRESERVES_RANGES/PRESERVES_BOUNDS missed when i migrated my project from vtk5.6 to vtk7.1. how I handle this situation? what's their replacement in vtk7.1? please help! -------------- next part -------------- An HTML attachment was scrubbed... URL: From rccm.kyoshimi at gmail.com Tue Jul 3 04:43:01 2018 From: rccm.kyoshimi at gmail.com (kenichiro yoshimi) Date: Tue, 3 Jul 2018 17:43:01 +0900 Subject: [vtkusers] Fwd: vtkAlgorithm::PRESERVES_RANGES/PRESERVES_BOUNDS is missed when migrating from vtk5.6 to vtk7.1 In-Reply-To: References: Message-ID: Hi, I find the same problem has been posted here: https://www.vtk.org/pipermail/vtkusers/2015-December/093244.html Thanks 2018?7?3?(?) 11:25 scofield zhu : > > > > ---------- Forwarded message --------- > From: scofield zhu > Date: Mon, Jul 2, 2018 at 1:41 PM > Subject: vtkAlgorithm::PRESERVES_RANGES/PRESERVES_BOUNDS is missed when migrating from vtk5.6 to vtk7.1 > To: > > > hi all: > I find vtkAlgorithm::PRESERVES_RANGES/PRESERVES_BOUNDS missed when i migrated my project from vtk5.6 to vtk7.1. how I handle this situation? what's their replacement in vtk7.1? please help! > > _______________________________________________ > 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 kor1581 at gmail.com Tue Jul 3 04:44:06 2018 From: kor1581 at gmail.com (ran) Date: Tue, 3 Jul 2018 01:44:06 -0700 (MST) Subject: [vtkusers] How to a customise vtkWidgetEvent? Message-ID: <1530607446898-0.post@n5.nabble.com> Hi all, I'm using vtkLineWidget2 for drawing lines over an image in vtkResliceImageViewer2. Current behavior of vtkLineWidget2 on LeftMouseButtonPress + Mousemove is transulation but i need I need to customize the behavior on event over the line. I tried to set lineWidget2->GetEventTranslator()->SetTranslation, but it only accept vtkWidgetEvent which already defined. I also tried to lineWidget2->GetEventTranslator()->RemoveTranslation, and to customize in my observer call back method, but then the event is not recognized by the callback and is transferring parent render window(which is vtkResliceImageViewer2) interactor style. In this case, I can't find whether the event is happening in vtkLineWidget2. Can I add a custom vtkWidgetEvent in to customize the behavior vtkLineWidget2? or can disable the action of an event(for eg translation action on LeftMouseButtonPress + Mousemove) with retaining observer event? -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From joshipranav333 at gmail.com Tue Jul 3 06:25:52 2018 From: joshipranav333 at gmail.com (Praz3) Date: Tue, 3 Jul 2018 03:25:52 -0700 (MST) Subject: [vtkusers] Oblique slice of 3D image data In-Reply-To: References: <1317242766682-4850672.post@n5.nabble.com> Message-ID: <1530613552819-0.post@n5.nabble.com> Hi, I am having the same need ,i.e, I want to extract a 2D slice out of a 3D vtkImageData and I am using the vtkPlaneWidget for getting the plane (vtkPlane) and I want to display this extracted plane. But the same problem that the colors shown are not accurate. As mentioned in this answer that, have found an approach and gave a link of the post, but unfortunately that url is no more in existence. Will you please help me to find a solution on this. If possible I want to have the same color map on the 2D slice that I have applied to the 3D volume.. Tijmen Klein wrote > Hello Rafay, > > I ended up with a different approach, not using the vtkImageReslice, since > I > wanted to use a vtkPlane as the cutting source. For the solution that I've > used, see this post on the mailinglist: > http://www.vtk.org/pipermail/vtkusers/2011-September/119089.html > > If you want to go the vtkImageReslice -> vtkImagemapToColors way, have a > look at the example posted by Jothy ( > http://vtk.org/gitweb?p=VTK.git;a=blob;f=Examples/ImageProcessing/Cxx/ImageSlicing.cxx > ) > > Cheers, > Tijmen > > On Wed, Sep 28, 2011 at 10:46 PM, Rafay < > rafayk_@ > > wrote: > >> Hi Tijmen, >> >> I am looking to do the exact same thing. I have 3d data set from a CT and >> I >> want to extract a 2D plane passing through the origin with any direction >> cosines I choose and I want to extract the data along this plane. I am >> using >> ImageReslice I was wondering if u could post your code for this part as I >> dont understand how you did this >> >> vtkImageReslice -> vtkImagemapToColors >> >> Also do you know how I can incorporate the interpolator into this? >> >> Thanks >> >> -- >> View this message in context: >> http://vtk.1045678.n5.nabble.com/Oblique-slice-of-3D-image-data-tp4822198p4850672.html >> Sent from the VTK - Users mailing list archive at Nabble.com. >> _______________________________________________ >> 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 >> >> Follow this link to subscribe/unsubscribe: >> http://www.vtk.org/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 > > Follow this link to subscribe/unsubscribe: > http://www.vtk.org/mailman/listinfo/vtkusers -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From f_u_7 at yahoo.com Tue Jul 3 06:57:53 2018 From: f_u_7 at yahoo.com (lucky) Date: Tue, 3 Jul 2018 03:57:53 -0700 (MST) Subject: [vtkusers] Deprecated isosurface extraction in VTK 8 with OpenGL2 support Message-ID: <1530615473352-0.post@n5.nabble.com> I can perform ray cast isosurface extraction using the following method in VTK <= 8.0.1 with Legacy OpenGL support. I can visualize the extracted surface without any issue, everything works perfect. Now I want to port the same code with VTK 8.1.1 OpenGL2 (3.2) support. In this version both vtkVolumeRayCastIsosurfaceFunction and vtkVolumeRayCastMapper classes are deprecated. I have tried vtkContourFilter instead of using these classes but never worked. How can I achieve the same output using the new GPU mapper vtkOpenGLGPUVolumeRayCastMapper or vtkFixedPointVolumeRayCastMapper? void IsoExtraction::create(double _iso, vtkImageData* _data) { p_iso_surf_func = vtkVolumeRayCastIsosurfaceFunction::New(); p_iso_surf_func->SetIsoValue(_iso); p_mapper = vtkVolumeRayCastMapper::New(); p_mapper->SetVolumeRayCastFunction(p_iso_surf_func); // Set volume ray cast function p_mapper->SetInputData(_data); // ? addToLOD (p_mapper) // ? } void IsoExtraction::setIsoValue(double _iso) { p_iso_surf_func->SetIsoValue(_iso); } -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From emonclus at cs.upc.edu Tue Jul 3 07:04:01 2018 From: emonclus at cs.upc.edu (=?UTF-8?Q?Eva_Moncl=c3=bas?=) Date: Tue, 3 Jul 2018 13:04:01 +0200 Subject: [vtkusers] Visualize a volume slice on a 3D plane (the acquisition plane of the images) In-Reply-To: References: <48c0dc5e-53e5-52f2-fc1c-b331f20bbbd2@cs.upc.edu> <33c99946-855c-775f-e72a-5258c8d98a15@cs.upc.edu> Message-ID: <7e3810cd-e177-f2a3-9230-5c52c0734792@cs.upc.edu> On 28/06/2018 16:18, Shashwath T.R. wrote: > For this, you should probably use something to slice the 3D volume to > get a 2D slice. You can use vtkExtractVOI with the correct extents to > pull out the slice and use that as your input. Probably a pipeline > like this: > > Input -> vtkExtractVOI -> vtkImageMapToColors -> vtkTexture. > Your solution works fine. Thank you very much for your support. The problem with the other suggested solutions was that the output of the (vtkImageMapToColors or ctkImageActor) was an opengl? 3D texture, which was not supported by the renderer of vtkTexture. But, I got the solution using your pipeline proposal: Input -> vtkExtractVOI -> vtkImageMapToColors -> vtkTexture. Thanks so much for your help! Best regards, ??? Eva From dave.demarle at kitware.com Tue Jul 3 12:28:56 2018 From: dave.demarle at kitware.com (David E DeMarle) Date: Tue, 3 Jul 2018 12:28:56 -0400 Subject: [vtkusers] How to build VTK 8.1.1 with vtkGUISupportMFC? In-Reply-To: <1530231317519-0.post@n5.nabble.com> References: <1530231317519-0.post@n5.nabble.com> Message-ID: We haven't actively maintained the MFC support for a while (6.0 as I recall). As a result the MFC interface never got updates for OpenGL2. The specific compilation failure you are seeing is because we added a left eye/right eye argument along the way and the old MFC interface code knows nothing about it. David E DeMarle Kitware, Inc. Principal Engineer 21 Corporate Drive Clifton Park, NY 12065-8662 Phone: 518-881-4909 On Thu, Jun 28, 2018 at 8:15 PM pnt1614 wrote: > I am trying to build VTK 8.1.1 with vtkGUISupportMFC option on Windows 10 > 64bit using CMake 3.11.4 and visual studio 2015 (64 bit). Everything is > okay > in CMake, but in the visual studio 2015 I cannot build "ALL_BUILD" project > because of two following messsages: > > 1. "no instance of overloaded function > "vtkWin32OpenGLRenderWindow::GetPixelData" matches the argument list" > 2. "vtkWin32OpenGLRenderWindow::GetPixelData": no overloaded function takes > 5 arguments. > > Is there anyone experienced this problem? Please, help me. > > > > -- > 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 cory.quammen at kitware.com Tue Jul 3 13:34:16 2018 From: cory.quammen at kitware.com (Cory Quammen) Date: Tue, 3 Jul 2018 13:34:16 -0400 Subject: [vtkusers] Contouring streamtracer (lines) In-Reply-To: <00f301d41222$b8336130$289a2390$@kepler-systems.com> References: <00f301d41222$b8336130$289a2390$@kepler-systems.com> Message-ID: Hi James, Please see my responses inlined below. On Mon, Jul 2, 2018 at 5:21 PM James Robinson wrote: > > > Dear All, > > > > I am trying to use VTK in its Activiz format (version 5.8.0) in C#. It is > working reasonably well 9very well in places) ? but I am trying to do some > visualisation of vector data. I have been trying for a week now (or more) > doing online searches for sample code etc. to no avail. > Have you searched through the VTK wiki? https://lorensen.github.io/VTKExamples/site/Cxx/ Some of the best examples for learning VTK are there. You may have to translate from C++ or Python to C#, but that shouldn't be too bad. > Ideally what I would like to achieve was described in this article on > ParaView: > https://blog.kitware.com/paraview-technique-curved-and-nicely-spaced-arrow-glyphs/ > Beautiful work, but the description of how it was achieved is somewhat > cryptic when viewed from the perspective of trying to replicate it in > Activiz. > That visualization is indeed possible with VTK - that is what ParaView is using to generate it. While you can easily generate Python code that uses the ParaView Python API to reproduce the technique, there is nothing that generates plain VTK code to reproduce it, I'm afraid. > If I could get one of the following visualisation tools developed it would > be fit for my purpose: > > 1. Ideal ? as per the link above. > > 2. Flow arrow glyphs that are coloured and scaled according to the vector > field magnitude. > Examples (searched for vtkGlyph3D on the wiki examples page) * https://lorensen.github.io/VTKExamples/site/Cxx/Visualization/OrientedGlyphs/ * https://lorensen.github.io/VTKExamples/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs/ * https://raw.githubusercontent.com/lorensen/VTKExamples/master/src/Testing/Baseline/Cxx/Visualization/TestCurvatureBandsWithGlyphs.png > 3. Minimum: Standard streamtracer lines with colour according to vector > magnitude. > Examples (searched for vtkStreamTracer on the wiki page): * https://lorensen.github.io/VTKExamples/site/Cxx/VisualizationAlgorithms/BluntStreamlines/ * https://lorensen.github.io/VTKExamples/site/Cxx/VisualizationAlgorithms/CarotidFlow/ * https://lorensen.github.io/VTKExamples/site/Cxx/Visualization/Kitchen/ > For test purposes I am reading in a set of data points in 3D with pressure > values (a history) for each point. I am meshing the points into a linear > tet mesh (using VTK class - vtkDelaunay3D) and then extract the resulting > mesh as a vtkUnstructuredGrid. Then I am using the pressure field to > calculate a pressure gradient at the nodes (points) of the tet mesh. As the > pressure data has a set of values for a series of timesteps, the resulting > gradient values are also per node per timestep. > > > > I associate the pressure data and the resulting gradient data with the > vtkUnstructuredGrid (called _vtkUSGrid) as follows: > > > > > //=========================================================================== > > > //=========================================================================== > > void AddDataSet(RiverDataSet dataset) > > { > > switch (dataset.Type) // POINT or CELL > > { > > case "POINT": > > _vtkUSGrid.GetPointData().AddArray(dataset.Values); > > break; > > case "CELL": > > _vtkUSGrid.GetCellData().AddArray(dataset.Values); > > break; > > } > > _vtkUSGrid.Update(); > > _vtkUSGrid.Modified(); > > > > Where dataset is a class that I have written to manage various data sets. > Note all data sets (scalars and vector) are added in this manner. The > resulting scalar (e.g. pressure) visualisation works perfectly. In > addition, I manage to extract the streamtracers from the data and can see > the evolution of that vector field in time. The vtkStreamTracer (which I > refer to as streamlines in the code) are created as follows: > > > > > //=========================================================================== > > > //=========================================================================== > > private void CreateStreamLine() > > { > > StreamTracer = new vtkStreamTracer(); > > StreamTracer.SetInput(_USGrid); > > _FlowPlaneSource = new vtkPlaneSource(); > > > StreamTracer.SetSourceConnection(_FlowPlaneSource.GetOutputPort()); > > > > double Initial_and_minimum_step = 0.05; // 5% of cell size > > > StreamTracer.SetInitialIntegrationStep(Initial_and_minimum_step); > > StreamTracer.SetMaximumPropagation(100); > > StreamTracer.SetIntegrationDirectionToBackward(); > > StreamTracer.SetIntegratorTypeToRungeKutta45(); > > StreamTracer.SetComputeVorticity(true); > > > > //vtkContourFilter contourFilter = new vtkContourFilter(); > > //contourFilter.SetInputArrayToProcess(StreamTracer.) > > > //contourFilter.SetInputConnection(StreamTracer.GetOutputPort()); > > > > _StreamTube = new vtkTubeFilter(); > > _StreamTube.SetInput(StreamTracer.GetOutput()); > > //_StreamTube.SetInput(contourFilter.GetOutput()); > > _StreamTube.SetNumberOfSides(12); > > _StreamTube.SetVaryRadiusToVaryRadiusByVector(); > > > > vtkPolyDataMapper StreamLineMapper = vtkPolyDataMapper.New(); > > StreamLineMapper.SetInput(_StreamTube.GetOutput()); > > StreamLineMapper.ScalarVisibilityOn(); > > StreamLineMapper.SetScalarModeToUsePointData(); > > StreamLineMapper.SetLookupTable(_ColourMap_LUT); > > > > _StreamlineActor = new vtkActor(); > > _StreamlineActor.SetMapper(StreamLineMapper); > > > > AddActor(_StreamlineActor); > > _StreamlineActor.VisibilityOff(); > > > > CreateStreamlinePointLocator(); > > } > > > > Note that in this code I have made an attempt (but commented it out) to > introduce contours on the streamlines as a first step to achieve the ideal > objective (as stated above) ? but as I can?t even get them to come out in > colour the attempt at creating definite (line) contours is futile for the > moment. > contourFilter.SetInputArrayToProcess() takes some port and connection information along with a field type (point or cell) and a character string containing the name of the array on which you want the filter to operate. See https://www.vtk.org/doc/nightly/html/classvtkAlgorithm.html#a42a55ca2c277aecc909ad592d12978aa for details. I believe you want the point array named "IntegrationTime" produced by the vtkStreamTracer. I hope that is helpful. Cheers, Cory > > > Each time I change timestep I set the data upon which the stream lines are > to be calculated to the appropriate set of gradients: > > > //=========================================================================== > > > //=========================================================================== > > private void UpDate_FlowActor(string Type, bool bRender = false) > > { > > switch (Type) > > { > > case "NONE": // No data set visible > > _StreamlineActor.VisibilityOff(); > > break; > > case "POINT": > > _USGrid.GetPointData().SetActiveVectors(_ > DataSet.CurrentVectorDataSet.Name); > > _StreamlineActor.GetMapper().SelectColorArray(_ > DataSet.CurrentVectorDataSet.Name); > > > _StreamlineActor.GetMapper().GetInput().GetPointData().SetActiveVectors(_ > DataSet.CurrentVectorDataSet.Name); > > // _StreamlineActor.GetMapper().ColorByArrayComponent(_ > DataSet.CurrentVectorDataSet.Name, 0); > > > _StreamlineActor.GetMapper().SetColorModeToMapScalars(); > > break; > > case "CELL": > > _USGrid.GetCellData().SetActiveVectors(_ > DataSet.CurrentVectorDataSet.Name); > > _StreamlineActor.GetMapper().SelectColorArray(_ > DataSet.CurrentVectorDataSet.Name); > > > _StreamlineActor.GetMapper().GetInput().GetCellData().SetActiveVectors(_ > DataSet.CurrentVectorDataSet.Name); > > // _StreamlineActor.GetMapper().ColorByArrayComponent(_ > DataSet.CurrentVectorDataSet.Name, 0); > > > _StreamlineActor.GetMapper().SetColorModeToMapScalars(); > > break; > > default: > > _StreamlineActor.VisibilityOff(); > > break; > > } > > _StreamlineActor.Modified(); > > > > if (bRender) > > { > > ReRender(); > > } > > } > > > > Any advice would be most welcomed. (And I can supply any additional code ? > but the overall project is too large to share). > > > > Many thanks in advance, > > > > Kind regards, > > > > Jim Robinson PhD > > > > > > > > > _______________________________________________ > 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. -------------- next part -------------- An HTML attachment was scrubbed... URL: From chris.marsh at usask.ca Tue Jul 3 13:57:38 2018 From: chris.marsh at usask.ca (Chris Marsh) Date: Tue, 3 Jul 2018 11:57:38 -0600 Subject: [vtkusers] Don't build vtkproj4? In-Reply-To: References: <20180110125844.GA1305@megas.kitware.com> <20180110153601.GA21857@megas.kitware.com> <20180111192937.GA11091@megas.kitware.com> Message-ID: Hi all, Just a note this appears to have been fixed as of (at least) 8.1.1 and I'm no longer encountering this issues. Thanks very much for resolving this. Cheers Chris On 30 January 2018 at 16:59, Chris Marsh wrote: > Hi, > That is great to hear! > Cheers > Chris > > > On 30 January 2018 at 16:35, Dan Lipsa wrote: > >> Hi Chris, >> Thanks for investigating this. >> Indeed, looking the the so file, there are some symbols that we are not >> mangling, which cause the problems you've seen. >> I believe this was caused by updating of the version of the library we >> are including without updating the list of symbols we are mangling. >> We'll fix this shortly, >> >> Dan >> >> >> On Tue, Jan 30, 2018 at 4:26 PM, Chris Marsh >> wrote: >> >>> Hi all, >>> >>> I have some updates on this. I recently discovered the >>> LD_DEBUG=bindings linker tool, so I can see what is happening. >>> >>> There appear to be many cases where either the proj4 library I built or >>> my executable bind to symbols in libvtkproj. >>> >>> A few examples shown here. 'After patch elf' is when I use patchelf with >>> --replace-needed to remove libvtkproj.so >>> >>> As built >>> 21340: binding file /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `pj_prime_meridians' >>> 21340: binding file /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `pj_list' >>> 21340: binding file /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 >>> [0] to /home/cbm038/build-release/bin/Release/CHM [0]: normal symbol >>> `stdout' [GLIBC_2.2.5] >>> 21340: binding file /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `pj_ellps' >>> 21340: binding file /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `pj_datums' >>> >>> After patch elf >>> >>> 21259: binding file /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 >>> [0] to /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0]: >>> normal symbol `pj_prime_meridians' >>> 21259: binding file /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 >>> [0] to /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0]: >>> normal symbol `pj_list' >>> 21259: binding file /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 >>> [0] to /home/cbm038/build-release/bin/Release/CHM [0]: normal symbol >>> `stdout' [GLIBC_2.2.5] >>> 21259: binding file /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 >>> [0] to /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0]: >>> normal symbol `pj_ellps' >>> 21259: binding file /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 >>> [0] to /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0]: >>> normal symbol `pj_datums' >>> >>> >>> Another example: >>> >>> As built >>> 21340: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/bin/Release/CHM [0]: normal symbol >>> `stderr' [GLIBC_2.2.5] >>> 21340: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `pj_units' >>> 21340: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `vtk_pj_aea' >>> 21340: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `pj_s_aea' >>> 21340: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `vtk_pj_aeqd' >>> 21340: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `pj_s_aeqd' >>> 21340: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `vtk_pj_airy' >>> 21340: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `pj_s_airy' >>> 21340: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `vtk_pj_aitoff' >>> 21340: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `pj_s_aitoff' >>> 21340: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `vtk_pj_alsk' >>> 21340: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `pj_s_alsk' >>> 21340: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `vtk_pj_apian' >>> 21340: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `pj_s_apian' >>> 21340: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `vtk_pj_august' >>> >>> >>> after patchelf >>> >>> 21259: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0]: >>> normal symbol `pj_units' >>> 21259: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `vtk_pj_aea' >>> 21259: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0]: >>> normal symbol `pj_s_aea' >>> 21259: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `vtk_pj_aeqd' >>> 21259: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0]: >>> normal symbol `pj_s_aeqd' >>> 21259: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `vtk_pj_airy' >>> 21259: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0]: >>> normal symbol `pj_s_airy' >>> 21259: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `vtk_pj_aitoff' >>> 21259: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0]: >>> normal symbol `pj_s_aitoff' >>> 21259: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `vtk_pj_alsk' >>> 21259: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0]: >>> normal symbol `pj_s_alsk' >>> 21259: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `vtk_pj_apian' >>> 21259: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0]: >>> normal symbol `pj_s_apian' >>> 21259: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: >>> normal symbol `vtk_pj_august' >>> 21259: binding file /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>> [0] to /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0]: >>> normal symbol `pj_s_august' >>> >>> >>> Building VTK with system proj4 does correctly 'solve' the problem. >>> >>> Can provide more details if required. >>> >>> Cheers >>> Chris >>> >>> On 16 January 2018 at 13:17, Chris Marsh wrote: >>> >>>> Hi all, >>>> >>>> Thanks for the detailed thoughts. >>>> >>>> Is the message you are getting from proj saying that the string you >>>>> pass is not valid? >>>>> >>>> Correct. However, I've verified with both the GDAL and proj4 mailing >>>> lists that the string is correct. The string is actually output from proj4 >>>> itself, so I have substantial confidence in it. >>>> >>>> >>>>> Maybe somebody overrides that memory? >>>>> Try run your program though valgrind and/or comment out chunks of code >>>>> trying to see who causes your error. >>>>> >>>> Valgrind and the Intel memory tools show no memory corruption. >>>> >>>> Is VTK in the call stack for the errors you described? If not, I think >>>>> it is not involved in the errors. >>>> >>>> GDAL, as I understand, dynamically opens the .so at runtime, so it's >>>> tough to figure out exactly what it is doing. Looking at the backtrace in >>>> gdb shows that it appears to be calling into the system proj4 before it >>>> segfaults. >>>> >>>> If I use patchelf to strip the vtkproj4 reference, it is then fine. If >>>> use patchelf to strip the system proj4 leaving the vtkproj4, I get the same >>>> error and segfault. >>>> >>>> I *suspect* GDAL is doing the wrong thing here and loading the wrong >>>> library for some calls. This is all to say, I don't think it's a VTK >>>> problem per se, but is for whatever reason, conflicting on this system. >>>> >>>> Further weirdness is that on the machines this works 100%, I don't see >>>> any reference to libvtkproj4. >>>> >>>> I'll follow up after I rebuild everything again with the VTK system >>>> proj4. >>>> >>>> Thanks very much, >>>> >>>> Cheers >>>> Chris >>>> >>>> >>>> University of Saskatchewan >>>> >>>> On 15 January 2018 at 10:03, Dan Lipsa wrote: >>>> >>>>> Hi Chris, >>>>> Is VTK in the call stack for the errors you described? If not, I think >>>>> it is not involved in the errors. >>>>> >>>>> vtkproj should not interfere with proj, but you can make VTK use the >>>>> system proj with the method described earlier. >>>>> >>>>> Is the message you are getting from proj saying that the string you >>>>> pass is not valid? Maybe somebody overrides that memory? >>>>> Try run your program though valgrind and/or comment out chunks of code >>>>> trying to see who causes your error. >>>>> Hope this helps, >>>>> Dan >>>>> >>>>> >>>>> >>>>> On Fri, Jan 12, 2018 at 3:32 PM, Chris Marsh >>>>> wrote: >>>>> >>>>>> Hi Dan, >>>>>> >>>>>> I'm trying to figure out the issue I detail here: >>>>>> http://osgeo-org.1560.x6.nabble.com/Failed-to-initialize-PRO >>>>>> J-4-with-quot-quot-td5338323.html >>>>>> http://osgeo-org.1560.x6.nabble.com/gdal-dev-ERROR-6-Failed- >>>>>> to-initialize-PROJ-4-with-quot-quot-td5338107.html >>>>>> >>>>>> Effectively the error is that GDAL seems to call the incorrect >>>>>> library/something happens, and the projection fails. >>>>>> >>>>>> In an effort to resolve this I was looking at my binary via LDD and >>>>>> found >>>>>> $ ldd ~/build-release/bin/Release/CHM | grep proj4 >>>>>> libvtkproj4-8.0.so.1 => /home/cmarsh/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>>>>> (0x00002b517aa36000) >>>>>> libproj.so.0 => /home/cmarsh/build-release/lib/proj4/lib/libproj.so.0 >>>>>> (0x00002b51944d2000) >>>>>> >>>>>> If I use patchelf (https://github.com/NixOS/patchelf) to strip >>>>>> libvtkproj4-8.0.so.1 from my binary, my code runs without the error. >>>>>> >>>>>> I don't quite understand why I don't have this problem on other >>>>>> machines though. Looking at other machines I compile on (using a custom VTK >>>>>> build) I don't see any reference to the VTK libproj4 via ldd. >>>>>> >>>>>> Thus I attributed the error to vtkproj4 inclusion. However if you >>>>>> mangle names, then I agree I don't understand why this is happening. >>>>>> >>>>>> Cheers >>>>>> Chris >>>>>> >>>>>> >>>>>> On 12 January 2018 at 09:35, Dan Lipsa wrote: >>>>>> >>>>>>> Chris, >>>>>>> >>>>>>> 1. Going back to the beginning of the thread, I don't understand why >>>>>>> vtklibproj conflicts with another proj, given that we mangle all names. Can >>>>>>> you send us the errors. >>>>>>> >>>>>>> 2. If you do want to build with the system proj4 >>>>>>> >>>>>>> Can you send up the output of: >>>>>>> cat CMakeCache.txt | grep LIBPROJ >>>>>>> >>>>>>> This is what I have: >>>>>>> LIBPROJ4_INCLUDE_DIR:PATH=/usr/include >>>>>>> LIBPROJ4_LIBRARIES:FILEPATH=/usr/lib/x86_64-linux-gnu/libproj.so.12 >>>>>>> LIBPROJ_BINDIR:PATH=bin >>>>>>> LIBPROJ_DATADIR:PATH=share/proj >>>>>>> LIBPROJ_DOCDIR:PATH=doc/proj >>>>>>> LIBPROJ_INCLUDEDIR:PATH=include >>>>>>> LIBPROJ_LIBDIR:PATH=lib >>>>>>> LIBPROJ_M_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libm.so >>>>>>> LIBPROJ_USE_THREAD:BOOL=ON >>>>>>> //Use system-installed LIBPROJ4 >>>>>>> VTK_USE_SYSTEM_LIBPROJ4:BOOL=ON >>>>>>> //ADVANCED property for variable: LIBPROJ4_INCLUDE_DIR >>>>>>> LIBPROJ4_INCLUDE_DIR-ADVANCED:INTERNAL=1 >>>>>>> //ADVANCED property for variable: LIBPROJ4_LIBRARIES >>>>>>> LIBPROJ4_LIBRARIES-ADVANCED:INTERNAL=1 >>>>>>> //MODIFIED property for variable: LIBPROJ4_LIBRARIES >>>>>>> LIBPROJ4_LIBRARIES-MODIFIED:INTERNAL=ON >>>>>>> //ADVANCED property for variable: LIBPROJ_BINDIR >>>>>>> LIBPROJ_BINDIR-ADVANCED:INTERNAL=1 >>>>>>> //ADVANCED property for variable: LIBPROJ_DATADIR >>>>>>> LIBPROJ_DATADIR-ADVANCED:INTERNAL=1 >>>>>>> //ADVANCED property for variable: LIBPROJ_DOCDIR >>>>>>> LIBPROJ_DOCDIR-ADVANCED:INTERNAL=1 >>>>>>> //ADVANCED property for variable: LIBPROJ_INCLUDEDIR >>>>>>> LIBPROJ_INCLUDEDIR-ADVANCED:INTERNAL=1 >>>>>>> //ADVANCED property for variable: LIBPROJ_LIBDIR >>>>>>> LIBPROJ_LIBDIR-ADVANCED:INTERNAL=1 >>>>>>> //ADVANCED property for variable: LIBPROJ_M_LIB >>>>>>> LIBPROJ_M_LIB-ADVANCED:INTERNAL=1 >>>>>>> //ADVANCED property for variable: LIBPROJ_USE_THREAD >>>>>>> LIBPROJ_USE_THREAD-ADVANCED:INTERNAL=1 >>>>>>> //ADVANCED property for variable: VTK_USE_SYSTEM_LIBPROJ4 >>>>>>> VTK_USE_SYSTEM_LIBPROJ4-ADVANCED:INTERNAL=1 >>>>>>> //MODIFIED property for variable: VTK_USE_SYSTEM_LIBPROJ4 >>>>>>> VTK_USE_SYSTEM_LIBPROJ4-MODIFIED:INTERNAL=ON >>>>>>> >>>>>>> >>>>>>> Make sure >>>>>>> LIBPROJ4_INCLUDE_DIR >>>>>>> LIBPROJ4_LIBRARIES >>>>>>> VTK_USE_SYSTEM_LIBPROJ4 >>>>>>> have the correct values. >>>>>>> >>>>>>> All those are cmake variables, you change them using ccmake or >>>>>>> cmake-gui. >>>>>>> After that you call: >>>>>>> >>>>>>> cmake . >>>>>>> make >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Fri, Jan 12, 2018 at 9:15 AM, Aashish Chaudhary < >>>>>>> aashish.chaudhary at kitware.com> wrote: >>>>>>> >>>>>>>> Dan Lipsa made last changes perhaps he may have some suggestions. >>>>>>>> >>>>>>>> - aashish >>>>>>>> >>>>>>>> On Thu, Jan 11, 2018 at 7:41 PM Chris Marsh >>>>>>>> wrote: >>>>>>>> >>>>>>>>> Looks like something is setting >>>>>>>>> PROJ4_INCLUDE_DIR >>>>>>>>> PROJ4_LIBRARY >>>>>>>>> to the system's proj4. I use a custom findproj4 that only looks >>>>>>>>> where I tell it. >>>>>>>>> >>>>>>>>> then I see that >>>>>>>>> LIB_FILES:INTERNAL >>>>>>>>> contains vtkproj4 >>>>>>>>> LIB_FILES just holds all my 3rd party libraries I need to link >>>>>>>>> against. >>>>>>>>> >>>>>>>>> Chris Marsh >>>>>>>>> PhD Candidate >>>>>>>>> chrismarsh.ca >>>>>>>>> >>>>>>>>> 121 Research Drive >>>>>>>>> >>>>>>>>> University of Saskatchewan >>>>>>>>> >>>>>>>>> >>>>>>>>> On 11 January 2018 at 13:29, Ben Boeckel >>>>>>>>> wrote: >>>>>>>>> >>>>>>>>>> On Thu, Jan 11, 2018 at 11:41:40 -0600, Chris Marsh wrote: >>>>>>>>>> > Thanks for the details. This doesn't seem to be working for me >>>>>>>>>> though. I've >>>>>>>>>> > tried passing VTK_USE_SYSTEM_libproj4 to cmake on the command >>>>>>>>>> line as well >>>>>>>>>> > as defining it as a CXXFLAG='-D VTK_USE_SYSTEM_libproj4", >>>>>>>>>> however neither >>>>>>>>>> > works. I still see the vtklibproj4 in the output of ldd. >>>>>>>>>> >>>>>>>>>> CMake should be getting the flag. If you do: >>>>>>>>>> >>>>>>>>>> grep -i proj4 CMakeCache.txt >>>>>>>>>> >>>>>>>>>> do any variables stand out as potentially being set to use the >>>>>>>>>> internal >>>>>>>>>> one? >>>>>>>>>> >>>>>>>>>> --Ben >>>>>>>>>> >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> 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 rubendibattista at gmail.com Wed Jul 4 00:03:49 2018 From: rubendibattista at gmail.com (Ruben Di Battista) Date: Tue, 3 Jul 2018 21:03:49 -0700 Subject: [vtkusers] vtkXDMF3Reader Illegal Hardware Instruction crash on OSX w/ AppleCLang Message-ID: Hello, I?m experiencing a crash of the vtkXDMF3Reader on OSX 10.13.5 compiled with the shipped Apple?s clang compiler. System Information: OSX 10.13.5 Apple LLVM version 9.1.0 (clang-902.0.39.2) Target: x86_64-apple-darwin17.6.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin Boost: 1.66.0 HDF5: 1.10.2 Stuff installed with Macports Basically when I read a xdmf that stores actual data in HDF5, the program crashes. Here?s a MWE: ``` #include "vtkNew.h" #include "vtkXdmf3Reader.h" int main(int argc, char** argv) { vtkNew reader; reader->SetFileName("scalar-data/scalar.xmf"); reader->DebugOn(); reader->Update(); } ``` here?s the sample data file that you can use with it to test. I tried to use the debugger, (below the output), It looks like a problem with the Xdmf3Reader destructor. I?m not able to understand if it?s because of Boost or a VTK?s bug with Apple Clang. Can you please give me help? *NB: *For further details see this PR on macports issue tracker. Thanks in advance, ``` (lldb) run Process 10472 launched: *** (x86_64) Debug: In /opt/local/var/macports/build/_Users_***_git_macports-ports_graphics_vtk/vtk/work/VTK-7.1.1/Common/Core/vtkObject.cxx, line 861 vtkXdmf3Reader (0x109218d80): Registered by vtkCompositeDataPipeline (0x109219ff0), ReferenceCount = 2 Process 10472 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) frame #0: 0x00000001044f383b libvtkxdmf3.dylib`XdmfRectilinearGrid::~XdmfRectilinearGrid() + 47 libvtkxdmf3.dylib`XdmfRectilinearGrid::~XdmfRectilinearGrid: -> 0x1044f383b <+47>: ud2 0x1044f383d <+49>: nop 0x1044f383e <+0>: pushq %rbp 0x1044f383f <+1>: movq %rsp, %rbp Target 0: (rayleigh) stopped. (lldb) bt * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) * frame #0: 0x00000001044f383b libvtkxdmf3.dylib`XdmfRectilinearGrid::~XdmfRectilinearGrid() + 47 frame #1: 0x00007ffeefbfef20 frame #2: 0x00000001044f3854 libvtkxdmf3.dylib`XdmfRectilinearGrid::~XdmfRectilinearGrid() + 22 frame #3: 0x00000001044f38ab libvtkxdmf3.dylib`XdmfRectilinearGrid::~XdmfRectilinearGrid() + 15 frame #4: 0x0000000104f1c2ed libXdmfCore.dylib`boost::detail::shared_count::~shared_count() + 45 frame #5: 0x0000000104eeac46 libXdmfCore.dylib`std::__1::__tree >, std::__1::__map_value_compare<_xmlNode*, std::__1::__value_type<_xmlNode*, boost::shared_ptr >, std::__1::less<_xmlNode*>, true>, std::__1::allocator > > >::destroy(std::__1::__tree_node >, void*>*) + 50 frame #6: 0x0000000104eeac3d libXdmfCore.dylib`std::__1::__tree >, std::__1::__map_value_compare<_xmlNode*, std::__1::__value_type<_xmlNode*, boost::shared_ptr >, std::__1::less<_xmlNode*>, true>, std::__1::allocator > > >::destroy(std::__1::__tree_node >, void*>*) + 41 frame #7: 0x0000000104eeac31 libXdmfCore.dylib`std::__1::__tree >, std::__1::__map_value_compare<_xmlNode*, std::__1::__value_type<_xmlNode*, boost::shared_ptr >, std::__1::less<_xmlNode*>, true>, std::__1::allocator > > >::destroy(std::__1::__tree_node >, void*>*) + 29 frame #8: 0x0000000104eea377 libXdmfCore.dylib`XdmfCoreReader::XdmfCoreReaderImpl::closeFile() + 31 frame #9: 0x0000000104eea44b libXdmfCore.dylib`XdmfCoreReader::readItems(std::__1::basic_string, std::__1::allocator > const&) const + 65 frame #10: 0x0000000104eea777 libXdmfCore.dylib`XdmfCoreReader::read(std::__1::basic_string, std::__1::allocator > const&) const + 27 frame #11: 0x00000001044f2912 libvtkxdmf3.dylib`XdmfReader::read(std::__1::basic_string, std::__1::allocator > const&) const + 14 frame #12: 0x000000010444aa32 libvtkIOXdmf3-7.1.1.dylib`vtkXdmf3Reader::Internals::Init(char const*, bool) + 2224 frame #13: 0x0000000104443ffe libvtkIOXdmf3-7.1.1.dylib`vtkXdmf3Reader::Internals::PrepareDocument(vtkXdmf3Reader*, char const*, bool) + 96 frame #14: 0x0000000104443ecf libvtkIOXdmf3-7.1.1.dylib`vtkXdmf3Reader::RequestDataObject(vtkInformationVector*) + 57 frame #15: 0x0000000107cdf00f libvtkCommonExecutionModel-7.1.1.dylib`vtkExecutive::CallAlgorithm(vtkInformation*, int, vtkInformationVector**, vtkInformationVector*) + 69 frame #16: 0x0000000107cd49fe libvtkCommonExecutionModel-7.1.1.dylib`vtkCompositeDataPipeline::ExecuteDataObject(vtkInformation*, vtkInformationVector**, vtkInformationVector*) + 304 frame #17: 0x0000000107cd944e libvtkCommonExecutionModel-7.1.1.dylib`vtkDemandDrivenPipeline::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) + 166 frame #18: 0x0000000107cf601d libvtkCommonExecutionModel-7.1.1.dylib`vtkStreamingDemandDrivenPipeline::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) + 543 frame #19: 0x0000000107cd9968 libvtkCommonExecutionModel-7.1.1.dylib`vtkDemandDrivenPipeline::UpdateInformation() + 48 frame #20: 0x0000000107cf6438 libvtkCommonExecutionModel-7.1.1.dylib`vtkStreamingDemandDrivenPipeline::Update(int, vtkInformationVector*) + 36 frame #21: 0x0000000100021d1f rayleigh`main(argc=1, argv=0x00007ffeefbff4e8) at rayleigh.cpp:10 frame #22: 0x00007fff7c908015 libdyld.dylib`start + 1 frame #23: 0x00007fff7c908015 libdyld.dylib`start + 1 ``` _ -. .? |???? ', ; |?????? ?? |????????? RdB ,., |?????? .' '. |???? -' `? http://rdb.is -------------- next part -------------- An HTML attachment was scrubbed... URL: From shayan.moradkhani at gmail.com Wed Jul 4 08:46:40 2018 From: shayan.moradkhani at gmail.com (shayan moradkhani) Date: Wed, 4 Jul 2018 05:46:40 -0700 (MST) Subject: [vtkusers] machining simulation and collision detection In-Reply-To: References: <1530181664677-0.post@n5.nabble.com> <1530488945540-0.post@n5.nabble.com> Message-ID: <1530708400863-0.post@n5.nabble.com> hi, would it be possible to use you slicer collision detection? apparently you were updating it... regards Shayan -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From 278124177 at qq.com Wed Jul 4 08:54:09 2018 From: 278124177 at qq.com (=?gb18030?B?zui3qM7ozOw=?=) Date: Wed, 4 Jul 2018 20:54:09 +0800 Subject: [vtkusers] How to judge whether a plane and an object are intersected? Message-ID: hi i use vtkplanesoure to make a plane and i have a vtkpolydata how can i know wheter the plane and the polydata are intersected? -------------- next part -------------- An HTML attachment was scrubbed... URL: From kumar.ashutosh.ee at gmail.com Wed Jul 4 09:11:10 2018 From: kumar.ashutosh.ee at gmail.com (Kumar Ashutosh) Date: Wed, 4 Jul 2018 21:11:10 +0800 Subject: [vtkusers] How to use SetGeometryShaderCode Message-ID: I want to add custom Geometry Shader to my mapper. From the source code, I concluded that in vtkOpenGLPolyDataMapper we can inject custom Shader Code. Also, the code has WideLineGS as the default Geometry Shader. I tried to mimic the same behaviour by injecting the same code as given here (source code of WideLinesGS) using the function SetGeometryShaderCode. The resulting screen is a blank screen with no errors raised. Can someone please guide me on how to inject Geometry Shader Code. This is specific to Geometry Shader only as I have successfully tried with Frag Shader and Vertex Shader. A simple example of this would be great. Regards, Kumar Ashutosh ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From csaba.pinter at queensu.ca Wed Jul 4 09:24:21 2018 From: csaba.pinter at queensu.ca (Csaba Pinter) Date: Wed, 4 Jul 2018 13:24:21 +0000 Subject: [vtkusers] machining simulation and collision detection In-Reply-To: <1530708400863-0.post@n5.nabble.com> References: <1530181664677-0.post@n5.nabble.com> <1530488945540-0.post@n5.nabble.com> <1530708400863-0.post@n5.nabble.com> Message-ID: I don't fully understand the question, but feel free to use it in any way you see fit. csaba -----Original Message----- From: vtkusers On Behalf Of shayan moradkhani Sent: Wednesday, July 4, 2018 14:47 To: vtkusers at vtk.org Subject: Re: [vtkusers] machining simulation and collision detection hi, would it be possible to use you slicer collision detection? apparently you were updating it... regards Shayan -- Sent from: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1045678.n5.nabble.com%2FVTK-Users-f1224199.html&data=02%7C01%7Ccsaba.pinter%40queensu.ca%7Ca1398740cb2d4c23f87208d5e1ac3399%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636663052088108619&sdata=9gr8GNcTWuRK0V0OkhPxLpQCe05mhdyw2z8jo5u7GRI%3D&reserved=0 _______________________________________________ Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Ccsaba.pinter%40queensu.ca%7Ca1398740cb2d4c23f87208d5e1ac3399%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636663052088108619&sdata=ckeNhPcJirDWM9AXuzLPhcHhp0zOvAMhlyv9KHZFSgE%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%7Ccsaba.pinter%40queensu.ca%7Ca1398740cb2d4c23f87208d5e1ac3399%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636663052088108619&sdata=JM%2FdpLNlXC92Gy8rfxd77r7ppk%2FFzxqv38rT1IJ2xxc%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%7Ccsaba.pinter%40queensu.ca%7Ca1398740cb2d4c23f87208d5e1ac3399%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636663052088108619&sdata=QgQtiAULmytHPvSiKjC4ERXvJ6E%2BMlku4j2MMwY1ICE%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%7Ccsaba.pinter%40queensu.ca%7Ca1398740cb2d4c23f87208d5e1ac3399%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636663052088108619&sdata=0Qn3FHRyEX8lagpZWFrdlnkoSGD%2Bmai0mfft%2FQn4%2BpI%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%7Ccsaba.pinter%40queensu.ca%7Ca1398740cb2d4c23f87208d5e1ac3399%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636663052088108619&sdata=BpmLEbUuHpPFpoLc2Wpn%2BibehTjndqhw%2FS5BiBHF97E%3D&reserved=0 From Jesse.Kinross-Smith at bentley.com Wed Jul 4 10:57:03 2018 From: Jesse.Kinross-Smith at bentley.com (Jesse Kinross-Smith) Date: Wed, 4 Jul 2018 14:57:03 +0000 Subject: [vtkusers] How to build VTK 8.1.1 with vtkGUISupportMFC? In-Reply-To: References: <1530231317519-0.post@n5.nabble.com> Message-ID: Would be nice if you could keep the support up ? it?s rather important to us as we?re also using the vtkGUISupportMFC code in our app ? using vtk 8.1.1 right now It did require a small change in vtkMFCWindow.cpp ? just an additional ,0 on line 195 GUISupport\MFC\vtkMFCWindow.cpp: 194: unsigned char *pixels = 195: this->pvtkWin32OpenGLRW->GetPixelData(0,0,size[0]-1,size[1]-1,0,0); Jesse -- Jesse Kinross-Smith Senior Software Engineer - BSW Bentley Systems, Fremantle From: vtkusers [mailto:vtkusers-bounces at public.kitware.com] On Behalf Of David E DeMarle Sent: Wednesday, 4 July 2018 12:29 AM To: minpu.code at gmail.com Cc: vtkusers at vtk.org Subject: Re: [vtkusers] How to build VTK 8.1.1 with vtkGUISupportMFC? We haven't actively maintained the MFC support for a while (6.0 as I recall). As a result the MFC interface never got updates for OpenGL2. The specific compilation failure you are seeing is because we added a left eye/right eye argument along the way and the old MFC interface code knows nothing about it. David E DeMarle Kitware, Inc. Principal Engineer 21 Corporate Drive Clifton Park, NY 12065-8662 Phone: 518-881-4909 On Thu, Jun 28, 2018 at 8:15 PM pnt1614 > wrote: I am trying to build VTK 8.1.1 with vtkGUISupportMFC option on Windows 10 64bit using CMake 3.11.4 and visual studio 2015 (64 bit). Everything is okay in CMake, but in the visual studio 2015 I cannot build "ALL_BUILD" project because of two following messsages: 1. "no instance of overloaded function "vtkWin32OpenGLRenderWindow::GetPixelData" matches the argument list" 2. "vtkWin32OpenGLRenderWindow::GetPixelData": no overloaded function takes 5 arguments. Is there anyone experienced this problem? Please, help me. -- 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 dave.demarle at kitware.com Wed Jul 4 11:05:11 2018 From: dave.demarle at kitware.com (David E DeMarle) Date: Wed, 4 Jul 2018 11:05:11 -0400 Subject: [vtkusers] How to build VTK 8.1.1 with vtkGUISupportMFC? In-Reply-To: References: <1530231317519-0.post@n5.nabble.com> Message-ID: On Wed, Jul 4, 2018 at 10:57 AM Jesse Kinross-Smith < Jesse.Kinross-Smith at bentley.com> wrote: > Would be nice if you could keep the support up ? > Agreed. Unfortunately it hasn't been a priority for any of Kitware's customers (most of whom are on Qt and a few of whom are on ActiViz), nor for any other of the other VTK developers apparently. It won't be hard to do, a couple of days perhaps to update the code and stand up a dashboard. Merge requests and Kitware support arrangements are both welcome. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mey1k at naver.com Wed Jul 4 22:33:32 2018 From: mey1k at naver.com (minjun) Date: Wed, 4 Jul 2018 19:33:32 -0700 (MST) Subject: [vtkusers] in vtk8.1.1 enviroment and igstk Message-ID: <1530758012928-0.post@n5.nabble.com> hi, i'm beginner dev.. In vtk 8.1.1 environment, vtkVolumeRayCastIsosurfaceFunction and vtkVolumeRayCastMapper are not available when using igstk. I know it was deleted in 8.1.1 Why it was removed and are there any other alternatives to using igstk? thanks for reading, :) -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From lasso at queensu.ca Wed Jul 4 23:01:11 2018 From: lasso at queensu.ca (Andras Lasso) Date: Thu, 5 Jul 2018 03:01:11 +0000 Subject: [vtkusers] in vtk8.1.1 enviroment and igstk In-Reply-To: <1530758012928-0.post@n5.nabble.com> References: <1530758012928-0.post@n5.nabble.com> Message-ID: Hardware device interfaces of IGSTK is replaced and hugely extended in PLUS toolkit (www.plustoolkit.org), calibration and registration classes are available in SlicerIGT (www.sicerigt.org), application classes (GUI widgets, application logic, etc.) in 3D Slicer (www.slicer.org). Similar features are available in Custus-X (https://www.custusx.org/) and Ibis (http://ibisneuronav.org/) for neurosurgery, and in MITK-IGT for general use (http://www.mitk.org/wiki/IGT). There are some other packages in this area (such as nifty), but I'm not sure they are available with restriction-free open-source license. Andras -----Original Message----- From: vtkusers On Behalf Of minjun Sent: Wednesday, July 4, 2018 10:34 PM To: vtkusers at vtk.org Subject: [vtkusers] in vtk8.1.1 enviroment and igstk hi, i'm beginner dev.. In vtk 8.1.1 environment, vtkVolumeRayCastIsosurfaceFunction and vtkVolumeRayCastMapper are not available when using igstk. I know it was deleted in 8.1.1 Why it was removed and are there any other alternatives to using igstk? thanks for reading, :) -- 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%7Caee1da44e5264d4ba86608d5e21fb852%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636663548228066499&sdata=8hBf1VA7cArecGnuGFy2j62UyLr3DAeInzbaSkodhHE%3D&reserved=0 _______________________________________________ Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Classo%40queensu.ca%7Caee1da44e5264d4ba86608d5e21fb852%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636663548228066499&sdata=hzO74InmMyQchQivU5YAXnweGrV%2BhWNe4NB4HikJLis%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%7Caee1da44e5264d4ba86608d5e21fb852%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636663548228066499&sdata=FTdH8DI43ZlPzMfPj1dCQXZl2KUYdD6iOUhO8em1OSQ%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%7Caee1da44e5264d4ba86608d5e21fb852%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636663548228066499&sdata=VU69hODjdg%2FHUPJ55rZQwedyWBjoMW3z1L0YQmRVgBc%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%7Caee1da44e5264d4ba86608d5e21fb852%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636663548228066499&sdata=wWohk5wmfOVJ%2FW8V3GoWx0rJWDVMFbMfkQs%2FIDlzNJg%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%7Caee1da44e5264d4ba86608d5e21fb852%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636663548228066499&sdata=4uUtPNBwb4eO91DD0exXubc2ktnDBFyGoicwcOJzJRU%3D&reserved=0 From mey1k at naver.com Thu Jul 5 00:12:14 2018 From: mey1k at naver.com (minjun) Date: Wed, 4 Jul 2018 21:12:14 -0700 (MST) Subject: [vtkusers] in vtk8.1.1 enviroment and igstk In-Reply-To: References: <1530758012928-0.post@n5.nabble.com> Message-ID: <1530763934475-0.post@n5.nabble.com> This is very helpful to me. Thank you very much. :) -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From shayan.moradkhani at gmail.com Thu Jul 5 03:52:30 2018 From: shayan.moradkhani at gmail.com (shayan moradkhani) Date: Thu, 5 Jul 2018 00:52:30 -0700 (MST) Subject: [vtkusers] help for collision detection of volume mode In-Reply-To: References: Message-ID: <1530777150808-0.post@n5.nabble.com> hi, have you figured out how to approach your issue? cause i'm trying to do the same thing -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From andrewkeeling at hotmail.com Thu Jul 5 04:23:46 2018 From: andrewkeeling at hotmail.com (andyjk) Date: Thu, 5 Jul 2018 01:23:46 -0700 (MST) Subject: [vtkusers] Trouble using VTK Widget with QVTK In-Reply-To: <1402238646023-5727389.post@n5.nabble.com> References: <1402238646023-5727389.post@n5.nabble.com> Message-ID: <1530779026665-0.post@n5.nabble.com> Hi Old post but I am having the same issue too, with the same example - the contour widget point placer found here : https://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator The issue seems to be that you cannot define a new interactor for a qvtk widget. ie you cannot do : vtkSmartPointer interactor = vtkSmartPointer::New(); this->ui->qvtkWidget->GetRenderWindow()->SetInteractor(interactor); This breaks the qvtkwidget (nothing appears on screen), even if you call: ui->qvtkwidget->update(); or (out of desparation!) : interactor->Initialise(); ui->qvtkwidget->update(); interactor->Start() However, you can grab the exisiting qvtkwidget interactor and work with it for some widgets: vtkSmartPointer renderWindowInteractor = this->ui->qvtkWidget->GetRenderWindow()->GetInteractor(); BUT This doesn't work for the contour widget. Heres what I tried (mostly from the example posted above). This version won't even display my QT ui.... vtkSmartPointer renderWindow = this->ui->qvtkWidget->GetRenderWindow(); vtkSmartPointer interactor = vtkSmartPointer::New(); interactor->SetRenderWindow(renderWindow); /* // I already have a renderer set up with an actor // Add the actors to the renderer, set the background and size renderer->AddActor(tw_data_.pre_actor); renderer->SetBackground(.3, .4, .5); */ // Here comes the contour widget stuff... vtkSmartPointer contourWidget = vtkSmartPointer::New(); contourWidget->SetInteractor(interactor); vtkSmartPointer rep = vtkOrientedGlyphContourRepresentation::SafeDownCast( contourWidget->GetRepresentation()); rep->GetLinesProperty()->SetColor(0, 0, 1.0); rep->GetLinesProperty()->SetLineWidth(3.0); rep->GetProperty()->SetPointSize(10); rep->GetProperty()->SetRenderPointsAsSpheres(1); vtkSmartPointer pointPlacer = vtkSmartPointer::New(); pointPlacer->AddProp(tw_data_.pre_actor); pointPlacer->GetPolys()->AddItem(tw_data_.pre_poly); rep->SetPointPlacer(pointPlacer); this->ui->qvtkWidget->GetRenderWindow()->SetInteractor(interactor); this->ui->qvtkWidget->update(); renderWindow->Render(); interactor->Initialize(); contourWidget->EnabledOn(); renderer_->ResetCamera(); interactor->Start(); If I comment out : // this->ui->qvtkWidget->GetRenderWindow()->SetInteractor(interactor); and change: contourWidget->SetInteractor(interactor); to contourWidget->SetInteractor(this->ui->qvtkWidget->GetRenderWindow()->GetInteractor()); then I get the QT ui displaying, and normal interaction working but no contour widget. If I set everything up on a separate vtk renderer/renderwindow (ie like a non-QT pop-up window, the contour widget works fine). Can anyone helps as to why QVTK interactor doesn't work with contour widget? It seems that the contourwidget requires an uninitialised interactor, but the qvtkwidget interactor is always initialised before we can do anything with it. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From mathieu.westphal at kitware.com Thu Jul 5 04:26:12 2018 From: mathieu.westphal at kitware.com (Mathieu Westphal) Date: Thu, 5 Jul 2018 10:26:12 +0200 Subject: [vtkusers] Trouble using VTK Widget with QVTK In-Reply-To: <1530779026665-0.post@n5.nabble.com> References: <1402238646023-5727389.post@n5.nabble.com> <1530779026665-0.post@n5.nabble.com> Message-ID: Hello Andrew, QVTKWidget is deprecated, you may want to try with QVTKOpenGLSimpleWidget and QVTKOpenGLWidget if they are available in the version of VTK you are using. Best regards, Mathieu Westphal On Thu, Jul 5, 2018 at 10:23 AM, andyjk wrote: > Hi > > Old post but I am having the same issue too, with the same example - the > contour widget point placer found here : > https://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ > PolygonalSurfaceContourLineInterpolator > PolygonalSurfaceContourLineInterpolator> > > The issue seems to be that you cannot define a new interactor for a qvtk > widget. ie you cannot do : > > vtkSmartPointer interactor = > vtkSmartPointer::New(); > this->ui->qvtkWidget->GetRenderWindow()->SetInteractor(interactor); > > This breaks the qvtkwidget (nothing appears on screen), even if you call: > ui->qvtkwidget->update(); > > or (out of desparation!) : > > interactor->Initialise(); > ui->qvtkwidget->update(); > interactor->Start() > > However, you can grab the exisiting qvtkwidget interactor and work with it > for some widgets: > > vtkSmartPointer renderWindowInteractor = > this->ui->qvtkWidget->GetRenderWindow()->GetInteractor(); > > BUT This doesn't work for the contour widget. > > Heres what I tried (mostly from the example posted above). This version > won't even display my QT ui.... > > vtkSmartPointer renderWindow = > this->ui->qvtkWidget->GetRenderWindow(); > vtkSmartPointer interactor = > vtkSmartPointer::New(); > interactor->SetRenderWindow(renderWindow); > /* > // I already have a renderer set up with an actor > // Add the actors to the renderer, set the background and size > renderer->AddActor(tw_data_.pre_actor); > renderer->SetBackground(.3, .4, .5); > */ > // Here comes the contour widget stuff... > vtkSmartPointer contourWidget = > vtkSmartPointer::New(); > contourWidget->SetInteractor(interactor); > vtkSmartPointer rep = > vtkOrientedGlyphContourRepresentation::SafeDownCast( > contourWidget->GetRepresentation()); > rep->GetLinesProperty()->SetColor(0, 0, 1.0); > rep->GetLinesProperty()->SetLineWidth(3.0); > rep->GetProperty()->SetPointSize(10); > rep->GetProperty()->SetRenderPointsAsSpheres(1); > > vtkSmartPointer pointPlacer = > vtkSmartPointer::New(); > pointPlacer->AddProp(tw_data_.pre_actor); > pointPlacer->GetPolys()->AddItem(tw_data_.pre_poly); > rep->SetPointPlacer(pointPlacer); > > this->ui->qvtkWidget->GetRenderWindow()-> > SetInteractor(interactor); > this->ui->qvtkWidget->update(); > > renderWindow->Render(); > interactor->Initialize(); > contourWidget->EnabledOn(); > renderer_->ResetCamera(); > interactor->Start(); > > If I comment out : > // this->ui->qvtkWidget->GetRenderWindow()-> > SetInteractor(interactor); > > and change: > contourWidget->SetInteractor(interactor); > to > contourWidget->SetInteractor(this->ui->qvtkWidget->GetRenderWindow()-> > GetInteractor()); > > then I get the QT ui displaying, and normal interaction working but no > contour widget. > > If I set everything up on a separate vtk renderer/renderwindow (ie like a > non-QT pop-up window, the contour widget works fine). > > > Can anyone helps as to why QVTK interactor doesn't work with contour > widget? > It seems that the contourwidget requires an uninitialised interactor, but > the qvtkwidget interactor is always initialised before we can do anything > with it. > > > > > > -- > 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 shayan.moradkhani at gmail.com Thu Jul 5 04:36:46 2018 From: shayan.moradkhani at gmail.com (shayan moradkhani) Date: Thu, 5 Jul 2018 01:36:46 -0700 (MST) Subject: [vtkusers] machining simulation and collision detection In-Reply-To: References: <1530181664677-0.post@n5.nabble.com> <1530488945540-0.post@n5.nabble.com> <1530708400863-0.post@n5.nabble.com> Message-ID: <1530779806503-0.post@n5.nabble.com> sorry, my bad for incomplete info. im trying to simulate real-time machining/drilling process. do you think that slicer collision detection can show material removal/ varying 3D objects? -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From andrewkeeling at hotmail.com Thu Jul 5 05:06:42 2018 From: andrewkeeling at hotmail.com (andyjk) Date: Thu, 5 Jul 2018 02:06:42 -0700 (MST) Subject: [vtkusers] Trouble using VTK Widget with QVTK In-Reply-To: References: <1402238646023-5727389.post@n5.nabble.com> <1530779026665-0.post@n5.nabble.com> Message-ID: <1530781602796-0.post@n5.nabble.com> Thanks I am on VTK 8-1 I did try the qvtkOpenGLWidget but I have several problems, and I think I read it was still unstable. Problem 1: No QVTKOpenGLWidget in the QT designer - so I insert a qvtkwidget, then in the .ui file I manually change it to qvtkOpenGLWidget (this compiles fine). Problem 2: If I try to drag a generic OpenGL widget into a window in QT designer, the designer crashes and closes. Problem 3: Running the code from 1 gives me an error: QVTKOpenGLWidget requires a `vtkGenericOpenGLRenderWindow`. ` vtkWin32OpenGLRenderWindow ` is not supported. I understand QVTKWidget is deprecated, but it also seems the OpenGL widget is too unstable at the moment ? -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From cammarasanasimone at gmail.com Thu Jul 5 05:11:12 2018 From: cammarasanasimone at gmail.com (cammarasana123) Date: Thu, 5 Jul 2018 02:11:12 -0700 (MST) Subject: [vtkusers] vtkAVIWriter::New() not working Message-ID: <1530781872206-0.post@n5.nabble.com> Hello everybody, I was trying this example for creating an AVI video https://www.vtk.org/Wiki/VTK/Examples/Cxx/Untested/Video/AVI but this simple program here is not working: / #include #include int main (int argc, char *argv[]) { vtkSmartPointer writer = vtkSmartPointer::New(); } / giving an error like *Undefined reference at vtkAVIWriter::New()* The Cmake is the same of the example..I don't know if there can be some error with the installation, other programs are working rightly. Thanks for supporting Simone -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From mathieu.westphal at kitware.com Thu Jul 5 05:20:30 2018 From: mathieu.westphal at kitware.com (Mathieu Westphal) Date: Thu, 5 Jul 2018 11:20:30 +0200 Subject: [vtkusers] Trouble using VTK Widget with QVTK In-Reply-To: <1530781602796-0.post@n5.nabble.com> References: <1402238646023-5727389.post@n5.nabble.com> <1530779026665-0.post@n5.nabble.com> <1530781602796-0.post@n5.nabble.com> Message-ID: Hi, QVTKOpenGLWindow in 8.1.0 and 8.1.1 is very stable and is used by all VTK/Qt based application, like ParaView for example. Problem 1 and Problem 2 are QTCreator related. I would suggest adding a simple QWidget in Qt creator, and once you're finished, juste change it manually in the .ui. Regarding Problem 3, well the answer is in the question. Juste use a vtkGenericOpenGLRenderWindow instead of a win32 specific. The vtkGenericOpenGLRenderWindow implementation is newer and will work on all platform. See attached for a QVTKOpenGLWidget usage example (found in VTK/GUISupport/Qt/Testing/Cxx/) Best regards, Mathieu Westphal On Thu, Jul 5, 2018 at 11:06 AM, andyjk wrote: > Thanks > > I am on VTK 8-1 > > I did try the qvtkOpenGLWidget but I have several problems, and I think I > read it was still unstable. > > Problem 1: No QVTKOpenGLWidget in the QT designer - so I insert a > qvtkwidget, then in the .ui file I manually change it to qvtkOpenGLWidget > (this compiles fine). > > Problem 2: If I try to drag a generic OpenGL widget into a window in QT > designer, the designer crashes and closes. > > Problem 3: Running the code from 1 gives me an error: > QVTKOpenGLWidget requires a `vtkGenericOpenGLRenderWindow`. ` > vtkWin32OpenGLRenderWindow ` is not supported. > > I understand QVTKWidget is deprecated, but it also seems the OpenGL widget > is too unstable at the moment ? > > > > -- > 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: -------------- next part -------------- A non-text attachment was scrubbed... Name: TestQVTKOpenGLWidget.cxx Type: text/x-c++src Size: 2550 bytes Desc: not available URL: From mathieu.westphal at kitware.com Thu Jul 5 05:34:46 2018 From: mathieu.westphal at kitware.com (Mathieu Westphal) Date: Thu, 5 Jul 2018 11:34:46 +0200 Subject: [vtkusers] vtkAVIWriter::New() not working In-Reply-To: <1530781872206-0.post@n5.nabble.com> References: <1530781872206-0.post@n5.nabble.com> Message-ID: Hello, vtkAVIWriter is a windows specific class. If you are on linux, this example can't be used. If you are on windows, make sure that you have activated VTK_USE_VIDEO_FOR_WINDOWS cmake option. Best regards, Mathieu Westphal On Thu, Jul 5, 2018 at 11:11 AM, cammarasana123 wrote: > Hello everybody, > > I was trying this example for creating an AVI video > > https://www.vtk.org/Wiki/VTK/Examples/Cxx/Untested/Video/AVI > > > but this simple program here is not working: > / > #include > #include > int main (int argc, char *argv[]) > { > vtkSmartPointer writer = > vtkSmartPointer::New(); > } > / > > giving an error like > *Undefined reference at vtkAVIWriter::New()* > > The Cmake is the same of the example..I don't know if there can be some > error with the installation, other programs are working rightly. > > Thanks for supporting > Simone > > > > -- > 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 babybishops at gmail.com Thu Jul 5 06:11:40 2018 From: babybishops at gmail.com (J.) Date: Thu, 5 Jul 2018 11:11:40 +0100 Subject: [vtkusers] How do I label points in 3d space with arbitrary strings? Message-ID: I have some particles moving around in 3d space, and I want to draw labels next to them that can display arbitrary data. The behavior in this example seems like what I need: https://github.com/Kitware/VTK/blob/master/Examples/Annotation/Python/labeledMesh.py I tried having a look at vtkLabeledDataMapper, but I don't see any way to tell it what to display. It just seems to automatically display... coordinates? Or "field data", whatever that is? In any case I couldn't see any way to just directly assign strings to point IDs or something like that. Is this not the right class for the job? How can I get the behavior I'm looking for? -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrewkeeling at hotmail.com Thu Jul 5 06:13:20 2018 From: andrewkeeling at hotmail.com (andyjk) Date: Thu, 5 Jul 2018 03:13:20 -0700 (MST) Subject: [vtkusers] Trouble using VTK Widget with QVTK In-Reply-To: References: <1402238646023-5727389.post@n5.nabble.com> <1530779026665-0.post@n5.nabble.com> <1530781602796-0.post@n5.nabble.com> Message-ID: <1530785600603-0.post@n5.nabble.com> Thanks Mathieu That was a big help. I added the line: QSurfaceFormat::setDefaultFormat(QVTKOpenGLWidget::defaultFormat()); in main.cpp (plus a couple of includes). then in my derived QMainWindow class I have done: vtkNew renderWindow; /* Set up the contour stuff as before with a new interactor */ then: renderWindow->Render(); interactor->Initialize(); contourWidget->EnabledOn(); this->ui->qvtkWidget->SetRenderWindow(renderWindow); renderer_->ResetCamera(); This works for other widgets, but still does not work for contour widget. The window renders and I can move the camera around etc, but left click does nothing. Do you think this means it is not possible to use the PolygonalSurfaceContourLineInterpolator with a QVTKOpenGL widget either ? -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From cammarasanasimone at gmail.com Thu Jul 5 07:40:16 2018 From: cammarasanasimone at gmail.com (cammarasana123) Date: Thu, 5 Jul 2018 04:40:16 -0700 (MST) Subject: [vtkusers] vtkAVIWriter::New() not working In-Reply-To: References: <1530781872206-0.post@n5.nabble.com> Message-ID: <1530790816633-0.post@n5.nabble.com> oh, ok..I just saw it's clearly written at the top of AVI writer documentation anyway I solved using OGG format thanks -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From lasso at queensu.ca Thu Jul 5 07:41:06 2018 From: lasso at queensu.ca (Andras Lasso) Date: Thu, 5 Jul 2018 11:41:06 +0000 Subject: [vtkusers] machining simulation and collision detection In-Reply-To: <1530779806503-0.post@n5.nabble.com> References: <1530181664677-0.post@n5.nabble.com> <1530488945540-0.post@n5.nabble.com> <1530708400863-0.post@n5.nabble.com> , <1530779806503-0.post@n5.nabble.com> Message-ID: <68dfec1c-1b37-4f12-a6a8-b90ba8320062@queensu.ca> You can simulate drilling by removing voxels from volume-rendered (or iso-surface-rendered) image data by combining it with the image of the drilling head using image mathematics. This is already fully implemented in 3D Slicer's Segment Editor module - you can use that as is (recommended), or use the code as an example. There are Boolean surface mesh operators in VTK, which in theory could be used to modify meshes directly. However, I've found that they sometimes randomly fail, even for well-behaved, valid inputs. Andras ________________________________ From: shayan moradkhani Sent: Thursday, July 5, 2018 4:36 AM To: vtkusers at vtk.org Subject: Re: [vtkusers] machining simulation and collision detection sorry, my bad for incomplete info. im trying to simulate real-time machining/drilling process. do you think that slicer collision detection can show material removal/ varying 3D objects? -- 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%7Cea40426f60a34f5fd52908d5e2527525%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636663766138155489&sdata=I3bHfSQCcec5TkMqhrmPXCxjfg4KuP9lIsBOiGuytTk%3D&reserved=0 _______________________________________________ Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Classo%40queensu.ca%7Cea40426f60a34f5fd52908d5e2527525%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636663766138155489&sdata=QwSvfeduPn98BZolK1lD8BLh419iL9lVlgGwGAsTYyE%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%7Cea40426f60a34f5fd52908d5e2527525%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636663766138155489&sdata=EWvGknlkaAwSxkY8c8Pm725ZqemIm7J16k4YkOtVYoU%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%7Cea40426f60a34f5fd52908d5e2527525%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636663766138155489&sdata=vwLFk1u%2BcxTiHuCvza1zbojBzxP1QcSrRjITqDcAxBQ%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%7Cea40426f60a34f5fd52908d5e2527525%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636663766138155489&sdata=3ltd%2BjKdZ%2BwgYEDfre%2Bjbz3Un4zBC5Gm1zmOwT6AvYI%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%7Cea40426f60a34f5fd52908d5e2527525%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636663766138155489&sdata=AWEoCmA6aXnoRE3%2F4DfMQU6dVaZA%2BUze1CSexcXaCk8%3D&reserved=0 -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrewkeeling at hotmail.com Thu Jul 5 09:39:02 2018 From: andrewkeeling at hotmail.com (andyjk) Date: Thu, 5 Jul 2018 06:39:02 -0700 (MST) Subject: [vtkusers] Trouble using VTK Widget with QVTK In-Reply-To: <1530785600603-0.post@n5.nabble.com> References: <1402238646023-5727389.post@n5.nabble.com> <1530779026665-0.post@n5.nabble.com> <1530781602796-0.post@n5.nabble.com> <1530785600603-0.post@n5.nabble.com> Message-ID: <1530797942431-0.post@n5.nabble.com> I have created a minimal compilable example complete with CMake file to show the problem. Would someone be kind enough to take a look and see if this is a bug or my error in understanding? I am trying to run this example https://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator but using a QT widget to display (QVTKOpenGLWidget). In the mainwindow.cpp file I have three small sets of comments to remove/use certain code. 1) Basically, as it stands, it will create a non-QT 'normal' VTK window and works perfectly 2) By uncommenting a couple of lines as per the code in mainwindow.cpp, I try to move the renderwindow into the QVTKOpenGLWidget. Depending on which of the 3 or 4 lines you uncomment/comment, we either get : a) Nothing - a black screen. Probably due to no valid interactor started b) The sphere correctly rendered but unable to interact c) The sphere and a moveable camera, but no polygonalSurfaceContour functionality (cannot 'draw' on sphere) Could someone help by running the simple code attached to reproduce the issue ? Thanks SimpleTest.zip -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From dan.lipsa at kitware.com Thu Jul 5 09:42:04 2018 From: dan.lipsa at kitware.com (Dan Lipsa) Date: Thu, 5 Jul 2018 09:42:04 -0400 Subject: [vtkusers] Don't build vtkproj4? In-Reply-To: References: <20180110125844.GA1305@megas.kitware.com> <20180110153601.GA21857@megas.kitware.com> <20180111192937.GA11091@megas.kitware.com> Message-ID: Great! Thanks for testing this Chris. Best, Dan On Tue, Jul 3, 2018 at 1:58 PM Chris Marsh wrote: > Hi all, > > Just a note this appears to have been fixed as of (at least) 8.1.1 and I'm > no longer encountering this issues. > Thanks very much for resolving this. > > Cheers > Chris > > > > On 30 January 2018 at 16:59, Chris Marsh wrote: > >> Hi, >> That is great to hear! >> Cheers >> Chris >> >> >> On 30 January 2018 at 16:35, Dan Lipsa wrote: >> >>> Hi Chris, >>> Thanks for investigating this. >>> Indeed, looking the the so file, there are some symbols that we are not >>> mangling, which cause the problems you've seen. >>> I believe this was caused by updating of the version of the library we >>> are including without updating the list of symbols we are mangling. >>> We'll fix this shortly, >>> >>> Dan >>> >>> >>> On Tue, Jan 30, 2018 at 4:26 PM, Chris Marsh >>> wrote: >>> >>>> Hi all, >>>> >>>> I have some updates on this. I recently discovered the >>>> LD_DEBUG=bindings linker tool, so I can see what is happening. >>>> >>>> There appear to be many cases where either the proj4 library I built or >>>> my executable bind to symbols in libvtkproj. >>>> >>>> A few examples shown here. 'After patch elf' is when I use patchelf >>>> with --replace-needed to remove libvtkproj.so >>>> >>>> As built >>>> 21340: binding file >>>> /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `pj_prime_meridians' >>>> 21340: binding file >>>> /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `pj_list' >>>> 21340: binding file >>>> /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0] to >>>> /home/cbm038/build-release/bin/Release/CHM [0]: normal symbol `stdout' >>>> [GLIBC_2.2.5] >>>> 21340: binding file >>>> /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `pj_ellps' >>>> 21340: binding file >>>> /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `pj_datums' >>>> >>>> After patch elf >>>> >>>> 21259: binding file >>>> /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0] to >>>> /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0]: normal symbol >>>> `pj_prime_meridians' >>>> 21259: binding file >>>> /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0] to >>>> /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0]: normal symbol >>>> `pj_list' >>>> 21259: binding file >>>> /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0] to >>>> /home/cbm038/build-release/bin/Release/CHM [0]: normal symbol `stdout' >>>> [GLIBC_2.2.5] >>>> 21259: binding file >>>> /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0] to >>>> /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0]: normal symbol >>>> `pj_ellps' >>>> 21259: binding file >>>> /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0] to >>>> /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0]: normal symbol >>>> `pj_datums' >>>> >>>> >>>> Another example: >>>> >>>> As built >>>> 21340: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/bin/Release/CHM [0]: normal symbol `stderr' >>>> [GLIBC_2.2.5] >>>> 21340: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `pj_units' >>>> 21340: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `vtk_pj_aea' >>>> 21340: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `pj_s_aea' >>>> 21340: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `vtk_pj_aeqd' >>>> 21340: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `pj_s_aeqd' >>>> 21340: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `vtk_pj_airy' >>>> 21340: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `pj_s_airy' >>>> 21340: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `vtk_pj_aitoff' >>>> 21340: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `pj_s_aitoff' >>>> 21340: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `vtk_pj_alsk' >>>> 21340: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `pj_s_alsk' >>>> 21340: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `vtk_pj_apian' >>>> 21340: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `pj_s_apian' >>>> 21340: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `vtk_pj_august' >>>> >>>> >>>> after patchelf >>>> >>>> 21259: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0]: normal symbol >>>> `pj_units' >>>> 21259: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `vtk_pj_aea' >>>> 21259: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0]: normal symbol >>>> `pj_s_aea' >>>> 21259: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `vtk_pj_aeqd' >>>> 21259: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0]: normal symbol >>>> `pj_s_aeqd' >>>> 21259: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `vtk_pj_airy' >>>> 21259: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0]: normal symbol >>>> `pj_s_airy' >>>> 21259: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `vtk_pj_aitoff' >>>> 21259: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0]: normal symbol >>>> `pj_s_aitoff' >>>> 21259: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `vtk_pj_alsk' >>>> 21259: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0]: normal symbol >>>> `pj_s_alsk' >>>> 21259: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `vtk_pj_apian' >>>> 21259: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0]: normal symbol >>>> `pj_s_apian' >>>> 21259: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0]: normal >>>> symbol `vtk_pj_august' >>>> 21259: binding file >>>> /home/cbm038/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 [0] to >>>> /home/cbm038/build-release/lib/proj4/lib/libproj.so.12 [0]: normal symbol >>>> `pj_s_august' >>>> >>>> >>>> Building VTK with system proj4 does correctly 'solve' the problem. >>>> >>>> Can provide more details if required. >>>> >>>> Cheers >>>> Chris >>>> >>>> On 16 January 2018 at 13:17, Chris Marsh wrote: >>>> >>>>> Hi all, >>>>> >>>>> Thanks for the detailed thoughts. >>>>> >>>>> Is the message you are getting from proj saying that the string you >>>>>> pass is not valid? >>>>>> >>>>> Correct. However, I've verified with both the GDAL and proj4 mailing >>>>> lists that the string is correct. The string is actually output from proj4 >>>>> itself, so I have substantial confidence in it. >>>>> >>>>> >>>>>> Maybe somebody overrides that memory? >>>>>> Try run your program though valgrind and/or comment out chunks of >>>>>> code trying to see who causes your error. >>>>>> >>>>> Valgrind and the Intel memory tools show no memory corruption. >>>>> >>>>> Is VTK in the call stack for the errors you described? If not, I think >>>>>> it is not involved in the errors. >>>>> >>>>> GDAL, as I understand, dynamically opens the .so at runtime, so it's >>>>> tough to figure out exactly what it is doing. Looking at the backtrace in >>>>> gdb shows that it appears to be calling into the system proj4 before it >>>>> segfaults. >>>>> >>>>> If I use patchelf to strip the vtkproj4 reference, it is then fine. >>>>> If use patchelf to strip the system proj4 leaving the vtkproj4, I get the >>>>> same error and segfault. >>>>> >>>>> I *suspect* GDAL is doing the wrong thing here and loading the wrong >>>>> library for some calls. This is all to say, I don't think it's a VTK >>>>> problem per se, but is for whatever reason, conflicting on this system. >>>>> >>>>> Further weirdness is that on the machines this works 100%, I don't see >>>>> any reference to libvtkproj4. >>>>> >>>>> I'll follow up after I rebuild everything again with the VTK system >>>>> proj4. >>>>> >>>>> Thanks very much, >>>>> >>>>> Cheers >>>>> Chris >>>>> >>>>> >>>>> University of Saskatchewan >>>>> >>>>> On 15 January 2018 at 10:03, Dan Lipsa wrote: >>>>> >>>>>> Hi Chris, >>>>>> Is VTK in the call stack for the errors you described? If not, I >>>>>> think it is not involved in the errors. >>>>>> >>>>>> vtkproj should not interfere with proj, but you can make VTK use the >>>>>> system proj with the method described earlier. >>>>>> >>>>>> Is the message you are getting from proj saying that the string you >>>>>> pass is not valid? Maybe somebody overrides that memory? >>>>>> Try run your program though valgrind and/or comment out chunks of >>>>>> code trying to see who causes your error. >>>>>> Hope this helps, >>>>>> Dan >>>>>> >>>>>> >>>>>> >>>>>> On Fri, Jan 12, 2018 at 3:32 PM, Chris Marsh >>>>>> wrote: >>>>>> >>>>>>> Hi Dan, >>>>>>> >>>>>>> I'm trying to figure out the issue I detail here: >>>>>>> >>>>>>> http://osgeo-org.1560.x6.nabble.com/Failed-to-initialize-PROJ-4-with-quot-quot-td5338323.html >>>>>>> >>>>>>> http://osgeo-org.1560.x6.nabble.com/gdal-dev-ERROR-6-Failed-to-initialize-PROJ-4-with-quot-quot-td5338107.html >>>>>>> >>>>>>> Effectively the error is that GDAL seems to call the incorrect >>>>>>> library/something happens, and the projection fails. >>>>>>> >>>>>>> In an effort to resolve this I was looking at my binary via LDD and >>>>>>> found >>>>>>> $ ldd ~/build-release/bin/Release/CHM | grep proj4 >>>>>>> libvtkproj4-8.0.so.1 => >>>>>>> /home/cmarsh/build-release/lib/VTK/lib/libvtkproj4-8.0.so.1 >>>>>>> (0x00002b517aa36000) >>>>>>> libproj.so.0 => >>>>>>> /home/cmarsh/build-release/lib/proj4/lib/libproj.so.0 (0x00002b51944d2000) >>>>>>> >>>>>>> If I use patchelf (https://github.com/NixOS/patchelf) to strip >>>>>>> libvtkproj4-8.0.so.1 from my binary, my code runs without the error. >>>>>>> >>>>>>> I don't quite understand why I don't have this problem on other >>>>>>> machines though. Looking at other machines I compile on (using a custom VTK >>>>>>> build) I don't see any reference to the VTK libproj4 via ldd. >>>>>>> >>>>>>> Thus I attributed the error to vtkproj4 inclusion. However if you >>>>>>> mangle names, then I agree I don't understand why this is happening. >>>>>>> >>>>>>> Cheers >>>>>>> Chris >>>>>>> >>>>>>> >>>>>>> On 12 January 2018 at 09:35, Dan Lipsa >>>>>>> wrote: >>>>>>> >>>>>>>> Chris, >>>>>>>> >>>>>>>> 1. Going back to the beginning of the thread, I don't understand >>>>>>>> why vtklibproj conflicts with another proj, given that we mangle all names. >>>>>>>> Can you send us the errors. >>>>>>>> >>>>>>>> 2. If you do want to build with the system proj4 >>>>>>>> >>>>>>>> Can you send up the output of: >>>>>>>> cat CMakeCache.txt | grep LIBPROJ >>>>>>>> >>>>>>>> This is what I have: >>>>>>>> LIBPROJ4_INCLUDE_DIR:PATH=/usr/include >>>>>>>> LIBPROJ4_LIBRARIES:FILEPATH=/usr/lib/x86_64-linux-gnu/libproj.so.12 >>>>>>>> LIBPROJ_BINDIR:PATH=bin >>>>>>>> LIBPROJ_DATADIR:PATH=share/proj >>>>>>>> LIBPROJ_DOCDIR:PATH=doc/proj >>>>>>>> LIBPROJ_INCLUDEDIR:PATH=include >>>>>>>> LIBPROJ_LIBDIR:PATH=lib >>>>>>>> LIBPROJ_M_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libm.so >>>>>>>> LIBPROJ_USE_THREAD:BOOL=ON >>>>>>>> //Use system-installed LIBPROJ4 >>>>>>>> VTK_USE_SYSTEM_LIBPROJ4:BOOL=ON >>>>>>>> //ADVANCED property for variable: LIBPROJ4_INCLUDE_DIR >>>>>>>> LIBPROJ4_INCLUDE_DIR-ADVANCED:INTERNAL=1 >>>>>>>> //ADVANCED property for variable: LIBPROJ4_LIBRARIES >>>>>>>> LIBPROJ4_LIBRARIES-ADVANCED:INTERNAL=1 >>>>>>>> //MODIFIED property for variable: LIBPROJ4_LIBRARIES >>>>>>>> LIBPROJ4_LIBRARIES-MODIFIED:INTERNAL=ON >>>>>>>> //ADVANCED property for variable: LIBPROJ_BINDIR >>>>>>>> LIBPROJ_BINDIR-ADVANCED:INTERNAL=1 >>>>>>>> //ADVANCED property for variable: LIBPROJ_DATADIR >>>>>>>> LIBPROJ_DATADIR-ADVANCED:INTERNAL=1 >>>>>>>> //ADVANCED property for variable: LIBPROJ_DOCDIR >>>>>>>> LIBPROJ_DOCDIR-ADVANCED:INTERNAL=1 >>>>>>>> //ADVANCED property for variable: LIBPROJ_INCLUDEDIR >>>>>>>> LIBPROJ_INCLUDEDIR-ADVANCED:INTERNAL=1 >>>>>>>> //ADVANCED property for variable: LIBPROJ_LIBDIR >>>>>>>> LIBPROJ_LIBDIR-ADVANCED:INTERNAL=1 >>>>>>>> //ADVANCED property for variable: LIBPROJ_M_LIB >>>>>>>> LIBPROJ_M_LIB-ADVANCED:INTERNAL=1 >>>>>>>> //ADVANCED property for variable: LIBPROJ_USE_THREAD >>>>>>>> LIBPROJ_USE_THREAD-ADVANCED:INTERNAL=1 >>>>>>>> //ADVANCED property for variable: VTK_USE_SYSTEM_LIBPROJ4 >>>>>>>> VTK_USE_SYSTEM_LIBPROJ4-ADVANCED:INTERNAL=1 >>>>>>>> //MODIFIED property for variable: VTK_USE_SYSTEM_LIBPROJ4 >>>>>>>> VTK_USE_SYSTEM_LIBPROJ4-MODIFIED:INTERNAL=ON >>>>>>>> >>>>>>>> >>>>>>>> Make sure >>>>>>>> LIBPROJ4_INCLUDE_DIR >>>>>>>> LIBPROJ4_LIBRARIES >>>>>>>> VTK_USE_SYSTEM_LIBPROJ4 >>>>>>>> have the correct values. >>>>>>>> >>>>>>>> All those are cmake variables, you change them using ccmake or >>>>>>>> cmake-gui. >>>>>>>> After that you call: >>>>>>>> >>>>>>>> cmake . >>>>>>>> make >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Fri, Jan 12, 2018 at 9:15 AM, Aashish Chaudhary < >>>>>>>> aashish.chaudhary at kitware.com> wrote: >>>>>>>> >>>>>>>>> Dan Lipsa made last changes perhaps he may have some suggestions. >>>>>>>>> >>>>>>>>> - aashish >>>>>>>>> >>>>>>>>> On Thu, Jan 11, 2018 at 7:41 PM Chris Marsh >>>>>>>>> wrote: >>>>>>>>> >>>>>>>>>> Looks like something is setting >>>>>>>>>> PROJ4_INCLUDE_DIR >>>>>>>>>> PROJ4_LIBRARY >>>>>>>>>> to the system's proj4. I use a custom findproj4 that only looks >>>>>>>>>> where I tell it. >>>>>>>>>> >>>>>>>>>> then I see that >>>>>>>>>> LIB_FILES:INTERNAL >>>>>>>>>> contains vtkproj4 >>>>>>>>>> LIB_FILES just holds all my 3rd party libraries I need to link >>>>>>>>>> against. >>>>>>>>>> >>>>>>>>>> Chris Marsh >>>>>>>>>> PhD Candidate >>>>>>>>>> chrismarsh.ca >>>>>>>>>> >>>>>>>>>> 121 Research Drive >>>>>>>>>> >>>>>>>>>> University of Saskatchewan >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On 11 January 2018 at 13:29, Ben Boeckel >>>>>>>>> > wrote: >>>>>>>>>> >>>>>>>>>>> On Thu, Jan 11, 2018 at 11:41:40 -0600, Chris Marsh wrote: >>>>>>>>>>> > Thanks for the details. This doesn't seem to be working for me >>>>>>>>>>> though. I've >>>>>>>>>>> > tried passing VTK_USE_SYSTEM_libproj4 to cmake on the command >>>>>>>>>>> line as well >>>>>>>>>>> > as defining it as a CXXFLAG='-D VTK_USE_SYSTEM_libproj4", >>>>>>>>>>> however neither >>>>>>>>>>> > works. I still see the vtklibproj4 in the output of ldd. >>>>>>>>>>> >>>>>>>>>>> CMake should be getting the flag. If you do: >>>>>>>>>>> >>>>>>>>>>> grep -i proj4 CMakeCache.txt >>>>>>>>>>> >>>>>>>>>>> do any variables stand out as potentially being set to use the >>>>>>>>>>> internal >>>>>>>>>>> one? >>>>>>>>>>> >>>>>>>>>>> --Ben >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> _______________________________________________ >>>>>>>>>> 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 dan.lipsa at kitware.com Thu Jul 5 09:50:39 2018 From: dan.lipsa at kitware.com (Dan Lipsa) Date: Thu, 5 Jul 2018 09:50:39 -0400 Subject: [vtkusers] Run VTK with OpenGL ES 2.0 backend In-Reply-To: References: Message-ID: Konrad, I believe OpenGL ES is only supported for mobile architectures https://blog.kitware.com/building-vtk-for-mobile-architectures/ The desktop version, including the version compiled for EGL requires full OpenGL https://blog.kitware.com/off-screen-rendering-through-the-native-platform-interface-egl/ Dan On Wed, Jun 27, 2018 at 11:33 AM Konrad LEY wrote: > Hello, > > I'm trying to run VTK on a Ultra96 board, which has a Mali-400 MP2 gpu > supporting OpenGL ES 2.0. > According to https://blog.kitware.com/raspberry-pi-likes-vtk/ VTK has a > OpenGL ES 2.0 backend and runs on EGL. > So I installed the libmali-dev package of my petalinux linux distribution, > which is providing me the following files: > > /usr/include/EGL/egl.h > /usr/include/EGL/eglext.h > /usr/include/EGL/eglplatform.h > /usr/include/GLES/gl.h > /usr/include/GLES/glext.h > /usr/include/GLES/glplatform.h > /usr/include/GLES2/gl2.h > /usr/include/GLES2/gl2ext.h > /usr/include/GLES2/gl2platform.h > /usr/include/KHR/khrplatform.h > /usr/lib/libEGL.so > /usr/lib/libGLESv1_CM.so > /usr/lib/libGLESv2.so > /usr/lib/libMali.so > /usr/lib/pkconfig/egl.pc > /usr/lib/pkconfig/glesv1.pc > /usr/lib/pkconfig/glesv1_cm.pc > /usr/lib/pkgconfig/glesv2.pc > > I can compile and run examples using OpenGL ES 2.0 now. > > Then I downloaded latest VTK-8.1.1 and ran cmake in the build folder. It > complained about not finding OpenGL so I also installed libgl-mesa-dev > package which is providing me: > > /usr/include/GL/gl.h > /usr/include/GL/gl_mangle.h > /usr/include/GL/glcorearb.h > /usr/include/GL/glext.h > /usr/include/GL/interal/dri_interface.h > /usr/include/GL/mesa_glinterop.h > /usr/include/GL/osmesa.h > /usr/include/GL/wglext.h > /usr/lib/libGL.la > /usr/lib/libGL.so > /usr/lib/pkgconfig/gl.pc > > After that CMake configuration completed. > > In the CMakeCache.txt I found out that VTK_HAS_EGL was set to OFF. I > turned it ON. > Then cmake complained about not finding EGL. So I had to manually set > > EGL_INCLUDE_DIR=/usr/include/EGL > EGL_LIBRARY=/usr/lib/libEGL.so > EGL_opengl_LIBRARY=/usr/lib/libGLESv2.so > > Compiling and installing works fine, but when I run the Sphere example it > returns the error: > > ~# ./Sphere > libGL error: unable to load driver: xilinx_drm_dri.so > libGL error: driver pointer missing > libGL error: failed to load driver: xilinx_drm > ERROR: In > /home/root/Downloads/VTK-8.1.1/Rendering/OpenGL/vtkOpenGLRenderWindow.cxx, > line 785 > vtkXOpenGLRenderWindow (0x25503fc0): GLEW could not be initialized. > > Segmentation fault > > How can I build for OpenGL ES 2.0 only? > > Correct me but I think there's something wrong when I have to install > OpenGL with the libgl-mesa-dev package. Also GLEW is for Desktop OpenGL > only? > > -- > Viele Gr??e / Best regards / Sinc?res > > salutations > > Konrad Ley > > System Engineer Software > Comfort and Driving Assistance Systems (CDA) > Driving Assistance Research (DAR) > Site Kronach > Hummendorfer Str. 72 > 96317 Kronach > > Phone: > E-Mail: konrad.ley at valeo.com > > Valeo Schalter und Sensoren GmbH > Laiernstrasse 12 > 74321 Bietigheim-Bissingen, > Sitz der Gesellschaft: 74321 Bietigheim-Bissingen > Handelsregister: Amtsgericht Stuttgart - HRB 301795 > Vorsitzender des Aufsichtsrates: Derrick Zechmair > Gesch?ftsf?hrer: Jens H?lker, Martin Mandry, Stiv Michael Smudja, Pierre-Yves > Veltois > > *This e-mail message is intended only for the use of the intended recipient(s). > The information contained therein may be confidential or privileged, > and its disclosure or reproduction is strictly prohibited. > If you are not the intended recipient, please return it immediately to its sender > at the above address and destroy it. * > > > *This e-mail message is intended for the internal use of the intended recipient(s) only. > The information contained herein is confidential/privileged. Its disclosure or reproduction is strictly prohibited. > If you are not the intended recipient, please inform the sender immediately, do not disclose it internally or to third parties and destroy it.* > > _______________________________________________ > 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 Thu Jul 5 09:53:26 2018 From: aron.helser at kitware.com (Aron Helser) Date: Thu, 5 Jul 2018 09:53:26 -0400 Subject: [vtkusers] How do I label points in 3d space with arbitrary strings? In-Reply-To: References: Message-ID: FieldData is what you want. Essentially, you add a 'field' to your dataset, with an entry for each point, that contains the string you want to display. This example https://github.com/Kitware/VTK/blob/master/Examples/DataManipulation/Python/Arrays.py shows one way to add scalar data to a polydata, but I'm not sure it's what you want - I'm sure there's an appropriate example somewhere :) HTH, Aron On Thu, Jul 5, 2018 at 6:11 AM J. wrote: > I have some particles moving around in 3d space, and I want to draw labels > next to them that can display arbitrary data. The behavior in this example > seems like what I need: > > > https://github.com/Kitware/VTK/blob/master/Examples/Annotation/Python/labeledMesh.py > > I tried having a look at vtkLabeledDataMapper, but I don't see any way to > tell it what to display. It just seems to automatically display... > coordinates? Or "field data", whatever that is? In any case I couldn't see > any way to just directly assign strings to point IDs or something like > that. Is this not the right class for the job? How can I get the behavior > I'm looking for? > _______________________________________________ > 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 babybishops at gmail.com Fri Jul 6 04:09:55 2018 From: babybishops at gmail.com (J.) Date: Fri, 6 Jul 2018 09:09:55 +0100 Subject: [vtkusers] How can I plot a Hedgehog with programmatically-built data? (Python) Message-ID: I'd like to draw a Hedgehog plot in Python. I had a look at this example: https://lorensen.github.io/VTKExamples/site/Python/Visualization/ComplexV/ But unfortunately the data for the plot there is just read from a file, "carotid.vtk" (a file which, by the way, I can't find anywhere on the Internet - maybe a download a link could be added to the examples page?). Thus it's quite opaque exactly how this data needs to be presented. I've been trying to guess my way to success by looking at some C code I found, but I'm not getting any joy. Say I have a 2-dimensional python array of python 3-tuples representing the values of a vector field at each point of a regular 3d grid. What steps do I take to plot that as a hedgehog? -------------- next part -------------- An HTML attachment was scrubbed... URL: From aron.helser at kitware.com Fri Jul 6 10:21:55 2018 From: aron.helser at kitware.com (Aron Helser) Date: Fri, 6 Jul 2018 10:21:55 -0400 Subject: [vtkusers] How can I plot a Hedgehog with programmatically-built data? (Python) In-Reply-To: References: Message-ID: If you build VTK, with testing or with examples, the data files end up in the build directory. It's a binary file ~2.5Mb, or I'd attach it. The example uses vtkStructuredPointsReader to read the file, then vtkPolyDataMapper , tells you carotid is probably a PolyData, so you can look for examples of constructing that. The example of exchanging data with Numpy arrays might be helpful. HTH, Aron On Fri, Jul 6, 2018 at 4:10 AM J. wrote: > I'd like to draw a Hedgehog plot in Python. I had a look at this example: > > https://lorensen.github.io/VTKExamples/site/Python/Visualization/ComplexV/ > > But unfortunately the data for the plot there is just read from a file, > "carotid.vtk" (a file which, by the way, I can't find anywhere on the > Internet - maybe a download a link could be added to the examples page?). > Thus it's quite opaque exactly how this data needs to be presented. I've > been trying to guess my way to success by looking at some C code I found, > but I'm not getting any joy. > > Say I have a 2-dimensional python array of python 3-tuples representing > the values of a vector field at each point of a regular 3d grid. What steps > do I take to plot that as a hedgehog? > _______________________________________________ > 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 andrew.amaclean at gmail.com Fri Jul 6 19:40:16 2018 From: andrew.amaclean at gmail.com (Andrew Maclean) Date: Sat, 7 Jul 2018 09:40:16 +1000 Subject: [vtkusers] How can I plot a Hedgehog with programmatically-built data? Message-ID: The best way to get the data is to check out VTKExamples as detailed here. Once you have done this the data files can be found in VTKExamples/src/Testing/Data. If you are a Python user I have usually created a function: *get_program_parameters()*. This function tells you the data file used and any parameters needed. In the case of the Cxx code you will usually find code like this: if (argc < 2) { std::cout << "Usage: " << argv[0] << " carotid.vtk" << std::endl; return EXIT_SUCCESS; } Alternatively, look at the CMakeLists.txt file in the directory where the Cxx code lives. For the Cxx equivalent of the Python example you used, it is in VTKExamples/Visualization. If you look at the CMakeLists.txt file there you will find a line: ------ add_test(${KIT}-ComplexV ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${KIT}CxxTests TestComplexV ${DATA}/carotid.vtk) ------ Note that the paramters are also listed here e.g. in the case of CorrectlyRenderTranslucentGeometry.cxx: ------ add_test(${KIT}-CorrectlyRenderTranslucentGeometry ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${KIT}CxxTests TestCorrectlyRenderTranslucentGeometry 100 100 50 0.1 0 0) ------ Regards Andrew ---------- Forwarded message ---------- > From: > ?? > Aron Helser > To: Jack Eiler > Cc: vtkusers at public.kitware.com > Bcc: > Date: Fri, 6 Jul 2018 10:21:55 -0400 > Subject: Re: [vtkusers] How can I plot a Hedgehog with > programmatically-built data? (Python) > If you build VTK, with testing or with examples, the data files end up in > the build directory. It's a binary file ~2.5Mb, or I'd attach it. > The example uses vtkStructuredPointsReader to read the file, then > vtkPolyDataMapper , tells you carotid is probably a PolyData, so you can > look for examples of constructing that. The example of exchanging data with > Numpy arrays might be helpful. > HTH, > Aron > > > On Fri, Jul 6, 2018 at 4:10 AM J. wrote: > >> I'd like to draw a Hedgehog plot in Python. I had a look at this example: >> >> https://lorensen.github.io/VTKExamples/site/Python/Visualization/ComplexV/ >> >> But unfortunately the data for the plot there is just read from a file, >> "carotid.vtk" (a file which, by the way, I can't find anywhere on the >> Internet - maybe a download a link could be added to the examples page?). >> Thus it's quite opaque exactly how this data needs to be presented. I've >> been trying to guess my way to success by looking at some C code I found, >> but I'm not getting any joy. >> >> Say I have a 2-dimensional python array of python 3-tuples representing >> the values of a vector field at each point of a regular 3d grid. What steps >> do I take to plot that as a hedgehog? >> > -- ___________________________________________ Andrew J. P. Maclean ___________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrewkeeling at hotmail.com Sat Jul 7 03:15:09 2018 From: andrewkeeling at hotmail.com (andyjk) Date: Sat, 7 Jul 2018 00:15:09 -0700 (MST) Subject: [vtkusers] Trouble using VTK Widget with QVTK In-Reply-To: <1530797942431-0.post@n5.nabble.com> References: <1402238646023-5727389.post@n5.nabble.com> <1530779026665-0.post@n5.nabble.com> <1530781602796-0.post@n5.nabble.com> <1530785600603-0.post@n5.nabble.com> <1530797942431-0.post@n5.nabble.com> Message-ID: <1530947709341-0.post@n5.nabble.com> I'm still having no luck and suspect this is a bug in VTK, when using QVTKOpenGLWidget. The full QT mainwindow.cpp code is pasted below with the various lines that don't work in comments. I've tried every combination and nothing worked - how do I report this as a bug ? Thanks! #include "mainwindow.h" #include "build/ui_mainwindow.h" #include #include "vtkSmartPointer.h" #include "vtkActor.h" #include "vtkCamera.h" #include "vtkCellArray.h" #include "vtkImageDataGeometryFilter.h" #include "vtkPoints.h" #include "vtkPolyData.h" #include "vtkPolyDataCollection.h" #include "vtkPolyDataMapper.h" #include "vtkProperty.h" #include "vtkRenderWindow.h" #include "vtkRenderWindowInteractor.h" #include "vtkRenderer.h" #include "vtkSphereSource.h" #include "vtkTriangleFilter.h" #include #include "vtkContourWidget.h" #include "vtkOrientedGlyphContourRepresentation.h" #include "vtkPolygonalSurfacePointPlacer.h" #include "vtkPolygonalSurfaceContourLineInterpolator.h" #include #include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); vtkSmartPointer polyData; vtkSmartPointer sphereSource = vtkSmartPointer::New(); sphereSource->SetThetaResolution(40); sphereSource->SetPhiResolution(20); sphereSource->Update(); polyData = sphereSource->GetOutput(); // The Dijkistra interpolator will not accept cells that aren't triangles vtkSmartPointer triangleFilter = vtkSmartPointer::New(); #if VTK_MAJOR_VERSION <= 5 triangleFilter->SetInput(polyData); #else triangleFilter->SetInputData(polyData); #endif triangleFilter->Update(); vtkSmartPointer pd = triangleFilter->GetOutput(); //Create a mapper and actor vtkSmartPointer mapper = vtkSmartPointer::New(); mapper->SetInputConnection(triangleFilter->GetOutputPort()); vtkSmartPointer actor = vtkSmartPointer::New(); actor->SetMapper(mapper); actor->GetProperty()->SetInterpolationToFlat(); // Create the render window, renderer and interactor. vtkSmartPointer renderer = vtkSmartPointer::New(); ///////////////////////////////////////////////////////////////////////////////////////////////////// // OPTION 1: Use this for a plain non-QT VTK window. The Polygonalsurfaceinteractor works fine //vtkSmartPointer renderWindow = vtkSmartPointer::New(); // OPTION 2: ....but if we use this instead and set the renderwindow of the qvtkOpenGL widget to this, the polygonalsurfaceintaeractor does not work // although at least the sphere displays. We cannot move the camera though // Remember to comment out the interactor->Start() line at the bottom of the code, or everything freezes with no display! //vtkNew renderWindow; vtkSmartPointer renderWindow = ui->widget->GetRenderWindow(); ///////////////////////////////////////////////////////////////////////////////////////////////////// ui->widget->GetRenderWindow()->AddRenderer(renderer); ui->widget->GetRenderWindow()->Render(); ui->widget->update(); ///////////////////////////////////////////////////////////////////////////////////////////////////// // OPTION A: If we grab the interactor from the QVTKOpenGL widget, then at least we can move the camera around, but we cannot use the polygonalsurface placer vtkSmartPointer interactor = ui->widget->GetInteractor(); // OPTION B: .....alternatively, if we set a new interactor and try to use QVTKOpenGL, no interaction is possible. // Note We must set a new interactor if we are using the pure non-QT VTK window (OPTION 1 above) //vtkSmartPointer interactor = vtkSmartPointer::New(); ///////////////////////////////////////////////////////////////////////////////////////////////////// //interactor->SetRenderWindow(ui->widget->GetRenderWindow()); // Add the actors to the renderer, set the background and size renderer->AddActor(actor); renderer->SetBackground(.3, .4, .5); renderer->ResetCamera(); // Here comes the contour widget stuff... vtkSmartPointer contourWidget = vtkSmartPointer::New(); contourWidget->SetInteractor(interactor); vtkSmartPointer rep = vtkOrientedGlyphContourRepresentation::SafeDownCast( contourWidget->GetRepresentation()); rep->GetLinesProperty()->SetColor(1, 0.2, 0); rep->GetLinesProperty()->SetLineWidth(3.0); vtkSmartPointer pointPlacer = vtkSmartPointer::New(); pointPlacer->AddProp(actor); pointPlacer->GetPolys()->AddItem(pd); rep->SetPointPlacer(pointPlacer); vtkSmartPointer interpolator = vtkSmartPointer::New(); interpolator->GetPolys()->AddItem(pd); rep->SetLineInterpolator(interpolator); //renderWindow->Render(); //interactor->Initialize(); contourWidget->EnabledOn(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // OPTION 1: We have to uncomment this for the pure VTK version // OPTION 2: ....But comment it out if using the QVTKOpenGL Widget, otherwise everything freezes with no rendering //interactor->Start(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } MainWindow::~MainWindow() { delete ui; } -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From nztoddler at yahoo.com Sat Jul 7 20:42:08 2018 From: nztoddler at yahoo.com (Todd Martin) Date: Sun, 8 Jul 2018 00:42:08 +0000 (UTC) Subject: [vtkusers] Trouble using VTK Widget with QVTK In-Reply-To: <1530947709341-0.post@n5.nabble.com> References: <1402238646023-5727389.post@n5.nabble.com> <1530779026665-0.post@n5.nabble.com> <1530781602796-0.post@n5.nabble.com> <1530785600603-0.post@n5.nabble.com> <1530797942431-0.post@n5.nabble.com> <1530947709341-0.post@n5.nabble.com> Message-ID: <1842077504.715103.1531010528616@mail.yahoo.com> Have you checked the class of the renderWindow object in comparison with ui->widget->GetRenderWindow()? ///////////////////////////////////////////////////////////////////////////////////////////////////// ??? // OPTION 1: Use this for a plain non-QT VTK window. The Polygonalsurfaceinteractor works fine ??? //vtkSmartPointer renderWindow = vtkSmartPointer::New(); Have you tried vtkSmartPointer renderWindow = vtkSmartPointer::New(); ui->widget->SetRenderWindow(renderWindow); Todd -- 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 nztoddler at yahoo.com Sat Jul 7 20:45:38 2018 From: nztoddler at yahoo.com (Todd Martin) Date: Sun, 8 Jul 2018 00:45:38 +0000 (UTC) Subject: [vtkusers] Trouble using VTK Widget with QVTK In-Reply-To: <1842077504.715103.1531010528616@mail.yahoo.com> References: <1402238646023-5727389.post@n5.nabble.com> <1530779026665-0.post@n5.nabble.com> <1530781602796-0.post@n5.nabble.com> <1530785600603-0.post@n5.nabble.com> <1530797942431-0.post@n5.nabble.com> <1530947709341-0.post@n5.nabble.com> <1842077504.715103.1531010528616@mail.yahoo.com> Message-ID: <955714104.694844.1531010738511@mail.yahoo.com> ///////////////////////////////////////////////////////////////////////////////////////////////////// ??? // OPTION 1: Use this for a plain non-QT VTK window. The Polygonalsurfaceinteractor works fine ??? //vtkSmartPointer renderWindow = vtkSmartPointer::New(); Have you checked the class of the renderWindow object in comparison with ui->widget->GetRenderWindow()? Have you tried vtkSmartPointer renderWindow = vtkSmartPointer::New(); ui->widget->SetRenderWindow(renderWindow); Todd -- 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 andrewkeeling at hotmail.com Sun Jul 8 04:36:47 2018 From: andrewkeeling at hotmail.com (andyjk) Date: Sun, 8 Jul 2018 01:36:47 -0700 (MST) Subject: [vtkusers] Trouble using VTK Widget with QVTK In-Reply-To: <955714104.694844.1531010738511@mail.yahoo.com> References: <1402238646023-5727389.post@n5.nabble.com> <1530779026665-0.post@n5.nabble.com> <1530781602796-0.post@n5.nabble.com> <1530785600603-0.post@n5.nabble.com> <1530797942431-0.post@n5.nabble.com> <1530947709341-0.post@n5.nabble.com> <1842077504.715103.1531010528616@mail.yahoo.com> <955714104.694844.1531010738511@mail.yahoo.com> Message-ID: <1531039007599-0.post@n5.nabble.com> Thanks I tried: vtkSmartPointer renderWindow = vtkSmartPointer::New(); ui->widget->SetRenderWindow(renderWindow); This compiles OK, but when I run, it immediately gives the error: QVTKOpenGLWidget requires a `vtkGenericOpenGLRenderWindow`. ` vtkWin32OpenGLRenderWindow ` is not supported. because I presume this is the wrong type. Strangely, vtkSmartPointer renderWindow = ui->widget->GetRenderWindow(); is allowed, and runs - though it fails to render because I think the context is wrong (ie in main.cpp I have the line QSurfaceFormat::setDefaultFormat(QVTKOpenGLWidget::defaultFormat()); which allows me to render in the QVTKpenGLWidget However, vtkNew renderWindow = ui->widget->GetRenderWindow() is not allowed by the compiler - telling me that GetRenderWindow() is expecting a vtkRenderWindow, not an OpenGL one. So it seems I can create a new OpenGL RenderWindow and set the widget Window to this : vtkNew renderWindow; ui->widget->SetRenderWindow(renderWindow); and this gives be the sphere on screen, moveable mouse, but no contour widget. But I can't grab the existing render window from the widget, because vtkSmartPointer renderWindow = ui->widget->GetRenderWindow(); compiles, but fails at runtime (I think due to the mismatch between a vtkRenderWindow and an OpenGL one), and vtkNew renderWindow = ui->widget->GetRenderWindow() will not compile because of the perceived type mismatch. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From nztoddler at yahoo.com Sun Jul 8 04:55:06 2018 From: nztoddler at yahoo.com (Todd) Date: Sun, 08 Jul 2018 20:55:06 +1200 Subject: [vtkusers] Trouble using VTK Widget with QVTK In-Reply-To: <1531039007599-0.post@n5.nabble.com> Message-ID: An HTML attachment was scrubbed... URL: From andrewkeeling at hotmail.com Sun Jul 8 05:09:35 2018 From: andrewkeeling at hotmail.com (andyjk) Date: Sun, 8 Jul 2018 02:09:35 -0700 (MST) Subject: [vtkusers] Trouble using VTK Widget with QVTK In-Reply-To: References: <1530781602796-0.post@n5.nabble.com> <1530785600603-0.post@n5.nabble.com> <1530797942431-0.post@n5.nabble.com> <1530947709341-0.post@n5.nabble.com> <1842077504.715103.1531010528616@mail.yahoo.com> <955714104.694844.1531010738511@mail.yahoo.com> <1531039007599-0.post@n5.nabble.com> Message-ID: <1531040975040-0.post@n5.nabble.com> Thanks again We're getting to the edge of my knowledge, I'm afraid! I can do vtkNew renderWindow; ui->widget->SetRenderWindow(vtkRenderWindow::SafeDownCast(renderWindow)); and this runs (displays sphere, allows me to move it, but no contour widget still). It seems to be no different from: vtkNew renderWindow; ui->widget->SetRenderWindow(renderWindow); If I try to grab the existing widget window (I think this is casting???): vtkSmartPointer renderWindow = vtkGenericOpenGLRenderWindow::SafeDownCast(ui->widget->GetRenderWindow()); it compiles but I don't even see a renderwindow when I run the code, the executable just closes gracefully. I am not sure about breakpoints, I'm afraid. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From nztoddler at yahoo.com Sun Jul 8 05:56:38 2018 From: nztoddler at yahoo.com (Todd) Date: Sun, 08 Jul 2018 21:56:38 +1200 Subject: [vtkusers] Trouble using VTK Widget with QVTK In-Reply-To: <1531040975040-0.post@n5.nabble.com> Message-ID: <338d35ff-973c-4d84-8c40-4083d91f8b6a@email.android.com> An HTML attachment was scrubbed... URL: From andrewkeeling at hotmail.com Sun Jul 8 06:34:48 2018 From: andrewkeeling at hotmail.com (andyjk) Date: Sun, 8 Jul 2018 03:34:48 -0700 (MST) Subject: [vtkusers] Trouble using VTK Widget with QVTK In-Reply-To: <338d35ff-973c-4d84-8c40-4083d91f8b6a@email.android.com> References: <1530785600603-0.post@n5.nabble.com> <1530797942431-0.post@n5.nabble.com> <1530947709341-0.post@n5.nabble.com> <1842077504.715103.1531010528616@mail.yahoo.com> <955714104.694844.1531010738511@mail.yahoo.com> <1531039007599-0.post@n5.nabble.com> <1531040975040-0.post@n5.nabble.com> <338d35ff-973c-4d84-8c40-4083d91f8b6a@email.android.com> Message-ID: <1531046088196-0.post@n5.nabble.com> Thanks again for the advice, Todd. Yes - I do need to delve a bit deeper re debugging. I thought vtkNew<...>, and vtksmartPointer<...>::New() both create instances (the former being the preferred method now?) To check, I tried both: vtkNew renderWindow; and vtkSmartPointer renderWindow = vtkSmartPointer::New(); (then ui->widget->SetRenderWindow(renderWindow); in both instances) Both work and produce the rendered sphere, but no contour widget. So I think the assignment is happening identically with either method. I also did the following, with two breakpoints (before and after the safe down cast): vtkSmartPointer vtkrenderWindow = vtkSmartPointer::New(); vtkSmartPointer renderWindow = vtkGenericOpenGLRenderWindow::SafeDownCast(vtkrenderWindow); ui->widget->SetRenderWindow(renderWindow); I notice that the vtkrenderwindow gets a valid pointer, and seems to be reading from vtkRenderingOpenGL2-8.1.dll - so is presumably already something opengl based ? At the subsequent break point (so after the line vtkSmartPointer renderWindow = vtkGenericOpenGLRenderWindow::SafeDownCast(vtkrenderWindow); ) I notice that the renderWindow pointer is still NULL. So the SafeDownCast seems to fail -but of course I can bypass this line by just doing vtkSmartPointer renderWindow = vtkSmartPointer::New(); ui->widget->SetRenderWindow(renderWindow); which seems to render fine but ignores the contour widget. Frustrating! But thanks for your help anyway. Andy -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From rccm.kyoshimi at gmail.com Sun Jul 8 21:10:38 2018 From: rccm.kyoshimi at gmail.com (kenichiro yoshimi) Date: Mon, 9 Jul 2018 10:10:38 +0900 Subject: [vtkusers] Trouble using VTK Widget with QVTK In-Reply-To: <1531046088196-0.post@n5.nabble.com> References: <1530785600603-0.post@n5.nabble.com> <1530797942431-0.post@n5.nabble.com> <1530947709341-0.post@n5.nabble.com> <1842077504.715103.1531010528616@mail.yahoo.com> <955714104.694844.1531010738511@mail.yahoo.com> <1531039007599-0.post@n5.nabble.com> <1531040975040-0.post@n5.nabble.com> <338d35ff-973c-4d84-8c40-4083d91f8b6a@email.android.com> <1531046088196-0.post@n5.nabble.com> Message-ID: Hi, How about you replace the macros in the following way in CMakeLists.txt? QT4_WRAP_CPP -> QT5_WRAP_CPP QT4_WRAP_UI -> QT5_WRAP_UI Best 2018?7?8?(?) 19:35 andyjk : > > Thanks again for the advice, Todd. > > Yes - I do need to delve a bit deeper re debugging. > > I thought vtkNew<...>, and vtksmartPointer<...>::New() both create instances > (the former being the preferred method now?) > > To check, I tried both: > vtkNew renderWindow; > > > and > > vtkSmartPointer renderWindow = > vtkSmartPointer::New(); > > (then ui->widget->SetRenderWindow(renderWindow); in both instances) > > Both work and produce the rendered sphere, but no contour widget. So I think > the assignment is happening identically with either method. > > I also did the following, with two breakpoints (before and after the safe > down cast): > > vtkSmartPointer vtkrenderWindow = > vtkSmartPointer::New(); > vtkSmartPointer renderWindow = > vtkGenericOpenGLRenderWindow::SafeDownCast(vtkrenderWindow); > > ui->widget->SetRenderWindow(renderWindow); > > I notice that the vtkrenderwindow gets a valid pointer, and seems to be > reading from vtkRenderingOpenGL2-8.1.dll - so is presumably already > something opengl based ? > > At the subsequent break point (so after the line > vtkSmartPointer renderWindow = > vtkGenericOpenGLRenderWindow::SafeDownCast(vtkrenderWindow); ) I notice that > the renderWindow pointer is still NULL. > > So the SafeDownCast seems to fail -but of course I can bypass this line by > just doing > vtkSmartPointer renderWindow = > vtkSmartPointer::New(); > ui->widget->SetRenderWindow(renderWindow); > > which seems to render fine but ignores the contour widget. > > Frustrating! But thanks for your help anyway. > > Andy > > > > > > > > > -- > 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 A.Buykx at dianafea.com Mon Jul 9 03:42:27 2018 From: A.Buykx at dianafea.com (Andreas Buykx) Date: Mon, 9 Jul 2018 07:42:27 +0000 Subject: [vtkusers] offscreen rendering from gui application in vtk8/opengl2 Message-ID: <0004f04295b246e3887f71b0d18f612c@dianafea.com> We recently switched our FEA application from vtk7.1 and the OpenGL backend to using 8.1 and the new OpenGL2 backend. With 7.1 we could make off-screen images from the gui application using a temporary off-screen render window, temporarily moving renderers from the GUI render window to the off-screen render window, render the image and then move all renderers back to the GUI render window. With vtk8.1 and OpenGL2 this causes OpenGL errors. I reproduced this with the attached script which on vtk8.1.1 and the current head leads to an openGL error: ERROR: In path-to/VTK-master/Rendering/OpenGL2/vtkOpenGLPolyDataMapper.cxx, line 1814 vtkOpenGLPolyDataMapper (0x273dc00): failed after UpdateShader 1 OpenGL errors detected 0 : (1282) Invalid operation When the script is run with a global off-screen render window things work out fine. Is my approach wrong (temporary render window, moving renderers to it temporarily) or is this a bug? Thanks for your help! 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: -------------- next part -------------- A non-text attachment was scrubbed... Name: writetopng.py Type: application/octet-stream Size: 1872 bytes Desc: writetopng.py URL: From babybishops at gmail.com Mon Jul 9 07:08:07 2018 From: babybishops at gmail.com (J.) Date: Mon, 9 Jul 2018 12:08:07 +0100 Subject: [vtkusers] 'vtkCommonCorePython.vtkCallbackCommand' object has no attribute 'SetCallback' Message-ID: According to the tutorials and example code, you can create a vtkCallbackCommand() object and then call SetCallback on it with a callback function, as in: vtkSmartPointer keypressCallback = vtkSmartPointer::New(); keypressCallback->SetCallback ( func ); However, when I try this with Python, I get* 'vtkCommonCorePython.vtkCallbackCommand' object has no attribute 'SetCallback'*. I'm using vtk 8: def onClick(): print("Hello, World!") onClickCallback = vtk.vtkCallbackCommand() onClickCallback.SetCallback(onClick) -------------- next part -------------- An HTML attachment was scrubbed... URL: From pbergeron at spiria.com Mon Jul 9 07:14:43 2018 From: pbergeron at spiria.com (Patrick Bergeron) Date: Mon, 9 Jul 2018 11:14:43 +0000 Subject: [vtkusers] offscreen rendering from gui application in vtk8/opengl2 In-Reply-To: <0004f04295b246e3887f71b0d18f612c@dianafea.com> References: <0004f04295b246e3887f71b0d18f612c@dianafea.com> Message-ID: Hi Andreas, The actors and mappers use OpenGL resources that belong to an OpenGL context, but not all can be shared across multiple OpenGL contexts, especially if one context is software OpenGL (mesaGL?) and the other is not. Maybe VTK should have a way to clone the renderer and all its contents to do this automatically, or find a way to share shaders across contexts too... For now here is my recommendation, re-create your scene. - Create a new render window - Create a new renderer - Get all actors in the renderer, and for each actor: - Create a new actor - Create a new mapper - Set the new mapper to the new actor - Get the input connection source of the mapper and set it to the new mapper - Copy the actor's rendering property to the new actor - Set the user transform of the old actor to the new actor. Set the active camera from y9our old renderer to new renderer Copy the lights too if necessary I think that is it! ________________________________ From: vtkusers on behalf of Andreas Buykx Sent: July 9, 2018 3:42:27 AM To: 'vtkusers at public.kitware.com' Subject: [vtkusers] offscreen rendering from gui application in vtk8/opengl2 We recently switched our FEA application from vtk7.1 and the OpenGL backend to using 8.1 and the new OpenGL2 backend. With 7.1 we could make off-screen images from the gui application using a temporary off-screen render window, temporarily moving renderers from the GUI render window to the off-screen render window, render the image and then move all renderers back to the GUI render window. With vtk8.1 and OpenGL2 this causes OpenGL errors. I reproduced this with the attached script which on vtk8.1.1 and the current head leads to an openGL error: ERROR: In path-to/VTK-master/Rendering/OpenGL2/vtkOpenGLPolyDataMapper.cxx, line 1814 vtkOpenGLPolyDataMapper (0x273dc00): failed after UpdateShader 1 OpenGL errors detected 0 : (1282) Invalid operation When the script is run with a global off-screen render window things work out fine. Is my approach wrong (temporary render window, moving renderers to it temporarily) or is this a bug? Thanks for your help! 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 A.Buykx at dianafea.com Mon Jul 9 07:22:55 2018 From: A.Buykx at dianafea.com (Andreas Buykx) Date: Mon, 9 Jul 2018 11:22:55 +0000 Subject: [vtkusers] offscreen rendering from gui application in vtk8/opengl2 In-Reply-To: References: <0004f04295b246e3887f71b0d18f612c@dianafea.com> Message-ID: <3641545f6b884d67a8396101837cc718@dianafea.com> I had hoped I would not get this advice as it's rather painful : we have heaps of actors and mappers with associated properties. This used to work before, was that a lucky accident? From: Patrick Bergeron Sent: maandag 9 juli 2018 1:15 To: Andreas Buykx ; 'vtkusers at public.kitware.com' Subject: Re: offscreen rendering from gui application in vtk8/opengl2 Hi Andreas, The actors and mappers use OpenGL resources that belong to an OpenGL context, but not all can be shared across multiple OpenGL contexts, especially if one context is software OpenGL (mesaGL?) and the other is not. Maybe VTK should have a way to clone the renderer and all its contents to do this automatically, or find a way to share shaders across contexts too... For now here is my recommendation, re-create your scene. - Create a new render window - Create a new renderer - Get all actors in the renderer, and for each actor: - Create a new actor - Create a new mapper - Set the new mapper to the new actor - Get the input connection source of the mapper and set it to the new mapper - Copy the actor's rendering property to the new actor - Set the user transform of the old actor to the new actor. Set the active camera from y9our old renderer to new renderer Copy the lights too if necessary I think that is it! ________________________________ From: vtkusers > on behalf of Andreas Buykx > Sent: July 9, 2018 3:42:27 AM To: 'vtkusers at public.kitware.com' Subject: [vtkusers] offscreen rendering from gui application in vtk8/opengl2 We recently switched our FEA application from vtk7.1 and the OpenGL backend to using 8.1 and the new OpenGL2 backend. With 7.1 we could make off-screen images from the gui application using a temporary off-screen render window, temporarily moving renderers from the GUI render window to the off-screen render window, render the image and then move all renderers back to the GUI render window. With vtk8.1 and OpenGL2 this causes OpenGL errors. I reproduced this with the attached script which on vtk8.1.1 and the current head leads to an openGL error: ERROR: In path-to/VTK-master/Rendering/OpenGL2/vtkOpenGLPolyDataMapper.cxx, line 1814 vtkOpenGLPolyDataMapper (0x273dc00): failed after UpdateShader 1 OpenGL errors detected 0 : (1282) Invalid operation When the script is run with a global off-screen render window things work out fine. Is my approach wrong (temporary render window, moving renderers to it temporarily) or is this a bug? Thanks for your help! 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 pbergeron at spiria.com Mon Jul 9 07:38:53 2018 From: pbergeron at spiria.com (Patrick Bergeron) Date: Mon, 9 Jul 2018 11:38:53 +0000 Subject: [vtkusers] offscreen rendering from gui application in vtk8/opengl2 In-Reply-To: <3641545f6b884d67a8396101837cc718@dianafea.com> References: <0004f04295b246e3887f71b0d18f612c@dianafea.com> , <3641545f6b884d67a8396101837cc718@dianafea.com> Message-ID: The new OpenGL backend simply works differently than before. The other thing you can try is to debug vtk to try to detect a context change and to re-initialize the graphics resources. So when you switch Graphics contexts, they get destroyed and re created. You may try this with shaders first since it is your immediate problem. But I might expect you?d have to do it with textures too at least. Another way to get around it is to render into a different render target and read the contents of the image (if you can do with the same rendered size) by using a frame buffer object. Sent from my iPhone On Jul 9, 2018, at 07:23, Andreas Buykx > wrote: I had hoped I would not get this advice as it?s rather painful : we have heaps of actors and mappers with associated properties. This used to work before, was that a lucky accident? From: Patrick Bergeron > Sent: maandag 9 juli 2018 1:15 To: Andreas Buykx >; 'vtkusers at public.kitware.com' > Subject: Re: offscreen rendering from gui application in vtk8/opengl2 Hi Andreas, The actors and mappers use OpenGL resources that belong to an OpenGL context, but not all can be shared across multiple OpenGL contexts, especially if one context is software OpenGL (mesaGL?) and the other is not. Maybe VTK should have a way to clone the renderer and all its contents to do this automatically, or find a way to share shaders across contexts too... For now here is my recommendation, re-create your scene. - Create a new render window - Create a new renderer - Get all actors in the renderer, and for each actor: - Create a new actor - Create a new mapper - Set the new mapper to the new actor - Get the input connection source of the mapper and set it to the new mapper - Copy the actor's rendering property to the new actor - Set the user transform of the old actor to the new actor. Set the active camera from y9our old renderer to new renderer Copy the lights too if necessary I think that is it! ________________________________ From: vtkusers > on behalf of Andreas Buykx > Sent: July 9, 2018 3:42:27 AM To: 'vtkusers at public.kitware.com' Subject: [vtkusers] offscreen rendering from gui application in vtk8/opengl2 We recently switched our FEA application from vtk7.1 and the OpenGL backend to using 8.1 and the new OpenGL2 backend. With 7.1 we could make off-screen images from the gui application using a temporary off-screen render window, temporarily moving renderers from the GUI render window to the off-screen render window, render the image and then move all renderers back to the GUI render window. With vtk8.1 and OpenGL2 this causes OpenGL errors. I reproduced this with the attached script which on vtk8.1.1 and the current head leads to an openGL error: ERROR: In path-to/VTK-master/Rendering/OpenGL2/vtkOpenGLPolyDataMapper.cxx, line 1814 vtkOpenGLPolyDataMapper (0x273dc00): failed after UpdateShader 1 OpenGL errors detected 0 : (1282) Invalid operation When the script is run with a global off-screen render window things work out fine. Is my approach wrong (temporary render window, moving renderers to it temporarily) or is this a bug? Thanks for your help! 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 ken.martin at kitware.com Mon Jul 9 08:25:06 2018 From: ken.martin at kitware.com (Ken Martin) Date: Mon, 9 Jul 2018 08:25:06 -0400 Subject: [vtkusers] offscreen rendering from gui application in vtk8/opengl2 In-Reply-To: References: <0004f04295b246e3887f71b0d18f612c@dianafea.com> <3641545f6b884d67a8396101837cc718@dianafea.com> Message-ID: Another option might be to try switching to offscreen on your main render window then switching it back to onscreen. I think the method is SetUseOffscreenBuffers. Then you don't have to copy any actors etc. That might do the trick for you. On Mon, Jul 9, 2018 at 7:38 AM, Patrick Bergeron wrote: > The new OpenGL backend simply works differently than before. > > The other thing you can try is to debug vtk to try to detect a context > change and to re-initialize the graphics resources. > > So when you switch Graphics contexts, they get destroyed and re created. > > You may try this with shaders first since it is your immediate problem. > But I might expect you?d have to do it with textures too at least. > > Another way to get around it is to render into a different render target > and read the contents of the image (if you can do with the same rendered > size) by using a frame buffer object. > > > Sent from my iPhone > > On Jul 9, 2018, at 07:23, Andreas Buykx wrote: > > I had hoped I would not get this advice as it?s rather painful : we have > heaps of actors and mappers with associated properties. > > This used to work before, was that a lucky accident? > > > > > > *From:* Patrick Bergeron > *Sent:* maandag 9 juli 2018 1:15 > *To:* Andreas Buykx ; 'vtkusers at public.kitware.com' > > *Subject:* Re: offscreen rendering from gui application in vtk8/opengl2 > > > > Hi Andreas, > > > > The actors and mappers use OpenGL resources that belong to an OpenGL > context, but not all can be shared across multiple OpenGL contexts, > especially if one context is software OpenGL (mesaGL?) and the other is > not. > > > > Maybe VTK should have a way to clone the renderer and all its contents to > do this automatically, or find a way to share shaders across contexts too... > > > > > > For now here is my recommendation, re-create your scene. > > > > - Create a new render window > > - Create a new renderer > > - Get all actors in the renderer, and for each actor: > > - Create a new actor > > - Create a new mapper > > - Set the new mapper to the new actor > > - Get the input connection source of the mapper and set it to the new > mapper > > - Copy the actor's rendering property to the new actor > > - Set the user transform of the old actor to the new actor. > > > > Set the active camera from y9our old renderer to new renderer > > > > Copy the lights too if necessary > > > > I think that is it! > > > ------------------------------ > > *From:* vtkusers on behalf of > Andreas Buykx > *Sent:* July 9, 2018 3:42:27 AM > *To:* 'vtkusers at public.kitware.com' > *Subject:* [vtkusers] offscreen rendering from gui application in > vtk8/opengl2 > > > > We recently switched our FEA application from vtk7.1 and the OpenGL > backend to using 8.1 and the new OpenGL2 backend. > > > > With 7.1 we could make off-screen images from the gui application using a > *temporary* off-screen render window, temporarily moving renderers from > the GUI render window to the off-screen render window, render the image and > then move all renderers back to the GUI render window. > > With vtk8.1 and OpenGL2 this causes OpenGL errors. > > > > I reproduced this with the attached script which on vtk8.1.1 and the > current head leads to an openGL error: > > > > ERROR: In path-to/VTK-master/Rendering/OpenGL2/vtkOpenGLPolyDataMapper.cxx, > line 1814 > > vtkOpenGLPolyDataMapper (0x273dc00): failed after UpdateShader 1 OpenGL > errors detected > > 0 : (1282) Invalid operation > > > > When the script is run with a global off-screen render window things work > out fine. > > > > Is my approach wrong (temporary render window, moving renderers to it > temporarily) or is this a bug? > > > > Thanks for your help! > > > > *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 > > > > > _______________________________________________ > 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 ken.martin at kitware.com Mon Jul 9 08:54:49 2018 From: ken.martin at kitware.com (Ken Martin) Date: Mon, 9 Jul 2018 08:54:49 -0400 Subject: [vtkusers] How to use SetGeometryShaderCode In-Reply-To: References: Message-ID: Using your own shader code is a bit advanced as there are a few moving parts. If you specify geometry shader code then you also have to make sure the right uniforms/arrays are being set for that shader code. That would be my guess as to the issue with your attempt to manually specify wide lines. Maybe the code is fine but some uniforms are not properly set and so are defaulting to 0.0 etc. I agree an example of geometry replacements would be good. If you get something working let me know and I'll add it to the wiki page on custom shaders. On Wed, Jul 4, 2018 at 9:11 AM, Kumar Ashutosh wrote: > I want to add custom Geometry Shader to my mapper. From the source code, I > concluded that in vtkOpenGLPolyDataMapper we can inject custom Shader Code. > Also, the code has WideLineGS as the default Geometry Shader. I tried to > mimic the same behaviour by injecting the same code as given here > (source > code of WideLinesGS) using the function SetGeometryShaderCode. The > resulting screen is a blank screen with no errors raised. > > Can someone please guide me on how to inject Geometry Shader Code. This is > specific to Geometry Shader only as I have successfully tried with Frag > Shader and Vertex Shader. > A simple example of this would be great. > > Regards, > Kumar Ashutosh > ? > > _______________________________________________ > 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 A.Buykx at dianafea.com Mon Jul 9 09:50:55 2018 From: A.Buykx at dianafea.com (Andreas Buykx) Date: Mon, 9 Jul 2018 13:50:55 +0000 Subject: [vtkusers] offscreen rendering from gui application in vtk8/opengl2 In-Reply-To: References: <0004f04295b246e3887f71b0d18f612c@dianafea.com> <3641545f6b884d67a8396101837cc718@dianafea.com> Message-ID: <9fb4eba628724091bae687877f38f52d@dianafea.com> I tried the SetUseOffScreenBuffers approach which does work in the sense that it renders to the hardware buffers without errors (see new version of writetopng.py). Unfortunately when I want to render to a different screen size the behavior is dependent on the actual render window used: 1. using vtkpython I will briefly see the vtk viewer window resized to that size, and 2. within our QVTKOpenGLWidget the widget remains as is, which is good, but the image written contains just a fragment of the viewer window in the lower left corner, with the upper and right parts of the image solid black. Regarding Patric Bergeron?s remark about re-initializing graphics resources: I had expected this to work with my initial approach since vtkRenderWindow::RemoveRenderer calls ReleaseGraphicsResources? From: Ken Martin Sent: maandag 9 juli 2018 2:25 To: Patrick Bergeron Cc: Andreas Buykx ; vtkusers at public.kitware.com Subject: Re: [vtkusers] offscreen rendering from gui application in vtk8/opengl2 Another option might be to try switching to offscreen on your main render window then switching it back to onscreen. I think the method is SetUseOffscreenBuffers. Then you don't have to copy any actors etc. That might do the trick for you. On Mon, Jul 9, 2018 at 7:38 AM, Patrick Bergeron > wrote: The new OpenGL backend simply works differently than before. The other thing you can try is to debug vtk to try to detect a context change and to re-initialize the graphics resources. So when you switch Graphics contexts, they get destroyed and re created. You may try this with shaders first since it is your immediate problem. But I might expect you?d have to do it with textures too at least. Another way to get around it is to render into a different render target and read the contents of the image (if you can do with the same rendered size) by using a frame buffer object. Sent from my iPhone On Jul 9, 2018, at 07:23, Andreas Buykx > wrote: I had hoped I would not get this advice as it?s rather painful : we have heaps of actors and mappers with associated properties. This used to work before, was that a lucky accident? From: Patrick Bergeron > Sent: maandag 9 juli 2018 1:15 To: Andreas Buykx >; 'vtkusers at public.kitware.com' > Subject: Re: offscreen rendering from gui application in vtk8/opengl2 Hi Andreas, The actors and mappers use OpenGL resources that belong to an OpenGL context, but not all can be shared across multiple OpenGL contexts, especially if one context is software OpenGL (mesaGL?) and the other is not. Maybe VTK should have a way to clone the renderer and all its contents to do this automatically, or find a way to share shaders across contexts too... For now here is my recommendation, re-create your scene. - Create a new render window - Create a new renderer - Get all actors in the renderer, and for each actor: - Create a new actor - Create a new mapper - Set the new mapper to the new actor - Get the input connection source of the mapper and set it to the new mapper - Copy the actor's rendering property to the new actor - Set the user transform of the old actor to the new actor. Set the active camera from y9our old renderer to new renderer Copy the lights too if necessary I think that is it! ________________________________ From: vtkusers > on behalf of Andreas Buykx > Sent: July 9, 2018 3:42:27 AM To: 'vtkusers at public.kitware.com' Subject: [vtkusers] offscreen rendering from gui application in vtk8/opengl2 We recently switched our FEA application from vtk7.1 and the OpenGL backend to using 8.1 and the new OpenGL2 backend. With 7.1 we could make off-screen images from the gui application using a temporary off-screen render window, temporarily moving renderers from the GUI render window to the off-screen render window, render the image and then move all renderers back to the GUI render window. With vtk8.1 and OpenGL2 this causes OpenGL errors. I reproduced this with the attached script which on vtk8.1.1 and the current head leads to an openGL error: ERROR: In path-to/VTK-master/Rendering/OpenGL2/vtkOpenGLPolyDataMapper.cxx, line 1814 vtkOpenGLPolyDataMapper (0x273dc00): failed after UpdateShader 1 OpenGL errors detected 0 : (1282) Invalid operation When the script is run with a global off-screen render window things work out fine. Is my approach wrong (temporary render window, moving renderers to it temporarily) or is this a bug? Thanks for your help! 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 _______________________________________________ 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: -------------- next part -------------- A non-text attachment was scrubbed... Name: writetopng.py Type: application/octet-stream Size: 2380 bytes Desc: writetopng.py URL: From andrewkeeling at hotmail.com Mon Jul 9 09:56:08 2018 From: andrewkeeling at hotmail.com (andyjk) Date: Mon, 9 Jul 2018 06:56:08 -0700 (MST) Subject: [vtkusers] Trouble using VTK Widget with QVTK In-Reply-To: References: <1530797942431-0.post@n5.nabble.com> <1530947709341-0.post@n5.nabble.com> <1842077504.715103.1531010528616@mail.yahoo.com> <955714104.694844.1531010738511@mail.yahoo.com> <1531039007599-0.post@n5.nabble.com> <1531040975040-0.post@n5.nabble.com> <338d35ff-973c-4d84-8c40-4083d91f8b6a@email.android.com> <1531046088196-0.post@n5.nabble.com> Message-ID: <1531144568696-0.post@n5.nabble.com> Thanks I have tried this but it made no difference. There just seems to be no way to set a new custom iterator in a QVTKOpenGLWidget (or a QVTKWidget). I think the issue is that I can grab the existing iterator, from the QWidget but it has already been initialised, so any custom interactor that requires setting up prior to initialisation fails. The only solution if you want to use a contour widget and pointplacer, is to use a normal VTK window as a pop-up. It looks like it cannot be displayed inside QT which is a shame as this spoils the look of the UI. Not sure this is a bug, just a lack of functionality. We need a way to be able to insert our own (new) interactor into a QVTKOpenGLWidget, which completely replaces the widgets existing iterator. I think at the moment they clash. I've tried all combinations of grabbing the existing QVTKWidget RenderWindow, the renderer and the iterator vs creating New RenderWindow, renderer, iterator and Setting them via the QWidget methods. No combination works - you cannot create a new window, renderer and iterator then apply the lot via ui->widget->SetRenderWindow(..) neither can you grab them all from the widget and modify them via ui->widget->GetRenderWindow(..) Ideally both of the above methods should be valid ways of modify the QVTKWidget, but it seems they are not, once a custom interactor is involved. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From kumar.ashutosh.ee at gmail.com Mon Jul 9 10:04:06 2018 From: kumar.ashutosh.ee at gmail.com (Kumar Ashutosh) Date: Mon, 9 Jul 2018 22:04:06 +0800 Subject: [vtkusers] How to use SetGeometryShaderCode In-Reply-To: References: Message-ID: Thanks, Ken for showing interest in this issue. You were correct that a uniform value was defaulting to 0.0. So I manually replaced them with a vec2. The line does render now but the behaves only as a normal line and not as a WideLine. My implementation can be seen here . In this code, case1 is the normal line, case2 is with SetRenderLineAsTubes() and case3 is the manual GS part which I am trying to implement. I have replaced the uniform vec2 variable lineWidthNVC with vec2(0.1, 0.1) . This renders as a normal line and not as a Tube. Kindly see if I am making any mistake in injecting the shader. Regards, Kumar Ashutosh ? On Mon, Jul 9, 2018 at 8:54 PM, Ken Martin wrote: > Using your own shader code is a bit advanced as there are a few moving > parts. If you specify geometry shader code then you also have to make sure > the right uniforms/arrays are being set for that shader code. That would be > my guess as to the issue with your attempt to manually specify wide lines. > Maybe the code is fine but some uniforms are not properly set and so are > defaulting to 0.0 etc. > > I agree an example of geometry replacements would be good. If you get > something working let me know and I'll add it to the wiki page on custom > shaders. > > On Wed, Jul 4, 2018 at 9:11 AM, Kumar Ashutosh < > kumar.ashutosh.ee at gmail.com> wrote: > >> I want to add custom Geometry Shader to my mapper. From the source code, >> I concluded that in vtkOpenGLPolyDataMapper we can inject custom Shader >> Code. Also, the code has WideLineGS as the default Geometry Shader. I tried >> to mimic the same behaviour by injecting the same code as given here >> (source >> code of WideLinesGS) using the function SetGeometryShaderCode. The >> resulting screen is a blank screen with no errors raised. >> >> Can someone please guide me on how to inject Geometry Shader Code. This >> is specific to Geometry Shader only as I have successfully tried with Frag >> Shader and Vertex Shader. >> A simple example of this would be great. >> >> Regards, >> Kumar Ashutosh >> ? >> >> _______________________________________________ >> 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 ken.martin at kitware.com Mon Jul 9 10:20:16 2018 From: ken.martin at kitware.com (Ken Martin) Date: Mon, 9 Jul 2018 10:20:16 -0400 Subject: [vtkusers] How to use SetGeometryShaderCode In-Reply-To: References: Message-ID: Glad that helped Kumar, I don't have time to dig into your specific code, but when I run into shader issues I usually try hardcoding parts of the shader or simplifying parts until I get to a point where it is simple enough to track down the issue. In this case as you are seieng lines but they are not wide, seems like something is bad in your computed vertex positions in the GS On Mon, Jul 9, 2018 at 10:04 AM, Kumar Ashutosh wrote: > Thanks, Ken for showing interest in this issue. > You were correct that a uniform value was defaulting to 0.0. So I manually > replaced them with a vec2. The line does render now but the behaves only as > a normal line and not as a WideLine. My implementation can be seen here > . > In this code, case1 is the normal line, case2 is with > SetRenderLineAsTubes() and case3 is the manual GS part which I am trying to > implement. I have replaced the uniform vec2 variable lineWidthNVC with > vec2(0.1, 0.1) . This renders as a normal line and not as a Tube. Kindly > see if I am making any mistake in injecting the shader. > > Regards, > Kumar Ashutosh > ? > > On Mon, Jul 9, 2018 at 8:54 PM, Ken Martin wrote: > >> Using your own shader code is a bit advanced as there are a few moving >> parts. If you specify geometry shader code then you also have to make sure >> the right uniforms/arrays are being set for that shader code. That would be >> my guess as to the issue with your attempt to manually specify wide lines. >> Maybe the code is fine but some uniforms are not properly set and so are >> defaulting to 0.0 etc. >> >> I agree an example of geometry replacements would be good. If you get >> something working let me know and I'll add it to the wiki page on custom >> shaders. >> >> On Wed, Jul 4, 2018 at 9:11 AM, Kumar Ashutosh < >> kumar.ashutosh.ee at gmail.com> wrote: >> >>> I want to add custom Geometry Shader to my mapper. From the source code, >>> I concluded that in vtkOpenGLPolyDataMapper we can inject custom Shader >>> Code. Also, the code has WideLineGS as the default Geometry Shader. I tried >>> to mimic the same behaviour by injecting the same code as given here >>> (source >>> code of WideLinesGS) using the function SetGeometryShaderCode. The >>> resulting screen is a blank screen with no errors raised. >>> >>> Can someone please guide me on how to inject Geometry Shader Code. This >>> is specific to Geometry Shader only as I have successfully tried with Frag >>> Shader and Vertex Shader. >>> A simple example of this would be great. >>> >>> Regards, >>> Kumar Ashutosh >>> ? >>> >>> _______________________________________________ >>> 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 jchris.fillionr at kitware.com Mon Jul 9 11:58:32 2018 From: jchris.fillionr at kitware.com (Jean-Christophe Fillion-Robin) Date: Mon, 9 Jul 2018 11:58:32 -0400 Subject: [vtkusers] 'vtkCommonCorePython.vtkCallbackCommand' object has no attribute 'SetCallback' In-Reply-To: References: Message-ID: Hi, Thanks for reaching out. In python, you shouldn't have to create a vtkCallbackCommand object. You can directly pass a python function to the AddObserver function. Looking at this test should help give more details: https://github.com/Kitware/VTK/blob/90f7e9a4590922d159ed3c599d0e363edcad3ed5/Common/Core/Testing/Python/TestInvokeEvent.py To more easily manage the connections, you could also create a VTKObservationMixin class. More detail about the mixin looking at these: * https://www.slicer.org/wiki/Documentation/Nightly/Developers/Python_scripting#How_can_I_access_callData_argument_in_a_VTK_object_observer_callback_function * https://github.com/Slicer/Slicer/blob/3ea26dae3e461899f8ecf51ec7ae02f7bab10d15/Base/Python/slicer/tests/test_slicer_util_VTKObservationMixin.py Hth Jc On Mon, Jul 9, 2018 at 7:08 AM, J. wrote: > According to the tutorials and example code, you can create a > vtkCallbackCommand() object and then call SetCallback on it with a callback > function, as in: > > vtkSmartPointer keypressCallback = > vtkSmartPointer::New(); > keypressCallback->SetCallback ( func ); > > However, when I try this with Python, I get* > 'vtkCommonCorePython.vtkCallbackCommand' object has no attribute > 'SetCallback'*. I'm using vtk 8: > > def onClick(): > print("Hello, World!") > > onClickCallback = vtk.vtkCallbackCommand() > onClickCallback.SetCallback(onClick) > > > _______________________________________________ > 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 > > -- +1 919 869 8849 -------------- next part -------------- An HTML attachment was scrubbed... URL: From lasso at queensu.ca Mon Jul 9 12:33:35 2018 From: lasso at queensu.ca (Andras Lasso) Date: Mon, 9 Jul 2018 16:33:35 +0000 Subject: [vtkusers] Cannot disable vtkPolyDataMapper2D scalar visibility using VTK OpenGL2 backend Message-ID: Hi all, I try to render a polydata with a plain solid color using a 2D actor. However, it seems that with OpenGL2 rendering backend, if a polydata has scalars and rendered once with scalar visibility enabled, ScalarVisibility cannot be disabled anymore. The actor will always appear as colored. In some cases, the colors randomly flicker. See a very simple code snippet below to reproduce it. The same code works well (scalar visibility can be enabled/disabled) using VTK OpenGL1 backend. If I use 3D mapper and actor (vtkPolyDataMapper and vtk.vtkActor) then it works well using both VTK OpenGL1 and OpenGL2 backends. Is this a known issue? Could somebody have a look? Thank you, Andras reader = vtk.vtkXMLPolyDataReader() reader.SetFileName("scalartest.vtp") mapper = vtk.vtkPolyDataMapper2D() mapper.SetInputConnection(reader.GetOutputPort()) actor = vtk.vtkActor2D() actor.SetMapper(mapper) actor.SetPosition(150,150) ren = vtk.vtkRenderer() ren.AddActor(actor) renWin = vtk.vtkRenderWindow() renWin.AddRenderer(ren) renWin.Render() # actor appears in color here => OK mapper.SetScalarVisibility(False) renWin.Render() # actor appears in color here => ERROR (it should be white) Download link for scalartest.vtp sample data set (any other polydata with scalars should work): https://1drv.ms/u/s!Arm_AFxB9yqHtK1gHCIsGt0U62OTQg -------------- next part -------------- An HTML attachment was scrubbed... URL: From ken.martin at kitware.com Mon Jul 9 15:52:53 2018 From: ken.martin at kitware.com (Ken Martin) Date: Mon, 9 Jul 2018 15:52:53 -0400 Subject: [vtkusers] Cannot disable vtkPolyDataMapper2D scalar visibility using VTK OpenGL2 backend In-Reply-To: References: Message-ID: Sounds like a bug. Andras if you move line 568 from vtkOpenGLPolyDataMapper2D.cxx out of the if statement to line 563 does that solve the problem? Looking at the code I believe that is the correct fix. e.g. it should look like this this->MapScalars(act->GetProperty()->GetOpacity()); this->HaveCellScalars = false; if (this->ScalarVisibility) { // We must figure out how the scalars should be mapped to the polydata. if ( (this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_DATA || this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_FIELD_DATA || On Mon, Jul 9, 2018 at 12:33 PM, Andras Lasso wrote: > Hi all, > > > > I try to render a polydata with a plain solid color using a 2D actor. > However, it seems that with OpenGL2 rendering backend, if a polydata has > scalars and rendered once with scalar visibility enabled, ScalarVisibility > cannot be disabled anymore. The actor will always appear as colored. In > some cases, the colors randomly flicker. See a very simple code snippet > below to reproduce it. > > > > The same code works well (scalar visibility can be enabled/disabled) using > VTK OpenGL1 backend. If I use 3D mapper and actor (vtkPolyDataMapper and > vtk.vtkActor) then it works well using both VTK OpenGL1 and OpenGL2 > backends. > > > > Is this a known issue? Could somebody have a look? > > > > Thank you, > > Andras > > > > > > reader = vtk.vtkXMLPolyDataReader() > > reader.SetFileName("scalartest.vtp") > > mapper = vtk.vtkPolyDataMapper2D() > > mapper.SetInputConnection(reader.GetOutputPort()) > > actor = vtk.vtkActor2D() > > actor.SetMapper(mapper) > > actor.SetPosition(150,150) > > ren = vtk.vtkRenderer() > > ren.AddActor(actor) > > renWin = vtk.vtkRenderWindow() > > renWin.AddRenderer(ren) > > renWin.Render() > > # actor appears in color here => OK > > mapper.SetScalarVisibility(False) > > renWin.Render() > > # actor appears in color here => ERROR (it should be white) > > > > > > Download link for scalartest.vtp sample data set (any other polydata with > scalars should work): > > https://1drv.ms/u/s!Arm_AFxB9yqHtK1gHCIsGt0U62OTQg > > > > _______________________________________________ > 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 andrew.amaclean at gmail.com Mon Jul 9 18:25:29 2018 From: andrew.amaclean at gmail.com (Andrew Maclean) Date: Tue, 10 Jul 2018 08:25:29 +1000 Subject: [vtkusers] 'vtkCommonCorePython.vtkCallbackCommand' object has no attribute 'SetCallback' In-Reply-To: References: Message-ID: This example should give you some ideas about how to set up callbacks: ?https://lorensen.github.io/VTKExamples/site/Python/Interaction/CallBack/ Also look at: https://lorensen.github.io/VTKExamples/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget/ https://lorensen.github.io/VTKExamples/site/Python/Interaction/MouseEventsObserver/ https://lorensen.github.io/VTKExamples/site/Python/Infovis/SelectedGraphIDs/ Regards Andrew > ---------- Forwarded message ---------- > From: > ?? > Jean-Christophe Fillion-Robin < > ?? > jchris.fillionr at kitware.com> > To: "J." > Cc: vtkusers at public.kitware.com > Bcc: > Date: Mon, 9 Jul 2018 11:58:32 -0400 > Subject: Re: [vtkusers] 'vtkCommonCorePython.vtkCallbackCommand' object > has no attribute 'SetCallback' > Hi, > > Thanks for reaching out. > > In python, you shouldn't have to create a vtkCallbackCommand object. You > can directly pass a python function to the AddObserver function. > > Looking at this test should help give more details: > https://github.com/Kitware/VTK/blob/90f7e9a4590922d159ed3c599d0e363edcad3ed5/Common/Core/Testing/Python/TestInvokeEvent.py > > > To more easily manage the connections, you could also create a > VTKObservationMixin > > class. > > More detail about the mixin looking at these: > * > https://www.slicer.org/wiki/Documentation/Nightly/Developers/Python_scripting#How_can_I_access_callData_argument_in_a_VTK_object_observer_callback_function > * > https://github.com/Slicer/Slicer/blob/3ea26dae3e461899f8ecf51ec7ae02f7bab10d15/Base/Python/slicer/tests/test_slicer_util_VTKObservationMixin.py > > > Hth > Jc > > > On Mon, Jul 9, 2018 at 7:08 AM, J. wrote: > >> According to the tutorials and example code, you can create a >> vtkCallbackCommand() object and then call SetCallback on it with a callback >> function, as in: >> >> vtkSmartPointer keypressCallback = >> vtkSmartPointer::New(); >> keypressCallback->SetCallback ( func ); >> >> However, when I try this with Python, I get* >> 'vtkCommonCorePython.vtkCallbackCommand' object has no attribute >> 'SetCallback'*. I'm using vtk 8: >> >> def onClick(): >> print("Hello, World!") >> >> onClickCallback = vtk.vtkCallbackCommand() >> onClickCallback.SetCallback(onClick) >> >> >> _______________________________________________ >> 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 >> >> > > > -- > +1 919 869 8849 > _______________________________________________ > 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 > -- ___________________________________________ Andrew J. P. Maclean ___________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: From minpu.code at gmail.com Mon Jul 9 22:15:34 2018 From: minpu.code at gmail.com (pnt1614) Date: Mon, 9 Jul 2018 19:15:34 -0700 (MST) Subject: [vtkusers] How to a customise vtkWidgetEvent? In-Reply-To: <1530607446898-0.post@n5.nabble.com> References: <1530607446898-0.post@n5.nabble.com> Message-ID: <1531188934070-0.post@n5.nabble.com> I have not tested yet but I think the following example can give you a hint about disabling or removing an event. https://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Interaction/Widgets/Testing/Cxx/TestContourWidget2.cxx -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From lasso at queensu.ca Tue Jul 10 00:10:11 2018 From: lasso at queensu.ca (Andras Lasso) Date: Tue, 10 Jul 2018 04:10:11 +0000 Subject: [vtkusers] Cannot disable vtkPolyDataMapper2D scalar visibility using VTK OpenGL2 backend In-Reply-To: References: Message-ID: Thanks a lot Ken for the quick response. The change that you described below fixed the issue! Andras From: Ken Martin Sent: Monday, July 9, 2018 3:53 PM To: Andras Lasso Cc: vtkusers at vtk.org Subject: Re: [vtkusers] Cannot disable vtkPolyDataMapper2D scalar visibility using VTK OpenGL2 backend Sounds like a bug. Andras if you move line 568 from vtkOpenGLPolyDataMapper2D.cxx out of the if statement to line 563 does that solve the problem? Looking at the code I believe that is the correct fix. e.g. it should look like this this->MapScalars(act->GetProperty()->GetOpacity()); this->HaveCellScalars = false; if (this->ScalarVisibility) { // We must figure out how the scalars should be mapped to the polydata. if ( (this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_DATA || this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_FIELD_DATA || On Mon, Jul 9, 2018 at 12:33 PM, Andras Lasso > wrote: Hi all, I try to render a polydata with a plain solid color using a 2D actor. However, it seems that with OpenGL2 rendering backend, if a polydata has scalars and rendered once with scalar visibility enabled, ScalarVisibility cannot be disabled anymore. The actor will always appear as colored. In some cases, the colors randomly flicker. See a very simple code snippet below to reproduce it. The same code works well (scalar visibility can be enabled/disabled) using VTK OpenGL1 backend. If I use 3D mapper and actor (vtkPolyDataMapper and vtk.vtkActor) then it works well using both VTK OpenGL1 and OpenGL2 backends. Is this a known issue? Could somebody have a look? Thank you, Andras reader = vtk.vtkXMLPolyDataReader() reader.SetFileName("scalartest.vtp") mapper = vtk.vtkPolyDataMapper2D() mapper.SetInputConnection(reader.GetOutputPort()) actor = vtk.vtkActor2D() actor.SetMapper(mapper) actor.SetPosition(150,150) ren = vtk.vtkRenderer() ren.AddActor(actor) renWin = vtk.vtkRenderWindow() renWin.AddRenderer(ren) renWin.Render() # actor appears in color here => OK mapper.SetScalarVisibility(False) renWin.Render() # actor appears in color here => ERROR (it should be white) Download link for scalartest.vtp sample data set (any other polydata with scalars should work): https://1drv.ms/u/s!Arm_AFxB9yqHtK1gHCIsGt0U62OTQg _______________________________________________ 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 rccm.kyoshimi at gmail.com Tue Jul 10 03:26:05 2018 From: rccm.kyoshimi at gmail.com (kenichiro yoshimi) Date: Tue, 10 Jul 2018 16:26:05 +0900 Subject: [vtkusers] Trouble using VTK Widget with QVTK In-Reply-To: <1531144568696-0.post@n5.nabble.com> References: <1530797942431-0.post@n5.nabble.com> <1530947709341-0.post@n5.nabble.com> <1842077504.715103.1531010528616@mail.yahoo.com> <955714104.694844.1531010738511@mail.yahoo.com> <1531039007599-0.post@n5.nabble.com> <1531040975040-0.post@n5.nabble.com> <338d35ff-973c-4d84-8c40-4083d91f8b6a@email.android.com> <1531046088196-0.post@n5.nabble.com> <1531144568696-0.post@n5.nabble.com> Message-ID: Hi, The solution may be to move the declaration of the vtkContourWidget to a member of MainWindow class according to the link below: https://www.vtk.org/pipermail/vtkusers/2010-August/061942.html Thanks 2018?7?9?(?) 22:56 andyjk : > > Thanks > > I have tried this but it made no difference. > > There just seems to be no way to set a new custom iterator in a > QVTKOpenGLWidget (or a QVTKWidget). > > I think the issue is that I can grab the existing iterator, from the QWidget > but it has already been initialised, so any custom interactor that requires > setting up prior to initialisation fails. > > The only solution if you want to use a contour widget and pointplacer, is to > use a normal VTK window as a pop-up. It looks like it cannot be displayed > inside QT which is a shame as this spoils the look of the UI. > > Not sure this is a bug, just a lack of functionality. We need a way to be > able to insert our own (new) interactor into a QVTKOpenGLWidget, which > completely replaces the widgets existing iterator. I think at the moment > they clash. > > I've tried all combinations of grabbing the existing QVTKWidget > RenderWindow, the renderer and the iterator vs creating New RenderWindow, > renderer, iterator and Setting them via the QWidget methods. > No combination works - you cannot create a new window, renderer and iterator > then apply the lot via > ui->widget->SetRenderWindow(..) > neither can you grab them all from the widget and modify them via > ui->widget->GetRenderWindow(..) > > Ideally both of the above methods should be valid ways of modify the > QVTKWidget, but it seems they are not, once a custom interactor is involved. > > > > > -- > 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 axkibe at gmail.com Tue Jul 10 06:07:36 2018 From: axkibe at gmail.com (Axel Kittenberger) Date: Tue, 10 Jul 2018 12:07:36 +0200 Subject: [vtkusers] VtkImageClip crash with 8.1.1 Message-ID: Hello, I'm somewhat confused why below code crashes (buserror). I know I can "fix" this by calling reader.Update( ) or reader.UpdateWholeExtent( ); before engaging the whole pipeline by the viewer, however this is a simplified case of a whole set of big images for which I would not have the memory to hold them all in memory before clipping. And I know I would have to call ClipDataOn() for it to actually easy memory use, but I left it away for simplicity of the minimal use. Also calling clip.Update( ) makes an instance crash (segfault) before the viewer is even setup. Below sample works with 6.3.0 tough. Identical C++ control application has the same effect. === from vtk import vtkJPEGReader from vtk import vtkImageViewer2 from vtk import vtkRenderWindowInteractor from vtk import vtkImageClip from vtk import vtkVersion print( vtkVersion.GetVTKSourceVersion( ) ) reader = vtkJPEGReader( ) reader.SetFileName( 'test.jpg' ) reader.UpdateInformation( ) clip = vtkImageClip( ) clip.SetInputConnection( reader.GetOutputPort( ) ) clip.SetOutputWholeExtent( 0, 10, 0, 10, 0, 1 ) viewer = vtkImageViewer2( ) viewer.SetInputConnection( clip.GetOutputPort( ) ) interactor = vtkRenderWindowInteractor( ) viewer.SetupInteractor( interactor ) viewer.Render( ) viewer.GetRenderer( ).ResetCamera( ) viewer.Render( ) interactor.Start( ) === I really have no idea what causes this. Kind regards, Axel -------------- next part -------------- An HTML attachment was scrubbed... URL: From ken.martin at kitware.com Tue Jul 10 09:54:01 2018 From: ken.martin at kitware.com (Ken Martin) Date: Tue, 10 Jul 2018 09:54:01 -0400 Subject: [vtkusers] Cannot disable vtkPolyDataMapper2D scalar visibility using VTK OpenGL2 backend In-Reply-To: References: Message-ID: Thanks!, fixed in MR https://gitlab.kitware.com/vtk/vtk/merge_requests/4475 On Tue, Jul 10, 2018 at 12:10 AM, Andras Lasso wrote: > Thanks a lot Ken for the quick response. The change that you described > below fixed the issue! > > > > Andras > > > > *From:* Ken Martin > *Sent:* Monday, July 9, 2018 3:53 PM > *To:* Andras Lasso > *Cc:* vtkusers at vtk.org > *Subject:* Re: [vtkusers] Cannot disable vtkPolyDataMapper2D scalar > visibility using VTK OpenGL2 backend > > > > Sounds like a bug. Andras if you move line 568 from > vtkOpenGLPolyDataMapper2D.cxx out of the if statement to line 563 does that > solve the problem? Looking at the code I believe that is the correct fix. > > > > e.g. it should look like this > > > > this->MapScalars(act->GetProperty()->GetOpacity()); > > this->HaveCellScalars = false; > > if (this->ScalarVisibility) > > { > > // We must figure out how the scalars should be mapped to the polydata. > > if ( (this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_DATA || > > this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_FIELD_DATA || > > > > > > > > On Mon, Jul 9, 2018 at 12:33 PM, Andras Lasso wrote: > > Hi all, > > > > I try to render a polydata with a plain solid color using a 2D actor. > However, it seems that with OpenGL2 rendering backend, if a polydata has > scalars and rendered once with scalar visibility enabled, ScalarVisibility > cannot be disabled anymore. The actor will always appear as colored. In > some cases, the colors randomly flicker. See a very simple code snippet > below to reproduce it. > > > > The same code works well (scalar visibility can be enabled/disabled) using > VTK OpenGL1 backend. If I use 3D mapper and actor (vtkPolyDataMapper and > vtk.vtkActor) then it works well using both VTK OpenGL1 and OpenGL2 > backends. > > > > Is this a known issue? Could somebody have a look? > > > > Thank you, > > Andras > > > > > > reader = vtk.vtkXMLPolyDataReader() > > reader.SetFileName("scalartest.vtp") > > mapper = vtk.vtkPolyDataMapper2D() > > mapper.SetInputConnection(reader.GetOutputPort()) > > actor = vtk.vtkActor2D() > > actor.SetMapper(mapper) > > actor.SetPosition(150,150) > > ren = vtk.vtkRenderer() > > ren.AddActor(actor) > > renWin = vtk.vtkRenderWindow() > > renWin.AddRenderer(ren) > > renWin.Render() > > # actor appears in color here => OK > > mapper.SetScalarVisibility(False) > > renWin.Render() > > # actor appears in color here => ERROR (it should be white) > > > > > > Download link for scalartest.vtp sample data set (any other polydata with > scalars should work): > > https://1drv.ms/u/s!Arm_AFxB9yqHtK1gHCIsGt0U62OTQg > > > > > > _______________________________________________ > 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 ochampao at hotmail.com Tue Jul 10 10:27:52 2018 From: ochampao at hotmail.com (ochampao) Date: Tue, 10 Jul 2018 07:27:52 -0700 (MST) Subject: [vtkusers] Extracted cross-section from vtkCutter cannot be displayed Message-ID: <1531232872553-0.post@n5.nabble.com> Hi vtkUsers, I am trying to extract the cross-section of a sphere (vtkSphereSource) displayed in one render window, and display its cross-section in another render window, however, I am unable to make this work. I am trying to achieve this using a vtkCutter to extract the cross-section of vtkSphereSource. I have adapted the SideBySideRenderWindowsQt example from the wiki to demonstrate the problem. The full compileable code is attached. Here are some details of the problem: In the example, I have two views: 1) left "2D" view and 2) right "3D" view. The 2D view has a callback for picking points via the ALT+LeftMouseButton key combination. When the user picks a point on the 2D view, the addPickedPoint() method is called, which renders a sphere on the 3D view and then uses a vtkCutter to extract the cross-section of the sphere so that it is displayed at the position of the picked point on the 2D view. The attached code implements this behaviour, however, only the sphere appears on the 3D view. Its cross-section, extracted using a vtkCutter instance is not displayed on the 2D view. My initial thought was that the vtkImageStack on the 2D view is "hiding" the cross-section actor, but after removing the vtkImageStack the actor is still not displayed. Have you got any ideas on how to fix this? Any help will be much appreciated. Thanks, Panos. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From ochampao at hotmail.com Tue Jul 10 10:29:53 2018 From: ochampao at hotmail.com (ochampao) Date: Tue, 10 Jul 2018 07:29:53 -0700 (MST) Subject: [vtkusers] Extracted cross-section from vtkCutter cannot be displayed In-Reply-To: <1531232872553-0.post@n5.nabble.com> References: <1531232872553-0.post@n5.nabble.com> Message-ID: <1531232993932-0.post@n5.nabble.com> My attachment did not get uploaded. Here is another attempt to upload it. SideBySideRenderWindowsQt.zip -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From k.diaz99 at gmail.com Tue Jul 10 10:41:47 2018 From: k.diaz99 at gmail.com (Camilo Diaz) Date: Tue, 10 Jul 2018 10:41:47 -0400 Subject: [vtkusers] Build VTK 8.1.1 on Windows vc12 - vtkPythonArgs.cxx Line 105 Error cannot convert from 'const char *' to 'char * Message-ID: Hello, Compiling VTK 8.1.1 + python wrapper on visual studio 2013 throws this error: error C2440: '=' : cannot convert from 'const char *' to 'char *' D:\VTK-8.1.1\Wrapping\PythonCore\vtkPythonArgs.cxx 105 1 vtkWrappingPythonCore I installed Python 3.7 in a windows 10 pc. I used cmake-gui to build the project. I'll appreciate any help. -- Kmilo -------------- next part -------------- An HTML attachment was scrubbed... URL: From skab12 at gmail.com Tue Jul 10 11:24:42 2018 From: skab12 at gmail.com (Serge K.) Date: Tue, 10 Jul 2018 11:24:42 -0400 Subject: [vtkusers] vtk + openvr + python Message-ID: Hi All, I just compiled VTK 8.1.1 with OpenVR 1.0.15 and python wrapping (windows 64bit - python 3.6) When I import vtk module in a python interpreter, I do not have access to these functions : - vtk.vtkOpenVRRenderer() - vtk.vtkOpenVRRenderWindow() - vtk.vtkOpenVRRenderWindowInteractor() - vtk.vtkOpenVRCustomInteractorStyle() The only available function is : vtkRenderingOpenVRObjectFactory. Below, this is what I obtain after a "dir" In [5]: import vtk.vtkRenderingOpenVRPython as vr In [6]: dir(vr) Out[6]: ['__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'vtkRenderingOpenVRObjectFactory'] Is it normal? Did I forget something during compilation step? What did I do wrong? How can I get these functions? Thanks in advance for any suggestion Serge K. -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Tue Jul 10 13:42:03 2018 From: david.gobbi at gmail.com (David Gobbi) Date: Tue, 10 Jul 2018 11:42:03 -0600 Subject: [vtkusers] Build VTK 8.1.1 on Windows vc12 - vtkPythonArgs.cxx Line 105 Error cannot convert from 'const char *' to 'char * In-Reply-To: References: Message-ID: It looks like the Python folks changed the PyUnicode_AsUTF8() function in Python 3.7. This function used to return "char *" but in 3.7 it returns "const char *". I'll start working on a patch for the VTK master branch, but for now your best option is to use Python 3.6. - David On Tue, Jul 10, 2018 at 8:41 AM, Camilo Diaz wrote: > Hello, > > Compiling VTK 8.1.1 + python wrapper on visual studio 2013 throws this > error: > > error C2440: '=' : cannot convert from 'const char *' to 'char *' > D:\VTK-8.1.1\Wrapping\PythonCore\vtkPythonArgs.cxx 105 1 > vtkWrappingPythonCore > > I installed Python 3.7 in a windows 10 pc. > I used cmake-gui to build the project. > > I'll appreciate any help. > > -- > Kmilo > -------------- next part -------------- An HTML attachment was scrubbed... URL: From shayan.moradkhani at gmail.com Wed Jul 11 03:02:28 2018 From: shayan.moradkhani at gmail.com (shayan moradkhani) Date: Wed, 11 Jul 2018 00:02:28 -0700 (MST) Subject: [vtkusers] machining simulation and collision detection In-Reply-To: References: <1530181664677-0.post@n5.nabble.com> Message-ID: <1531292548828-0.post@n5.nabble.com> hi, i'm using this collision detection that you put the link for. i just copy pasted the code and got bunch of red lines including (#include "vtkSlicerRtCommonWin32Header.h") and many undefined parameters! what am i missing/doing wrong here ? shayan -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From andrewkeeling at hotmail.com Wed Jul 11 03:38:44 2018 From: andrewkeeling at hotmail.com (andyjk) Date: Wed, 11 Jul 2018 00:38:44 -0700 (MST) Subject: [vtkusers] Trouble using VTK Widget with QVTK In-Reply-To: References: <1842077504.715103.1531010528616@mail.yahoo.com> <955714104.694844.1531010738511@mail.yahoo.com> <1531039007599-0.post@n5.nabble.com> <1531040975040-0.post@n5.nabble.com> <338d35ff-973c-4d84-8c40-4083d91f8b6a@email.android.com> <1531046088196-0.post@n5.nabble.com> <1531144568696-0.post@n5.nabble.com> Message-ID: <1531294724169-0.post@n5.nabble.com> Thankyou! Yes - putting the widget in the QT mainwindow class as a member solves this! I think this is true of all VTKWidgets when used with QT, so everyone be aware of this. Thanks again. Andy -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From pechnikov at mobigroup.ru Wed Jul 11 05:54:28 2018 From: pechnikov at mobigroup.ru (Alexey Pechnikov) Date: Wed, 11 Jul 2018 16:54:28 +0700 Subject: [vtkusers] Is there any way to prepare datasets for vtk.js? Message-ID: Hi, I couldn't find any documentation or tool to do it. Google doesn't know anything about "vti-web" data format. VTK/VTI and other VTK formats are not allowed I see. Is disassembling example datasets and build own tools the only possible way?! -- Best regards, Alexey Pechnikov. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ochampao at hotmail.com Wed Jul 11 06:00:16 2018 From: ochampao at hotmail.com (ochampao) Date: Wed, 11 Jul 2018 03:00:16 -0700 (MST) Subject: [vtkusers] Extracted cross-section from vtkCutter cannot be displayed In-Reply-To: <1531232993932-0.post@n5.nabble.com> References: <1531232872553-0.post@n5.nabble.com> <1531232993932-0.post@n5.nabble.com> Message-ID: <1531303216243-0.post@n5.nabble.com> Here is the method which adds the sphere on the right view and then cuts the cross-section to be displayed on the left view. void addPickedPoint(const double x, const double y, const double z) { // sphere source vtkNew sphereSource; sphereSource->SetCenter(x, y, z); sphereSource->SetRadius(1.0); sphereSource->SetThetaResolution(50); sphereSource->SetPhiResolution(50); // sphere polygonal mapper vtkNew sphereMapper; sphereMapper->SetInputConnection(sphereSource->GetOutputPort()); // actor for displaying sphere in 3D vtkNew sphereActor; sphereActor->SetMapper(sphereMapper); sphereActor->GetProperty()->SetDiffuseColor(1, 0, 0); sphereActor->GetProperty()->SetOpacity(0.7); // setup cut plane for extracting cross-sections of polygonal models. // Cutplane is the plane defined by the focal point and the view plane // normal of the Left View. vtkNew cutPlane; cutPlane->SetOrigin( this->leftRenderer->GetActiveCamera()->GetFocalPoint()); cutPlane->SetNormal( this->leftRenderer->GetActiveCamera()->GetViewPlaneNormal()); // setup cutter and attach cutplane vtkNew cutter; cutter->SetCutFunction(cutPlane); cutter->SetInputConnection(sphereSource->GetOutputPort()); cutter->Update(); // crossection mapper vtkNew cutterMapper; cutterMapper->SetInputConnection(cutter->GetOutputPort()); // actor for displaying the extracted cross-section from the sphere vtkNew cutterActor; cutterActor->SetMapper(cutterMapper); cutterActor->GetProperty()->SetDiffuseColor(0.2, .49, 1); cutterActor->GetProperty()->SetColor(1.0, 0.55, 0.2); cutterActor->GetProperty()->SetLineWidth(1.0f); cutterActor->GetProperty()->SetOpacity(1.0); // add all actors to the Renderers this->leftRenderer->AddActor(cutterActor); this->rightRenderer->AddActor(sphereActor); // reset camera this->leftRenderer->ResetCamera(); this->rightRenderer->ResetCamera(); // render views this->leftRenderer->GetRenderWindow()->Render(); this->rightRenderer->GetRenderWindow()->Render(); } -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From jothybasu at gmail.com Wed Jul 11 06:36:38 2018 From: jothybasu at gmail.com (Jothybasu Selvaraj) Date: Wed, 11 Jul 2018 20:36:38 +1000 Subject: [vtkusers] Problem initializing GLEW with vtk8.1 Message-ID: Dear All I just build vtk8.1 and tried to render a sphere using QVTKOpelnGLWidget -hope this is the recommended over QVTKWidget in vtk8.1. I am getting this error. I am using QtCreator. vtkGenericOpenGLRenderWindow (00000255BB134430): GLEW could not be initialized. I have the following in the header file of the class which renders this: #define vtkRenderingCore_AUTOINIT 3(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingOpenGL2) #define vtkRenderingVolume_AUTOINIT 1(vtkRenderingVolumeOpenGL2) Any ideas how to fix this? I am coming back to VTK after suing vtk 6.x. Regards, Jothy -------------- next part -------------- An HTML attachment was scrubbed... URL: From nztoddler at yahoo.com Wed Jul 11 06:59:52 2018 From: nztoddler at yahoo.com (Todd) Date: Wed, 11 Jul 2018 22:59:52 +1200 Subject: [vtkusers] Problem initializing GLEW with vtk8.1 In-Reply-To: Message-ID: <27d8adc6-07a7-41d1-bcb3-b909dc6b014b@email.android.com> An HTML attachment was scrubbed... URL: From jothybasu at gmail.com Wed Jul 11 07:01:13 2018 From: jothybasu at gmail.com (Jothybasu Selvaraj) Date: Wed, 11 Jul 2018 21:01:13 +1000 Subject: [vtkusers] Problem initializing GLEW with vtk8.1 In-Reply-To: <27d8adc6-07a7-41d1-bcb3-b909dc6b014b@email.android.com> References: <27d8adc6-07a7-41d1-bcb3-b909dc6b014b@email.android.com> Message-ID: <5b45e37b.1c69fb81.69e33.0605@mx.google.com> Windows 10 with Nvidia card. Sent from Mail for Windows 10 From: Todd Sent: Wednesday, July 11, 2018 9:00 PM To: Jothybasu Selvaraj Cc: VTK Mailing List Subject: Re: [vtkusers] Problem initializing GLEW with vtk8.1 What platform are you using? On 11 Jul 2018 10:36 p.m., Jothybasu Selvaraj wrote: Dear All I just?build vtk8.1 and tried to render a sphere using QVTKOpelnGLWidget -hope this is the recommended over QVTKWidget in vtk8.1. I am getting this error. I am using QtCreator. vtkGenericOpenGLRenderWindow (00000255BB134430): GLEW could not be initialized. I have the following in the header file of the class which renders this: #define vtkRenderingCore_AUTOINIT 3(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingOpenGL2) #define vtkRenderingVolume_AUTOINIT 1(vtkRenderingVolumeOpenGL2) Any ideas how to fix this? I am coming back to VTK after suing vtk 6.x. Regards, Jothy -------------- next part -------------- An HTML attachment was scrubbed... URL: From nztoddler at yahoo.com Wed Jul 11 07:08:14 2018 From: nztoddler at yahoo.com (Todd) Date: Wed, 11 Jul 2018 23:08:14 +1200 Subject: [vtkusers] Problem initializing GLEW with vtk8.1 In-Reply-To: <5b45e37b.1c69fb81.69e33.0605@mx.google.com> Message-ID: <87388158-afc8-4b9a-a5fb-a1950e5e78c7@email.android.com> An HTML attachment was scrubbed... URL: From konrad.ley at valeo.com Wed Jul 11 07:25:16 2018 From: konrad.ley at valeo.com (Konrad LEY) Date: Wed, 11 Jul 2018 13:25:16 +0200 Subject: [vtkusers] Fwd: Run VTK with OpenGL ES 2.0 backend In-Reply-To: References: Message-ID: ---------- Forwarded message --------- From: Konrad LEY Date: Mon, Jul 2, 2018 at 3:50 PM Subject: Re: [vtkusers] Run VTK with OpenGL ES 2.0 backend To: Hello Dan, thank you very much for the info. What a pity! Is there no chance for me to manually switch to the OpenGL ES backend? What you are saying is also what i'm experiencing: For example when i run the simple Sphere example https://www.vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/Sphere i get the output: sh-4.3# ./Sphere libGL error: unable to load driver: xilinx_drm_dri.so libGL error: driver pointer missing libGL error: failed to load driver: xilinx_drm ERROR: In /home/root/Downloads/VTK-8.1.1/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx, line 785 vtkXOpenGLRenderWindow (0x19641d50): GLEW could not be initialized. Segmentation fault According to this post https://forums.xilinx.com/t5/Embedded-Linux/libGL-error-unable-to-load-driver-xilinx-drm-dri-so/td-p/853905 that means that vtk is not using OpenGL ES 2. When i force vtk to use EGLRenderWindow and change the Code of the simple Sphere example to: #include #include #include #include #include #include #include #include #include #include int main(int, char *[]) { vtkSmartPointer colors = vtkSmartPointer::New(); // Create a sphere vtkSmartPointer sphereSource = vtkSmartPointer::New(); sphereSource->SetCenter(0.0, 0.0, 0.0); sphereSource->SetRadius(5.0); // Make the surface smooth. sphereSource->SetPhiResolution(100); sphereSource->SetThetaResolution(100); vtkSmartPointer mapper = vtkSmartPointer::New(); mapper->SetInputConnection(sphereSource->GetOutputPort()); vtkSmartPointer actor = vtkSmartPointer::New(); actor->SetMapper(mapper); actor->GetProperty()->SetColor(colors->GetColor3d("Cornsilk").GetData()); vtkSmartPointer renderer = vtkSmartPointer::New(); vtkSmartPointer renderWindow = vtkSmartPointer::New(); renderWindow->SetWindowName("Sphere"); renderWindow->AddRenderer(renderer); // vtkSmartPointer renderWindowInteractor = // vtkSmartPointer::New(); // renderWindowInteractor->SetRenderWindow(renderWindow); renderer->AddActor(actor); renderer->SetBackground(colors->GetColor3d("DarkGreen").GetData()); renderWindow->Render(); // renderWindowInteractor->Start(); return EXIT_SUCCESS; } I get the error message: Warning: In /home/root/Downloads/VTK-8.1.1/Rendering/OpenGL2/vtkEGLRenderWindow.cxx, line 273 vtkEGLRenderWindow (0x1ca53d50): Setting an EGL display to device index: 0 require EGL_EXT_device_base EGL_EXT_platform_device EGL_EXT_platform_base extensions ERROR: In /home/root/Downloads/VTK-8.1.1/Rendering/OpenGL2/vtkEGLRenderWindow.cxx, line 356 vtkEGLRenderWindow (0x1ca53d50): No matching EGL configuration found. ERROR: In /home/root/Downloads/VTK-8.1.1/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx, line 785 vtkEGLRenderWindow (0x1ca53d50): GLEW could not be initialized. Segmentation fault So still VTK wants to use GLEW, thus full OpenGL. Is there a way to configure/patch VTK so it uses OpenGL ES 2.0 like in the Android configuration? Konrad On Thu, Jul 5, 2018 at 3:51 PM Dan Lipsa wrote: > Konrad, > I believe OpenGL ES is only supported for mobile architectures > https://blog.kitware.com/building-vtk-for-mobile-architectures/ > > The desktop version, including the version compiled for EGL requires full > OpenGL > > https://blog.kitware.com/off-screen-rendering-through-the-native-platform-interface-egl/ > > Dan > > > On Wed, Jun 27, 2018 at 11:33 AM Konrad LEY wrote: > >> Hello, >> >> I'm trying to run VTK on a Ultra96 board, which has a Mali-400 MP2 gpu >> supporting OpenGL ES 2.0. >> According to https://blog.kitware.com/raspberry-pi-likes-vtk/ VTK has a >> OpenGL ES 2.0 backend and runs on EGL. >> So I installed the libmali-dev package of my petalinux linux >> distribution, which is providing me the following files: >> >> /usr/include/EGL/egl.h >> /usr/include/EGL/eglext.h >> /usr/include/EGL/eglplatform.h >> /usr/include/GLES/gl.h >> /usr/include/GLES/glext.h >> /usr/include/GLES/glplatform.h >> /usr/include/GLES2/gl2.h >> /usr/include/GLES2/gl2ext.h >> /usr/include/GLES2/gl2platform.h >> /usr/include/KHR/khrplatform.h >> /usr/lib/libEGL.so >> /usr/lib/libGLESv1_CM.so >> /usr/lib/libGLESv2.so >> /usr/lib/libMali.so >> /usr/lib/pkconfig/egl.pc >> /usr/lib/pkconfig/glesv1.pc >> /usr/lib/pkconfig/glesv1_cm.pc >> /usr/lib/pkgconfig/glesv2.pc >> >> I can compile and run examples using OpenGL ES 2.0 now. >> >> Then I downloaded latest VTK-8.1.1 and ran cmake in the build folder. It >> complained about not finding OpenGL so I also installed libgl-mesa-dev >> package which is providing me: >> >> /usr/include/GL/gl.h >> /usr/include/GL/gl_mangle.h >> /usr/include/GL/glcorearb.h >> /usr/include/GL/glext.h >> /usr/include/GL/interal/dri_interface.h >> /usr/include/GL/mesa_glinterop.h >> /usr/include/GL/osmesa.h >> /usr/include/GL/wglext.h >> /usr/lib/libGL.la >> /usr/lib/libGL.so >> /usr/lib/pkgconfig/gl.pc >> >> After that CMake configuration completed. >> >> In the CMakeCache.txt I found out that VTK_HAS_EGL was set to OFF. I >> turned it ON. >> Then cmake complained about not finding EGL. So I had to manually set >> >> EGL_INCLUDE_DIR=/usr/include/EGL >> EGL_LIBRARY=/usr/lib/libEGL.so >> EGL_opengl_LIBRARY=/usr/lib/libGLESv2.so >> >> Compiling and installing works fine, but when I run the Sphere example it >> returns the error: >> >> ~# ./Sphere >> libGL error: unable to load driver: xilinx_drm_dri.so >> libGL error: driver pointer missing >> libGL error: failed to load driver: xilinx_drm >> ERROR: In >> /home/root/Downloads/VTK-8.1.1/Rendering/OpenGL/vtkOpenGLRenderWindow.cxx, >> line 785 >> vtkXOpenGLRenderWindow (0x25503fc0): GLEW could not be initialized. >> >> Segmentation fault >> >> How can I build for OpenGL ES 2.0 only? >> >> Correct me but I think there's something wrong when I have to install >> OpenGL with the libgl-mesa-dev package. Also GLEW is for Desktop OpenGL >> only? >> >> -- >> Viele Gr??e / Best regards / Sinc?res >> >> salutations >> >> Konrad Ley >> >> System Engineer Software >> Comfort and Driving Assistance Systems (CDA) >> Driving Assistance Research (DAR) >> Site Kronach >> Hummendorfer Str. 72 >> 96317 Kronach >> >> Phone: >> E-Mail: konrad.ley at valeo.com >> >> Valeo Schalter und Sensoren GmbH >> Laiernstrasse 12 >> 74321 Bietigheim-Bissingen, >> Sitz der Gesellschaft: 74321 Bietigheim-Bissingen >> Handelsregister: Amtsgericht Stuttgart - HRB 301795 >> Vorsitzender des Aufsichtsrates: Derrick Zechmair >> Gesch?ftsf?hrer: Jens H?lker, Martin Mandry, Stiv Michael Smudja, Pierre-Yves >> Veltois >> >> *This e-mail message is intended only for the use of the intended recipient(s). >> The information contained therein may be confidential or privileged, >> and its disclosure or reproduction is strictly prohibited. >> If you are not the intended recipient, please return it immediately to its sender >> at the above address and destroy it. * >> >> >> *This e-mail message is intended for the internal use of the intended recipient(s) only. >> The information contained herein is confidential/privileged. Its disclosure or reproduction is strictly prohibited. >> If you are not the intended recipient, please inform the sender immediately, do not disclose it internally or to third parties and destroy it.* >> >> _______________________________________________ >> 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 >> > -- Viele Gr??e / Best regards / Sinc?res salutations Konrad Ley System Engineer Software Comfort and Driving Assistance Systems (CDA) Driving Assistance Research (DAR) Site Kronach Hummendorfer Str. 72 96317 Kronach Phone: E-Mail: konrad.ley at valeo.com Valeo Schalter und Sensoren GmbH Laiernstrasse 12 74321 Bietigheim-Bissingen, Sitz der Gesellschaft: 74321 Bietigheim-Bissingen Handelsregister: Amtsgericht Stuttgart - HRB 301795 Vorsitzender des Aufsichtsrates: Derrick Zechmair Gesch?ftsf?hrer: Jens H?lker, Martin Mandry, Stiv Michael Smudja, Pierre-Yves Veltois *This e-mail message is intended only for the use of the intended recipient(s). The information contained therein may be confidential or privileged, and its disclosure or reproduction is strictly prohibited. If you are not the intended recipient, please return it immediately to its sender at the above address and destroy it. * -- Viele Gr??e / Best regards / Sinc?res salutations Konrad Ley System Engineer Software Comfort and Driving Assistance Systems (CDA) Driving Assistance Research (DAR) Site Kronach Hummendorfer Str. 72 96317 Kronach Phone: E-Mail: konrad.ley at valeo.com Valeo Schalter und Sensoren GmbH Laiernstrasse 12 74321 Bietigheim-Bissingen, Sitz der Gesellschaft: 74321 Bietigheim-Bissingen Handelsregister: Amtsgericht Stuttgart - HRB 301795 Vorsitzender des Aufsichtsrates: Derrick Zechmair Gesch?ftsf?hrer: Jens H?lker, Martin Mandry, Stiv Michael Smudja, Pierre-Yves Veltois *This e-mail message is intended only for the use of the intended recipient(s). The information contained therein may be confidential or privileged, and its disclosure or reproduction is strictly prohibited. If you are not the intended recipient, please return it immediately to its sender at the above address and destroy it. * -- *This e-mail message is intended for the internal use of the intended recipient(s) only. The information contained herein is confidential/privileged. Its disclosure or reproduction is strictly prohibited. If you are not the intended recipient, please inform the sender immediately, do not disclose it internally or to third parties and destroy it.* -------------- next part -------------- An HTML attachment was scrubbed... URL: From nztoddler at yahoo.com Wed Jul 11 07:27:05 2018 From: nztoddler at yahoo.com (Todd) Date: Wed, 11 Jul 2018 23:27:05 +1200 Subject: [vtkusers] Problem initializing GLEW with vtk8.1 In-Reply-To: <87388158-afc8-4b9a-a5fb-a1950e5e78c7@email.android.com> Message-ID: An HTML attachment was scrubbed... URL: From babybishops at gmail.com Wed Jul 11 08:38:47 2018 From: babybishops at gmail.com (J.) Date: Wed, 11 Jul 2018 13:38:47 +0100 Subject: [vtkusers] VTK with Qt5 - Timer stops running as soon as I interact with the window Message-ID: I want to display an animation while allowing the user to rotate and pan the view. For this reason I've been using TimerEvent, and it was working fine until I started using the Qt bindings. What's happening is that as soon as I interact with the window in any way, such as clicking in side it, the timer stops firing. I created a minimal example to show what I mean. This is with VTK 8 and Qt 5. https://pastebin.com/XV8eGSnc -------------- next part -------------- An HTML attachment was scrubbed... URL: From lasso at queensu.ca Wed Jul 11 09:06:58 2018 From: lasso at queensu.ca (Andras Lasso) Date: Wed, 11 Jul 2018 13:06:58 +0000 Subject: [vtkusers] machining simulation and collision detection In-Reply-To: <1531292548828-0.post@n5.nabble.com> References: <1530181664677-0.post@n5.nabble.com> <1531292548828-0.post@n5.nabble.com> Message-ID: You need to replace vtkSlicerRtCommonWin32Header.h and VTK_SLICERRTCOMMON_EXPORT with your export header and macro. Andras -----Original Message----- From: vtkusers On Behalf Of shayan moradkhani Sent: Wednesday, July 11, 2018 3:02 AM To: vtkusers at vtk.org Subject: Re: [vtkusers] machining simulation and collision detection hi, i'm using this collision detection that you put the link for. i just copy pasted the code and got bunch of red lines including (#include "vtkSlicerRtCommonWin32Header.h") and many undefined parameters! what am i missing/doing wrong here ? shayan -- 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%7C336f83532936489f843308d5e6fc4bb7%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636668893645830928&sdata=skzs9YRV%2FmRNtdpGKnliG8igf24ktphc%2Bx0opnXI9k8%3D&reserved=0 _______________________________________________ Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Classo%40queensu.ca%7C336f83532936489f843308d5e6fc4bb7%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636668893645830928&sdata=Ly1BsWmG1jC7XHazeGPgg5%2Fm6woNP377QA30Bss2tws%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%7C336f83532936489f843308d5e6fc4bb7%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636668893645830928&sdata=JOHPz5MqfS0zXMvdhKcBHtK9S2oekXt3WYMZG%2Fc%2B9F8%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%7C336f83532936489f843308d5e6fc4bb7%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636668893645830928&sdata=jgBYiAPflxsRq3Sa93RumVENfpXrH0G9kzUvi8QBTjE%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%7C336f83532936489f843308d5e6fc4bb7%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636668893645830928&sdata=T7X9QyyIrIMX2dlTFaActD5tlEuFpum8ZTMlLfNT730%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%7C336f83532936489f843308d5e6fc4bb7%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636668893645830928&sdata=fBqDjFxBFOmo9stTFI59rPp0pjfgKhwbPZ%2F7Kc6U0lc%3D&reserved=0 From aron.helser at kitware.com Wed Jul 11 09:16:33 2018 From: aron.helser at kitware.com (Aron Helser) Date: Wed, 11 Jul 2018 09:16:33 -0400 Subject: [vtkusers] Is there any way to prepare datasets for vtk.js? In-Reply-To: References: Message-ID: Hi Alexey, This example: https://kitware.github.io/vtk-js/examples/StandaloneSceneLoader.html references this macro from vtk-js: Utilities/ParaView/export-scene-macro.py It can be used to export a scene from ParaView for consumption by vtk-js. I know there are other ways to do it as well, but that was the easiest. HTH, Aron On Wed, Jul 11, 2018 at 5:54 AM Alexey Pechnikov wrote: > Hi, > > I couldn't find any documentation or tool to do it. Google doesn't know > anything about "vti-web" data format. VTK/VTI and other VTK formats are not > allowed I see. Is disassembling example datasets and build own tools the > only possible way?! > > -- > Best regards, Alexey Pechnikov. > _______________________________________________ > 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 ochampao at hotmail.com Wed Jul 11 09:32:34 2018 From: ochampao at hotmail.com (ochampao) Date: Wed, 11 Jul 2018 06:32:34 -0700 (MST) Subject: [vtkusers] Extracted cross-section from vtkCutter cannot be displayed In-Reply-To: <1531303216243-0.post@n5.nabble.com> References: <1531232872553-0.post@n5.nabble.com> <1531232993932-0.post@n5.nabble.com> <1531303216243-0.post@n5.nabble.com> Message-ID: <1531315954010-0.post@n5.nabble.com> After lots of searching in VTK users mailing list, I came across this post: http://vtk.1045678.n5.nabble.com/black-contour-instead-of-colors-after-vtkcutter-td5738068.html which helped me solve the issues. Essentially, the actors were placed on the view but they were not visible. To mitigate this I have added the following two lines of code: cutterActor->GetProperty()->LightingOff(); cutterActor->GetProperty()->SetAmbient(1.0); This solved the problem. Thanks, P. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From aron.helser at kitware.com Wed Jul 11 10:08:33 2018 From: aron.helser at kitware.com (Aron Helser) Date: Wed, 11 Jul 2018 10:08:33 -0400 Subject: [vtkusers] Is there any way to prepare datasets for vtk.js? In-Reply-To: References: Message-ID: Adding back the mailing list.... Alexey, Do you have a particular goal, or do you just want to try out vtk-js? If you just want to see what it can do, it is used the rendering in ParaView Glance, which you can try out here: https://kitware.github.io/paraview-glance/nightly/ It will load several different data formats, or just start with the example datasets. As you can see, vtk-js is used for real and useful projects. For just VTK-js, the example applications like the OBJ viewer: https://kitware.github.io/vtk-js/examples/OBJViewer.html are a good starting point - there are several that will load different formats of data. The script I pointed you at is a ParaView macro, which means that after running the ParaView application, you add it by going to the Macro menu and choosing 'Add new macro...' Regards, Aron On Wed, Jul 11, 2018 at 9:59 AM Alexey Pechnikov wrote: > Aron, > > That script doesn't work in python2/python3 (there is no paraview > extension) and it doesn't work in internal Paraview Python shell. Maybe do > you know some working way? Or do you mean I need to write my own script > using this one instead of normal documentation? Is vtk-js used by somebody > or it's only just to fun unuseful project? Maybe I don't need to try it > actually. > > 2018-07-11 20:16 GMT+07:00 Aron Helser : > >> Hi Alexey, >> This example: >> https://kitware.github.io/vtk-js/examples/StandaloneSceneLoader.html >> references this macro from >> vtk-js: Utilities/ParaView/export-scene-macro.py >> It can be used to export a scene from ParaView for consumption by vtk-js. >> >> I know there are other ways to do it as well, but that was the easiest. >> HTH, >> Aron >> >> On Wed, Jul 11, 2018 at 5:54 AM Alexey Pechnikov >> wrote: >> >>> Hi, >>> >>> I couldn't find any documentation or tool to do it. Google doesn't know >>> anything about "vti-web" data format. VTK/VTI and other VTK formats are not >>> allowed I see. Is disassembling example datasets and build own tools the >>> only possible way?! >>> >>> -- >>> Best regards, Alexey Pechnikov. >>> _______________________________________________ >>> 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 >>> >> > > > -- > Best regards, Alexey Pechnikov. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From marvin.huber at basf.com Wed Jul 11 10:11:10 2018 From: marvin.huber at basf.com (marf) Date: Wed, 11 Jul 2018 07:11:10 -0700 (MST) Subject: [vtkusers] Loading a .vtu file in vtkjs Message-ID: <1531318270640-0.post@n5.nabble.com> Hello, maybe someone can help me. I'm currently trying to display a .vtu file in my browser using vtkjs. I tried to follow the example for the PolyDataReader , but even with adjusting stuff the best I could get was an error stating "No input" I tried getting the .vtu from a server and having it locally. For both I tried passing it as an ArrayBuffer through reader.setInputArrayToProcess(0, fileArrayBuffer, 0); and loading it through a url using reader.setUrl('assets/model.vtu'); Any help or hints would be appreciated :-) Marvin -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From pechnikov at mobigroup.ru Wed Jul 11 10:29:44 2018 From: pechnikov at mobigroup.ru (Alexey Pechnikov) Date: Wed, 11 Jul 2018 21:29:44 +0700 Subject: [vtkusers] Is there any way to prepare datasets for vtk.js? In-Reply-To: References: Message-ID: Aron, Thank you for the links! I just want to try it. As sample I have large enough 3D grid (~100MB) that I want to show it by vtk-js. I don't know how to work with large files by vtk-js... maybe need I use small reducted dataset for 3D preview and load full slices from server? I found aneurism.vti viewer at https://kitware.github.io/paraview-glance/nightly It looks very interesting but the used datafile is small here. Sorry, the script doesn't work as Paraview macro: ERROR: In /Users/kitware/dashboards/buildbot-slave/8275bd07/build/superbuild/paraview/src/VTK/Rendering/OpenGL2/vtkShaderProgram.cxx, line 445 vtkShaderProgram (0x60c00058d5b0): 1: #version 150 2: #ifdef GL_ES 3: #if __VERSION__ == 300 4: #define varying in 5: #ifdef GL_FRAGMENT_PRECISION_HIGH 6: precision highp float; 7: precision highp sampler2D; 8: precision highp sampler3D; 9: #else 10: precision mediump float; 11: precision mediump sampler2D; 12: precision mediump sampler3D; 13: #endif 14: #define texelFetchBuffer texelFetch 15: #define texture1D texture 16: #define texture2D texture 17: #define texture3D texture 18: #endif // 300 19: #else // GL_ES 20: #define highp 21: #define mediump 22: #define lowp 23: #if __VERSION__ == 150 24: #define varying in 25: #define texelFetchBuffer texelFetch 26: #define texture1D texture 27: #define texture2D texture 28: #define texture3D texture 29: #endif 30: #if __VERSION__ == 120 31: #extension GL_EXT_gpu_shader4 : require 32: #endif 33: #endif // GL_ES 34: 35: 36: /*========================================================================= 37: 38: Program: Visualization Toolkit 39: Module: raycasterfs.glsl 40: 41: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 42: All rights reserved. 43: See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 44: 45: This software is distributed WITHOUT ANY WARRANTY; without even 46: the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 47: PURPOSE. See the above copyright notice for more information. 48: 49: =========================================================================*/ 50: 51: ////////////////////////////////////////////////////////////////////////////// 52: /// 53: /// Inputs 54: /// 55: ////////////////////////////////////////////////////////////////////////////// 56: 57: /// 3D texture coordinates form vertex shader 58: varying vec3 ip_textureCoords; 59: varying vec3 ip_vertexPos; 60: 61: ////////////////////////////////////////////////////////////////////////////// 62: /// 63: /// Outputs 64: /// 65: ////////////////////////////////////////////////////////////////////////////// 66: 67: vec4 g_fragColor = vec4(0.0); 68: 69: ////////////////////////////////////////////////////////////////////////////// 70: /// 71: /// Uniforms, attributes, and globals 72: /// 73: ////////////////////////////////////////////////////////////////////////////// 74: vec3 g_dataPos; 75: vec3 g_dirStep; 76: vec4 g_srcColor; 77: vec4 g_eyePosObj; 78: bool g_exit; 79: bool g_skip; 80: float g_currentT; 81: float g_terminatePointMax; 82: 83: out vec4 fragOutput0; 84: 85: 86: uniform sampler3D in_volume[1]; 87: uniform vec4 in_volume_scale[1]; 88: uniform vec4 in_volume_bias[1]; 89: uniform int in_noOfComponents; 90: uniform int in_independentComponents; 91: 92: uniform sampler2D in_noiseSampler; 93: #ifndef GL_ES 94: uniform sampler2D in_depthSampler; 95: #endif 96: 97: // Camera position 98: uniform vec3 in_cameraPos; 99: uniform mat4 in_volumeMatrix[1]; 100: uniform mat4 in_inverseVolumeMatrix[1]; 101: uniform mat4 in_textureDatasetMatrix[1]; 102: uniform mat4 in_inverseTextureDatasetMatrix[1]; 103: uniform mat4 in_textureToEye[1]; 104: uniform vec3 in_texMin[1]; 105: uniform vec3 in_texMax[1]; 106: uniform mat4 in_cellToPoint[1]; 107: // view and model matrices 108: uniform mat4 in_projectionMatrix; 109: uniform mat4 in_inverseProjectionMatrix; 110: uniform mat4 in_modelViewMatrix; 111: uniform mat4 in_inverseModelViewMatrix; 112: varying mat4 ip_inverseTextureDataAdjusted; 113: 114: // Ray step size 115: uniform vec3 in_cellStep[1]; 116: uniform vec2 in_scalarsRange[4]; 117: uniform vec3 in_cellSpacing[1]; 118: 119: // Sample distance 120: uniform float in_sampleDistance; 121: 122: // Scales 123: uniform vec2 in_windowLowerLeftCorner; 124: uniform vec2 in_inverseOriginalWindowSize; 125: uniform vec2 in_inverseWindowSize; 126: uniform vec3 in_textureExtentsMax; 127: uniform vec3 in_textureExtentsMin; 128: 129: // Material and lighting 130: uniform vec3 in_diffuse[4]; 131: uniform vec3 in_ambient[4]; 132: uniform vec3 in_specular[4]; 133: uniform float in_shininess[4]; 134: 135: // Others 136: uniform bool in_useJittering; 137: vec3 g_rayJitter = vec3(0.0); 138: 139: uniform vec2 in_averageIPRange; 140: uniform vec3 in_lightAmbientColor[1]; 141: uniform vec3 in_lightDiffuseColor[1]; 142: uniform vec3 in_lightSpecularColor[1]; 143: vec4 g_lightPosObj; 144: vec3 g_ldir; 145: vec3 g_vdir; 146: vec3 g_h; 147: 148: 149: 150: const float g_opacityThreshold = 1.0 - 1.0 / 255.0; 151: 152: 153: 154: 155: int clippingPlanesSize; 156: vec3 objRayDir; 157: mat4 textureToObjMat; 158: 159: 160: 161: 162: 163: 164: 165: //VTK::GradientCache::Dec 166: 167: //VTK::Transfer2D::Dec 168: 169: uniform sampler2D in_opacityTransferFunc_0[1]; 170: 171: float computeOpacity(vec4 scalar) 172: { 173: return texture2D(in_opacityTransferFunc_0[0], vec2(scalar.w, 0)).r; 174: } 175: 176: vec4 computeGradient(in vec3 texPos, in int c, in sampler3D volume, in int index) 177: { 178: return vec4(0.0); 179: } 180: 181: 182: uniform sampler2D [1]; 183: 184: 185: 186: vec4 computeLighting(vec4 color, int component) 187: { 188: vec4 finalColor = vec4(0.0); 189: finalColor = vec4(color.rgb, 0.0); 190: finalColor.a = color.a; 191: return finalColor; 192: } 193: 194: uniform sampler2D in_colorTransferFunc_0[1]; 195: 196: vec4 computeColor(vec4 scalar, float opacity) 197: { 198: return computeLighting(vec4(texture2D(in_colorTransferFunc_0[0], 199: vec2(scalar.w, 0.0)).xyz, opacity), 0); 200: } 201: 202: 203: vec3 computeRayDirection() 204: { 205: return normalize(ip_vertexPos.xyz - g_eyePosObj.xyz); 206: } 207: 208: //VTK::Picking::Dec 209: 210: //VTK::RenderToImage::Dec 211: 212: //VTK::DepthPeeling::Dec 213: 214: /// We support only 8 clipping planes for now 215: /// The first value is the size of the data array for clipping 216: /// planes (origin, normal) 217: uniform float in_clippingPlanes[49]; 218: uniform float in_scale; 219: uniform float in_bias; 220: 221: ////////////////////////////////////////////////////////////////////////////// 222: /// 223: /// Helper functions 224: /// 225: ////////////////////////////////////////////////////////////////////////////// 226: 227: /** 228: * Transform window coordinate to NDC. 229: */ 230: vec4 WindowToNDC(const float xCoord, const float yCoord, const float zCoord) 231: { 232: vec4 NDCCoord = vec4(0.0, 0.0, 0.0, 1.0); 233: 234: NDCCoord.x = (xCoord - in_windowLowerLeftCorner.x) * 2.0 * 235: in_inverseWindowSize.x - 1.0; 236: NDCCoord.y = (yCoord - in_windowLowerLeftCorner.y) * 2.0 * 237: in_inverseWindowSize.y - 1.0; 238: NDCCoord.z = (2.0 * zCoord - (gl_DepthRange.near + gl_DepthRange.far)) / 239: gl_DepthRange.diff; 240: 241: return NDCCoord; 242: } 243: 244: /** 245: * Transform NDC coordinate to window coordinates. 246: */ 247: vec4 NDCToWindow(const float xNDC, const float yNDC, const float zNDC) 248: { 249: vec4 WinCoord = vec4(0.0, 0.0, 0.0, 1.0); 250: 251: WinCoord.x = (xNDC + 1.f) / (2.f * in_inverseWindowSize.x) + 252: in_windowLowerLeftCorner.x; 253: WinCoord.y = (yNDC + 1.f) / (2.f * in_inverseWindowSize.y) + 254: in_windowLowerLeftCorner.y; 255: WinCoord.z = (zNDC * gl_DepthRange.diff + 256: (gl_DepthRange.near + gl_DepthRange.far)) / 2.f; 257: 258: return WinCoord; 259: } 260: 261: ////////////////////////////////////////////////////////////////////////////// 262: /// 263: /// Ray-casting 264: /// 265: ////////////////////////////////////////////////////////////////////////////// 266: 267: /** 268: * Global initialization. This method should only be called once per shader 269: * invocation regardless of whether castRay() is called several times (e.g. 270: * vtkDualDepthPeelingPass). Any castRay() specific initialization should be 271: * placed within that function. 272: */ 273: void initializeRayCast() 274: { 275: /// Initialize g_fragColor (output) to 0 276: g_fragColor = vec4(0.0); 277: g_dirStep = vec3(0.0); 278: g_srcColor = vec4(0.0); 279: g_exit = false; 280: 281: 282: // Get the 3D texture coordinates for lookup into the in_volume dataset 283: g_dataPos = ip_textureCoords.xyz; 284: 285: // Eye position in dataset space 286: g_eyePosObj = in_inverseVolumeMatrix[0] * vec4(in_cameraPos, 1.0); 287: 288: // Getting the ray marching direction (in dataset space); 289: vec3 rayDir = computeRayDirection(); 290: 291: // Multiply the raymarching direction with the step size to get the 292: // sub-step size we need to take at each raymarching step 293: g_dirStep = (ip_inverseTextureDataAdjusted * 294: vec4(rayDir, 0.0)).xyz * in_sampleDistance; 295: 296: // 2D Texture fragment coordinates [0,1] from fragment coordinates. 297: // The frame buffer texture has the size of the plain buffer but 298: // we use a fraction of it. The texture coordinate is less than 1 if 299: // the reduction factor is less than 1. 300: // Device coordinates are between -1 and 1. We need texture 301: // coordinates between 0 and 1. The in_noiseSampler and in_depthSampler 302: // buffers have the original size buffer. 303: vec2 fragTexCoord = (gl_FragCoord.xy - in_windowLowerLeftCorner) * 304: in_inverseWindowSize; 305: 306: if (in_useJittering) 307: { 308: float jitterValue = texture2D(in_noiseSampler, fragTexCoord).x; 309: g_rayJitter = g_dirStep * jitterValue; 310: g_dataPos += g_rayJitter; 311: } 312: else 313: { 314: g_dataPos += g_dirStep; 315: } 316: 317: // Flag to deternmine if voxel should be considered for the rendering 318: g_skip = false; 319: 320: 321: // Flag to indicate if the raymarch loop should terminate 322: bool stop = false; 323: 324: g_terminatePointMax = 0.0; 325: 326: #ifdef GL_ES 327: vec4 l_depthValue = vec4(1.0,1.0,1.0,1.0); 328: #else 329: vec4 l_depthValue = texture2D(in_depthSampler, fragTexCoord); 330: #endif 331: // Depth test 332: if(gl_FragCoord.z >= l_depthValue.x) 333: { 334: discard; 335: } 336: 337: // color buffer or max scalar buffer have a reduced size. 338: fragTexCoord = (gl_FragCoord.xy - in_windowLowerLeftCorner) * 339: in_inverseOriginalWindowSize; 340: 341: // Compute max number of iterations it will take before we hit 342: // the termination point 343: 344: // Abscissa of the point on the depth buffer along the ray. 345: // point in texture coordinates 346: vec4 terminatePoint = WindowToNDC(gl_FragCoord.x, gl_FragCoord.y, l_depthValue.x); 347: 348: // From normalized device coordinates to eye coordinates. 349: // in_projectionMatrix is inversed because of way VT 350: // From eye coordinates to texture coordinates 351: terminatePoint = ip_inverseTextureDataAdjusted * 352: in_inverseVolumeMatrix[0] * 353: in_inverseModelViewMatrix * 354: in_inverseProjectionMatrix * 355: terminatePoint; 356: terminatePoint /= terminatePoint.w; 357: 358: g_terminatePointMax = length(terminatePoint.xyz - g_dataPos.xyz) / 359: length(g_dirStep); 360: g_currentT = 0.0; 361: 362: 363: 364: 365: 366: //VTK::RenderToImage::Init 367: 368: //VTK::DepthPass::Init 369: } 370: 371: /** 372: * March along the ray direction sampling the volume texture. This function 373: * takes a start and end point as arguments but it is up to the specific render 374: * pass implementation to use these values (e.g. vtkDualDepthPeelingPass). The 375: * mapper does not use these values by default, instead it uses the number of 376: * steps defined by g_terminatePointMax. 377: */ 378: vec4 castRay(const float zStart, const float zEnd) 379: { 380: //VTK::DepthPeeling::Ray::Init 381: 382: //VTK::DepthPeeling::Ray::PathCheck 383: 384: 385: 386: /// For all samples along the ray 387: while (!g_exit) 388: { 389: 390: g_skip = false; 391: 392: 393: 394: 395: 396: 397: 398: 399: 400: //VTK::PreComputeGradients::Impl 401: 402: 403: if (!g_skip) 404: { 405: vec4 scalar = texture3D(in_volume[0], g_dataPos); 406: scalar.r = scalar.r * in_volume_scale[0].r + in_volume_bias[0].r; 407: scalar = vec4(scalar.r); 408: g_srcColor = vec4(0.0); 409: g_srcColor.a = computeOpacity(scalar); 410: if (g_srcColor.a > 0.0) 411: { 412: g_srcColor = computeColor(scalar, g_srcColor.a); 413: // Opacity calculation using compositing: 414: // Here we use front to back compositing scheme whereby 415: // the current sample value is multiplied to the 416: // currently accumulated alpha and then this product 417: // is subtracted from the sample value to get the 418: // alpha from the previous steps. Next, this alpha is 419: // multiplied with the current sample colour 420: // and accumulated to the composited colour. The alpha 421: // value from the previous steps is then accumulated 422: // to the composited colour alpha. 423: g_srcColor.rgb *= g_srcColor.a; 424: g_fragColor = (1.0f - g_fragColor.a) * g_srcColor + g_fragColor; 425: } 426: } 427: 428: //VTK::RenderToImage::Impl 429: 430: //VTK::DepthPass::Impl 431: 432: /// Advance ray 433: g_dataPos += g_dirStep; 434: 435: 436: if(any(greaterThan(g_dataPos, in_texMax[0])) || 437: any(lessThan(g_dataPos, in_texMin[0]))) 438: { 439: break; 440: } 441: 442: // Early ray termination 443: // if the currently composited colour alpha is already fully saturated 444: // we terminated the loop or if we have hit an obstacle in the 445: // direction of they ray (using depth buffer) we terminate as well. 446: if((g_fragColor.a > g_opacityThreshold) || 447: g_currentT >= g_terminatePointMax) 448: { 449: break; 450: } 451: ++g_currentT; 452: } 453: 454: 455: 456: return g_fragColor; 457: } 458: 459: /** 460: * Finalize specific modes and set output data. 461: */ 462: void finalizeRayCast() 463: { 464: 465: 466: 467: 468: 469: 470: 471: 472: 473: // Special coloring mode which renders the voxel index in fragments that 474: // have accumulated certain level of opacity. Used during the selection 475: // pass vtkHardwareSelection::ID_MID24. 476: if (g_fragColor.a > 3.0/ 255.0) 477: { 478: uvec3 volumeDim = uvec3(in_textureExtentsMax - in_textureExtentsMin); 479: uvec3 voxelCoords = uvec3(volumeDim * g_dataPos); 480: // vtkHardwareSelector assumes index 0 to be empty space, so add uint(1). 481: uint idx = volumeDim.x * volumeDim.y * voxelCoords.z + 482: volumeDim.x * voxelCoords.y + voxelCoords.x + uint(1); 483: idx = ((idx & 0xff000000) >> 24); 484: fragOutput0 = vec4(float(idx % uint(256)) / 255.0, 485: float((idx / uint(256)) % uint(256)) / 255.0, 486: float(idx / uint(65536)) / 255.0, 1.0); 487: } 488: else 489: { 490: fragOutput0 = vec4(0.0); 491: } 492: return; 493: 494: g_fragColor.r = g_fragColor.r * in_scale + in_bias * g_fragColor.a; 495: g_fragColor.g = g_fragColor.g * in_scale + in_bias * g_fragColor.a; 496: g_fragColor.b = g_fragColor.b * in_scale + in_bias * g_fragColor.a; 497: fragOutput0 = g_fragColor; 498: 499: //VTK::RenderToImage::Exit 500: 501: //VTK::DepthPass::Exit 502: } 503: 504: ////////////////////////////////////////////////////////////////////////////// 505: /// 506: /// Main 507: /// 508: ////////////////////////////////////////////////////////////////////////////// 509: void main() 510: { 511: 512: initializeRayCast(); 513: castRay(-1.0, -1.0); 514: finalizeRayCast(); 515: } ERROR: In /Users/kitware/dashboards/buildbot-slave/8275bd07/build/superbuild/paraview/src/VTK/Rendering/OpenGL2/vtkShaderProgram.cxx, line 446 vtkShaderProgram (0x60c00058d5b0): ERROR: 0:483: '&' does not operate on 'unsigned int' and 'int' ERROR: In /Users/kitware/dashboards/buildbot-slave/8275bd07/build/superbuild/paraview/src/VTK/Rendering/VolumeOpenGL2/vtkOpenGLGPUVolumeRayCastMapper.cxx, line 3169 vtkOpenGLGPUVolumeRayCastMapper (0x7fc085e21f60): Shader failed to compile Traceback (most recent call last): File "", line 450, in AttributeError: 'vtkCommonDataModelPython.vtkImageData' object has no attribute 'GetPoints' 2018-07-11 21:08 GMT+07:00 Aron Helser : > Adding back the mailing list.... > > Alexey, > Do you have a particular goal, or do you just want to try out vtk-js? If > you just want to see what it can do, it is used the rendering in ParaView > Glance, which you can try out here: > https://kitware.github.io/paraview-glance/nightly/ > It will load several different data formats, or just start with the > example datasets. As you can see, vtk-js is used for real and useful > projects. > > For just VTK-js, the example applications like the OBJ viewer: > https://kitware.github.io/vtk-js/examples/OBJViewer.html > are a good starting point - there are several that will load different > formats of data. > > The script I pointed you at is a ParaView macro, which means that after > running the ParaView application, you add it by going to the Macro menu and > choosing 'Add new macro...' > > Regards, > Aron > > On Wed, Jul 11, 2018 at 9:59 AM Alexey Pechnikov > wrote: > >> Aron, >> >> That script doesn't work in python2/python3 (there is no paraview >> extension) and it doesn't work in internal Paraview Python shell. Maybe do >> you know some working way? Or do you mean I need to write my own script >> using this one instead of normal documentation? Is vtk-js used by somebody >> or it's only just to fun unuseful project? Maybe I don't need to try it >> actually. >> >> 2018-07-11 20:16 GMT+07:00 Aron Helser : >> >>> Hi Alexey, >>> This example: https://kitware.github.io/vtk-js/examples/ >>> StandaloneSceneLoader.html >>> references this macro from vtk-js: Utilities/ParaView/ >>> export-scene-macro.py >>> It can be used to export a scene from ParaView for consumption by >>> vtk-js. >>> >>> I know there are other ways to do it as well, but that was the easiest. >>> HTH, >>> Aron >>> >>> On Wed, Jul 11, 2018 at 5:54 AM Alexey Pechnikov >>> wrote: >>> >>>> Hi, >>>> >>>> I couldn't find any documentation or tool to do it. Google doesn't know >>>> anything about "vti-web" data format. VTK/VTI and other VTK formats are not >>>> allowed I see. Is disassembling example datasets and build own tools the >>>> only possible way?! >>>> >>>> -- >>>> Best regards, Alexey Pechnikov. >>>> _______________________________________________ >>>> 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 >>>> >>> >> >> >> -- >> Best regards, Alexey Pechnikov. >> > -- Best regards, Alexey Pechnikov. -------------- next part -------------- An HTML attachment was scrubbed... URL: From aron.helser at kitware.com Wed Jul 11 10:59:00 2018 From: aron.helser at kitware.com (Aron Helser) Date: Wed, 11 Jul 2018 10:59:00 -0400 Subject: [vtkusers] Is there any way to prepare datasets for vtk.js? In-Reply-To: References: Message-ID: Yes, the example data files are usually small, because they have to be delivered over the network. I don't think there is anything to prevent a large file from working locally - are you seeing particular errors with your data file? It could be it is just slow to load. Also, I was getting a blank window with some of the ParaView Glance examples with the nightly build - you might try the 'stable' build instead, which worked for me. https://kitware.github.io/paraview-glance/ I don't know why you are seeing the error in the paraview macro - it could be a version mismatch. I am not sure which version of ParaView is required. On Wed, Jul 11, 2018 at 10:29 AM Alexey Pechnikov wrote: > Aron, > > Thank you for the links! I just want to try it. As sample I have large > enough 3D grid (~100MB) that I want to show it by vtk-js. I don't know how > to work with large files by vtk-js... maybe need I use small reducted > dataset for 3D preview and load full slices from server? > > I found aneurism.vti viewer at > https://kitware.github.io/paraview-glance/nightly It looks very > interesting but the used datafile is small here. > > > Sorry, the script doesn't work as Paraview macro: > > ERROR: In > /Users/kitware/dashboards/buildbot-slave/8275bd07/build/superbuild/paraview/src/VTK/Rendering/OpenGL2/vtkShaderProgram.cxx, > line 445 > > vtkShaderProgram (0x60c00058d5b0): 1: #version 150 > > 2: #ifdef GL_ES > > 3: #if __VERSION__ == 300 > > 4: #define varying in > > 5: #ifdef GL_FRAGMENT_PRECISION_HIGH > > 6: precision highp float; > > 7: precision highp sampler2D; > > 8: precision highp sampler3D; > > 9: #else > > 10: precision mediump float; > > 11: precision mediump sampler2D; > > 12: precision mediump sampler3D; > > 13: #endif > > 14: #define texelFetchBuffer texelFetch > > 15: #define texture1D texture > > 16: #define texture2D texture > > 17: #define texture3D texture > > 18: #endif // 300 > > 19: #else // GL_ES > > 20: #define highp > > 21: #define mediump > > 22: #define lowp > > 23: #if __VERSION__ == 150 > > 24: #define varying in > > 25: #define texelFetchBuffer texelFetch > > 26: #define texture1D texture > > 27: #define texture2D texture > > 28: #define texture3D texture > > 29: #endif > > 30: #if __VERSION__ == 120 > > 31: #extension GL_EXT_gpu_shader4 : require > > 32: #endif > > 33: #endif // GL_ES > > 34: > > 35: > > 36: > /*========================================================================= > > 37: > > 38: Program: Visualization Toolkit > > 39: Module: raycasterfs.glsl > > 40: > > 41: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen > > 42: All rights reserved. > > 43: See Copyright.txt or http://www.kitware.com/Copyright.htm for details. > > 44: > > 45: This software is distributed WITHOUT ANY WARRANTY; without even > > 46: the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR > > 47: PURPOSE. See the above copyright notice for more information. > > 48: > > 49: > =========================================================================*/ > > 50: > > 51: > ////////////////////////////////////////////////////////////////////////////// > > 52: /// > > 53: /// Inputs > > 54: /// > > 55: > ////////////////////////////////////////////////////////////////////////////// > > 56: > > 57: /// 3D texture coordinates form vertex shader > > 58: varying vec3 ip_textureCoords; > > 59: varying vec3 ip_vertexPos; > > 60: > > 61: > ////////////////////////////////////////////////////////////////////////////// > > 62: /// > > 63: /// Outputs > > 64: /// > > 65: > ////////////////////////////////////////////////////////////////////////////// > > 66: > > 67: vec4 g_fragColor = vec4(0.0); > > 68: > > 69: > ////////////////////////////////////////////////////////////////////////////// > > 70: /// > > 71: /// Uniforms, attributes, and globals > > 72: /// > > 73: > ////////////////////////////////////////////////////////////////////////////// > > 74: vec3 g_dataPos; > > 75: vec3 g_dirStep; > > 76: vec4 g_srcColor; > > 77: vec4 g_eyePosObj; > > 78: bool g_exit; > > 79: bool g_skip; > > 80: float g_currentT; > > 81: float g_terminatePointMax; > > 82: > > 83: out vec4 fragOutput0; > > 84: > > 85: > > 86: uniform sampler3D in_volume[1]; > > 87: uniform vec4 in_volume_scale[1]; > > 88: uniform vec4 in_volume_bias[1]; > > 89: uniform int in_noOfComponents; > > 90: uniform int in_independentComponents; > > 91: > > 92: uniform sampler2D in_noiseSampler; > > 93: #ifndef GL_ES > > 94: uniform sampler2D in_depthSampler; > > 95: #endif > > 96: > > 97: // Camera position > > 98: uniform vec3 in_cameraPos; > > 99: uniform mat4 in_volumeMatrix[1]; > > 100: uniform mat4 in_inverseVolumeMatrix[1]; > > 101: uniform mat4 in_textureDatasetMatrix[1]; > > 102: uniform mat4 in_inverseTextureDatasetMatrix[1]; > > 103: uniform mat4 in_textureToEye[1]; > > 104: uniform vec3 in_texMin[1]; > > 105: uniform vec3 in_texMax[1]; > > 106: uniform mat4 in_cellToPoint[1]; > > 107: // view and model matrices > > 108: uniform mat4 in_projectionMatrix; > > 109: uniform mat4 in_inverseProjectionMatrix; > > 110: uniform mat4 in_modelViewMatrix; > > 111: uniform mat4 in_inverseModelViewMatrix; > > 112: varying mat4 ip_inverseTextureDataAdjusted; > > 113: > > 114: // Ray step size > > 115: uniform vec3 in_cellStep[1]; > > 116: uniform vec2 in_scalarsRange[4]; > > 117: uniform vec3 in_cellSpacing[1]; > > 118: > > 119: // Sample distance > > 120: uniform float in_sampleDistance; > > 121: > > 122: // Scales > > 123: uniform vec2 in_windowLowerLeftCorner; > > 124: uniform vec2 in_inverseOriginalWindowSize; > > 125: uniform vec2 in_inverseWindowSize; > > 126: uniform vec3 in_textureExtentsMax; > > 127: uniform vec3 in_textureExtentsMin; > > 128: > > 129: // Material and lighting > > 130: uniform vec3 in_diffuse[4]; > > 131: uniform vec3 in_ambient[4]; > > 132: uniform vec3 in_specular[4]; > > 133: uniform float in_shininess[4]; > > 134: > > 135: // Others > > 136: uniform bool in_useJittering; > > 137: vec3 g_rayJitter = vec3(0.0); > > 138: > > 139: uniform vec2 in_averageIPRange; > > 140: uniform vec3 in_lightAmbientColor[1]; > > 141: uniform vec3 in_lightDiffuseColor[1]; > > 142: uniform vec3 in_lightSpecularColor[1]; > > 143: vec4 g_lightPosObj; > > 144: vec3 g_ldir; > > 145: vec3 g_vdir; > > 146: vec3 g_h; > > 147: > > 148: > > 149: > > 150: const float g_opacityThreshold = 1.0 - 1.0 / 255.0; > > 151: > > 152: > > 153: > > 154: > > 155: int clippingPlanesSize; > > 156: vec3 objRayDir; > > 157: mat4 textureToObjMat; > > 158: > > 159: > > 160: > > 161: > > 162: > > 163: > > 164: > > 165: //VTK::GradientCache::Dec > > 166: > > 167: //VTK::Transfer2D::Dec > > 168: > > 169: uniform sampler2D in_opacityTransferFunc_0[1]; > > 170: > > 171: float computeOpacity(vec4 scalar) > > 172: { > > 173: return texture2D(in_opacityTransferFunc_0[0], vec2(scalar.w, 0)).r; > > 174: } > > 175: > > 176: vec4 computeGradient(in vec3 texPos, in int c, in sampler3D volume, > in int index) > > 177: { > > 178: return vec4(0.0); > > 179: } > > 180: > > 181: > > 182: uniform sampler2D [1]; > > 183: > > 184: > > 185: > > 186: vec4 computeLighting(vec4 color, int component) > > 187: { > > 188: vec4 finalColor = vec4(0.0); > > 189: finalColor = vec4(color.rgb, 0.0); > > 190: finalColor.a = color.a; > > 191: return finalColor; > > 192: } > > 193: > > 194: uniform sampler2D in_colorTransferFunc_0[1]; > > 195: > > 196: vec4 computeColor(vec4 scalar, float opacity) > > 197: { > > 198: return computeLighting(vec4(texture2D(in_colorTransferFunc_0[0], > > 199: vec2(scalar.w, 0.0)).xyz, opacity), 0); > > 200: } > > 201: > > 202: > > 203: vec3 computeRayDirection() > > 204: { > > 205: return normalize(ip_vertexPos.xyz - g_eyePosObj.xyz); > > 206: } > > 207: > > 208: //VTK::Picking::Dec > > 209: > > 210: //VTK::RenderToImage::Dec > > 211: > > 212: //VTK::DepthPeeling::Dec > > 213: > > 214: /// We support only 8 clipping planes for now > > 215: /// The first value is the size of the data array for clipping > > 216: /// planes (origin, normal) > > 217: uniform float in_clippingPlanes[49]; > > 218: uniform float in_scale; > > 219: uniform float in_bias; > > 220: > > 221: > ////////////////////////////////////////////////////////////////////////////// > > 222: /// > > 223: /// Helper functions > > 224: /// > > 225: > ////////////////////////////////////////////////////////////////////////////// > > 226: > > 227: /** > > 228: * Transform window coordinate to NDC. > > 229: */ > > 230: vec4 WindowToNDC(const float xCoord, const float yCoord, const float > zCoord) > > 231: { > > 232: vec4 NDCCoord = vec4(0.0, 0.0, 0.0, 1.0); > > 233: > > 234: NDCCoord.x = (xCoord - in_windowLowerLeftCorner.x) * 2.0 * > > 235: in_inverseWindowSize.x - 1.0; > > 236: NDCCoord.y = (yCoord - in_windowLowerLeftCorner.y) * 2.0 * > > 237: in_inverseWindowSize.y - 1.0; > > 238: NDCCoord.z = (2.0 * zCoord - (gl_DepthRange.near + > gl_DepthRange.far)) / > > 239: gl_DepthRange.diff; > > 240: > > 241: return NDCCoord; > > 242: } > > 243: > > 244: /** > > 245: * Transform NDC coordinate to window coordinates. > > 246: */ > > 247: vec4 NDCToWindow(const float xNDC, const float yNDC, const float zNDC) > > 248: { > > 249: vec4 WinCoord = vec4(0.0, 0.0, 0.0, 1.0); > > 250: > > 251: WinCoord.x = (xNDC + 1.f) / (2.f * in_inverseWindowSize.x) + > > 252: in_windowLowerLeftCorner.x; > > 253: WinCoord.y = (yNDC + 1.f) / (2.f * in_inverseWindowSize.y) + > > 254: in_windowLowerLeftCorner.y; > > 255: WinCoord.z = (zNDC * gl_DepthRange.diff + > > 256: (gl_DepthRange.near + gl_DepthRange.far)) / 2.f; > > 257: > > 258: return WinCoord; > > 259: } > > 260: > > 261: > ////////////////////////////////////////////////////////////////////////////// > > 262: /// > > 263: /// Ray-casting > > 264: /// > > 265: > ////////////////////////////////////////////////////////////////////////////// > > 266: > > 267: /** > > 268: * Global initialization. This method should only be called once per > shader > > 269: * invocation regardless of whether castRay() is called several times > (e.g. > > 270: * vtkDualDepthPeelingPass). Any castRay() specific initialization > should be > > 271: * placed within that function. > > 272: */ > > 273: void initializeRayCast() > > 274: { > > 275: /// Initialize g_fragColor (output) to 0 > > 276: g_fragColor = vec4(0.0); > > 277: g_dirStep = vec3(0.0); > > 278: g_srcColor = vec4(0.0); > > 279: g_exit = false; > > 280: > > 281: > > 282: // Get the 3D texture coordinates for lookup into the in_volume > dataset > > 283: g_dataPos = ip_textureCoords.xyz; > > 284: > > 285: // Eye position in dataset space > > 286: g_eyePosObj = in_inverseVolumeMatrix[0] * vec4(in_cameraPos, 1.0); > > 287: > > 288: // Getting the ray marching direction (in dataset space); > > 289: vec3 rayDir = computeRayDirection(); > > 290: > > 291: // Multiply the raymarching direction with the step size to get the > > 292: // sub-step size we need to take at each raymarching step > > 293: g_dirStep = (ip_inverseTextureDataAdjusted * > > 294: vec4(rayDir, 0.0)).xyz * in_sampleDistance; > > 295: > > 296: // 2D Texture fragment coordinates [0,1] from fragment coordinates. > > 297: // The frame buffer texture has the size of the plain buffer but > > 298: // we use a fraction of it. The texture coordinate is less than 1 if > > 299: // the reduction factor is less than 1. > > 300: // Device coordinates are between -1 and 1. We need texture > > 301: // coordinates between 0 and 1. The in_noiseSampler and > in_depthSampler > > 302: // buffers have the original size buffer. > > 303: vec2 fragTexCoord = (gl_FragCoord.xy - in_windowLowerLeftCorner) * > > 304: in_inverseWindowSize; > > 305: > > 306: if (in_useJittering) > > 307: { > > 308: float jitterValue = texture2D(in_noiseSampler, fragTexCoord).x; > > 309: g_rayJitter = g_dirStep * jitterValue; > > 310: g_dataPos += g_rayJitter; > > 311: } > > 312: else > > 313: { > > 314: g_dataPos += g_dirStep; > > 315: } > > 316: > > 317: // Flag to deternmine if voxel should be considered for the rendering > > 318: g_skip = false; > > 319: > > 320: > > 321: // Flag to indicate if the raymarch loop should terminate > > 322: bool stop = false; > > 323: > > 324: g_terminatePointMax = 0.0; > > 325: > > 326: #ifdef GL_ES > > 327: vec4 l_depthValue = vec4(1.0,1.0,1.0,1.0); > > 328: #else > > 329: vec4 l_depthValue = texture2D(in_depthSampler, fragTexCoord); > > 330: #endif > > 331: // Depth test > > 332: if(gl_FragCoord.z >= l_depthValue.x) > > 333: { > > 334: discard; > > 335: } > > 336: > > 337: // color buffer or max scalar buffer have a reduced size. > > 338: fragTexCoord = (gl_FragCoord.xy - in_windowLowerLeftCorner) * > > 339: in_inverseOriginalWindowSize; > > 340: > > 341: // Compute max number of iterations it will take before we hit > > 342: // the termination point > > 343: > > 344: // Abscissa of the point on the depth buffer along the ray. > > 345: // point in texture coordinates > > 346: vec4 terminatePoint = WindowToNDC(gl_FragCoord.x, gl_FragCoord.y, > l_depthValue.x); > > 347: > > 348: // From normalized device coordinates to eye coordinates. > > 349: // in_projectionMatrix is inversed because of way VT > > 350: // From eye coordinates to texture coordinates > > 351: terminatePoint = ip_inverseTextureDataAdjusted * > > 352: in_inverseVolumeMatrix[0] * > > 353: in_inverseModelViewMatrix * > > 354: in_inverseProjectionMatrix * > > 355: terminatePoint; > > 356: terminatePoint /= terminatePoint.w; > > 357: > > 358: g_terminatePointMax = length(terminatePoint.xyz - g_dataPos.xyz) / > > 359: length(g_dirStep); > > 360: g_currentT = 0.0; > > 361: > > 362: > > 363: > > 364: > > 365: > > 366: //VTK::RenderToImage::Init > > 367: > > 368: //VTK::DepthPass::Init > > 369: } > > 370: > > 371: /** > > 372: * March along the ray direction sampling the volume texture. This > function > > 373: * takes a start and end point as arguments but it is up to the > specific render > > 374: * pass implementation to use these values (e.g. > vtkDualDepthPeelingPass). The > > 375: * mapper does not use these values by default, instead it uses the > number of > > 376: * steps defined by g_terminatePointMax. > > 377: */ > > 378: vec4 castRay(const float zStart, const float zEnd) > > 379: { > > 380: //VTK::DepthPeeling::Ray::Init > > 381: > > 382: //VTK::DepthPeeling::Ray::PathCheck > > 383: > > 384: > > 385: > > 386: /// For all samples along the ray > > 387: while (!g_exit) > > 388: { > > 389: > > 390: g_skip = false; > > 391: > > 392: > > 393: > > 394: > > 395: > > 396: > > 397: > > 398: > > 399: > > 400: //VTK::PreComputeGradients::Impl > > 401: > > 402: > > 403: if (!g_skip) > > 404: { > > 405: vec4 scalar = texture3D(in_volume[0], g_dataPos); > > 406: scalar.r = scalar.r * in_volume_scale[0].r + in_volume_bias[0].r; > > 407: scalar = vec4(scalar.r); > > 408: g_srcColor = vec4(0.0); > > 409: g_srcColor.a = computeOpacity(scalar); > > 410: if (g_srcColor.a > 0.0) > > 411: { > > 412: g_srcColor = computeColor(scalar, g_srcColor.a); > > 413: // Opacity calculation using compositing: > > 414: // Here we use front to back compositing scheme whereby > > 415: // the current sample value is multiplied to the > > 416: // currently accumulated alpha and then this product > > 417: // is subtracted from the sample value to get the > > 418: // alpha from the previous steps. Next, this alpha is > > 419: // multiplied with the current sample colour > > 420: // and accumulated to the composited colour. The alpha > > 421: // value from the previous steps is then accumulated > > 422: // to the composited colour alpha. > > 423: g_srcColor.rgb *= g_srcColor.a; > > 424: g_fragColor = (1.0f - g_fragColor.a) * g_srcColor + g_fragColor; > > 425: } > > 426: } > > 427: > > 428: //VTK::RenderToImage::Impl > > 429: > > 430: //VTK::DepthPass::Impl > > 431: > > 432: /// Advance ray > > 433: g_dataPos += g_dirStep; > > 434: > > 435: > > 436: if(any(greaterThan(g_dataPos, in_texMax[0])) || > > 437: any(lessThan(g_dataPos, in_texMin[0]))) > > 438: { > > 439: break; > > 440: } > > 441: > > 442: // Early ray termination > > 443: // if the currently composited colour alpha is already fully > saturated > > 444: // we terminated the loop or if we have hit an obstacle in the > > 445: // direction of they ray (using depth buffer) we terminate as well. > > 446: if((g_fragColor.a > g_opacityThreshold) || > > 447: g_currentT >= g_terminatePointMax) > > 448: { > > 449: break; > > 450: } > > 451: ++g_currentT; > > 452: } > > 453: > > 454: > > 455: > > 456: return g_fragColor; > > 457: } > > 458: > > 459: /** > > 460: * Finalize specific modes and set output data. > > 461: */ > > 462: void finalizeRayCast() > > 463: { > > 464: > > 465: > > 466: > > 467: > > 468: > > 469: > > 470: > > 471: > > 472: > > 473: // Special coloring mode which renders the voxel index in fragments > that > > 474: // have accumulated certain level of opacity. Used during the > selection > > 475: // pass vtkHardwareSelection::ID_MID24. > > 476: if (g_fragColor.a > 3.0/ 255.0) > > 477: { > > 478: uvec3 volumeDim = uvec3(in_textureExtentsMax - in_textureExtentsMin); > > 479: uvec3 voxelCoords = uvec3(volumeDim * g_dataPos); > > 480: // vtkHardwareSelector assumes index 0 to be empty space, so add > uint(1). > > 481: uint idx = volumeDim.x * volumeDim.y * voxelCoords.z + > > 482: volumeDim.x * voxelCoords.y + voxelCoords.x + uint(1); > > 483: idx = ((idx & 0xff000000) >> 24); > > 484: fragOutput0 = vec4(float(idx % uint(256)) / 255.0, > > 485: float((idx / uint(256)) % uint(256)) / 255.0, > > 486: float(idx / uint(65536)) / 255.0, 1.0); > > 487: } > > 488: else > > 489: { > > 490: fragOutput0 = vec4(0.0); > > 491: } > > 492: return; > > 493: > > 494: g_fragColor.r = g_fragColor.r * in_scale + in_bias * g_fragColor.a; > > 495: g_fragColor.g = g_fragColor.g * in_scale + in_bias * g_fragColor.a; > > 496: g_fragColor.b = g_fragColor.b * in_scale + in_bias * g_fragColor.a; > > 497: fragOutput0 = g_fragColor; > > 498: > > 499: //VTK::RenderToImage::Exit > > 500: > > 501: //VTK::DepthPass::Exit > > 502: } > > 503: > > 504: > ////////////////////////////////////////////////////////////////////////////// > > 505: /// > > 506: /// Main > > 507: /// > > 508: > ////////////////////////////////////////////////////////////////////////////// > > 509: void main() > > 510: { > > 511: > > 512: initializeRayCast(); > > 513: castRay(-1.0, -1.0); > > 514: finalizeRayCast(); > > 515: } > > > > ERROR: In > /Users/kitware/dashboards/buildbot-slave/8275bd07/build/superbuild/paraview/src/VTK/Rendering/OpenGL2/vtkShaderProgram.cxx, > line 446 > > vtkShaderProgram (0x60c00058d5b0): ERROR: 0:483: '&' does not operate on > 'unsigned int' and 'int' > > > > ERROR: In > /Users/kitware/dashboards/buildbot-slave/8275bd07/build/superbuild/paraview/src/VTK/Rendering/VolumeOpenGL2/vtkOpenGLGPUVolumeRayCastMapper.cxx, > line 3169 > > vtkOpenGLGPUVolumeRayCastMapper (0x7fc085e21f60): Shader failed to compile > > > Traceback (most recent call last): > > File "", line 450, in > > AttributeError: 'vtkCommonDataModelPython.vtkImageData' object has no > attribute 'GetPoints' > > > > > 2018-07-11 21:08 GMT+07:00 Aron Helser : > >> Adding back the mailing list.... >> >> Alexey, >> Do you have a particular goal, or do you just want to try out vtk-js? If >> you just want to see what it can do, it is used the rendering in ParaView >> Glance, which you can try out here: >> https://kitware.github.io/paraview-glance/nightly/ >> It will load several different data formats, or just start with the >> example datasets. As you can see, vtk-js is used for real and useful >> projects. >> >> For just VTK-js, the example applications like the OBJ viewer: >> https://kitware.github.io/vtk-js/examples/OBJViewer.html >> are a good starting point - there are several that will load different >> formats of data. >> >> The script I pointed you at is a ParaView macro, which means that after >> running the ParaView application, you add it by going to the Macro menu and >> choosing 'Add new macro...' >> >> Regards, >> Aron >> >> On Wed, Jul 11, 2018 at 9:59 AM Alexey Pechnikov >> wrote: >> >>> Aron, >>> >>> That script doesn't work in python2/python3 (there is no paraview >>> extension) and it doesn't work in internal Paraview Python shell. Maybe do >>> you know some working way? Or do you mean I need to write my own script >>> using this one instead of normal documentation? Is vtk-js used by somebody >>> or it's only just to fun unuseful project? Maybe I don't need to try it >>> actually. >>> >>> 2018-07-11 20:16 GMT+07:00 Aron Helser : >>> >>>> Hi Alexey, >>>> This example: >>>> https://kitware.github.io/vtk-js/examples/StandaloneSceneLoader.html >>>> references this macro from >>>> vtk-js: Utilities/ParaView/export-scene-macro.py >>>> It can be used to export a scene from ParaView for consumption by >>>> vtk-js. >>>> >>>> I know there are other ways to do it as well, but that was the easiest. >>>> HTH, >>>> Aron >>>> >>>> On Wed, Jul 11, 2018 at 5:54 AM Alexey Pechnikov < >>>> pechnikov at mobigroup.ru> wrote: >>>> >>>>> Hi, >>>>> >>>>> I couldn't find any documentation or tool to do it. Google doesn't >>>>> know anything about "vti-web" data format. VTK/VTI and other VTK formats >>>>> are not allowed I see. Is disassembling example datasets and build own >>>>> tools the only possible way?! >>>>> >>>>> -- >>>>> Best regards, Alexey Pechnikov. >>>>> _______________________________________________ >>>>> 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 >>>>> >>>> >>> >>> >>> -- >>> Best regards, Alexey Pechnikov. >>> >> > > > -- > Best regards, Alexey Pechnikov. > _______________________________________________ > 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 mathieu.westphal at kitware.com Wed Jul 11 20:18:17 2018 From: mathieu.westphal at kitware.com (Mathieu Westphal) Date: Thu, 12 Jul 2018 02:18:17 +0200 Subject: [vtkusers] Problem initializing GLEW with vtk8.1 In-Reply-To: References: <87388158-afc8-4b9a-a5fb-a1950e5e78c7@email.android.com> Message-ID: Hello, You may want to try with QVTKOpenGLSimpleWidget as well. Please see this examples, available in VTK/GUISupport/Qt/Testing/Cxx Best, Mathieu Westphal On Wed, Jul 11, 2018 at 1:27 PM, Todd via vtkusers < vtkusers at public.kitware.com> wrote: > You might need to install/reinstall Nvidia drivers. > > On 11 Jul 2018 11:08 p.m., Todd wrote: > > The reason I asked, and it might be irrelevant, is that another user was > running a c++ project with VTK 8.1 on Hyper-V, which does not support > opengl 2, and got a similar error. He had to install Mesa. > > On 11 Jul 2018 11:01 p.m., Jothybasu Selvaraj wrote: > > Windows 10 with Nvidia card. > > > > Sent from Mail for > Windows 10 > > > > *From: *Todd > *Sent: *Wednesday, July 11, 2018 9:00 PM > *To: *Jothybasu Selvaraj > *Cc: *VTK Mailing List > *Subject: *Re: [vtkusers] Problem initializing GLEW with vtk8.1 > > > > What platform are you using? > > > > On 11 Jul 2018 10:36 p.m., Jothybasu Selvaraj wrote: > > Dear All > > > > I just build vtk8.1 and tried to render a sphere using QVTKOpelnGLWidget > -hope this is the recommended over QVTKWidget in vtk8.1. > > > > I am getting this error. I am using QtCreator. > > > > vtkGenericOpenGLRenderWindow (00000255BB134430): GLEW could not be > initialized. > > > > I have the following in the header file of the class which renders this: > > #define vtkRenderingCore_AUTOINIT 3(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingOpenGL2) > > #define vtkRenderingVolume_AUTOINIT 1(vtkRenderingVolumeOpenGL2) > > > > Any ideas how to fix this? > > > > I am coming back to VTK after suing vtk 6.x. > > > > > > Regards, > > Jothy > > > > > > > > > > > > > > > _______________________________________________ > 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: TestQVTKOpenGLSimpleWidget.cxx Type: text/x-c++src Size: 2586 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: TestQVTKOpenGLWidget.cxx Type: text/x-c++src Size: 2824 bytes Desc: not available URL: From jothybasu at gmail.com Wed Jul 11 20:30:57 2018 From: jothybasu at gmail.com (Jothybasu Selvaraj) Date: Thu, 12 Jul 2018 10:30:57 +1000 Subject: [vtkusers] Problem initializing GLEW with vtk8.1 In-Reply-To: References: <87388158-afc8-4b9a-a5fb-a1950e5e78c7@email.android.com> Message-ID: Thanks, I'll check it out. On Thu, Jul 12, 2018 at 10:18 AM Mathieu Westphal < mathieu.westphal at kitware.com> wrote: > Hello, > > You may want to try with QVTKOpenGLSimpleWidget as well. > Please see this examples, available in VTK/GUISupport/Qt/Testing/Cxx > > Best, > > Mathieu Westphal > > On Wed, Jul 11, 2018 at 1:27 PM, Todd via vtkusers < > vtkusers at public.kitware.com> wrote: > >> You might need to install/reinstall Nvidia drivers. >> >> On 11 Jul 2018 11:08 p.m., Todd wrote: >> >> The reason I asked, and it might be irrelevant, is that another user was >> running a c++ project with VTK 8.1 on Hyper-V, which does not support >> opengl 2, and got a similar error. He had to install Mesa. >> >> On 11 Jul 2018 11:01 p.m., Jothybasu Selvaraj >> wrote: >> >> Windows 10 with Nvidia card. >> >> >> >> Sent from Mail for >> Windows 10 >> >> >> >> *From: *Todd >> *Sent: *Wednesday, July 11, 2018 9:00 PM >> *To: *Jothybasu Selvaraj >> *Cc: *VTK Mailing List >> *Subject: *Re: [vtkusers] Problem initializing GLEW with vtk8.1 >> >> >> >> What platform are you using? >> >> >> >> On 11 Jul 2018 10:36 p.m., Jothybasu Selvaraj >> wrote: >> >> Dear All >> >> >> >> I just build vtk8.1 and tried to render a sphere using QVTKOpelnGLWidget >> -hope this is the recommended over QVTKWidget in vtk8.1. >> >> >> >> I am getting this error. I am using QtCreator. >> >> >> >> vtkGenericOpenGLRenderWindow (00000255BB134430): GLEW could not be >> initialized. >> >> >> >> I have the following in the header file of the class which renders this: >> >> #define vtkRenderingCore_AUTOINIT 3(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingOpenGL2) >> >> #define vtkRenderingVolume_AUTOINIT 1(vtkRenderingVolumeOpenGL2) >> >> >> >> Any ideas how to fix this? >> >> >> >> I am coming back to VTK after suing vtk 6.x. >> >> >> >> >> >> Regards, >> >> Jothy >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> _______________________________________________ >> 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 shayan.moradkhani at gmail.com Thu Jul 12 04:06:38 2018 From: shayan.moradkhani at gmail.com (shayan moradkhani) Date: Thu, 12 Jul 2018 01:06:38 -0700 (MST) Subject: [vtkusers] machining simulation and collision detection In-Reply-To: References: <1530181664677-0.post@n5.nabble.com> <1531292548828-0.post@n5.nabble.com> Message-ID: <1531382798046-0.post@n5.nabble.com> thanks for your reply, but how should i write my own macro and export header file? where can i find some examples? sorry for these questions, but i find no explanation for the codes on the github and how we should use them :-( shayan -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From M.skovmand1 at gmail.com Thu Jul 12 08:11:42 2018 From: M.skovmand1 at gmail.com (M_skov) Date: Thu, 12 Jul 2018 05:11:42 -0700 (MST) Subject: [vtkusers] Tapered "cylinder". Message-ID: <1531397502734-0.post@n5.nabble.com> Hello there. Disclaimer, I am quite new to using VTK, and even coding in general (which is done in Python). I am trying to visualize a tapered hollow cylinder, I have start and end-coordinates (x,y,z) and a different diameter at each coordinate. ___ / \ / \ This is basically what I want. /_____ \ I have searched, quite a bit, but have yet to find a solution to this. As of right now, when the diameters are equal, I am visualizing the cylinder as an extruded disk, transforming it for the orientation, which works perfectly! I have been looking at vtktubefilter, but as I see it, I end up losing my wall thickness using that option. Is there a radius scaling factor I have overlooked, or other functions that can help me accomplish this? Hoping the question is clear and that someone is able to assist me in this. Have a nice day! - Martin -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From david.gobbi at gmail.com Thu Jul 12 08:22:37 2018 From: david.gobbi at gmail.com (David Gobbi) Date: Thu, 12 Jul 2018 06:22:37 -0600 Subject: [vtkusers] Build VTK 8.1.1 on Windows vc12 - vtkPythonArgs.cxx Line 105 Error cannot convert from 'const char *' to 'char * In-Reply-To: References: Message-ID: See https://gitlab.kitware.com/vtk/vtk/issues/17350 for bug report and patches. Thanks for bringing this issue to my attention. - David On Tue, Jul 10, 2018 at 11:42 AM, David Gobbi wrote: > It looks like the Python folks changed the PyUnicode_AsUTF8() function in > Python 3.7. This function used to return "char *" but in 3.7 it returns > "const char *". > > I'll start working on a patch for the VTK master branch, but for now your > best option is to use Python 3.6. > > - David > > > > On Tue, Jul 10, 2018 at 8:41 AM, Camilo Diaz wrote: > >> Hello, >> >> Compiling VTK 8.1.1 + python wrapper on visual studio 2013 throws this >> error: >> >> error C2440: '=' : cannot convert from 'const char *' to 'char *' >> D:\VTK-8.1.1\Wrapping\PythonCore\vtkPythonArgs.cxx 105 1 >> vtkWrappingPythonCore >> >> I installed Python 3.7 in a windows 10 pc. >> I used cmake-gui to build the project. >> >> I'll appreciate any help. >> >> -- >> Kmilo >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From harry1994128 at gmail.com Thu Jul 12 09:26:26 2018 From: harry1994128 at gmail.com (hao chen) Date: Thu, 12 Jul 2018 06:26:26 -0700 (MST) Subject: [vtkusers] Delete object from vtkPolyDataConnectivityFilter(C++) Message-ID: <1531401986606-0.post@n5.nabble.com> Hello, I want to delete one object in vtkTriangleFilter, have some question about origin CellId after I do vtkPolyDataConnectivityFilter. Part of my code: vtkSmartPointer DicomImageReader = vtkSmartPointer::New(); DicomImageReader->SetDirectoryName("E:\\offline_3Ddata\\2017042402"); DicomImageReader->Update(); In my part of code: vtkSmartPointer filter = vtkSmartPointer::New(); filter->SetInputConnection(DicomImageReader->GetOutputPort()); filter->SetValue(0, 9000); filter->Update(); vtkSmartPointer triangleFilter = vtkSmartPointer::New(); triangleFilter->SetInputConnection(filter->GetOutputPort()); triangleFilter->Update(); vtkSmartPointer connectivityFilter = vtkSmartPointer::New(); connectivityFilter->SetInput(triangleFilter->GetOutput()); connectivityFilter->SetExtractionModeToCellSeededRegions(); connectivityFilter->AddSeed(1000); connectivityFilter->Update(); ---------------------------------------------------------------------------------------------------------------------- This case in triangleFilter have many objects and use connectivityFilter it will find CellId = 1000 in triangleFilter others cell connected with CellId = 1000. After that connectivityFilter will have one object, and the connectivityFilter's CellId will start with zero, but I want the original CellId. How can I get the original CellId in connectivityFilter? I want to delete object in the triangleFilter. Or have any other solution. Sorry my poor english. Thx~ Hao -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From ashahrior.91994 at gmail.com Thu Jul 12 10:53:01 2018 From: ashahrior.91994 at gmail.com (Ashef Shahrior) Date: Thu, 12 Jul 2018 20:53:01 +0600 Subject: [vtkusers] Segmentation and visualization with color Message-ID: I have followed the itk guide and implemented those segmentation methods. Using fast marching segmentation, I am getting this in the fourth box. I have used itk for segmentation and vtk for visualization with C++. [image: image.png] But what I actually want is something like this - [image: image.png] I want to show the segmented portion right on top of the main image but with a different color to distinguish it. How can I do that? This is my code:- https://paste.ubuntu.com/p/BRMrhys5J8/ #include "iostream"#include "string.h"using namespace std; #include "itkCurvatureAnisotropicDiffusionImageFilter.h" #include "itkGradientMagnitudeRecursiveGaussianImageFilter.h"#include "itkSigmoidImageFilter.h" #include "itkFastMarchingImageFilter.h" #include "itkBinaryThresholdImageFilter.h" #include "itkImageFileReader.h"#include "itkImageFileWriter.h" #include "itkRescaleIntensityImageFilter.h"#include "QuickView.h" #include "itkCastImageFilter.h" #include "itkGDCMImageIO.h" char inputFile[1000], iseedX[100], iseedY[100], isigma[100], isigmoidAlpha[100], isigmoidBeta[100], itimeThreshold[100], istoppingValue[100], inputType[100];char inputName[1000], outputImage[1000], smoothingOutputImage[1000], gradientMagnitudeOutputImage[1000], sigmoidOutputImage[1000]; void takeInput(){ cout<< " Enter file path: "; cin>>inputFile; cout<< " Enter seed in X position: "; cin>>iseedX; cout<< " Enter seed in Y position: "; cin>>iseedY; cout<< " Enter Sigma value: "; cin>>isigma; cout<< " Enter SigmoidAlpha value: "; cin>>isigmoidAlpha; cout<< " Enter SigmoidBeta value: "; cin>>isigmoidBeta; cout<< " Enter time-threshold value: "; cin>>itimeThreshold; cout<< " Enter stopping value: "; cin>>istoppingValue; cout<< " Enter input file type '-IMAGE'/'-DICOM' : "; cin>>inputType;} void getFileName(){ int l = strlen(inputFile); int x = 0; for(int i = l-1; i>-1; i--) { if(inputFile[i]=='\\') break; inputName[x] = inputFile[i]; x++; } strrev(inputName); return;} void fastMarchingSegmentation(){ try { takeInput(); getFileName(); } catch(exception e) { cout<<"Exception occurred in taking input"< InternalImageType; typedef unsigned char OutputPixelType; typedef itk::Image< OutputPixelType, Dimension > OutputImageType; typedef itk::BinaryThresholdImageFilter< InternalImageType, OutputImageType > ThresholdingFilterType; ThresholdingFilterType::Pointer thresholder = ThresholdingFilterType::New(); typedef itk::CastImageFilter< InternalImageType, OutputImageType > CastingFilterType; CastingFilterType::Pointer caster = CastingFilterType::New(); const InternalPixelType timeThreshold = atof( itimeThreshold ); thresholder->SetLowerThreshold( 0.0 ); thresholder->SetUpperThreshold( timeThreshold ); thresholder->SetOutsideValue( 0 ); thresholder->SetInsideValue( 255 ); typedef itk::GDCMImageIO ImageIOType; ImageIOType::Pointer gdcmImageIO = ImageIOType::New(); typedef itk::ImageFileReader< InternalImageType > ReaderType; typedef itk::ImageFileWriter< OutputImageType > WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); reader->SetFileName( inputFile ); //outputImage = "Fast Marching Segmented ";// +inputFile; strcpy(outputImage, "Fast_Marching_Segmented_"); strcat(outputImage, inputName); writer->SetFileName( outputImage ); for (int i = 0; inputType[i] != '\0'; i++) inputType[i] = toupper(inputType[i]); if (strcmp(inputType,"-DICOM")==0) { reader->SetImageIO(gdcmImageIO); } try { reader->Update(); } catch (itk::ExceptionObject & e) { std::cerr << "exception in file reader " << std::endl; std::cerr << e << std::endl; return; // EXIT_FAILURE; } typedef itk::RescaleIntensityImageFilter CastFilterType; typedef itk::CurvatureAnisotropicDiffusionImageFilter< InternalImageType, InternalImageType > SmoothingFilterType; SmoothingFilterType::Pointer smoothing = SmoothingFilterType::New(); typedef itk::GradientMagnitudeRecursiveGaussianImageFilter GradientFilterType; typedef itk::SigmoidImageFilter SigmoidFilterType; GradientFilterType::Pointer gradientMagnitude = GradientFilterType::New(); SigmoidFilterType::Pointer sigmoid = SigmoidFilterType::New(); sigmoid->SetOutputMinimum( 0.0 ); sigmoid->SetOutputMaximum( 1.0 ); typedef itk::FastMarchingImageFilter< InternalImageType,InternalImageType > FastMarchingFilterType; FastMarchingFilterType::Pointer fastMarching = FastMarchingFilterType::New(); smoothing->SetInput( reader->GetOutput() ); gradientMagnitude->SetInput( smoothing->GetOutput() ); sigmoid->SetInput( gradientMagnitude->GetOutput() ); fastMarching->SetInput( sigmoid->GetOutput() ); thresholder->SetInput( fastMarching->GetOutput() ); //caster->SetInput( thresholder->GetOutput() ); writer->SetInput(thresholder->GetOutput()); smoothing->SetTimeStep( 0.125 ); smoothing->SetNumberOfIterations( 5 ); smoothing->SetConductanceParameter( 9.0 ); const double sigma = atof( isigma ); gradientMagnitude->SetSigma( sigma ); const double alpha = atof( isigmoidAlpha ); const double beta = atof( isigmoidBeta ); sigmoid->SetAlpha( alpha ); sigmoid->SetBeta( beta ); typedef FastMarchingFilterType::NodeContainer NodeContainer; typedef FastMarchingFilterType::NodeType NodeType; NodeContainer::Pointer seeds = NodeContainer::New(); InternalImageType::IndexType seedPosition; seedPosition[0] = atoi( iseedX ); seedPosition[1] = atoi( iseedY ); NodeType node; const double seedValue = 0.0; node.SetValue( seedValue ); node.SetIndex( seedPosition ); seeds->Initialize(); seeds->InsertElement( 0, node ); fastMarching->SetTrialPoints( seeds ); typedef itk::Image ImageType; ImageType::Pointer image; QuickView viewer; try { typedef itk::RescaleIntensityImageFilter< ImageType, ImageType > RescaleFilterType; RescaleFilterType::Pointer caster1 = RescaleFilterType::New(); WriterType::Pointer writer1 = WriterType::New(); caster->SetInput( smoothing->GetOutput() ); image = caster->GetOutput(); caster1->SetInput( image ); writer1->SetInput( caster1->GetOutput() ); //writer1->SetFileName("Smoothing Output Image "+inputFile); char t1[100]; strcpy(t1,"Smoothing_Output_Image_" ); char tmp[1000]; strcpy(tmp,inputName); strcat(t1, tmp); writer1->SetFileName(t1); caster1->SetOutputMinimum( 0 ); caster1->SetOutputMaximum( 255 ); caster1->Update(); writer1->Update(); //QuickView viewer; //viewer.AddImage(image.GetPointer()); viewer.AddImage(caster1->GetOutput()); } catch( itk::ExceptionObject & err ) { std::cerr << "ExceptionObject caught in the kahini one !" << std::endl; std::cerr << err << std::endl; return; // EXIT_FAILURE; } try { CastFilterType::Pointer caster2 = CastFilterType::New(); WriterType::Pointer writer2 = WriterType::New(); caster2->SetInput( gradientMagnitude->GetOutput() ); writer2->SetInput( caster2->GetOutput() ); //writer2->SetFileName("Gradient Magnitude Output Image "+inputFile); char t1[100]; strcpy(t1,"Gradient_Magnitude_Output_Image_"); char tmp[1000]; strcpy(tmp, inputName); strcat(t1, tmp); writer2->SetFileName(t1); caster2->SetOutputMinimum( 0 ); caster2->SetOutputMaximum( 255 ); writer2->Update(); image = caster2->GetOutput(); /* QuickView viewer; viewer.AddImage(image.GetPointer());*/ viewer.AddImage(caster2->GetOutput()); } catch( itk::ExceptionObject & err ) { std::cerr << "ExceptionObject caught !" << std::endl; std::cerr << err << std::endl; return; //EXIT_FAILURE; } try { CastFilterType::Pointer caster3 = CastFilterType::New(); WriterType::Pointer writer3 = WriterType::New(); caster3->SetInput( sigmoid->GetOutput() ); writer3->SetInput( caster3->GetOutput() ); //writer3->SetFileName("Sigmoid Output Image"+inputFile); char t1[100]; strcpy(t1,"Sigmoid_Output_Image_"); char tmp[1000]; strcpy(tmp,inputName); strcat(t1, tmp); writer3->SetFileName(t1); caster3->SetOutputMinimum( 0 ); caster3->SetOutputMaximum( 255 ); writer3->Update(); //image = caster3->GetOutput(); //QuickView viewer; //viewer.AddImage(image.GetPointer()); viewer.AddImage(caster3->GetOutput()); //viewer.Visualize(); } catch( itk::ExceptionObject & err ) { std::cerr << "ExceptionObject caught !" << std::endl; std::cerr << err << std::endl; return; //EXIT_FAILURE; } fastMarching->SetOutputSize( reader->GetOutput()->GetBufferedRegion().GetSize() ); const double stoppingTime = atof( istoppingValue ); fastMarching->SetStoppingValue( stoppingTime ); try { writer->Update(); } catch( itk::ExceptionObject & excep ) { std::cerr << "Exception caught !" << std::endl; std::cerr << excep << std::endl; return; //EXIT_FAILURE; } try { CastFilterType::Pointer caster4 = CastFilterType::New(); WriterType::Pointer writer4 = WriterType::New(); caster4->SetInput( fastMarching->GetOutput() ); writer4->SetInput( caster4->GetOutput() ); //writer4->SetFileName("Fast Marching Filter Output " + inputFile); char t1[100]; strcpy(t1,"Fast_Marching_Filter_Output_"); char tmp[1000]; strcpy(tmp,inputName); strcat(t1, tmp); writer4->SetFileName(t1); caster4->SetOutputMinimum( 0 ); caster4->SetOutputMaximum( 255 ); writer4->Update(); viewer.AddImage(caster4->GetOutput()); } catch( itk::ExceptionObject & err ) { std::cerr << "ExceptionObject caught !" << std::endl; std::cerr << err << std::endl; return; //EXIT_FAILURE; } viewer.ShareCameraOff(); viewer.Visualize();} -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image.png Type: image/png Size: 291396 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image.png Type: image/png Size: 84452 bytes Desc: not available URL: From c.desrosiers02 at gmail.com Thu Jul 12 16:19:55 2018 From: c.desrosiers02 at gmail.com (cDesrosiers) Date: Thu, 12 Jul 2018 13:19:55 -0700 (MST) Subject: [vtkusers] Cure non manifold edges Message-ID: <1531426795006-0.post@n5.nabble.com> Hi, I found a way to find when my polydata got non manifold eges with vtkFeatureEdges. But after that does vtk have an algorithm to cure/repair them ? Thanks, C. Desrosiers -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From rccm.kyoshimi at gmail.com Thu Jul 12 21:21:31 2018 From: rccm.kyoshimi at gmail.com (kenichiro yoshimi) Date: Fri, 13 Jul 2018 10:21:31 +0900 Subject: [vtkusers] Tapered "cylinder". In-Reply-To: <1531397502734-0.post@n5.nabble.com> References: <1531397502734-0.post@n5.nabble.com> Message-ID: Hi, The easiest way to create a tapered hollow cylinder is scaling the points on top surface of the cylinder created as an extrusion of a disk. The sample code below shows this: ------ #!/usr/bin/env python # -*- coding: utf-8 -*- import vtk def main(): colors = vtk.vtkNamedColors() diskSource = vtk.vtkDiskSource() diskSource.SetInnerRadius(0.5); diskSource.SetOuterRadius(1.0); diskSource.SetRadialResolution(1); diskSource.SetCircumferentialResolution(40); # Apply linear extrusion extrude = vtk.vtkLinearExtrusionFilter() extrude.SetInputConnection(diskSource.GetOutputPort()) extrude.SetExtrusionTypeToNormalExtrusion(); extrude.SetVector(0, 0, 2) extrude.Update() # Taper the cylinder scale = 0.5 taperedCylinder = extrude.GetOutput() points = taperedCylinder.GetPoints() numPts = taperedCylinder.GetNumberOfPoints() for ptId in range(numPts/2, numPts): point = points.GetPoint(ptId) points.SetPoint(ptId, point[0]*scale, point[1]*scale, point[2]) # Create a mapper and actor. mapper = vtk.vtkPolyDataMapper() mapper.SetInputData(taperedCylinder) actor = vtk.vtkActor() actor.GetProperty().SetColor(colors.GetColor3d("Cornsilk")) actor.SetMapper(mapper) # Create a renderer, render window, and interactor renderer = vtk.vtkRenderer() renderWindow = vtk.vtkRenderWindow() renderWindow.SetWindowName("TaperedCylinder") renderWindow.AddRenderer(renderer) renderWindowInteractor = vtk.vtkRenderWindowInteractor() renderWindowInteractor.SetRenderWindow(renderWindow) # Add the actors to the scene renderer.AddActor(actor) renderer.SetBackground(colors.GetColor3d("DarkGreen")) # Render and interact renderWindow.Render() renderWindowInteractor.Start() if __name__ == '__main__': main() ------ Regards 2018?7?12?(?) 21:12 M_skov : > > Hello there. > > Disclaimer, I am quite new to using VTK, and even coding in general (which > is done in Python). > I am trying to visualize a tapered hollow cylinder, I have start and > end-coordinates (x,y,z) and a different diameter at each coordinate. > ___ > / \ > / \ This is basically what I want. > /_____ \ > > I have searched, quite a bit, but have yet to find a solution to this. > As of right now, when the diameters are equal, I am visualizing the cylinder > as an extruded disk, transforming it for the orientation, which works > perfectly! > > I have been looking at vtktubefilter, but as I see it, I end up losing my > wall thickness using that option. > Is there a radius scaling factor I have overlooked, or other functions that > can help me accomplish this? > > Hoping the question is clear and that someone is able to assist me in this. > Have a nice day! > > - Martin > > > > > -- > 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 nztoddler at yahoo.com Thu Jul 12 21:41:00 2018 From: nztoddler at yahoo.com (Todd Martin) Date: Fri, 13 Jul 2018 01:41:00 +0000 (UTC) Subject: [vtkusers] Tapered "cylinder". In-Reply-To: References: <1531397502734-0.post@n5.nabble.com> Message-ID: <1576882504.3688554.1531446061006@mail.yahoo.com> Or you could use vtkRotationalExtrusionFilter with an angled line. Todd Martin, PhD. Freelance Engineer/Software Architect. On Friday, July 13, 2018, 1:21:53 PM GMT+12, kenichiro yoshimi wrote: Hi, The easiest way to create a tapered hollow cylinder is scaling the points on top surface of the cylinder created as an extrusion of a disk. The sample code below shows this: ------ #!/usr/bin/env python # -*- coding: utf-8 -*- import vtk def main(): ? ? colors = vtk.vtkNamedColors() ? ? diskSource = vtk.vtkDiskSource() ? ? diskSource.SetInnerRadius(0.5); ? ? diskSource.SetOuterRadius(1.0); ? ? diskSource.SetRadialResolution(1); ? ? diskSource.SetCircumferentialResolution(40); ? ? # Apply linear extrusion ? ? extrude = vtk.vtkLinearExtrusionFilter() ? ? extrude.SetInputConnection(diskSource.GetOutputPort()) ? ? extrude.SetExtrusionTypeToNormalExtrusion(); ? ? extrude.SetVector(0, 0, 2) ? ? extrude.Update() ? ? # Taper the cylinder ? ? scale = 0.5 ? ? taperedCylinder = extrude.GetOutput() ? ? points = taperedCylinder.GetPoints() ? ? numPts = taperedCylinder.GetNumberOfPoints() ? ? for ptId in range(numPts/2, numPts): ? ? ? point = points.GetPoint(ptId) ? ? ? points.SetPoint(ptId, point[0]*scale, point[1]*scale, point[2]) ? ? # Create a mapper and actor. ? ? mapper = vtk.vtkPolyDataMapper() ? ? mapper.SetInputData(taperedCylinder) ? ? actor = vtk.vtkActor() ? ? actor.GetProperty().SetColor(colors.GetColor3d("Cornsilk")) ? ? actor.SetMapper(mapper) ? ? # Create a renderer, render window, and interactor ? ? renderer = vtk.vtkRenderer() ? ? renderWindow = vtk.vtkRenderWindow() ? ? renderWindow.SetWindowName("TaperedCylinder") ? ? renderWindow.AddRenderer(renderer) ? ? renderWindowInteractor = vtk.vtkRenderWindowInteractor() ? ? renderWindowInteractor.SetRenderWindow(renderWindow) ? ? # Add the actors to the scene ? ? renderer.AddActor(actor) ? ? renderer.SetBackground(colors.GetColor3d("DarkGreen")) ? ? # Render and interact ? ? renderWindow.Render() ? ? renderWindowInteractor.Start() if __name__ == '__main__': ? ? main() ------ Regards 2018?7?12?(?) 21:12 M_skov : > > Hello there. > > Disclaimer, I am quite new to using VTK, and even coding in general (which > is done in Python). > I am trying to visualize a tapered hollow cylinder, I have start and > end-coordinates (x,y,z) and a different diameter at each coordinate. >? ? ? ___ >? ? /? ? ? \ >? /? ? ? ? \? This is basically what I want. >? /_____ \ > > I have searched, quite a bit, but have yet to find a solution to this. > As of right now, when the diameters are equal, I am visualizing the cylinder > as an extruded disk, transforming it for the orientation, which works > perfectly! > > I have been looking at vtktubefilter, but as I see it, I end up losing my > wall thickness using that option. > Is there a radius scaling factor I have overlooked, or other functions that > can help me accomplish this? > > Hoping the question is clear and that someone is able to assist me in this. > Have a nice day! > > - Martin > > > > > -- > 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 M.skovmand1 at gmail.com Fri Jul 13 04:01:05 2018 From: M.skovmand1 at gmail.com (M_skov) Date: Fri, 13 Jul 2018 01:01:05 -0700 (MST) Subject: [vtkusers] Tapered "cylinder". In-Reply-To: References: <1531397502734-0.post@n5.nabble.com> Message-ID: <1531468865289-0.post@n5.nabble.com> Hello, Thank you very much for the answers. The scaling was exactly what I was looking for. Did not know I could get the circumferential points that way, thanks a lot for your assistance. I will have a look at the rotational filter as well. Maybe that is useful in another situation! I appreciate your help, I hope you'll have a good day. - Martin -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From jackynguyen.km at gmail.com Fri Jul 13 05:09:57 2018 From: jackynguyen.km at gmail.com (Jacky Nguyen) Date: Fri, 13 Jul 2018 17:09:57 +0800 Subject: [vtkusers] Close the gap between a mesh and a planar Message-ID: I have converted an .obj mesh file to .stl. I also created a planar geometry as a holder for the mesh object then merge them. However, it contains a gap. Any suggestion how to close the gap vertically so that it becomes a solid object, I have already tried vtkFillHolesFilter, but it won't fill the gap? The code to create the planar: implicitPolyDataDistance = vtk.vtkImplicitPolyDataDistance() implicitPolyDataDistance.SetInput(stl_poly_data) #create a grid xCoords = vtk.vtkFloatArray() for x, i in enumerate(np.linspace(xmin, xmax,50)): xCoords.InsertNextValue(i) yCoords = vtk.vtkFloatArray() for y, i in enumerate(np.linspace(ymin, ymax, 50)): yCoords.InsertNextValue(i) zCoords = vtk.vtkFloatArray() for z, i in enumerate(np.linspace(zmin, zmin + 1, 50)): zCoords.InsertNextValue(i) rgrid = vtk.vtkRectilinearGrid() rgrid.SetDimensions(x + 1, y + 1 , z + 1) rgrid.SetXCoordinates(xCoords) rgrid.SetYCoordinates(yCoords) rgrid.SetZCoordinates(zCoords) signedDistances = vtk.vtkFloatArray() signedDistances.SetNumberOfComponents(1) signedDistances.SetName("SignedDistances") # Evaluate the signed distance function at all of the grid points for pointId in range(rgrid.GetNumberOfPoints()): p = rgrid.GetPoint(pointId) signedDistance = implicitPolyDataDistance.EvaluateFunction(p) signedDistances.InsertNextValue(signedDistance) # add the SignedDistances to the grid rgrid.GetPointData().SetScalars(signedDistances) # geometry filter to view the background grid geometryFilter = vtk.vtkRectilinearGridGeometryFilter() geometryFilter.SetInputData(rgrid) geometryFilter.SetExtent(0, x + 1, 0, y + 1, (z + 1) // 2, (z + 1) // 2) geometryFilter.Update() # ================ END creating a plane ======================= The code that merge the stl poly data and the plane: meshAppend = vtk.vtkAppendPolyData() meshAppend.AddInputData(stl_poly_data) meshAppend.AddInputData(geometryFilter.GetOutput()) meshAppend.Update() boundaryClean = vtk.vtkCleanPolyData() boundaryClean.SetInputData(meshAppend.GetOutput()) boundaryClean.Update() out = vtk.vtkPolyData() out.DeepCopy(boundaryClean.GetOutput()) triangleTrans = vtk.vtkTriangleFilter() triangleTrans.SetInputData(out) triangleTrans.Update() fill = vtk.vtkFillHolesFilter() fill.SetInputData(out) fill.SetHoleSize(1000000.0) fill.Update() A screenshot of what my current mesh is (note: the red line is where i want to close the gap vertically along the z axis: https://i.stack.imgur.com/F9w3c.png Any suggestion to solve this problem? Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: From marvin.huber at basf.com Fri Jul 13 07:40:48 2018 From: marvin.huber at basf.com (marf) Date: Fri, 13 Jul 2018 04:40:48 -0700 (MST) Subject: [vtkusers] Loading a .vtu file in vtkjs In-Reply-To: <1531318270640-0.post@n5.nabble.com> References: <1531318270640-0.post@n5.nabble.com> Message-ID: <1531482048909-0.post@n5.nabble.com> I would really really apprectiated any hint or workaround or whatever, I realized there is an XMLUnstructuredGridLoader or something similar in the real vtk, but apparently it has not been ported to vtkjs as of now -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From shayan.moradkhani at gmail.com Fri Jul 13 08:07:13 2018 From: shayan.moradkhani at gmail.com (shayan moradkhani) Date: Fri, 13 Jul 2018 05:07:13 -0700 (MST) Subject: [vtkusers] vtkOBBTree undefined identifier Message-ID: <1531483633712-0.post@n5.nabble.com> hi, i copy pasted this example (https://www.vtk.org/Wiki/VTK/Examples/Cxx/DataStructures/OBBTreeIntersectWithLine) and it worked fine. however, i had to restart my machine for other reasons and when i tried to run the same example, it didnt build saying :identifier "vtkOBBTree" is undefined. i never changed anything and i?m sending the screenshot of my visual studio project here as well. could it be a possible visual studio 2015 bug? shayan -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From pbergeron at spiria.com Fri Jul 13 10:10:39 2018 From: pbergeron at spiria.com (Patrick Bergeron) Date: Fri, 13 Jul 2018 14:10:39 +0000 Subject: [vtkusers] Close the gap between a mesh and a planar In-Reply-To: References: Message-ID: <679DA8D3-16D1-4213-9085-F0DBCB53B86D@spiria.com> I would take a different approach. I would look at all the edges that have only 1 cell attached, and these are your boundary edges. For each boundary edge, create 2 triangles (a quad) with 1 or 2 points at z=0. (Create 2 new points at z=0 for this purpose). If you already have a point at that z=0, then reuse it don?t create it. That approach will create quads all around your geometry connecting to the bottom but will leave the bottom hole open. Next create a cell connecting all your z=0 points together. Make sure they are ordered in sequential order to create your contour loop. Done Sent from my iPhone On Jul 13, 2018, at 05:10, Jacky Nguyen > wrote: I have converted an .obj mesh file to .stl. I also created a planar geometry as a holder for the mesh object then merge them. However, it contains a gap. Any suggestion how to close the gap vertically so that it becomes a solid object, I have already tried vtkFillHolesFilter, but it won't fill the gap? The code to create the planar: implicitPolyDataDistance = vtk.vtkImplicitPolyDataDistance() implicitPolyDataDistance.SetInput(stl_poly_data) #create a grid xCoords = vtk.vtkFloatArray() for x, i in enumerate(np.linspace(xmin, xmax,50)): xCoords.InsertNextValue(i) yCoords = vtk.vtkFloatArray() for y, i in enumerate(np.linspace(ymin, ymax, 50)): yCoords.InsertNextValue(i) zCoords = vtk.vtkFloatArray() for z, i in enumerate(np.linspace(zmin, zmin + 1, 50)): zCoords.InsertNextValue(i) rgrid = vtk.vtkRectilinearGrid() rgrid.SetDimensions(x + 1, y + 1 , z + 1) rgrid.SetXCoordinates(xCoords) rgrid.SetYCoordinates(yCoords) rgrid.SetZCoordinates(zCoords) signedDistances = vtk.vtkFloatArray() signedDistances.SetNumberOfComponents(1) signedDistances.SetName("SignedDistances") # Evaluate the signed distance function at all of the grid points for pointId in range(rgrid.GetNumberOfPoints()): p = rgrid.GetPoint(pointId) signedDistance = implicitPolyDataDistance.EvaluateFunction(p) signedDistances.InsertNextValue(signedDistance) # add the SignedDistances to the grid rgrid.GetPointData().SetScalars(signedDistances) # geometry filter to view the background grid geometryFilter = vtk.vtkRectilinearGridGeometryFilter() geometryFilter.SetInputData(rgrid) geometryFilter.SetExtent(0, x + 1, 0, y + 1, (z + 1) // 2, (z + 1) // 2) geometryFilter.Update() # ================ END creating a plane ======================= The code that merge the stl poly data and the plane: meshAppend = vtk.vtkAppendPolyData() meshAppend.AddInputData(stl_poly_data) meshAppend.AddInputData(geometryFilter.GetOutput()) meshAppend.Update() boundaryClean = vtk.vtkCleanPolyData() boundaryClean.SetInputData(meshAppend.GetOutput()) boundaryClean.Update() out = vtk.vtkPolyData() out.DeepCopy(boundaryClean.GetOutput()) triangleTrans = vtk.vtkTriangleFilter() triangleTrans.SetInputData(out) triangleTrans.Update() fill = vtk.vtkFillHolesFilter() fill.SetInputData(out) fill.SetHoleSize(1000000.0) fill.Update() A screenshot of what my current mesh is (note: the red line is where i want to close the gap vertically along the z axis: https://i.stack.imgur.com/F9w3c.png Any suggestion to solve this problem? Thank you _______________________________________________ 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 278124177 at qq.com Sat Jul 14 02:40:28 2018 From: 278124177 at qq.com (=?gb18030?B?zui3qM7ozOw=?=) Date: Sat, 14 Jul 2018 14:40:28 +0800 Subject: [vtkusers] How to change the points in a polydata Message-ID: Hello. I read a ply file and want to change its' points' postion, but the code below doesn't work , how can i do? vtkSmartPointer reader = vtkSmartPointer::New(); reader->SetFileName("d:\\plane.ply"); reader->Update(); vtkPolyData* data = reader->GetOutput(); int n = data->GetNumberOfPoints(); vtkSmartPointer points = vtkSmartPointer::New(); points->DeepCopy(data->GetPoints()); for (int i = 0; i < n; i++) { double *p = points->GetPoint(i); p[2] = 0; } vtkSmartPointerwriter = vtkSmartPointer::New(); writer->SetInputData(data); writer->SetFileName("d:\\abc.txt"); writer->Update(); vtkSmartPointer mapper = vtkSmartPointer::New(); mapper->SetInputData(data); mapper->Update(); vtkSmartPointer actor = vtkSmartPointer::New(); actor->SetMapper(mapper); //actor->GetProperty()->SetRepresentationToWireframe(); vtkSmartPointer renderer = vtkSmartPointer::New(); renderer->AddActor(actor); vtkSmartPointer window = vtkSmartPointer::New(); window->AddRenderer(renderer); vtkSmartPointer interactor = vtkSmartPointer::New(); interactor->SetRenderWindow(window); -------------- next part -------------- An HTML attachment was scrubbed... URL: From rccm.kyoshimi at gmail.com Sat Jul 14 06:20:20 2018 From: rccm.kyoshimi at gmail.com (kenichiro yoshimi) Date: Sat, 14 Jul 2018 19:20:20 +0900 Subject: [vtkusers] Delete object from vtkPolyDataConnectivityFilter(C++) In-Reply-To: <1531401986606-0.post@n5.nabble.com> References: <1531401986606-0.post@n5.nabble.com> Message-ID: Hi Hao, Beforehand you can make a numbering of cell ids using vtkIdFilter before applying connectivityFilter. See: https://lorensen.github.io/VTKExamples/site/Cxx/PolyData/PointCellIds/ Regards 2018?7?12?(?) 22:26 hao chen : > > Hello, I want to delete one object in vtkTriangleFilter, have some question > about origin CellId after I do vtkPolyDataConnectivityFilter. > > Part of my code: > > vtkSmartPointer DicomImageReader = > vtkSmartPointer::New(); > DicomImageReader->SetDirectoryName("E:\\offline_3Ddata\\2017042402"); > DicomImageReader->Update(); > In my part of code: > vtkSmartPointer filter = > vtkSmartPointer::New(); > filter->SetInputConnection(DicomImageReader->GetOutputPort()); > filter->SetValue(0, 9000); > filter->Update(); > > vtkSmartPointer triangleFilter = > vtkSmartPointer::New(); > triangleFilter->SetInputConnection(filter->GetOutputPort()); > triangleFilter->Update(); > > vtkSmartPointer connectivityFilter = > vtkSmartPointer::New(); > connectivityFilter->SetInput(triangleFilter->GetOutput()); > connectivityFilter->SetExtractionModeToCellSeededRegions(); > connectivityFilter->AddSeed(1000); > connectivityFilter->Update(); > > ---------------------------------------------------------------------------------------------------------------------- > This case in triangleFilter have many objects and use connectivityFilter it > will find CellId = 1000 in triangleFilter others cell connected with CellId > = 1000. > > After that connectivityFilter will have one object, and the > connectivityFilter's CellId will start with zero, but I want the original > CellId. > > How can I get the original CellId in connectivityFilter? I want to delete > object in the triangleFilter. > Or have any other solution. > > Sorry my poor english. Thx~ > > Hao > > > > -- > 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 rccm.kyoshimi at gmail.com Sat Jul 14 07:19:31 2018 From: rccm.kyoshimi at gmail.com (kenichiro yoshimi) Date: Sat, 14 Jul 2018 20:19:31 +0900 Subject: [vtkusers] How to change the points in a polydata In-Reply-To: References: Message-ID: Hi ????, If written as follows, this will work well. --- vtkSmartPointer points = vtkSmartPointer::New(); points->ShallowCopy(data->GetPoints()); for (int i = 0; i < n; i++) { double *p = points->GetPoint(i); p[2] = 0; points->SetPoint(i, p); } --- Best 2018?7?14?(?) 15:41 ???? <278124177 at qq.com>: > > Hello. > I read a ply file and want to change its' points' postion, but the code below doesn't work , how can i do? > vtkSmartPointer reader = vtkSmartPointer::New(); > reader->SetFileName("d:\\plane.ply"); > reader->Update(); > vtkPolyData* data = reader->GetOutput(); > int n = data->GetNumberOfPoints(); > vtkSmartPointer points = vtkSmartPointer::New(); > points->DeepCopy(data->GetPoints()); > for (int i = 0; i < n; i++) > { > double *p = points->GetPoint(i); > p[2] = 0; > } > vtkSmartPointerwriter = vtkSmartPointer::New(); > writer->SetInputData(data); > writer->SetFileName("d:\\abc.txt"); > writer->Update(); > vtkSmartPointer mapper = > vtkSmartPointer::New(); > mapper->SetInputData(data); > mapper->Update(); > vtkSmartPointer actor = > vtkSmartPointer::New(); > actor->SetMapper(mapper); > //actor->GetProperty()->SetRepresentationToWireframe(); > vtkSmartPointer renderer = > vtkSmartPointer::New(); > renderer->AddActor(actor); > vtkSmartPointer window = > vtkSmartPointer::New(); > window->AddRenderer(renderer); > vtkSmartPointer interactor = > vtkSmartPointer::New(); > interactor->SetRenderWindow(window); > > > _______________________________________________ > 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 278124177 at qq.com Sun Jul 15 04:07:27 2018 From: 278124177 at qq.com (=?gb18030?B?zui3qM7ozOw=?=) Date: Sun, 15 Jul 2018 16:07:27 +0800 Subject: [vtkusers] =?gb18030?b?u9i4tKO6ICBIb3cgdG8gY2hhbmdlIHRoZSBwb2lu?= =?gb18030?q?ts_in_a_polydata?= In-Reply-To: References: Message-ID: This works well thanks ------------------ ???? ------------------ ???: "kenichiro yoshimi"; ????: 2018?7?14?(???) ??7:19 ???: "????"<278124177 at qq.com>; ??: "vtkusers"; ??: Re: [vtkusers] How to change the points in a polydata Hi ????, If written as follows, this will work well. --- vtkSmartPointer points = vtkSmartPointer::New(); points->ShallowCopy(data->GetPoints()); for (int i = 0; i < n; i++) { double *p = points->GetPoint(i); p[2] = 0; points->SetPoint(i, p); } --- Best 2018?7?14?(?) 15:41 ???? <278124177 at qq.com>: > > Hello. > I read a ply file and want to change its' points' postion, but the code below doesn't work , how can i do? > vtkSmartPointer reader = vtkSmartPointer::New(); > reader->SetFileName("d:\\plane.ply"); > reader->Update(); > vtkPolyData* data = reader->GetOutput(); > int n = data->GetNumberOfPoints(); > vtkSmartPointer points = vtkSmartPointer::New(); > points->DeepCopy(data->GetPoints()); > for (int i = 0; i < n; i++) > { > double *p = points->GetPoint(i); > p[2] = 0; > } > vtkSmartPointerwriter = vtkSmartPointer::New(); > writer->SetInputData(data); > writer->SetFileName("d:\\abc.txt"); > writer->Update(); > vtkSmartPointer mapper = > vtkSmartPointer::New(); > mapper->SetInputData(data); > mapper->Update(); > vtkSmartPointer actor = > vtkSmartPointer::New(); > actor->SetMapper(mapper); > //actor->GetProperty()->SetRepresentationToWireframe(); > vtkSmartPointer renderer = > vtkSmartPointer::New(); > renderer->AddActor(actor); > vtkSmartPointer window = > vtkSmartPointer::New(); > window->AddRenderer(renderer); > vtkSmartPointer interactor = > vtkSmartPointer::New(); > interactor->SetRenderWindow(window); > > > _______________________________________________ > 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 harry1994128 at gmail.com Mon Jul 16 02:49:33 2018 From: harry1994128 at gmail.com (hao chen) Date: Sun, 15 Jul 2018 23:49:33 -0700 (MST) Subject: [vtkusers] Delete object from vtkPolyDataConnectivityFilter(C++) In-Reply-To: References: <1531401986606-0.post@n5.nabble.com> Message-ID: <1531723773397-0.post@n5.nabble.com> Hi, kenichiro yoshimi Thank you for your reply. But I don't know the specific method. Do you mean like this: vtkSmartPointer DicomImageReader = vtkSmartPointer::New(); DicomImageReader->SetDirectoryName("E:\\offline_3Ddata\\2017042402"); DicomImageReader->Update(); vtkSmartPointer filter = vtkSmartPointer::New(); filter->SetInputConnection(DicomImageReader->GetOutputPort()); filter->SetValue(0, 9000); filter->Update(); vtkSmartPointer triangleFilter = vtkSmartPointer::New(); triangleFilter->SetInputConnection(filter->GetOutputPort()); triangleFilter->Update(); * vtkSmartPointer idFilter = vtkSmartPointer::New(); idFilter->SetInputConnection(sphereSource->GetOutputPort()); idFilter->SetIdsArrayName("ids"); idFilter->Update();* vtkSmartPointer connectivityFilter = vtkSmartPointer::New(); connectivityFilter->SetInput(*idFilter*->GetOutput()); connectivityFilter->SetExtractionModeToCellSeededRegions(); connectivityFilter->AddSeed(1000); connectivityFilter->Update(); ---------------------------------------------------------------------------------------------------------------------- By the way, I didn't realize that I don't know how to get the CellID from vtkPolyDataConnectivityFilter. I use 'GetCellNeighbors' to get CellId, but if I use in circled object(too large), it will work very slowly. So I found vtkPolyDataConnectivityFilter method, want to find out the CellId directly. Can you show me the specific method? Sorry my poor english. Thank you~ Hao -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From rubendibattista at gmail.com Mon Jul 16 03:06:50 2018 From: rubendibattista at gmail.com (Ruben Di Battista) Date: Mon, 16 Jul 2018 00:06:50 -0700 Subject: [vtkusers] Segmentation fault on a wrapper class for vtkPolyData Message-ID: Hello everybody, I?m trying to gain a bit more awareness on C++ programming and I wanted to try to iterate using C++11/14 iterators over a vtkPolyData structure but I?m experiencing SIGSEV. I will present before the code structure. 1) I have a `PolyDataWrapper ` class that accepts as argument a pointer to a `vtkPolyData` structure containing a triangulated surface. This class offers a method `iterateOver` that returns an iterator so that you can iterate over the points of the vtkPolydata doing for (PolyDataPoint p : polydata.iterateOver()){ // Do something } And equivalently for cells: for (PolyDataCell c : postdata.iterateOver() { /*?*/} And moreover it exposes some methods like `GetCellPoints` that use the underlying pointer to the ?raw? vtkPolyData object. Here's the class for the PolyDataCell 2) I have a `PolyDataIterator ` that implements the C++14 compatible range-based for loop. The problem is that running the following code raises a Segmentation fault if I?m using the PolyDataCell::GetCellPoints() method that the only thing it does it calling the PolyDataWrapper::GetCellPoints(PolyDataCell *). I probably did a mistake passing around pointers, but I was thinking that maybe I?m doing something that is messed up by the garbage collection of the vtk smart pointer. Could it be? Help is very much appreciated! #define SPHERE_RADIUS 1.0 #include "vtkNew.h" #include "vtkSmartPointer.h" #include "vtkTriangleFilter.h" #include "vtkSphereSource.h" #include "types.h" #include "PolyDataWrapper.h" vtkNew sphere; sphere->SetRadius(SPHERE_RADIUS); sphere->Update(); // Transform the sphere into a PolyData vtkNew triFilter; triFilter->SetInputData(sphere->GetOutput()); triFilter->Update(); // Triangulated version of the sphere vtkSmartPointer triSphere = triFilter->GetOutput(); // Build cells triSphere->BuildCells(); // Get total number of points IdType nPoints = triSphere->GetNumberOfPoints(); // Get total number of cells IdType nCells = triSphere->GetNumberOfCells(); //Initialize PolyDataWrapper PolyDataWrapper polydata(triFilter->GetOutput()); for(PolyDataCell cell : polydata.iterateOver()) { std::array points; points = polydata.GetCellPoints(cell); // This is ok // points = cell.GetCellPoints(); // This causes SIGSEV } _ -. .? |???? ', ; |?????? ?? |????????? RdB ,., |?????? .' '. |???? -' `? http://rdb.is -------------- next part -------------- An HTML attachment was scrubbed... URL: From shayan.moradkhani at gmail.com Mon Jul 16 03:28:40 2018 From: shayan.moradkhani at gmail.com (shayan moradkhani) Date: Mon, 16 Jul 2018 00:28:40 -0700 (MST) Subject: [vtkusers] machining simulation and collision detection In-Reply-To: <1531382798046-0.post@n5.nabble.com> References: <1530181664677-0.post@n5.nabble.com> <1531292548828-0.post@n5.nabble.com> <1531382798046-0.post@n5.nabble.com> Message-ID: <1531726120902-0.post@n5.nabble.com> hi, i really need some help with the collision detection files (vtkCollisionDetectionFilter.h, vtkCollisionDetectionFilter.cpp, TestCollisionDetection.cpp). i really dont know how to write macro and export header file. shouldn't that work with TestCollisionDetection.cpp on its own? regards shayan -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From andrewkeeling at hotmail.com Mon Jul 16 04:13:38 2018 From: andrewkeeling at hotmail.com (andyjk) Date: Mon, 16 Jul 2018 01:13:38 -0700 (MST) Subject: [vtkusers] Correctly apply camera matrix Message-ID: <1531728818177-0.post@n5.nabble.com> I am trying to save a particular camera view, then reapply it later (ie be able to reset the the view to a previous position) I see from here ( http://vtk.1045678.n5.nabble.com/How-to-restore-a-camera-view-td5728916.html ) that I can do this by saving position, focal_point, View-up and view_angle, but I am trying to do this more neatly by saving just the 4x4 transformation matrix of the camera (and assuming view angle is unchanged). How can I grab the current camera transformation matrix, and later re-apply it ? I have tried : 1) GRAB vtkSmartPointer mat; mat = iren->GetRenderWindow()->GetRenderers()->GetFirstRenderer()->GetActiveCamera()->GetModelViewTransformMatrix(); saveVTKMat4x4(mat, "VTKCamera.vmx"); 2) LOAD and APPLY loadVTKMat4x4(mat, "VTKCamera.vmx"); mat->Print(std::cout); vtkSmartPointer mat_inverse = vtkSmartPointer::New(); vtkMatrix4x4::Invert(mat, mat_inverse); vtkSmartPointer transform = vtkSmartPointer::New(); transform->SetMatrix(mat); transform->Update(); vtkSmartPointer current_mat; current_mat = custom_camera->GetViewTransformMatrix(); vtkSmartPointer current_mat_inverse = vtkSmartPointer::New(); vtkMatrix4x4::Invert(current_mat, current_mat_inverse); vtkSmartPointer transformInv = vtkSmartPointer::New(); transformInv->SetMatrix(current_mat_inverse); transformInv->Update(); custom_camera->ApplyTransform(transformInv); custom_camera->Modified(); custom_camera->ApplyTransform(transform); [Where the save/load functions have been verified using vtk::print and are working fine] I presume when loading, I have to move the camera back to identity (via an inverse transform) before applying the new transform because I think ApplyTransform concatenates. I find that if I don't move the camera at all between saving and loading, it works. If I nudge the camera a tiny bit between loading and saving, the new view is displaced a bit more when loading, so I think I must be getting some inverse transforms muddled up? Is there a neat way to the current camera matrix then reapply it later ? -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From cammarasanasimone at gmail.com Mon Jul 16 04:41:26 2018 From: cammarasanasimone at gmail.com (cammarasana123) Date: Mon, 16 Jul 2018 01:41:26 -0700 (MST) Subject: [vtkusers] VTK ogg video Message-ID: <1531730486228-0.post@n5.nabble.com> Hello, I have a problem I'm not sure someone can help me, but at least I can find someone with the same problem as I have. On my laptop, I'm able to produce an OGG video of animated mesh without troubles; otherwise on my desktop (same ubuntu 18.04, same VTK 8.1.1, external packages and same code) I produce the video but the output is a 4kB file, with all black frames (the duration of the movie is correct). Does anyone have similar problem, or know how to check where the issue could come from? thank you Simone -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From jackynguyen.km at gmail.com Mon Jul 16 05:12:42 2018 From: jackynguyen.km at gmail.com (Jacky Nguyen) Date: Mon, 16 Jul 2018 17:12:42 +0800 Subject: [vtkusers] Close the gap between a mesh and a planar In-Reply-To: <679DA8D3-16D1-4213-9085-F0DBCB53B86D@spiria.com> References: <679DA8D3-16D1-4213-9085-F0DBCB53B86D@spiria.com> Message-ID: Thanks for your input. Sorry, I am new to these so I need to take it slowly. Let me clarify a few things: 1) by using your approach, i don't need to create the plane on the bottom of the object as a holder? 2) When you say "For each boundary edge, create 2 triangles (a quad) with 1 or 2 points at z=0", does it matter which x and y coordinate to pick? I have added the following codes to extract the edges and find the pointID and point coordinate for each edge in the STL object. I trace through my console log, and there is no point that has z = 0 reader = vtk.vtkSTLReader() reader.SetFileName('path_to_stl') reader.Update() triangleFilter = vtk.vtkTriangleFilter() triangleFilter.SetInputConnection(reader.GetOutputPort()) triangleFilter.Update() # ++++++++++++++++++ extract edges ++++++++++++++++++++++++++++++++++++ featureEdges = vtk.vtkFeatureEdges() featureEdges.SetInputData(triangleFilter.GetOutput()) featureEdges.SetBoundaryEdges(1) featureEdges.SetFeatureEdges(0) featureEdges.SetNonManifoldEdges(0) featureEdges.SetManifoldEdges(0) featureEdges.Update() boundaryMesh = featureEdges.GetOutput() numberOfOpenEdges = featureEdges.GetOutput().GetNumberOfLines() print('number of lines: ', featureEdges.GetOutput().GetNumberOfLines()) for i in range(0, boundaryMesh.GetNumberOfLines()): cell = boundaryMesh.GetCell(i) cellPoints = cell.GetPoints() pointIds = cell.GetPointIds() for j in range(0, pointIds.GetNumberOfIds()): print('>>> point id: ', pointIds.GetId(j)) print('>>> coordinate: ', boundaryMesh.GetPoint(pointIds.GetId(j))) Thank you, On Fri, Jul 13, 2018 at 10:10 PM Patrick Bergeron wrote: > I would take a different approach. > > I would look at all the edges that have only 1 cell attached, and these > are your boundary edges. > > For each boundary edge, create 2 triangles (a quad) with 1 or 2 points at > z=0. (Create 2 new points at z=0 for this purpose). If you already have a > point at that z=0, then reuse it don?t create it. > > That approach will create quads all around your geometry connecting to the > bottom but will leave the bottom hole open. > > Next create a cell connecting all your z=0 points together. Make sure they > are ordered in sequential order to create your contour loop. > > Done > > > Sent from my iPhone > > On Jul 13, 2018, at 05:10, Jacky Nguyen wrote: > > I have converted an .obj mesh file to .stl. I also created a planar > geometry as a holder for the mesh object then merge them. However, it > contains a gap. Any suggestion how to close the gap vertically so that it > becomes a solid object, I have already tried vtkFillHolesFilter, but it > won't fill the gap? > > The code to create the planar: > > implicitPolyDataDistance = vtk.vtkImplicitPolyDataDistance() > implicitPolyDataDistance.SetInput(stl_poly_data) > > #create a grid > xCoords = vtk.vtkFloatArray() > for x, i in enumerate(np.linspace(xmin, xmax,50)): > xCoords.InsertNextValue(i) > > yCoords = vtk.vtkFloatArray() > for y, i in enumerate(np.linspace(ymin, ymax, 50)): > yCoords.InsertNextValue(i) > > zCoords = vtk.vtkFloatArray() > for z, i in enumerate(np.linspace(zmin, zmin + 1, 50)): > zCoords.InsertNextValue(i) > > rgrid = vtk.vtkRectilinearGrid() > rgrid.SetDimensions(x + 1, y + 1 , z + 1) > rgrid.SetXCoordinates(xCoords) > rgrid.SetYCoordinates(yCoords) > rgrid.SetZCoordinates(zCoords) > signedDistances = vtk.vtkFloatArray() > signedDistances.SetNumberOfComponents(1) > signedDistances.SetName("SignedDistances") > > # Evaluate the signed distance function at all of the grid points > for pointId in range(rgrid.GetNumberOfPoints()): > p = rgrid.GetPoint(pointId) > signedDistance = implicitPolyDataDistance.EvaluateFunction(p) > signedDistances.InsertNextValue(signedDistance) > > # add the SignedDistances to the grid > rgrid.GetPointData().SetScalars(signedDistances) > > # geometry filter to view the background grid > geometryFilter = vtk.vtkRectilinearGridGeometryFilter() > geometryFilter.SetInputData(rgrid) > geometryFilter.SetExtent(0, x + 1, 0, y + 1, (z + 1) // 2, (z + 1) // 2) > geometryFilter.Update() > # ================ END creating a plane ======================= > > > The code that merge the stl poly data and the plane: > > meshAppend = vtk.vtkAppendPolyData() > meshAppend.AddInputData(stl_poly_data) > meshAppend.AddInputData(geometryFilter.GetOutput()) > meshAppend.Update() > boundaryClean = vtk.vtkCleanPolyData() > boundaryClean.SetInputData(meshAppend.GetOutput()) > boundaryClean.Update() > out = vtk.vtkPolyData() > out.DeepCopy(boundaryClean.GetOutput()) > > triangleTrans = vtk.vtkTriangleFilter() > triangleTrans.SetInputData(out) > triangleTrans.Update() > > fill = vtk.vtkFillHolesFilter() > fill.SetInputData(out) > fill.SetHoleSize(1000000.0) > fill.Update() > > > > A screenshot of what my current mesh is (note: the red line is where i > want to close the gap vertically along the z axis: > https://i.stack.imgur.com/F9w3c.png > > Any suggestion to solve this problem? > > Thank you > > _______________________________________________ > 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 rccm.kyoshimi at gmail.com Mon Jul 16 05:18:00 2018 From: rccm.kyoshimi at gmail.com (kenichiro yoshimi) Date: Mon, 16 Jul 2018 18:18:00 +0900 Subject: [vtkusers] Delete object from vtkPolyDataConnectivityFilter(C++) In-Reply-To: <1531723773397-0.post@n5.nabble.com> References: <1531401986606-0.post@n5.nabble.com> <1531723773397-0.post@n5.nabble.com> Message-ID: Hi Hao, I am sorry that I don't quite understand what you are trying to do. If you want to get the original CellID from vtkPolyDataConnectivityFilter, I think you first need to make a map that stores combinations {original id:current id}: ----- std::map idMap; vtkIdTypeArray *cellIdArray = vtkIdTypeArray::SafeDownCast( connectivityFilter->GetOutput()->GetCellData()->GetArray("ids")); for (vtkIdType i = 0; i < cellIdArray->GetNumberOfTuples(); ++i) { vtkIdType orgId = cellIdArray->GetTuple1(i); idMap[orgId] = i; } ----- After that you can also get a cell according to the original Id: vtkCell *cell = connectivityFilter->GetOutput()->GetCell(idMap[1000]); Thanks 2018?7?16?(?) 15:49 hao chen : > > Hi, kenichiro yoshimi > > Thank you for your reply. > But I don't know the specific method. > > Do you mean like this: > > vtkSmartPointer DicomImageReader = > vtkSmartPointer::New(); > DicomImageReader->SetDirectoryName("E:\\offline_3Ddata\\2017042402"); > DicomImageReader->Update(); > > vtkSmartPointer filter = > vtkSmartPointer::New(); > filter->SetInputConnection(DicomImageReader->GetOutputPort()); > filter->SetValue(0, 9000); > filter->Update(); > > vtkSmartPointer triangleFilter = > vtkSmartPointer::New(); > triangleFilter->SetInputConnection(filter->GetOutputPort()); > triangleFilter->Update(); > > * vtkSmartPointer idFilter = > vtkSmartPointer::New(); > idFilter->SetInputConnection(sphereSource->GetOutputPort()); > idFilter->SetIdsArrayName("ids"); > idFilter->Update();* > > vtkSmartPointer connectivityFilter = > vtkSmartPointer::New(); > connectivityFilter->SetInput(*idFilter*->GetOutput()); > connectivityFilter->SetExtractionModeToCellSeededRegions(); > connectivityFilter->AddSeed(1000); > connectivityFilter->Update(); > > ---------------------------------------------------------------------------------------------------------------------- > By the way, I didn't realize that I don't know how to get the CellID from > vtkPolyDataConnectivityFilter. > I use 'GetCellNeighbors' to get CellId, but if I use in circled object(too > large), it will work very slowly. > So I found vtkPolyDataConnectivityFilter method, want to find out the CellId > directly. > Can you show me the specific method? > > Sorry my poor english. > Thank you~ > > Hao > > > > -- > 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 pbergeron at spiria.com Mon Jul 16 07:48:18 2018 From: pbergeron at spiria.com (Patrick Bergeron) Date: Mon, 16 Jul 2018 11:48:18 +0000 Subject: [vtkusers] Close the gap between a mesh and a planar In-Reply-To: References: <679DA8D3-16D1-4213-9085-F0DBCB53B86D@spiria.com> Message-ID: Hi Jacky Let me try to be clearer. Let?s say you have a surface floating in space, which seems to be your case. You can create a wall around your surface, by creating new geometry around your surface, which we will say is your wall. On the wall, you need to connect boundary edges with the floor (at z=0). So set?s say you find a boundary edge with points a and b * Add 2 points to your polydata. (xa, ya, 0), (xb, yb, 0) Then you create a quad that goes like this: (xa,ya,za), (xb,yb,zb) (xb,yb,0) (xa,ya,0) Or if you prefer you can create 2 triangles: (xa,ya,za), (xb,yb,zb) (xb,yb,0) (xb,yb,0) (xa,ya,0) (xa,ya,za), Anyway, after you create your walls at each boundary edge, you end up with walls that go all around your surface, but with no horizontal surface at the bottom. Maybe this is important to you, maybe not. If it?s important, you can create a duplicate copy of your top surface, but in the copy, set all your point?s Z to 0.0. This will flatten out the copy of your top surface and place it at Z=0, connecting to the bottom of your wall that you created all around your surface You will end up with a volume with the sides and bottom capped off. Patrick. From: Jacky Nguyen Date: Monday, July 16, 2018 at 5:12 AM To: Patrick Bergeron Cc: "vtkusers at public.kitware.com" Subject: Re: [vtkusers] Close the gap between a mesh and a planar Thanks for your input. Sorry, I am new to these so I need to take it slowly. Let me clarify a few things: 1) by using your approach, i don't need to create the plane on the bottom of the object as a holder? 2) When you say "For each boundary edge, create 2 triangles (a quad) with 1 or 2 points at z=0", does it matter which x and y coordinate to pick? I have added the following codes to extract the edges and find the pointID and point coordinate for each edge in the STL object. I trace through my console log, and there is no point that has z = 0 reader = vtk.vtkSTLReader() reader.SetFileName('path_to_stl') reader.Update() triangleFilter = vtk.vtkTriangleFilter() triangleFilter.SetInputConnection(reader.GetOutputPort()) triangleFilter.Update() # ++++++++++++++++++ extract edges ++++++++++++++++++++++++++++++++++++ featureEdges = vtk.vtkFeatureEdges() featureEdges.SetInputData(triangleFilter.GetOutput()) featureEdges.SetBoundaryEdges(1) featureEdges.SetFeatureEdges(0) featureEdges.SetNonManifoldEdges(0) featureEdges.SetManifoldEdges(0) featureEdges.Update() boundaryMesh = featureEdges.GetOutput() numberOfOpenEdges = featureEdges.GetOutput().GetNumberOfLines() print('number of lines: ', featureEdges.GetOutput().GetNumberOfLines()) for i in range(0, boundaryMesh.GetNumberOfLines()): cell = boundaryMesh.GetCell(i) cellPoints = cell.GetPoints() pointIds = cell.GetPointIds() for j in range(0, pointIds.GetNumberOfIds()): print('>>> point id: ', pointIds.GetId(j)) print('>>> coordinate: ', boundaryMesh.GetPoint(pointIds.GetId(j))) Thank you, On Fri, Jul 13, 2018 at 10:10 PM Patrick Bergeron > wrote: I would take a different approach. I would look at all the edges that have only 1 cell attached, and these are your boundary edges. For each boundary edge, create 2 triangles (a quad) with 1 or 2 points at z=0. (Create 2 new points at z=0 for this purpose). If you already have a point at that z=0, then reuse it don?t create it. That approach will create quads all around your geometry connecting to the bottom but will leave the bottom hole open. Next create a cell connecting all your z=0 points together. Make sure they are ordered in sequential order to create your contour loop. Done Sent from my iPhone On Jul 13, 2018, at 05:10, Jacky Nguyen > wrote: I have converted an .obj mesh file to .stl. I also created a planar geometry as a holder for the mesh object then merge them. However, it contains a gap. Any suggestion how to close the gap vertically so that it becomes a solid object, I have already tried vtkFillHolesFilter, but it won't fill the gap? The code to create the planar: implicitPolyDataDistance = vtk.vtkImplicitPolyDataDistance() implicitPolyDataDistance.SetInput(stl_poly_data) #create a grid xCoords = vtk.vtkFloatArray() for x, i in enumerate(np.linspace(xmin, xmax,50)): xCoords.InsertNextValue(i) yCoords = vtk.vtkFloatArray() for y, i in enumerate(np.linspace(ymin, ymax, 50)): yCoords.InsertNextValue(i) zCoords = vtk.vtkFloatArray() for z, i in enumerate(np.linspace(zmin, zmin + 1, 50)): zCoords.InsertNextValue(i) rgrid = vtk.vtkRectilinearGrid() rgrid.SetDimensions(x + 1, y + 1 , z + 1) rgrid.SetXCoordinates(xCoords) rgrid.SetYCoordinates(yCoords) rgrid.SetZCoordinates(zCoords) signedDistances = vtk.vtkFloatArray() signedDistances.SetNumberOfComponents(1) signedDistances.SetName("SignedDistances") # Evaluate the signed distance function at all of the grid points for pointId in range(rgrid.GetNumberOfPoints()): p = rgrid.GetPoint(pointId) signedDistance = implicitPolyDataDistance.EvaluateFunction(p) signedDistances.InsertNextValue(signedDistance) # add the SignedDistances to the grid rgrid.GetPointData().SetScalars(signedDistances) # geometry filter to view the background grid geometryFilter = vtk.vtkRectilinearGridGeometryFilter() geometryFilter.SetInputData(rgrid) geometryFilter.SetExtent(0, x + 1, 0, y + 1, (z + 1) // 2, (z + 1) // 2) geometryFilter.Update() # ================ END creating a plane ======================= The code that merge the stl poly data and the plane: meshAppend = vtk.vtkAppendPolyData() meshAppend.AddInputData(stl_poly_data) meshAppend.AddInputData(geometryFilter.GetOutput()) meshAppend.Update() boundaryClean = vtk.vtkCleanPolyData() boundaryClean.SetInputData(meshAppend.GetOutput()) boundaryClean.Update() out = vtk.vtkPolyData() out.DeepCopy(boundaryClean.GetOutput()) triangleTrans = vtk.vtkTriangleFilter() triangleTrans.SetInputData(out) triangleTrans.Update() fill = vtk.vtkFillHolesFilter() fill.SetInputData(out) fill.SetHoleSize(1000000.0) fill.Update() A screenshot of what my current mesh is (note: the red line is where i want to close the gap vertically along the z axis: https://i.stack.imgur.com/F9w3c.png Any suggestion to solve this problem? Thank you _______________________________________________ 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 M.skovmand1 at gmail.com Mon Jul 16 09:42:27 2018 From: M.skovmand1 at gmail.com (M_skov) Date: Mon, 16 Jul 2018 06:42:27 -0700 (MST) Subject: [vtkusers] =?utf-8?q?=E2=80=9CConnect=E2=80=9D_actors_by_removin?= =?utf-8?q?g_overlap_or_=E2=80=9Cfilling=E2=80=9D_the_gab=2E_Collision_det?= =?utf-8?q?ection?= Message-ID: <1531748547533-0.post@n5.nabble.com> I am attempting to visualize a structural frame, with a hollow cylindrical cross-section (later on I would like to generalize the cross-section, but for now this will do), using VTK version 8.1.0 and Python. Disclaimer, I am quite new to both VTK and Python programming. The problem is I am getting overlapping actors, which is obvious, to be honest. As illustrated in the figure below. I would like to get rid of this, and actually "connect" the adjacent actors. I am thinking that first of all, I need some form of collision detection. This I hoped could be achieved by using the example shown here: https://lorensen.github.io/VTKExamples/site/Cxx/PolyData/IntersectionPolyDataFilter/ However, I cannot get this example working with the way I am illustrating the cylinders as of now. (I have created a "sandbox" example of the problem, which I will put at the end of this post). My thought about this method is to use the points from the intersection to create a surface that can be used for clipping. I do not know if this is possible, or if there is a better solution to this problem? I hope some can be able to assist in this, would be much appreciated. If I need to go in another direction, in general, to solve this problem please let me know! If more information is needed please let me know as well. A sandbox version illustrating my problem can be seen below. The problem here is that I get a warning saying no intersection. Which there clearly is. I am using the transformed polydata for checking the intersection (Or so I think atleast), and I cannot figure out why I get no intersection, all help is appreciated! Best regards, Martin -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From ken.martin at kitware.com Mon Jul 16 12:12:47 2018 From: ken.martin at kitware.com (Ken Martin) Date: Mon, 16 Jul 2018 12:12:47 -0400 Subject: [vtkusers] Correctly apply camera matrix In-Reply-To: <1531728818177-0.post@n5.nabble.com> References: <1531728818177-0.post@n5.nabble.com> Message-ID: The best approach in VTK is to save the key variables, camera position, focal point, vup, dop, view angle. This is because the interaction methods directly adjust those parameters, not the computed matrix. On Mon, Jul 16, 2018 at 4:13 AM, andyjk wrote: > I am trying to save a particular camera view, then reapply it later (ie be > able to reset the the view to a previous position) > > I see from here ( > http://vtk.1045678.n5.nabble.com/How-to-restore-a-camera- > view-td5728916.html > ) that I can do this by saving position, focal_point, View-up and > view_angle, > > but I am trying to do this more neatly by saving just the 4x4 > transformation > matrix of the camera (and assuming view angle is unchanged). > > How can I grab the current camera transformation matrix, and later re-apply > it ? > > I have tried : > > 1) GRAB > vtkSmartPointer mat; > mat = > iren->GetRenderWindow()->GetRenderers()->GetFirstRenderer()-> > GetActiveCamera()->GetModelViewTransformMatrix(); > > saveVTKMat4x4(mat, "VTKCamera.vmx"); > > 2) LOAD and APPLY > loadVTKMat4x4(mat, "VTKCamera.vmx"); > mat->Print(std::cout); > > > vtkSmartPointer mat_inverse = > vtkSmartPointer::New(); > vtkMatrix4x4::Invert(mat, mat_inverse); > vtkSmartPointer transform = > vtkSmartPointer::New(); > transform->SetMatrix(mat); > transform->Update(); > > > vtkSmartPointer current_mat; > current_mat = custom_camera->GetViewTransformMatrix(); > > vtkSmartPointer current_mat_inverse = > vtkSmartPointer::New(); > vtkMatrix4x4::Invert(current_mat, current_mat_inverse); > > vtkSmartPointer transformInv = > vtkSmartPointer::New(); > transformInv->SetMatrix(current_mat_inverse); > transformInv->Update(); > > > custom_camera->ApplyTransform(transformInv); > custom_camera->Modified(); > custom_camera->ApplyTransform(transform); > > > [Where the save/load functions have been verified using vtk::print and are > working fine] > > I presume when loading, I have to move the camera back to identity (via an > inverse transform) before applying the new transform because I think > ApplyTransform concatenates. > > I find that if I don't move the camera at all between saving and loading, > it > works. > If I nudge the camera a tiny bit between loading and saving, the new view > is > displaced a bit more when loading, so I think I must be getting some > inverse > transforms muddled up? > > Is there a neat way to the current camera matrix then reapply it later ? > > > > > > > -- > 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 dzenanz at gmail.com Mon Jul 16 12:45:02 2018 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Mon, 16 Jul 2018 12:45:02 -0400 Subject: [vtkusers] Segmentation and visualization with color In-Reply-To: References: Message-ID: Hi Ashef, have you looked at this example ? If not, try it. Otherwise re-post this question on the forum . There was already a similar question . Regards, D?enan On Thu, Jul 12, 2018 at 10:53 AM Ashef Shahrior wrote: > I have followed the itk guide and implemented those segmentation methods. > Using fast marching segmentation, I am getting this in the fourth box. I > have used itk for segmentation and vtk for visualization with C++. > [image: image.png] > But what I actually want is something like this - > [image: image.png] > I want to show the segmented portion right on top of the main image but > with a different color to distinguish it. How can I do that? > > This is my code:- > > https://paste.ubuntu.com/p/BRMrhys5J8/ > > #include "iostream"#include "string.h"using namespace std; > #include "itkCurvatureAnisotropicDiffusionImageFilter.h" > #include "itkGradientMagnitudeRecursiveGaussianImageFilter.h"#include "itkSigmoidImageFilter.h" > #include "itkFastMarchingImageFilter.h" > #include "itkBinaryThresholdImageFilter.h" > #include "itkImageFileReader.h"#include "itkImageFileWriter.h" > #include "itkRescaleIntensityImageFilter.h"#include "QuickView.h" > #include "itkCastImageFilter.h" > #include "itkGDCMImageIO.h" > char inputFile[1000], iseedX[100], iseedY[100], isigma[100], isigmoidAlpha[100], isigmoidBeta[100], itimeThreshold[100], istoppingValue[100], inputType[100];char inputName[1000], outputImage[1000], smoothingOutputImage[1000], gradientMagnitudeOutputImage[1000], sigmoidOutputImage[1000]; > void takeInput(){ > cout<< " Enter file path: "; > cin>>inputFile; > cout<< " Enter seed in X position: "; > cin>>iseedX; > cout<< " Enter seed in Y position: "; > cin>>iseedY; > cout<< " Enter Sigma value: "; > cin>>isigma; > cout<< " Enter SigmoidAlpha value: "; > cin>>isigmoidAlpha; > cout<< " Enter SigmoidBeta value: "; > cin>>isigmoidBeta; > cout<< " Enter time-threshold value: "; > cin>>itimeThreshold; > cout<< " Enter stopping value: "; > cin>>istoppingValue; > cout<< " Enter input file type '-IMAGE'/'-DICOM' : "; > cin>>inputType;} > void getFileName(){ > int l = strlen(inputFile); > int x = 0; > for(int i = l-1; i>-1; i--) > { > if(inputFile[i]=='\\') > break; > inputName[x] = inputFile[i]; > x++; > } > strrev(inputName); > return;} > > void fastMarchingSegmentation(){ > try > { > takeInput(); > getFileName(); > } > catch(exception e) > { > cout<<"Exception occurred in taking input"< } > > typedef float InternalPixelType; > const unsigned int Dimension = 2; > typedef itk::Image< InternalPixelType, Dimension > InternalImageType; > > typedef unsigned char OutputPixelType; > typedef itk::Image< OutputPixelType, Dimension > OutputImageType; > > typedef itk::BinaryThresholdImageFilter< InternalImageType, OutputImageType > ThresholdingFilterType; > ThresholdingFilterType::Pointer thresholder = ThresholdingFilterType::New(); > > typedef itk::CastImageFilter< InternalImageType, OutputImageType > CastingFilterType; > CastingFilterType::Pointer caster = CastingFilterType::New(); > > const InternalPixelType timeThreshold = atof( itimeThreshold ); > > thresholder->SetLowerThreshold( 0.0 ); > thresholder->SetUpperThreshold( timeThreshold ); > > thresholder->SetOutsideValue( 0 ); > thresholder->SetInsideValue( 255 ); > > typedef itk::GDCMImageIO ImageIOType; > ImageIOType::Pointer gdcmImageIO = ImageIOType::New(); > > typedef itk::ImageFileReader< InternalImageType > ReaderType; > typedef itk::ImageFileWriter< OutputImageType > WriterType; > > ReaderType::Pointer reader = ReaderType::New(); > WriterType::Pointer writer = WriterType::New(); > > reader->SetFileName( inputFile ); > //outputImage = "Fast Marching Segmented ";// +inputFile; > strcpy(outputImage, "Fast_Marching_Segmented_"); > strcat(outputImage, inputName); > writer->SetFileName( outputImage ); > > > for (int i = 0; inputType[i] != '\0'; i++) > inputType[i] = toupper(inputType[i]); > > if (strcmp(inputType,"-DICOM")==0) > { > reader->SetImageIO(gdcmImageIO); > } > try > { > reader->Update(); > } > catch (itk::ExceptionObject & e) > { > std::cerr << "exception in file reader " << std::endl; > std::cerr << e << std::endl; > return; // EXIT_FAILURE; > } > > typedef itk::RescaleIntensityImageFilter CastFilterType; > > typedef itk::CurvatureAnisotropicDiffusionImageFilter< > InternalImageType, > InternalImageType > SmoothingFilterType; > > SmoothingFilterType::Pointer smoothing = SmoothingFilterType::New(); > > typedef itk::GradientMagnitudeRecursiveGaussianImageFilter GradientFilterType; > > typedef itk::SigmoidImageFilter SigmoidFilterType; > > GradientFilterType::Pointer gradientMagnitude = GradientFilterType::New(); > SigmoidFilterType::Pointer sigmoid = SigmoidFilterType::New(); > > sigmoid->SetOutputMinimum( 0.0 ); > sigmoid->SetOutputMaximum( 1.0 ); > > typedef itk::FastMarchingImageFilter< InternalImageType,InternalImageType > FastMarchingFilterType; > > FastMarchingFilterType::Pointer fastMarching = FastMarchingFilterType::New(); > > smoothing->SetInput( reader->GetOutput() ); > gradientMagnitude->SetInput( smoothing->GetOutput() ); > sigmoid->SetInput( gradientMagnitude->GetOutput() ); > fastMarching->SetInput( sigmoid->GetOutput() ); > thresholder->SetInput( fastMarching->GetOutput() ); > //caster->SetInput( thresholder->GetOutput() ); > writer->SetInput(thresholder->GetOutput()); > > smoothing->SetTimeStep( 0.125 ); > smoothing->SetNumberOfIterations( 5 ); > smoothing->SetConductanceParameter( 9.0 ); > > const double sigma = atof( isigma ); > > gradientMagnitude->SetSigma( sigma ); > > const double alpha = atof( isigmoidAlpha ); > const double beta = atof( isigmoidBeta ); > > sigmoid->SetAlpha( alpha ); > sigmoid->SetBeta( beta ); > > typedef FastMarchingFilterType::NodeContainer NodeContainer; > typedef FastMarchingFilterType::NodeType NodeType; > NodeContainer::Pointer seeds = NodeContainer::New(); > > InternalImageType::IndexType seedPosition; > > seedPosition[0] = atoi( iseedX ); > seedPosition[1] = atoi( iseedY ); > > NodeType node; > const double seedValue = 0.0; > > node.SetValue( seedValue ); > node.SetIndex( seedPosition ); > > seeds->Initialize(); > seeds->InsertElement( 0, node ); > > fastMarching->SetTrialPoints( seeds ); > > > typedef itk::Image ImageType; > ImageType::Pointer image; > QuickView viewer; > > try > { > typedef itk::RescaleIntensityImageFilter< ImageType, ImageType > RescaleFilterType; > RescaleFilterType::Pointer caster1 = RescaleFilterType::New(); > WriterType::Pointer writer1 = WriterType::New(); > caster->SetInput( smoothing->GetOutput() ); > > image = caster->GetOutput(); > > caster1->SetInput( image ); > writer1->SetInput( caster1->GetOutput() ); > //writer1->SetFileName("Smoothing Output Image "+inputFile); > char t1[100]; > strcpy(t1,"Smoothing_Output_Image_" ); > char tmp[1000]; > strcpy(tmp,inputName); > strcat(t1, tmp); > writer1->SetFileName(t1); > caster1->SetOutputMinimum( 0 ); > caster1->SetOutputMaximum( 255 ); > caster1->Update(); > writer1->Update(); > //QuickView viewer; > //viewer.AddImage(image.GetPointer()); > viewer.AddImage(caster1->GetOutput()); > > } > catch( itk::ExceptionObject & err ) > { > std::cerr << "ExceptionObject caught in the kahini one !" << std::endl; > std::cerr << err << std::endl; > return; // EXIT_FAILURE; > } > > try > { > CastFilterType::Pointer caster2 = CastFilterType::New(); > WriterType::Pointer writer2 = WriterType::New(); > caster2->SetInput( gradientMagnitude->GetOutput() ); > writer2->SetInput( caster2->GetOutput() ); > //writer2->SetFileName("Gradient Magnitude Output Image "+inputFile); > char t1[100]; > strcpy(t1,"Gradient_Magnitude_Output_Image_"); > char tmp[1000]; > strcpy(tmp, inputName); > strcat(t1, tmp); > writer2->SetFileName(t1); > caster2->SetOutputMinimum( 0 ); > caster2->SetOutputMaximum( 255 ); > writer2->Update(); > > image = caster2->GetOutput(); > > /* QuickView viewer; viewer.AddImage(image.GetPointer());*/ > viewer.AddImage(caster2->GetOutput()); > } > catch( itk::ExceptionObject & err ) > { > std::cerr << "ExceptionObject caught !" << std::endl; > std::cerr << err << std::endl; > return; //EXIT_FAILURE; > } > > try > { > CastFilterType::Pointer caster3 = CastFilterType::New(); > WriterType::Pointer writer3 = WriterType::New(); > caster3->SetInput( sigmoid->GetOutput() ); > writer3->SetInput( caster3->GetOutput() ); > //writer3->SetFileName("Sigmoid Output Image"+inputFile); > > char t1[100]; > strcpy(t1,"Sigmoid_Output_Image_"); > char tmp[1000]; > strcpy(tmp,inputName); > strcat(t1, tmp); > writer3->SetFileName(t1); > caster3->SetOutputMinimum( 0 ); > caster3->SetOutputMaximum( 255 ); > writer3->Update(); > > //image = caster3->GetOutput(); > //QuickView viewer; > //viewer.AddImage(image.GetPointer()); > viewer.AddImage(caster3->GetOutput()); > //viewer.Visualize(); > } > catch( itk::ExceptionObject & err ) > { > std::cerr << "ExceptionObject caught !" << std::endl; > std::cerr << err << std::endl; > return; //EXIT_FAILURE; > } > > fastMarching->SetOutputSize( reader->GetOutput()->GetBufferedRegion().GetSize() ); > > const double stoppingTime = atof( istoppingValue ); > > fastMarching->SetStoppingValue( stoppingTime ); > > try > { > writer->Update(); > } > catch( itk::ExceptionObject & excep ) > { > std::cerr << "Exception caught !" << std::endl; > std::cerr << excep << std::endl; > return; //EXIT_FAILURE; > } > > try > { > CastFilterType::Pointer caster4 = CastFilterType::New(); > WriterType::Pointer writer4 = WriterType::New(); > caster4->SetInput( fastMarching->GetOutput() ); > writer4->SetInput( caster4->GetOutput() ); > //writer4->SetFileName("Fast Marching Filter Output " + inputFile); > char t1[100]; > strcpy(t1,"Fast_Marching_Filter_Output_"); > char tmp[1000]; > strcpy(tmp,inputName); > strcat(t1, tmp); > writer4->SetFileName(t1); > caster4->SetOutputMinimum( 0 ); > caster4->SetOutputMaximum( 255 ); > writer4->Update(); > > viewer.AddImage(caster4->GetOutput()); > > } > catch( itk::ExceptionObject & err ) > { > std::cerr << "ExceptionObject caught !" << std::endl; > std::cerr << err << std::endl; > return; //EXIT_FAILURE; > } > viewer.ShareCameraOff(); > viewer.Visualize();} > > > _______________________________________________ > 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: 291396 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image.png Type: image/png Size: 84452 bytes Desc: not available URL: From andrewkeeling at hotmail.com Mon Jul 16 12:46:02 2018 From: andrewkeeling at hotmail.com (andyjk) Date: Mon, 16 Jul 2018 09:46:02 -0700 (MST) Subject: [vtkusers] Correctly apply camera matrix In-Reply-To: References: <1531728818177-0.post@n5.nabble.com> Message-ID: <1531759562160-0.post@n5.nabble.com> Thanks Ken Looks like this is the sensible way to do it, so I have abandoned the transformation matrix idea. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From bill.lorensen at gmail.com Mon Jul 16 13:30:10 2018 From: bill.lorensen at gmail.com (Bill Lorensen) Date: Mon, 16 Jul 2018 10:30:10 -0700 Subject: [vtkusers] Correctly apply camera matrix In-Reply-To: <1531759562160-0.post@n5.nabble.com> References: <1531728818177-0.post@n5.nabble.com> <1531759562160-0.post@n5.nabble.com> Message-ID: These two examples save the camera to a file or store it in field data: https://lorensen.github.io/VTKExamples/site/Cxx/Utilities/SaveSceneToFieldData/ https://lorensen.github.io/VTKExamples/site/Cxx/Utilities/SaveSceneToFile/ On Mon, Jul 16, 2018 at 9:46 AM, andyjk wrote: > Thanks Ken > > Looks like this is the sensible way to do it, so I have abandoned the > transformation matrix idea. > > > > -- > 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 -- Unpaid intern in BillsParadise at noware dot com From minpu.code at gmail.com Mon Jul 16 21:43:51 2018 From: minpu.code at gmail.com (pnt1614) Date: Mon, 16 Jul 2018 18:43:51 -0700 (MST) Subject: [vtkusers] A problem with rendering lines on a surface Message-ID: <1531791831318-0.post@n5.nabble.com> Let's me describe my situation, first I pick many points and then render all cell edges around those points in different color. Everything is okay but when I rotate the camera, there are some edges disappeared. I am not sure what the problem is but it looks like a z-fighting problem. I have attached two images to show this problem. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From shayan.moradkhani at gmail.com Tue Jul 17 03:42:27 2018 From: shayan.moradkhani at gmail.com (shayan moradkhani) Date: Tue, 17 Jul 2018 00:42:27 -0700 (MST) Subject: [vtkusers] intersectwithobbtree Message-ID: <1531813347109-0.post@n5.nabble.com> hi, does any one know what the parameters for "intersectwithobbtree" are according to "https://www.vtk.org/doc/release/5.2/html/a00908.html#a53db482ed4ccfc3db52b258034597e7" ? unfortunately there is no explanation or example for that. any help would be appreciated shayan -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From harry1994128 at gmail.com Tue Jul 17 06:01:15 2018 From: harry1994128 at gmail.com (hao chen) Date: Tue, 17 Jul 2018 03:01:15 -0700 (MST) Subject: [vtkusers] Delete object from vtkPolyDataConnectivityFilter(C++) In-Reply-To: References: <1531401986606-0.post@n5.nabble.com> <1531723773397-0.post@n5.nabble.com> Message-ID: <1531821675509-0.post@n5.nabble.com> Hi kenichiro yoshimi, Very thank you for your method and reply patiently. I can get the origin CellId now. This is my part of code: vtkSmartPointer DicomImageReader = vtkSmartPointer::New(); DicomImageReader->SetDirectoryName("E:\\offline_3Ddata\\2017042402"); DicomImageReader->Update(); vtkSmartPointer filter = vtkSmartPointer::New(); filter->SetInputConnection(DicomImageReader->GetOutputPort()); filter->SetValue(0, 9000); filter->Update(); vtkSmartPointer triangleFilter = vtkSmartPointer::New(); triangleFilter->SetInputConnection(filter->GetOutputPort()); triangleFilter->Update(); *vtkSmartPointer idFilter = vtkSmartPointer::New(); idFilter->SetInputConnection(triangleFilter->GetOutputPort()); idFilter->SetIdsArrayName("ids"); idFilter->Update();* vtkSmartPointer connectivityFilter = vtkSmartPointer::New(); connectivityFilter->SetInput(*idFilter*->GetOutput()); connectivityFilter->SetExtractionModeToCellSeededRegions(); connectivityFilter->AddSeed(1000); connectivityFilter->Update(); *vtkSmartPointer cellIdArray = vtkIdTypeArray::SafeDownCast(connectivityFilter->GetOutput()->GetCellData()->GetArray("ids"));* *std::vector OriginCellId; for(int i = 0; i < cellIdArray->GetSize(); i++) { OriginCellId.push_back(cellIdArray->GetTuple1(i)); }* ---------------------------------------------------------------------------------------------------------------------- Use 'cellIdArray->GetTuple1(i)' can get is entire connectivityFilter's origin cellid in triangleFilter. In addition, I had a question about vtkIdFilter, did I need to use for sure? If I don't use, it will error in 'vtkSmartPointer cellIdArray = vtkIdTypeArray::SafeDownCast(connectivityFilter->GetOutput()->GetCellData()->GetArray("ids"));' I think is 'GetArray("ids")' problem. Sorry my poor english. Thank you~ Hao -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From marvin.huber at basf.com Tue Jul 17 06:26:24 2018 From: marvin.huber at basf.com (marf) Date: Tue, 17 Jul 2018 03:26:24 -0700 (MST) Subject: [vtkusers] Create PolyData in vtk.js Message-ID: <1531823184017-0.post@n5.nabble.com> Hi, I recently asked about an XMLUnstructuredGridReader to read .vtu files in vtk.js By now I advanced with this issue an can read the following information from a .vtu file: PointArray ConnectivityArray OffsetArray TypesArray I also know how these work, and how to theoretically construct different Cells from those. What I am missing though, is the actual implementation where I create new cells with data I provide and create PolyData from these cells to display it in the browser. Can anyone help me with that? All I found where examples in C++, using methods not available to vtk.js Marvin -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From vacingforo at gmail.com Tue Jul 17 09:32:50 2018 From: vacingforo at gmail.com (vacingforo) Date: Tue, 17 Jul 2018 06:32:50 -0700 (MST) Subject: [vtkusers] tkImageData - vtkUnsignedCharArray: Unable to allocate 768951260 elements of size 1 bytes. Message-ID: <1531834370310-0.post@n5.nabble.com> Hello, I have the following code piece : vtkSmartPointer image = vtkSmartPointer::New(); image->SetSpacing(spacing); image->SetDimensions(dim); image->SetExtent(-1, dim[0] + 1, -1 , dim[1] + 1, 0, dim[2] - 1); image->SetOrigin(origin); image->AllocateScalars(VTK_UNSIGNED_CHAR, 1); vtkIdType count = image->GetNumberOfPoints(); for (vtkIdType i = 0; i < count; ++i) { image->GetPointData()->GetScalars()->SetTuple1(i, white); } I get the following error when i process a polydata from vtp file of only 10K(It does not happen with smaller polydata). ERROR: In C:\VTK-7.1.1\Common\Core\vtkGenericDataArray.txx, line 394 vtkUnsignedCharArray (0xcc2ac80): Unable to allocate 768951260 elements of size 1 bytes. what(): std::bad_alloc It was compiled in mingw 32 bits in Windows 10. for more details check small application and a Windbg results in the following link: https://drive.google.com/drive/folders/13ZesoMHHvhAfe6zz__RIZ2qWDfmOcu0b?usp=sharing The memory seems to be ok but I don't know why it does not work. Best regards, Sergio -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From marvin.huber at basf.com Tue Jul 17 09:39:13 2018 From: marvin.huber at basf.com (marf) Date: Tue, 17 Jul 2018 06:39:13 -0700 (MST) Subject: [vtkusers] Create PolyData in vtk.js In-Reply-To: <1531823184017-0.post@n5.nabble.com> References: <1531823184017-0.post@n5.nabble.com> Message-ID: <1531834753471-0.post@n5.nabble.com> Ok, I solved it now, by taking the connectivityarray and translating it into a format for polyData which kind of looks like this numberOfPoints idOfPoint1 idOfPoint2 idOfPoint3 numberOfPoints idOfPoint1 idOfPoint2 idOfPoint3 e.g. polys = [3, 0, 2, 1, 3, 1, 2, 3, 3......] (this would only be triangles) points = [0.1, 0.5, 9, 0.5] Then I passed this to the polydata via polydata.getPolys().setData(polys); polydata.getPoints().setData(points); and provided it as the modeloutput with model.output[0] = polydata; So this worked nicely, but there is also more information that I would have to display by coloring cells or points, can someone help with that please? -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From vacingforo at gmail.com Tue Jul 17 10:49:25 2018 From: vacingforo at gmail.com (vacingforo) Date: Tue, 17 Jul 2018 07:49:25 -0700 (MST) Subject: [vtkusers] vtkImageData - vtkUnsignedCharArray: Unable to allocate 768951260 elements of size 1 bytes. In-Reply-To: <1531834370310-0.post@n5.nabble.com> References: <1531834370310-0.post@n5.nabble.com> Message-ID: <1531838965853-0.post@n5.nabble.com> Hello, This is the evolution of the memory which is included in the main.cpp posted link: The memory change from: There is 62 percent of memory in use to There is 93 percent of memory in use. Output program: Start... There is 62 percent of memory in use. There are 8061184 total KB of physical memory. There are 3050704 free KB of physical memory. There are 16171740 total KB of paging file. There are 3346076 free KB of paging file. There are 4194176 total KB of virtual memory. There are 4044480 free KB of virtual memory. There are 0 free KB of extended memory. There is 62 percent of memory in use. There are 8061184 total KB of physical memory. There are 3050404 free KB of physical memory. There are 16171740 total KB of paging file. There are 3346076 free KB of paging file. There are 4194176 total KB of virtual memory. There are 4044480 free KB of virtual memory. There are 0 free KB of extended memory. There is 62 percent of memory in use. There are 8061184 total KB of physical memory. There are 3050276 free KB of physical memory. There are 16171740 total KB of paging file. There are 2598940 free KB of paging file. There are 4194176 total KB of virtual memory. There are 3293492 free KB of virtual memory. There are 0 free KB of extended memory. There is 70 percent of memory in use. There are 8061184 total KB of physical memory. There are 2370144 free KB of physical memory. There are 16171740 total KB of paging file. There are 2620368 free KB of paging file. There are 4194176 total KB of virtual memory. There are 3293492 free KB of virtual memory. There are 0 free KB of extended memory. There is 84 percent of memory in use. There are 8061184 total KB of physical memory. There are 1241268 free KB of physical memory. There are 16171740 total KB of paging file. There are 2211832 free KB of paging file. There are 4194176 total KB of virtual memory. There are 3286068 free KB of virtual memory. There are 0 free KB of extended memory. There is 93 percent of memory in use. There are 8061184 total KB of physical memory. There are 535040 free KB of physical memory. There are 17240328 total KB of paging file. There are 2555224 free KB of paging file. There are 4194176 total KB of virtual memory. There are 2535072 free KB of virtual memory. There are 0 free KB of extended memory. terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From allison.vacanti at kitware.com Tue Jul 17 11:42:29 2018 From: allison.vacanti at kitware.com (Allie Vacanti) Date: Tue, 17 Jul 2018 11:42:29 -0400 Subject: [vtkusers] vtkImageData - vtkUnsignedCharArray: Unable to allocate 768951260 elements of size 1 bytes. In-Reply-To: <1531838965853-0.post@n5.nabble.com> References: <1531834370310-0.post@n5.nabble.com> <1531838965853-0.post@n5.nabble.com> Message-ID: The memory footprint of the input polydata isn't really important here, rather it's the bounds of the input dataset that are determining the size of the output in this example. What's the value of the dims arg? That's what is ultimately determining the size of this array. >From the linked code, the final size of the output scalar array will be (dims[0] + 2) * (dims[1] + 2) * (dims[2] + 2) bytes for uchar scalars. You likely want to reduce the resolution of the spacing parameters based on the input bounds to keep the size manageable. On Tue, Jul 17, 2018 at 10:49 AM, vacingforo wrote: > Hello, > > This is the evolution of the memory which is included in the main.cpp > posted > link: > The memory change from: > > There is 62 percent of memory in use to There is 93 percent of > memory in use. > > Output program: > > Start... > There is 62 percent of memory in use. > There are 8061184 total KB of physical memory. > There are 3050704 free KB of physical memory. > There are 16171740 total KB of paging file. > There are 3346076 free KB of paging file. > There are 4194176 total KB of virtual memory. > There are 4044480 free KB of virtual memory. > There are 0 free KB of extended memory. > There is 62 percent of memory in use. > There are 8061184 total KB of physical memory. > There are 3050404 free KB of physical memory. > There are 16171740 total KB of paging file. > There are 3346076 free KB of paging file. > There are 4194176 total KB of virtual memory. > There are 4044480 free KB of virtual memory. > There are 0 free KB of extended memory. > There is 62 percent of memory in use. > There are 8061184 total KB of physical memory. > There are 3050276 free KB of physical memory. > There are 16171740 total KB of paging file. > There are 2598940 free KB of paging file. > There are 4194176 total KB of virtual memory. > There are 3293492 free KB of virtual memory. > There are 0 free KB of extended memory. > There is 70 percent of memory in use. > There are 8061184 total KB of physical memory. > There are 2370144 free KB of physical memory. > There are 16171740 total KB of paging file. > There are 2620368 free KB of paging file. > There are 4194176 total KB of virtual memory. > There are 3293492 free KB of virtual memory. > There are 0 free KB of extended memory. > There is 84 percent of memory in use. > There are 8061184 total KB of physical memory. > There are 1241268 free KB of physical memory. > There are 16171740 total KB of paging file. > There are 2211832 free KB of paging file. > There are 4194176 total KB of virtual memory. > There are 3286068 free KB of virtual memory. > There are 0 free KB of extended memory. > There is 93 percent of memory in use. > There are 8061184 total KB of physical memory. > There are 535040 free KB of physical memory. > There are 17240328 total KB of paging file. > There are 2555224 free KB of paging file. > There are 4194176 total KB of virtual memory. > There are 2535072 free KB of virtual memory. > There are 0 free KB of extended memory. > terminate called after throwing an instance of 'std::bad_alloc' > what(): std::bad_alloc > > This application has requested the Runtime to terminate it in an unusual > way. > Please contact the application's support team for more information. > > > > -- > 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 sebastien.jourdain at kitware.com Tue Jul 17 11:54:48 2018 From: sebastien.jourdain at kitware.com (Sebastien Jourdain) Date: Tue, 17 Jul 2018 09:54:48 -0600 Subject: [vtkusers] Create PolyData in vtk.js In-Reply-To: <1531834753471-0.post@n5.nabble.com> References: <1531823184017-0.post@n5.nabble.com> <1531834753471-0.post@n5.nabble.com> Message-ID: I was starting to answer your previous email but I'm glad you figure it out. But I'm not sure what it your new question. 1) How to add data to the polydata? 2) How to render an array from a polydata for both points and cells? Seb PS: You could create an issue for that topic on vtk.js is you want too. On Tue, Jul 17, 2018 at 7:39 AM marf wrote: > Ok, I solved it now, by taking the connectivityarray and translating it > into > a format for polyData which kind of looks like this > > numberOfPoints idOfPoint1 idOfPoint2 idOfPoint3 numberOfPoints idOfPoint1 > idOfPoint2 idOfPoint3 > > e.g. > polys = [3, 0, 2, 1, 3, 1, 2, 3, 3......] (this would only be triangles) > points = [0.1, 0.5, 9, 0.5] > > Then I passed this to the polydata via > > polydata.getPolys().setData(polys); > polydata.getPoints().setData(points); > > and provided it as the modeloutput with > model.output[0] = polydata; > > So this worked nicely, but there is also more information that I would have > to display by coloring cells or points, can someone help with that please? > > > > -- > 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 ken.martin at kitware.com Tue Jul 17 13:21:58 2018 From: ken.martin at kitware.com (Ken Martin) Date: Tue, 17 Jul 2018 13:21:58 -0400 Subject: [vtkusers] A problem with rendering lines on a surface In-Reply-To: <1531791831318-0.post@n5.nabble.com> References: <1531791831318-0.post@n5.nabble.com> Message-ID: Did you //@{ /** * Set/Get a global flag that controls whether coincident topology (e.g., a * line on top of a polygon) is shifted to avoid z-buffer resolution (and * hence rendering problems). If not off, there are two methods to choose * from. PolygonOffset uses graphics systems calls to shift polygons, lines * and points from each other. ShiftZBuffer is a legacy method that used to * remap the z-buffer to distinguish vertices, lines, and polygons, but * does not always produce acceptable results. You should only use the * PolygonOffset method (or none) at this point. */ static void SetResolveCoincidentTopology(int val); static int GetResolveCoincidentTopology(); static void SetResolveCoincidentTopologyToDefault(); static void SetResolveCoincidentTopologyToOff() { SetResolveCoincidentTopology(VTK_RESOLVE_OFF) ;} static void SetResolveCoincidentTopologyToPolygonOffset() { SetResolveCoincidentTopology(VTK_RESOLVE_POLYGON_OFFSET); } static void SetResolveCoincidentTopologyToShiftZBuffer() { SetResolveCoincidentTopology(VTK_RESOLVE_SHIFT_ZBUFFER); } //@} specifically mapper->SetResolveCoincidentTopologyToPolygonOffset(); ? On Mon, Jul 16, 2018 at 9:43 PM, pnt1614 wrote: > Let's me describe my situation, first I pick many points and then render > all > cell edges around those points in different color. Everything is okay but > when I rotate the camera, there are some edges disappeared. I am not sure > what the problem is but it looks like a z-fighting problem. I have attached > two images to show this problem. > > > > > > -- > 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 rccm.kyoshimi at gmail.com Tue Jul 17 23:22:02 2018 From: rccm.kyoshimi at gmail.com (kenichiro yoshimi) Date: Wed, 18 Jul 2018 12:22:02 +0900 Subject: [vtkusers] intersectwithobbtree In-Reply-To: <1531813347109-0.post@n5.nabble.com> References: <1531813347109-0.post@n5.nabble.com> Message-ID: Hello, I am not too sure, but IntersectWithOBBTree function is used to search intersections between two vtkPolyData objects in vtkIntersectionPolyDataFilter. https://github.com/Kitware/VTK/blob/master/Filters/General/vtkIntersectionPolyDataFilter.cxx For your reference. 2018?7?17?(?) 16:42 shayan moradkhani : > > hi, > does any one know what the parameters for "intersectwithobbtree" are > according to > "https://www.vtk.org/doc/release/5.2/html/a00908.html#a53db482ed4ccfc3db52b258034597e7" > ? > > unfortunately there is no explanation or example for that. > any help would be appreciated > > shayan > > > > -- > 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 minpu.code at gmail.com Wed Jul 18 00:02:24 2018 From: minpu.code at gmail.com (pnt1614) Date: Tue, 17 Jul 2018 21:02:24 -0700 (MST) Subject: [vtkusers] A problem with rendering lines on a surface In-Reply-To: References: <1531791831318-0.post@n5.nabble.com> Message-ID: <1531886544433-0.post@n5.nabble.com> Thank for the reply, I will try it and let you know the result. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From jackynguyen.km at gmail.com Wed Jul 18 02:43:47 2018 From: jackynguyen.km at gmail.com (Jacky Nguyen) Date: Wed, 18 Jul 2018 14:43:47 +0800 Subject: [vtkusers] Close the gap between a mesh and a planar In-Reply-To: References: <679DA8D3-16D1-4213-9085-F0DBCB53B86D@spiria.com> Message-ID: Hi Patrick, Thanks for the clarification. I have tried your approach, but however the wall was not covered up the entire boundary. The wall was stopped kinda half way. Do you mind taking a look at my code to see what went wrong? I have created a gist here: https://gist.github.com/ngunhaSO/f3902fd34172a161b678b2a05a5c91fe I have also attached a stl file that i wanna manipulate and the screenshot of what i achieved here: https://github.com/ngunhaSO/misc Thank you! Jacky On Mon, Jul 16, 2018 at 7:48 PM Patrick Bergeron wrote: > Hi Jacky > > > > Let me try to be clearer. Let?s say you have a surface floating in space, > which seems to be your case. > > > > You can create a wall around your surface, by creating new geometry around > your surface, which we will say is your wall. On the wall, you need to > connect boundary edges with the floor (at z=0). > > > > So set?s say you find a boundary edge with points a and b > > > > - Add 2 points to your polydata. (xa, ya, 0), (xb, yb, 0) > > > > Then you create a quad that goes like this: > > > > (xa,ya,za), > > (xb,yb,zb) > > (xb,yb,0) > > (xa,ya,0) > > > > Or if you prefer you can create 2 triangles: > > (xa,ya,za), > > (xb,yb,zb) > > (xb,yb,0) > > > > (xb,yb,0) > > (xa,ya,0) > > (xa,ya,za), > > > > > > Anyway, after you create your walls at each boundary edge, you end up with > walls that go all around your surface, but with no horizontal surface at > the bottom. Maybe this is important to you, maybe not. > > > > If it?s important, you can create a duplicate copy of your top surface, > but in the copy, set all your point?s Z to 0.0. > > > > This will flatten out the copy of your top surface and place it at Z=0, > connecting to the bottom of your wall that you created all around your > surface > > > > You will end up with a volume with the sides and bottom capped off. > > > > > > Patrick. > > > > > > > > *From: *Jacky Nguyen > *Date: *Monday, July 16, 2018 at 5:12 AM > *To: *Patrick Bergeron > *Cc: *"vtkusers at public.kitware.com" > *Subject: *Re: [vtkusers] Close the gap between a mesh and a planar > > > > Thanks for your input. > > Sorry, I am new to these so I need to take it slowly. > > > > Let me clarify a few things: > > 1) by using your approach, i don't need to create the plane on the bottom > of the object as a holder? > > 2) When you say "For each boundary edge, create 2 triangles (a quad) with > 1 or 2 points at z=0", does it matter which x and y coordinate to pick? > > > > I have added the following codes to extract the edges and find the pointID > and point coordinate for each edge in the STL object. I trace through my > console log, and there is no point that has z = 0 > > > > reader = vtk.vtkSTLReader() > reader.SetFileName('path_to_stl') > reader.Update() > > triangleFilter = vtk.vtkTriangleFilter() > triangleFilter.SetInputConnection(reader.GetOutputPort()) > triangleFilter.Update() > > # ++++++++++++++++++ extract edges ++++++++++++++++++++++++++++++++++++ > > featureEdges = vtk.vtkFeatureEdges() > featureEdges.SetInputData(triangleFilter.GetOutput()) > featureEdges.SetBoundaryEdges(1) > featureEdges.SetFeatureEdges(0) > featureEdges.SetNonManifoldEdges(0) > featureEdges.SetManifoldEdges(0) > featureEdges.Update() > boundaryMesh = featureEdges.GetOutput() > numberOfOpenEdges = featureEdges.GetOutput().GetNumberOfLines() > print('number of lines: ', featureEdges.GetOutput().GetNumberOfLines()) > for i in range(0, boundaryMesh.GetNumberOfLines()): > cell = boundaryMesh.GetCell(i) > cellPoints = cell.GetPoints() > pointIds = cell.GetPointIds() > for j in range(0, pointIds.GetNumberOfIds()): > print('>>> point id: ', pointIds.GetId(j)) > print('>>> coordinate: ', boundaryMesh.GetPoint(pointIds.GetId(j))) > > > > Thank you, > > > > > > On Fri, Jul 13, 2018 at 10:10 PM Patrick Bergeron > wrote: > > I would take a different approach. > > > > I would look at all the edges that have only 1 cell attached, and these > are your boundary edges. > > > > For each boundary edge, create 2 triangles (a quad) with 1 or 2 points at > z=0. (Create 2 new points at z=0 for this purpose). If you already have a > point at that z=0, then reuse it don?t create it. > > > > That approach will create quads all around your geometry connecting to the > bottom but will leave the bottom hole open. > > > > Next create a cell connecting all your z=0 points together. Make sure they > are ordered in sequential order to create your contour loop. > > > > Done > > > > > > Sent from my iPhone > > > On Jul 13, 2018, at 05:10, Jacky Nguyen wrote: > > I have converted an .obj mesh file to .stl. I also created a planar > geometry as a holder for the mesh object then merge them. However, it > contains a gap. Any suggestion how to close the gap vertically so that it > becomes a solid object, I have already tried vtkFillHolesFilter, but it > won't fill the gap? > > > > The code to create the planar: > > > > implicitPolyDataDistance = vtk.vtkImplicitPolyDataDistance() > > implicitPolyDataDistance.SetInput(stl_poly_data) > > > > #create a grid > > xCoords = vtk.vtkFloatArray() > > for x, i in enumerate(np.linspace(xmin, xmax,50)): > > xCoords.InsertNextValue(i) > > > > yCoords = vtk.vtkFloatArray() > > for y, i in enumerate(np.linspace(ymin, ymax, 50)): > > yCoords.InsertNextValue(i) > > > > zCoords = vtk.vtkFloatArray() > > for z, i in enumerate(np.linspace(zmin, zmin + 1, 50)): > > zCoords.InsertNextValue(i) > > > > rgrid = vtk.vtkRectilinearGrid() > > rgrid.SetDimensions(x + 1, y + 1 , z + 1) > > rgrid.SetXCoordinates(xCoords) > > rgrid.SetYCoordinates(yCoords) > > rgrid.SetZCoordinates(zCoords) > > signedDistances = vtk.vtkFloatArray() > > signedDistances.SetNumberOfComponents(1) > > signedDistances.SetName("SignedDistances") > > > > # Evaluate the signed distance function at all of the grid points > > for pointId in range(rgrid.GetNumberOfPoints()): > > p = rgrid.GetPoint(pointId) > > signedDistance = implicitPolyDataDistance.EvaluateFunction(p) > > signedDistances.InsertNextValue(signedDistance) > > > > # add the SignedDistances to the grid > > rgrid.GetPointData().SetScalars(signedDistances) > > > > # geometry filter to view the background grid > > geometryFilter = vtk.vtkRectilinearGridGeometryFilter() > > geometryFilter.SetInputData(rgrid) > > geometryFilter.SetExtent(0, x + 1, 0, y + 1, (z + 1) // 2, (z + 1) // 2) > > geometryFilter.Update() > > # ================ END creating a plane ======================= > > > > The code that merge the stl poly data and the plane: > > meshAppend = vtk.vtkAppendPolyData() > > meshAppend.AddInputData(stl_poly_data) > > meshAppend.AddInputData(geometryFilter.GetOutput()) > > meshAppend.Update() > > boundaryClean = vtk.vtkCleanPolyData() > > boundaryClean.SetInputData(meshAppend.GetOutput()) > > boundaryClean.Update() > > out = vtk.vtkPolyData() > > out.DeepCopy(boundaryClean.GetOutput()) > > > > triangleTrans = vtk.vtkTriangleFilter() > > triangleTrans.SetInputData(out) > > triangleTrans.Update() > > > > fill = vtk.vtkFillHolesFilter() > > fill.SetInputData(out) > > fill.SetHoleSize(1000000.0) > > fill.Update() > > > > > > A screenshot of what my current mesh is (note: the red line is where i > want to close the gap vertically along the z axis: > https://i.stack.imgur.com/F9w3c.png > > > > Any suggestion to solve this problem? > > > > Thank you > > > > _______________________________________________ > 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 andrew.amaclean at gmail.com Wed Jul 18 03:29:00 2018 From: andrew.amaclean at gmail.com (Andrew Maclean) Date: Wed, 18 Jul 2018 17:29:00 +1000 Subject: [vtkusers] Correctly apply camera matrix In-Reply-To: References: Message-ID: Bill, if you like, I can do a Python version of these two examples. Regards Andrew ---------- Forwarded message ---------- > From: Bill Lorensen > To: andyjk > Cc: VTK Users > Bcc: > Date: Mon, 16 Jul 2018 10:30:10 -0700 > Subject: Re: [vtkusers] Correctly apply camera matrix > These two examples save the camera to a file or store it in field data: > > > https://lorensen.github.io/VTKExamples/site/Cxx/Utilities/SaveSceneToFieldData/ > https://lorensen.github.io/VTKExamples/site/Cxx/Utilities/SaveSceneToFile/ > > > On Mon, Jul 16, 2018 at 9:46 AM, andyjk wrote: > > Thanks Ken > > > > Looks like this is the sensible way to do it, so I have abandoned the > > transformation matrix idea. > > > > > > > > -- > > 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 > > > > -- > Unpaid intern in BillsParadise at noware dot com > > > > -- > ___________________________________________ Andrew J. P. Maclean ___________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: From jayavardhanravi at outlook.com Wed Jul 18 04:51:02 2018 From: jayavardhanravi at outlook.com (Jay) Date: Wed, 18 Jul 2018 01:51:02 -0700 (MST) Subject: [vtkusers] How to run VTK with display driver supporting OpenGL version < 3.0 Message-ID: <1531903862658-0.post@n5.nabble.com> I am trying to run VTK on a hardware platform which doesn't support OpenGL version 3.0 or higher (display driver). I tried to test the VTK 8.1.1 build with VTK_RENDERING_BACKEND = OpenGL2 but the application crashes with OpenGL error which I suspect to be related to OpenGL. So I went back and tried to build the VTK 8.1.1 with VTK_RENDERINZG_BACKEND = OpenGL but failed to make & build as it says that the VTK 8.1.1 doesn't support OPENGL anymore. So I moved back to VTK 7.1.1 and was able to build with both options OpenGL2 and OpenGL of VTK_RENDERING_BACKEND. I was confused to about what VTK_RENDERING_BACKEND means i.e. difference between OpenGL2 and OpenGL options. Is it the versions ? If so how do I know which versions are supported by OpenGL2 and OpenGL How can I know which versions of VTK would be able to run on the hardware platform with display drivers having support for OpenGL version less than 3.0 (OpenGL References: Message-ID: <1531904826861-0.post@n5.nabble.com> I had faced the similar issue using the TimerEvent with VTK 8.1.1 and QT 5.10. But with the previous version VTK 7.1.1 and VTK 5.10 i was able to get the TimerEvent to be triggered. As the time event was not firing I tried to replace it with the QTimer. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From shayan.moradkhani at gmail.com Wed Jul 18 05:10:00 2018 From: shayan.moradkhani at gmail.com (shayan moradkhani) Date: Wed, 18 Jul 2018 02:10:00 -0700 (MST) Subject: [vtkusers] intersectwithobbtree In-Reply-To: References: <1531813347109-0.post@n5.nabble.com> Message-ID: <1531905000769-0.post@n5.nabble.com> thanks for your reply, but those thousand lines of codes on the github page does not really tell much how to use IntersectWithOBBTree function :-( . below is the function with 4 parameters: what is that transformation? the third parameter is a function taking 4 parameters and the last one is also not clear. if anyone has any idea, i would very much appreciate it regards Shayan -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From juch at zhaw.ch Wed Jul 18 05:50:09 2018 From: juch at zhaw.ch (normanius) Date: Wed, 18 Jul 2018 02:50:09 -0700 (MST) Subject: [vtkusers] How to traverse lines of a polyline in reversed order? Message-ID: <1531907409886-0.post@n5.nabble.com> Hi allHow to nicely traverse the lines of a polyline in reversed order, from end to start? Is there an existing function that does this, or do I have to implement my own loop that does this?In the example below, I would like to get the line traversal AD -> DC -> CB -> BA, after initializing the cells to go from AB -> BC -> CD -> DA.Thanks! -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From ochampao at hotmail.com Wed Jul 18 05:52:56 2018 From: ochampao at hotmail.com (ochampao) Date: Wed, 18 Jul 2018 02:52:56 -0700 (MST) Subject: [vtkusers] Problem with vtkImageResliceMapper and vtkCutter Message-ID: <1531907576199-0.post@n5.nabble.com> Hello vtkUsers, My application uses a vtkImageStack for overlaying slices of medical images from multiple volumes. Briefly the pipeline is: vtkDICOMImageReader -> vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack. On these 2D views, I am also overlaying cross-sections of polygonal volumes (e.g. from a vtkSphereSource) extracted using a vtkCutter instance. The cut function is set to the vtkImageResliceMapper's slice plane, i.e. cutter->SetCutFunction(resliceMapper->GetSlicePlane()); The slice plane is updated when the camera focus changes and the output of the cutter is updated automatically accordingly. This works well but in some cases the extracted cross-section seems to disappear for some slice planes. In particular, when the camera is such that we are slicing through the volume along the z-axis, there is no problem. If the camera is set such that we are slicing along the x, or y-axis then the problem appears. For some slice planes, the actor representing the cross-section disappears, as if it is hidden by the image slice. Setting the opacity to 0.5 of the vtkImageSlice and the vtkImageStack does not however make the missing cross-sections visible. I suspect that this happens because the slicing plane is slightly further away from camera focus. By looking at the source code of vtkImageResliceMapper, when JumpToNearestSlice is on, the plane should be aligned with a slice. Why is this behaviour happening, and how can this be fixed? Any suggestions are welcome. Thanks, Panos -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From marvin.huber at basf.com Wed Jul 18 06:21:13 2018 From: marvin.huber at basf.com (marf) Date: Wed, 18 Jul 2018 03:21:13 -0700 (MST) Subject: [vtkusers] Create PolyData in vtk.js In-Reply-To: References: <1531823184017-0.post@n5.nabble.com> <1531834753471-0.post@n5.nabble.com> Message-ID: <1531909273485-0.post@n5.nabble.com> First off, thank you very much for your answer :-) So my current state is, that I can render the data from a .vtu file as polydata through using a mapper and an actor like this: *const reader = xmlUnstructuredGridReader.newInstance(); const mapper = vtk.Rendering.Core.vtkMapper.newInstance({ scalarVisibility: true }); const actor = vtk.Rendering.Core.vtkActor.newInstance(); await reader.parseAsArrayBuffer(serverFile); actor.setMapper(mapper); mapper.setInputConnection(reader.getOutputPort()); renderer.addActor(actor); renderer.resetCamera(); this.onReady(renderWindow); //UnstructuredGridReader is written by myself (with inspiration from the vtkPolyDataReader) and utilizes the vtkXMLReader to read a .vtu file into a polydataobject* But now I also want to show more information, by coloring the model. I found that this could by done by using a vtkLookupTable and tried the following, before actor.setMapper(mapper) * const bounds = reader.getOutputData().getBounds(); const max = Math.max.apply(Math, bounds); const min = Math.min.apply(Math, bounds); const lookup = vtk.Common.Core.vtkLookupTable.newInstance(); lookup.setNumberOfColors(64), lookup.setHueRange(0.0, 0.667); lookup.setRange(min, max); lookup.build(); mapper.setLookupTable(lookup); mapper.setInterpolateScalarsBeforeMapping(true); mapper.setUseLookupTableScalarRange(lookup);* This did not do anything at all. So I treid coloring the point individually kind of like this: *for (let i = 0; i < pointsData.getNumberOfPoints(); i++) { const color = []; color[0] = 0.2; color[1] = 0.1; color[2] = 0.1; colors.insertNextTupleValue(color); } reader.getOutputData().getPointData().setScalars(colors);* Since colors apparently should be a vtkUnsignedCharArray and that is not implemented in vtkjs yet, I mocked it like this: * const colors = { tupleValues: [ ], insertNextTupleValue: (color) => { for (let i = 0; i < color.length; i++) { colors.tupleValues.push(color[i]); } }, getNumberOfComponents: () => { return 3; }, getDataType: () => { return 'array'; }, getNumberOfTuples: () => { return colors.tupleValues.length / colors.getNumberOfComponents(); }, getData: () => { return colors.tupleValues; } }; * This actually lets me color the model, but there are some issues - It will only ever pick up color[0] for a point, that can range from 0 ( = orange-red) to 1 ( = blue) and misses a real red and all purple variations - I have to kind of figure out the colors since rgb does not work at all afaik Sorry for the very long post, I hope it is not even more confusing -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From emonclus at cs.upc.edu Wed Jul 18 07:20:08 2018 From: emonclus at cs.upc.edu (=?UTF-8?Q?Eva_Moncl=c3=bas?=) Date: Wed, 18 Jul 2018 13:20:08 +0200 Subject: [vtkusers] Printing the contents of a vtkWindowLevelLookupTable Message-ID: <44777d02-9ac5-9135-dd36-3e4a285c936f@cs.upc.edu> Hello everyone, I'm working with a volume dataset which is visualized using a vtkWindowLevelLookupTable?? with a vtkImageMapToColors which takes as an input vtkExtractVOI->GetOutputPort(). The vtkExtractVOI has as an inputdata the volume dataset. This pipeline works fine. I can change the window/level of the vtkWindowLevelLookupTable? using? SetWindow/SetLevel methods and after that I always execute the Build method of the vtkWindowLevelLookupTable.?? As I said, the changes in the window/level are properly mapped in the obtained visualization. My problem starts when I try to print the colors of the vtkWindowLevelLookupTable? (I want to use them in another task). I use the following code to print it, but I always obtain the same values (although I'm changing the window/level and I see how my changes affect the current rendering). But, although I change the window/level the printed messages are always the same. void printVtKTransferFunction(vtkLookupTable *vtk_tf) { ??? vtkIdType tv = vtk_tf->GetNumberOfTableValues(); ??? double dR[2]; ??? vtk_tf->GetTableRange(dR); ???? cout << "Number of table values : " << tv << "\nTable Range: " << std::fixed? << std::setw(8) << std::setprecision(6) ??? ??? ??? ??? << dR[0] << " to " << dR[1] << std::endl; ??? ??? ??? std::vector indices; ??? ??? ??? for (int i = 0; i < tv; ++i) ??? ??? ??? { ??? ??? ??? ??? indices.push_back((dR[1] - dR[0]) * i / tv + dR[0]); ??? ??? ??? } ??? ??? ??? unsigned int id_tf = 0; ??? ??? ??? for (std::vector::const_iterator p = indices.begin(); p != indices.end(); ++p, id_tf++) ??? ??? ??? { ??? ??? ??? ??? double rgba[4]; ??? ??? ??? ??? vtk_tf->GetColor(*p, rgba); ??? ??? ??? ??? rgba[3] = vtk_tf->GetOpacity(*p); ??? ??? ??? ??? cerr << id_tf << " : " << rgba[0] << " " << rgba[1] << " " << rgba[2] << " " << rgba[3] << endl; ??? ??? ??? } ??? ??? } } Any help will be welcome.? Thank you very much in advance, ?? Eva From juch at zhaw.ch Wed Jul 18 07:32:18 2018 From: juch at zhaw.ch (normanius) Date: Wed, 18 Jul 2018 04:32:18 -0700 (MST) Subject: [vtkusers] How to triangulate two non-intersecting polylines, now in 3D In-Reply-To: <1520414018586-0.post@n5.nabble.com> References: <1520285054864-0.post@n5.nabble.com> <1520285371710-0.post@n5.nabble.com> <1520285736914-0.post@n5.nabble.com> <1520296188366-0.post@n5.nabble.com> <1520296360148-0.post@n5.nabble.com> <1520414018586-0.post@n5.nabble.com> Message-ID: <1531913538053-0.post@n5.nabble.com> For the sake of completeness: there were a few issues with this code. Notably, the input edges must be oriented the same way and represented as a continuous polyline. (feature edges are not guaranteed to form a continuous line). I shared a working example of the code on SO, hoping this will be useful for somebody: https://stackoverflow.com/a/51371094/3388962 -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From shayan.moradkhani at gmail.com Wed Jul 18 08:32:57 2018 From: shayan.moradkhani at gmail.com (shayan moradkhani) Date: Wed, 18 Jul 2018 05:32:57 -0700 (MST) Subject: [vtkusers] machining simulation and collision detection In-Reply-To: <1531726120902-0.post@n5.nabble.com> References: <1530181664677-0.post@n5.nabble.com> <1531292548828-0.post@n5.nabble.com> <1531382798046-0.post@n5.nabble.com> <1531726120902-0.post@n5.nabble.com> Message-ID: <1531917177883-0.post@n5.nabble.com> hi, has any one used this collision detection file so he/she is kind enough to give me some hints using them? i was just told this: "You need to replace vtkSlicerRtCommonWin32Header.h and VTK_SLICERRTCOMMON_EXPORT with your export header and macro. " shayan -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From rccm.kyoshimi at gmail.com Wed Jul 18 08:34:34 2018 From: rccm.kyoshimi at gmail.com (kenichiro yoshimi) Date: Wed, 18 Jul 2018 21:34:34 +0900 Subject: [vtkusers] Close the gap between a mesh and a planar In-Reply-To: References: <679DA8D3-16D1-4213-9085-F0DBCB53B86D@spiria.com> Message-ID: Hi, Excuse me for cutting in. I am inspired by Patrick method. First create a skirt from boundary edges of polygonal data by vtkLinearExtrusionFilter and then place the extruded points at x-y plane. --- #!/usr/bin/env python # -*- coding: utf-8 -*- import vtk def main(): colors = vtk.vtkNamedColors() reader = vtk.vtkSTLReader() reader.SetFileName('improve.stl') reader.Update() # Apply linear extrusion extrude = vtk.vtkLinearExtrusionFilter() extrude.SetInputConnection(reader.GetOutputPort()) extrude.SetExtrusionTypeToNormalExtrusion(); extrude.SetVector(0, 0, -10) extrude.CappingOn() extrude.Update() # project extruded points onto x-y plane z = 1130 closedSurface = extrude.GetOutput() points = closedSurface.GetPoints() numPts = closedSurface.GetNumberOfPoints() for ptId in range(numPts/2, numPts): point = points.GetPoint(ptId) points.SetPoint(ptId, point[0], point[1], z) # Create a mapper and actor. mapper = vtk.vtkPolyDataMapper() mapper.SetInputData(closedSurface) actor = vtk.vtkActor() actor.GetProperty().SetColor(colors.GetColor3d("Cornsilk")) actor.SetMapper(mapper) # Create a renderer, render window, and interactor renderer = vtk.vtkRenderer() renderWindow = vtk.vtkRenderWindow() renderWindow.SetWindowName("TaperedCylinder") renderWindow.AddRenderer(renderer) renderWindowInteractor = vtk.vtkRenderWindowInteractor() renderWindowInteractor.SetRenderWindow(renderWindow) # Add the actors to the scene renderer.AddActor(actor) renderer.SetBackground(colors.GetColor3d("DarkGreen")) # Render and interact renderWindow.Render() renderWindowInteractor.Start() if __name__ == '__main__': main() --- For your reference. 2018?7?18?(?) 15:44 Jacky Nguyen : > > Hi Patrick, > > Thanks for the clarification. I have tried your approach, but however the wall was not covered up the entire boundary. The wall was stopped kinda half way. > Do you mind taking a look at my code to see what went wrong? I have created a gist here: https://gist.github.com/ngunhaSO/f3902fd34172a161b678b2a05a5c91fe > I have also attached a stl file that i wanna manipulate and the screenshot of what i achieved here: https://github.com/ngunhaSO/misc > > Thank you! > > Jacky > > On Mon, Jul 16, 2018 at 7:48 PM Patrick Bergeron wrote: >> >> Hi Jacky >> >> >> >> Let me try to be clearer. Let?s say you have a surface floating in space, which seems to be your case. >> >> >> >> You can create a wall around your surface, by creating new geometry around your surface, which we will say is your wall. On the wall, you need to connect boundary edges with the floor (at z=0). >> >> >> >> So set?s say you find a boundary edge with points a and b >> >> >> >> Add 2 points to your polydata. (xa, ya, 0), (xb, yb, 0) >> >> >> >> Then you create a quad that goes like this: >> >> >> >> (xa,ya,za), >> >> (xb,yb,zb) >> >> (xb,yb,0) >> >> (xa,ya,0) >> >> >> >> Or if you prefer you can create 2 triangles: >> >> (xa,ya,za), >> >> (xb,yb,zb) >> >> (xb,yb,0) >> >> >> >> (xb,yb,0) >> >> (xa,ya,0) >> >> (xa,ya,za), >> >> >> >> >> >> Anyway, after you create your walls at each boundary edge, you end up with walls that go all around your surface, but with no horizontal surface at the bottom. Maybe this is important to you, maybe not. >> >> >> >> If it?s important, you can create a duplicate copy of your top surface, but in the copy, set all your point?s Z to 0.0. >> >> >> >> This will flatten out the copy of your top surface and place it at Z=0, connecting to the bottom of your wall that you created all around your surface >> >> >> >> You will end up with a volume with the sides and bottom capped off. >> >> >> >> >> >> Patrick. >> >> >> >> >> >> >> >> From: Jacky Nguyen >> Date: Monday, July 16, 2018 at 5:12 AM >> To: Patrick Bergeron >> Cc: "vtkusers at public.kitware.com" >> Subject: Re: [vtkusers] Close the gap between a mesh and a planar >> >> >> >> Thanks for your input. >> >> Sorry, I am new to these so I need to take it slowly. >> >> >> >> Let me clarify a few things: >> >> 1) by using your approach, i don't need to create the plane on the bottom of the object as a holder? >> >> 2) When you say "For each boundary edge, create 2 triangles (a quad) with 1 or 2 points at z=0", does it matter which x and y coordinate to pick? >> >> >> >> I have added the following codes to extract the edges and find the pointID and point coordinate for each edge in the STL object. I trace through my console log, and there is no point that has z = 0 >> >> >> >> reader = vtk.vtkSTLReader() >> reader.SetFileName('path_to_stl') >> reader.Update() >> >> triangleFilter = vtk.vtkTriangleFilter() >> triangleFilter.SetInputConnection(reader.GetOutputPort()) >> triangleFilter.Update() >> >> # ++++++++++++++++++ extract edges ++++++++++++++++++++++++++++++++++++ >> >> featureEdges = vtk.vtkFeatureEdges() >> featureEdges.SetInputData(triangleFilter.GetOutput()) >> featureEdges.SetBoundaryEdges(1) >> featureEdges.SetFeatureEdges(0) >> featureEdges.SetNonManifoldEdges(0) >> featureEdges.SetManifoldEdges(0) >> featureEdges.Update() >> boundaryMesh = featureEdges.GetOutput() >> numberOfOpenEdges = featureEdges.GetOutput().GetNumberOfLines() >> print('number of lines: ', featureEdges.GetOutput().GetNumberOfLines()) >> for i in range(0, boundaryMesh.GetNumberOfLines()): >> cell = boundaryMesh.GetCell(i) >> cellPoints = cell.GetPoints() >> pointIds = cell.GetPointIds() >> for j in range(0, pointIds.GetNumberOfIds()): >> print('>>> point id: ', pointIds.GetId(j)) >> print('>>> coordinate: ', boundaryMesh.GetPoint(pointIds.GetId(j))) >> >> >> >> Thank you, >> >> >> >> >> >> On Fri, Jul 13, 2018 at 10:10 PM Patrick Bergeron wrote: >> >> I would take a different approach. >> >> >> >> I would look at all the edges that have only 1 cell attached, and these are your boundary edges. >> >> >> >> For each boundary edge, create 2 triangles (a quad) with 1 or 2 points at z=0. (Create 2 new points at z=0 for this purpose). If you already have a point at that z=0, then reuse it don?t create it. >> >> >> >> That approach will create quads all around your geometry connecting to the bottom but will leave the bottom hole open. >> >> >> >> Next create a cell connecting all your z=0 points together. Make sure they are ordered in sequential order to create your contour loop. >> >> >> >> Done >> >> >> >> >> >> Sent from my iPhone >> >> >> On Jul 13, 2018, at 05:10, Jacky Nguyen wrote: >> >> I have converted an .obj mesh file to .stl. I also created a planar geometry as a holder for the mesh object then merge them. However, it contains a gap. Any suggestion how to close the gap vertically so that it becomes a solid object, I have already tried vtkFillHolesFilter, but it won't fill the gap? >> >> >> >> The code to create the planar: >> >> >> >> implicitPolyDataDistance = vtk.vtkImplicitPolyDataDistance() >> >> implicitPolyDataDistance.SetInput(stl_poly_data) >> >> >> >> #create a grid >> >> xCoords = vtk.vtkFloatArray() >> >> for x, i in enumerate(np.linspace(xmin, xmax,50)): >> >> xCoords.InsertNextValue(i) >> >> >> >> yCoords = vtk.vtkFloatArray() >> >> for y, i in enumerate(np.linspace(ymin, ymax, 50)): >> >> yCoords.InsertNextValue(i) >> >> >> >> zCoords = vtk.vtkFloatArray() >> >> for z, i in enumerate(np.linspace(zmin, zmin + 1, 50)): >> >> zCoords.InsertNextValue(i) >> >> >> >> rgrid = vtk.vtkRectilinearGrid() >> >> rgrid.SetDimensions(x + 1, y + 1 , z + 1) >> >> rgrid.SetXCoordinates(xCoords) >> >> rgrid.SetYCoordinates(yCoords) >> >> rgrid.SetZCoordinates(zCoords) >> >> signedDistances = vtk.vtkFloatArray() >> >> signedDistances.SetNumberOfComponents(1) >> >> signedDistances.SetName("SignedDistances") >> >> >> >> # Evaluate the signed distance function at all of the grid points >> >> for pointId in range(rgrid.GetNumberOfPoints()): >> >> p = rgrid.GetPoint(pointId) >> >> signedDistance = implicitPolyDataDistance.EvaluateFunction(p) >> >> signedDistances.InsertNextValue(signedDistance) >> >> >> >> # add the SignedDistances to the grid >> >> rgrid.GetPointData().SetScalars(signedDistances) >> >> >> >> # geometry filter to view the background grid >> >> geometryFilter = vtk.vtkRectilinearGridGeometryFilter() >> >> geometryFilter.SetInputData(rgrid) >> >> geometryFilter.SetExtent(0, x + 1, 0, y + 1, (z + 1) // 2, (z + 1) // 2) >> >> geometryFilter.Update() >> >> # ================ END creating a plane ======================= >> >> >> >> The code that merge the stl poly data and the plane: >> >> meshAppend = vtk.vtkAppendPolyData() >> >> meshAppend.AddInputData(stl_poly_data) >> >> meshAppend.AddInputData(geometryFilter.GetOutput()) >> >> meshAppend.Update() >> >> boundaryClean = vtk.vtkCleanPolyData() >> >> boundaryClean.SetInputData(meshAppend.GetOutput()) >> >> boundaryClean.Update() >> >> out = vtk.vtkPolyData() >> >> out.DeepCopy(boundaryClean.GetOutput()) >> >> >> >> triangleTrans = vtk.vtkTriangleFilter() >> >> triangleTrans.SetInputData(out) >> >> triangleTrans.Update() >> >> >> >> fill = vtk.vtkFillHolesFilter() >> >> fill.SetInputData(out) >> >> fill.SetHoleSize(1000000.0) >> >> fill.Update() >> >> >> >> >> >> A screenshot of what my current mesh is (note: the red line is where i want to close the gap vertically along the z axis: https://i.stack.imgur.com/F9w3c.png >> >> >> >> Any suggestion to solve this problem? >> >> >> >> Thank you >> >> >> >> _______________________________________________ >> 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 From csaba.pinter at queensu.ca Wed Jul 18 09:01:52 2018 From: csaba.pinter at queensu.ca (Csaba Pinter) Date: Wed, 18 Jul 2018 13:01:52 +0000 Subject: [vtkusers] machining simulation and collision detection In-Reply-To: <1531917177883-0.post@n5.nabble.com> References: <1530181664677-0.post@n5.nabble.com> <1531292548828-0.post@n5.nabble.com> <1531382798046-0.post@n5.nabble.com> <1531726120902-0.post@n5.nabble.com> <1531917177883-0.post@n5.nabble.com> Message-ID: If you check out the project where the filter currently is, then you'll see a file https://github.com/SlicerRt/SlicerRT/blob/master/SlicerRtCommon/vtkSlicerRtCommonWin32Header.h#L14 with the export directive defined in it. That is what is used by the filter in its header https://github.com/SlicerRt/SlicerRT/blob/master/SlicerRtCommon/vtkCollisionDetectionFilter.h#L58 As I'm not sure how your project looks, I cannot help you with this, but if you use CMake, then you can follow the same pattern in your project. csaba -----Original Message----- From: vtkusers On Behalf Of shayan moradkhani Sent: Wednesday, July 18, 2018 08:33 To: vtkusers at vtk.org Subject: Re: [vtkusers] machining simulation and collision detection hi, has any one used this collision detection file so he/she is kind enough to give me some hints using them? i was just told this: "You need to replace vtkSlicerRtCommonWin32Header.h and VTK_SLICERRTCOMMON_EXPORT with your export header and macro. " shayan -- Sent from: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1045678.n5.nabble.com%2FVTK-Users-f1224199.html&data=02%7C01%7Ccsaba.pinter%40queensu.ca%7C749dc2e556e54dce375108d5ecaa9ad3%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636675139858784375&sdata=ZJATRplexy1wqyO%2FTCLX9U%2FTZ2cpdtyOMzdWY5cea%2FM%3D&reserved=0 _______________________________________________ Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Ccsaba.pinter%40queensu.ca%7C749dc2e556e54dce375108d5ecaa9ad3%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636675139858784375&sdata=JPCBODgyuHfoYN8no2DKNb1Mn4EAl1LG3XhjmUKvF4Q%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%7Ccsaba.pinter%40queensu.ca%7C749dc2e556e54dce375108d5ecaa9ad3%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636675139858784375&sdata=rFsO2D3AKrFFJXl1qumqvVrWDGPxczk%2FLTJferjCcvc%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%7Ccsaba.pinter%40queensu.ca%7C749dc2e556e54dce375108d5ecaa9ad3%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636675139858784375&sdata=71Ufd5jyW%2FHrkuu42804Wexk1lGYLhNHrKb4HjDLxRQ%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%7Ccsaba.pinter%40queensu.ca%7C749dc2e556e54dce375108d5ecaa9ad3%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636675139858784375&sdata=OpLcOH7kJCliCuaaVtxL65%2B%2F660L80WUPX3Tjo9blO0%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%7Ccsaba.pinter%40queensu.ca%7C749dc2e556e54dce375108d5ecaa9ad3%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636675139858784375&sdata=PcbWPPKrCrXJBZsQius9OFSw1rs7w7HfVNnMsqafoU4%3D&reserved=0 From marvin.huber at basf.com Wed Jul 18 09:19:23 2018 From: marvin.huber at basf.com (marf) Date: Wed, 18 Jul 2018 06:19:23 -0700 (MST) Subject: [vtkusers] Create PolyData in vtk.js In-Reply-To: <1531909273485-0.post@n5.nabble.com> References: <1531823184017-0.post@n5.nabble.com> <1531834753471-0.post@n5.nabble.com> <1531909273485-0.post@n5.nabble.com> Message-ID: <1531919963954-0.post@n5.nabble.com> Ok nevermind, a lot of this became clear now and even though I can't really articulate anything about it yet, I understand all this stuff a lot better I guess and will be able to move forward -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From shawn.waldon at kitware.com Wed Jul 18 09:34:45 2018 From: shawn.waldon at kitware.com (Shawn Waldon) Date: Wed, 18 Jul 2018 09:34:45 -0400 Subject: [vtkusers] How to run VTK with display driver supporting OpenGL version < 3.0 In-Reply-To: <1531903862658-0.post@n5.nabble.com> References: <1531903862658-0.post@n5.nabble.com> Message-ID: Hi Jay, It is a bit confusing I agree. OpenGL2 should really be named OpenGLNew or something like that, the 2 just means it is the second OpenGL-based backend. The minimum version supported with the "OpenGL2" backend is OpenGL 3.2. So for your hardware, you are limited to the "OpenGL" backend. Unless you compile with Mesa as your GL driver and use software rendering to get the newer OpenGL standard for the "OpenGL2" backend. It will probably be slower, but will let you use features of the newer backend (or newer VTK versions) if you need them. HTH, Shawn On Wed, Jul 18, 2018 at 4:51 AM, Jay wrote: > I am trying to run VTK on a hardware platform which doesn't support OpenGL > version 3.0 or higher (display driver). > I tried to test the VTK 8.1.1 build with VTK_RENDERING_BACKEND = OpenGL2 > but > the application crashes with OpenGL error which I suspect to be related to > OpenGL. So I went back and tried to build the VTK 8.1.1 with > VTK_RENDERINZG_BACKEND = OpenGL but failed to make & build as it says that > the VTK 8.1.1 doesn't support OPENGL anymore. > > So I moved back to VTK 7.1.1 and was able to build with both options > OpenGL2 > and OpenGL of VTK_RENDERING_BACKEND. > > I was confused to about what VTK_RENDERING_BACKEND means i.e. difference > between OpenGL2 and OpenGL options. Is it the versions ? If so how do I > know > which versions are supported by OpenGL2 and OpenGL > > How can I know which versions of VTK would be able to run on the hardware > platform with display drivers having support for OpenGL version less than > 3.0 (OpenGL > Please kindly suggest > > > > -- > 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 goodwin.lawlor.lists at gmail.com Wed Jul 18 09:50:52 2018 From: goodwin.lawlor.lists at gmail.com (Goodwin Lawlor) Date: Wed, 18 Jul 2018 14:50:52 +0100 Subject: [vtkusers] machining simulation and collision detection In-Reply-To: <1531917177883-0.post@n5.nabble.com> References: <1530181664677-0.post@n5.nabble.com> <1531292548828-0.post@n5.nabble.com> <1531382798046-0.post@n5.nabble.com> <1531726120902-0.post@n5.nabble.com> <1531917177883-0.post@n5.nabble.com> Message-ID: Hi Shayan, Have a look here on how to build your own local project: https://gitlab.kitware.com/vtk/vtk/tree/master/Examples/Build/vtkLocal or if you've built VTK just add the files to the filters/modelling module, update the cmake file, and copy the export header and module info from another class . Rerun cmake! Build. For example: https://gitlab.kitware.com/vtk/vtk/merge_requests/4369/diffs hth goodwin On Wed, Jul 18, 2018 at 1:33 PM shayan moradkhani < shayan.moradkhani at gmail.com> wrote: > hi, > has any one used this collision detection file so he/she is kind enough to > give me some hints using them? > i was just told this: "You need to replace vtkSlicerRtCommonWin32Header.h > and VTK_SLICERRTCOMMON_EXPORT with your export header and macro. " > shayan > > > > -- > 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 bill.lorensen at gmail.com Wed Jul 18 09:53:12 2018 From: bill.lorensen at gmail.com (Bill Lorensen) Date: Wed, 18 Jul 2018 06:53:12 -0700 Subject: [vtkusers] Correctly apply camera matrix In-Reply-To: References: Message-ID: Yes, please! On Wed, Jul 18, 2018, 12:29 AM Andrew Maclean wrote: > Bill, if you like, I can do a Python version of these two examples. > > Regards > Andrew > > ---------- Forwarded message ---------- >> From: Bill Lorensen >> To: andyjk >> Cc: VTK Users >> Bcc: >> Date: Mon, 16 Jul 2018 10:30:10 -0700 >> Subject: Re: [vtkusers] Correctly apply camera matrix >> These two examples save the camera to a file or store it in field data: >> >> >> https://lorensen.github.io/VTKExamples/site/Cxx/Utilities/SaveSceneToFieldData/ >> https://lorensen.github.io/VTKExamples/site/Cxx/Utilities/SaveSceneToFile/ >> >> >> On Mon, Jul 16, 2018 at 9:46 AM, andyjk >> wrote: >> > Thanks Ken >> > >> > Looks like this is the sensible way to do it, so I have abandoned the >> > transformation matrix idea. >> > >> > >> > >> > -- >> > 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 >> >> >> >> -- >> Unpaid intern in BillsParadise at noware dot com >> >> >> >> -- >> > ___________________________________________ > Andrew J. P. Maclean > > ___________________________________________ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sebastien.jourdain at kitware.com Wed Jul 18 10:26:26 2018 From: sebastien.jourdain at kitware.com (Sebastien Jourdain) Date: Wed, 18 Jul 2018 08:26:26 -0600 Subject: [vtkusers] Create PolyData in vtk.js In-Reply-To: <1531919963954-0.post@n5.nabble.com> References: <1531823184017-0.post@n5.nabble.com> <1531834753471-0.post@n5.nabble.com> <1531909273485-0.post@n5.nabble.com> <1531919963954-0.post@n5.nabble.com> Message-ID: Your scalars should remain what ever they truly are (Float32/64, Int8/16/32, Uint8/16/32)... Then you need to tell the mapper which array to color by. You can look at that example which allow you to dynamically pick the array to color by https://kitware.github.io/vtk-js/examples/GeometryViewer.html https://github.com/Kitware/vtk-js/blob/master/Examples/Applications/GeometryViewer/index.js#L280-L328 [image: example.jpg] In fact if you want to contribute your reader to vtk.js you could directly use ParaViewGlance https://kitware.github.io/paraview-glance/ HTH, Seb On Wed, Jul 18, 2018 at 7:19 AM marf wrote: > Ok nevermind, a lot of this became clear now and even though I can't really > articulate anything about it yet, I understand all this stuff a lot better > I > guess and will be able to move forward > > > > -- > 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: -------------- next part -------------- A non-text attachment was scrubbed... Name: example.jpg Type: image/jpeg Size: 405546 bytes Desc: not available URL: From fking1 at bwh.harvard.edu Wed Jul 18 13:31:32 2018 From: fking1 at bwh.harvard.edu (King, Franklin) Date: Wed, 18 Jul 2018 17:31:32 +0000 Subject: [vtkusers] vtkHardwareSelector blacking out window with QVTKOpenGLWidget Message-ID: Hi, I've been attempting to run what is essentially this example of extracting visible cells using vtkHardwareSelector (https://www.vtk.org/Wiki/VTK/Examples/Cxx/Filtering/ExtractVisibleCells) but with the render window displayed within a QVTKOpenGLWidge instead. Doing so, however, results in the entire window failing to render and appearing black upon this line: vtkSelection* selection = selector->Select(); I've tried disabling multisampling with both QSurfaceFormat and vtkRenderWindow to no avail. The window does, however, briefly render correctly (and the selection appearing successful) upon resizing events. Curiously, with a debug build it also renders correctly upon calling Select() again. I am using VTK 9 with Qt 5.10.1, and I've confirmed that there is no issue when implementing with just a vtkRenderWindow or using QVTKWidget in VTK 7. Any idea as to what is going wrong? Thanks, Franklin The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail. -------------- next part -------------- An HTML attachment was scrubbed... URL: From castellanoslizan at gmail.com Wed Jul 18 14:42:20 2018 From: castellanoslizan at gmail.com (Lizeth Castellanos) Date: Wed, 18 Jul 2018 15:42:20 -0300 Subject: [vtkusers] Copy image data into vtkImageData from a textfile Message-ID: Hi! I'd like to copy image data from a textfile (csv) into vtkImageData. The textfile have voxel values for x,y,z and image intensity. I already have read the textfile into VTK with the vtkDelimitedTextReader class: Table loaded from CSV file: +-----------+-----------+-----------+------------+ | Field 0 | Field 1 | Field 2 | Field 3 | +-----------+-----------+-----------+------------+ | 510 | 291 | 0 | 32 | | 511 | 291 | 0 | 128 | | 510 | 292 | 0 | 104 | | 511 | 292 | 0 | 104 | | 510 | 293 | 0 | 40 | | 511 | 293 | 0 | 240 | | 510 | 294 | 0 | 104 | | 511 | 294 | 0 | 96 | | 506 | 295 | 0 | 64 | | 507 | 295 | 0 | 16 | ..... ..... The file is an exported segmented dataset. I am following the tips from this similar question http://vtk.1045678.n5.nabble.com/importing-image-data-into-VTK-from-textfile-mimics-td1243332.html I have created an appropriate vtkimagedata (volume): imageData = vtk.vtkImageData() imageData.SetDimensions(512, 512, 192) imageData.SetOrigin(0.0, 0.0, 0.0) imageData.SetSpacing(1, 1, 1) imageData.SetNumberOfScalarComponents(1) imageData.Update() However I don't know how to copy the data loaded from vtkDelimitedTextReader into vtkImageData. How do I copy the x,y,z voxel values into vtkImageData? How do I copy the intensity valuesVtkImageData? Any help provided for this would be greatly appreciated! Lizeth -------------- next part -------------- An HTML attachment was scrubbed... URL: From ken.martin at kitware.com Wed Jul 18 14:48:44 2018 From: ken.martin at kitware.com (Ken Martin) Date: Wed, 18 Jul 2018 14:48:44 -0400 Subject: [vtkusers] vtkHardwareSelector blacking out window with QVTKOpenGLWidget In-Reply-To: References: Message-ID: How recent is the VTK you tried with, there were significant changes made to this code in the past week? Can you zip up a small example I could build and try? On Wed, Jul 18, 2018 at 1:31 PM, King, Franklin wrote: > Hi, > > > I've been attempting to run what is essentially this example of extracting > visible cells using vtkHardwareSelector (https://www.vtk.org/Wiki/VTK/ > Examples/Cxx/Filtering/ExtractVisibleCells) but with the render window > displayed within a QVTKOpenGLWidge instead. > > > Doing so, however, results in the entire window failing to render and > appearing black upon this line: > > vtkSelection* selection = selector->Select(); > > I've tried disabling multisampling with both QSurfaceFormat and > vtkRenderWindow to no avail. > > > The window does, however, briefly render correctly (and the selection > appearing successful) upon resizing events. Curiously, with a debug build > it also renders correctly upon calling Select() again. > > > I am using VTK 9 with Qt 5.10.1, and I've confirmed that there is no issue > when implementing with just a vtkRenderWindow or using QVTKWidget in VTK 7. > Any idea as to what is going wrong? > > > Thanks, > > > Franklin > > The information in this e-mail is intended only for the person to whom it > is > addressed. If you believe this e-mail was sent to you in error and the > e-mail > contains patient information, please contact the Partners Compliance > HelpLine at > http://www.partners.org/complianceline . If the e-mail was sent to you in > error > but does not contain patient information, please contact the sender and > properly > dispose of the e-mail. > > _______________________________________________ > 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 fking1 at bwh.harvard.edu Wed Jul 18 15:30:33 2018 From: fking1 at bwh.harvard.edu (King, Franklin) Date: Wed, 18 Jul 2018 19:30:33 +0000 Subject: [vtkusers] vtkHardwareSelector blacking out window with QVTKOpenGLWidget In-Reply-To: References: , Message-ID: I've attached the small example. It's identical to the working ExtractVisibleCells example except for the small addition of the QVTKOpenGLWidget and using its render window rather than having one standalone. I'm actually using this version of VTK 9 (https://github.com/Slicer/VTK/tree/slicer-v9.0.0-2018-04-17-10e8cdc) which seems to date back to April 2018. Thanks, Franklin ________________________________ From: Ken Martin Sent: Wednesday, July 18, 2018 2:48:44 PM To: King, Franklin Cc: vtkusers at public.kitware.com Subject: Re: [vtkusers] vtkHardwareSelector blacking out window with QVTKOpenGLWidget External Email - Use Caution How recent is the VTK you tried with, there were significant changes made to this code in the past week? Can you zip up a small example I could build and try? On Wed, Jul 18, 2018 at 1:31 PM, King, Franklin > wrote: Hi, I've been attempting to run what is essentially this example of extracting visible cells using vtkHardwareSelector (https://www.vtk.org/Wiki/VTK/Examples/Cxx/Filtering/ExtractVisibleCells) but with the render window displayed within a QVTKOpenGLWidge instead. Doing so, however, results in the entire window failing to render and appearing black upon this line: vtkSelection* selection = selector->Select(); I've tried disabling multisampling with both QSurfaceFormat and vtkRenderWindow to no avail. The window does, however, briefly render correctly (and the selection appearing successful) upon resizing events. Curiously, with a debug build it also renders correctly upon calling Select() again. I am using VTK 9 with Qt 5.10.1, and I've confirmed that there is no issue when implementing with just a vtkRenderWindow or using QVTKWidget in VTK 7. Any idea as to what is going wrong? Thanks, Franklin The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail. _______________________________________________ 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: -------------- next part -------------- A non-text attachment was scrubbed... Name: ExtractVisibleCells.zip Type: application/x-zip-compressed Size: 2152 bytes Desc: ExtractVisibleCells.zip URL: From mark.ostroot at lickenbrocktech.com Wed Jul 18 17:27:36 2018 From: mark.ostroot at lickenbrocktech.com (mark.ostroot at lickenbrocktech.com) Date: Wed, 18 Jul 2018 14:27:36 -0700 Subject: [vtkusers] Multi-Volume tool Message-ID: <20180718142736.c7db654a879d86b78cfcacc46040d57b.c7dd080bf5.mailapi@email09.godaddy.com> Hello, I have been using the multi-Volume tool in VTK and i have been trying to compensate for the rendering speeds with the multi-volumes, so that rotation and zoom of a volume can still be done in real time. I've tried to use the desired update rate of the Qvtkrendering window that the multi-volume is attached to. Does anyone have any ideas on how I could Improve performance with this tool? Thanks, Mark O -------------- next part -------------- An HTML attachment was scrubbed... URL: From jackynguyen.km at gmail.com Wed Jul 18 21:13:43 2018 From: jackynguyen.km at gmail.com (Jacky Nguyen) Date: Thu, 19 Jul 2018 09:13:43 +0800 Subject: [vtkusers] Close the gap between a mesh and a planar In-Reply-To: References: <679DA8D3-16D1-4213-9085-F0DBCB53B86D@spiria.com> Message-ID: Hi Kenichiro, Your method works! I am new to 3D stuff so i was not aware of this vtkLinearExtrusionFilter. But I did hear of this term when I worked with the 3D modelling guy when he said he manually did extrude the original shape. Thank you for your help! Jacky On Wed, Jul 18, 2018 at 8:34 PM kenichiro yoshimi wrote: > Hi, > > Excuse me for cutting in. I am inspired by Patrick method. > First create a skirt from boundary edges of polygonal data by > vtkLinearExtrusionFilter > and then place the extruded points at x-y plane. > > --- > #!/usr/bin/env python > # -*- coding: utf-8 -*- > > import vtk > > > def main(): > colors = vtk.vtkNamedColors() > > reader = vtk.vtkSTLReader() > reader.SetFileName('improve.stl') > reader.Update() > > # Apply linear extrusion > extrude = vtk.vtkLinearExtrusionFilter() > extrude.SetInputConnection(reader.GetOutputPort()) > extrude.SetExtrusionTypeToNormalExtrusion(); > extrude.SetVector(0, 0, -10) > extrude.CappingOn() > extrude.Update() > > # project extruded points onto x-y plane > z = 1130 > closedSurface = extrude.GetOutput() > points = closedSurface.GetPoints() > numPts = closedSurface.GetNumberOfPoints() > for ptId in range(numPts/2, numPts): > point = points.GetPoint(ptId) > points.SetPoint(ptId, point[0], point[1], z) > > # Create a mapper and actor. > mapper = vtk.vtkPolyDataMapper() > mapper.SetInputData(closedSurface) > > actor = vtk.vtkActor() > actor.GetProperty().SetColor(colors.GetColor3d("Cornsilk")) > actor.SetMapper(mapper) > > # Create a renderer, render window, and interactor > renderer = vtk.vtkRenderer() > renderWindow = vtk.vtkRenderWindow() > renderWindow.SetWindowName("TaperedCylinder") > renderWindow.AddRenderer(renderer) > renderWindowInteractor = vtk.vtkRenderWindowInteractor() > renderWindowInteractor.SetRenderWindow(renderWindow) > > # Add the actors to the scene > renderer.AddActor(actor) > renderer.SetBackground(colors.GetColor3d("DarkGreen")) > > # Render and interact > renderWindow.Render() > renderWindowInteractor.Start() > > > if __name__ == '__main__': > main() > --- > > For your reference. > 2018?7?18?(?) 15:44 Jacky Nguyen : > > > > Hi Patrick, > > > > Thanks for the clarification. I have tried your approach, but however > the wall was not covered up the entire boundary. The wall was stopped kinda > half way. > > Do you mind taking a look at my code to see what went wrong? I have > created a gist here: > https://gist.github.com/ngunhaSO/f3902fd34172a161b678b2a05a5c91fe > > I have also attached a stl file that i wanna manipulate and the > screenshot of what i achieved here: https://github.com/ngunhaSO/misc > > > > Thank you! > > > > Jacky > > > > On Mon, Jul 16, 2018 at 7:48 PM Patrick Bergeron > wrote: > >> > >> Hi Jacky > >> > >> > >> > >> Let me try to be clearer. Let?s say you have a surface floating in > space, which seems to be your case. > >> > >> > >> > >> You can create a wall around your surface, by creating new geometry > around your surface, which we will say is your wall. On the wall, you need > to connect boundary edges with the floor (at z=0). > >> > >> > >> > >> So set?s say you find a boundary edge with points a and b > >> > >> > >> > >> Add 2 points to your polydata. (xa, ya, 0), (xb, yb, 0) > >> > >> > >> > >> Then you create a quad that goes like this: > >> > >> > >> > >> (xa,ya,za), > >> > >> (xb,yb,zb) > >> > >> (xb,yb,0) > >> > >> (xa,ya,0) > >> > >> > >> > >> Or if you prefer you can create 2 triangles: > >> > >> (xa,ya,za), > >> > >> (xb,yb,zb) > >> > >> (xb,yb,0) > >> > >> > >> > >> (xb,yb,0) > >> > >> (xa,ya,0) > >> > >> (xa,ya,za), > >> > >> > >> > >> > >> > >> Anyway, after you create your walls at each boundary edge, you end up > with walls that go all around your surface, but with no horizontal surface > at the bottom. Maybe this is important to you, maybe not. > >> > >> > >> > >> If it?s important, you can create a duplicate copy of your top surface, > but in the copy, set all your point?s Z to 0.0. > >> > >> > >> > >> This will flatten out the copy of your top surface and place it at Z=0, > connecting to the bottom of your wall that you created all around your > surface > >> > >> > >> > >> You will end up with a volume with the sides and bottom capped off. > >> > >> > >> > >> > >> > >> Patrick. > >> > >> > >> > >> > >> > >> > >> > >> From: Jacky Nguyen > >> Date: Monday, July 16, 2018 at 5:12 AM > >> To: Patrick Bergeron > >> Cc: "vtkusers at public.kitware.com" > >> Subject: Re: [vtkusers] Close the gap between a mesh and a planar > >> > >> > >> > >> Thanks for your input. > >> > >> Sorry, I am new to these so I need to take it slowly. > >> > >> > >> > >> Let me clarify a few things: > >> > >> 1) by using your approach, i don't need to create the plane on the > bottom of the object as a holder? > >> > >> 2) When you say "For each boundary edge, create 2 triangles (a quad) > with 1 or 2 points at z=0", does it matter which x and y coordinate to pick? > >> > >> > >> > >> I have added the following codes to extract the edges and find the > pointID and point coordinate for each edge in the STL object. I trace > through my console log, and there is no point that has z = 0 > >> > >> > >> > >> reader = vtk.vtkSTLReader() > >> reader.SetFileName('path_to_stl') > >> reader.Update() > >> > >> triangleFilter = vtk.vtkTriangleFilter() > >> triangleFilter.SetInputConnection(reader.GetOutputPort()) > >> triangleFilter.Update() > >> > >> # ++++++++++++++++++ extract edges ++++++++++++++++++++++++++++++++++++ > >> > >> featureEdges = vtk.vtkFeatureEdges() > >> featureEdges.SetInputData(triangleFilter.GetOutput()) > >> featureEdges.SetBoundaryEdges(1) > >> featureEdges.SetFeatureEdges(0) > >> featureEdges.SetNonManifoldEdges(0) > >> featureEdges.SetManifoldEdges(0) > >> featureEdges.Update() > >> boundaryMesh = featureEdges.GetOutput() > >> numberOfOpenEdges = featureEdges.GetOutput().GetNumberOfLines() > >> print('number of lines: ', featureEdges.GetOutput().GetNumberOfLines()) > >> for i in range(0, boundaryMesh.GetNumberOfLines()): > >> cell = boundaryMesh.GetCell(i) > >> cellPoints = cell.GetPoints() > >> pointIds = cell.GetPointIds() > >> for j in range(0, pointIds.GetNumberOfIds()): > >> print('>>> point id: ', pointIds.GetId(j)) > >> print('>>> coordinate: ', > boundaryMesh.GetPoint(pointIds.GetId(j))) > >> > >> > >> > >> Thank you, > >> > >> > >> > >> > >> > >> On Fri, Jul 13, 2018 at 10:10 PM Patrick Bergeron > wrote: > >> > >> I would take a different approach. > >> > >> > >> > >> I would look at all the edges that have only 1 cell attached, and these > are your boundary edges. > >> > >> > >> > >> For each boundary edge, create 2 triangles (a quad) with 1 or 2 points > at z=0. (Create 2 new points at z=0 for this purpose). If you already have > a point at that z=0, then reuse it don?t create it. > >> > >> > >> > >> That approach will create quads all around your geometry connecting to > the bottom but will leave the bottom hole open. > >> > >> > >> > >> Next create a cell connecting all your z=0 points together. Make sure > they are ordered in sequential order to create your contour loop. > >> > >> > >> > >> Done > >> > >> > >> > >> > >> > >> Sent from my iPhone > >> > >> > >> On Jul 13, 2018, at 05:10, Jacky Nguyen > wrote: > >> > >> I have converted an .obj mesh file to .stl. I also created a planar > geometry as a holder for the mesh object then merge them. However, it > contains a gap. Any suggestion how to close the gap vertically so that it > becomes a solid object, I have already tried vtkFillHolesFilter, but it > won't fill the gap? > >> > >> > >> > >> The code to create the planar: > >> > >> > >> > >> implicitPolyDataDistance = vtk.vtkImplicitPolyDataDistance() > >> > >> implicitPolyDataDistance.SetInput(stl_poly_data) > >> > >> > >> > >> #create a grid > >> > >> xCoords = vtk.vtkFloatArray() > >> > >> for x, i in enumerate(np.linspace(xmin, xmax,50)): > >> > >> xCoords.InsertNextValue(i) > >> > >> > >> > >> yCoords = vtk.vtkFloatArray() > >> > >> for y, i in enumerate(np.linspace(ymin, ymax, 50)): > >> > >> yCoords.InsertNextValue(i) > >> > >> > >> > >> zCoords = vtk.vtkFloatArray() > >> > >> for z, i in enumerate(np.linspace(zmin, zmin + 1, 50)): > >> > >> zCoords.InsertNextValue(i) > >> > >> > >> > >> rgrid = vtk.vtkRectilinearGrid() > >> > >> rgrid.SetDimensions(x + 1, y + 1 , z + 1) > >> > >> rgrid.SetXCoordinates(xCoords) > >> > >> rgrid.SetYCoordinates(yCoords) > >> > >> rgrid.SetZCoordinates(zCoords) > >> > >> signedDistances = vtk.vtkFloatArray() > >> > >> signedDistances.SetNumberOfComponents(1) > >> > >> signedDistances.SetName("SignedDistances") > >> > >> > >> > >> # Evaluate the signed distance function at all of the grid points > >> > >> for pointId in range(rgrid.GetNumberOfPoints()): > >> > >> p = rgrid.GetPoint(pointId) > >> > >> signedDistance = implicitPolyDataDistance.EvaluateFunction(p) > >> > >> signedDistances.InsertNextValue(signedDistance) > >> > >> > >> > >> # add the SignedDistances to the grid > >> > >> rgrid.GetPointData().SetScalars(signedDistances) > >> > >> > >> > >> # geometry filter to view the background grid > >> > >> geometryFilter = vtk.vtkRectilinearGridGeometryFilter() > >> > >> geometryFilter.SetInputData(rgrid) > >> > >> geometryFilter.SetExtent(0, x + 1, 0, y + 1, (z + 1) // 2, (z + 1) // 2) > >> > >> geometryFilter.Update() > >> > >> # ================ END creating a plane ======================= > >> > >> > >> > >> The code that merge the stl poly data and the plane: > >> > >> meshAppend = vtk.vtkAppendPolyData() > >> > >> meshAppend.AddInputData(stl_poly_data) > >> > >> meshAppend.AddInputData(geometryFilter.GetOutput()) > >> > >> meshAppend.Update() > >> > >> boundaryClean = vtk.vtkCleanPolyData() > >> > >> boundaryClean.SetInputData(meshAppend.GetOutput()) > >> > >> boundaryClean.Update() > >> > >> out = vtk.vtkPolyData() > >> > >> out.DeepCopy(boundaryClean.GetOutput()) > >> > >> > >> > >> triangleTrans = vtk.vtkTriangleFilter() > >> > >> triangleTrans.SetInputData(out) > >> > >> triangleTrans.Update() > >> > >> > >> > >> fill = vtk.vtkFillHolesFilter() > >> > >> fill.SetInputData(out) > >> > >> fill.SetHoleSize(1000000.0) > >> > >> fill.Update() > >> > >> > >> > >> > >> > >> A screenshot of what my current mesh is (note: the red line is where i > want to close the gap vertically along the z axis: > https://i.stack.imgur.com/F9w3c.png > >> > >> > >> > >> Any suggestion to solve this problem? > >> > >> > >> > >> Thank you > >> > >> > >> > >> _______________________________________________ > >> 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 jackynguyen.km at gmail.com Wed Jul 18 23:23:36 2018 From: jackynguyen.km at gmail.com (Jacky Nguyen) Date: Thu, 19 Jul 2018 11:23:36 +0800 Subject: [vtkusers] Close the gap between a mesh and a planar In-Reply-To: References: <679DA8D3-16D1-4213-9085-F0DBCB53B86D@spiria.com> Message-ID: Also, can you please explain why populating the points must be from half the number of points onward but not from 0 ? I am referring to this line: for ptId in range(round(numPts/2), numPts): Thank you, Jacky On Thu, Jul 19, 2018 at 9:13 AM Jacky Nguyen wrote: > Hi Kenichiro, > > Your method works! I am new to 3D stuff so i was not aware of this vtkLinearExtrusionFilter. > But I did hear of this term when I worked with the 3D modelling guy when he > said he manually did extrude the original shape. > > Thank you for your help! > > Jacky > > On Wed, Jul 18, 2018 at 8:34 PM kenichiro yoshimi > wrote: > >> Hi, >> >> Excuse me for cutting in. I am inspired by Patrick method. >> First create a skirt from boundary edges of polygonal data by >> vtkLinearExtrusionFilter >> and then place the extruded points at x-y plane. >> >> --- >> #!/usr/bin/env python >> # -*- coding: utf-8 -*- >> >> import vtk >> >> >> def main(): >> colors = vtk.vtkNamedColors() >> >> reader = vtk.vtkSTLReader() >> reader.SetFileName('improve.stl') >> reader.Update() >> >> # Apply linear extrusion >> extrude = vtk.vtkLinearExtrusionFilter() >> extrude.SetInputConnection(reader.GetOutputPort()) >> extrude.SetExtrusionTypeToNormalExtrusion(); >> extrude.SetVector(0, 0, -10) >> extrude.CappingOn() >> extrude.Update() >> >> # project extruded points onto x-y plane >> z = 1130 >> closedSurface = extrude.GetOutput() >> points = closedSurface.GetPoints() >> numPts = closedSurface.GetNumberOfPoints() >> for ptId in range(numPts/2, numPts): >> point = points.GetPoint(ptId) >> points.SetPoint(ptId, point[0], point[1], z) >> >> # Create a mapper and actor. >> mapper = vtk.vtkPolyDataMapper() >> mapper.SetInputData(closedSurface) >> >> actor = vtk.vtkActor() >> actor.GetProperty().SetColor(colors.GetColor3d("Cornsilk")) >> actor.SetMapper(mapper) >> >> # Create a renderer, render window, and interactor >> renderer = vtk.vtkRenderer() >> renderWindow = vtk.vtkRenderWindow() >> renderWindow.SetWindowName("TaperedCylinder") >> renderWindow.AddRenderer(renderer) >> renderWindowInteractor = vtk.vtkRenderWindowInteractor() >> renderWindowInteractor.SetRenderWindow(renderWindow) >> >> # Add the actors to the scene >> renderer.AddActor(actor) >> renderer.SetBackground(colors.GetColor3d("DarkGreen")) >> >> # Render and interact >> renderWindow.Render() >> renderWindowInteractor.Start() >> >> >> if __name__ == '__main__': >> main() >> --- >> >> For your reference. >> 2018?7?18?(?) 15:44 Jacky Nguyen : >> > >> > Hi Patrick, >> > >> > Thanks for the clarification. I have tried your approach, but however >> the wall was not covered up the entire boundary. The wall was stopped kinda >> half way. >> > Do you mind taking a look at my code to see what went wrong? I have >> created a gist here: >> https://gist.github.com/ngunhaSO/f3902fd34172a161b678b2a05a5c91fe >> > I have also attached a stl file that i wanna manipulate and the >> screenshot of what i achieved here: https://github.com/ngunhaSO/misc >> > >> > Thank you! >> > >> > Jacky >> > >> > On Mon, Jul 16, 2018 at 7:48 PM Patrick Bergeron >> wrote: >> >> >> >> Hi Jacky >> >> >> >> >> >> >> >> Let me try to be clearer. Let?s say you have a surface floating in >> space, which seems to be your case. >> >> >> >> >> >> >> >> You can create a wall around your surface, by creating new geometry >> around your surface, which we will say is your wall. On the wall, you need >> to connect boundary edges with the floor (at z=0). >> >> >> >> >> >> >> >> So set?s say you find a boundary edge with points a and b >> >> >> >> >> >> >> >> Add 2 points to your polydata. (xa, ya, 0), (xb, yb, 0) >> >> >> >> >> >> >> >> Then you create a quad that goes like this: >> >> >> >> >> >> >> >> (xa,ya,za), >> >> >> >> (xb,yb,zb) >> >> >> >> (xb,yb,0) >> >> >> >> (xa,ya,0) >> >> >> >> >> >> >> >> Or if you prefer you can create 2 triangles: >> >> >> >> (xa,ya,za), >> >> >> >> (xb,yb,zb) >> >> >> >> (xb,yb,0) >> >> >> >> >> >> >> >> (xb,yb,0) >> >> >> >> (xa,ya,0) >> >> >> >> (xa,ya,za), >> >> >> >> >> >> >> >> >> >> >> >> Anyway, after you create your walls at each boundary edge, you end up >> with walls that go all around your surface, but with no horizontal surface >> at the bottom. Maybe this is important to you, maybe not. >> >> >> >> >> >> >> >> If it?s important, you can create a duplicate copy of your top >> surface, but in the copy, set all your point?s Z to 0.0. >> >> >> >> >> >> >> >> This will flatten out the copy of your top surface and place it at >> Z=0, connecting to the bottom of your wall that you created all around your >> surface >> >> >> >> >> >> >> >> You will end up with a volume with the sides and bottom capped off. >> >> >> >> >> >> >> >> >> >> >> >> Patrick. >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> From: Jacky Nguyen >> >> Date: Monday, July 16, 2018 at 5:12 AM >> >> To: Patrick Bergeron >> >> Cc: "vtkusers at public.kitware.com" >> >> Subject: Re: [vtkusers] Close the gap between a mesh and a planar >> >> >> >> >> >> >> >> Thanks for your input. >> >> >> >> Sorry, I am new to these so I need to take it slowly. >> >> >> >> >> >> >> >> Let me clarify a few things: >> >> >> >> 1) by using your approach, i don't need to create the plane on the >> bottom of the object as a holder? >> >> >> >> 2) When you say "For each boundary edge, create 2 triangles (a quad) >> with 1 or 2 points at z=0", does it matter which x and y coordinate to pick? >> >> >> >> >> >> >> >> I have added the following codes to extract the edges and find the >> pointID and point coordinate for each edge in the STL object. I trace >> through my console log, and there is no point that has z = 0 >> >> >> >> >> >> >> >> reader = vtk.vtkSTLReader() >> >> reader.SetFileName('path_to_stl') >> >> reader.Update() >> >> >> >> triangleFilter = vtk.vtkTriangleFilter() >> >> triangleFilter.SetInputConnection(reader.GetOutputPort()) >> >> triangleFilter.Update() >> >> >> >> # ++++++++++++++++++ extract edges ++++++++++++++++++++++++++++++++++++ >> >> >> >> featureEdges = vtk.vtkFeatureEdges() >> >> featureEdges.SetInputData(triangleFilter.GetOutput()) >> >> featureEdges.SetBoundaryEdges(1) >> >> featureEdges.SetFeatureEdges(0) >> >> featureEdges.SetNonManifoldEdges(0) >> >> featureEdges.SetManifoldEdges(0) >> >> featureEdges.Update() >> >> boundaryMesh = featureEdges.GetOutput() >> >> numberOfOpenEdges = featureEdges.GetOutput().GetNumberOfLines() >> >> print('number of lines: ', featureEdges.GetOutput().GetNumberOfLines()) >> >> for i in range(0, boundaryMesh.GetNumberOfLines()): >> >> cell = boundaryMesh.GetCell(i) >> >> cellPoints = cell.GetPoints() >> >> pointIds = cell.GetPointIds() >> >> for j in range(0, pointIds.GetNumberOfIds()): >> >> print('>>> point id: ', pointIds.GetId(j)) >> >> print('>>> coordinate: ', >> boundaryMesh.GetPoint(pointIds.GetId(j))) >> >> >> >> >> >> >> >> Thank you, >> >> >> >> >> >> >> >> >> >> >> >> On Fri, Jul 13, 2018 at 10:10 PM Patrick Bergeron < >> pbergeron at spiria.com> wrote: >> >> >> >> I would take a different approach. >> >> >> >> >> >> >> >> I would look at all the edges that have only 1 cell attached, and >> these are your boundary edges. >> >> >> >> >> >> >> >> For each boundary edge, create 2 triangles (a quad) with 1 or 2 points >> at z=0. (Create 2 new points at z=0 for this purpose). If you already have >> a point at that z=0, then reuse it don?t create it. >> >> >> >> >> >> >> >> That approach will create quads all around your geometry connecting to >> the bottom but will leave the bottom hole open. >> >> >> >> >> >> >> >> Next create a cell connecting all your z=0 points together. Make sure >> they are ordered in sequential order to create your contour loop. >> >> >> >> >> >> >> >> Done >> >> >> >> >> >> >> >> >> >> >> >> Sent from my iPhone >> >> >> >> >> >> On Jul 13, 2018, at 05:10, Jacky Nguyen >> wrote: >> >> >> >> I have converted an .obj mesh file to .stl. I also created a planar >> geometry as a holder for the mesh object then merge them. However, it >> contains a gap. Any suggestion how to close the gap vertically so that it >> becomes a solid object, I have already tried vtkFillHolesFilter, but it >> won't fill the gap? >> >> >> >> >> >> >> >> The code to create the planar: >> >> >> >> >> >> >> >> implicitPolyDataDistance = vtk.vtkImplicitPolyDataDistance() >> >> >> >> implicitPolyDataDistance.SetInput(stl_poly_data) >> >> >> >> >> >> >> >> #create a grid >> >> >> >> xCoords = vtk.vtkFloatArray() >> >> >> >> for x, i in enumerate(np.linspace(xmin, xmax,50)): >> >> >> >> xCoords.InsertNextValue(i) >> >> >> >> >> >> >> >> yCoords = vtk.vtkFloatArray() >> >> >> >> for y, i in enumerate(np.linspace(ymin, ymax, 50)): >> >> >> >> yCoords.InsertNextValue(i) >> >> >> >> >> >> >> >> zCoords = vtk.vtkFloatArray() >> >> >> >> for z, i in enumerate(np.linspace(zmin, zmin + 1, 50)): >> >> >> >> zCoords.InsertNextValue(i) >> >> >> >> >> >> >> >> rgrid = vtk.vtkRectilinearGrid() >> >> >> >> rgrid.SetDimensions(x + 1, y + 1 , z + 1) >> >> >> >> rgrid.SetXCoordinates(xCoords) >> >> >> >> rgrid.SetYCoordinates(yCoords) >> >> >> >> rgrid.SetZCoordinates(zCoords) >> >> >> >> signedDistances = vtk.vtkFloatArray() >> >> >> >> signedDistances.SetNumberOfComponents(1) >> >> >> >> signedDistances.SetName("SignedDistances") >> >> >> >> >> >> >> >> # Evaluate the signed distance function at all of the grid points >> >> >> >> for pointId in range(rgrid.GetNumberOfPoints()): >> >> >> >> p = rgrid.GetPoint(pointId) >> >> >> >> signedDistance = implicitPolyDataDistance.EvaluateFunction(p) >> >> >> >> signedDistances.InsertNextValue(signedDistance) >> >> >> >> >> >> >> >> # add the SignedDistances to the grid >> >> >> >> rgrid.GetPointData().SetScalars(signedDistances) >> >> >> >> >> >> >> >> # geometry filter to view the background grid >> >> >> >> geometryFilter = vtk.vtkRectilinearGridGeometryFilter() >> >> >> >> geometryFilter.SetInputData(rgrid) >> >> >> >> geometryFilter.SetExtent(0, x + 1, 0, y + 1, (z + 1) // 2, (z + 1) // >> 2) >> >> >> >> geometryFilter.Update() >> >> >> >> # ================ END creating a plane ======================= >> >> >> >> >> >> >> >> The code that merge the stl poly data and the plane: >> >> >> >> meshAppend = vtk.vtkAppendPolyData() >> >> >> >> meshAppend.AddInputData(stl_poly_data) >> >> >> >> meshAppend.AddInputData(geometryFilter.GetOutput()) >> >> >> >> meshAppend.Update() >> >> >> >> boundaryClean = vtk.vtkCleanPolyData() >> >> >> >> boundaryClean.SetInputData(meshAppend.GetOutput()) >> >> >> >> boundaryClean.Update() >> >> >> >> out = vtk.vtkPolyData() >> >> >> >> out.DeepCopy(boundaryClean.GetOutput()) >> >> >> >> >> >> >> >> triangleTrans = vtk.vtkTriangleFilter() >> >> >> >> triangleTrans.SetInputData(out) >> >> >> >> triangleTrans.Update() >> >> >> >> >> >> >> >> fill = vtk.vtkFillHolesFilter() >> >> >> >> fill.SetInputData(out) >> >> >> >> fill.SetHoleSize(1000000.0) >> >> >> >> fill.Update() >> >> >> >> >> >> >> >> >> >> >> >> A screenshot of what my current mesh is (note: the red line is where i >> want to close the gap vertically along the z axis: >> https://i.stack.imgur.com/F9w3c.png >> >> >> >> >> >> >> >> Any suggestion to solve this problem? >> >> >> >> >> >> >> >> Thank you >> >> >> >> >> >> >> >> _______________________________________________ >> >> 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 rccm.kyoshimi at gmail.com Wed Jul 18 23:38:22 2018 From: rccm.kyoshimi at gmail.com (kenichiro yoshimi) Date: Thu, 19 Jul 2018 12:38:22 +0900 Subject: [vtkusers] Copy image data into vtkImageData from a textfile In-Reply-To: References: Message-ID: Hi Lizeth, Because vtkDelimitedTextReader outputs a vtkTable, you firstly need to convert it to a vtkPolyData using vtkTableToPolyData. And then you can use vtkResampleToImage to map the polyData to vtkImageData. ---sample.csv--- 0 0 0 60.7635 1 0 0 107.555 2 0 0 80.5241 0 1 0 85.9694 1 1 0 156.706 2 1 0 105.73 0 2 0 37.3531 1 2 0 84.1445 2 2 0 57.1137 0 0 1 100.634 1 0 1 171.37 2 0 1 120.395 0 1 1 149.785 1 1 1 260 2 1 1 169.546 0 2 1 77.2238 1 2 1 147.96 2 2 1 96.9844 0 0 2 60.7635 1 0 2 107.555 2 0 2 80.5241 0 1 2 85.9694 1 1 2 156.706 2 1 2 105.73 0 2 2 37.3531 1 2 2 84.1445 2 2 2 57.1137 --- import vtk def main(): colors = vtk.vtkNamedColors() reader = vtk.vtkDelimitedTextReader() reader.SetFileName('sample.csv') reader.DetectNumericColumnsOn() reader.SetFieldDelimiterCharacters(' ') reader.MergeConsecutiveDelimitersOn() tableToPoints = vtk.vtkTableToPolyData() tableToPoints.SetInputConnection(reader.GetOutputPort()) tableToPoints.SetXColumn('Field 0') tableToPoints.SetYColumn('Field 1') tableToPoints.SetZColumn('Field 2') resample = vtk.vtkResampleToImage() resample.SetInputConnection(tableToPoints.GetOutputPort()) resample.SetSamplingDimensions(3, 3, 3) resample.Update() scalar = resample.GetOutput().GetPointData().GetArray('Field 3') resample.GetOutput().GetPointData().SetScalars(scalar) writer = vtk.vtkMetaImageWriter() writer.SetInputData(resample.GetOutput()) writer.SetFileName('out.mha') writer.SetCompression(True) writer.Write() if __name__ == '__main__': main() --- Best 2018?7?19?(?) 3:43 Lizeth Castellanos : > > Hi! > > I'd like to copy image data from a textfile (csv) into vtkImageData. > The textfile have voxel values for x,y,z and image intensity. I already have read the textfile into VTK with the vtkDelimitedTextReader class: > > Table loaded from CSV file: > +-----------+-----------+-----------+------------+ > | Field 0 | Field 1 | Field 2 | Field 3 | > +-----------+-----------+-----------+------------+ > | 510 | 291 | 0 | 32 | > | 511 | 291 | 0 | 128 | > | 510 | 292 | 0 | 104 | > | 511 | 292 | 0 | 104 | > | 510 | 293 | 0 | 40 | > | 511 | 293 | 0 | 240 | > | 510 | 294 | 0 | 104 | > | 511 | 294 | 0 | 96 | > | 506 | 295 | 0 | 64 | > | 507 | 295 | 0 | 16 | > ..... > ..... > The file is an exported segmented dataset. > > I am following the tips from this similar question http://vtk.1045678.n5.nabble.com/importing-image-data-into-VTK-from-textfile-mimics-td1243332.html > I have created an appropriate vtkimagedata (volume): > > imageData = vtk.vtkImageData() > imageData.SetDimensions(512, 512, 192) > imageData.SetOrigin(0.0, 0.0, 0.0) > imageData.SetSpacing(1, 1, 1) > imageData.SetNumberOfScalarComponents(1) > imageData.Update() > > However I don't know how to copy the data loaded from vtkDelimitedTextReader into vtkImageData. How do I copy the x,y,z voxel values into vtkImageData? How do I copy the intensity valuesVtkImageData? > > Any help provided for this would be greatly appreciated! > > Lizeth > > > _______________________________________________ > 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 rccm.kyoshimi at gmail.com Thu Jul 19 00:10:17 2018 From: rccm.kyoshimi at gmail.com (kenichiro yoshimi) Date: Thu, 19 Jul 2018 13:10:17 +0900 Subject: [vtkusers] Close the gap between a mesh and a planar In-Reply-To: References: <679DA8D3-16D1-4213-9085-F0DBCB53B86D@spiria.com> Message-ID: Hi, The second half of numbers of points indicates the target side of extrusion, while the first half is the source side. Here, only the target side must be projected on x-y plane. Thanks 2018?7?19?(?) 12:23 Jacky Nguyen : > > Also, can you please explain why populating the points must be from half the number of points onward but not from 0 ? I am referring to this line: > > for ptId in range(round(numPts/2), numPts): > > > > Thank you, > > Jacky > > On Thu, Jul 19, 2018 at 9:13 AM Jacky Nguyen wrote: >> >> Hi Kenichiro, >> >> Your method works! I am new to 3D stuff so i was not aware of this vtkLinearExtrusionFilter. But I did hear of this term when I worked with the 3D modelling guy when he said he manually did extrude the original shape. >> >> Thank you for your help! >> >> Jacky >> >> On Wed, Jul 18, 2018 at 8:34 PM kenichiro yoshimi wrote: >>> >>> Hi, >>> >>> Excuse me for cutting in. I am inspired by Patrick method. >>> First create a skirt from boundary edges of polygonal data by >>> vtkLinearExtrusionFilter >>> and then place the extruded points at x-y plane. >>> >>> --- >>> #!/usr/bin/env python >>> # -*- coding: utf-8 -*- >>> >>> import vtk >>> >>> >>> def main(): >>> colors = vtk.vtkNamedColors() >>> >>> reader = vtk.vtkSTLReader() >>> reader.SetFileName('improve.stl') >>> reader.Update() >>> >>> # Apply linear extrusion >>> extrude = vtk.vtkLinearExtrusionFilter() >>> extrude.SetInputConnection(reader.GetOutputPort()) >>> extrude.SetExtrusionTypeToNormalExtrusion(); >>> extrude.SetVector(0, 0, -10) >>> extrude.CappingOn() >>> extrude.Update() >>> >>> # project extruded points onto x-y plane >>> z = 1130 >>> closedSurface = extrude.GetOutput() >>> points = closedSurface.GetPoints() >>> numPts = closedSurface.GetNumberOfPoints() >>> for ptId in range(numPts/2, numPts): >>> point = points.GetPoint(ptId) >>> points.SetPoint(ptId, point[0], point[1], z) >>> >>> # Create a mapper and actor. >>> mapper = vtk.vtkPolyDataMapper() >>> mapper.SetInputData(closedSurface) >>> >>> actor = vtk.vtkActor() >>> actor.GetProperty().SetColor(colors.GetColor3d("Cornsilk")) >>> actor.SetMapper(mapper) >>> >>> # Create a renderer, render window, and interactor >>> renderer = vtk.vtkRenderer() >>> renderWindow = vtk.vtkRenderWindow() >>> renderWindow.SetWindowName("TaperedCylinder") >>> renderWindow.AddRenderer(renderer) >>> renderWindowInteractor = vtk.vtkRenderWindowInteractor() >>> renderWindowInteractor.SetRenderWindow(renderWindow) >>> >>> # Add the actors to the scene >>> renderer.AddActor(actor) >>> renderer.SetBackground(colors.GetColor3d("DarkGreen")) >>> >>> # Render and interact >>> renderWindow.Render() >>> renderWindowInteractor.Start() >>> >>> >>> if __name__ == '__main__': >>> main() >>> --- >>> >>> For your reference. >>> 2018?7?18?(?) 15:44 Jacky Nguyen : >>> > >>> > Hi Patrick, >>> > >>> > Thanks for the clarification. I have tried your approach, but however the wall was not covered up the entire boundary. The wall was stopped kinda half way. >>> > Do you mind taking a look at my code to see what went wrong? I have created a gist here: https://gist.github.com/ngunhaSO/f3902fd34172a161b678b2a05a5c91fe >>> > I have also attached a stl file that i wanna manipulate and the screenshot of what i achieved here: https://github.com/ngunhaSO/misc >>> > >>> > Thank you! >>> > >>> > Jacky >>> > >>> > On Mon, Jul 16, 2018 at 7:48 PM Patrick Bergeron wrote: >>> >> >>> >> Hi Jacky >>> >> >>> >> >>> >> >>> >> Let me try to be clearer. Let?s say you have a surface floating in space, which seems to be your case. >>> >> >>> >> >>> >> >>> >> You can create a wall around your surface, by creating new geometry around your surface, which we will say is your wall. On the wall, you need to connect boundary edges with the floor (at z=0). >>> >> >>> >> >>> >> >>> >> So set?s say you find a boundary edge with points a and b >>> >> >>> >> >>> >> >>> >> Add 2 points to your polydata. (xa, ya, 0), (xb, yb, 0) >>> >> >>> >> >>> >> >>> >> Then you create a quad that goes like this: >>> >> >>> >> >>> >> >>> >> (xa,ya,za), >>> >> >>> >> (xb,yb,zb) >>> >> >>> >> (xb,yb,0) >>> >> >>> >> (xa,ya,0) >>> >> >>> >> >>> >> >>> >> Or if you prefer you can create 2 triangles: >>> >> >>> >> (xa,ya,za), >>> >> >>> >> (xb,yb,zb) >>> >> >>> >> (xb,yb,0) >>> >> >>> >> >>> >> >>> >> (xb,yb,0) >>> >> >>> >> (xa,ya,0) >>> >> >>> >> (xa,ya,za), >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> Anyway, after you create your walls at each boundary edge, you end up with walls that go all around your surface, but with no horizontal surface at the bottom. Maybe this is important to you, maybe not. >>> >> >>> >> >>> >> >>> >> If it?s important, you can create a duplicate copy of your top surface, but in the copy, set all your point?s Z to 0.0. >>> >> >>> >> >>> >> >>> >> This will flatten out the copy of your top surface and place it at Z=0, connecting to the bottom of your wall that you created all around your surface >>> >> >>> >> >>> >> >>> >> You will end up with a volume with the sides and bottom capped off. >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> Patrick. >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> From: Jacky Nguyen >>> >> Date: Monday, July 16, 2018 at 5:12 AM >>> >> To: Patrick Bergeron >>> >> Cc: "vtkusers at public.kitware.com" >>> >> Subject: Re: [vtkusers] Close the gap between a mesh and a planar >>> >> >>> >> >>> >> >>> >> Thanks for your input. >>> >> >>> >> Sorry, I am new to these so I need to take it slowly. >>> >> >>> >> >>> >> >>> >> Let me clarify a few things: >>> >> >>> >> 1) by using your approach, i don't need to create the plane on the bottom of the object as a holder? >>> >> >>> >> 2) When you say "For each boundary edge, create 2 triangles (a quad) with 1 or 2 points at z=0", does it matter which x and y coordinate to pick? >>> >> >>> >> >>> >> >>> >> I have added the following codes to extract the edges and find the pointID and point coordinate for each edge in the STL object. I trace through my console log, and there is no point that has z = 0 >>> >> >>> >> >>> >> >>> >> reader = vtk.vtkSTLReader() >>> >> reader.SetFileName('path_to_stl') >>> >> reader.Update() >>> >> >>> >> triangleFilter = vtk.vtkTriangleFilter() >>> >> triangleFilter.SetInputConnection(reader.GetOutputPort()) >>> >> triangleFilter.Update() >>> >> >>> >> # ++++++++++++++++++ extract edges ++++++++++++++++++++++++++++++++++++ >>> >> >>> >> featureEdges = vtk.vtkFeatureEdges() >>> >> featureEdges.SetInputData(triangleFilter.GetOutput()) >>> >> featureEdges.SetBoundaryEdges(1) >>> >> featureEdges.SetFeatureEdges(0) >>> >> featureEdges.SetNonManifoldEdges(0) >>> >> featureEdges.SetManifoldEdges(0) >>> >> featureEdges.Update() >>> >> boundaryMesh = featureEdges.GetOutput() >>> >> numberOfOpenEdges = featureEdges.GetOutput().GetNumberOfLines() >>> >> print('number of lines: ', featureEdges.GetOutput().GetNumberOfLines()) >>> >> for i in range(0, boundaryMesh.GetNumberOfLines()): >>> >> cell = boundaryMesh.GetCell(i) >>> >> cellPoints = cell.GetPoints() >>> >> pointIds = cell.GetPointIds() >>> >> for j in range(0, pointIds.GetNumberOfIds()): >>> >> print('>>> point id: ', pointIds.GetId(j)) >>> >> print('>>> coordinate: ', boundaryMesh.GetPoint(pointIds.GetId(j))) >>> >> >>> >> >>> >> >>> >> Thank you, >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> On Fri, Jul 13, 2018 at 10:10 PM Patrick Bergeron wrote: >>> >> >>> >> I would take a different approach. >>> >> >>> >> >>> >> >>> >> I would look at all the edges that have only 1 cell attached, and these are your boundary edges. >>> >> >>> >> >>> >> >>> >> For each boundary edge, create 2 triangles (a quad) with 1 or 2 points at z=0. (Create 2 new points at z=0 for this purpose). If you already have a point at that z=0, then reuse it don?t create it. >>> >> >>> >> >>> >> >>> >> That approach will create quads all around your geometry connecting to the bottom but will leave the bottom hole open. >>> >> >>> >> >>> >> >>> >> Next create a cell connecting all your z=0 points together. Make sure they are ordered in sequential order to create your contour loop. >>> >> >>> >> >>> >> >>> >> Done >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> Sent from my iPhone >>> >> >>> >> >>> >> On Jul 13, 2018, at 05:10, Jacky Nguyen wrote: >>> >> >>> >> I have converted an .obj mesh file to .stl. I also created a planar geometry as a holder for the mesh object then merge them. However, it contains a gap. Any suggestion how to close the gap vertically so that it becomes a solid object, I have already tried vtkFillHolesFilter, but it won't fill the gap? >>> >> >>> >> >>> >> >>> >> The code to create the planar: >>> >> >>> >> >>> >> >>> >> implicitPolyDataDistance = vtk.vtkImplicitPolyDataDistance() >>> >> >>> >> implicitPolyDataDistance.SetInput(stl_poly_data) >>> >> >>> >> >>> >> >>> >> #create a grid >>> >> >>> >> xCoords = vtk.vtkFloatArray() >>> >> >>> >> for x, i in enumerate(np.linspace(xmin, xmax,50)): >>> >> >>> >> xCoords.InsertNextValue(i) >>> >> >>> >> >>> >> >>> >> yCoords = vtk.vtkFloatArray() >>> >> >>> >> for y, i in enumerate(np.linspace(ymin, ymax, 50)): >>> >> >>> >> yCoords.InsertNextValue(i) >>> >> >>> >> >>> >> >>> >> zCoords = vtk.vtkFloatArray() >>> >> >>> >> for z, i in enumerate(np.linspace(zmin, zmin + 1, 50)): >>> >> >>> >> zCoords.InsertNextValue(i) >>> >> >>> >> >>> >> >>> >> rgrid = vtk.vtkRectilinearGrid() >>> >> >>> >> rgrid.SetDimensions(x + 1, y + 1 , z + 1) >>> >> >>> >> rgrid.SetXCoordinates(xCoords) >>> >> >>> >> rgrid.SetYCoordinates(yCoords) >>> >> >>> >> rgrid.SetZCoordinates(zCoords) >>> >> >>> >> signedDistances = vtk.vtkFloatArray() >>> >> >>> >> signedDistances.SetNumberOfComponents(1) >>> >> >>> >> signedDistances.SetName("SignedDistances") >>> >> >>> >> >>> >> >>> >> # Evaluate the signed distance function at all of the grid points >>> >> >>> >> for pointId in range(rgrid.GetNumberOfPoints()): >>> >> >>> >> p = rgrid.GetPoint(pointId) >>> >> >>> >> signedDistance = implicitPolyDataDistance.EvaluateFunction(p) >>> >> >>> >> signedDistances.InsertNextValue(signedDistance) >>> >> >>> >> >>> >> >>> >> # add the SignedDistances to the grid >>> >> >>> >> rgrid.GetPointData().SetScalars(signedDistances) >>> >> >>> >> >>> >> >>> >> # geometry filter to view the background grid >>> >> >>> >> geometryFilter = vtk.vtkRectilinearGridGeometryFilter() >>> >> >>> >> geometryFilter.SetInputData(rgrid) >>> >> >>> >> geometryFilter.SetExtent(0, x + 1, 0, y + 1, (z + 1) // 2, (z + 1) // 2) >>> >> >>> >> geometryFilter.Update() >>> >> >>> >> # ================ END creating a plane ======================= >>> >> >>> >> >>> >> >>> >> The code that merge the stl poly data and the plane: >>> >> >>> >> meshAppend = vtk.vtkAppendPolyData() >>> >> >>> >> meshAppend.AddInputData(stl_poly_data) >>> >> >>> >> meshAppend.AddInputData(geometryFilter.GetOutput()) >>> >> >>> >> meshAppend.Update() >>> >> >>> >> boundaryClean = vtk.vtkCleanPolyData() >>> >> >>> >> boundaryClean.SetInputData(meshAppend.GetOutput()) >>> >> >>> >> boundaryClean.Update() >>> >> >>> >> out = vtk.vtkPolyData() >>> >> >>> >> out.DeepCopy(boundaryClean.GetOutput()) >>> >> >>> >> >>> >> >>> >> triangleTrans = vtk.vtkTriangleFilter() >>> >> >>> >> triangleTrans.SetInputData(out) >>> >> >>> >> triangleTrans.Update() >>> >> >>> >> >>> >> >>> >> fill = vtk.vtkFillHolesFilter() >>> >> >>> >> fill.SetInputData(out) >>> >> >>> >> fill.SetHoleSize(1000000.0) >>> >> >>> >> fill.Update() >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> A screenshot of what my current mesh is (note: the red line is where i want to close the gap vertically along the z axis: https://i.stack.imgur.com/F9w3c.png >>> >> >>> >> >>> >> >>> >> Any suggestion to solve this problem? >>> >> >>> >> >>> >> >>> >> Thank you >>> >> >>> >> >>> >> >>> >> _______________________________________________ >>> >> 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 From andrew.amaclean at gmail.com Thu Jul 19 01:04:47 2018 From: andrew.amaclean at gmail.com (Andrew Maclean) Date: Thu, 19 Jul 2018 15:04:47 +1000 Subject: [vtkusers] Correctly apply camera matrix In-Reply-To: References: Message-ID: All done. When the site updates they should be here: https://lorensen.github.io/VTKExamples/site/Python/Utilities/SaveSceneToFieldData/ https://lorensen.github.io/VTKExamples/site/Python/Utilities/SaveSceneToFile/ On Wed, Jul 18, 2018 at 11:53 PM Bill Lorensen wrote: > Yes, please! > > On Wed, Jul 18, 2018, 12:29 AM Andrew Maclean > wrote: > >> Bill, if you like, I can do a Python version of these two examples. >> >> Regards >> Andrew >> >> ---------- Forwarded message ---------- >>> From: Bill Lorensen >>> To: andyjk >>> Cc: VTK Users >>> Bcc: >>> Date: Mon, 16 Jul 2018 10:30:10 -0700 >>> Subject: Re: [vtkusers] Correctly apply camera matrix >>> These two examples save the camera to a file or store it in field data: >>> >>> >>> https://lorensen.github.io/VTKExamples/site/Cxx/Utilities/SaveSceneToFieldData/ >>> >>> https://lorensen.github.io/VTKExamples/site/Cxx/Utilities/SaveSceneToFile/ >>> >>> >>> On Mon, Jul 16, 2018 at 9:46 AM, andyjk >>> wrote: >>> > Thanks Ken >>> > >>> > Looks like this is the sensible way to do it, so I have abandoned the >>> > transformation matrix idea. >>> > >>> > >>> > >>> > -- >>> > 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 >>> >>> >>> >>> -- >>> Unpaid intern in BillsParadise at noware dot com >>> >>> >>> >>> -- >>> >> ___________________________________________ >> Andrew J. P. Maclean >> >> ___________________________________________ >> > -- ___________________________________________ Andrew J. P. Maclean ___________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: From jackynguyen.km at gmail.com Thu Jul 19 01:43:37 2018 From: jackynguyen.km at gmail.com (Jacky Nguyen) Date: Thu, 19 Jul 2018 13:43:37 +0800 Subject: [vtkusers] Close the gap between a mesh and a planar In-Reply-To: References: <679DA8D3-16D1-4213-9085-F0DBCB53B86D@spiria.com> Message-ID: Ahh I see, thank you very much for the explanation! Best Regards, Jacky On Thu, Jul 19, 2018 at 12:10 PM kenichiro yoshimi wrote: > Hi, > > The second half of numbers of points indicates the target side of > extrusion, while the first half is the source side. Here, only the > target side must be projected on x-y plane. > > Thanks > 2018?7?19?(?) 12:23 Jacky Nguyen : > > > > Also, can you please explain why populating the points must be from half > the number of points onward but not from 0 ? I am referring to this line: > > > > for ptId in range(round(numPts/2), numPts): > > > > > > > > Thank you, > > > > Jacky > > > > On Thu, Jul 19, 2018 at 9:13 AM Jacky Nguyen > wrote: > >> > >> Hi Kenichiro, > >> > >> Your method works! I am new to 3D stuff so i was not aware of this > vtkLinearExtrusionFilter. But I did hear of this term when I worked with > the 3D modelling guy when he said he manually did extrude the original > shape. > >> > >> Thank you for your help! > >> > >> Jacky > >> > >> On Wed, Jul 18, 2018 at 8:34 PM kenichiro yoshimi < > rccm.kyoshimi at gmail.com> wrote: > >>> > >>> Hi, > >>> > >>> Excuse me for cutting in. I am inspired by Patrick method. > >>> First create a skirt from boundary edges of polygonal data by > >>> vtkLinearExtrusionFilter > >>> and then place the extruded points at x-y plane. > >>> > >>> --- > >>> #!/usr/bin/env python > >>> # -*- coding: utf-8 -*- > >>> > >>> import vtk > >>> > >>> > >>> def main(): > >>> colors = vtk.vtkNamedColors() > >>> > >>> reader = vtk.vtkSTLReader() > >>> reader.SetFileName('improve.stl') > >>> reader.Update() > >>> > >>> # Apply linear extrusion > >>> extrude = vtk.vtkLinearExtrusionFilter() > >>> extrude.SetInputConnection(reader.GetOutputPort()) > >>> extrude.SetExtrusionTypeToNormalExtrusion(); > >>> extrude.SetVector(0, 0, -10) > >>> extrude.CappingOn() > >>> extrude.Update() > >>> > >>> # project extruded points onto x-y plane > >>> z = 1130 > >>> closedSurface = extrude.GetOutput() > >>> points = closedSurface.GetPoints() > >>> numPts = closedSurface.GetNumberOfPoints() > >>> for ptId in range(numPts/2, numPts): > >>> point = points.GetPoint(ptId) > >>> points.SetPoint(ptId, point[0], point[1], z) > >>> > >>> # Create a mapper and actor. > >>> mapper = vtk.vtkPolyDataMapper() > >>> mapper.SetInputData(closedSurface) > >>> > >>> actor = vtk.vtkActor() > >>> actor.GetProperty().SetColor(colors.GetColor3d("Cornsilk")) > >>> actor.SetMapper(mapper) > >>> > >>> # Create a renderer, render window, and interactor > >>> renderer = vtk.vtkRenderer() > >>> renderWindow = vtk.vtkRenderWindow() > >>> renderWindow.SetWindowName("TaperedCylinder") > >>> renderWindow.AddRenderer(renderer) > >>> renderWindowInteractor = vtk.vtkRenderWindowInteractor() > >>> renderWindowInteractor.SetRenderWindow(renderWindow) > >>> > >>> # Add the actors to the scene > >>> renderer.AddActor(actor) > >>> renderer.SetBackground(colors.GetColor3d("DarkGreen")) > >>> > >>> # Render and interact > >>> renderWindow.Render() > >>> renderWindowInteractor.Start() > >>> > >>> > >>> if __name__ == '__main__': > >>> main() > >>> --- > >>> > >>> For your reference. > >>> 2018?7?18?(?) 15:44 Jacky Nguyen : > >>> > > >>> > Hi Patrick, > >>> > > >>> > Thanks for the clarification. I have tried your approach, but > however the wall was not covered up the entire boundary. The wall was > stopped kinda half way. > >>> > Do you mind taking a look at my code to see what went wrong? I have > created a gist here: > https://gist.github.com/ngunhaSO/f3902fd34172a161b678b2a05a5c91fe > >>> > I have also attached a stl file that i wanna manipulate and the > screenshot of what i achieved here: https://github.com/ngunhaSO/misc > >>> > > >>> > Thank you! > >>> > > >>> > Jacky > >>> > > >>> > On Mon, Jul 16, 2018 at 7:48 PM Patrick Bergeron < > pbergeron at spiria.com> wrote: > >>> >> > >>> >> Hi Jacky > >>> >> > >>> >> > >>> >> > >>> >> Let me try to be clearer. Let?s say you have a surface floating in > space, which seems to be your case. > >>> >> > >>> >> > >>> >> > >>> >> You can create a wall around your surface, by creating new geometry > around your surface, which we will say is your wall. On the wall, you need > to connect boundary edges with the floor (at z=0). > >>> >> > >>> >> > >>> >> > >>> >> So set?s say you find a boundary edge with points a and b > >>> >> > >>> >> > >>> >> > >>> >> Add 2 points to your polydata. (xa, ya, 0), (xb, yb, 0) > >>> >> > >>> >> > >>> >> > >>> >> Then you create a quad that goes like this: > >>> >> > >>> >> > >>> >> > >>> >> (xa,ya,za), > >>> >> > >>> >> (xb,yb,zb) > >>> >> > >>> >> (xb,yb,0) > >>> >> > >>> >> (xa,ya,0) > >>> >> > >>> >> > >>> >> > >>> >> Or if you prefer you can create 2 triangles: > >>> >> > >>> >> (xa,ya,za), > >>> >> > >>> >> (xb,yb,zb) > >>> >> > >>> >> (xb,yb,0) > >>> >> > >>> >> > >>> >> > >>> >> (xb,yb,0) > >>> >> > >>> >> (xa,ya,0) > >>> >> > >>> >> (xa,ya,za), > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> Anyway, after you create your walls at each boundary edge, you end > up with walls that go all around your surface, but with no horizontal > surface at the bottom. Maybe this is important to you, maybe not. > >>> >> > >>> >> > >>> >> > >>> >> If it?s important, you can create a duplicate copy of your top > surface, but in the copy, set all your point?s Z to 0.0. > >>> >> > >>> >> > >>> >> > >>> >> This will flatten out the copy of your top surface and place it at > Z=0, connecting to the bottom of your wall that you created all around your > surface > >>> >> > >>> >> > >>> >> > >>> >> You will end up with a volume with the sides and bottom capped off. > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> Patrick. > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> From: Jacky Nguyen > >>> >> Date: Monday, July 16, 2018 at 5:12 AM > >>> >> To: Patrick Bergeron > >>> >> Cc: "vtkusers at public.kitware.com" > >>> >> Subject: Re: [vtkusers] Close the gap between a mesh and a planar > >>> >> > >>> >> > >>> >> > >>> >> Thanks for your input. > >>> >> > >>> >> Sorry, I am new to these so I need to take it slowly. > >>> >> > >>> >> > >>> >> > >>> >> Let me clarify a few things: > >>> >> > >>> >> 1) by using your approach, i don't need to create the plane on the > bottom of the object as a holder? > >>> >> > >>> >> 2) When you say "For each boundary edge, create 2 triangles (a > quad) with 1 or 2 points at z=0", does it matter which x and y coordinate > to pick? > >>> >> > >>> >> > >>> >> > >>> >> I have added the following codes to extract the edges and find the > pointID and point coordinate for each edge in the STL object. I trace > through my console log, and there is no point that has z = 0 > >>> >> > >>> >> > >>> >> > >>> >> reader = vtk.vtkSTLReader() > >>> >> reader.SetFileName('path_to_stl') > >>> >> reader.Update() > >>> >> > >>> >> triangleFilter = vtk.vtkTriangleFilter() > >>> >> triangleFilter.SetInputConnection(reader.GetOutputPort()) > >>> >> triangleFilter.Update() > >>> >> > >>> >> # ++++++++++++++++++ extract edges > ++++++++++++++++++++++++++++++++++++ > >>> >> > >>> >> featureEdges = vtk.vtkFeatureEdges() > >>> >> featureEdges.SetInputData(triangleFilter.GetOutput()) > >>> >> featureEdges.SetBoundaryEdges(1) > >>> >> featureEdges.SetFeatureEdges(0) > >>> >> featureEdges.SetNonManifoldEdges(0) > >>> >> featureEdges.SetManifoldEdges(0) > >>> >> featureEdges.Update() > >>> >> boundaryMesh = featureEdges.GetOutput() > >>> >> numberOfOpenEdges = featureEdges.GetOutput().GetNumberOfLines() > >>> >> print('number of lines: ', > featureEdges.GetOutput().GetNumberOfLines()) > >>> >> for i in range(0, boundaryMesh.GetNumberOfLines()): > >>> >> cell = boundaryMesh.GetCell(i) > >>> >> cellPoints = cell.GetPoints() > >>> >> pointIds = cell.GetPointIds() > >>> >> for j in range(0, pointIds.GetNumberOfIds()): > >>> >> print('>>> point id: ', pointIds.GetId(j)) > >>> >> print('>>> coordinate: ', > boundaryMesh.GetPoint(pointIds.GetId(j))) > >>> >> > >>> >> > >>> >> > >>> >> Thank you, > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> On Fri, Jul 13, 2018 at 10:10 PM Patrick Bergeron < > pbergeron at spiria.com> wrote: > >>> >> > >>> >> I would take a different approach. > >>> >> > >>> >> > >>> >> > >>> >> I would look at all the edges that have only 1 cell attached, and > these are your boundary edges. > >>> >> > >>> >> > >>> >> > >>> >> For each boundary edge, create 2 triangles (a quad) with 1 or 2 > points at z=0. (Create 2 new points at z=0 for this purpose). If you > already have a point at that z=0, then reuse it don?t create it. > >>> >> > >>> >> > >>> >> > >>> >> That approach will create quads all around your geometry connecting > to the bottom but will leave the bottom hole open. > >>> >> > >>> >> > >>> >> > >>> >> Next create a cell connecting all your z=0 points together. Make > sure they are ordered in sequential order to create your contour loop. > >>> >> > >>> >> > >>> >> > >>> >> Done > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> Sent from my iPhone > >>> >> > >>> >> > >>> >> On Jul 13, 2018, at 05:10, Jacky Nguyen > wrote: > >>> >> > >>> >> I have converted an .obj mesh file to .stl. I also created a planar > geometry as a holder for the mesh object then merge them. However, it > contains a gap. Any suggestion how to close the gap vertically so that it > becomes a solid object, I have already tried vtkFillHolesFilter, but it > won't fill the gap? > >>> >> > >>> >> > >>> >> > >>> >> The code to create the planar: > >>> >> > >>> >> > >>> >> > >>> >> implicitPolyDataDistance = vtk.vtkImplicitPolyDataDistance() > >>> >> > >>> >> implicitPolyDataDistance.SetInput(stl_poly_data) > >>> >> > >>> >> > >>> >> > >>> >> #create a grid > >>> >> > >>> >> xCoords = vtk.vtkFloatArray() > >>> >> > >>> >> for x, i in enumerate(np.linspace(xmin, xmax,50)): > >>> >> > >>> >> xCoords.InsertNextValue(i) > >>> >> > >>> >> > >>> >> > >>> >> yCoords = vtk.vtkFloatArray() > >>> >> > >>> >> for y, i in enumerate(np.linspace(ymin, ymax, 50)): > >>> >> > >>> >> yCoords.InsertNextValue(i) > >>> >> > >>> >> > >>> >> > >>> >> zCoords = vtk.vtkFloatArray() > >>> >> > >>> >> for z, i in enumerate(np.linspace(zmin, zmin + 1, 50)): > >>> >> > >>> >> zCoords.InsertNextValue(i) > >>> >> > >>> >> > >>> >> > >>> >> rgrid = vtk.vtkRectilinearGrid() > >>> >> > >>> >> rgrid.SetDimensions(x + 1, y + 1 , z + 1) > >>> >> > >>> >> rgrid.SetXCoordinates(xCoords) > >>> >> > >>> >> rgrid.SetYCoordinates(yCoords) > >>> >> > >>> >> rgrid.SetZCoordinates(zCoords) > >>> >> > >>> >> signedDistances = vtk.vtkFloatArray() > >>> >> > >>> >> signedDistances.SetNumberOfComponents(1) > >>> >> > >>> >> signedDistances.SetName("SignedDistances") > >>> >> > >>> >> > >>> >> > >>> >> # Evaluate the signed distance function at all of the grid points > >>> >> > >>> >> for pointId in range(rgrid.GetNumberOfPoints()): > >>> >> > >>> >> p = rgrid.GetPoint(pointId) > >>> >> > >>> >> signedDistance = implicitPolyDataDistance.EvaluateFunction(p) > >>> >> > >>> >> signedDistances.InsertNextValue(signedDistance) > >>> >> > >>> >> > >>> >> > >>> >> # add the SignedDistances to the grid > >>> >> > >>> >> rgrid.GetPointData().SetScalars(signedDistances) > >>> >> > >>> >> > >>> >> > >>> >> # geometry filter to view the background grid > >>> >> > >>> >> geometryFilter = vtk.vtkRectilinearGridGeometryFilter() > >>> >> > >>> >> geometryFilter.SetInputData(rgrid) > >>> >> > >>> >> geometryFilter.SetExtent(0, x + 1, 0, y + 1, (z + 1) // 2, (z + 1) > // 2) > >>> >> > >>> >> geometryFilter.Update() > >>> >> > >>> >> # ================ END creating a plane ======================= > >>> >> > >>> >> > >>> >> > >>> >> The code that merge the stl poly data and the plane: > >>> >> > >>> >> meshAppend = vtk.vtkAppendPolyData() > >>> >> > >>> >> meshAppend.AddInputData(stl_poly_data) > >>> >> > >>> >> meshAppend.AddInputData(geometryFilter.GetOutput()) > >>> >> > >>> >> meshAppend.Update() > >>> >> > >>> >> boundaryClean = vtk.vtkCleanPolyData() > >>> >> > >>> >> boundaryClean.SetInputData(meshAppend.GetOutput()) > >>> >> > >>> >> boundaryClean.Update() > >>> >> > >>> >> out = vtk.vtkPolyData() > >>> >> > >>> >> out.DeepCopy(boundaryClean.GetOutput()) > >>> >> > >>> >> > >>> >> > >>> >> triangleTrans = vtk.vtkTriangleFilter() > >>> >> > >>> >> triangleTrans.SetInputData(out) > >>> >> > >>> >> triangleTrans.Update() > >>> >> > >>> >> > >>> >> > >>> >> fill = vtk.vtkFillHolesFilter() > >>> >> > >>> >> fill.SetInputData(out) > >>> >> > >>> >> fill.SetHoleSize(1000000.0) > >>> >> > >>> >> fill.Update() > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> A screenshot of what my current mesh is (note: the red line is > where i want to close the gap vertically along the z axis: > https://i.stack.imgur.com/F9w3c.png > >>> >> > >>> >> > >>> >> > >>> >> Any suggestion to solve this problem? > >>> >> > >>> >> > >>> >> > >>> >> Thank you > >>> >> > >>> >> > >>> >> > >>> >> _______________________________________________ > >>> >> 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 kor1581 at gmail.com Thu Jul 19 05:04:06 2018 From: kor1581 at gmail.com (ran) Date: Thu, 19 Jul 2018 02:04:06 -0700 (MST) Subject: [vtkusers] How to customize mouse event vtkAbstractWidget Message-ID: <1531991046721-0.post@n5.nabble.com> Hi, How can I customize the mouse events vtkAbstractWidget or its child widgets?. I need to avoid the default operation (like Scaling , moving etc) in mouse events(like LeftMouseDown, MouseMove etc) defined in the widget class and have to get the mouse events in my custom interactor observer callback function. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From oleg.gubanov at gmail.com Thu Jul 19 11:56:00 2018 From: oleg.gubanov at gmail.com (Oleg Gubanov) Date: Thu, 19 Jul 2018 11:56:00 -0400 Subject: [vtkusers] QVTKOpenGLWidget and Qt's dynamic selection of OpenGL backend in Qt Message-ID: Hi, Since version 5.4, Qt applications based on class `QOpenGLWidget` select OpenGL dynamically at runtime: in addition to using actual OpenGL implementation, Qt may choose software rendering or even translate OpenGL API calls to DirectX calls. This choice can be manually overridden by setting environment variable `QT_OPENGL=software` or `QT_OPENGL=angle`. For details, please see < http://blog.qt.io/blog/2014/11/27/qt-weekly-21-dynamic-opengl-implementation-loading-in-qt-5-4/ >. Considering that Qt's class `QOpenGLWidget` is used by VTK's class `QVKTOpenGLWidget`, how does the latter class account for Qt's switch to `software` and `angle` OpenGL backends? Does VTK provide an OpenGL abstraction layer similar to Qt's? Does `QVTKOpenGLWidget` direct OpenGL calls to `QOpenGLFunctions`, taking advantage of Qt's dynamic selection of OpenGL backend? If no, are there any plans to go in that direction? Thanks, Oleg. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rccm.kyoshimi at gmail.com Fri Jul 20 05:01:31 2018 From: rccm.kyoshimi at gmail.com (kenichiro yoshimi) Date: Fri, 20 Jul 2018 18:01:31 +0900 Subject: [vtkusers] How to traverse lines of a polyline in reversed order? In-Reply-To: <1531907409886-0.post@n5.nabble.com> References: <1531907409886-0.post@n5.nabble.com> Message-ID: Hi, vtkReverseSense is exactly what you are searching for. Regards 2018?7?18?(?) 18:50 normanius : > > Hi all How to nicely traverse the lines of a polyline in reversed order, from end to start? Is there an existing function that does this, or do I have to implement my own loop that does this? In the example below, I would like to get the line traversal AD -> DC -> CB -> BA, after initializing the cells to go from AB -> BC -> CD -> DA. Thanks! > > points = vtk.vtkPoints() > points.InsertNextPoint([0,0,0]) # A > points.InsertNextPoint([1,0,0]) # B > points.InsertNextPoint([1,1,0]) # C > points.InsertNextPoint([0,1,0]) # D > lines = vtk.vtkCellArray() > for i in range(4): > line = vtk.vtkLine() > line.GetPointIds().SetId(0, i) > line.GetPointIds().SetId(1, (i+1)%4) > lines.InsertNextCell(line) > poly = vtk.vtkPolyData() > poly.SetPoints(points) > poly.SetLines(lines) > > reversed = reverseLines(poly) > > lines = reversed.GetLines() > points = reversed.GetPoints() > lines.InitTraversal() > idList = vtk.vtkIdList() > while lines.GetNextCell(idList): > p = [] > for i in range(0, idList.GetNumberOfIds()): > p.append(points.GetPoint(idList.GetId(i))) > print(p) > > > ________________________________ > Sent from the VTK - Users mailing list archive at Nabble.com. > _______________________________________________ > 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 juch at zhaw.ch Fri Jul 20 05:10:25 2018 From: juch at zhaw.ch (normanius) Date: Fri, 20 Jul 2018 02:10:25 -0700 (MST) Subject: [vtkusers] How to traverse lines of a polyline in reversed order? In-Reply-To: References: <1531907409886-0.post@n5.nabble.com> Message-ID: <1532077825876-0.post@n5.nabble.com> No, it's not, unfortunately. vtkReverseSense reverses only the edge orientation per cell, but not the ordering of the cells when traversing them. Best -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From rccm.kyoshimi at gmail.com Fri Jul 20 10:12:04 2018 From: rccm.kyoshimi at gmail.com (kenichiro yoshimi) Date: Fri, 20 Jul 2018 23:12:04 +0900 Subject: [vtkusers] How to traverse lines of a polyline in reversed order? In-Reply-To: <1532077825876-0.post@n5.nabble.com> References: <1531907409886-0.post@n5.nabble.com> <1532077825876-0.post@n5.nabble.com> Message-ID: Hi, I am sorry that I didn't read your post carefully. If you don't mind a single polyline instead of several lines, you may use a combination of vtkStripper and vtkReverseSense. Thanks 2018?7?20?(?) 18:10 normanius : > > No, it's not, unfortunately. vtkReverseSense reverses only the edge > orientation per cell, but not the ordering of the cells when traversing > them. > > Best > > > > -- > 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 rickfrank at me.com Fri Jul 20 16:28:01 2018 From: rickfrank at me.com (Richard Frank) Date: Fri, 20 Jul 2018 16:28:01 -0400 Subject: [vtkusers] vtk.js image volume issues Message-ID: <000a01d42068$28671980$79354c80$@me.com> Hi, I'm creating a simple volume from vtkImageData using vtk.js. I create an empty 3d vtkImageData and set it up with a mapper and actor, and add it to the renderer. I create a transfer function that has 0 = blue, 100 = red, 1000 = green. I'm trying to set pixels directly in the volume. There's two problems - The first is that when I click anywhere on the screen the volume disappears.it shows on the first render call. I have a button that is used to trigger the voxel setting. This seems to work only on the first slice of voxels, and the rest seem to not "stick". Regardless, however, the render call makes the volume disappear. My code is here: https://github.com/DominionSoftware/TestVolumeImage and can be built with the installation instructions like the other examples (this was cribbed from an example). Anyone have any suggestions as to why the volume disappears, and / or ways to debug this? Thanks, Rick -------------- next part -------------- An HTML attachment was scrubbed... URL: From sebastien.jourdain at kitware.com Fri Jul 20 17:53:44 2018 From: sebastien.jourdain at kitware.com (Sebastien Jourdain) Date: Fri, 20 Jul 2018 15:53:44 -0600 Subject: [vtkusers] vtk.js image volume issues In-Reply-To: <000a01d42068$28671980$79354c80$@me.com> References: <000a01d42068$28671980$79354c80$@me.com> Message-ID: You need to disable those lines as your data is homogeneous. // this.actor.getProperty().setUseGradientOpacity(0, true); // this.actor.getProperty().setGradientOpacityMinimumValue(0, 15); // this.actor.getProperty().setGradientOpacityMinimumOpacity(0, 0.0); // this.actor.getProperty().setGradientOpacityMaximumValue(0, 100); // this.actor.getProperty().setGradientOpacityMaximumOpacity(0, 1.0); // this.actor.getProperty().setShade(true); On Fri, Jul 20, 2018 at 3:28 PM Richard Frank via vtkusers < vtkusers at public.kitware.com> wrote: > > > Hi, > > > > I?m creating a simple volume from vtkImageData using vtk.js. > > > > I create an empty 3d vtkImageData and set it up with a mapper and actor, > and add it to the renderer. > > > > I create a transfer function that has 0 = blue, 100 = red, 1000 = green. > > > > I?m trying to set pixels directly in the volume. > > > > There?s two problems ? > > > > The first is that when I click anywhere on the screen the volume > disappears?it shows on the first render call. > > > > I have a button that is used to trigger the voxel setting. This seems to > work only on the first slice of voxels, and the rest seem to not ?stick?. > > Regardless, however, the render call makes the volume disappear. > > > > My code is here: > > > > https://github.com/DominionSoftware/TestVolumeImage > > > > and can be built with the installation instructions like the other > examples (this was cribbed from an example). > > > > Anyone have any suggestions as to why the volume disappears, and / or ways > to debug this? > > > > > > Thanks, > > > > Rick > > > > > > > _______________________________________________ > 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 rickfrank at me.com Fri Jul 20 17:57:38 2018 From: rickfrank at me.com (Richard Frank) Date: Fri, 20 Jul 2018 17:57:38 -0400 Subject: [vtkusers] vtk.js image volume issues In-Reply-To: References: <000a01d42068$28671980$79354c80$@me.com> Message-ID: <001f01d42074$ad75a310$0860e930$@me.com> Ah, yes thanks that makes sense. Rick From: Sebastien Jourdain Sent: Friday, July 20, 2018 5:54 PM To: rickfrank at me.com Cc: vtkusers at public.kitware.com Subject: Re: [vtkusers] vtk.js image volume issues You need to disable those lines as your data is homogeneous. // this.actor.getProperty().setUseGradientOpacity(0, true); // this.actor.getProperty().setGradientOpacityMinimumValue(0, 15); // this.actor.getProperty().setGradientOpacityMinimumOpacity(0, 0.0); // this.actor.getProperty().setGradientOpacityMaximumValue(0, 100); // this.actor.getProperty().setGradientOpacityMaximumOpacity(0, 1.0); // this.actor.getProperty().setShade(true); On Fri, Jul 20, 2018 at 3:28 PM Richard Frank via vtkusers > wrote: Hi, I?m creating a simple volume from vtkImageData using vtk.js. I create an empty 3d vtkImageData and set it up with a mapper and actor, and add it to the renderer. I create a transfer function that has 0 = blue, 100 = red, 1000 = green. I?m trying to set pixels directly in the volume. There?s two problems ? The first is that when I click anywhere on the screen the volume disappears?it shows on the first render call. I have a button that is used to trigger the voxel setting. This seems to work only on the first slice of voxels, and the rest seem to not ?stick?. Regardless, however, the render call makes the volume disappear. My code is here: https://github.com/DominionSoftware/TestVolumeImage and can be built with the installation instructions like the other examples (this was cribbed from an example). Anyone have any suggestions as to why the volume disappears, and / or ways to debug this? Thanks, Rick _______________________________________________ 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 Fri Jul 20 18:06:58 2018 From: sebastien.jourdain at kitware.com (Sebastien Jourdain) Date: Fri, 20 Jul 2018 16:06:58 -0600 Subject: [vtkusers] vtk.js image volume issues In-Reply-To: <001f01d42074$ad75a310$0860e930$@me.com> References: <000a01d42068$28671980$79354c80$@me.com> <001f01d42074$ad75a310$0860e930$@me.com> Message-ID: For the second issue, you need to tell vtk that the data has changed. Normally calling "scalars.modified();" should work (need to fix the mapper to detect that base on the array mtime). But it you call "this.imageData.modified();" you will be good. On Fri, Jul 20, 2018 at 3:57 PM Richard Frank wrote: > Ah, yes thanks that makes sense. > > > > Rick > > > > > > *From:* Sebastien Jourdain > *Sent:* Friday, July 20, 2018 5:54 PM > *To:* rickfrank at me.com > *Cc:* vtkusers at public.kitware.com > *Subject:* Re: [vtkusers] vtk.js image volume issues > > > > You need to disable those lines as your data is homogeneous. > > > > // this.actor.getProperty().setUseGradientOpacity(0, true); > > // this.actor.getProperty().setGradientOpacityMinimumValue(0, 15); > > // this.actor.getProperty().setGradientOpacityMinimumOpacity(0, > 0.0); > > // this.actor.getProperty().setGradientOpacityMaximumValue(0, 100); > > // this.actor.getProperty().setGradientOpacityMaximumOpacity(0, > 1.0); > > // this.actor.getProperty().setShade(true); > > > > On Fri, Jul 20, 2018 at 3:28 PM Richard Frank via vtkusers < > vtkusers at public.kitware.com> wrote: > > > > Hi, > > > > I?m creating a simple volume from vtkImageData using vtk.js. > > > > I create an empty 3d vtkImageData and set it up with a mapper and actor, > and add it to the renderer. > > > > I create a transfer function that has 0 = blue, 100 = red, 1000 = green. > > > > I?m trying to set pixels directly in the volume. > > > > There?s two problems ? > > > > The first is that when I click anywhere on the screen the volume > disappears?it shows on the first render call. > > > > I have a button that is used to trigger the voxel setting. This seems to > work only on the first slice of voxels, and the rest seem to not ?stick?. > > Regardless, however, the render call makes the volume disappear. > > > > My code is here: > > > > https://github.com/DominionSoftware/TestVolumeImage > > > > and can be built with the installation instructions like the other > examples (this was cribbed from an example). > > > > Anyone have any suggestions as to why the volume disappears, and / or ways > to debug this? > > > > > > Thanks, > > > > Rick > > > > > > > > _______________________________________________ > 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 alexander.woltersom at gmail.com Sat Jul 21 02:27:21 2018 From: alexander.woltersom at gmail.com (Alexander2) Date: Fri, 20 Jul 2018 23:27:21 -0700 (MST) Subject: [vtkusers] VTKBlender installation, VTK compile configurations Message-ID: <1532154441108-0.post@n5.nabble.com> Hi everyone, I am fairly new to VTK and I would like to ask some clarification on how to compile VTK to make it work with Blender. I am using Blender 2.79b which is using python 3.5.3. I am running everything on MacOS I found this very promising work by Chris Want, however it unfortunate that the GitHub page is somewhat vague on what settings are used while compiling and installing VTK. VTKBlender Github This is where I expect things to go wrong for me because my VTK_build folder does not contain a "/lib/python3.5/site-packages" folder. Even after I enable the "VTK_WRAP_PYTHON" configuration. I know that Blender has his own python interpreter and I have also tried to link the: PYTHON_EXECUTABLE to /Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5 PYTHON_INCLUDE_DIR to /Applications/Blender/blender.app/Contents/Resources/2.79/python/include/python3.5m PYTHON_LIBRARY to /Applications/Blender/blender.app/Contents/Resources/lib/libiomp5.dylib However without success, I was not able to configure it like that. I get errors like: CMake Error at CMake/FindPythonLibs.cmake:183 (FILE): FILE STRINGS file "/Applications/Blender/blender.app/Contents/Resources/2.79/python/include/python3.5m/patchlevel.h" cannot be read. I feel a little bit lost on what to do as there are so many parameters. Awaiting your suggestions and explanation, Alex -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From 523480317 at qq.com Sat Jul 21 04:08:42 2018 From: 523480317 at qq.com (=?ISO-8859-1?B?eWlydWkxMjEw?=) Date: Sat, 21 Jul 2018 16:08:42 +0800 Subject: [vtkusers] Data cannot transfer between different dll when link VTK in static mode Message-ID: Hello, I build VTK 8.0 in static mode in Windows 10, VS2015, and I write a simple demo which has two dll modules. The data is transferred as following: (1) read data in module 1 and save it, this is no problem. (2) transfer the data in module 1 to module 2. (3) write the data in module 2, but there is error, the saved data is empty. I have traced the code in VTK roughly, the image extent is [0, -1, 0, -1, 0, -1], but I can retrieve the pixel, the pixel value can be get correctly. The demo code I used is attached in this email, any help or tips will be appreciated, thank you! Regards, Yirui -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: demo_link_vtk_in_static_mode.zip Type: application/octet-stream Size: 230881 bytes Desc: not available URL: From juch at zhaw.ch Sat Jul 21 06:07:25 2018 From: juch at zhaw.ch (normanius) Date: Sat, 21 Jul 2018 03:07:25 -0700 (MST) Subject: [vtkusers] How to traverse lines of a polyline in reversed order? In-Reply-To: References: <1531907409886-0.post@n5.nabble.com> <1532077825876-0.post@n5.nabble.com> Message-ID: <1532167645746-0.post@n5.nabble.com> Cool, this is working indeed! Many thanks for the idea. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From rccm.kyoshimi at gmail.com Sat Jul 21 10:39:14 2018 From: rccm.kyoshimi at gmail.com (kenichiro yoshimi) Date: Sat, 21 Jul 2018 23:39:14 +0900 Subject: [vtkusers] Data cannot transfer between different dll when link VTK in static mode In-Reply-To: References: Message-ID: Hello Yirui, I think the problem is caused by the missing information relating to the pipeline and hence WHOLE_EXTENT. Therefore in Function2WriteImage function, you need to explicitly create vtkTrivialProducer to pass the WHOLE_EXTENT to the writer below. void Function2WriteImage(vtkSmartPointer data) { int ext[6]; data->GetExtent(ext); vtkSmartPointer producer = vtkSmartPointer::New(); producer->SetOutput(data); producer->SetWholeExtent(ext); std::cout << "Write image using function2.dll" << std::endl; vtkSmartPointer writer = vtkSmartPointer::New(); writer->SetFileName("./function2_write_image.mha"); writer->SetInputConnection(producer->GetOutputPort()); try { writer->Write(); } catch (...) { std::cout << "function 2 write image error." << std::endl; return; } } Regards 2018?7?21?(?) 17:16 yirui1210 <523480317 at qq.com>: > > Hello, > > I build VTK 8.0 in static mode in Windows 10, VS2015, and I write a simple demo which has two dll modules. The data is transferred as following: > (1) read data in module 1 and save it, this is no problem. > (2) transfer the data in module 1 to module 2. > (3) write the data in module 2, but there is error, the saved data is empty. > I have traced the code in VTK roughly, the image extent is [0, -1, 0, -1, 0, -1], but I can retrieve the pixel, the pixel value can be get correctly. The demo code I used is attached in this email, any help or tips will be appreciated, thank you! > > Regards, > Yirui > _______________________________________________ > 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 cjwant at gmail.com Sat Jul 21 16:58:14 2018 From: cjwant at gmail.com (Chris Want) Date: Sat, 21 Jul 2018 14:58:14 -0600 Subject: [vtkusers] VTKBlender installation, VTK compile configurations In-Reply-To: <1532154441108-0.post@n5.nabble.com> References: <1532154441108-0.post@n5.nabble.com> Message-ID: Hi Alex, My apologies, I don't use OSX, so my ability to help will be limited. I suspect that you will need to get python 3.5.3 for OSX from the python project, and use the headers and libraries from there: https://www.python.org/downloads/release/python-353/ The python library that ships with Blender does not have the full headers/libraries (e.g., on Linux, the only header that comes with blender is pyconfig.h). Regards, Chris On 21 July 2018 at 00:27, Alexander2 wrote: > Hi everyone, > > I am fairly new to VTK and I would like to ask some clarification on how to > compile VTK to make it work with Blender. I am using Blender 2.79b which is > using python 3.5.3. I am running everything on MacOS > I found this very promising work by Chris Want, however it unfortunate that > the GitHub page is somewhat vague on what settings are used while compiling > and installing VTK. > VTKBlender Github > This is where I expect things to go wrong for me because my VTK_build folder > does not contain a "/lib/python3.5/site-packages" folder. Even after I > enable the "VTK_WRAP_PYTHON" configuration. > I know that Blender has his own python interpreter and I have also tried to > link the: > PYTHON_EXECUTABLE to > /Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5 > PYTHON_INCLUDE_DIR to > /Applications/Blender/blender.app/Contents/Resources/2.79/python/include/python3.5m > PYTHON_LIBRARY to > /Applications/Blender/blender.app/Contents/Resources/lib/libiomp5.dylib > > However without success, I was not able to configure it like that. > I get errors like: > CMake Error at CMake/FindPythonLibs.cmake:183 (FILE): > FILE STRINGS file > > "/Applications/Blender/blender.app/Contents/Resources/2.79/python/include/python3.5m/patchlevel.h" > cannot be read. > > I feel a little bit lost on what to do as there are so many parameters. > > Awaiting your suggestions and explanation, > Alex > > > > -- > 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 alexander.woltersom at gmail.com Sat Jul 21 20:30:01 2018 From: alexander.woltersom at gmail.com (Alexander2) Date: Sat, 21 Jul 2018 17:30:01 -0700 (MST) Subject: [vtkusers] VTKBlender installation, VTK compile configurations In-Reply-To: References: <1532154441108-0.post@n5.nabble.com> Message-ID: <1532219401502-0.post@n5.nabble.com> Hi Chris, Thanks for the quick reply. I also have an Ubuntu Box available if that makes life easier. It will be a good idea to get it working on linux first after which I will take a look at OSX and see what I can do there. I am happy to document my findings for anyone interested in the future! On linux do you also have to download the appropriate python version from the python project website to get the headers and libraries? Or is this a non-issue on linux? When running ccmake, are you able to tell me what your parameters in configuration on linux are? I am quite new to this, however I am suite sure we can figure this out. With Kindest regards, Alex -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From vjblog_info at yahoo.com Sat Jul 21 21:28:19 2018 From: vjblog_info at yahoo.com (terminator) Date: Sat, 21 Jul 2018 18:28:19 -0700 (MST) Subject: [vtkusers] reasons of limitations on opacity per component and up to 4 components in label-map volume rendering? In-Reply-To: References: <1528679386409-0.post@n5.nabble.com> <1528860138781-0.post@n5.nabble.com> <1528973440861-0.post@n5.nabble.com> Message-ID: <1532222899652-0.post@n5.nabble.com> Could you please let me know your opinion about the previous post? Can anyone explain the problem? Is it a bug in VTK? -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From 523480317 at qq.com Sun Jul 22 09:15:56 2018 From: 523480317 at qq.com (=?gb18030?B?eWlydWkxMjEw?=) Date: Sun, 22 Jul 2018 21:15:56 +0800 Subject: [vtkusers] =?gb18030?b?u9i4tKO6ICBEYXRhIGNhbm5vdCB0cmFuc2ZlciBi?= =?gb18030?q?etween_different_dll_when_linkVTK_in_static_mode?= In-Reply-To: References: Message-ID: Hello Yoshimi, Thank you so much, it works! Regards, Yirui ------------------ ???? ------------------ ???: "kenichiro yoshimi"; ????: 2018?7?21?(???) ??10:39 ???: "yirui1210"<523480317 at qq.com>; ??: "vtkusers"; ??: Re: [vtkusers] Data cannot transfer between different dll when linkVTK in static mode Hello Yirui, I think the problem is caused by the missing information relating to the pipeline and hence WHOLE_EXTENT. Therefore in Function2WriteImage function, you need to explicitly create vtkTrivialProducer to pass the WHOLE_EXTENT to the writer below. void Function2WriteImage(vtkSmartPointer data) { int ext[6]; data->GetExtent(ext); vtkSmartPointer producer = vtkSmartPointer::New(); producer->SetOutput(data); producer->SetWholeExtent(ext); std::cout << "Write image using function2.dll" << std::endl; vtkSmartPointer writer = vtkSmartPointer::New(); writer->SetFileName("./function2_write_image.mha"); writer->SetInputConnection(producer->GetOutputPort()); try { writer->Write(); } catch (...) { std::cout << "function 2 write image error." << std::endl; return; } } Regards 2018?7?21?(?) 17:16 yirui1210 <523480317 at qq.com>: > > Hello, > > I build VTK 8.0 in static mode in Windows 10, VS2015, and I write a simple demo which has two dll modules. The data is transferred as following: > (1) read data in module 1 and save it, this is no problem. > (2) transfer the data in module 1 to module 2. > (3) write the data in module 2, but there is error, the saved data is empty. > I have traced the code in VTK roughly, the image extent is [0, -1, 0, -1, 0, -1], but I can retrieve the pixel, the pixel value can be get correctly. The demo code I used is attached in this email, any help or tips will be appreciated, thank you! > > Regards, > Yirui > _______________________________________________ > 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 cjwant at gmail.com Sun Jul 22 11:51:24 2018 From: cjwant at gmail.com (Chris Want) Date: Sun, 22 Jul 2018 09:51:24 -0600 Subject: [vtkusers] VTKBlender installation, VTK compile configurations In-Reply-To: <1532219401502-0.post@n5.nabble.com> References: <1532154441108-0.post@n5.nabble.com> <1532219401502-0.post@n5.nabble.com> Message-ID: Hi Alex, I haven't run VTKBlender on Ubuntu for a while as there are some issues with the current release of Ubuntu 18.04: the available Python versions are Python 3.6 or 3.7, but current Blender uses Python 3.5. If you aren't running the latest Ubuntu, you may not have this issue, but assuming you are also on 18.04, there are a couple of ways around this: 1) There is a (non-official) Ubuntu repository for older python versions where you could get Python 3.5: https://askubuntu.com/questions/682869/how-do-i-install-a-different-python-version-using-apt-get 2) There are downloads for the Blender beta version 2.80 which uses Python 3.6: https://builder.blender.org/download (although I haven't tried this, with this option, you might not need to build VTK as the Ubuntu packages should work with Python 3.6) 3) Build your own Blender or Python My most recent VTK build on Ubuntu, I have the following CMakeCache.txt: https://drive.google.com/open?id=12t3rqpKGQZGzBfHnRFoLiwkNF6eP7pe8 (Although you won't be able to use this file directly, it might help you debug). Regards, Chris On 21 July 2018 at 18:30, Alexander2 wrote: > Hi Chris, > > Thanks for the quick reply. > I also have an Ubuntu Box available if that makes life easier. > It will be a good idea to get it working on linux first after which I will > take a look at OSX and see what I can do there. I am happy to document my > findings for anyone interested in the future! > > On linux do you also have to download the appropriate python version from > the python project website to get the headers and libraries? Or is this a > non-issue on linux? > > When running ccmake, are you able to tell me what your parameters in > configuration on linux are? > I am quite new to this, however I am suite sure we can figure this out. > > With Kindest regards, > Alex > > > > -- > 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 stefan.neumann at tuhh.de Sun Jul 22 12:57:39 2018 From: stefan.neumann at tuhh.de (StevenNew) Date: Sun, 22 Jul 2018 09:57:39 -0700 (MST) Subject: [vtkusers] General question to usage of VTK Message-ID: <1532278659023-0.post@n5.nabble.com> Hi, I'm also really new to the VTK and generally to the software development with libraries. I have a question, that I already researched on, but I couldn't find pleasing answers and therefore I wanted to ask here: I want to make an application that can read STL files and point clouds. Importing the STL files is no problem, but for the point clouds it would be nice if I could import .pcd files, which is a file format from the PointCloudLibrary, if I'm right. Is there a way to convert .pcd files to .ply or .stl ? An answer on this topic by real vtk-users would be so helpful. Thank you. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From rickfrank at me.com Sun Jul 22 13:32:27 2018 From: rickfrank at me.com (Richard Frank) Date: Sun, 22 Jul 2018 13:32:27 -0400 Subject: [vtkusers] does vtk.js support multiple image volumes in the same renderer? Message-ID: <002001d421e1$f6d046f0$e470d4d0$@me.com> I add a second volume and the first disappears.. Thanks Rick -------------- next part -------------- An HTML attachment was scrubbed... URL: From mey1k at naver.com Sun Jul 22 19:37:43 2018 From: mey1k at naver.com (minjun) Date: Sun, 22 Jul 2018 16:37:43 -0700 (MST) Subject: [vtkusers] can i use custom cursor in vtkSliderWidget? Message-ID: <1532302663878-0.post@n5.nabble.com> hi, i'm beginner dev.. can i use custom cursor in vtkSliderWidget? Please, help me. thanks for reading, :) -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From vacingforo at gmail.com Mon Jul 23 03:01:11 2018 From: vacingforo at gmail.com (vacingforo) Date: Mon, 23 Jul 2018 00:01:11 -0700 (MST) Subject: [vtkusers] vtkImageData: Is it possible to define array VTK_BIT(image->AllocateScalars) instead of VTK_UNSIGNED_CHAR to mask a polydata? Message-ID: <1532329271833-0.post@n5.nabble.com> Hello, I have the following code : vtkSmartPointer image = vtkSmartPointer::New(); image->SetSpacing(spacing); image->SetDimensions(dim); image->SetExtent(-1, dim[0] + 1, -1 , dim[1] + 1, 0, dim[2] - 1); image->SetOrigin(origin); image->AllocateScalars(VTK_UNSIGNED_CHAR, 1); vtkIdType count = image->GetNumberOfPoints(); for (vtkIdType i = 0; i < count; ++i) { image->GetPointData()->GetScalars()->SetTuple1(i, white); } Is it possible to define array VTK_BIT(image->AllocateScalars) instead of VTK_UNSIGNED_CHAR to mask a polydata?. This is in order to reduce the size of matrix. for more details check small application main.cpp in the following link: https://drive.google.com/file/d/1FBnJw96zz5uv33uh_GYV71OAT05NngOR/view?usp=sharing Best regards, Sergio -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From ken.martin at kitware.com Mon Jul 23 09:15:09 2018 From: ken.martin at kitware.com (Ken Martin) Date: Mon, 23 Jul 2018 09:15:09 -0400 Subject: [vtkusers] ParaView Glance (vtk.js) Message-ID: I'm happy to announce a new visualization application called ParaView Glance. Some of you may have already heard of it from the recent blog post https://blog.kitware.com/kitware-releases-paraview-glance- an-advanced-in-browser-data-viewer/ ParaView Glance is an open source web based visualization application built on top of the JavaScript library vtk.js. As this is its first release, its feature set is still limited, but we think it shows significant promise in terms of web based visualization. If you have developed in VTK or used ParaView many of the concepts and terms will be familiar to you. The source code can be found at https://github.com/Kitware/paraview-glance and you can try the application out at https://kitware.github.io/paraview-glance/app/ As always thanks to NIH, DOE, DOD and our commercial sponsors whose support of open source platforms makes this possible. Thanks! Ken -- 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: -------------- next part -------------- A non-text attachment was scrubbed... Name: image.png Type: image/png Size: 613603 bytes Desc: not available URL: From dan.lipsa at kitware.com Mon Jul 23 11:37:47 2018 From: dan.lipsa at kitware.com (Dan Lipsa) Date: Mon, 23 Jul 2018 11:37:47 -0400 Subject: [vtkusers] vtkImageData: Is it possible to define array VTK_BIT(image->AllocateScalars) instead of VTK_UNSIGNED_CHAR to mask a polydata? In-Reply-To: <1532329271833-0.post@n5.nabble.com> References: <1532329271833-0.post@n5.nabble.com> Message-ID: No, it needs to be an unsigned char. This is because different bits from that unsigned char are used for different things. https://blog.kitware.com/ghost-and-blanking-visibility-changes/ On Mon, Jul 23, 2018 at 3:01 AM vacingforo wrote: > Hello, > > I have the following code : > > vtkSmartPointer image = > vtkSmartPointer::New(); > image->SetSpacing(spacing); > image->SetDimensions(dim); > image->SetExtent(-1, dim[0] + 1, -1 , dim[1] + 1, 0, dim[2] - 1); > image->SetOrigin(origin); > image->AllocateScalars(VTK_UNSIGNED_CHAR, 1); > > vtkIdType count = image->GetNumberOfPoints(); > for (vtkIdType i = 0; i < count; ++i) > { > image->GetPointData()->GetScalars()->SetTuple1(i, white); > } > > Is it possible to define array VTK_BIT(image->AllocateScalars) instead of > VTK_UNSIGNED_CHAR to mask a polydata?. This is in order to reduce the size > of matrix. > > for more details check small application main.cpp in the > following link: > > > > https://drive.google.com/file/d/1FBnJw96zz5uv33uh_GYV71OAT05NngOR/view?usp=sharing > > > Best regards, > > Sergio > > > > -- > 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 dan.lipsa at kitware.com Mon Jul 23 11:45:51 2018 From: dan.lipsa at kitware.com (Dan Lipsa) Date: Mon, 23 Jul 2018 11:45:51 -0400 Subject: [vtkusers] General question to usage of VTK In-Reply-To: <1532278659023-0.post@n5.nabble.com> References: <1532278659023-0.post@n5.nabble.com> Message-ID: VTK supports pdal which is able to read .pcd. So you could load your file using vtkPDALReader - no need for conversions. You'll need to recompile VTK and enable Module_vtkIOPDAL to enable that functionality. Dan On Sun, Jul 22, 2018 at 12:57 PM StevenNew wrote: > Hi, > > I'm also really new to the VTK and generally to the software development > with libraries. > I have a question, that I already researched on, but I couldn't find > pleasing answers and therefore I wanted to ask here: > > I want to make an application that can read STL files and point clouds. > Importing the STL files is no problem, but for the point clouds it would be > nice if I could import .pcd files, which is a file format from the > PointCloudLibrary, if I'm right. > Is there a way to convert .pcd files to .ply or .stl ? > > An answer on this topic by real vtk-users would be so helpful. > > Thank you. > > > > -- > 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 shayan.moradkhani at gmail.com Tue Jul 24 03:21:46 2018 From: shayan.moradkhani at gmail.com (shayan moradkhani) Date: Tue, 24 Jul 2018 00:21:46 -0700 (MST) Subject: [vtkusers] 3D transformation using slider Message-ID: <1532416906628-0.post@n5.nabble.com> hi, I am trying to use slider to transform a 3D object in space with the help of "sphere resolution example". I tried to replicate the same approach, but i couldn't connect the slider callback to the transformation. any help would be appreciated Shayan -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From rocio.lopez at upf.edu Tue Jul 24 05:55:25 2018 From: rocio.lopez at upf.edu (LOPEZ VELAZCO, ROCIO) Date: Tue, 24 Jul 2018 11:55:25 +0200 Subject: [vtkusers] Customized interactor in vtk 8.1 Message-ID: Hello all, I am developing an application based in MITK which uses vtk. I am migrating now the app from vtk 7 to vtk 8.1. I have found a problem with respect changing the render window interactor style to a customized one. It worked perfectly in vtk 7, however now it does not apply the new style. The code is the same: m_renderWindowInteractor = m_simulation_3D_right->GetVtkRenderWindow()-> GetInteractor(); vtkNew style; m_renderWindowInteractor->SetInteractorStyle(style); Where m_renderWindowInteractor is vtkSmartPointer I created my customize style following this example . Now, using vtk 8.1 it compiles and gives no error but it does not work, it does not apply my custom style... Should I take something new into account? Any help will be very welcome! Thank you very much in advance. Best regards, -- Roc?o L?pez Velazco *SimbioSYS** group, BCN MedTech* *UniversityPompeu Fabra* *Department of Information and Communication Technologies Roc Boronat, 122 (T?nger Building), 08018 Barcelona Office 55 119 https://bcn-medtech.upf.edu/ * -------------- next part -------------- An HTML attachment was scrubbed... URL: From Zoltan.Kovacs at esi-group.com Tue Jul 24 11:23:43 2018 From: Zoltan.Kovacs at esi-group.com (Zoltan Kovacs) Date: Tue, 24 Jul 2018 15:23:43 +0000 Subject: [vtkusers] Updating color scale for glypsh. Message-ID: Dear all, I fail to update the lookup table for a VTU file particle data visualized by sphere glyphs. The VTU file contains the fields "Radii" and "Mass" with the particle coordinates. I use the following code to set up the color scale for the particles with coloring based on the field "Radii": vtkSmartPointer reader; vtkSmartPointer mapper; vtkSmartPointer actor; vtkSmartPointer glyph; vtkSmartPointer scalarBar; vtkSmartPointer lookupTable; vtkSmartPointer sphere; reader = vtkSmartPointer::New(); mapper = vtkSmartPointer::New(); actor = vtkSmartPointer::New(); sphere = vtkSmartPointer::New(); glyph = vtkSmartPointer::New(); lookupTable = vtkSmartPointer::New(); scalarBar = vtkSmartPointer::New(); reader->SetFileName(fileNameStdStr.c_str()); reader->Update(); reader->GetOutput()->GetPointData()->SetActiveScalars("Radii"); reader->GetOutput()->GetPointData()->GetScalars()->GetRange(range); // lookup table lookupTable->SetTableRange(range[0], range[1]); lookupTable->SetHueRange(0.6667, 0.0); lookupTable->SetSaturationRange(1, 1); lookupTable->SetValueRange(1, 1); lookupTable->Build(); scalarBar->SetTitle("Radii"); scalarBar->SetNumberOfLabels(4); // initialize shpere source amd glyphs sphere->SetThetaResolution(10); sphere->SetPhiResolution(10); sphere->Update(); glyph->SetScaleModeToScaleByScalar(); glyph->SetScaleFactor(2.0); // connect the output of the VTU file reader and the sphere source and to the glyps glyph->SetInputConnection(reader->GetOutputPort()); glyph->SetSourceConnection(sphere->GetOutputPort()); glyph->Update(); mapper->SetInputConnection(glyph->GetOutputPort()); mapper->ScalarVisibilityOn(); mapper->SetColorModeToMapScalars(); mapper->SetScalarRange(lookupTable->GetTableRange()); mapper->SetLookupTable(lookupTable); mapper->Update(); This works well, as seen on in the picture snapshot1.png. However when I modify the lookup table by setting to the field "Mass" I can only update the color bar but the color scale for the particles remains the same and the colors of the particles become out of range. The picture snapshot2.png shows this behavior. The code for the modification of the color scale repeating the original setup is the following: readerVTU->GetOutput()->GetPointData()->SetActiveScalars("Mass"); readerVTU->GetOutput()->GetPointData()->GetScalars()->GetRange(range); lookupTable->SetTableRange(range[0], range[1]); lookupTable->SetHueRange(0.6667, 0.0); lookupTable->SetSaturationRange(1, 1); lookupTable->SetValueRange(1, 1); lookupTable->Modified(); scalarBar->SetTitle("Mass"); mapper->ScalarVisibilityOn(); mapper->SetColorModeToMapScalars(); mapper->SetScalarRange(lookupTable->GetTableRange()); mapper->SetLookupTable(lookupTable); mapper->Update(); I guess something is missing from the update and someone may know what is needed to the proper update of the particle color scale. Thanks a lot. Kind regards, Zoltan -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: snapshot1.png Type: image/png Size: 191133 bytes Desc: snapshot1.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: snapshot2.png Type: image/png Size: 132705 bytes Desc: snapshot2.png URL: From qyaoza at gmail.com Tue Jul 24 13:57:42 2018 From: qyaoza at gmail.com (ling Hai) Date: Tue, 24 Jul 2018 13:57:42 -0400 Subject: [vtkusers] How to get the framebuffer Message-ID: Hi, I am new to vtk and I am trying to get the front framebuffer from the renderwindow like this: int * dim = renderWindow->GetSize(); unsigned char* pixels = renderWindow->GetPixelData(0,0,dim[0]-1,dim[1]-1,true); but in pixels there is only a null value. I am using this on a 3d render if that makes a difference the above segment of code called after rendering the volume. What am I missing? Any help is appreciated thanks. Linghai -------------- next part -------------- An HTML attachment was scrubbed... URL: From castellanoslizan at gmail.com Tue Jul 24 15:10:01 2018 From: castellanoslizan at gmail.com (Lizeth Castellanos) Date: Tue, 24 Jul 2018 16:10:01 -0300 Subject: [vtkusers] Copy image data into vtkImageData from a textfile In-Reply-To: References: Message-ID: Thanks for your help Kenichiro Yoshimi I was able to reproduce some part of your code. However, I encountered new issues. 1)I have all my project under VTK 5.10.1 with python 2.7.12 in linux. I got this error: 'module' object has no attribute 'vtkResampleToImage'. So I guess that the vtkResampleToImage class is not avaliable for my VTK version. I tried to build a newer VTK version but I didn't get success. I tried with VTK 7.1.1 and I got errors related to the python libs Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS). 2) I read that vtkResampleToImage samples a dataset on a uniform grid and it internally uses vtkProbeFilter to do the probing. So, Is there any way to use vtkProbeFilter instead of vtkResampleToImage? I have tested some examples from vtkProbeFilter but I am confused about how use it in my specific problem. Thanks, Lizeth On Thu, Jul 19, 2018 at 12:38 AM, kenichiro yoshimi wrote: > Hi Lizeth, > > Because vtkDelimitedTextReader outputs a vtkTable, you firstly need to > convert it to a vtkPolyData using vtkTableToPolyData. And then you can > use vtkResampleToImage to map the polyData to vtkImageData. > > ---sample.csv--- > 0 0 0 60.7635 > 1 0 0 107.555 > 2 0 0 80.5241 > 0 1 0 85.9694 > 1 1 0 156.706 > 2 1 0 105.73 > 0 2 0 37.3531 > 1 2 0 84.1445 > 2 2 0 57.1137 > 0 0 1 100.634 > 1 0 1 171.37 > 2 0 1 120.395 > 0 1 1 149.785 > 1 1 1 260 > 2 1 1 169.546 > 0 2 1 77.2238 > 1 2 1 147.96 > 2 2 1 96.9844 > 0 0 2 60.7635 > 1 0 2 107.555 > 2 0 2 80.5241 > 0 1 2 85.9694 > 1 1 2 156.706 > 2 1 2 105.73 > 0 2 2 37.3531 > 1 2 2 84.1445 > 2 2 2 57.1137 > > --- > import vtk > > > def main(): > colors = vtk.vtkNamedColors() > > reader = vtk.vtkDelimitedTextReader() > reader.SetFileName('sample.csv') > reader.DetectNumericColumnsOn() > reader.SetFieldDelimiterCharacters(' ') > reader.MergeConsecutiveDelimitersOn() > > tableToPoints = vtk.vtkTableToPolyData() > tableToPoints.SetInputConnection(reader.GetOutputPort()) > tableToPoints.SetXColumn('Field 0') > tableToPoints.SetYColumn('Field 1') > tableToPoints.SetZColumn('Field 2') > > resample = vtk.vtkResampleToImage() > resample.SetInputConnection(tableToPoints.GetOutputPort()) > resample.SetSamplingDimensions(3, 3, 3) > resample.Update() > > scalar = resample.GetOutput().GetPointData().GetArray('Field 3') > resample.GetOutput().GetPointData().SetScalars(scalar) > > writer = vtk.vtkMetaImageWriter() > writer.SetInputData(resample.GetOutput()) > writer.SetFileName('out.mha') > writer.SetCompression(True) > writer.Write() > > > if __name__ == '__main__': > main() > --- > > Best > 2018?7?19?(?) 3:43 Lizeth Castellanos : > > > > Hi! > > > > I'd like to copy image data from a textfile (csv) into vtkImageData. > > The textfile have voxel values for x,y,z and image intensity. I already > have read the textfile into VTK with the vtkDelimitedTextReader class: > > > > Table loaded from CSV file: > > +-----------+-----------+-----------+------------+ > > | Field 0 | Field 1 | Field 2 | Field 3 | > > +-----------+-----------+-----------+------------+ > > | 510 | 291 | 0 | 32 | > > | 511 | 291 | 0 | 128 | > > | 510 | 292 | 0 | 104 | > > | 511 | 292 | 0 | 104 | > > | 510 | 293 | 0 | 40 | > > | 511 | 293 | 0 | 240 | > > | 510 | 294 | 0 | 104 | > > | 511 | 294 | 0 | 96 | > > | 506 | 295 | 0 | 64 | > > | 507 | 295 | 0 | 16 | > > ..... > > ..... > > The file is an exported segmented dataset. > > > > I am following the tips from this similar question > http://vtk.1045678.n5.nabble.com/importing-image-data-into-V > TK-from-textfile-mimics-td1243332.html > > I have created an appropriate vtkimagedata (volume): > > > > imageData = vtk.vtkImageData() > > imageData.SetDimensions(512, 512, 192) > > imageData.SetOrigin(0.0, 0.0, 0.0) > > imageData.SetSpacing(1, 1, 1) > > imageData.SetNumberOfScalarComponents(1) > > imageData.Update() > > > > However I don't know how to copy the data loaded from > vtkDelimitedTextReader into vtkImageData. How do I copy the x,y,z voxel > values into vtkImageData? How do I copy the intensity valuesVtkImageData? > > > > Any help provided for this would be greatly appreciated! > > > > Lizeth > > > > > > _______________________________________________ > > 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 mey1k at naver.com Tue Jul 24 20:44:25 2018 From: mey1k at naver.com (minjun) Date: Tue, 24 Jul 2018 17:44:25 -0700 (MST) Subject: [vtkusers] vtkSliderWidget subclassing Message-ID: <1532479465899-0.post@n5.nabble.com> hello, i want to show mouse cursor(VTK_CURSOR_HAND) at hovering vtkSliderWidget below shows what I want to do. // vtkButtonWidget.cxx void vtkButtonWidget::MoveAction(vtkAbstractWidget *w) { vtkButtonWidget *self = reinterpret_cast(w); int X = self->Interactor->GetEventPosition()[0]; int Y = self->Interactor->GetEventPosition()[1]; // Motion while selecting is ignored if ( self->WidgetState == vtkButtonWidget::Selecting ) { self->EventCallbackCommand->SetAbortFlag(1); return; } // Get the new state and compare it to the old int renderRequired = 0; int state = self->WidgetRep->ComputeInteractionState(X, Y); if ( self->WidgetState == vtkButtonWidget::Hovering ) { if ( state == vtkButtonRepresentation::Outside ) { renderRequired = 1; if ( self->ManagesCursor ) { self->RequestCursorShape(VTK_CURSOR_DEFAULT); } self->WidgetRep->Highlight(vtkButtonRepresentation::HighlightNormal); self->WidgetState = vtkButtonWidget::Start; } } else //state is Start { if ( state == vtkButtonRepresentation::Inside ) { renderRequired = 1; if ( self->ManagesCursor ) { self->RequestCursorShape(VTK_CURSOR_HAND); } self->WidgetRep->Highlight(vtkButtonRepresentation::HighlightHovering); self->WidgetState = vtkButtonWidget::Hovering; self->EventCallbackCommand->SetAbortFlag(1); } } if ( renderRequired ) { self->Render(); } } I got an idea here, I want to show the mouse cursor by modifying below code(vtkSliderWidet.cxx) void vtkSliderWidget::MoveAction(vtkAbstractWidget *w) { vtkSliderWidget *self = reinterpret_cast(w); // See whether we're active if ( self->WidgetState == vtkSliderWidget::Start || self->WidgetState == vtkSliderWidget::Animating ) { return; } // Definitely moving the slider, get the updated position double eventPos[2]; eventPos[0] = self->Interactor->GetEventPosition()[0]; eventPos[1] = self->Interactor->GetEventPosition()[1]; self->WidgetRep->WidgetInteraction(eventPos); // Interact, if desired self->EventCallbackCommand->SetAbortFlag(1); self->InvokeEvent(vtkCommand::InteractionEvent,NULL); self->Render(); } To use modified code, I think I should use subclassing. But after modifying the code, I don't know how to apply it. //vtkSliderWidget.cxx vtkSliderWidget::vtkSliderWidget() { // Set the initial state this->WidgetState = vtkSliderWidget::Start; // Assign initial values this->AnimationMode = vtkSliderWidget::Jump; this->NumberOfAnimationSteps = 24; // Okay, define the events this->CallbackMapper->SetCallbackMethod(vtkCommand::LeftButtonPressEvent, vtkWidgetEvent::Select, this, vtkSliderWidget::SelectAction); this->CallbackMapper->SetCallbackMethod(vtkCommand::MouseMoveEvent, vtkWidgetEvent::Move, this, vtkSliderWidget::MoveAction); this->CallbackMapper->SetCallbackMethod(vtkCommand::LeftButtonReleaseEvent, vtkWidgetEvent::EndSelect, this, vtkSliderWidget::EndSelectAction); } i'm now use callback event as below vtkSmartPointer callback = vtkSmartPointer::New(); AddObserver(vtkCommand::InteractionEvent, callback); But I want to know how to call the modified moveAction event. If you have an idea about this issue, I would like help. Thanks for reading. :) -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From rccm.kyoshimi at gmail.com Tue Jul 24 22:29:00 2018 From: rccm.kyoshimi at gmail.com (kenichiro yoshimi) Date: Wed, 25 Jul 2018 11:29:00 +0900 Subject: [vtkusers] Copy image data into vtkImageData from a textfile In-Reply-To: References: Message-ID: Hi, 1) You need to specify PYTHON_INCLUDE_DIR and PYTHON_LIBRARY to suit your own system in the 'advanced options' in cmake. PYTHON_INCLUDE_DIR will be the name of the directory containing the Python.h: e.g. /usr/include/python2.7 PYTHON_LIBRARY will be the full path to libpython2.7.so (or.a): e.g. /usr/lib64/libpython2.7.so 2) For example, if you apply vtkProbeFilter to sample.csv in the previous my post, script is something like below. --- import vtk def main(): reader = vtk.vtkDelimitedTextReader() reader.SetFileName('sample.csv') reader.DetectNumericColumnsOn() reader.SetFieldDelimiterCharacters(' ') reader.MergeConsecutiveDelimitersOn() tableToPoints = vtk.vtkTableToPolyData() tableToPoints.SetInputConnection(reader.GetOutputPort()) tableToPoints.SetXColumn('Field 0') tableToPoints.SetYColumn('Field 1') tableToPoints.SetZColumn('Field 2') imageData = vtk.vtkImageData() imageData.SetDimensions(3, 3, 3) imageData.SetOrigin(0.0, 0.0, 0.0) imageData.SetSpacing(1.0, 1.0, 1.0) probeFilter = vtk.vtkProbeFilter() probeFilter.SetSourceConnection(tableToPoints.GetOutputPort()) probeFilter.SetInputData(imageData) probeFilter.Update() writer = vtk.vtkXMLImageDataWriter() writer.SetInputData(probeFilter.GetOutput()) writer.SetFileName('out.vti') writer.Write() if __name__ == '__main__': main() --- For your reference. 2018?7?25?(?) 4:10 Lizeth Castellanos : > > Thanks for your help Kenichiro Yoshimi > > I was able to reproduce some part of your code. However, I encountered new issues. > > 1)I have all my project under VTK 5.10.1 with python 2.7.12 in linux. I got this error: 'module' object has no attribute 'vtkResampleToImage'. > So I guess that the vtkResampleToImage class is not avaliable for my VTK version. > I tried to build a newer VTK version but I didn't get success. I tried with VTK 7.1.1 and I got errors related to the python libs Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS). > > 2) I read that vtkResampleToImage samples a dataset on a uniform grid and it internally uses vtkProbeFilter to do the probing. So, Is there any way to use vtkProbeFilter instead of vtkResampleToImage? > I have tested some examples from vtkProbeFilter but I am confused about how use it in my specific problem. > > Thanks, > > Lizeth > > On Thu, Jul 19, 2018 at 12:38 AM, kenichiro yoshimi wrote: >> >> Hi Lizeth, >> >> Because vtkDelimitedTextReader outputs a vtkTable, you firstly need to >> convert it to a vtkPolyData using vtkTableToPolyData. And then you can >> use vtkResampleToImage to map the polyData to vtkImageData. >> >> ---sample.csv--- >> 0 0 0 60.7635 >> 1 0 0 107.555 >> 2 0 0 80.5241 >> 0 1 0 85.9694 >> 1 1 0 156.706 >> 2 1 0 105.73 >> 0 2 0 37.3531 >> 1 2 0 84.1445 >> 2 2 0 57.1137 >> 0 0 1 100.634 >> 1 0 1 171.37 >> 2 0 1 120.395 >> 0 1 1 149.785 >> 1 1 1 260 >> 2 1 1 169.546 >> 0 2 1 77.2238 >> 1 2 1 147.96 >> 2 2 1 96.9844 >> 0 0 2 60.7635 >> 1 0 2 107.555 >> 2 0 2 80.5241 >> 0 1 2 85.9694 >> 1 1 2 156.706 >> 2 1 2 105.73 >> 0 2 2 37.3531 >> 1 2 2 84.1445 >> 2 2 2 57.1137 >> >> --- >> import vtk >> >> >> def main(): >> colors = vtk.vtkNamedColors() >> >> reader = vtk.vtkDelimitedTextReader() >> reader.SetFileName('sample.csv') >> reader.DetectNumericColumnsOn() >> reader.SetFieldDelimiterCharacters(' ') >> reader.MergeConsecutiveDelimitersOn() >> >> tableToPoints = vtk.vtkTableToPolyData() >> tableToPoints.SetInputConnection(reader.GetOutputPort()) >> tableToPoints.SetXColumn('Field 0') >> tableToPoints.SetYColumn('Field 1') >> tableToPoints.SetZColumn('Field 2') >> >> resample = vtk.vtkResampleToImage() >> resample.SetInputConnection(tableToPoints.GetOutputPort()) >> resample.SetSamplingDimensions(3, 3, 3) >> resample.Update() >> >> scalar = resample.GetOutput().GetPointData().GetArray('Field 3') >> resample.GetOutput().GetPointData().SetScalars(scalar) >> >> writer = vtk.vtkMetaImageWriter() >> writer.SetInputData(resample.GetOutput()) >> writer.SetFileName('out.mha') >> writer.SetCompression(True) >> writer.Write() >> >> >> if __name__ == '__main__': >> main() >> --- >> >> Best >> 2018?7?19?(?) 3:43 Lizeth Castellanos : >> > >> > Hi! >> > >> > I'd like to copy image data from a textfile (csv) into vtkImageData. >> > The textfile have voxel values for x,y,z and image intensity. I already have read the textfile into VTK with the vtkDelimitedTextReader class: >> > >> > Table loaded from CSV file: >> > +-----------+-----------+-----------+------------+ >> > | Field 0 | Field 1 | Field 2 | Field 3 | >> > +-----------+-----------+-----------+------------+ >> > | 510 | 291 | 0 | 32 | >> > | 511 | 291 | 0 | 128 | >> > | 510 | 292 | 0 | 104 | >> > | 511 | 292 | 0 | 104 | >> > | 510 | 293 | 0 | 40 | >> > | 511 | 293 | 0 | 240 | >> > | 510 | 294 | 0 | 104 | >> > | 511 | 294 | 0 | 96 | >> > | 506 | 295 | 0 | 64 | >> > | 507 | 295 | 0 | 16 | >> > ..... >> > ..... >> > The file is an exported segmented dataset. >> > >> > I am following the tips from this similar question http://vtk.1045678.n5.nabble.com/importing-image-data-into-VTK-from-textfile-mimics-td1243332.html >> > I have created an appropriate vtkimagedata (volume): >> > >> > imageData = vtk.vtkImageData() >> > imageData.SetDimensions(512, 512, 192) >> > imageData.SetOrigin(0.0, 0.0, 0.0) >> > imageData.SetSpacing(1, 1, 1) >> > imageData.SetNumberOfScalarComponents(1) >> > imageData.Update() >> > >> > However I don't know how to copy the data loaded from vtkDelimitedTextReader into vtkImageData. How do I copy the x,y,z voxel values into vtkImageData? How do I copy the intensity valuesVtkImageData? >> > >> > Any help provided for this would be greatly appreciated! >> > >> > Lizeth >> > >> > >> > _______________________________________________ >> > 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 278124177 at qq.com Wed Jul 25 01:01:09 2018 From: 278124177 at qq.com (=?gb18030?B?zui3qM7ozOw=?=) Date: Wed, 25 Jul 2018 13:01:09 +0800 Subject: [vtkusers] Get the intersection part of two planes Message-ID: Hi, I want to get the intesection part of two planes,and I use the vtkBooleanOperationPolyDataFilter,but the error 0xC0000005 happens when I try to update. vtkPolyData*data =(vtkPolyData*) planeActor->GetMapper()->GetInput(); vtkPolyData*data1 =(vtkPolyData*) planeActor1->GetMapper()->GetInput(); vtkSmartPointer filter = vtkSmartPointer::New(); filter->SetInputData(0, data); filter->SetInputData(1, data1); filter->SetOperationToIntersection(); filter->Update(); How can I get the this in the right way, thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From newcowbow1104 at gmail.com Wed Jul 25 02:48:20 2018 From: newcowbow1104 at gmail.com (Feng Yang) Date: Wed, 25 Jul 2018 14:48:20 +0800 Subject: [vtkusers] About MIP(maximal intensity projection) feature in vtk.js Message-ID: Hello Mr. Would you like to tell me do you guys have schedule for implement of MIP in vtk.js. thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From julien.finet at kitware.com Wed Jul 25 03:04:16 2018 From: julien.finet at kitware.com (Julien Finet) Date: Wed, 25 Jul 2018 09:04:16 +0200 Subject: [vtkusers] About MIP(maximal intensity projection) feature in vtk.js In-Reply-To: References: Message-ID: Hi, There is no short term plan for MIP implementation. However, please note that there is a PR for a first implementation of the vtkImageReslice filter (https://github.com/Kitware/vtk-js/pull/784). Therefore you can start from it and add MIP support to it (similarly to what is done in VTK). Please consider making a PR of your iteration on the filter. Hth, Julien. On Wed, Jul 25, 2018 at 8:54 AM Feng Yang wrote: > Hello Mr. > Would you like to tell me do you guys have schedule for implement > of MIP in vtk.js. > 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 mathieu.westphal at kitware.com Wed Jul 25 03:52:07 2018 From: mathieu.westphal at kitware.com (Mathieu Westphal) Date: Wed, 25 Jul 2018 09:52:07 +0200 Subject: [vtkusers] How to get the framebuffer In-Reply-To: References: Message-ID: Hi LingHai Make sure you have rendered into the renderWindow first. (renderWindow->Render()) And try to read from the front and the back buffer. Best regards, Mathieu Westphal On Tue, Jul 24, 2018 at 7:57 PM, ling Hai wrote: > Hi, > I am new to vtk and I am trying to get the front framebuffer from the > renderwindow like this: > int * dim = renderWindow->GetSize(); > unsigned char* pixels = renderWindow->GetPixelData(0, > 0,dim[0]-1,dim[1]-1,true); > > but in pixels there is only a null value. I am using this on a 3d render > if that makes a difference the above segment of code called after rendering > the volume. What am I missing? Any help is appreciated thanks. > Linghai > > _______________________________________________ > 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 julien.finet at kitware.com Wed Jul 25 03:55:40 2018 From: julien.finet at kitware.com (Julien Finet) Date: Wed, 25 Jul 2018 09:55:40 +0200 Subject: [vtkusers] About MIP(maximal intensity projection) feature in vtk.js In-Reply-To: References: Message-ID: MIP is done here: https://github.com/Kitware/VTK/blob/master/Imaging/Core/vtkImageReslice.cxx (see VTK_IMAGE_SLAB_MAX) Julien. On Wed, Jul 25, 2018 at 9:42 AM Feng Yang wrote: > Hi > Thanks for reply. I'm afraid I'm new for both vtk and vtk.js. > So would you like to provide me some examples or articles which can > tell me how to implement MIP with vtkImageReslice in vtk C++. > Thanks. > > > 2018-07-25 15:04 GMT+08:00 Julien Finet : > >> Hi, >> >> There is no short term plan for MIP implementation. However, please note >> that there is a PR for a first implementation of the vtkImageReslice filter >> (https://github.com/Kitware/vtk-js/pull/784). >> Therefore you can start from it and add MIP support to it (similarly to >> what is done in VTK). Please consider making a PR of your iteration on the >> filter. >> >> Hth, >> Julien. >> >> On Wed, Jul 25, 2018 at 8:54 AM Feng Yang >> wrote: >> >>> Hello Mr. >>> Would you like to tell me do you guys have schedule for >>> implement of MIP in vtk.js. >>> 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 shayan.moradkhani at gmail.com Wed Jul 25 04:01:24 2018 From: shayan.moradkhani at gmail.com (shayan moradkhani) Date: Wed, 25 Jul 2018 01:01:24 -0700 (MST) Subject: [vtkusers] KeyPressEvevnts Message-ID: <1532505684979-0.post@n5.nabble.com> hi I am using "KeyPressEvevnts" example to apply 3d transformation on the sphere using arrow keys. here is the example: "https://www.vtk.org/Wiki/VTK/Examples/Cxx/Interaction/KeypressEvents" I only added following lines: double x = 0.0; x = x + 1.0; vtkSmartPointer handTransform = vtkSmartPointer::New(); actor->SetUserTransform(handTransform); handTransform->Translate(x, 0.0, 0.0); and the code looked like the attached file. KeyPressEvent.txt but when I run the program, pressing up only executes the printing line and it does not move the sphere. anyone has any idea why it is not working? regards Shayan -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From vacingforo at gmail.com Wed Jul 25 04:28:12 2018 From: vacingforo at gmail.com (sergio campo) Date: Wed, 25 Jul 2018 10:28:12 +0200 Subject: [vtkusers] vtkImageData: Is it possible to define array VTK_BIT(image->AllocateScalars) instead of VTK_UNSIGNED_CHAR to mask a polydata? In-Reply-To: References: <1532329271833-0.post@n5.nabble.com> Message-ID: Sorry but it continues be confusing for me. I don't understand the reasons. is there no way to make a mask Image with 0 and 1(bits) in order to mask polydata? On Mon, Jul 23, 2018 at 5:37 PM, Dan Lipsa wrote: > No, it needs to be an unsigned char. This is because different bits from > that unsigned char are used for different things. > > https://blog.kitware.com/ghost-and-blanking-visibility-changes/ > > On Mon, Jul 23, 2018 at 3:01 AM vacingforo wrote: > >> Hello, >> >> I have the following code : >> >> vtkSmartPointer image = >> vtkSmartPointer::New(); >> image->SetSpacing(spacing); >> image->SetDimensions(dim); >> image->SetExtent(-1, dim[0] + 1, -1 , dim[1] + 1, 0, dim[2] - 1); >> image->SetOrigin(origin); >> image->AllocateScalars(VTK_UNSIGNED_CHAR, 1); >> >> vtkIdType count = image->GetNumberOfPoints(); >> for (vtkIdType i = 0; i < count; ++i) >> { >> image->GetPointData()->GetScalars()->SetTuple1(i, white); >> } >> >> Is it possible to define array VTK_BIT(image->AllocateScalars) instead of >> VTK_UNSIGNED_CHAR to mask a polydata?. This is in order to reduce the size >> of matrix. >> >> for more details check small application main.cpp in the >> following link: >> >> >> https://drive.google.com/file/d/1FBnJw96zz5uv33uh_ >> GYV71OAT05NngOR/view?usp=sharing >> >> >> Best regards, >> >> Sergio >> >> >> >> -- >> 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 mey1k at naver.com Wed Jul 25 04:29:08 2018 From: mey1k at naver.com (minjun) Date: Wed, 25 Jul 2018 01:29:08 -0700 (MST) Subject: [vtkusers] vtkSliderWidget subclassing In-Reply-To: <1532479465899-0.post@n5.nabble.com> References: <1532479465899-0.post@n5.nabble.com> Message-ID: <1532507348161-0.post@n5.nabble.com> i solve this problem, it works fine i use subclassing vtkSliderWidget(MoveAction) and use Custum Callbackmapper and overriding MoveAction.. (MoveAction is static method.. so it isn't a normal overriding method But I used it because it works as I want.) and I modified moveaction as I wanted then I can call my MoveAction event :) -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From s.turner17 at imperial.ac.uk Wed Jul 25 04:50:04 2018 From: s.turner17 at imperial.ac.uk (Turner, Shruti) Date: Wed, 25 Jul 2018 08:50:04 +0000 Subject: [vtkusers] Question: choose vertices on STL object Message-ID: Hello, I'm new to VTK and I am trying to use it so that I can create a colour map on an object to represent some measured data with some interpolation. In real life I have an object with sensors in various locations. I have a 3D model of the object which I have imported into vtk as an STL file. I now want to assign the measured data to the relevant locations on the model, then I want to interpolate between the measured data points so every vertex has a value. I then want to have a colour scale dependent on the value of the vertex. I'm not sure how to go about this or if it's possible. My specific queries are:- 1. Can I click on the model for it to give me the location of the nearest vertex to my mouse click? If so, how can I? 2. What is the best way to interpolate between the known measurements? I don't need each value across the mesh, only the final colours - would it be better to assign colours to the known points and then interpolate colour between them without doing the numbers? Many thanks, Shruti -------------- next part -------------- An HTML attachment was scrubbed... URL: From newcfd at yahoo.com Wed Jul 25 06:11:45 2018 From: newcfd at yahoo.com (newcfd) Date: Wed, 25 Jul 2018 03:11:45 -0700 (MST) Subject: [vtkusers] qvtkWidget(8.1) does not resize horizontally Message-ID: <1532513505962-0.post@n5.nabble.com> it works fine in my app on my own computer. But qvtkWidget does not resize horizontally when the deployed app is installed in another computer. Some mismatched library is not copied? VTK version is 8.1. Thanks for your help. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From mathieu.westphal at kitware.com Wed Jul 25 08:06:08 2018 From: mathieu.westphal at kitware.com (Mathieu Westphal) Date: Wed, 25 Jul 2018 14:06:08 +0200 Subject: [vtkusers] qvtkWidget(8.1) does not resize horizontally In-Reply-To: <1532513505962-0.post@n5.nabble.com> References: <1532513505962-0.post@n5.nabble.com> Message-ID: Hi, You may to try with QVTKOpenGLWidget or QVTKOpenGLSimpleWidget QVTKWidget is deprecated. Best regards, Mathieu Westphal On Wed, Jul 25, 2018 at 12:11 PM, newcfd via vtkusers < vtkusers at public.kitware.com> wrote: > it works fine in my app on my own computer. But qvtkWidget does not resize > horizontally when the deployed app is installed in another computer. Some > mismatched library is not copied? VTK version is 8.1. Thanks for your > help. > > > > -- > 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 marvin.huber at basf.com Wed Jul 25 08:19:13 2018 From: marvin.huber at basf.com (marf) Date: Wed, 25 Jul 2018 05:19:13 -0700 (MST) Subject: [vtkusers] Create PolyData in vtk.js In-Reply-To: References: <1531823184017-0.post@n5.nabble.com> <1531834753471-0.post@n5.nabble.com> <1531909273485-0.post@n5.nabble.com> <1531919963954-0.post@n5.nabble.com> Message-ID: <1532521153708-0.post@n5.nabble.com> Thank you, all worked out fine for now :-) I actually plan to contribute the reader later on, but for now its kind of a hacky solution that mainly works for my purposes, but I will improve it over the next weeks as needed and then contribute it to the vtk.js project through paraview glance -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From marvin.huber at basf.com Wed Jul 25 08:34:44 2018 From: marvin.huber at basf.com (marf) Date: Wed, 25 Jul 2018 05:34:44 -0700 (MST) Subject: [vtkusers] MarchingCubes on polydata with vtkjs Message-ID: <1532522084005-0.post@n5.nabble.com> Hello guys, I have some polydata and want to extract its surface. I stumble upon vtkImageMarchingCubes, which seemed to be exactly what I need. Only it is not able to handle polydata. I tried using it like this: *const cubes = vtk.Filters.General.vtkImageMarchingCubes.newInstance(); cubes.setContourValue(0.5); cubes.setInputConnection(this.reader.getOutputPort()); cubes.update(); this.mapper.setInputConnection(cubes.getOutputPort());* But using it like this throws an error *ERROR TypeError: o.getOrigin is not a function* Where, as I figured out, o is my polydata, which indeed does not have a getOrigin method. From looking at ImageMarchingCube's code, I also figured out it would then need a getSpacing() and getDimensions() method. So my question is, what kind of data do I feed to ImageMarchingCubes or is there any way to get it to work with polydata? Greetings, Marvin -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From qyaoza at gmail.com Wed Jul 25 10:20:13 2018 From: qyaoza at gmail.com (ling Hai) Date: Wed, 25 Jul 2018 10:20:13 -0400 Subject: [vtkusers] How to get the framebuffer In-Reply-To: References: Message-ID: Hi Mathieu, Thank you for the response, I am already calling renderWindow->Render(). I tried reading the front, back, left and right buffers but am still unable to get any data from the call. If it helps, I am not using shaders, color points, or opacity the blending mode is composite, it is rendered by the gpu. Linghai On Wed, Jul 25, 2018 at 3:52 AM, Mathieu Westphal < mathieu.westphal at kitware.com> wrote: > Hi LingHai > > Make sure you have rendered into the renderWindow first. > (renderWindow->Render()) > And try to read from the front and the back buffer. > > Best regards, > > Mathieu Westphal > > On Tue, Jul 24, 2018 at 7:57 PM, ling Hai wrote: > >> Hi, >> I am new to vtk and I am trying to get the front framebuffer from the >> renderwindow like this: >> int * dim = renderWindow->GetSize(); >> unsigned char* pixels = renderWindow->GetPixelData(0,0 >> ,dim[0]-1,dim[1]-1,true); >> >> but in pixels there is only a null value. I am using this on a 3d render >> if that makes a difference the above segment of code called after rendering >> the volume. What am I missing? Any help is appreciated thanks. >> Linghai >> >> _______________________________________________ >> 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 mathieu.westphal at kitware.com Wed Jul 25 10:24:51 2018 From: mathieu.westphal at kitware.com (Mathieu Westphal) Date: Wed, 25 Jul 2018 16:24:51 +0200 Subject: [vtkusers] How to get the framebuffer In-Reply-To: References: Message-ID: Hi, It should work then. Take a look into : VTK/Rendering/OpenGL2/Testing/Cxx/TestRenderToImage.cxx VTK/Rendering/Core/vtkWindowToImageFilter.cxx Both are doing exactly what you are trying to do. The first one (the test) may be very useful to you. Best regards, Mathieu Westphal On Wed, Jul 25, 2018 at 4:20 PM, ling Hai wrote: > Hi Mathieu, > Thank you for the response, I am already calling renderWindow->Render(). I > tried reading the front, back, left and right buffers but am still unable > to get any data from the call. If it helps, I am not using shaders, color > points, or opacity the blending mode is composite, it is rendered by the > gpu. > > Linghai > > On Wed, Jul 25, 2018 at 3:52 AM, Mathieu Westphal < > mathieu.westphal at kitware.com> wrote: > >> Hi LingHai >> >> Make sure you have rendered into the renderWindow first. >> (renderWindow->Render()) >> And try to read from the front and the back buffer. >> >> Best regards, >> >> Mathieu Westphal >> >> On Tue, Jul 24, 2018 at 7:57 PM, ling Hai wrote: >> >>> Hi, >>> I am new to vtk and I am trying to get the front framebuffer from the >>> renderwindow like this: >>> int * dim = renderWindow->GetSize(); >>> unsigned char* pixels = renderWindow->GetPixelData(0,0 >>> ,dim[0]-1,dim[1]-1,true); >>> >>> but in pixels there is only a null value. I am using this on a 3d render >>> if that makes a difference the above segment of code called after rendering >>> the volume. What am I missing? Any help is appreciated thanks. >>> Linghai >>> >>> _______________________________________________ >>> 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 ken.martin at kitware.com Wed Jul 25 10:46:58 2018 From: ken.martin at kitware.com (Ken Martin) Date: Wed, 25 Jul 2018 10:46:58 -0400 Subject: [vtkusers] How to get the framebuffer In-Reply-To: References: Message-ID: In current VTK I cannot see how GetPixelData can return null unless new returns null due to being out of memory. The code boils down to unsigned char* ucdata = new unsigned char[width * height * 3]; vtkRecti rect(x_low, y_low, width, height); this->ReadPixels(rect, front, GL_RGB, GL_UNSIGNED_BYTE, ucdata, right); return ucdata; So if the return value is nullptr then "new" failed. So check around maybe something else funny is going on. On Wed, Jul 25, 2018 at 10:24 AM, Mathieu Westphal < mathieu.westphal at kitware.com> wrote: > Hi, > > It should work then. > > Take a look into : > VTK/Rendering/OpenGL2/Testing/Cxx/TestRenderToImage.cxx > VTK/Rendering/Core/vtkWindowToImageFilter.cxx > > Both are doing exactly what you are trying to do. > The first one (the test) may be very useful to you. > > Best regards, > > Mathieu Westphal > > On Wed, Jul 25, 2018 at 4:20 PM, ling Hai wrote: > >> Hi Mathieu, >> Thank you for the response, I am already calling renderWindow->Render(). >> I tried reading the front, back, left and right buffers but am still unable >> to get any data from the call. If it helps, I am not using shaders, color >> points, or opacity the blending mode is composite, it is rendered by the >> gpu. >> >> Linghai >> >> On Wed, Jul 25, 2018 at 3:52 AM, Mathieu Westphal < >> mathieu.westphal at kitware.com> wrote: >> >>> Hi LingHai >>> >>> Make sure you have rendered into the renderWindow first. >>> (renderWindow->Render()) >>> And try to read from the front and the back buffer. >>> >>> Best regards, >>> >>> Mathieu Westphal >>> >>> On Tue, Jul 24, 2018 at 7:57 PM, ling Hai wrote: >>> >>>> Hi, >>>> I am new to vtk and I am trying to get the front framebuffer from the >>>> renderwindow like this: >>>> int * dim = renderWindow->GetSize(); >>>> unsigned char* pixels = renderWindow->GetPixelData(0,0 >>>> ,dim[0]-1,dim[1]-1,true); >>>> >>>> but in pixels there is only a null value. I am using this on a 3d >>>> render if that makes a difference the above segment of code called after >>>> rendering the volume. What am I missing? Any help is appreciated thanks. >>>> Linghai >>>> >>>> _______________________________________________ >>>> 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 > > -- 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 mathieu.westphal at kitware.com Wed Jul 25 10:51:15 2018 From: mathieu.westphal at kitware.com (Mathieu Westphal) Date: Wed, 25 Jul 2018 16:51:15 +0200 Subject: [vtkusers] How to get the framebuffer In-Reply-To: References: Message-ID: Hi, You will need to share more code in order to get help. The test I mentioned is working perfectly here. Mathieu Westphal On Wed, Jul 25, 2018 at 4:46 PM, Ken Martin wrote: > In current VTK I cannot see how GetPixelData can return null unless new > returns null due to being out of memory. The code boils down to > > unsigned char* ucdata = new unsigned char[width * height * 3]; > vtkRecti rect(x_low, y_low, width, height); > this->ReadPixels(rect, front, GL_RGB, GL_UNSIGNED_BYTE, ucdata, right); > return ucdata; > > So if the return value is nullptr then "new" failed. So check around maybe > something else funny is going on. > > > On Wed, Jul 25, 2018 at 10:24 AM, Mathieu Westphal < > mathieu.westphal at kitware.com> wrote: > >> Hi, >> >> It should work then. >> >> Take a look into : >> VTK/Rendering/OpenGL2/Testing/Cxx/TestRenderToImage.cxx >> VTK/Rendering/Core/vtkWindowToImageFilter.cxx >> >> Both are doing exactly what you are trying to do. >> The first one (the test) may be very useful to you. >> >> Best regards, >> >> Mathieu Westphal >> >> On Wed, Jul 25, 2018 at 4:20 PM, ling Hai wrote: >> >>> Hi Mathieu, >>> Thank you for the response, I am already calling renderWindow->Render(). >>> I tried reading the front, back, left and right buffers but am still unable >>> to get any data from the call. If it helps, I am not using shaders, color >>> points, or opacity the blending mode is composite, it is rendered by the >>> gpu. >>> >>> Linghai >>> >>> On Wed, Jul 25, 2018 at 3:52 AM, Mathieu Westphal < >>> mathieu.westphal at kitware.com> wrote: >>> >>>> Hi LingHai >>>> >>>> Make sure you have rendered into the renderWindow first. >>>> (renderWindow->Render()) >>>> And try to read from the front and the back buffer. >>>> >>>> Best regards, >>>> >>>> Mathieu Westphal >>>> >>>> On Tue, Jul 24, 2018 at 7:57 PM, ling Hai wrote: >>>> >>>>> Hi, >>>>> I am new to vtk and I am trying to get the front framebuffer from the >>>>> renderwindow like this: >>>>> int * dim = renderWindow->GetSize(); >>>>> unsigned char* pixels = renderWindow->GetPixelData(0,0 >>>>> ,dim[0]-1,dim[1]-1,true); >>>>> >>>>> but in pixels there is only a null value. I am using this on a 3d >>>>> render if that makes a difference the above segment of code called after >>>>> rendering the volume. What am I missing? Any help is appreciated thanks. >>>>> Linghai >>>>> >>>>> _______________________________________________ >>>>> 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 >> >> > > > -- > 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 qyaoza at gmail.com Wed Jul 25 10:52:08 2018 From: qyaoza at gmail.com (ling Hai) Date: Wed, 25 Jul 2018 10:52:08 -0400 Subject: [vtkusers] How to get the framebuffer In-Reply-To: References: Message-ID: Hi, Thank you for your help. I was able to figure out that you need to call ->Render() right before the GetPixelData which I had not done. Linghai On Wed, Jul 25, 2018 at 10:24 AM, Mathieu Westphal < mathieu.westphal at kitware.com> wrote: > Hi, > > It should work then. > > Take a look into : > VTK/Rendering/OpenGL2/Testing/Cxx/TestRenderToImage.cxx > VTK/Rendering/Core/vtkWindowToImageFilter.cxx > > Both are doing exactly what you are trying to do. > The first one (the test) may be very useful to you. > > Best regards, > > Mathieu Westphal > > On Wed, Jul 25, 2018 at 4:20 PM, ling Hai wrote: > >> Hi Mathieu, >> Thank you for the response, I am already calling renderWindow->Render(). >> I tried reading the front, back, left and right buffers but am still unable >> to get any data from the call. If it helps, I am not using shaders, color >> points, or opacity the blending mode is composite, it is rendered by the >> gpu. >> >> Linghai >> >> On Wed, Jul 25, 2018 at 3:52 AM, Mathieu Westphal < >> mathieu.westphal at kitware.com> wrote: >> >>> Hi LingHai >>> >>> Make sure you have rendered into the renderWindow first. >>> (renderWindow->Render()) >>> And try to read from the front and the back buffer. >>> >>> Best regards, >>> >>> Mathieu Westphal >>> >>> On Tue, Jul 24, 2018 at 7:57 PM, ling Hai wrote: >>> >>>> Hi, >>>> I am new to vtk and I am trying to get the front framebuffer from the >>>> renderwindow like this: >>>> int * dim = renderWindow->GetSize(); >>>> unsigned char* pixels = renderWindow->GetPixelData(0,0 >>>> ,dim[0]-1,dim[1]-1,true); >>>> >>>> but in pixels there is only a null value. I am using this on a 3d >>>> render if that makes a difference the above segment of code called after >>>> rendering the volume. What am I missing? Any help is appreciated thanks. >>>> Linghai >>>> >>>> _______________________________________________ >>>> 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 Jul 25 10:52:53 2018 From: sebastien.jourdain at kitware.com (Sebastien Jourdain) Date: Wed, 25 Jul 2018 08:52:53 -0600 Subject: [vtkusers] Question: choose vertices on STL object In-Reply-To: References: Message-ID: You can use ParaView to inspect your model, but STL duplicate all points for each faces. In order to get the proper interpolation, you will have to merge those points. Moreover, you will need to assign a field value for each point, then VTK will be able to do the interpolation on each face of your model. On Wed, Jul 25, 2018 at 3:16 AM Turner, Shruti wrote: > Hello, > > > > I?m new to VTK and I am trying to use it so that I can create a colour map > on an object to represent some measured data with some interpolation. In > real life I have an object with sensors in various locations. I have a 3D > model of the object which I have imported into vtk as an STL file. > > > > I now want to assign the measured data to the relevant locations on the > model, then I want to interpolate between the measured data points so every > vertex has a value. I then want to have a colour scale dependent on the > value of the vertex. > > > > I?m not sure how to go about this or if it?s possible. My specific queries > are:- > > > > 1. Can I click on the model for it to give me the location of the > nearest vertex to my mouse click? If so, how can I? > 2. What is the best way to interpolate between the known measurements? > I don?t need each value across the mesh, only the final colours ? would it > be better to assign colours to the known points and then interpolate colour > between them without doing the numbers? > > > > Many thanks, > > Shruti > _______________________________________________ > 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 Jul 25 11:06:28 2018 From: sebastien.jourdain at kitware.com (Sebastien Jourdain) Date: Wed, 25 Jul 2018 09:06:28 -0600 Subject: [vtkusers] Create PolyData in vtk.js In-Reply-To: <1532521153708-0.post@n5.nabble.com> References: <1531823184017-0.post@n5.nabble.com> <1531834753471-0.post@n5.nabble.com> <1531909273485-0.post@n5.nabble.com> <1531919963954-0.post@n5.nabble.com> <1532521153708-0.post@n5.nabble.com> Message-ID: Awesome, I'm glad it is working on your end. Is your unstructured grid only a surface mesh? Or do you handle a various set of cells? Moreover if you deal with 3D cell, do you remove the internal faces? Thanks for thinking of contributing... Seb On Wed, Jul 25, 2018 at 6:19 AM marf wrote: > Thank you, all worked out fine for now :-) I actually plan to contribute > the > reader later on, but for now its kind of a hacky solution that mainly works > for my purposes, but I will improve it over the next weeks as needed and > then contribute it to the vtk.js project through paraview glance > > > > -- > 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 sebastien.jourdain at kitware.com Wed Jul 25 11:10:53 2018 From: sebastien.jourdain at kitware.com (Sebastien Jourdain) Date: Wed, 25 Jul 2018 09:10:53 -0600 Subject: [vtkusers] MarchingCubes on polydata with vtkjs In-Reply-To: <1532522084005-0.post@n5.nabble.com> References: <1532522084005-0.post@n5.nabble.com> Message-ID: Polydata are just surface mesh so contouring them will mean creating an iso line. We don't have such filter implemented inside vtk.js. On Wed, Jul 25, 2018 at 6:34 AM marf wrote: > Hello guys, I have some polydata and want to extract its surface. I stumble > upon vtkImageMarchingCubes, which seemed to be exactly what I need. Only it > is not able to handle polydata. I tried using it like this: > > *const cubes = vtk.Filters.General.vtkImageMarchingCubes.newInstance(); > cubes.setContourValue(0.5); > cubes.setInputConnection(this.reader.getOutputPort()); > cubes.update(); > this.mapper.setInputConnection(cubes.getOutputPort());* > > But using it like this throws an error > > *ERROR TypeError: o.getOrigin is not a function* > > Where, as I figured out, o is my polydata, which indeed does not have a > getOrigin method. From looking at ImageMarchingCube's code, I also figured > out it would then need a getSpacing() and getDimensions() method. > So my question is, what kind of data do I feed to ImageMarchingCubes or is > there any way to get it to work with polydata? > Greetings, Marvin > > > > -- > 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 castellanoslizan at gmail.com Wed Jul 25 11:14:46 2018 From: castellanoslizan at gmail.com (Lizeth Castellanos) Date: Wed, 25 Jul 2018 12:14:46 -0300 Subject: [vtkusers] Copy image data into vtkImageData from a textfile In-Reply-To: References: Message-ID: Thanks for your answers! For the case *2)* I have one more question: How can I add the scalar values from the intensity ('Field 3') to the data? I have added those two lines to your code: scalar = probeFilter.GetOutput().GetPointData().GetArray('Field 3') probeFilter.GetOutput().GetPointData().SetScalars(scalar) But when I render the volume, nothing is displayed in the render window. Thanks Lizeth On Tue, Jul 24, 2018 at 11:29 PM, kenichiro yoshimi wrote: > Hi, > > 1) You need to specify PYTHON_INCLUDE_DIR and PYTHON_LIBRARY to suit > your own system in the 'advanced options' in cmake. > > PYTHON_INCLUDE_DIR will be the name of the directory containing the > Python.h: > e.g. /usr/include/python2.7 > PYTHON_LIBRARY will be the full path to libpython2.7.so (or.a): > e.g. /usr/lib64/libpython2.7.so > > 2) For example, if you apply vtkProbeFilter to sample.csv in the > previous my post, script is something like below. > > --- > import vtk > > > def main(): > > reader = vtk.vtkDelimitedTextReader() > reader.SetFileName('sample.csv') > reader.DetectNumericColumnsOn() > reader.SetFieldDelimiterCharacters(' ') > reader.MergeConsecutiveDelimitersOn() > > tableToPoints = vtk.vtkTableToPolyData() > tableToPoints.SetInputConnection(reader.GetOutputPort()) > tableToPoints.SetXColumn('Field 0') > tableToPoints.SetYColumn('Field 1') > tableToPoints.SetZColumn('Field 2') > > imageData = vtk.vtkImageData() > imageData.SetDimensions(3, 3, 3) > imageData.SetOrigin(0.0, 0.0, 0.0) > imageData.SetSpacing(1.0, 1.0, 1.0) > > probeFilter = vtk.vtkProbeFilter() > probeFilter.SetSourceConnection(tableToPoints.GetOutputPort()) > probeFilter.SetInputData(imageData) > probeFilter.Update() > > writer = vtk.vtkXMLImageDataWriter() > writer.SetInputData(probeFilter.GetOutput()) > writer.SetFileName('out.vti') > writer.Write() > > > if __name__ == '__main__': > main() > --- > > For your reference. > 2018?7?25?(?) 4:10 Lizeth Castellanos : > > > > Thanks for your help Kenichiro Yoshimi > > > > I was able to reproduce some part of your code. However, I encountered > new issues. > > > > 1)I have all my project under VTK 5.10.1 with python 2.7.12 in linux. I > got this error: 'module' object has no attribute 'vtkResampleToImage'. > > So I guess that the vtkResampleToImage class is not avaliable for my > VTK version. > > I tried to build a newer VTK version but I didn't get success. I tried > with VTK 7.1.1 and I got errors related to the python libs Could NOT find > PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS). > > > > 2) I read that vtkResampleToImage samples a dataset on a uniform grid > and it internally uses vtkProbeFilter to do the probing. So, Is there any > way to use vtkProbeFilter instead of vtkResampleToImage? > > I have tested some examples from vtkProbeFilter but I am confused about > how use it in my specific problem. > > > > Thanks, > > > > Lizeth > > > > On Thu, Jul 19, 2018 at 12:38 AM, kenichiro yoshimi < > rccm.kyoshimi at gmail.com> wrote: > >> > >> Hi Lizeth, > >> > >> Because vtkDelimitedTextReader outputs a vtkTable, you firstly need to > >> convert it to a vtkPolyData using vtkTableToPolyData. And then you can > >> use vtkResampleToImage to map the polyData to vtkImageData. > >> > >> ---sample.csv--- > >> 0 0 0 60.7635 > >> 1 0 0 107.555 > >> 2 0 0 80.5241 > >> 0 1 0 85.9694 > >> 1 1 0 156.706 > >> 2 1 0 105.73 > >> 0 2 0 37.3531 > >> 1 2 0 84.1445 > >> 2 2 0 57.1137 > >> 0 0 1 100.634 > >> 1 0 1 171.37 > >> 2 0 1 120.395 > >> 0 1 1 149.785 > >> 1 1 1 260 > >> 2 1 1 169.546 > >> 0 2 1 77.2238 > >> 1 2 1 147.96 > >> 2 2 1 96.9844 > >> 0 0 2 60.7635 > >> 1 0 2 107.555 > >> 2 0 2 80.5241 > >> 0 1 2 85.9694 > >> 1 1 2 156.706 > >> 2 1 2 105.73 > >> 0 2 2 37.3531 > >> 1 2 2 84.1445 > >> 2 2 2 57.1137 > >> > >> --- > >> import vtk > >> > >> > >> def main(): > >> colors = vtk.vtkNamedColors() > >> > >> reader = vtk.vtkDelimitedTextReader() > >> reader.SetFileName('sample.csv') > >> reader.DetectNumericColumnsOn() > >> reader.SetFieldDelimiterCharacters(' ') > >> reader.MergeConsecutiveDelimitersOn() > >> > >> tableToPoints = vtk.vtkTableToPolyData() > >> tableToPoints.SetInputConnection(reader.GetOutputPort()) > >> tableToPoints.SetXColumn('Field 0') > >> tableToPoints.SetYColumn('Field 1') > >> tableToPoints.SetZColumn('Field 2') > >> > >> resample = vtk.vtkResampleToImage() > >> resample.SetInputConnection(tableToPoints.GetOutputPort()) > >> resample.SetSamplingDimensions(3, 3, 3) > >> resample.Update() > >> > >> scalar = resample.GetOutput().GetPointData().GetArray('Field 3') > >> resample.GetOutput().GetPointData().SetScalars(scalar) > >> > >> writer = vtk.vtkMetaImageWriter() > >> writer.SetInputData(resample.GetOutput()) > >> writer.SetFileName('out.mha') > >> writer.SetCompression(True) > >> writer.Write() > >> > >> > >> if __name__ == '__main__': > >> main() > >> --- > >> > >> Best > >> 2018?7?19?(?) 3:43 Lizeth Castellanos : > >> > > >> > Hi! > >> > > >> > I'd like to copy image data from a textfile (csv) into vtkImageData. > >> > The textfile have voxel values for x,y,z and image intensity. I > already have read the textfile into VTK with the vtkDelimitedTextReader > class: > >> > > >> > Table loaded from CSV file: > >> > +-----------+-----------+-----------+------------+ > >> > | Field 0 | Field 1 | Field 2 | Field 3 | > >> > +-----------+-----------+-----------+------------+ > >> > | 510 | 291 | 0 | 32 | > >> > | 511 | 291 | 0 | 128 | > >> > | 510 | 292 | 0 | 104 | > >> > | 511 | 292 | 0 | 104 | > >> > | 510 | 293 | 0 | 40 | > >> > | 511 | 293 | 0 | 240 | > >> > | 510 | 294 | 0 | 104 | > >> > | 511 | 294 | 0 | 96 | > >> > | 506 | 295 | 0 | 64 | > >> > | 507 | 295 | 0 | 16 | > >> > ..... > >> > ..... > >> > The file is an exported segmented dataset. > >> > > >> > I am following the tips from this similar question > http://vtk.1045678.n5.nabble.com/importing-image-data-into-V > TK-from-textfile-mimics-td1243332.html > >> > I have created an appropriate vtkimagedata (volume): > >> > > >> > imageData = vtk.vtkImageData() > >> > imageData.SetDimensions(512, 512, 192) > >> > imageData.SetOrigin(0.0, 0.0, 0.0) > >> > imageData.SetSpacing(1, 1, 1) > >> > imageData.SetNumberOfScalarComponents(1) > >> > imageData.Update() > >> > > >> > However I don't know how to copy the data loaded from > vtkDelimitedTextReader into vtkImageData. How do I copy the x,y,z voxel > values into vtkImageData? How do I copy the intensity valuesVtkImageData? > >> > > >> > Any help provided for this would be greatly appreciated! > >> > > >> > Lizeth > >> > > >> > > >> > _______________________________________________ > >> > 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 278124177 at qq.com Thu Jul 26 05:01:08 2018 From: 278124177 at qq.com (=?gb18030?B?zui3qM7ozOw=?=) Date: Thu, 26 Jul 2018 17:01:08 +0800 Subject: [vtkusers] RightbuttonReleaseEvent Message-ID: Hi I use the observer to get the right mouse button click on a widget,but it dosen't work? can anyone tell me the right way to do this? my code as follow vtkCaptionWidget* captionWidget = vtkCaptionWidget::New(); vtkCaptionCallback* captionCall = vtkCaptionCallback::New(); captionWidget->SetInteractor(this->GetInteractor()); captionWidget->SetRepresentation(captionRepresentation); captionWidget->AddObserver(vtkCommand::RightButtonReleaseEvent, captionCall); captionWidget->On(); } -------------- next part -------------- An HTML attachment was scrubbed... URL: From pkorir at ebi.ac.uk Thu Jul 26 11:37:13 2018 From: pkorir at ebi.ac.uk (Paul Korir) Date: Thu, 26 Jul 2018 16:37:13 +0100 Subject: [vtkusers] VTK 8.1.0 wheels on pypi In-Reply-To: <4b4635d8-b082-afed-0d31-68f05a551fbc@aero.iitb.ac.in> References: <4b4635d8-b082-afed-0d31-68f05a551fbc@aero.iitb.ac.in> Message-ID: <9619fc2a-a348-31c2-b72a-edfc193062bd@ebi.ac.uk> Dear Prabhu, Big favour to ask: could you build wheels for running VTK headless i.e. offscreen rendering? I think the option to support this is VTK_OPENGL_HAS_OSMESA (see https://www.vtk.org/Wiki/VTK/Examples/Cxx/Utilities/OffScreenRendering). That would be a very big help. I've seen loads of queries on how to do this but almost no clear solutions. Then running VTK in headless mode would be as simple as first doing: pip install vtk-headless ... then you're off to the races! Paul K. Korir, PhD Scientific Programmer EMBL-EBI 01223494422 On 31/01/2018 18:48, Prabhu Ramachandran wrote: > > Hi all, > > Just a small announcement that we now have VTK-8.1.0 wheels available > on pypi (for OSX, Linux, and Windows). Installing VTK (on a 64 bit > OS), is now as simple as: > > ?$ pip install vtk > > More details are available here: > > http://prabhuramachandran.blogspot.in/2018/01/vtk-810-wheels-for-all-platforms-on-pypi.html > > Many thanks to all the folks who made this happen! > > cheers, > > Prabhu > > > > _______________________________________________ > 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 rccm.kyoshimi at gmail.com Thu Jul 26 20:35:09 2018 From: rccm.kyoshimi at gmail.com (kenichiro yoshimi) Date: Fri, 27 Jul 2018 09:35:09 +0900 Subject: [vtkusers] Copy image data into vtkImageData from a textfile In-Reply-To: References: Message-ID: Hi, Your question is not clear enough. If you possible, can you post your code? I don't have a problem with volume rendering in my code. ---- import vtk def main(): reader = vtk.vtkDelimitedTextReader() reader.SetFileName('sample.csv') reader.DetectNumericColumnsOn() reader.SetFieldDelimiterCharacters(' ') reader.MergeConsecutiveDelimitersOn() tableToPoints = vtk.vtkTableToPolyData() tableToPoints.SetInputConnection(reader.GetOutputPort()) tableToPoints.SetXColumn('Field 0') tableToPoints.SetYColumn('Field 1') tableToPoints.SetZColumn('Field 2') imageData = vtk.vtkImageData() imageData.SetDimensions(3, 3, 3) imageData.SetOrigin(0.0, 0.0, 0.0) imageData.SetSpacing(1.0, 1.0, 1.0) probeFilter = vtk.vtkProbeFilter() probeFilter.SetSourceConnection(tableToPoints.GetOutputPort()) probeFilter.SetInputData(imageData) probeFilter.Update() writer = vtk.vtkXMLImageDataWriter() writer.SetInputData(probeFilter.GetOutput()) writer.SetFileName('out.vti') writer.Write() probeFilter.GetOutput().GetPointData().SetActiveScalars('Field 3') range = probeFilter.GetOutput().GetPointData().GetScalars().GetRange() colors = vtk.vtkNamedColors() # Create the standard renderer, render window # and interactor. ren = vtk.vtkRenderer() renWin = vtk.vtkRenderWindow() renWin.AddRenderer(ren) iren = vtk.vtkRenderWindowInteractor() iren.SetRenderWindow(renWin) # Create transfer mapping scalar value to opacity. opacityTransferFunction = vtk.vtkPiecewiseFunction() opacityTransferFunction.AddPoint(range[0], 0.0) opacityTransferFunction.AddPoint(range[1], 1.0) # Create transfer mapping scalar value to color. colorTransferFunction = vtk.vtkColorTransferFunction() colorTransferFunction.AddRGBPoint(range[0], 0.0, 0.0, 1.0) colorTransferFunction.AddRGBPoint((range[0]+range[1])*0.5, 0.0, 1.0, 0.0) colorTransferFunction.AddRGBPoint(range[1], 1.0, 0.0, 0.0) # The property describes how the data will look. volumeProperty = vtk.vtkVolumeProperty() volumeProperty.SetColor(colorTransferFunction) volumeProperty.SetScalarOpacity(opacityTransferFunction) volumeProperty.SetScalarOpacityUnitDistance(1.73205080757) volumeProperty.SetInterpolationTypeToLinear() # The mapper / ray cast function know how to render the data. volumeMapper = vtk.vtkSmartVolumeMapper() volumeMapper.SetInputConnection(probeFilter.GetOutputPort()) volumeMapper.SetBlendModeToComposite() # The volume holds the mapper and the property and # can be used to position/orient the volume. volume = vtk.vtkVolume() volume.SetMapper(volumeMapper) volume.SetProperty(volumeProperty) ren.AddVolume(volume) ren.SetBackground(colors.GetColor3d("White")) ren.GetActiveCamera().ParallelProjectionOn() ren.ResetCameraClippingRange() ren.ResetCamera() renWin.SetSize(600, 600) renWin.Render() iren.Start() if __name__ == '__main__': main() ---- Regards 2018?7?26?(?) 0:15 Lizeth Castellanos : > > Thanks for your answers! > > For the case 2) I have one more question: How can I add the scalar values from the intensity ('Field 3') to the data? > > I have added those two lines to your code: > > scalar = probeFilter.GetOutput().GetPointData().GetArray('Field 3') > probeFilter.GetOutput().GetPointData().SetScalars(scalar) > > But when I render the volume, nothing is displayed in the render window. > > Thanks > > Lizeth > > > > > > On Tue, Jul 24, 2018 at 11:29 PM, kenichiro yoshimi wrote: >> >> Hi, >> >> 1) You need to specify PYTHON_INCLUDE_DIR and PYTHON_LIBRARY to suit >> your own system in the 'advanced options' in cmake. >> >> PYTHON_INCLUDE_DIR will be the name of the directory containing the Python.h: >> e.g. /usr/include/python2.7 >> PYTHON_LIBRARY will be the full path to libpython2.7.so (or.a): >> e.g. /usr/lib64/libpython2.7.so >> >> 2) For example, if you apply vtkProbeFilter to sample.csv in the >> previous my post, script is something like below. >> >> --- >> import vtk >> >> >> def main(): >> >> reader = vtk.vtkDelimitedTextReader() >> reader.SetFileName('sample.csv') >> reader.DetectNumericColumnsOn() >> reader.SetFieldDelimiterCharacters(' ') >> reader.MergeConsecutiveDelimitersOn() >> >> tableToPoints = vtk.vtkTableToPolyData() >> tableToPoints.SetInputConnection(reader.GetOutputPort()) >> tableToPoints.SetXColumn('Field 0') >> tableToPoints.SetYColumn('Field 1') >> tableToPoints.SetZColumn('Field 2') >> >> imageData = vtk.vtkImageData() >> imageData.SetDimensions(3, 3, 3) >> imageData.SetOrigin(0.0, 0.0, 0.0) >> imageData.SetSpacing(1.0, 1.0, 1.0) >> >> probeFilter = vtk.vtkProbeFilter() >> probeFilter.SetSourceConnection(tableToPoints.GetOutputPort()) >> probeFilter.SetInputData(imageData) >> probeFilter.Update() >> >> writer = vtk.vtkXMLImageDataWriter() >> writer.SetInputData(probeFilter.GetOutput()) >> writer.SetFileName('out.vti') >> writer.Write() >> >> >> if __name__ == '__main__': >> main() >> --- >> >> For your reference. >> 2018?7?25?(?) 4:10 Lizeth Castellanos : >> > >> > Thanks for your help Kenichiro Yoshimi >> > >> > I was able to reproduce some part of your code. However, I encountered new issues. >> > >> > 1)I have all my project under VTK 5.10.1 with python 2.7.12 in linux. I got this error: 'module' object has no attribute 'vtkResampleToImage'. >> > So I guess that the vtkResampleToImage class is not avaliable for my VTK version. >> > I tried to build a newer VTK version but I didn't get success. I tried with VTK 7.1.1 and I got errors related to the python libs Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS). >> > >> > 2) I read that vtkResampleToImage samples a dataset on a uniform grid and it internally uses vtkProbeFilter to do the probing. So, Is there any way to use vtkProbeFilter instead of vtkResampleToImage? >> > I have tested some examples from vtkProbeFilter but I am confused about how use it in my specific problem. >> > >> > Thanks, >> > >> > Lizeth >> > >> > On Thu, Jul 19, 2018 at 12:38 AM, kenichiro yoshimi wrote: >> >> >> >> Hi Lizeth, >> >> >> >> Because vtkDelimitedTextReader outputs a vtkTable, you firstly need to >> >> convert it to a vtkPolyData using vtkTableToPolyData. And then you can >> >> use vtkResampleToImage to map the polyData to vtkImageData. >> >> >> >> ---sample.csv--- >> >> 0 0 0 60.7635 >> >> 1 0 0 107.555 >> >> 2 0 0 80.5241 >> >> 0 1 0 85.9694 >> >> 1 1 0 156.706 >> >> 2 1 0 105.73 >> >> 0 2 0 37.3531 >> >> 1 2 0 84.1445 >> >> 2 2 0 57.1137 >> >> 0 0 1 100.634 >> >> 1 0 1 171.37 >> >> 2 0 1 120.395 >> >> 0 1 1 149.785 >> >> 1 1 1 260 >> >> 2 1 1 169.546 >> >> 0 2 1 77.2238 >> >> 1 2 1 147.96 >> >> 2 2 1 96.9844 >> >> 0 0 2 60.7635 >> >> 1 0 2 107.555 >> >> 2 0 2 80.5241 >> >> 0 1 2 85.9694 >> >> 1 1 2 156.706 >> >> 2 1 2 105.73 >> >> 0 2 2 37.3531 >> >> 1 2 2 84.1445 >> >> 2 2 2 57.1137 >> >> >> >> --- >> >> import vtk >> >> >> >> >> >> def main(): >> >> colors = vtk.vtkNamedColors() >> >> >> >> reader = vtk.vtkDelimitedTextReader() >> >> reader.SetFileName('sample.csv') >> >> reader.DetectNumericColumnsOn() >> >> reader.SetFieldDelimiterCharacters(' ') >> >> reader.MergeConsecutiveDelimitersOn() >> >> >> >> tableToPoints = vtk.vtkTableToPolyData() >> >> tableToPoints.SetInputConnection(reader.GetOutputPort()) >> >> tableToPoints.SetXColumn('Field 0') >> >> tableToPoints.SetYColumn('Field 1') >> >> tableToPoints.SetZColumn('Field 2') >> >> >> >> resample = vtk.vtkResampleToImage() >> >> resample.SetInputConnection(tableToPoints.GetOutputPort()) >> >> resample.SetSamplingDimensions(3, 3, 3) >> >> resample.Update() >> >> >> >> scalar = resample.GetOutput().GetPointData().GetArray('Field 3') >> >> resample.GetOutput().GetPointData().SetScalars(scalar) >> >> >> >> writer = vtk.vtkMetaImageWriter() >> >> writer.SetInputData(resample.GetOutput()) >> >> writer.SetFileName('out.mha') >> >> writer.SetCompression(True) >> >> writer.Write() >> >> >> >> >> >> if __name__ == '__main__': >> >> main() >> >> --- >> >> >> >> Best >> >> 2018?7?19?(?) 3:43 Lizeth Castellanos : >> >> > >> >> > Hi! >> >> > >> >> > I'd like to copy image data from a textfile (csv) into vtkImageData. >> >> > The textfile have voxel values for x,y,z and image intensity. I already have read the textfile into VTK with the vtkDelimitedTextReader class: >> >> > >> >> > Table loaded from CSV file: >> >> > +-----------+-----------+-----------+------------+ >> >> > | Field 0 | Field 1 | Field 2 | Field 3 | >> >> > +-----------+-----------+-----------+------------+ >> >> > | 510 | 291 | 0 | 32 | >> >> > | 511 | 291 | 0 | 128 | >> >> > | 510 | 292 | 0 | 104 | >> >> > | 511 | 292 | 0 | 104 | >> >> > | 510 | 293 | 0 | 40 | >> >> > | 511 | 293 | 0 | 240 | >> >> > | 510 | 294 | 0 | 104 | >> >> > | 511 | 294 | 0 | 96 | >> >> > | 506 | 295 | 0 | 64 | >> >> > | 507 | 295 | 0 | 16 | >> >> > ..... >> >> > ..... >> >> > The file is an exported segmented dataset. >> >> > >> >> > I am following the tips from this similar question http://vtk.1045678.n5.nabble.com/importing-image-data-into-VTK-from-textfile-mimics-td1243332.html >> >> > I have created an appropriate vtkimagedata (volume): >> >> > >> >> > imageData = vtk.vtkImageData() >> >> > imageData.SetDimensions(512, 512, 192) >> >> > imageData.SetOrigin(0.0, 0.0, 0.0) >> >> > imageData.SetSpacing(1, 1, 1) >> >> > imageData.SetNumberOfScalarComponents(1) >> >> > imageData.Update() >> >> > >> >> > However I don't know how to copy the data loaded from vtkDelimitedTextReader into vtkImageData. How do I copy the x,y,z voxel values into vtkImageData? How do I copy the intensity valuesVtkImageData? >> >> > >> >> > Any help provided for this would be greatly appreciated! >> >> > >> >> > Lizeth >> >> > >> >> > >> >> > _______________________________________________ >> >> > 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 prabhu at aero.iitb.ac.in Thu Jul 26 20:38:38 2018 From: prabhu at aero.iitb.ac.in (Prabhu Ramachandran) Date: Thu, 26 Jul 2018 20:38:38 -0400 Subject: [vtkusers] VTK 8.1.0 wheels on pypi In-Reply-To: <9619fc2a-a348-31c2-b72a-edfc193062bd@ebi.ac.uk> References: <4b4635d8-b082-afed-0d31-68f05a551fbc@aero.iitb.ac.in> <9619fc2a-a348-31c2-b72a-edfc193062bd@ebi.ac.uk> Message-ID: On 7/26/18 11:37 AM, Paul Korir wrote: > > Dear Prabhu, > > Big favour to ask: could you build wheels for running VTK headless i.e. > offscreen rendering? I think the option to support this is > VTK_OPENGL_HAS_OSMESA (see > https://www.vtk.org/Wiki/VTK/Examples/Cxx/Utilities/OffScreenRendering). > > That would be a very big help. I've seen loads of queries on how to do this > but almost no clear solutions. > > Then running VTK in headless mode would be as simple as first doing: > > pip install vtk-headless > > ... then you're off to the races! > I wish it were that easy but unfortunately it isn't.? It would be nicer still if this could be bundled into the same VTK wheels that we currently build.? Unfortunately, I do not have the bandwidth to follow up with this right now.? If VTK supported this easily enough then I am happy to build the wheels and push them to pypi. :) cheers, Prabhu -------------- next part -------------- An HTML attachment was scrubbed... URL: From newcfd at yahoo.com Thu Jul 26 23:04:29 2018 From: newcfd at yahoo.com (newcfd) Date: Thu, 26 Jul 2018 20:04:29 -0700 (MST) Subject: [vtkusers] qvtkWidget(8.1) does not resize horizontally In-Reply-To: References: <1532513505962-0.post@n5.nabble.com> Message-ID: <1532660669153-0.post@n5.nabble.com> Thank you, Mathieu. Will have a spin on it. QVTKWidgetPlugin still has QVTKWidget. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From newcfd at yahoo.com Thu Jul 26 23:07:26 2018 From: newcfd at yahoo.com (newcfd) Date: Thu, 26 Jul 2018 20:07:26 -0700 (MST) Subject: [vtkusers] qvtkWidget(8.1) does not resize horizontally In-Reply-To: References: <1532513505962-0.post@n5.nabble.com> Message-ID: <1532660846009-0.post@n5.nabble.com> I mean I did not see QVTKOpenGLWidgetPlugin for QDesigner. However, I will try it out in the code. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From sigurd.cbq425 at gmail.com Thu Jul 26 23:57:40 2018 From: sigurd.cbq425 at gmail.com (baiqi cheng) Date: Fri, 27 Jul 2018 13:57:40 +1000 Subject: [vtkusers] converting file from abaqus to vtk Message-ID: Dear all, I'm new to vtk file format. so, my question is pretty dumb. I just want to ask is it possible to convert a 3D volumetric Abaqus file(a simple cube with quadratic tetrahedron) to a legacy vtk file? if so, which kind of geometry/topology type and dataset attributes should I use in that case? Btw, in the vtk file format.pdf provided online, on page 7, it says" Polygons 6 30", I'm bit confused about the number 30, where is that come from? Best regards, Aaron -------------- next part -------------- An HTML attachment was scrubbed... URL: From mathieu.westphal at kitware.com Fri Jul 27 03:15:53 2018 From: mathieu.westphal at kitware.com (Mathieu Westphal) Date: Fri, 27 Jul 2018 09:15:53 +0200 Subject: [vtkusers] converting file from abaqus to vtk In-Reply-To: References: Message-ID: Not supported natively in VTK sadly. However you should be able to convert it to format that we support. eg : * Use export capabilities in abaqus into a format readable with VTK * https://github.com/Liujie-SYSU/odb2vtk And do not forget to vote for it here : https://paraview.uservoice.com/forums/11350-general/suggestions/6769619-abaqus Best regards, Mathieu Westphal On Fri, Jul 27, 2018 at 5:57 AM, baiqi cheng wrote: > Dear all, > > I'm new to vtk file format. so, my question is pretty dumb. > > I just want to ask is it possible to convert a 3D volumetric Abaqus file(a > simple cube with quadratic tetrahedron) to a legacy vtk file? > > if so, which kind of geometry/topology type and dataset attributes should > I use in that case? > > Btw, in the vtk file format.pdf provided online, on page 7, it says" > Polygons 6 30", I'm bit confused about the number 30, where is that come > from? > > Best regards, > Aaron > > > _______________________________________________ > 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 mathieu.westphal at kitware.com Fri Jul 27 03:18:17 2018 From: mathieu.westphal at kitware.com (Mathieu Westphal) Date: Fri, 27 Jul 2018 09:18:17 +0200 Subject: [vtkusers] qvtkWidget(8.1) does not resize horizontally In-Reply-To: <1532660846009-0.post@n5.nabble.com> References: <1532513505962-0.post@n5.nabble.com> <1532660846009-0.post@n5.nabble.com> Message-ID: Hi, Custom widgets cannot be found in designed afaik. QVTKOpenGLWidget (and potentially QVTKOpenGLSimpleWidget ) can be found in VT/GUISupport/Qt QVTKOpenGLWidgetPlugin is not a thing. Best regards, Mathieu Westphal On Fri, Jul 27, 2018 at 5:07 AM, newcfd via vtkusers < vtkusers at public.kitware.com> wrote: > I mean I did not see QVTKOpenGLWidgetPlugin for QDesigner. However, I will > try it out in the code. > > > > -- > 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 giorgosragos at gmail.com Fri Jul 27 03:41:45 2018 From: giorgosragos at gmail.com (Giorgos Ragkousis) Date: Fri, 27 Jul 2018 08:41:45 +0100 Subject: [vtkusers] converting file from abaqus to vtk In-Reply-To: References: Message-ID: Hi, You can also use Abapy ( http://abapy.readthedocs.io/en/latest/postproc.html#abapy.postproc.VectorFieldOutput.dump2vtk ). BW Giorgos On Fri, Jul 27, 2018 at 8:15 AM, Mathieu Westphal < mathieu.westphal at kitware.com> wrote: > Not supported natively in VTK sadly. > However you should be able to convert it to format that we support. > > eg : > * Use export capabilities in abaqus into a format readable with VTK > * https://github.com/Liujie-SYSU/odb2vtk > > And do not forget to vote for it here : > https://paraview.uservoice.com/forums/11350-general/ > suggestions/6769619-abaqus > > Best regards, > > > Mathieu Westphal > > On Fri, Jul 27, 2018 at 5:57 AM, baiqi cheng > wrote: > >> Dear all, >> >> I'm new to vtk file format. so, my question is pretty dumb. >> >> I just want to ask is it possible to convert a 3D volumetric Abaqus >> file(a simple cube with quadratic tetrahedron) to a legacy vtk file? >> >> if so, which kind of geometry/topology type and dataset attributes should >> I use in that case? >> >> Btw, in the vtk file format.pdf provided online, on page 7, it says" >> Polygons 6 30", I'm bit confused about the number 30, where is that come >> from? >> >> Best regards, >> Aaron >> >> >> _______________________________________________ >> 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 > > -- Georgios Ragkousis -------------- next part -------------- An HTML attachment was scrubbed... URL: From marvin.huber at basf.com Fri Jul 27 03:51:58 2018 From: marvin.huber at basf.com (marf) Date: Fri, 27 Jul 2018 00:51:58 -0700 (MST) Subject: [vtkusers] Create PolyData in vtk.js In-Reply-To: References: <1531823184017-0.post@n5.nabble.com> <1531834753471-0.post@n5.nabble.com> <1531909273485-0.post@n5.nabble.com> <1531919963954-0.post@n5.nabble.com> <1532521153708-0.post@n5.nabble.com> Message-ID: <1532677918372-0.post@n5.nabble.com> The first file I was working on was only a sruface mesh with triangles (celltype 5). But in my next example I also encountered hexahedrons (type 12) and type 13 (forgot about the name :D ), so I handle those aswell now. About removing the internal faces, thats what I have been trying to do and why I asked the question there: http://vtk.1045678.n5.nabble.com/MarchingCubes-on-polydata-with-vtkjs-td5748183.html I think you already answered me, so I will have a look at it right now -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From marvin.huber at basf.com Fri Jul 27 03:54:23 2018 From: marvin.huber at basf.com (marf) Date: Fri, 27 Jul 2018 00:54:23 -0700 (MST) Subject: [vtkusers] Create PolyData in vtk.js In-Reply-To: <1532677918372-0.post@n5.nabble.com> References: <1531823184017-0.post@n5.nabble.com> <1531834753471-0.post@n5.nabble.com> <1531909273485-0.post@n5.nabble.com> <1531919963954-0.post@n5.nabble.com> <1532521153708-0.post@n5.nabble.com> <1532677918372-0.post@n5.nabble.com> Message-ID: <1532678063629-0.post@n5.nabble.com> Ok, I just looked at your answer and since there is no filter for that, could you hint me in any direction on how to determine which faces are internal and can be removed? I'm not exactly experienced with computer graphics and didn't find a solution yet -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From fanatic8787 at gmail.com Fri Jul 27 05:47:16 2018 From: fanatic8787 at gmail.com (Alex) Date: Fri, 27 Jul 2018 02:47:16 -0700 (MST) Subject: [vtkusers] Problem with Rendering multiple windows in multiple threads Message-ID: <1532684836591-0.post@n5.nabble.com> Hello I have 4 WidowsForms controls with RenderWindow in each control. I'm trying to render this controls each in its own thread and sometimes this causes System.AccessViolationException -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From robertomelucci1000 at gmail.com Fri Jul 27 13:00:01 2018 From: robertomelucci1000 at gmail.com (Roberto Melucci) Date: Fri, 27 Jul 2018 19:00:01 +0200 Subject: [vtkusers] Unsubscribe this email from Message-ID: -------------- next part -------------- An HTML attachment was scrubbed... URL: From marcwang17 at hotmail.com Fri Jul 27 14:28:56 2018 From: marcwang17 at hotmail.com (WackoWanderer) Date: Fri, 27 Jul 2018 11:28:56 -0700 (MST) Subject: [vtkusers] does the ordering of the points in vtkCellArray imply adjacency? Message-ID: <1532716136926-0.post@n5.nabble.com> Hi, I have a closed contour in the form of a polyline. I am accessing the point through vtkPolyData.GetLines() and iterating through the cells in vtkCellArray. I want to calculate the angle bisector at each vertex of the line. Therefore I need to know the coordinate of V_{i-1}, V_i and V_{i+1}. In the vtkCellArray, [n0, p_1, p_2,... , p_n0, ... ] , if p_2 comes after p_1 in the cell , does it mean that p_1 and p_2 are connected together? Ps. Also would it be possible to reupload the vtk textbook and user guide on the website. All the equations are not rendered correctly and therefore unreadable. I tried to open the pdf with bunch of pdf reader and it still doesn't look right. -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From sebastien.jourdain at kitware.com Fri Jul 27 14:36:49 2018 From: sebastien.jourdain at kitware.com (Sebastien Jourdain) Date: Fri, 27 Jul 2018 12:36:49 -0600 Subject: [vtkusers] Create PolyData in vtk.js In-Reply-To: <1532678063629-0.post@n5.nabble.com> References: <1531823184017-0.post@n5.nabble.com> <1531834753471-0.post@n5.nabble.com> <1531909273485-0.post@n5.nabble.com> <1531919963954-0.post@n5.nabble.com> <1532521153708-0.post@n5.nabble.com> <1532677918372-0.post@n5.nabble.com> <1532678063629-0.post@n5.nabble.com> Message-ID: Ideally we would implement a standard unstructured grid reader which will just reproduce the same structure as the one available in C++ without processing/conversion to polydata. Then you will have to apply a filter that will extract the surface of each of those cells and remove the inner surfaces that in fact aims to convert your unstructured grid into a PolyData. In order to implement that filter, you will need: - a table for each cell type that list its surface cells (triangle/quad/line/vertex from all the 3d ones) - Then you will have to gather all those surface cells and eliminate those which are present twice (internal face) (cell pointing to the same set of point id) - You will have to only use the points that are use by those cells to produce that polydata and remap any data array based on that new indexing system for both cells and points. In any case you can either implement it yourself, or Kitware can help via consulting/support contract. HTH, Seb On Fri, Jul 27, 2018 at 1:54 AM marf wrote: > Ok, I just looked at your answer and since there is no filter for that, > could > you hint me in any direction on how to determine which faces are internal > and can be removed? I'm not exactly experienced with computer graphics and > didn't find a solution yet > > > > -- > 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 bill.lorensen at gmail.com Fri Jul 27 15:00:14 2018 From: bill.lorensen at gmail.com (Bill Lorensen) Date: Fri, 27 Jul 2018 12:00:14 -0700 Subject: [vtkusers] does the ordering of the points in vtkCellArray imply adjacency? In-Reply-To: <1532716136926-0.post@n5.nabble.com> References: <1532716136926-0.post@n5.nabble.com> Message-ID: We will soon announce the Latex and Markdown versions of the text. Equations are great. Latex: https://lorensen.github.io/VTKExamples/site/VTKBookLaTeX/VTKTextBook/ Markdown: https://lorensen.github.io/VTKExamples/site/VTKBook/00Preface/ Bill On Fri, Jul 27, 2018, 11:29 AM WackoWanderer wrote: > Hi, > > I have a closed contour in the form of a polyline. I am accessing the point > through vtkPolyData.GetLines() and iterating through the cells in > vtkCellArray. > > I want to calculate the angle bisector at each vertex of the line. > Therefore > I need to know the coordinate of V_{i-1}, V_i and V_{i+1}. > > In the vtkCellArray, [n0, p_1, p_2,... , p_n0, ... ] , if p_2 comes after > p_1 in the cell , does it mean that p_1 and p_2 are connected together? > > Ps. > Also would it be possible to reupload the vtk textbook and user guide on > the > website. All the equations are not rendered correctly and therefore > unreadable. I tried to open the pdf with bunch of pdf reader and it still > doesn't look right. > > > > > > -- > 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 castellanoslizan at gmail.com Fri Jul 27 15:02:20 2018 From: castellanoslizan at gmail.com (Lizeth Castellanos) Date: Fri, 27 Jul 2018 16:02:20 -0300 Subject: [vtkusers] Copy image data into vtkImageData from a textfile In-Reply-To: References: Message-ID: Hi! Thanks for your reply. My doubt was about how to pass the 'Field 3' to the probe filter. I made some adjust based in your help. However, the output shows two solid cube instead of the points from my segmented dataset. I am sending the code and the screenshot of the output. Thanks again :-) reader = vtk.vtkDelimitedTextReader() reader.SetFieldDelimiterCharacters(' ') reader.DetectNumericColumnsOn() reader.SetFileName('sample.csv') reader.MergeConsecutiveDelimitersOn() reader.Update() tableToPoints = vtk.vtkTableToPolyData() tableToPoints.SetInputConnection(reader.GetOutputPort()) tableToPoints.SetXColumn('Field 0') tableToPoints.SetYColumn('Field 1') tableToPoints.SetZColumn('Field 2') tableToPoints.Update() imageData = vtk.vtkImageData() imageData.SetDimensions(3, 3, 3) imageData.SetOrigin(0.0, 0.0, 0.0) imageData.SetSpacing(1.0, 1.0, 1.0) imageData.Update() probeFilter = vtk.vtkProbeFilter() probeFilter.SetSourceConnection(tableToPoints.GetOutputPort()) probeFilter.SetInput(imageData) probeFilter.Update() probeFilter.GetOutput().GetPointData().SetActiveScalars('Field 3') scalarRange = probeFilter.GetOutput().GetPointData().GetScalars().GetRange() writer = vtk.vtkXMLImageDataWriter() writer.SetInput(probeFilter.GetOutput()) writer.SetFileName('out.vti') writer.Write() # Create transfer mapping scalar value to opacity. opacityTransferFunction = vtk.vtkPiecewiseFunction() opacityTransferFunction.AddPoint(scalarRange[0], 0.0) opacityTransferFunction.AddPoint(scalarRange[1], 0.5) # Create transfer mapping scalar value to color. colorTransferFunction = vtk.vtkColorTransferFunction() colorTransferFunction.AddRGBPoint(scalarRange[0], 0.0, 0.0, 1.0) colorTransferFunction.AddRGBPoint((scalarRange[0]+scalarRange[1])*0.5, 0.0, 1.0, 0.0) colorTransferFunction.AddRGBPoint(scalarRange[1], 1.0, 0.0, 0.0) # The property describes how the data will look. volumeProperty = vtk.vtkVolumeProperty() volumeProperty.SetColor(colorTransferFunction) volumeProperty.SetScalarOpacity(opacityTransferFunction) volumeProperty.SetScalarOpacityUnitDistance(1.73205080757) volumeProperty.SetInterpolationTypeToLinear() volumeProperty.ShadeOn() # vtkVolumeRayCastMapper need data of type unsigned char or unsigned short cast = vtk.vtkImageCast() cast.SetInputConnection(probeFilter.GetOutputPort()) cast.SetOutputScalarTypeToUnsignedChar() cast.Update() ## The mapper / ray cast function know how to render the data compositeFunction = vtk.vtkVolumeRayCastCompositeFunction() volumeMapper = vtk.vtkVolumeRayCastMapper() volumeMapper.SetVolumeRayCastFunction(compositeFunction) volumeMapper.SetInputConnection(cast.GetOutputPort()) #The volume holds the mapper and the property. volume = vtk.vtkVolume() volume.SetMapper(volumeMapper) volume.SetProperty(volumeProperty) #Create the standard renderer, render window and interactor ren = vtk.vtkRenderer() renWin = vtk.vtkRenderWindow() renWin.AddRenderer(ren) iren = vtk.vtkRenderWindowInteractor() iren.SetRenderWindow(renWin) ren.AddVolume(volume) ren.SetBackground(1, 1, 1) renWin.SetSize(600, 600) renWin.Render() iren.Initialize() renWin.Render() iren.Start() On Thu, Jul 26, 2018 at 9:35 PM, kenichiro yoshimi wrote: > Hi, > > Your question is not clear enough. If you possible, can you post your > code? I don't have a problem with volume rendering in my code. > > ---- > import vtk > > > def main(): > > reader = vtk.vtkDelimitedTextReader() > reader.SetFileName('sample.csv') > reader.DetectNumericColumnsOn() > reader.SetFieldDelimiterCharacters(' ') > reader.MergeConsecutiveDelimitersOn() > > tableToPoints = vtk.vtkTableToPolyData() > tableToPoints.SetInputConnection(reader.GetOutputPort()) > tableToPoints.SetXColumn('Field 0') > tableToPoints.SetYColumn('Field 1') > tableToPoints.SetZColumn('Field 2') > > imageData = vtk.vtkImageData() > imageData.SetDimensions(3, 3, 3) > imageData.SetOrigin(0.0, 0.0, 0.0) > imageData.SetSpacing(1.0, 1.0, 1.0) > > probeFilter = vtk.vtkProbeFilter() > probeFilter.SetSourceConnection(tableToPoints.GetOutputPort()) > probeFilter.SetInputData(imageData) > probeFilter.Update() > > writer = vtk.vtkXMLImageDataWriter() > writer.SetInputData(probeFilter.GetOutput()) > writer.SetFileName('out.vti') > writer.Write() > > probeFilter.GetOutput().GetPointData().SetActiveScalars('Field 3') > range = probeFilter.GetOutput().GetPointData().GetScalars().GetRange() > > colors = vtk.vtkNamedColors() > > # Create the standard renderer, render window > # and interactor. > ren = vtk.vtkRenderer() > > renWin = vtk.vtkRenderWindow() > renWin.AddRenderer(ren) > > iren = vtk.vtkRenderWindowInteractor() > iren.SetRenderWindow(renWin) > > # Create transfer mapping scalar value to opacity. > opacityTransferFunction = vtk.vtkPiecewiseFunction() > opacityTransferFunction.AddPoint(range[0], 0.0) > opacityTransferFunction.AddPoint(range[1], 1.0) > > # Create transfer mapping scalar value to color. > colorTransferFunction = vtk.vtkColorTransferFunction() > colorTransferFunction.AddRGBPoint(range[0], 0.0, 0.0, 1.0) > colorTransferFunction.AddRGBPoint((range[0]+range[1])*0.5, 0.0, 1.0, > 0.0) > colorTransferFunction.AddRGBPoint(range[1], 1.0, 0.0, 0.0) > > # The property describes how the data will look. > volumeProperty = vtk.vtkVolumeProperty() > volumeProperty.SetColor(colorTransferFunction) > volumeProperty.SetScalarOpacity(opacityTransferFunction) > volumeProperty.SetScalarOpacityUnitDistance(1.73205080757) > volumeProperty.SetInterpolationTypeToLinear() > > # The mapper / ray cast function know how to render the data. > volumeMapper = vtk.vtkSmartVolumeMapper() > volumeMapper.SetInputConnection(probeFilter.GetOutputPort()) > volumeMapper.SetBlendModeToComposite() > > # The volume holds the mapper and the property and > # can be used to position/orient the volume. > volume = vtk.vtkVolume() > volume.SetMapper(volumeMapper) > volume.SetProperty(volumeProperty) > > ren.AddVolume(volume) > > ren.SetBackground(colors.GetColor3d("White")) > ren.GetActiveCamera().ParallelProjectionOn() > ren.ResetCameraClippingRange() > ren.ResetCamera() > > renWin.SetSize(600, 600) > renWin.Render() > > iren.Start() > > > if __name__ == '__main__': > main() > ---- > > Regards > 2018?7?26?(?) 0:15 Lizeth Castellanos : > > > > Thanks for your answers! > > > > For the case 2) I have one more question: How can I add the scalar > values from the intensity ('Field 3') to the data? > > > > I have added those two lines to your code: > > > > scalar = probeFilter.GetOutput().GetPointData().GetArray('Field 3') > > probeFilter.GetOutput().GetPointData().SetScalars(scalar) > > > > But when I render the volume, nothing is displayed in the render window. > > > > Thanks > > > > Lizeth > > > > > > > > > > > > On Tue, Jul 24, 2018 at 11:29 PM, kenichiro yoshimi < > rccm.kyoshimi at gmail.com> wrote: > >> > >> Hi, > >> > >> 1) You need to specify PYTHON_INCLUDE_DIR and PYTHON_LIBRARY to suit > >> your own system in the 'advanced options' in cmake. > >> > >> PYTHON_INCLUDE_DIR will be the name of the directory containing the > Python.h: > >> e.g. /usr/include/python2.7 > >> PYTHON_LIBRARY will be the full path to libpython2.7.so (or.a): > >> e.g. /usr/lib64/libpython2.7.so > >> > >> 2) For example, if you apply vtkProbeFilter to sample.csv in the > >> previous my post, script is something like below. > >> > >> --- > >> import vtk > >> > >> > >> def main(): > >> > >> reader = vtk.vtkDelimitedTextReader() > >> reader.SetFileName('sample.csv') > >> reader.DetectNumericColumnsOn() > >> reader.SetFieldDelimiterCharacters(' ') > >> reader.MergeConsecutiveDelimitersOn() > >> > >> tableToPoints = vtk.vtkTableToPolyData() > >> tableToPoints.SetInputConnection(reader.GetOutputPort()) > >> tableToPoints.SetXColumn('Field 0') > >> tableToPoints.SetYColumn('Field 1') > >> tableToPoints.SetZColumn('Field 2') > >> > >> imageData = vtk.vtkImageData() > >> imageData.SetDimensions(3, 3, 3) > >> imageData.SetOrigin(0.0, 0.0, 0.0) > >> imageData.SetSpacing(1.0, 1.0, 1.0) > >> > >> probeFilter = vtk.vtkProbeFilter() > >> probeFilter.SetSourceConnection(tableToPoints.GetOutputPort()) > >> probeFilter.SetInputData(imageData) > >> probeFilter.Update() > >> > >> writer = vtk.vtkXMLImageDataWriter() > >> writer.SetInputData(probeFilter.GetOutput()) > >> writer.SetFileName('out.vti') > >> writer.Write() > >> > >> > >> if __name__ == '__main__': > >> main() > >> --- > >> > >> For your reference. > >> 2018?7?25?(?) 4:10 Lizeth Castellanos : > >> > > >> > Thanks for your help Kenichiro Yoshimi > >> > > >> > I was able to reproduce some part of your code. However, I > encountered new issues. > >> > > >> > 1)I have all my project under VTK 5.10.1 with python 2.7.12 in linux. > I got this error: 'module' object has no attribute 'vtkResampleToImage'. > >> > So I guess that the vtkResampleToImage class is not avaliable for my > VTK version. > >> > I tried to build a newer VTK version but I didn't get success. I > tried with VTK 7.1.1 and I got errors related to the python libs Could NOT > find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS). > >> > > >> > 2) I read that vtkResampleToImage samples a dataset on a uniform > grid and it internally uses vtkProbeFilter to do the probing. So, Is there > any way to use vtkProbeFilter instead of vtkResampleToImage? > >> > I have tested some examples from vtkProbeFilter but I am confused > about how use it in my specific problem. > >> > > >> > Thanks, > >> > > >> > Lizeth > >> > > >> > On Thu, Jul 19, 2018 at 12:38 AM, kenichiro yoshimi < > rccm.kyoshimi at gmail.com> wrote: > >> >> > >> >> Hi Lizeth, > >> >> > >> >> Because vtkDelimitedTextReader outputs a vtkTable, you firstly need > to > >> >> convert it to a vtkPolyData using vtkTableToPolyData. And then you > can > >> >> use vtkResampleToImage to map the polyData to vtkImageData. > >> >> > >> >> ---sample.csv--- > >> >> 0 0 0 60.7635 > >> >> 1 0 0 107.555 > >> >> 2 0 0 80.5241 > >> >> 0 1 0 85.9694 > >> >> 1 1 0 156.706 > >> >> 2 1 0 105.73 > >> >> 0 2 0 37.3531 > >> >> 1 2 0 84.1445 > >> >> 2 2 0 57.1137 > >> >> 0 0 1 100.634 > >> >> 1 0 1 171.37 > >> >> 2 0 1 120.395 > >> >> 0 1 1 149.785 > >> >> 1 1 1 260 > >> >> 2 1 1 169.546 > >> >> 0 2 1 77.2238 > >> >> 1 2 1 147.96 > >> >> 2 2 1 96.9844 > >> >> 0 0 2 60.7635 > >> >> 1 0 2 107.555 > >> >> 2 0 2 80.5241 > >> >> 0 1 2 85.9694 > >> >> 1 1 2 156.706 > >> >> 2 1 2 105.73 > >> >> 0 2 2 37.3531 > >> >> 1 2 2 84.1445 > >> >> 2 2 2 57.1137 > >> >> > >> >> --- > >> >> import vtk > >> >> > >> >> > >> >> def main(): > >> >> colors = vtk.vtkNamedColors() > >> >> > >> >> reader = vtk.vtkDelimitedTextReader() > >> >> reader.SetFileName('sample.csv') > >> >> reader.DetectNumericColumnsOn() > >> >> reader.SetFieldDelimiterCharacters(' ') > >> >> reader.MergeConsecutiveDelimitersOn() > >> >> > >> >> tableToPoints = vtk.vtkTableToPolyData() > >> >> tableToPoints.SetInputConnection(reader.GetOutputPort()) > >> >> tableToPoints.SetXColumn('Field 0') > >> >> tableToPoints.SetYColumn('Field 1') > >> >> tableToPoints.SetZColumn('Field 2') > >> >> > >> >> resample = vtk.vtkResampleToImage() > >> >> resample.SetInputConnection(tableToPoints.GetOutputPort()) > >> >> resample.SetSamplingDimensions(3, 3, 3) > >> >> resample.Update() > >> >> > >> >> scalar = resample.GetOutput().GetPointData().GetArray('Field 3') > >> >> resample.GetOutput().GetPointData().SetScalars(scalar) > >> >> > >> >> writer = vtk.vtkMetaImageWriter() > >> >> writer.SetInputData(resample.GetOutput()) > >> >> writer.SetFileName('out.mha') > >> >> writer.SetCompression(True) > >> >> writer.Write() > >> >> > >> >> > >> >> if __name__ == '__main__': > >> >> main() > >> >> --- > >> >> > >> >> Best > >> >> 2018?7?19?(?) 3:43 Lizeth Castellanos : > >> >> > > >> >> > Hi! > >> >> > > >> >> > I'd like to copy image data from a textfile (csv) into > vtkImageData. > >> >> > The textfile have voxel values for x,y,z and image intensity. I > already have read the textfile into VTK with the vtkDelimitedTextReader > class: > >> >> > > >> >> > Table loaded from CSV file: > >> >> > +-----------+-----------+-----------+------------+ > >> >> > | Field 0 | Field 1 | Field 2 | Field 3 | > >> >> > +-----------+-----------+-----------+------------+ > >> >> > | 510 | 291 | 0 | 32 | > >> >> > | 511 | 291 | 0 | 128 | > >> >> > | 510 | 292 | 0 | 104 | > >> >> > | 511 | 292 | 0 | 104 | > >> >> > | 510 | 293 | 0 | 40 | > >> >> > | 511 | 293 | 0 | 240 | > >> >> > | 510 | 294 | 0 | 104 | > >> >> > | 511 | 294 | 0 | 96 | > >> >> > | 506 | 295 | 0 | 64 | > >> >> > | 507 | 295 | 0 | 16 | > >> >> > ..... > >> >> > ..... > >> >> > The file is an exported segmented dataset. > >> >> > > >> >> > I am following the tips from this similar question > http://vtk.1045678.n5.nabble.com/importing-image-data-into- > VTK-from-textfile-mimics-td1243332.html > >> >> > I have created an appropriate vtkimagedata (volume): > >> >> > > >> >> > imageData = vtk.vtkImageData() > >> >> > imageData.SetDimensions(512, 512, 192) > >> >> > imageData.SetOrigin(0.0, 0.0, 0.0) > >> >> > imageData.SetSpacing(1, 1, 1) > >> >> > imageData.SetNumberOfScalarComponents(1) > >> >> > imageData.Update() > >> >> > > >> >> > However I don't know how to copy the data loaded from > vtkDelimitedTextReader into vtkImageData. How do I copy the x,y,z voxel > values into vtkImageData? How do I copy the intensity valuesVtkImageData? > >> >> > > >> >> > Any help provided for this would be greatly appreciated! > >> >> > > >> >> > Lizeth > >> >> > > >> >> > > >> >> > _______________________________________________ > >> >> > 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 > >> > > >> > > >> > > >> > > >> > -- > >> > > >> > > >> > > > > > > > > > > > -- > > > > > > > -- Lizeth Castellanos. PhD Student Federal University of Rio Grande do Sul (UFRGS) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: render.png Type: image/png Size: 15442 bytes Desc: not available URL: From rccm.kyoshimi at gmail.com Fri Jul 27 16:37:22 2018 From: rccm.kyoshimi at gmail.com (kenichiro yoshimi) Date: Sat, 28 Jul 2018 05:37:22 +0900 Subject: [vtkusers] Copy image data into vtkImageData from a textfile In-Reply-To: References: Message-ID: Hi, Thank you for sharing your code. At first glance, the parameters of imageData have to be set according to your own data. --- imageData.SetDimensions(512, 512, 192) imageData.SetOrigin(0.0, 0.0, 0.0) imageData.SetSpacing(1, 1, 1) --- And would you try to use vtkSmartVolumeMapper, instead of vtkVolumeRaycastMapper? Thanks 2018?7?28?(?) 4:03 Lizeth Castellanos : > > Hi! > > Thanks for your reply. > My doubt was about how to pass the 'Field 3' to the probe filter. I made some adjust based in your help. However, the output shows two solid cube instead of the points from my segmented dataset. > > I am sending the code and the screenshot of the output. Thanks again :-) > > reader = vtk.vtkDelimitedTextReader() > reader.SetFieldDelimiterCharacters(' ') > reader.DetectNumericColumnsOn() > reader.SetFileName('sample.csv') > reader.MergeConsecutiveDelimitersOn() > reader.Update() > > tableToPoints = vtk.vtkTableToPolyData() > tableToPoints.SetInputConnection(reader.GetOutputPort()) > tableToPoints.SetXColumn('Field 0') > tableToPoints.SetYColumn('Field 1') > tableToPoints.SetZColumn('Field 2') > tableToPoints.Update() > > imageData = vtk.vtkImageData() > imageData.SetDimensions(3, 3, 3) > imageData.SetOrigin(0.0, 0.0, 0.0) > imageData.SetSpacing(1.0, 1.0, 1.0) > imageData.Update() > > probeFilter = vtk.vtkProbeFilter() > probeFilter.SetSourceConnection(tableToPoints.GetOutputPort()) > probeFilter.SetInput(imageData) > probeFilter.Update() > > probeFilter.GetOutput().GetPointData().SetActiveScalars('Field 3') > scalarRange = probeFilter.GetOutput().GetPointData().GetScalars().GetRange() > > writer = vtk.vtkXMLImageDataWriter() > writer.SetInput(probeFilter.GetOutput()) > writer.SetFileName('out.vti') > writer.Write() > > # Create transfer mapping scalar value to opacity. > opacityTransferFunction = vtk.vtkPiecewiseFunction() > opacityTransferFunction.AddPoint(scalarRange[0], 0.0) > opacityTransferFunction.AddPoint(scalarRange[1], 0.5) > > # Create transfer mapping scalar value to color. > colorTransferFunction = vtk.vtkColorTransferFunction() > colorTransferFunction.AddRGBPoint(scalarRange[0], 0.0, 0.0, 1.0) > colorTransferFunction.AddRGBPoint((scalarRange[0]+scalarRange[1])*0.5, 0.0, 1.0, 0.0) > colorTransferFunction.AddRGBPoint(scalarRange[1], 1.0, 0.0, 0.0) > > # The property describes how the data will look. > volumeProperty = vtk.vtkVolumeProperty() > volumeProperty.SetColor(colorTransferFunction) > volumeProperty.SetScalarOpacity(opacityTransferFunction) > volumeProperty.SetScalarOpacityUnitDistance(1.73205080757) > volumeProperty.SetInterpolationTypeToLinear() > volumeProperty.ShadeOn() > > # vtkVolumeRayCastMapper need data of type unsigned char or unsigned short > cast = vtk.vtkImageCast() > cast.SetInputConnection(probeFilter.GetOutputPort()) > cast.SetOutputScalarTypeToUnsignedChar() > cast.Update() > > ## The mapper / ray cast function know how to render the data > compositeFunction = vtk.vtkVolumeRayCastCompositeFunction() > volumeMapper = vtk.vtkVolumeRayCastMapper() > volumeMapper.SetVolumeRayCastFunction(compositeFunction) > volumeMapper.SetInputConnection(cast.GetOutputPort()) > > > #The volume holds the mapper and the property. > volume = vtk.vtkVolume() > volume.SetMapper(volumeMapper) > volume.SetProperty(volumeProperty) > > #Create the standard renderer, render window and interactor > ren = vtk.vtkRenderer() > > renWin = vtk.vtkRenderWindow() > renWin.AddRenderer(ren) > > iren = vtk.vtkRenderWindowInteractor() > iren.SetRenderWindow(renWin) > > ren.AddVolume(volume) > ren.SetBackground(1, 1, 1) > renWin.SetSize(600, 600) > renWin.Render() > > iren.Initialize() > renWin.Render() > iren.Start() > > > > > On Thu, Jul 26, 2018 at 9:35 PM, kenichiro yoshimi wrote: >> >> Hi, >> >> Your question is not clear enough. If you possible, can you post your >> code? I don't have a problem with volume rendering in my code. >> >> ---- >> import vtk >> >> >> def main(): >> >> reader = vtk.vtkDelimitedTextReader() >> reader.SetFileName('sample.csv') >> reader.DetectNumericColumnsOn() >> reader.SetFieldDelimiterCharacters(' ') >> reader.MergeConsecutiveDelimitersOn() >> >> tableToPoints = vtk.vtkTableToPolyData() >> tableToPoints.SetInputConnection(reader.GetOutputPort()) >> tableToPoints.SetXColumn('Field 0') >> tableToPoints.SetYColumn('Field 1') >> tableToPoints.SetZColumn('Field 2') >> >> imageData = vtk.vtkImageData() >> imageData.SetDimensions(3, 3, 3) >> imageData.SetOrigin(0.0, 0.0, 0.0) >> imageData.SetSpacing(1.0, 1.0, 1.0) >> >> probeFilter = vtk.vtkProbeFilter() >> probeFilter.SetSourceConnection(tableToPoints.GetOutputPort()) >> probeFilter.SetInputData(imageData) >> probeFilter.Update() >> >> writer = vtk.vtkXMLImageDataWriter() >> writer.SetInputData(probeFilter.GetOutput()) >> writer.SetFileName('out.vti') >> writer.Write() >> >> probeFilter.GetOutput().GetPointData().SetActiveScalars('Field 3') >> range = probeFilter.GetOutput().GetPointData().GetScalars().GetRange() >> >> colors = vtk.vtkNamedColors() >> >> # Create the standard renderer, render window >> # and interactor. >> ren = vtk.vtkRenderer() >> >> renWin = vtk.vtkRenderWindow() >> renWin.AddRenderer(ren) >> >> iren = vtk.vtkRenderWindowInteractor() >> iren.SetRenderWindow(renWin) >> >> # Create transfer mapping scalar value to opacity. >> opacityTransferFunction = vtk.vtkPiecewiseFunction() >> opacityTransferFunction.AddPoint(range[0], 0.0) >> opacityTransferFunction.AddPoint(range[1], 1.0) >> >> # Create transfer mapping scalar value to color. >> colorTransferFunction = vtk.vtkColorTransferFunction() >> colorTransferFunction.AddRGBPoint(range[0], 0.0, 0.0, 1.0) >> colorTransferFunction.AddRGBPoint((range[0]+range[1])*0.5, 0.0, 1.0, 0.0) >> colorTransferFunction.AddRGBPoint(range[1], 1.0, 0.0, 0.0) >> >> # The property describes how the data will look. >> volumeProperty = vtk.vtkVolumeProperty() >> volumeProperty.SetColor(colorTransferFunction) >> volumeProperty.SetScalarOpacity(opacityTransferFunction) >> volumeProperty.SetScalarOpacityUnitDistance(1.73205080757) >> volumeProperty.SetInterpolationTypeToLinear() >> >> # The mapper / ray cast function know how to render the data. >> volumeMapper = vtk.vtkSmartVolumeMapper() >> volumeMapper.SetInputConnection(probeFilter.GetOutputPort()) >> volumeMapper.SetBlendModeToComposite() >> >> # The volume holds the mapper and the property and >> # can be used to position/orient the volume. >> volume = vtk.vtkVolume() >> volume.SetMapper(volumeMapper) >> volume.SetProperty(volumeProperty) >> >> ren.AddVolume(volume) >> >> ren.SetBackground(colors.GetColor3d("White")) >> ren.GetActiveCamera().ParallelProjectionOn() >> ren.ResetCameraClippingRange() >> ren.ResetCamera() >> >> renWin.SetSize(600, 600) >> renWin.Render() >> >> iren.Start() >> >> >> if __name__ == '__main__': >> main() >> ---- >> >> Regards >> 2018?7?26?(?) 0:15 Lizeth Castellanos : >> > >> > Thanks for your answers! >> > >> > For the case 2) I have one more question: How can I add the scalar values from the intensity ('Field 3') to the data? >> > >> > I have added those two lines to your code: >> > >> > scalar = probeFilter.GetOutput().GetPointData().GetArray('Field 3') >> > probeFilter.GetOutput().GetPointData().SetScalars(scalar) >> > >> > But when I render the volume, nothing is displayed in the render window. >> > >> > Thanks >> > >> > Lizeth >> > >> > >> > >> > >> > >> > On Tue, Jul 24, 2018 at 11:29 PM, kenichiro yoshimi wrote: >> >> >> >> Hi, >> >> >> >> 1) You need to specify PYTHON_INCLUDE_DIR and PYTHON_LIBRARY to suit >> >> your own system in the 'advanced options' in cmake. >> >> >> >> PYTHON_INCLUDE_DIR will be the name of the directory containing the Python.h: >> >> e.g. /usr/include/python2.7 >> >> PYTHON_LIBRARY will be the full path to libpython2.7.so (or.a): >> >> e.g. /usr/lib64/libpython2.7.so >> >> >> >> 2) For example, if you apply vtkProbeFilter to sample.csv in the >> >> previous my post, script is something like below. >> >> >> >> --- >> >> import vtk >> >> >> >> >> >> def main(): >> >> >> >> reader = vtk.vtkDelimitedTextReader() >> >> reader.SetFileName('sample.csv') >> >> reader.DetectNumericColumnsOn() >> >> reader.SetFieldDelimiterCharacters(' ') >> >> reader.MergeConsecutiveDelimitersOn() >> >> >> >> tableToPoints = vtk.vtkTableToPolyData() >> >> tableToPoints.SetInputConnection(reader.GetOutputPort()) >> >> tableToPoints.SetXColumn('Field 0') >> >> tableToPoints.SetYColumn('Field 1') >> >> tableToPoints.SetZColumn('Field 2') >> >> >> >> imageData = vtk.vtkImageData() >> >> imageData.SetDimensions(3, 3, 3) >> >> imageData.SetOrigin(0.0, 0.0, 0.0) >> >> imageData.SetSpacing(1.0, 1.0, 1.0) >> >> >> >> probeFilter = vtk.vtkProbeFilter() >> >> probeFilter.SetSourceConnection(tableToPoints.GetOutputPort()) >> >> probeFilter.SetInputData(imageData) >> >> probeFilter.Update() >> >> >> >> writer = vtk.vtkXMLImageDataWriter() >> >> writer.SetInputData(probeFilter.GetOutput()) >> >> writer.SetFileName('out.vti') >> >> writer.Write() >> >> >> >> >> >> if __name__ == '__main__': >> >> main() >> >> --- >> >> >> >> For your reference. >> >> 2018?7?25?(?) 4:10 Lizeth Castellanos : >> >> > >> >> > Thanks for your help Kenichiro Yoshimi >> >> > >> >> > I was able to reproduce some part of your code. However, I encountered new issues. >> >> > >> >> > 1)I have all my project under VTK 5.10.1 with python 2.7.12 in linux. I got this error: 'module' object has no attribute 'vtkResampleToImage'. >> >> > So I guess that the vtkResampleToImage class is not avaliable for my VTK version. >> >> > I tried to build a newer VTK version but I didn't get success. I tried with VTK 7.1.1 and I got errors related to the python libs Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS). >> >> > >> >> > 2) I read that vtkResampleToImage samples a dataset on a uniform grid and it internally uses vtkProbeFilter to do the probing. So, Is there any way to use vtkProbeFilter instead of vtkResampleToImage? >> >> > I have tested some examples from vtkProbeFilter but I am confused about how use it in my specific problem. >> >> > >> >> > Thanks, >> >> > >> >> > Lizeth >> >> > >> >> > On Thu, Jul 19, 2018 at 12:38 AM, kenichiro yoshimi wrote: >> >> >> >> >> >> Hi Lizeth, >> >> >> >> >> >> Because vtkDelimitedTextReader outputs a vtkTable, you firstly need to >> >> >> convert it to a vtkPolyData using vtkTableToPolyData. And then you can >> >> >> use vtkResampleToImage to map the polyData to vtkImageData. >> >> >> >> >> >> ---sample.csv--- >> >> >> 0 0 0 60.7635 >> >> >> 1 0 0 107.555 >> >> >> 2 0 0 80.5241 >> >> >> 0 1 0 85.9694 >> >> >> 1 1 0 156.706 >> >> >> 2 1 0 105.73 >> >> >> 0 2 0 37.3531 >> >> >> 1 2 0 84.1445 >> >> >> 2 2 0 57.1137 >> >> >> 0 0 1 100.634 >> >> >> 1 0 1 171.37 >> >> >> 2 0 1 120.395 >> >> >> 0 1 1 149.785 >> >> >> 1 1 1 260 >> >> >> 2 1 1 169.546 >> >> >> 0 2 1 77.2238 >> >> >> 1 2 1 147.96 >> >> >> 2 2 1 96.9844 >> >> >> 0 0 2 60.7635 >> >> >> 1 0 2 107.555 >> >> >> 2 0 2 80.5241 >> >> >> 0 1 2 85.9694 >> >> >> 1 1 2 156.706 >> >> >> 2 1 2 105.73 >> >> >> 0 2 2 37.3531 >> >> >> 1 2 2 84.1445 >> >> >> 2 2 2 57.1137 >> >> >> >> >> >> --- >> >> >> import vtk >> >> >> >> >> >> >> >> >> def main(): >> >> >> colors = vtk.vtkNamedColors() >> >> >> >> >> >> reader = vtk.vtkDelimitedTextReader() >> >> >> reader.SetFileName('sample.csv') >> >> >> reader.DetectNumericColumnsOn() >> >> >> reader.SetFieldDelimiterCharacters(' ') >> >> >> reader.MergeConsecutiveDelimitersOn() >> >> >> >> >> >> tableToPoints = vtk.vtkTableToPolyData() >> >> >> tableToPoints.SetInputConnection(reader.GetOutputPort()) >> >> >> tableToPoints.SetXColumn('Field 0') >> >> >> tableToPoints.SetYColumn('Field 1') >> >> >> tableToPoints.SetZColumn('Field 2') >> >> >> >> >> >> resample = vtk.vtkResampleToImage() >> >> >> resample.SetInputConnection(tableToPoints.GetOutputPort()) >> >> >> resample.SetSamplingDimensions(3, 3, 3) >> >> >> resample.Update() >> >> >> >> >> >> scalar = resample.GetOutput().GetPointData().GetArray('Field 3') >> >> >> resample.GetOutput().GetPointData().SetScalars(scalar) >> >> >> >> >> >> writer = vtk.vtkMetaImageWriter() >> >> >> writer.SetInputData(resample.GetOutput()) >> >> >> writer.SetFileName('out.mha') >> >> >> writer.SetCompression(True) >> >> >> writer.Write() >> >> >> >> >> >> >> >> >> if __name__ == '__main__': >> >> >> main() >> >> >> --- >> >> >> >> >> >> Best >> >> >> 2018?7?19?(?) 3:43 Lizeth Castellanos : >> >> >> > >> >> >> > Hi! >> >> >> > >> >> >> > I'd like to copy image data from a textfile (csv) into vtkImageData. >> >> >> > The textfile have voxel values for x,y,z and image intensity. I already have read the textfile into VTK with the vtkDelimitedTextReader class: >> >> >> > >> >> >> > Table loaded from CSV file: >> >> >> > +-----------+-----------+-----------+------------+ >> >> >> > | Field 0 | Field 1 | Field 2 | Field 3 | >> >> >> > +-----------+-----------+-----------+------------+ >> >> >> > | 510 | 291 | 0 | 32 | >> >> >> > | 511 | 291 | 0 | 128 | >> >> >> > | 510 | 292 | 0 | 104 | >> >> >> > | 511 | 292 | 0 | 104 | >> >> >> > | 510 | 293 | 0 | 40 | >> >> >> > | 511 | 293 | 0 | 240 | >> >> >> > | 510 | 294 | 0 | 104 | >> >> >> > | 511 | 294 | 0 | 96 | >> >> >> > | 506 | 295 | 0 | 64 | >> >> >> > | 507 | 295 | 0 | 16 | >> >> >> > ..... >> >> >> > ..... >> >> >> > The file is an exported segmented dataset. >> >> >> > >> >> >> > I am following the tips from this similar question http://vtk.1045678.n5.nabble.com/importing-image-data-into-VTK-from-textfile-mimics-td1243332.html >> >> >> > I have created an appropriate vtkimagedata (volume): >> >> >> > >> >> >> > imageData = vtk.vtkImageData() >> >> >> > imageData.SetDimensions(512, 512, 192) >> >> >> > imageData.SetOrigin(0.0, 0.0, 0.0) >> >> >> > imageData.SetSpacing(1, 1, 1) >> >> >> > imageData.SetNumberOfScalarComponents(1) >> >> >> > imageData.Update() >> >> >> > >> >> >> > However I don't know how to copy the data loaded from vtkDelimitedTextReader into vtkImageData. How do I copy the x,y,z voxel values into vtkImageData? How do I copy the intensity valuesVtkImageData? >> >> >> > >> >> >> > Any help provided for this would be greatly appreciated! >> >> >> > >> >> >> > Lizeth >> >> >> > >> >> >> > >> >> >> > _______________________________________________ >> >> >> > 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 >> >> > >> >> > >> >> > >> >> > >> >> > -- >> >> > >> >> > >> >> > >> > >> > >> > >> > >> > -- >> > >> > >> > > > > > > -- > Lizeth Castellanos. > PhD Student > Federal University of Rio Grande do Sul (UFRGS) > > From bill.lorensen at gmail.com Fri Jul 27 21:10:59 2018 From: bill.lorensen at gmail.com (Bill Lorensen) Date: Fri, 27 Jul 2018 18:10:59 -0700 Subject: [vtkusers] New vtkCollisionDetectionFilter progress Message-ID: Folks, The code has been converted to new VTK style. It also compiles. The code needs a lot more testing. I've started a unit test to try and get 1005 verified code. Then I'll\ add a functional test that demonstrates the filter. More documentation is needed and I'll add that as I understand the code better after writing the unit test. Here is the current MR: https://gitlab.kitware.com/vtk/vtk/merge_requests/4527 Stay tuned. Bill -- Unpaid intern in BillsParadise at noware dot com From adam.turner93 at icloud.com Sat Jul 28 05:26:24 2018 From: adam.turner93 at icloud.com (Adam Turner) Date: Sat, 28 Jul 2018 10:26:24 +0100 Subject: [vtkusers] VTK data visualisation from STL file (using PYTHON 3) Message-ID: <26e1c258-be31-9bce-9f4f-b59f9d9bd2d6@icloud.com> Good morning, I'm new to VTK and trying to use it to create a visualisation on a 3D model. I have my model saved as an STL file and successfully been able to import that into my Python Script and render it on screen. However, it is several steps short of where I need my visualisation to be.? Please could someone help me achieve the following? 1. I need to assign colours to specific locations on the Model, which will be represent pressure data from sensors on the real object. 2. I need to then interpolate between these specific locations to display a complete visualisation across the model. 3. Finally I need a colour scale to help the user know what the colours represent, namely what the values at min and max are and what colour represents those values. I really hope someone is able to lend their assistance or can point me to an existing tutorial! I don't seem to be able to find one. Thank you for your time in advance, Adam From david.ansari at gmail.com Sat Jul 28 09:35:32 2018 From: david.ansari at gmail.com (Davood Ansari) Date: Sat, 28 Jul 2018 09:35:32 -0400 Subject: [vtkusers] Emails slipping through my gmail filters Message-ID: Hi everyone I noticed that a relatively high number of email from vtkusers are escaping through my email filters and showing in my general mailbox. I cannot say for sure why this is happening but I though someone else may have run into this issue as well. Any thoughts? Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Sat Jul 28 09:53:23 2018 From: david.gobbi at gmail.com (David Gobbi) Date: Sat, 28 Jul 2018 07:53:23 -0600 Subject: [vtkusers] Emails slipping through my gmail filters In-Reply-To: References: Message-ID: Hi Davood, Gmail was doing the same thing to me a couple months ago. I had to edit my filters, previously they used list:() but now they use list:(). Kitware must have changed the mailing list server. - David On Sat, Jul 28, 2018 at 7:35 AM, Davood Ansari wrote: > Hi everyone > > I noticed that a relatively high number of email from vtkusers are > escaping through my email filters and showing in my general mailbox. I > cannot say for sure why this is happening but I though someone else may > have run into this issue as well. > Any thoughts? > Thank you > -------------- next part -------------- An HTML attachment was scrubbed... URL: From marvin.huber at basf.com Mon Jul 30 07:33:33 2018 From: marvin.huber at basf.com (marf) Date: Mon, 30 Jul 2018 04:33:33 -0700 (MST) Subject: [vtkusers] Create PolyData in vtk.js In-Reply-To: References: <1531834753471-0.post@n5.nabble.com> <1531909273485-0.post@n5.nabble.com> <1531919963954-0.post@n5.nabble.com> <1532521153708-0.post@n5.nabble.com> <1532677918372-0.post@n5.nabble.com> <1532678063629-0.post@n5.nabble.com> Message-ID: <1532950413133-0.post@n5.nabble.com> Thanks again, I previously tried filtering out duplicate faces and found an efficient way to do it with hashes. Even though I can now half the number of faces for my model, it will render as thought there are inner faces present: Whereas, when looked at it from another angle you can clearly see, there are no more inner faces present (which also HAS to be the case, since I slim down the amount of rendered faces from 38.000 to 20.000 without effecting the outer surface) Do you have any idea whats going on there? I apply a scalar to the polydata and then color it using a vtkLookupTable and that works perfectly otherwise. Also, the scalardata is per point, and since every point is on the surface in my case, the should not change with changing faces right? -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From shayan.moradkhani at gmail.com Mon Jul 30 07:34:08 2018 From: shayan.moradkhani at gmail.com (shayan moradkhani) Date: Mon, 30 Jul 2018 04:34:08 -0700 (MST) Subject: [vtkusers] camera Message-ID: <1532950448864-0.post@n5.nabble.com> hi, in the examples: DataAnimation.cpp and other examples i came across, when we use the mouse interaction such as camera rotation, the movement stops as long as the mouse buttons are pressed, and once they are released, the movement continues. or in TransformPipeline.cpp example, there is no mouse interaction possibility until the movement is completed and then we can rotate the camera. how can i make this camera interaction independent of the what is happening in the window? regards Shayan -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From newcfd at yahoo.com Mon Jul 30 08:32:18 2018 From: newcfd at yahoo.com (newcfd) Date: Mon, 30 Jul 2018 05:32:18 -0700 (MST) Subject: [vtkusers] qvtkWidget(8.1) does not resize horizontally In-Reply-To: References: <1532513505962-0.post@n5.nabble.com> <1532660846009-0.post@n5.nabble.com> Message-ID: <1532953938444-0.post@n5.nabble.com> Got it.Thanks -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From sebastien.jourdain at kitware.com Mon Jul 30 10:33:33 2018 From: sebastien.jourdain at kitware.com (Sebastien Jourdain) Date: Mon, 30 Jul 2018 08:33:33 -0600 Subject: [vtkusers] Create PolyData in vtk.js In-Reply-To: <1532950413133-0.post@n5.nabble.com> References: <1531834753471-0.post@n5.nabble.com> <1531909273485-0.post@n5.nabble.com> <1531919963954-0.post@n5.nabble.com> <1532521153708-0.post@n5.nabble.com> <1532677918372-0.post@n5.nabble.com> <1532678063629-0.post@n5.nabble.com> <1532950413133-0.post@n5.nabble.com> Message-ID: Having inner surface is not an issue especially if you don't put any transparency. The draw back will only be that you try to draw more data that you truly need and depending on your data size, this could affect the rendering performance. But other than that, there is no issue. On Mon, Jul 30, 2018 at 5:33 AM marf wrote: > Thanks again, I previously tried filtering out duplicate faces and found an > efficient way to do it with hashes. Even though I can now half the number > of > faces for my model, it will render as thought there are inner faces > present: > > > > Whereas, when looked at it from another angle you can clearly see, there > are > no more inner faces present (which also HAS to be the case, since I slim > down the amount of rendered faces from 38.000 to 20.000 without effecting > the outer surface) > > > > Do you have any idea whats going on there? I apply a scalar to the polydata > and then color it using a vtkLookupTable and that works perfectly > otherwise. > Also, the scalardata is per point, and since every point is on the surface > in my case, the should not change with changing faces right? > > > > -- > 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 marvin.huber at basf.com Mon Jul 30 10:49:29 2018 From: marvin.huber at basf.com (marf) Date: Mon, 30 Jul 2018 07:49:29 -0700 (MST) Subject: [vtkusers] Create PolyData in vtk.js In-Reply-To: References: <1531909273485-0.post@n5.nabble.com> <1531919963954-0.post@n5.nabble.com> <1532521153708-0.post@n5.nabble.com> <1532677918372-0.post@n5.nabble.com> <1532678063629-0.post@n5.nabble.com> <1532950413133-0.post@n5.nabble.com> Message-ID: <1532962169905-0.post@n5.nabble.com> I know, but I want/need transparency, and even though I seem to get rid of the inner faces (I cut the total number of faces in half) they seem to be renderer :-/ There is and was absolutely no issue with speed of rendering of fps, its just that I need transparency and don't want inner faces to show -- Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html From sebastien.jourdain at kitware.com Mon Jul 30 10:52:58 2018 From: sebastien.jourdain at kitware.com (Sebastien Jourdain) Date: Mon, 30 Jul 2018 08:52:58 -0600 Subject: [vtkusers] Create PolyData in vtk.js In-Reply-To: <1532962169905-0.post@n5.nabble.com> References: <1531909273485-0.post@n5.nabble.com> <1531919963954-0.post@n5.nabble.com> <1532521153708-0.post@n5.nabble.com> <1532677918372-0.post@n5.nabble.com> <1532678063629-0.post@n5.nabble.com> <1532950413133-0.post@n5.nabble.com> <1532962169905-0.post@n5.nabble.com> Message-ID: The transparency currently have some limitation in vtk.js since we don't have implemented depth peeling yet. Some of those artifact could be related to that current limitation. On Mon, Jul 30, 2018 at 8:49 AM marf wrote: > I know, but I want/need transparency, and even though I seem to get rid of > the inner faces (I cut the total number of faces in half) they seem to be > renderer :-/ > There is and was absolutely no issue with speed of rendering of fps, its > just that I need transparency and don't want inner faces to show > > > > -- > 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 ken.martin at kitware.com Mon Jul 30 12:46:13 2018 From: ken.martin at kitware.com (Ken Martin) Date: Mon, 30 Jul 2018 12:46:13 -0400 Subject: [vtkusers] vtk + openvr + python In-Reply-To: References: Message-ID: I think this is fixed in VTK master. - Ken On Tue, Jul 10, 2018 at 11:24 AM, Serge K. wrote: > Hi All, > > I just compiled VTK 8.1.1 with OpenVR 1.0.15 and python wrapping (windows > 64bit - python 3.6) > > When I import vtk module in a python interpreter, I do not have access to > these functions : > - vtk.vtkOpenVRRenderer() > - vtk.vtkOpenVRRenderWindow() > - vtk.vtkOpenVRRenderWindowInteractor() > - vtk.vtkOpenVRCustomInteractorStyle() > > The only available function is : vtkRenderingOpenVRObjectFactory. > Below, this is what I obtain after a "dir" > > In [5]: import vtk.vtkRenderingOpenVRPython as vr > > In [6]: dir(vr) > Out[6]: > ['__doc__', > '__file__', > '__loader__', > '__name__', > '__package__', > '__spec__', > 'vtkRenderingOpenVRObjectFactory'] > > Is it normal? Did I forget something during compilation step? What did I > do wrong? How can I get these functions? > > Thanks in advance for any suggestion > > Serge K. > > > _______________________________________________ > 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 skab12 at gmail.com Mon Jul 30 13:00:50 2018 From: skab12 at gmail.com (Serge K.) Date: Mon, 30 Jul 2018 19:00:50 +0200 Subject: [vtkusers] vtk + openvr + python In-Reply-To: References: Message-ID: Great, thanks for this information ken! I will try it. Serge K. On Mon, Jul 30, 2018 at 6:46 PM Ken Martin wrote: > I think this is fixed in VTK master. - Ken > > On Tue, Jul 10, 2018 at 11:24 AM, Serge K. wrote: > >> Hi All, >> >> I just compiled VTK 8.1.1 with OpenVR 1.0.15 and python wrapping (windows >> 64bit - python 3.6) >> >> When I import vtk module in a python interpreter, I do not have access to >> these functions : >> - vtk.vtkOpenVRRenderer() >> - vtk.vtkOpenVRRenderWindow() >> - vtk.vtkOpenVRRenderWindowInteractor() >> - vtk.vtkOpenVRCustomInteractorStyle() >> >> The only available function is : vtkRenderingOpenVRObjectFactory. >> Below, this is what I obtain after a "dir" >> >> In [5]: import vtk.vtkRenderingOpenVRPython as vr >> >> In [6]: dir(vr) >> Out[6]: >> ['__doc__', >> '__file__', >> '__loader__', >> '__name__', >> '__package__', >> '__spec__', >> 'vtkRenderingOpenVRObjectFactory'] >> >> Is it normal? Did I forget something during compilation step? What did I >> do wrong? How can I get these functions? >> >> Thanks in advance for any suggestion >> >> Serge K. >> >> >> _______________________________________________ >> 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 omalyushytskyvtkuser at gmail.com Mon Jul 30 15:16:23 2018 From: omalyushytskyvtkuser at gmail.com (Oleksandr Malyushytsky) Date: Mon, 30 Jul 2018 12:16:23 -0700 Subject: [vtkusers] VTK data visualisation from STL file (using PYTHON 3) In-Reply-To: <26e1c258-be31-9bce-9f4f-b59f9d9bd2d6@icloud.com> References: <26e1c258-be31-9bce-9f4f-b59f9d9bd2d6@icloud.com> Message-ID: 1-2 Interpolation withing the cell can be done by VTK, but at least without specifying the logic, vtk has no way to know how the data changes between your arbitrary points. So,I afraid You need to assign data values to every cell point (vtkPointData) yourself. 3 Then you can display data using vtkLookupTable, which would present point data as a color. cell will be colored by interpolating the colors from cell points. One of the (not an exactly what you need) example I could find: https://lorensen.github.io/VTKExamples/site/Cxx/Graphs/ColorVerticesLookupTable/ You need one data value per node. Better example is present in VTK book. The vtk example web page may contains more suitable for you example, but for some reason I cant open them right now. You may have more luck , check https://www.vtk.org/Wiki/VTK/Examples/Cxx Best regards, Alex On Sat, Jul 28, 2018 at 2:26 AM, Adam Turner via vtkusers < vtkusers at public.kitware.com> wrote: > Good morning, > > I'm new to VTK and trying to use it to create a visualisation on a 3D > model. I have my model saved as an STL file and successfully been able to > import that into my Python Script and render it on screen. However, it is > several steps short of where I need my visualisation to be. Please could > someone help me achieve the following? > > 1. I need to assign colours to specific locations on the Model, which will > be represent pressure data from sensors on the real object. > > 2. I need to then interpolate between these specific locations to display > a complete visualisation across the model. > > 3. Finally I need a colour scale to help the user know what the colours > represent, namely what the values at min and max are and what colour > represents those values. > > I really hope someone is able to lend their assistance or can point me to > an existing tutorial! I don't seem to be able to find one. > > Thank you for your time in advance, > > Adam > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at http://www.kitware.com/opensou > rce/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 newcowbow1104 at gmail.com Mon Jul 30 21:43:56 2018 From: newcowbow1104 at gmail.com (Feng Yang) Date: Tue, 31 Jul 2018 09:43:56 +0800 Subject: [vtkusers] About camera.setParallelProjection(true) in vtk.js Message-ID: Hi Sir. I'm doing medical imaging volume rendering with vtk.js in my application. And I have a problem here. Before camera.setParallelProjection(true), everything looks fine. the result is ok. but After camera.setParallelProjection(true) , Nothing is shown. Why is that. Am I missing something here. thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From sebastien.jourdain at kitware.com Mon Jul 30 21:56:06 2018 From: sebastien.jourdain at kitware.com (Sebastien Jourdain) Date: Mon, 30 Jul 2018 19:56:06 -0600 Subject: [vtkusers] About camera.setParallelProjection(true) in vtk.js In-Reply-To: References: Message-ID: Did you try calling renderder.resetCamera() after calling camera.setParallelProjection(true) ? On Mon, Jul 30, 2018 at 7:43 PM Feng Yang wrote: > Hi Sir. > I'm doing medical imaging volume rendering with vtk.js in my > application. > And I have a problem here. > Before camera.setParallelProjection(true), everything looks fine. > the result is ok. > but After camera.setParallelProjection(true) , Nothing is shown. > Why is that. Am I missing something here. > > 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 newcowbow1104 at gmail.com Mon Jul 30 22:52:57 2018 From: newcowbow1104 at gmail.com (Feng Yang) Date: Tue, 31 Jul 2018 10:52:57 +0800 Subject: [vtkusers] volume rendering view orientation question in vtk.js Message-ID: Hi sir. I'm doing medical imaging volume rendering with vtk.js in my application. There is a basic feature that user can see the volume imaging in sagittal,Transversal and Coronal view. Could you tell me some hint or example that how to implement this function in vtk.js. Thanks a lot. -------------- next part -------------- An HTML attachment was scrubbed... URL: From amazuyer at stanford.edu Mon Jul 30 23:39:23 2018 From: amazuyer at stanford.edu (Antoine Mazuyer) Date: Tue, 31 Jul 2018 03:39:23 +0000 Subject: [vtkusers] VTM : Multiblock of DataSet Message-ID: Hi everyone. My goal is to have a vtm file witch n Blocks, each block containing some DataSet With this sample of code , running on MPI with 2 processes, vtkSmartPointer vtm = vtkXMLPMultiBlockDataWriter::New() vtkSmartPointer block= vtkMultiBlockDataSet::New(); block->SetNumberOfBlocks(4); vtkSmartPointer multi_block= vtkMultiBlockDataSet::New(); multi_block->SetNumberOfBlocks(Communicator::worldSize()); multi_block->SetBlock(Communicator::worldRank(),block); std::string filename = m_name + ".vtm"; vtm->SetInputData(multi_block); vtm->SetFileName(filename.c_str()); vtm->Write(); I have this output I don' t understand why I have one Block with 4 DataSets and one DataSet alone. The result that I expect is : What am I doing wrong ? How can I achieve to have two blocks (corresponding of the number of MPI processes), each one containing several DataSets ? Thanks in advance, Antoine. -------------- next part -------------- An HTML attachment was scrubbed... URL: From marefin at uwo.ca Tue Jul 31 12:23:37 2018 From: marefin at uwo.ca (Arefin Shamsil) Date: Tue, 31 Jul 2018 12:23:37 -0400 Subject: [vtkusers] Displaying ITK image via VTK viewer on Qt GUI Message-ID: Hello there Awesome VTK community, I have been trying to make a Qt app work for a few days with no success. The screenshot of the app is attached in this email. In this app (please look at the screenshot), the user will first select a directory. Once the directory is loaded, the user will click the "Feed a Dataset" button. It will then trigger an ITK function to read a file and execute a simple VTK function to display a 2D ultrasound image on the designated window. When the button is clicked again, the window should clear off and display the next image. That's is for now. The ultimate purpose of this application is to visualize incremental volume reconstruction from an already recorded tracked series of ultrasound images by providing an image one at a time. This has been done in many ways before. Nothing really new. The app runs fine and I am able to select a directory. THE PROBLEM is when I click the "Feed a Dataset" button, nothing displays on the window, the app freezes and then closes. I tried many ways but cannot really figure out why this is happening. The Ultrasound window is an object of class QVTKWidget. And the VTK function I am calling from inside the button's slot function is as follows. *void USImageViewer::viewonUSwindow(ImageType2D::Pointer usImage)*{ // setup and connect itk with vtk vtkConnectorType::Pointer connector = vtkConnectorType::New(); connector->SetInput(tacImage); connector->Update(); // seems to be ok until here // Convert to vtk image vtkImage = vtkSmartPointer::New(); vtkImage->DeepCopy(connector->GetOutput()); // hangs during executing this line, indicating something is wrong with the connector // Image actor tacIMactor = vtkSmartPointer::New(); tacIMactor->GetMapper()->SetInputData(vtkImage); renderer = vtkSmartPointer::New(); renderer->AddActor(tacIMactor); renderer->ResetCamera(); ui->usImQVTKviewer->GetRenderWindow()->AddRenderer(renderer); ui->usImQVTKviewer->update(); } Can anyone please help me out in this? Your help is much appreciated. Sincerely Shams -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Capture.JPG Type: image/jpeg Size: 28248 bytes Desc: not available URL: From shandoosheri at gmail.com Tue Jul 31 16:12:17 2018 From: shandoosheri at gmail.com (Shady Nawara) Date: Tue, 31 Jul 2018 15:12:17 -0500 Subject: [vtkusers] point picking through vtkboxwidget Message-ID: Hi, I have been trying to pick a point from an actor while the vtkBoxWidget is visible but it appears that it doesnt allow any interaction to go through to the underlying actor. Does anybody have a way around this. Thanks, Shady Nawara -------------- next part -------------- An HTML attachment was scrubbed... URL: From omalyushytskyvtkuser at gmail.com Tue Jul 31 18:48:33 2018 From: omalyushytskyvtkuser at gmail.com (Oleksandr Malyushytsky) Date: Tue, 31 Jul 2018 15:48:33 -0700 Subject: [vtkusers] Using QVTKOpenGLWidget in QGraphics view and replacement for deprecated QVTKGraphicsItem Message-ID: QVTKWidget and QVTKWidget2 are deprecated due to QGLWidget be deprecated in Qt. There is a replacement - QVTKOpenGLWidget which is subclassing QOpenGLWidget. But it seems there is no real support for using vtk in QGraphicsScene. Using QVTKOpenGLWidget as a background for QGraphicsScene is relatively simple. But QVTKGraphicsItem is still derived from QVTKWidget and is using QGLContext (depricated). Are there plans or example of QVTKGraphicsItem equivalent ("QVTKOpenGLGraphicsItem) ? Best regards, Alex -------------- next part -------------- An HTML attachment was scrubbed... URL: From omalyushytskyvtkuser at gmail.com Tue Jul 31 18:58:27 2018 From: omalyushytskyvtkuser at gmail.com (Oleksandr Malyushytsky) Date: Tue, 31 Jul 2018 15:58:27 -0700 Subject: [vtkusers] point picking through vtkboxwidget In-Reply-To: References: Message-ID: have you tried to disable it before picking ? SetEnabled(1) On Tue, Jul 31, 2018 at 1:12 PM, Shady Nawara wrote: > Hi, > I have been trying to pick a point from an actor while the vtkBoxWidget is > visible but it appears that it doesnt allow any interaction to go through > to the underlying actor. Does anybody have a way around this. > > Thanks, > Shady Nawara > > _______________________________________________ > 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 shandoosheri at gmail.com Tue Jul 31 19:14:09 2018 From: shandoosheri at gmail.com (Shady Nawara) Date: Tue, 31 Jul 2018 18:14:09 -0500 Subject: [vtkusers] point picking through vtkboxwidget In-Reply-To: References: Message-ID: I still kinda wanted it to be visible as I am mainly using it to show the boundary of the actor. On Tue, Jul 31, 2018 at 5:58 PM Oleksandr Malyushytsky < omalyushytskyvtkuser at gmail.com> wrote: > have you tried to disable it before picking ? > SetEnabled(1) > > On Tue, Jul 31, 2018 at 1:12 PM, Shady Nawara > wrote: > >> Hi, >> I have been trying to pick a point from an actor while the vtkBoxWidget >> is visible but it appears that it doesnt allow any interaction to go >> through to the underlying actor. Does anybody have a way around this. >> >> Thanks, >> Shady Nawara >> >> _______________________________________________ >> 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: