change the input image channel order

change the input image channel order  

  By: junma on Aug. 11, 2022, 7:08 p.m.

Dear organizers,

It seems that the default inputs are: channel 0-PET, channel 1-CT.

However, in our nnunet model, the channel 0 is CT and channel 1 is PET.

Is there an easy way to change the default input channel order to match the model's input?

Re: change the input image channel order  

  By: Lachlanmcintosh on Aug. 12, 2022, 7:26 a.m.

It may be possible to fix this by swapping lines 64 and 66 of load_inputs in the process.py (https://github.com/lab-midas/autoPET/blob/master/nnUNet_baseline/process.py) I believe the challenge server is using .mha data so this should get called.. I am not certain though.

Original:

    self.convert_mha_to_nii(os.path.join(self.input_path, 'images/pet/', pet_mha),
                            os.path.join(self.nii_path, 'TCIA_001_0000.nii.gz'))
    self.convert_mha_to_nii(os.path.join(self.input_path, 'images/ct/', ct_mha),
                            os.path.join(self.nii_path, 'TCIA_001_0001.nii.gz'))

Spoof naming convention:

    self.convert_mha_to_nii(os.path.join(self.input_path, 'images/pet/', pet_mha),
                            os.path.join(self.nii_path, 'TCIA_001_0001.nii.gz'))
    self.convert_mha_to_nii(os.path.join(self.input_path, 'images/ct/', ct_mha),
                            os.path.join(self.nii_path, 'TCIA_001_0000.nii.gz'))

Re: change the input image channel order  

  By: junma on Aug. 15, 2022, 12:48 a.m.

Thank you so much. It works:)