Re: [Paraview] Saving Programmable Filter as a PNG image
Hi Utkarsh, Excellent! That works!! Magician On Feb 5, 2014, at 4:04, Utkarsh Ayachit utkarsh.ayac...@kitware.com wrote: In vtkImageData, the scalars are associated with points, not cell. Add the unsigned char array to the PointData, not CellData. Also note that you'll need to update your whole extent, image dimensions etc. since now you have 3x3 points and not 3x3 cells (==4x4 points). Utkarsh On Tue, Feb 4, 2014 at 11:08 AM, Magician f_magic...@mac.com wrote: Hi all, I want to save vtkImageData as a PNG image. The vtkImageData is generated by Programmable Filter. My PV version is 4.1.0. I have a small CSV data as below: 1,0.5,0 0.5,1,0.5 0,0.5,1 I opened the data and applied the Programmable Filter as below: #Output Data Set Type: vtkImageData #Script: inp = self.GetInput() out = self.GetOutput() out.SetDimensions(4, 4, 1) out.SetOrigin(0, 0, 0) out.SetSpacing(1, 1, 1) ca = vtk.vtkUnsignedCharArray() ca.SetName('image') ca.SetNumberOfComponents(3) ca.SetNumberOfTuples(9) out.GetCellData().SetScalars(ca) for i in range(3): for j in range(3): ca.SetTuple3(i * 3 + j, inp.GetValue(i, j).ToFloat() * 255.0, 0.0, 0.0) #RequestInformation Script: from paraview import util inp = self.GetInput() util.SetOutputWholeExtent(self, [0, 3, 0, 3, 0, 0]) I got a 3x3 matrix image on the View. Then I saved the data as a PNG image, I got the warning and no image was found: Warning: In /Users/kitware/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release/paraview/src/paraview/VTK/IO/Image/vtkPNGWriter.cxx, line 198 vtkPNGWriter (0x11c80a540): PNGWriter only supports unsigned char and unsigned short inputs How can I save the Programmable Filter as an image? Magician ___ 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 ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview ___ 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 ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview
[Paraview] Saving Programmable Filter as a PNG image
Hi all, I want to save vtkImageData as a PNG image. The vtkImageData is generated by Programmable Filter. My PV version is 4.1.0. I have a small CSV data as below: 1,0.5,0 0.5,1,0.5 0,0.5,1 I opened the data and applied the Programmable Filter as below: #Output Data Set Type: vtkImageData #Script: inp = self.GetInput() out = self.GetOutput() out.SetDimensions(4, 4, 1) out.SetOrigin(0, 0, 0) out.SetSpacing(1, 1, 1) ca = vtk.vtkUnsignedCharArray() ca.SetName('image') ca.SetNumberOfComponents(3) ca.SetNumberOfTuples(9) out.GetCellData().SetScalars(ca) for i in range(3): for j in range(3): ca.SetTuple3(i * 3 + j, inp.GetValue(i, j).ToFloat() * 255.0, 0.0, 0.0) #RequestInformation Script: from paraview import util inp = self.GetInput() util.SetOutputWholeExtent(self, [0, 3, 0, 3, 0, 0]) I got a 3x3 matrix image on the View. Then I saved the data as a PNG image, I got the warning and no image was found: Warning: In /Users/kitware/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release/paraview/src/paraview/VTK/IO/Image/vtkPNGWriter.cxx, line 198 vtkPNGWriter (0x11c80a540): PNGWriter only supports unsigned char and unsigned short inputs How can I save the Programmable Filter as an image? Magician ___ 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 ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview
Re: [Paraview] Saving Programmable Filter as a PNG image
In vtkImageData, the scalars are associated with points, not cell. Add the unsigned char array to the PointData, not CellData. Also note that you'll need to update your whole extent, image dimensions etc. since now you have 3x3 points and not 3x3 cells (==4x4 points). Utkarsh On Tue, Feb 4, 2014 at 11:08 AM, Magician f_magic...@mac.com wrote: Hi all, I want to save vtkImageData as a PNG image. The vtkImageData is generated by Programmable Filter. My PV version is 4.1.0. I have a small CSV data as below: 1,0.5,0 0.5,1,0.5 0,0.5,1 I opened the data and applied the Programmable Filter as below: #Output Data Set Type: vtkImageData #Script: inp = self.GetInput() out = self.GetOutput() out.SetDimensions(4, 4, 1) out.SetOrigin(0, 0, 0) out.SetSpacing(1, 1, 1) ca = vtk.vtkUnsignedCharArray() ca.SetName('image') ca.SetNumberOfComponents(3) ca.SetNumberOfTuples(9) out.GetCellData().SetScalars(ca) for i in range(3): for j in range(3): ca.SetTuple3(i * 3 + j, inp.GetValue(i, j).ToFloat() * 255.0, 0.0, 0.0) #RequestInformation Script: from paraview import util inp = self.GetInput() util.SetOutputWholeExtent(self, [0, 3, 0, 3, 0, 0]) I got a 3x3 matrix image on the View. Then I saved the data as a PNG image, I got the warning and no image was found: Warning: In /Users/kitware/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release/paraview/src/paraview/VTK/IO/Image/vtkPNGWriter.cxx, line 198 vtkPNGWriter (0x11c80a540): PNGWriter only supports unsigned char and unsigned short inputs How can I save the Programmable Filter as an image? Magician ___ 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 ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview ___ 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 ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview