Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NB!!!! Dataset Class during Brats Challenge validation or testing #11

Open
AlyssaAmod opened this issue Jul 23, 2023 · 1 comment
Open
Assignees
Labels
bug Something isn't working invalid This doesn't seem right question Further information is requested

Comments

@AlyssaAmod
Copy link
Owner

UNN_BraTS23/scripts/data_class.py

**lines: 41-69**

Should this section not account for when mask does not exist?

see code change suggestion in docstring at end

@AlyssaAmod AlyssaAmod added bug Something isn't working invalid This doesn't seem right question Further information is requested labels Jul 23, 2023
@AlyssaAmod
Copy link
Owner Author

AlyssaAmod commented Jul 23, 2023

@Alexandra-Smith I see you already discovered this during inference --> can you check if you happy with my suggested code replace from line 41

As in script under Ask Alex:

image = np.load(self.imgs[idx])
image = torch.from_numpy(image) # 4, 240, 240, 155
if self.mode == "labels":
  mask = np.load(self.lbls[idx])
  mask = torch.from_numpy(mask) # 240, 240, 155           
if self.transform is not None:
  if self.mode == "labels":
    subject = tio.Subject(
        image=tio.ScalarImage(tensor=image),
        mask=tio.LabelMap(tensor=mask)
        )
    tranformed_subject = self.transform(subject)
    if self.SSA == False and self.SSAtransform is not None:
      tranformed_subject = self.SSAtransform(tranformed_subject) 
      print("Tranformed_subject: ", tranformed_subject)
      image = tranformed_subject["image"].data
      mask = tranformed_subject["mask"].data
      return image, mask, self.imgs[idx]
    else:
      subject = tio.Subject(
          image=tio.ScalarImage(tensor=image),
          )
      tranformed_subject = self.transform(subject)           
      print("Tranformed_subject: ", tranformed_subject)
      image = tranformed_subject["image"].data
      return image, self.imgs[idx]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working invalid This doesn't seem right question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants