Skip to content
Discussion options

You must be logged in to vote

img = nib.load('path to nib image')
r = img[:, :, 100] #Loading the 100th slice from a nifti image of 240 slices
r = tfms(image = r)['image'] #Applying my transformation
stacker = np.zeros((224, 224))
r = {'image': r, 'label': None}#dictionary to apply MONAI transforms
r = new_transform(r)['image']#New_transform = MONAI transform
r = np.dstack((r, np.zeros((224, 224)), np.zeros((224, 224)), np.zeros((224, 224))))# Stacking zeros along depth.`

r = r[np.newaxis, ...]# Running this code twice to add two new axis so as to make the input compatible with the model
r = r.transpose(0, -1, 2, 3, 1) #Transposing the image so as to make it the desired shape

with torch.no_grad():
n = model.forward(t…

Replies: 3 comments 12 replies

Comment options

You must be logged in to vote
1 reply
@Adwaitt
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
11 replies
@Adwaitt
Comment options

@Adwaitt
Comment options

@Nic-Ma
Comment options

@Adwaitt
Comment options

@Nic-Ma
Comment options

Answer selected by Nic-Ma
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants