class PVGeoPercentThreshold(PercentThreshold): def __init__(self): PercentThreshold.__init__(self) #### Seters and Geters #### @smproperty.doublevector(name="Percent", default_values=50.0) @smdomain.doublerange(min=0.0, max=100.0) def set_percent(self, percent): PercentThreshold.set_percent(self, percent) @smproperty.xml( _helpers.get_property_xml(name='Use Continuous Cell Range', command='set_use_continuous_cell_range', default_values=False)) def set_use_continuous_cell_range(self, flag): PercentThreshold.set_use_continuous_cell_range(self, flag) @smproperty.xml( _helpers.get_property_xml(name='Invert', command='set_invert', default_values=False, help='Use to invert the threshold filter.')) def set_invert(self, flag): PercentThreshold.set_invert(self, flag) @smproperty.xml(_helpers.get_input_array_xml(nInputPorts=1, n_arrays=1)) def SetInputArrayToProcess(self, idx, port, connection, field, name): return PercentThreshold.SetInputArrayToProcess(self, idx, port, connection, field, name)
class PVGeoVoxelizePoints(VoxelizePoints): def __init__(self): VoxelizePoints.__init__(self) #### Seters and Geters #### @smproperty.xml( _helpers.get_property_xml( name='Estimate Grid Spacing', command='set_estimate_grid', default_values=True, help= 'A boolean to set whether to try to estimate the proper dx, dy, and dz spacings for a grid on a regular cartesian coordinate system.', panel_visibility='advanced')) def set_estimate_grid(self, flag): VoxelizePoints.set_estimate_grid(self, flag) @smproperty.xml( _helpers.get_property_xml( name='Cell Size', command='set_cell_size', default_values=[10.0, 10.0, 10.0], help= 'The cell size (dx, dy, dz) to use as a default for all generated voxels.', panel_visibility='advanced')) def set_cell_size(self, dx, dy, dz): VoxelizePoints.set_deltas(self, dx, dy, dz)
class PVGeoAddCellConnToPoints(AddCellConnToPoints): def __init__(self): AddCellConnToPoints.__init__(self) #### Seters and Geters #### @smproperty.xml( _helpers.get_drop_down_xml(name='CellType', command='set_cell_type', labels=['Line', 'Poly Line'], values=[3, 4])) def set_cell_type(self, cell_type): AddCellConnToPoints.set_cell_type(self, cell_type) @smproperty.xml( _helpers.get_property_xml( name='Use Neareast Nbr Approx', command='set_use_nearest_nbr', default_values=False, help= 'A boolean to control whether or not to use SciPy nearest neighbor approximation when build cell connectivity.' )) def set_use_nearest_nbr(self, flag): AddCellConnToPoints.set_use_nearest_nbr(self, flag) @smproperty.xml( _helpers.get_property_xml( name='Use Unique Points', command='set_use_unique_points', default_values=False, help='Set a flag on whether to only use unique points')) def set_use_unique_points(self, flag): AddCellConnToPoints.set_use_unique_points(self, flag)
class PVGeoReverseImageDataAxii(ReverseImageDataAxii): def __init__(self): ReverseImageDataAxii.__init__(self) #### Seters and Geters #### @smproperty.xml( _helpers.get_property_xml( name='Flip X Axis', command='set_flip_x', default_values=True, help='A boolean to set whether to flip the X axis.', )) def set_flip_x(self, flag): ReverseImageDataAxii.set_flip_x(self, flag) @smproperty.xml( _helpers.get_property_xml( name='Flip Y Axis', command='set_flip_y', default_values=True, help='A boolean to set whether to flip the Y axis.', )) def set_flip_y(self, flag): ReverseImageDataAxii.set_flip_y(self, flag) @smproperty.xml( _helpers.get_property_xml( name='Flip Z Axis', command='set_flip_z', default_values=True, help='A boolean to set whether to flip the Z axis.', )) def set_flip_z(self, flag): ReverseImageDataAxii.set_flip_z(self, flag)
class PVGeoDelimitedTextReader(DelimitedTextReader): def __init__(self): DelimitedTextReader.__init__(self) #### Seters and Geters #### @smproperty.xml( _helpers.get_file_reader_xml( DelimitedTextReader.extensions, reader_description=DelimitedTextReader.description, ) ) def AddFileName(self, filename): DelimitedTextReader.AddFileName(self, filename) @smproperty.doublevector( name="TimeDelta", default_values=1.0, panel_visibility="advanced" ) def set_time_delta(self, dt): DelimitedTextReader.set_time_delta(self, dt) @smproperty.doublevector( name="TimestepValues", information_only="1", si_class="vtkSITimeStepsProperty" ) def get_time_step_values(self): """This is critical for registering the timesteps""" return DelimitedTextReader.get_time_step_values(self) @smproperty.stringvector(name="Delimiter", default_values=" ") def set_delimiter(self, deli): DelimitedTextReader.set_delimiter(self, deli) @smproperty.xml( _helpers.get_property_xml( name='Use Split on Whitespace', command='set_split_on_white_space', default_values=False, help='A boolean to override the Delimiter_Field and use whitespace as delimiter.', ) ) def set_split_on_white_space(self, flag): DelimitedTextReader.set_split_on_white_space(self, flag) @smproperty.intvector(name="SkipRows", default_values=0) def set_skip_rows(self, skip): DelimitedTextReader.set_skip_rows(self, skip) @smproperty.stringvector(name="Comments", default_values="!") def set_comments(self, identifier): DelimitedTextReader.set_comments(self, identifier) @smproperty.xml( _helpers.get_property_xml( name='Has Titles', command='set_has_titles', default_values=False, help='A boolean for if the delimited file has header titles for the data arrays.', ) ) def set_has_titles(self, flag): DelimitedTextReader.set_has_titles(self, flag)
class PVGeoPointsToTube(PointsToTube): def __init__(self): PointsToTube.__init__(self) #### Seters and Geters #### # NOTE: Not givign the use the choice of cell type for this... # It is still accesible to change though... @smproperty.doublevector(name="Radius", default_values=10.0) def set_radius(self, radius): PointsToTube.set_radius(self, radius) @smproperty.intvector(name="Number of Sides", default_values=20) def set_number_of_sides(self, num): PointsToTube.set_number_of_sides(self, num) @smproperty.xml( _helpers.get_property_xml( name='Use Nearest Neighbor', command='set_use_nearest_nbr', default_values=False, help= 'A boolean to set whether to use a nearest neighbor approxiamtion when building path from input points.', )) def set_use_nearest_nbr(self, flag): PointsToTube.set_use_nearest_nbr(self, flag) @smproperty.xml( _helpers.get_property_xml( name='Capping', command='set_capping', default_values=False, help='A boolean to set whether to cap the ends of the tube.', )) def set_capping(self, flag): PointsToTube.set_capping(self, flag) @smproperty.xml( _helpers.get_drop_down_xml( name='CellType', command='set_cell_type', labels=['Line', 'Poly Line'], values=[3, 4], )) def set_cell_type(self, cell_type): PointsToTube.set_cell_type(self, cell_type) @smproperty.xml( _helpers.get_property_xml( name='Use Unique Points', command='set_use_unique_points', default_values=False, help='Set a flag on whether to only use unique points', )) def set_use_unique_points(self, flag): PointsToTube.set_use_unique_points(self, flag)
class PVGeoLandsatReader(LandsatReader): def __init__(self): LandsatReader.__init__(self) #### Seters and Geters #### @smproperty.xml(_helpers.get_file_reader_xml(LandsatReader.extensions, reader_description=LandsatReader.description)) def AddFileName(self, filename): LandsatReader.AddFileName(self, filename) @smproperty.dataarrayselection(name="Available Bands") def GetDataSelection(self): return LandsatReader.GetDataSelection(self) @smproperty.xml(_helpers.get_property_xml(name='Cast Data Type', command='set_cast_data_type', default_values=True, help='A boolean to set whether to cast the data arrays so invalid points are filled nans.', panel_visibility='advanced')) def set_cast_data_type(self, flag): LandsatReader.set_cast_data_type(self, flag) @smproperty.xml(_helpers.get_drop_down_xml(name='Color Scheme', command='set_color_scheme', labels=LandsatReader.GetColorSchemeNames(), help='Set a color scheme to use.')) def set_color_scheme(self, scheme): LandsatReader.set_color_scheme(self, scheme)
class PVGeoExtractTopography(ExtractTopography): def __init__(self): ExtractTopography.__init__(self) #### Seters and Geters #### @smproperty.doublevector(name="Tolerance", default_values=1.0) def set_tolerance(self, tol): ExtractTopography.set_tolerance(self, tol) @smproperty.doublevector(name="Offset", default_values=0.0) def set_offset(self, offset): ExtractTopography.set_offset(self, offset) @smproperty.xml( _helpers.get_drop_down_xml( name='Operation', command='set_operation', labels=ExtractTopography.get_operation_names(), help='This is the type of extraction operation to apply', )) def set_operation(self, op): ExtractTopography.set_operation(self, op) @smproperty.xml( _helpers.get_property_xml( name='Invert', command='set_invert', default_values=False, help= 'A boolean to set whether on whether to invert the extraction.', )) def set_invert(self, flag): ExtractTopography.set_invert(self, flag)
class PVGeoArraysToRGBA(ArraysToRGBA): def __init__(self): ArraysToRGBA.__init__(self) #### Seters and Geters #### @smproperty.xml( _helpers.get_input_array_xml( nInputPorts=1, n_arrays=4, labels=['Red', 'Green', 'Blue', 'Transparency'])) def SetInputArrayToProcess(self, idx, port, connection, field, name): return ArraysToRGBA.SetInputArrayToProcess(self, idx, port, connection, field, name) @smproperty.xml( _helpers.get_property_xml( name='Use Transparency', command='set_use_transparency', default_values=False, help= 'A boolean to control whether or not to use the Transparency array.' )) def set_use_transparency(self, flag): ArraysToRGBA.set_use_transparency(self, flag) @smproperty.doublevector(name="Mask", default_values=-9999.0) def set_mask_value(self, val): ArraysToRGBA.set_mask_value(self, val)
class PVGeoRotatePoints(RotatePoints): def __init__(self): RotatePoints.__init__(self) #### Seters and Geters #### @smproperty.doublevector(name="Rotation Angle", default_values=45.0) @smdomain.doublerange(min=-90.0, max=90.0) def set_rotation_degrees(self, theta): RotatePoints.set_rotation_degrees(self, theta) @smproperty.doublevector(name="Origin", default_values=[0.0, 0.0], panel_visibility='advanced') def set_origin(self, xo, yo): RotatePoints.set_origin(self, xo, yo) @smproperty.xml( _helpers.get_property_xml( name='Use Corner', command='set_use_corner', default_values=True, help='Use the corner as the rotation origin.', panel_visibility='advanced')) def set_use_corner(self, flag): RotatePoints.set_use_corner(self, flag)
class PVGeoTableToTimeGrid(TableToTimeGrid): def __init__(self): TableToTimeGrid.__init__(self) #### Setters / Getters #### @smproperty.intvector(name="Extent", default_values=[10, 10, 10, 1]) def set_extent(self, nx, ny, nz, nt): TableToTimeGrid.set_extent(self, nx, ny, nz, nt) @smproperty.intvector(name="Dimensions", default_values=[0, 1, 2, 3]) def set_dimensions(self, x, y, z, t): TableToTimeGrid.set_dimensions(self, x, y, z, t) @smproperty.doublevector(name="Spacing", default_values=[1.0, 1.0, 1.0]) def set_spacing(self, dx, dy, dz): TableToTimeGrid.set_spacing(self, dx, dy, dz) @smproperty.doublevector(name="Origin", default_values=[0.0, 0.0, 0.0]) def set_origin(self, x0, y0, z0): TableToTimeGrid.set_origin(self, x0, y0, z0) @smproperty.xml( _helpers.get_drop_down_xml( name='Order', command='set_order', labels=[ 'C-style: Row-major order', 'Fortran-style: column-major order' ], values=[0, 1], )) def set_order(self, order): o = ['C', 'F'] TableToTimeGrid.set_order(self, o[order]) @smproperty.doublevector(name="TimeDelta", default_values=1.0, panel_visibility="advanced") def set_time_delta(self, dt): TableToTimeGrid.set_time_delta(self, dt) @smproperty.doublevector(name="TimestepValues", information_only="1", si_class="vtkSITimeStepsProperty") def get_time_step_values(self): """This is critical for registering the timesteps""" return TableToTimeGrid.get_time_step_values(self) @smproperty.xml( _helpers.get_property_xml( name='Use Point Data', command='set_use_points', default_values=False, panel_visibility='advanced', help= 'Set whether or not to place the data on the nodes/cells of the grid. In ParaView, switching can be a bit buggy: be sure to turn the visibility of this data object OFF on the pipeline when changing bewteen nodes/cells.', )) def set_use_points(self, flag): TableToTimeGrid.set_use_points(self, flag)
class PVGeoGSLibPointSetReader(GSLibPointSetReader): def __init__(self): GSLibPointSetReader.__init__(self) #### Seters and Geters #### @smproperty.xml( _helpers.get_file_reader_xml( GSLibPointSetReader.extensions, reader_description=GSLibPointSetReader.description, ) ) def AddFileName(self, filename): GSLibPointSetReader.AddFileName(self, filename) @smproperty.stringvector(name="Delimiter", default_values=" ") def set_delimiter(self, deli): GSLibPointSetReader.set_delimiter(self, deli) @smproperty.xml( _helpers.get_property_xml( name='Use Split on Whitespace', command='set_split_on_white_space', default_values=True, help='A boolean to override the Delimiter_Field and use whitespace as delimiter.', ) ) def set_split_on_white_space(self, flag): GSLibPointSetReader.set_split_on_white_space(self, flag) @smproperty.intvector(name="SkipRows", default_values=0) def set_skip_rows(self, skip): GSLibPointSetReader.set_skip_rows(self, skip) @smproperty.stringvector(name="Comments", default_values="!") def set_comments(self, identifier): GSLibPointSetReader.set_comments(self, identifier) @smproperty.doublevector( name="TimeDelta", default_values=1.0, panel_visibility="advanced" ) def set_time_delta(self, dt): GSLibPointSetReader.set_time_delta(self, dt) @smproperty.doublevector( name="TimestepValues", information_only="1", si_class="vtkSITimeStepsProperty" ) def get_time_step_values(self): """This is critical for registering the timesteps""" return GSLibPointSetReader.get_time_step_values(self) @smproperty.xml( """<Property name="Print File Header" command="print_file_header" panel_widget="command_button"/>""" ) def print_file_header(self): print(GSLibPointSetReader.get_file_header(self)) return 1
class PVGeoVoxelizePointsFromArrays(VoxelizePoints): def __init__(self): VoxelizePoints.__init__(self) self.__dx_id = [None, None] self.__dy_id = [None, None] self.__dz_id = [None, None] self.set_estimate_grid(False) # CRUCIAL def _copy_arrays(self, pdi, pdo): """Override to not pass spacing arrays to output""" exclude = [self.__dx_id[1], self.__dy_id[1], self.__dz_id[1]] for i in range(pdi.GetPointData().GetNumberOfArrays()): arr = pdi.GetPointData().GetArray(i) if arr.GetName() not in exclude: _helpers.add_array(pdo, 1, arr) # adds to CELL data return pdo def RequestData(self, request, inInfo, outInfo): # Handle input arrays pdi = self.GetInputData(inInfo, 0, 0) wpdi = dsa.WrapDataObject(pdi) dx = _helpers.get_numpy_array(wpdi, self.__dx_id[0], self.__dx_id[1]) dy = _helpers.get_numpy_array(wpdi, self.__dy_id[0], self.__dy_id[1]) dz = _helpers.get_numpy_array(wpdi, self.__dz_id[0], self.__dz_id[1]) VoxelizePoints.set_deltas(self, dx, dy, dz) # call parent and make sure EstimateGrid is set to False return VoxelizePoints.RequestData(self, request, inInfo, outInfo) #### Seters and Geters #### # (int idx, int port, int connection, int fieldAssociation, const char *name) @smproperty.xml( _helpers.get_input_array_xml(labels=['dx', 'dy', 'dz'], nInputPorts=1, n_arrays=3)) def SetInputArrayToProcess(self, idx, port, connection, field, name): if idx == 0: self.__dx_id = [field, name] elif idx == 1: self.__dy_id = [field, name] elif idx == 2: self.__dz_id = [field, name] else: raise RuntimeError('Bad input array index.') return 1 @smproperty.xml( _helpers.get_property_xml( name='Extract Unique', command='set_unique', default_values=True, help='Set a flag on whether to only use unique elements', )) def set_unique(self, flag): VoxelizePoints.set_unique(self, flag)
class PVGeoTensorMeshAppender(TensorMeshAppender): """This assumes the input vtkRectilinearGrid has already handled the timesteps""" def __init__(self): TensorMeshAppender.__init__(self) @smproperty.xml( ''' <StringVectorProperty panel_visibility="default" name="ModelFiles" label="File Name(s) Model" command="add_model_file_name" animateable="1" repeat_command="1" clean_command="clear_models" number_of_elements="1"> <FileListDomain name="model_files"/> <Documentation>This is for a single sets of model files to append to the mesh as data time varying attributes. You can chose as many files as you would like for this for the given attribute.</Documentation> </StringVectorProperty>''' ) def add_model_file_name(self, filename): """Use to set the file names for the reader. Handles single string or list of strings.""" TensorMeshAppender.add_model_file_name(self, filename) @smproperty.xml( _helpers.get_property_xml( name='Use file as data name', command='set_use_filename', default_values=True, help='A boolean to override the DataName and use model file name as data name.', panel_visibility="advanced", ) ) def set_use_filename(self, flag): TensorMeshAppender.set_use_filename(self, flag) @smproperty.stringvector( name='DataName', default_values='Appended Data', panel_visibility="advanced" ) def set_data_name(self, name): TensorMeshAppender.set_data_name(self, name) @smproperty.doublevector( name="TimestepValues", information_only="1", si_class="vtkSITimeStepsProperty" ) def get_time_step_values(self): """This is critical for registering the timesteps""" return TensorMeshAppender.get_time_step_values(self)
class PVGeoNormalizeArray(NormalizeArray): def __init__(self): NormalizeArray.__init__(self) #### SETTERS AND GETTERS #### @smproperty.xml(_helpers.get_input_array_xml(nInputPorts=1, n_arrays=1)) def SetInputArrayToProcess(self, idx, port, connection, field, name): return NormalizeArray.SetInputArrayToProcess(self, idx, port, connection, field, name) @smproperty.doublevector(name="Multiplier", default_values=1.0) def set_multiplier(self, val): NormalizeArray.set_multiplier(self, val) @smproperty.stringvector(name="New Array Name", default_values="Normalized") def set_new_array_name(self, name): NormalizeArray.set_new_array_name(self, name) @smproperty.xml( _helpers.get_drop_down_xml( name='Normalization', command='set_normalization', labels=NormalizeArray.get_normalization_names(), help= 'This is the type of normalization to apply to the input array.', )) def set_normalization(self, norm): NormalizeArray.set_normalization(self, norm) @smproperty.xml( _helpers.get_property_xml( name='Absolute Value', command='set_take_absolute_value', default_values=False, help= 'This will take the absolute value of the array before normalization.', )) def set_take_absolute_value(self, flag): NormalizeArray.set_take_absolute_value(self, flag) @smproperty.doublevector(name="Shifter", default_values=0.0) def set_shift(self, sft): NormalizeArray.set_shift(self, sft)
class PVGeoSlideSliceAlongPoints(SlideSliceAlongPoints): def __init__(self): SlideSliceAlongPoints.__init__(self) @smproperty.intvector(name="Location", default_values=50) @smdomain.intrange(min=0, max=99) def set_location(self, loc): SlideSliceAlongPoints.set_location(self, loc) @smproperty.xml( _helpers.get_property_xml( name='Use Neareast Nbr Approx', command='set_use_nearest_nbr', default_values=False, help= 'A boolean to control whether or not to use SciPy nearest neighbor approximation when build cell connectivity.' )) def set_use_nearest_nbr(self, flag): SlideSliceAlongPoints.set_use_nearest_nbr(self, flag)
class PVGeoManySlicesAlongPoints(ManySlicesAlongPoints): def __init__(self): ManySlicesAlongPoints.__init__(self) @smproperty.intvector(name="Number of Slices", default_values=10) @smdomain.intrange(min=2, max=25) def set_number_of_slices(self, num): ManySlicesAlongPoints.set_number_of_slices(self, num) @smproperty.xml( _helpers.get_property_xml( name='Use Neareast Nbr Approx', command='set_use_nearest_nbr', default_values=False, help= 'A boolean to control whether or not to use SciPy nearest neighbor approximation when build cell connectivity.' )) def set_use_nearest_nbr(self, flag): ManySlicesAlongPoints.set_use_nearest_nbr(self, flag)
class PVGeoSGeMSGridReader(SGeMSGridReader): def __init__(self): SGeMSGridReader.__init__(self) #### Seters and Geters #### @smproperty.xml(_helpers.get_file_reader_xml(SGeMSGridReader.extensions, reader_description=SGeMSGridReader.description)) def AddFileName(self, filename): SGeMSGridReader.AddFileName(self, filename) @smproperty.stringvector(name="Delimiter", default_values=" ") def set_delimiter(self, deli): SGeMSGridReader.set_delimiter(self, deli) @smproperty.xml(_helpers.get_property_xml(name='Use Split on Whitespace', command='set_split_on_white_space', default_values=True, help='A boolean to override the Delimiter_Field and use whitespace as delimiter.')) def set_split_on_white_space(self, flag): SGeMSGridReader.set_split_on_white_space(self, flag) @smproperty.intvector(name="SkipRows", default_values=0) def set_skip_rows(self, skip): SGeMSGridReader.set_skip_rows(self, skip) @smproperty.stringvector(name="Comments", default_values="!") def set_comments(self, identifier): SGeMSGridReader.set_comments(self, identifier) @smproperty.doublevector(name="TimeDelta", default_values=1.0, panel_visibility="advanced") def set_time_delta(self, dt): SGeMSGridReader.set_time_delta(self, dt) @smproperty.doublevector(name="TimestepValues", information_only="1", si_class="vtkSITimeStepsProperty") def get_time_step_values(self): """This is critical for registering the timesteps""" return SGeMSGridReader.get_time_step_values(self) @smproperty.doublevector(name="Spacing", default_values=[1.0, 1.0, 1.0],) def set_spacing(self, dx, dy, dz): SGeMSGridReader.set_spacing(self, dx, dy, dz) @smproperty.doublevector(name="Origin", default_values=[0.0, 0.0, 0.0],) def set_origin(self, ox, oy, oz): SGeMSGridReader.set_origin(self, ox, oy, oz)
class PVGeoUBCOcTreeMeshReader(OcTreeReader): def __init__(self): OcTreeReader.__init__(self) #### Seters and Geters #### @smproperty.xml( ''' <StringVectorProperty panel_visibility="advanced" name="MeshFile" label="File Name Mesh" command="set_mesh_filename" animateable="1" clean_command="clear_mesh" number_of_elements="1"> <FileListDomain name="meshfile"/> <Documentation>This is the mesh file for a OcTree Mesh grid. This plugin only allows ONE mesh to be defined.</Documentation> </StringVectorProperty>''' ) def set_mesh_filename(self, filename): OcTreeReader.set_mesh_filename(self, filename) @smproperty.xml( ''' <StringVectorProperty panel_visibility="default" name="ModelFiles" label="File Name(s) Model" command="add_model_file_name" animateable="1" repeat_command="1" clean_command="clear_models" number_of_elements="1"> <FileListDomain name="model_files"/> <Documentation>This is for a single sets of model files to append to the mesh as data time varying attributes. You can chose as many files as you would like for this for the given attribute.</Documentation> </StringVectorProperty>''' ) def add_model_file_name(self, filename): """Use to set the file names for the reader. Handles singlt string or list of strings.""" OcTreeReader.add_model_file_name(self, filename) @smproperty.doublevector( name="TimeDelta", default_values=1.0, panel_visibility="advanced" ) def set_time_delta(self, dt): OcTreeReader.set_time_delta(self, dt) @smproperty.doublevector( name="TimestepValues", information_only="1", si_class="vtkSITimeStepsProperty", ) def get_time_step_values(self): """This is critical for registering the timesteps""" return OcTreeReader.get_time_step_values(self) @smproperty.xml( _helpers.get_property_xml( name='Use file as data name', command='set_use_filename', default_values=True, help='A boolean to override the DataName and use model file name as data name.', panel_visibility="advanced", ) ) def set_use_filename(self, flag): OcTreeReader.set_use_filename(self, flag) @smproperty.stringvector( name='DataName', default_values='Data', panel_visibility="advanced" ) def set_data_name(self, name): OcTreeReader.set_data_name(self, name)