想知道为什么和何时需要在数据联合中的自动填充表中设置make/maketuples函数中的另一个变量的键,如文档这里中所示。
在本例中,部件表SegmentationROI定义如下:
%{
# Region of interest resulting from segmentation
-> test.Segmentation
roi : smallint # roi number
---
roi_pixels : longblob # indices of pixels
roi_weights : longblob # weights of pixels
%}
classdef SegmentationROI < dj.Part
properties(SetAccess=protected)
master = test.Segmentation
end
methods
function make(self, key)
image = fetch1(test.Image & key, 'image');
[roi_pixels, roi_weighs] = mylib.segment(image);
for roi=1:length(roi_pixels)
entity = key;
entity.roi_pixels = roi_pixels{roi};
entity.roi_weights = roi_weights{roi};
self.insert(entity)
end
end
end
end将密钥重命名为单独的变量实体(entity = key),然后插入该变量的目的是什么?
发布于 2021-12-03 15:50:29
在本例中,我们将字段作为结构添加到entity中。我认为最好的做法是将论点保留为-原样。如果在这里添加第二个for -循环,则在调用key时可能会遇到其他问题。
注意:我更熟悉DataJoint python,而且在MATLAB中没有广泛使用它。
https://stackoverflow.com/questions/70192069
复制相似问题