DebugSlicerLook at the images and volumes in your Python code while it is paused in the debugger, without writing a single temporary DebugSlicer is a multipurpose viewer for debugging processing steps. It works with ordinary 2D images (mono, RGB, RGBA) and with 3D volumes, including MRI and CT scans. Right-click a variable, and it opens in its own tab.
Raw data, shown as it isDebugSlicer shows you what is actually in the array, because that is what you need when looking for a bug:
Requirements
Getting started
The menu item appears for these types:
Each variable gets its own tab, named after it. If you reopen the same variable later, even in a new debug run, it returns to its existing tab with the new data and keeps your axis settings when the shape hasn't changed. Choosing what each dimension meansEvery dimension of the array has a column showing its size and what it is used for:
Sensible roles are chosen for you. A dimension of size 1 starts as a constant at 0, and a last dimension of size 3 or 4 in a 3-dimensional array is treated as colour. You can change any of them. Constants are useful for arrays with extra dimensions, such as a batch of images: set the batch dimension to Viewing a volumeWhen
The names are only labels, since orientation data isn't used. The Captions setting switches them to Mouse controls
On a Mac, Cmd works the same as Ctrl. The buttons above each view zoom in, zoom out, fit the image to the view, and take a screenshot. The Crosshair checkbox hides or shows the lines. Reading valuesThe bar at the bottom shows the position and value under the cursor, whichever view it is in, with a small swatch of the colour that value is drawn in. For colour images it lists every channel, with Colour imagesA 2D image with a colour dimension of 2 to 4 values is shown in colour: gray + alpha, RGB or RGBA. Transparent areas show a gray checkerboard.
8-bit data is used as it is, floats already between 0 and 1 are treated as that range, and anything else is stretched to the range of the array. Colour only applies to 2D images: while ColormapsWithout colour channels, values are drawn through a colormap. The brightness range comes from the whole array, so it doesn't jump as you move between slices, and all three views agree.
Auto picks one for you: Labels for data with up to 64 distinct whole numbers, and Gray otherwise. The presets are:
With Labels, 0 stays black as the background and every other label gets its own unique colour, however large or far apart the label values are. This also works for segmentations stored as floats, as they are after nibabel's
NaN and infinite values are always drawn in magenta, so they can't be mistaken for real data. Your own colormapsChoose Edit... to create a colormap from the current one, or to change one you saved. Pick or type the colours, and choose the type:
Saved colormaps are available in every tab and every workspace. ScreenshotsThe camera button above a view copies it to the clipboard as an image, exactly as shown, including zoom, pan and interpolation but without the crosshair. A message confirms the copy. Large arraysLarge scans load in pieces, with a progress bar showing how much has arrived. As a guide, a 6 GB array took about 18 seconds in testing. An array is held in memory completely while its tab is open, and one tab can hold about 15 GB, however much RAM your machine has. If an array doesn't fit, DebugSlicer asks the debugger to save it again at a smaller type, for example Limitations
Planned
Development
Press F5 with the Run Extension launch configuration to open |




