MultiChannel #2017
Replies: 2 comments 1 reply
-
Are the images of the same dimension? If yes, you can simply read them and then concatenate the arrays. If not, you can use |
Beta Was this translation helpful? Give feedback.
-
Hi @rijobro thank you for your help [{'image': 'Images_256/DEAB621C050A_A_mimics.nii',
'label': {'label_scapula': 'Masks_scapula_256/DEAB621C050A_A_mimics_scapula.nii',
'label_humerus': 'Masks_humerus_256/DEAB621C050A_A_mimics_humerus.nii'}}] I did the concanate and I have the label in to channels ex (2 , 512, 512, 200) loader = LoadImaged(keys=("label_scapula", "label_humerus"))
for i in range(len(data_dict_l)):
data_dict = loader(data_dict_l[i])
label_scapula, label_humerus = data_dict["label_scapula"], data_dict["label_humerus"]
add_channel = AddChanneld(keys=["label_scapula", "label_humerus"])
datac_dict = add_channel(data_dict)
mask= np.concatenate((datac_dict['label_scapula'], datac_dict['label_humerus']), axis=0)
label_bones.append(mask)
i+=1
label_bones[0].shape (2, 512, 512, 256) ### > but` I'm tryin do doing into the train_transforms = Compose(.. using the tutorial (Brain tumor 3D segmentation with MONAI), it crashes
class ConvertToMultiChannelBasedOnBratsClassesd(MapTransform):
"""
"""
def __call__(self, data):
d = dict(data)
for key in self.keys:
result = []
# merge label 2 and label 3 to construct TC
result.append(np.logical_or(d[key] == 2, d[key] == 3))
# merge labels 1, 2 and 3 to construct WT
result.append(
np.logical_or(
np.logical_or(d[key] == 2, d[key] == 3), d[key] == 1
)
)
# label 2 is ET
result.append(d[key] == 2)
d[key] = np.stack(result, axis=0).astype(np.float32)
return d thanks Oscar |
Beta Was this translation helpful? Give feedback.
-
hello all
can someone help me please.
I have few CT scan to make a segmentation model, I would like to segment two bones with this model.
the problem is, I have a file .nii for the CT, one file .nii for bone trainer based on components and ignite #1 and one file .nii for bone NifTI image reader 2D/3D #2.
is there a tutorial to convert these two files into a single multichanel file? or what solusion can I use,
I want to use the Brain tumor 3D segmentation example for the segmentation
thank you
OB
Beta Was this translation helpful? Give feedback.
All reactions