fix(3DSegmentation): [Bug] The viewports become blank when loading the seg file in advanced layout after closing the seg file from any other advanced layout (#5505)
This commit is contained in:
1 parent
afa9131da1
commit
76f7d4e23a
25 files changed
+189
-208
No files matched your search
@@ -70,43 +70,6 @@ describe('getUpdatedViewportsForSegmentation', () => {
|
||||
expect(result).toEqual(mockUpdatedViewports);
|
||||
});
|
||||
|
||||
it('should filter out volume3d viewports', () => {
|
||||
const mockUpdatedViewports = [
|
||||
{
|
||||
viewportOptions: {
|
||||
viewportType: 'stack',
|
||||
},
|
||||
},
|
||||
{
|
||||
viewportOptions: {
|
||||
viewportType: 'volume3d',
|
||||
},
|
||||
},
|
||||
{
|
||||
viewportOptions: {
|
||||
viewportType: 'volume',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
mockHangingProtocolService.getViewportsRequireUpdate.mockReturnValue(mockUpdatedViewports);
|
||||
|
||||
const result = getUpdatedViewportsForSegmentation(defaultParameters);
|
||||
|
||||
expect(result).toEqual([
|
||||
{
|
||||
viewportOptions: {
|
||||
viewportType: 'stack',
|
||||
},
|
||||
},
|
||||
{
|
||||
viewportOptions: {
|
||||
viewportType: 'volume',
|
||||
},
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('should handle viewports without viewportOptions', () => {
|
||||
const mockUpdatedViewports = [
|
||||
{
|
||||
@@ -255,70 +218,22 @@ describe('getUpdatedViewportsForSegmentation', () => {
|
||||
it('should handle getViewportsRequireUpdate returning null', () => {
|
||||
mockHangingProtocolService.getViewportsRequireUpdate.mockReturnValue(null);
|
||||
|
||||
expect(() => getUpdatedViewportsForSegmentation(defaultParameters)).toThrow();
|
||||
expect(getUpdatedViewportsForSegmentation(defaultParameters)).toEqual(null);
|
||||
});
|
||||
|
||||
it('should handle mixed viewport types including volume3d', () => {
|
||||
const mockUpdatedViewports = [
|
||||
{
|
||||
viewportOptions: {
|
||||
viewportType: 'stack',
|
||||
},
|
||||
},
|
||||
{
|
||||
viewportOptions: {
|
||||
viewportType: 'volume3d',
|
||||
},
|
||||
},
|
||||
{
|
||||
viewportOptions: {
|
||||
viewportType: 'volume3d',
|
||||
},
|
||||
},
|
||||
{
|
||||
viewportOptions: {
|
||||
viewportType: 'orthogonal',
|
||||
},
|
||||
},
|
||||
{ viewportOptions: { viewportType: 'stack' } },
|
||||
{ viewportOptions: { viewportType: 'volume3d' } },
|
||||
{ viewportOptions: { viewportType: 'volume3d' } },
|
||||
{ viewportOptions: { viewportType: 'orthogonal' } },
|
||||
];
|
||||
|
||||
mockHangingProtocolService.getViewportsRequireUpdate.mockReturnValue(mockUpdatedViewports);
|
||||
|
||||
const result = getUpdatedViewportsForSegmentation(defaultParameters);
|
||||
|
||||
expect(result).toEqual([
|
||||
{
|
||||
viewportOptions: {
|
||||
viewportType: 'stack',
|
||||
},
|
||||
},
|
||||
{
|
||||
viewportOptions: {
|
||||
viewportType: 'orthogonal',
|
||||
},
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('should handle all volume3d viewports', () => {
|
||||
const mockUpdatedViewports = [
|
||||
{
|
||||
viewportOptions: {
|
||||
viewportType: 'volume3d',
|
||||
},
|
||||
},
|
||||
{
|
||||
viewportOptions: {
|
||||
viewportType: 'volume3d',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
mockHangingProtocolService.getViewportsRequireUpdate.mockReturnValue(mockUpdatedViewports);
|
||||
|
||||
const result = getUpdatedViewportsForSegmentation(defaultParameters);
|
||||
|
||||
expect(result).toEqual([]);
|
||||
expect(result).toEqual(mockUpdatedViewports);
|
||||
});
|
||||
|
||||
it('should handle viewports with undefined viewportType', () => {
|
||||
@@ -328,6 +243,11 @@ describe('getUpdatedViewportsForSegmentation', () => {
|
||||
viewportType: undefined,
|
||||
},
|
||||
},
|
||||
{
|
||||
viewportOptions: {
|
||||
viewportType: 'volume3d',
|
||||
},
|
||||
},
|
||||
{
|
||||
viewportOptions: {
|
||||
someOtherProperty: 'value',
|
||||
|
||||
@@ -16,7 +16,7 @@ function getUpdatedViewportsForSegmentation({
|
||||
isHangingProtocolLayout
|
||||
);
|
||||
|
||||
return updatedViewports.filter(v => v.viewportOptions?.viewportType !== 'volume3d');
|
||||
return updatedViewports;
|
||||
}
|
||||
|
||||
const getTargetViewport = ({ viewportId, viewportGridService }) => {
|
||||
|
||||
@@ -84,7 +84,7 @@ export default function interleaveCenterLoader({
|
||||
// the imageIds and save them in AllRequests for later use
|
||||
const AllRequests = [];
|
||||
volumes.forEach(volume => {
|
||||
const requests = volume.getImageLoadRequests();
|
||||
const requests = volume.getImageLoadRequests?.() ?? [];
|
||||
|
||||
if (!requests.length || !requests[0] || !requests[0].imageId) {
|
||||
return;
|
||||
|
||||
@@ -83,7 +83,7 @@ export default function interleaveTopToBottom({
|
||||
// the imageIds and save them in AllRequests for later use
|
||||
const AllRequests = [];
|
||||
volumes.forEach(volume => {
|
||||
const requests = volume.getImageLoadRequests();
|
||||
const requests = volume.getImageLoadRequests?.() ?? [];
|
||||
|
||||
if (!requests?.[0]?.imageId) {
|
||||
return;
|
||||
|
||||
@@ -348,20 +348,4 @@ describe('Transitions Module', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Performance Validation', () => {
|
||||
it('should handle many rapid calls without issues', () => {
|
||||
const startTime = performance.now();
|
||||
|
||||
for (let i = 0; i < 1000; i++) {
|
||||
const t = i / 1000;
|
||||
linear(t);
|
||||
easeInOut(t, 0.1);
|
||||
ease(t, 0.2, 1.5);
|
||||
}
|
||||
|
||||
const endTime = performance.now();
|
||||
expect(endTime - startTime).toBeLessThan(10);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user