def test_changing_names(self):
        source = SlimCUDSSource(cuds=self.container,
                                point_scalars="TEMPERATURE")

        point_attrs, cell_attrs = get_all_attributes(source.data)
        self.assertEqual(len(point_attrs["scalars"]), 1)
        self.assertEqual(point_attrs["scalars"][0], "TEMPERATURE")

        source.point_scalars_name = ""
        point_attrs, cell_attrs = get_all_attributes(source.data)
        self.assertEqual(len(point_attrs["scalars"]), 0)
    def _update(self):
        """Updates the traits for the fields that are available in the
        input data.
        """
        if len(self.inputs) == 0 or len(self.inputs[0].outputs) == 0:
            return

        input = self.inputs[0].get_output_object()
        pnt_attr, cell_attr = get_all_attributes(
            self.inputs[0].get_output_dataset()
        )

        self._setup_data_traits(cell_attr, 'cell')
        self._setup_data_traits(pnt_attr, 'point')
        if self._first:
            self._first = False
Ejemplo n.º 3
0
    def _update(self):
        """Updates the traits for the fields that are available in the
        input data.
        """
        if len(self.inputs) == 0 or len(self.inputs[0].outputs) == 0:
            return

        input = self.inputs[0].outputs[0]
        if self._first:
            # Force all attributes to be defined and computed
            input.update()
        pnt_attr, cell_attr = get_all_attributes(input)

        self._setup_data_traits(cell_attr, 'cell')
        self._setup_data_traits(pnt_attr, 'point')
        if self._first:
            self._first = False
Ejemplo n.º 4
0
    def _update(self):
        """Updates the traits for the fields that are available in the
        input data.
        """
        if len(self.inputs) == 0 or len(self.inputs[0].outputs) == 0:
            return

        input = self.inputs[0].outputs[0]
        if self._first:
            # Force all attributes to be defined and computed
            input.update()
        pnt_attr, cell_attr = get_all_attributes(input)

        self._setup_data_traits(cell_attr, "cell")
        self._setup_data_traits(pnt_attr, "point")
        if self._first:
            self._first = False
Ejemplo n.º 5
0
    def _update(self):
        """Updates the traits for the fields that are available in the
        input data.
        """
        if len(self.inputs) == 0 or len(self.inputs[0].outputs) == 0:
            return

        input = self.inputs[0].get_output_object()
        if self._first and is_old_pipeline():
            # Force all attributes to be defined and computed
            input.update()
        pnt_attr, cell_attr = get_all_attributes(input)

        self._setup_data_traits(cell_attr, 'cell')
        self._setup_data_traits(pnt_attr, 'point')
        if self._first:
            self._first = False
Ejemplo n.º 6
0
    def _update_vtk_dataset_content(self):
        vtk_dataset = self.data

        if vtk_dataset is None:
            return

        pnt_attr, cell_attr = get_all_attributes(vtk_dataset)

        scalars = vtk_dataset.point_data.scalars
        if vtk_dataset.is_a('vtkImageData') and scalars is not None:
            # For some reason getting the range of the scalars flushes
            # the data through to prevent some really strange errors
            # when using an ImagePlaneWidget.
            if is_old_pipeline():
                self._assign_attribute.output.scalar_type = scalars.data_type
                vtk_dataset.scalar_type = scalars.data_type

        self._update_vtk_pipeline_for_data('point', pnt_attr)
        self._update_vtk_pipeline_for_data('cell', cell_attr)