def __init__(self, templateData, parcelationData, axis, correlationTable, colorTable, selectedColor):
super(SliceViewer, self).__init__()
self.template = templateData
self.regionId = None
self.parcelation = parcelationData
self.axis = axis
self.CommunityMode = False
self.correlationTable = correlationTable
self.colorTable= colorTable
self.selectedColor = selectedColor
self.displayedSlice = 0
self.QImage = []
scalefactor = 350
self.scaleFactor = int(math.ceil(scalefactor / self.parcelation.shape[0]))
numColors = self.parcelation.max()
self.clut = np.zeros(numColors, dtype=np.uint32)
for i in range(numColors):
r, g, b = colorsys.hls_to_rgb(float(i) / float(numColors), 0.5, 1.0)
self.clut[i] = (255 << 24 | int(255*r) << 16 | int(255*g) << 8 | int(255*b))
slice_view_layout = QtGui.QHBoxLayout()
self.setLayout(slice_view_layout)
slider = QtGui.QSlider()
slider.setRange(0, self.template.shape[self.axis]-1)
slider.valueChanged.connect(self.setDisplayedSlice)
slider.sliderReleased.connect(self.handleSliderRelease)
slider.setValue(self.displayedSlice)
slice_view_layout.addWidget(slider)
self.label = QtGui.QLabel()
self.updateSliceLabel()
slice_view_layout.addWidget(self.label)
评论列表
文章目录