Adds a Contour instance to this Slice.

 @param [Contour] contour a contour instance to be associated with this slice
962338
def add_contour(contour)
      raise ArgumentError, "Invalid argument 'contour'. Expected Contour, got #{contour.class}." unless contour.is_a?(Contour)
      @contours << contour unless @contours.include?(contour)
    end
1216711
def add shape_name, tkar_id, flags, layer, x, y, r, *params
      del(tkar_id)
      
      tkaroid = Tkaroid.new do |t|
        t.shape   = get_shape(shape_name)
        t.id      = tkar_id
        t.flags   = flags
        t.layer   = layer
        t.x       = x
        t.y       = y
        t.r       = r
        t.params  = params
        t.newly_added = true
      end

      @objects[tkar_id] = tkaroid
      @changed[tkar_id] = tkaroid
    end
516225
function contoursTransform(contours, transforms) {
    if (!contours || !contours.length || !transforms || !transforms.length) {
        return contours;
    }

    contours.forEach(function (p) {
        for (var i = 0, l = transforms.length; i < l; i++) {
            var transform = transforms[i];
            var params = transform.params;
            switch (transform.name) {
                case 'translate':
                    pathAdjust(p, 1, 1, params[0], params[1]);
                    break;
                case 'scale':
                    pathAdjust(p, params[0], params[1]);
                    break;
                case 'matrix':
                    pathTransform(p, params[0], params[1], params[2], params[3], params[4], params[5]);
                    break;
            }
        }
    });

    return contours;
}
843645
def create_slices(contour_sequence)
      raise ArgumentError, "Invalid argument 'contour_sequence'. Expected DICOM::Sequence, got #{contour_sequence.class}." unless contour_sequence.is_a?(DICOM::Sequence)
      # Sort the contours by slices:
      slice_collection = Hash.new
      contour_sequence.each do |slice_contour_item|
        sop_uid = slice_contour_item[CONTOUR_IMAGE_SQ][0].value(REF_SOP_UID)
        slice_collection[sop_uid] = Array.new unless slice_collection[sop_uid]
        slice_collection[sop_uid] << slice_contour_item
      end
      # Create slices:
      slice_collection.each_pair do |sop_uid, items|
        Slice.create_from_items(sop_uid, items, self)
      end
    end
334287
def findContours(*args, **kwargs):
    
    if cv2.__version__.startswith('4'):
        contours, hierarchy = cv2.findContours(*args, **kwargs)
    elif cv2.__version__.startswith('3'):
        _, contours, hierarchy = cv2.findContours(*args, **kwargs)
    else:
        raise AssertionError(
            'cv2 must be either version 3 or 4 to call this method')

    return contours, hierarchy
799869
def add_slice(slice)
      raise ArgumentError, "Invalid argument 'slice'. Expected Slice, got #{slice.class}." unless slice.is_a?(Slice)
      @slices << slice unless @associated_instance_uids[slice.uid]
      @associated_instance_uids[slice.uid] = slice
    end
569056
def contourf(x, y, z, ax, **kwargs):
    
    primitive = ax.contourf(x, y, z, **kwargs)
    return primitive
1282115
def _contour(f, vertexlabels=None, contourfunc=None, **kwargs):
    ''''''

    if contourfunc is None:
        contourfunc = plt.tricontour
    if vertexlabels is None:
        vertexlabels = ('1','2','3')
    x = np.linspace(0, 1, 100)
    y = np.linspace(0, np.sqrt(3.0)/2.0, 100)
    points2d = np.transpose([np.tile(x, len(y)), np.repeat(y, len(x))])
    points3d = barycentric(points2d)
    valid = (points3d.sum(axis=1) == 1.0) & ((0.0 <= points3d).all(axis=1))
    points2d = points2d[np.where(valid),:][0]
    points3d = points3d[np.where(valid),:][0]
    z = f(points3d)
    contourfunc(points2d[:,0], points2d[:,1], z, **kwargs)
    _draw_axes(vertexlabels)
    return plt.gcf()
364310
def add_subsegment(self, subsegment):
        
        self._check_ended()
        subsegment.parent_id = self.id
        self.subsegments.append(subsegment)
1322098
def _deep_copy_contours(self, ufo, parent, component, transformation):
        """"""

        for nested in component.components:
            self._deep_copy_contours(
                ufo,
                parent,
                ufo[nested.baseGlyph],
                transformation.transform(nested.transformation),
            )

        if component != parent:
            pen = TransformPen(parent.getPen(), transformation)

            # if the transformation has a negative determinant, it will reverse
            # the contour direction of the component
            xx, xy, yx, yy = transformation[:4]
            if xx * yy - xy * yx < 0:
                pen = ReverseContourPen(pen)

            component.draw(pen)
322484
def add_image(image)
      raise ArgumentError, "Invalid argument 'image'. Expected Image, got #{image.class}." unless image.is_a?(Image)
      @images << image
      @associated_images[image.uid] = image
    end
1208911
private static void addShapeAndMembers(String shapeName,
            Map<String, ShapeModel> in,
            Map<String, ShapeModel> out) {

        if (shapeName == null) return;

        final ShapeModel shape = in.get(shapeName);
        if (shape == null) return;

        if (!out.containsKey(shapeName)) {
            out.put(shapeName, in.get(shapeName));
            List<MemberModel> members = shape.getMembers();

            if (members != null) {
                for (MemberModel member : members) {
                    List<String> memberShapes = resolveMemberShapes(member);
                    if (memberShapes == null) continue;
                    for (String memberShape : memberShapes) {
                        addShapeAndMembers(memberShape, in, out);
                    }
                }
            }
        }
    }
758063
def add_segment(self, segment):
        
        self.tracks.add(segment.track)
        self.segments.append(segment)
683320
def add_custom_feature(self, feature):
        
        if feature.dimension <= 0:
            raise ValueError("Dimension has to be positive. "
                             "Please override dimension attribute in feature!")

        if not hasattr(feature, 'transform'):
            raise ValueError("no 'transform' method in given feature")
        elif not callable(getattr(feature, 'transform')):
            raise ValueError("'transform' attribute exists but is not a method")

        self.__add_feature(feature)
695260
@NonNull
    public IconicsDrawable drawBackgroundContour(boolean drawBackgroundContour) {
        if (mDrawBackgroundContour != drawBackgroundContour) {
            mDrawBackgroundContour = drawBackgroundContour;

            mIconPadding += (mDrawBackgroundContour ? 1 : -1) * mBackgroundContourWidth * 2;

            invalidateSelf();
        }
        return this;
    }
414076
def contours(*values)
		(values = (0..values[0]+1).to_a.map{|i| i.to_f * (@grid.max - @grid.min) / ( values[0]+1) + @grid.min}; values.pop; values.shift) if values.size==1 and values[0].kind_of? Integer
		cons = values.inject({}){|hash, val| hash[val] = []; hash}
# 			p cons
		for i in 0...((@x.size / 2.0).ceil - 1)
			for j in 0...((@y.size / 2.0).ceil - 1)
				analyse_cell(i*2, j*2, cons)
			end
		end
# 			pp cons
		cons.keys.each{|val| cons[val] = connect_contours(cons[val])}
		@last_contours = cons
	end
1099980
def add_branch(steps, source_line, ruby_code = nil)
      branches << Branch.new(steps, source_line, ruby_code)
    end