Skip to content

Commit

Permalink
fix roi id and color diff
Browse files Browse the repository at this point in the history
  • Loading branch information
ReiHashimoto committed Sep 29, 2023
1 parent d7f6df8 commit fb293bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions frontend/src/components/Workspace/Visualize/Plot/ImagePlot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,9 @@ const ImagePlotChart = React.memo<{
name: 'roi',
hovertemplate: isAddRoi ? 'none' : 'cell id: %{z}',
// hoverinfo: isAddRoi || pointClick.length ? 'none' : undefined,
colorscale: [...Array(timeDataMaxIndex)].map((_, i) => {
colorscale: [...Array(timeDataMaxIndex + 1)].map((_, i) => {
const new_i = Math.floor(((i % 10) * 10 + i / 10) % 100)
const offset: number = i / (timeDataMaxIndex - 1)
const offset: number = i / timeDataMaxIndex
const rgba = colorscaleRoi[new_i]
const hex = rgba2hex(rgba, roiAlpha)
return [offset, hex]
Expand Down Expand Up @@ -356,7 +356,7 @@ const ImagePlotChart = React.memo<{
z: Number(point.z),
})
}
if (point.curveNumber >= 1 && point.z > 0) {
if (point.curveNumber >= 1 && point.z >= 0) {
dispatch(
setImageItemClikedDataId({
itemId,
Expand All @@ -367,12 +367,12 @@ const ImagePlotChart = React.memo<{
}

const setSelectRoi = (point: PointClick) => {
if (!point.z) return
if (typeof point.z !== 'number' || point.z === -1) return
const newPoints = [...pointClick, point]
const newRoi = roiDataState.map((roi) => {
return roi.map((element) => {
if (newPoints.some((p) => p.z === element)) {
return 0
return -1
}
return element
})
Expand Down Expand Up @@ -480,7 +480,7 @@ const ImagePlotChart = React.memo<{
dispatch(resetAllOrderList())
try {
await mergeRoiApi(roiFilePath, {
ids: pointClick.map((point) => point.z - 1),
ids: pointClick.map((point) => point.z),
})
} catch {}
setLoadingApi(false)
Expand All @@ -495,7 +495,7 @@ const ImagePlotChart = React.memo<{
dispatch(resetAllOrderList())
try {
await deleteRoiApi(roiFilePath, {
ids: pointClick.map((point) => point.z - 1),
ids: pointClick.map((point) => point.z),
})
} catch {}
setLoadingApi(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const TimeSeriesPlotImple = React.memo(() => {
return Object.fromEntries(
dataKeys.map((key) => {
let y = newDataXrange.map((x) => newTimeSeriesData[key]?.[x])
const i = Number(key) - 1
const i = Number(key)
const new_i = Math.floor((i % 10) * 10 + i / 10) % 100
if (drawOrderList.includes(key) && offset) {
const activeIdx: number = drawOrderList.findIndex((v) => v === key)
Expand Down

0 comments on commit fb293bb

Please sign in to comment.