Page MenuHomePhabricator

Slice interpolation 'confirm for all slices' not working for large images
Open, HighPublic

Description

In the segmentation plugin, the 2D slice interpolation if one of my favorite tools. It does exactly what I want it to do and is super useful!

However, it falls flat when working with large images, for example this dummy segmentation:

When looking through the segmentation with slice interpolation enabled (2d) , you can see that the yellow preview contour works nicely. However, when I want to 'confirm for all slices' (I selected coronal of course!) MITK will compute for a couple of minutes and then at some point just stop without throwing an error. No interpolated segmentation is generated.

I can work around that by:

  • loading the segmentation in python
  • cropping to the area where the slices are (with some padding so that I dont run into border problems. I don't know whether 2D slice interpolation can move outside the bounding box)
  • saving the cropped segmentation
  • loading the cropped segmentation in MITK
  • 2d slice interpolation 'confirm all slices' now works with the smaller image. This computes interestingly MUCH faster than whatever MITK did before
  • save result
  • load result in python
  • place result back into original segmentation
  • save again
  • load in mitk

As you might expect, this is not very user friendly ;-) I don't know what caused it to crash for larger images, but you might want to look into that.
Note: I had plenty of RAM available, so that's not the problem.

image.png (24×442 px, 6 KB)

Ubuntu 18.04

Best,
Fabian

Event Timeline

isensee added a subscriber: kislinsk.

@kislinsk I know you have plenty of things to do, but this bug (along with T28516) is a blocker at the moment. I would like to recommend MITK as an annotation tool for our collaborators but cannot do that as along as the slice interpolation does not work (fast enough, T28516) for large images :-)

As it is an inexpensive operation my first guess would be an issue related to the amount of used memory. For example, the image above eats 3,5 GB, Activating the interpolation already triples it. Confirming adds at least another 3,5 GB. That could also explain why it is so slow (swapping). But at this point it is just a first assumption. On a 16 GB Windows machine I was able to complete the interpolation without crash but it took a while.

edit: But maybe it is also not as inexpensive as we though as we rarely have 2048x2048 image stacks.

And we seem to have a huge leak here. Even after deleting all the nodes again, half of my RAM is still in use.

kislinsk triaged this task as High priority.
kislinsk edited projects, added MITK (v2021.10); removed MITK.
kislinsk moved this task from Backlog to Cycle on the MITK (v2021.10) board.

A few things that impact the handling of huge images:

  • Loading an image or at least a segmentation currently required twice as much RAM for a short amount of time. I guess there's a block copy happening.
  • Interpolation is really heavily computing on a single core and adds another chunk of memory (twice as large) during the operation.
  • While one part of that memory is released after the operation is complete, the other half is still not freed until the Segmentation view is closed. Removing the image or closing the project is not enough.

As it is an inexpensive operation my first guess would be an issue related to the amount of used memory. For example, the image above eats 3,5 GB, Activating the interpolation already triples it. Confirming adds at least another 3,5 GB. That could also explain why it is so slow (swapping). But at this point it is just a first assumption. On a 16 GB Windows machine I was able to complete the interpolation without crash but it took a while.

It is not a RAM issue. I checked that :-) No swapping on my 32GB machine. I would have noticed and reported that - I am not new to these things you know :-P

Most computers now have 8 cores or more. This operation takes forever to complete, so it would be nice to have it distributed across the cores