View in #cornerstone3d on Slack
@Leo_Reubelt: I have the following function.
export const getCurrentSOPInstanceUID = (viewportId: string) => {
const renderingEngine = cornerstoneCore.getRenderingEngine(renderingEngineId);
if (!!!renderingEngine) {
return;
}
const viewport = renderingEngine.getViewport(viewportId)
const imageUid = viewport.getCurrentImageId();
if (!!!imageUid) {
return;
}
return getComponentsFromImageId(imageUid).sopInstanceUid;
}
And sometimes viewport.getCurrentImageId()
returns null when there is an image displayed.
Is there a better way to determine the imageId for the image that is being displayed?
@Alireza_Sedghi: if you have reconstruction views there is no imageId, if there is stack or acuisition view there is always imageId
what is your end goal
@Leo_Reubelt: thanks for the response. they are volume viewports, but i am only trying to get the image id for the viewport in the default orientation. does that classify as a reconstruction view? as i move the slider, to change the slice, that function is called. some of the slices return the correct image id. and others return null. and it is repeatable. the same slices always return null. right now i am trying to get meta data specific to a particular slice, and i need sop instance uid (which is part of the image id) to get it. but i use sop instance uid for many things. so i will need it in other places.
@Robbie_Barton: I’ve seen similar things because, though things might have changed in theory, in reality perhaps a RunCommand or Async or Timer() is delaying the actual change. I usually subscribe to a Service to get some notification, depending.
@Bill_Wallace: In acquisition orientation, with a default slice thickness, the getCurrentImageId should always return an image id on a reconstructable series. However, if the volume you used to create the image is not quite reconstructable, there can be cases where it wont return a valid slice, but it may still render something that looks almost right.
Could you also call getViewReference, and see what that returns as compared to the actual slices. That one will return things like view plane normal, and focal point, so you should be able to manually determine which slice you should be getting from that output and that will help us determine what is going wrong. Then, if the data is anonymizeable and shareable, could you create an issue with the image data and slice indices not returning correctly?