MCPcopy Create free account
hub / github.com/YaoZhang93/MAML / PreprocessorFor2D_noNormalization

Class PreprocessorFor2D_noNormalization

nnunet/preprocessing/preprocessing.py:858–888  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

856
857
858class PreprocessorFor2D_noNormalization(GenericPreprocessor):
859 def resample_and_normalize(self, data, target_spacing, properties, seg=None, force_separate_z=None):
860 original_spacing_transposed = np.array(properties["original_spacing"])[self.transpose_forward]
861 before = {
862 'spacing': properties["original_spacing"],
863 'spacing_transposed': original_spacing_transposed,
864 'data.shape (data is transposed)': data.shape
865 }
866 target_spacing[0] = original_spacing_transposed[0]
867 data, seg = resample_patient(data, seg, np.array(original_spacing_transposed), target_spacing, 3, 1,
868 force_separate_z=force_separate_z, order_z_data=0, order_z_seg=0,
869 separate_z_anisotropy_threshold=self.resample_separate_z_anisotropy_threshold)
870 after = {
871 'spacing': target_spacing,
872 'data.shape (data is resampled)': data.shape
873 }
874 print("before:", before, "\nafter: ", after, "\n")
875
876 if seg is not None: # hippocampus 243 has one voxel with -2 as label. wtf?
877 seg[seg < -1] = 0
878
879 properties["size_after_resampling"] = data[0].shape
880 properties["spacing_after_resampling"] = target_spacing
881 use_nonzero_mask = self.use_nonzero_mask
882
883 assert len(self.normalization_scheme_per_modality) == len(data), "self.normalization_scheme_per_modality " \
884 "must have as many entries as data has " \
885 "modalities"
886 assert len(self.use_nonzero_mask) == len(data), "self.use_nonzero_mask must have as many entries as data" \
887 " has modalities"
888 return data, seg, properties

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected