Project-MONAI / MONAI

AI Toolkit for Healthcare Imaging

Home Page:https://monai.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Overlay two labels into a dual channel label

wxr521314 opened this issue · comments

I have data.nii.gzl. Label.nii.gz and label_2.nii.gz, I would like to add label.nii.gz, Label_2.nii.gz is superimposed into a two channel data. Can LoadNiftid be automatically completed? What should I do?

I have a dual channel 128 * 128 * 128 data, and I use EnsureChannelFirst(), torch.Size ([1, 2, 128, 128, 128, 1]), why is there an extra dimension? It shouldn't be torch.Size ([1, 2, 128, 128, 128,]) correct?

I have data.nii.gzl. Label.nii.gz and label_2.nii.gz, I would like to add label.nii.gz, Label_2.nii.gz is superimposed into a two channel data. Can LoadNiftid be automatically completed? What should I do?

You can use ConcatItemsd to help you concate.

class ConcatItemsd(MapTransform):

I have a dual channel 128 * 128 * 128 data, and I use EnsureChannelFirst(), torch.Size ([1, 2, 128, 128, 128, 1]), why is there an extra dimension? It shouldn't be torch.Size ([1, 2, 128, 128, 128,]) correct?

EnsureChannelFirst is used to ensure the channel dim first, if you already have 2 as your channel dim, no need to add this transform.

Thanks.
(Move to discussion as more like a usage issue.)