cornerstone3D icon indicating copy to clipboard operation
cornerstone3D copied to clipboard

[Feature Request] setScalar?

Open CYB3RL1F3 opened this issue 1 year ago • 6 comments

What feature or change would you like to see made?

Is there a way to update points of a segmentation and segmentation volume ? Actually I apply a scalar to a volume and a volume to a segmentation. But I'd like to have the possibility to update this scalar (like it works with a tool like brush, etc...) but from a reducer. Which way? I tried to apply values on scalar but it doesn't refresh despite the viewport.render() thing. Is there a way or is it possible to implement it? Thanks.

Why should we prioritize this feature?

Because I need to be able to update / refresh segmentations with an easy way...

CYB3RL1F3 avatar Jan 25 '24 13:01 CYB3RL1F3

I also need this feature.I have the following program, but I don't know where it went wrong. It cannot update.

let scalarData = segmentationVolume.scalarData;

let voxelIndex = 0;

const { dimensions } = segmentationVolume;

for (let z = 0; z < dimensions[2]; z++) {
  for (let y = 0; y < dimensions[1]; y++) {
    for (let x = 0; x < dimensions[0]; x++) {
        scalarData[voxelIndex] = 0;
        voxelIndex++;
    }
  }
}

const segmentationRepresentationUID = segmentation.state.getSegmentationRepresentations('MY_TOOLGROUP_ID')[0].segmentationRepresentationUID;
const toolGroupId = VolumeInfomation.TOOL_GROUP_ID;
segmentation.triggerSegmentationEvents.triggerSegmentationRepresentationModified(toolGroupId, segmentationRepresentationUID);

YaXinHuu avatar Jan 26 '24 03:01 YaXinHuu

@YaXinHuu I found a way to update by recreating each segmentation and derived volume each time I have to update the scalarData, but it's really weird dirty code and I hate it... I'd love to have a true functional API for that...

CYB3RL1F3 avatar Jan 29 '24 12:01 CYB3RL1F3

Use the new VoxelManager

sedghi avatar Feb 02 '24 03:02 sedghi

@sedghi you have a tutorial, an example? I tried but it doesn't work / no update and crash... Thx

CYB3RL1F3 avatar Feb 02 '24 14:02 CYB3RL1F3

How can I write a scalar in my current volume?

CYB3RL1F3 avatar Feb 05 '24 11:02 CYB3RL1F3

are you guys calling .modified() after you update the scalar of thet volume? volume.modified

sedghi avatar Feb 20 '24 17:02 sedghi