segmentation output by model does dot align with the volume when loaded into Slicer

Hello, the 3D Slicer Community,

Sorry if this question has been asked many times. I’ve trained a segmentation model for some brain tumor, and I want to review the results in Slicer. When I load them into the Slicer, the segmentation does not overlay at the correct position (see the screenshot of the scene in Slicer and a plot I create with matplotlib, I’m assured that the volume and the output segmentation have the same shape, and the segmentation output by the model for this case is almost correct)

Thanks in advance!

Some tools discard image geometry (origin, spacing, axis directions). If you visualize image data using tools that ignore this information (such as Matplotlib) then you may not even realize that you have a problem. You need to use a tool like Slicer to realize that there is a misalignment. If you lose the image geometry during your processing workflow then make sure you restore it in the image header before loading it into Slicer.