[vtkusers] How to find range of data in Cell Scalar Array?

Andras Lasso lasso at queensu.ca
Mon Dec 18 14:15:04 EST 2017


Have you tried vtkDataArray::GetRange()?
https://www.vtk.org/doc/nightly/html/classvtkDataArray.html#a717568beffb50a7ddff9ed3919dcf153

Computing range may take a long time on large data sets. GetRange() has an important feature that it caches the computed range and the value is also propagated through the processing pipeline.

Andras

From: vtkusers [mailto:vtkusers-bounces at vtk.org] On Behalf Of Cory Quammen
Sent: Monday, December 18, 2017 10:11 AM
To: scotsman60 <doug at beachmailing.com>
Cc: vtkusers <vtkusers at vtk.org>
Subject: Re: [vtkusers] How to find range of data in Cell Scalar Array?

I'm not sure if there is something in VTK that does this, but the good news is you can use numpy to do it. See Berk's blog post series on VTK/numpy integration starting with https://blog.kitware.com/improved-vtk-numpy-integration/<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fblog.kitware.com%2Fimproved-vtk-numpy-integration%2F&data=02%7C01%7Classo%40queensu.ca%7C9e44ae347d034dd9a79708d546298e0b%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636492066658759271&sdata=bo1AD39UpsmbDQrtzVsAswaqwGloD33ChgklbtqwJAQ%3D&reserved=0>.

HTH,
Cory

On Sun, Dec 17, 2017 at 8:32 PM, scotsman60 <doug at beachmailing.com<mailto:doug at beachmailing.com>> wrote:
Hello,

I'm using vtk in a Python app and I need to set parameters on a lookup table
based on the range of values in an integer scalar array associated to Cells
in a vtkUnstructuredGrid.

I can access the array ,

name = self.mesh.GetCellData().GetArrayName('PID')

where self.mesh is my vtkUnstructuredGrid

But how can I find the unique value sin this array?

I need something like numpy.unique () - is there a vtk method available?

Thanks in advance,


Doug



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html<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%7C9e44ae347d034dd9a79708d546298e0b%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636492066658759271&sdata=MPzOr4k9tUJIWf31Hxefu8JTDFWlUUc215%2BqHjsba1s%3D&reserved=0>
_______________________________________________
Powered by www.kitware.com<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com&data=02%7C01%7Classo%40queensu.ca%7C9e44ae347d034dd9a79708d546298e0b%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636492066658759271&sdata=6PzkUDGy%2BmGbm%2F6bEwpVvAUC7SsIRFkXlbMmwC5PI%2Bk%3D&reserved=0>

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7C9e44ae347d034dd9a79708d546298e0b%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636492066658759271&sdata=%2BcZHkAwRayN7hhA9Q%2FythlnRNhX0xKyJoq5ygDQ3Nks%3D&reserved=0>

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vtk.org%2FWiki%2FVTK_FAQ&data=02%7C01%7Classo%40queensu.ca%7C9e44ae347d034dd9a79708d546298e0b%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636492066658759271&sdata=arBOCytrI9tUJHN9S3BD8TkAJoQtPfSXN051UAg3jeY%3D&reserved=0>

Search the list archives at: http://markmail.org/search/?q=vtkusers<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtkusers&data=02%7C01%7Classo%40queensu.ca%7C9e44ae347d034dd9a79708d546298e0b%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636492066658759271&sdata=a3Eu3ZqHZT7GKC%2FUZ%2Fg%2Fdr8b%2BgcAJUHFBM8xBziWPag%3D&reserved=0>

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fvtk.org%2Fmailman%2Flistinfo%2Fvtkusers&data=02%7C01%7Classo%40queensu.ca%7C9e44ae347d034dd9a79708d546298e0b%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636492066658759271&sdata=woK52v%2FtkoGlaRe6yhJx%2FlHfmVmK2%2B1j8ivd5TYehFI%3D&reserved=0>



--
Cory Quammen
Staff R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://vtk.org/pipermail/vtkusers/attachments/20171218/7470f03c/attachment.html>


More information about the vtkusers mailing list