<div dir="ltr">Sounds good. Thanks Seb.<div><br></div><div>Dan</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 11, 2016 at 1:08 PM, Sebastien Jourdain <span dir="ltr"><<a href="mailto:sebastien.jourdain@kitware.com" target="_blank">sebastien.jourdain@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thinks serialization... And don't assume any specific efficiency. Think on what you want to get on the JavaScript side.</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 11, 2016 at 11:03 AM, Dan Lipsa <span dir="ltr"><<a href="mailto:dan.lipsa@kitware.com" target="_blank">dan.lipsa@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks Seb,<div>So I'll have to make regular arrays out of the numpy arrays and send those over? </div><div>What about multi-dimensional numpy arrays? (2D, 3D) Do I have to flatten them on the server and then get them into the right format on the client?</div><div><br></div><div>What about the numpy masked arrays? This have missing values, similar with VTK blanking.</div><div><br></div><div>How efficient is this?</div><div><br></div><div>Thanks,</div><div>Dan</div><div><br></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 7, 2016 at 5:27 PM, Sebastien Jourdain <span dir="ltr"><<a href="mailto:sebastien.jourdain@kitware.com" target="_blank">sebastien.jourdain@kitware.co<wbr>m</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">We do that all the time, so yes, vtk/paraview web can handle it.<div><br></div><div>Just need to create a new RPC method that will build the structure the client expect based on its request.</div><div><br></div><div>Here is a ParaView example which should apply to VTK if you ignore the ParaView proxy magic (self.reader.GetClientSideObje<wbr>ct())</div><div><br></div><div><div>  @exportRpc("my.super.app.get.t<wbr>able")</div><div>  def getTable(self):</div><div>    from vtk.util.numpy_support import vtk_to_numpy</div><div>    returnValue = {}</div><div>    dataTable = self.reader.GetClientSideObjec<wbr>t().GetOutputDataObject(0)</div><div>    count = dataTable.GetNumberOfColumns()</div><div>    for idx in range(count):</div><div>      array = dataTable.GetColumn(idx)</div><div>      if SUPPORTED_TYPES[VTK_DATA_TYPES<wbr>[array.GetDataType()]]:</div><div>        npArray = vtk_to_numpy(array)</div><div>        returnValue[array.GetName()] = [ i.item() for i in npArray ]</div><div>      else:</div><div>        returnValue[array.GetName()] = [ array.GetValue(i) for i in xrange(array.GetNumberOfValues<wbr>()) ]</div><div>    return returnValue</div></div><div><br></div><div>with that for our constant settings for filtering arrays we don't want to get on the client side.</div><div><br></div><div><div>VTK_DATA_TYPES = [ 'void',       # 0</div><div>          'bit',       # 1</div><div>          'char',       # 2</div><div>          'unsigned_char',  # 3</div><div>          'short',      # 4</div><div>          'unsigned_short',  # 5</div><div>          'int',       # 6</div><div>          'unsigned_int',   # 7</div><div>          'long',       # 8</div><div>          'unsigned_long',  # 9</div><div>          'float',      # 10</div><div>          'double',      # 11</div><div>          'id_type',     # 12</div><div>          'unspecified',   # 13</div><div>          'unspecified',   # 14</div><div>          'signed_char' ]   # 15</div><div><br></div><div>SUPPORTED_TYPES = { 'void': False,</div><div>          'bit': False,</div><div>          'char': True,</div><div>          'unsigned_char': True,</div><div>          'short': True,</div><div>          'unsigned_short': True,</div><div>          'int': True,</div><div>          'unsigned_int': True,</div><div>          'long': True,</div><div>          'unsigned_long': True,</div><div>          'float': True,</div><div>          'double': True,</div><div>          'id_type': True,</div><div>          'unspecified': False,</div><div>          'unspecified': False,</div><div>          'signed_char': True }</div></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 7, 2016 at 3:09 PM, Dan Lipsa <span dir="ltr"><<a href="mailto:dan.lipsa@kitware.com" target="_blank">dan.lipsa@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Seb and all,<div>One of the features we want to implement in our application is the ability to render plots on the client (in certain cases) using alternate means such as plotly.</div><div><br></div><div>For this we need to send data = a numpy or numpy masked array = to the client. Is there any capability in vtkWeb or do you have any advise on how to do that?</div><div><br></div><div>Thanks,</div><div>Dan</div><div><br></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>