def test_diffusion_images(self): tmp_output_dir = tempfile.mkdtemp() try: results = convert_ge.dicom_to_nifti( read_dicom_directory(test_data.GE_DTI), os.path.join(tmp_output_dir, 'test.nii.gz')) assert compare_nifti(results['NII_FILE'], ground_thruth_filenames( test_data.GE_DTI)[0]) is True assert compare_bval(results['BVAL_FILE'], ground_thruth_filenames( test_data.GE_DTI)[2]) is True assert compare_bvec(results['BVEC_FILE'], ground_thruth_filenames( test_data.GE_DTI)[3]) is True convert_ge.dicom_to_nifti( read_dicom_directory(test_data.GE_DTI_IMPLICIT), os.path.join(tmp_output_dir, 'test.nii.gz')) assert compare_nifti( results['NII_FILE'], ground_thruth_filenames(test_data.GE_DTI_IMPLICIT)[0]) is True assert compare_bval( results['BVAL_FILE'], ground_thruth_filenames(test_data.GE_DTI_IMPLICIT)[2]) is True assert compare_bvec( results['BVEC_FILE'], ground_thruth_filenames(test_data.GE_DTI_IMPLICIT)[3]) is True finally: shutil.rmtree(tmp_output_dir)
def test_diffusion_imaging(self): tmp_output_dir = tempfile.mkdtemp() try: results = convert_philips.dicom_to_nifti( read_dicom_directory(test_data.PHILIPS_DTI), os.path.join(tmp_output_dir, 'test.nii.gz')) assert compare_nifti( results['NII_FILE'], ground_thruth_filenames(test_data.PHILIPS_DTI)[0]) is True assert compare_bval( results['BVAL_FILE'], ground_thruth_filenames(test_data.PHILIPS_DTI)[2]) is True assert compare_bvec( results['BVEC_FILE'], ground_thruth_filenames(test_data.PHILIPS_DTI)[3]) is True results = convert_philips.dicom_to_nifti( read_dicom_directory(test_data.PHILIPS_DTI_002), os.path.join(tmp_output_dir, 'test.nii.gz')) assert compare_nifti( results['NII_FILE'], ground_thruth_filenames(test_data.PHILIPS_DTI_002)[0]) is True assert compare_bval( results['BVAL_FILE'], ground_thruth_filenames(test_data.PHILIPS_DTI_002)[2]) is True assert compare_bvec( results['BVEC_FILE'], ground_thruth_filenames(test_data.PHILIPS_DTI_002)[3]) is True results = convert_philips.dicom_to_nifti( read_dicom_directory(test_data.PHILIPS_ENHANCED_DTI), os.path.join(tmp_output_dir, 'test.nii.gz')) assert compare_nifti( results['NII_FILE'], ground_thruth_filenames( test_data.PHILIPS_ENHANCED_DTI)[0]) is True assert compare_bval( results['BVAL_FILE'], ground_thruth_filenames( test_data.PHILIPS_ENHANCED_DTI)[2]) is True assert compare_bvec( results['BVEC_FILE'], ground_thruth_filenames( test_data.PHILIPS_ENHANCED_DTI)[3]) is True results = convert_philips.dicom_to_nifti( read_dicom_directory(test_data.PHILIPS_DTI_IMPLICIT), os.path.join(tmp_output_dir, 'test.nii.gz')) assert compare_nifti( results['NII_FILE'], ground_thruth_filenames( test_data.PHILIPS_DTI_IMPLICIT)[0]) is True assert compare_bval( results['BVAL_FILE'], ground_thruth_filenames( test_data.PHILIPS_DTI_IMPLICIT)[2]) is True assert compare_bvec( results['BVEC_FILE'], ground_thruth_filenames( test_data.PHILIPS_DTI_IMPLICIT)[3]) is True results = convert_philips.dicom_to_nifti( read_dicom_directory(test_data.PHILIPS_DTI_IMPLICIT_002), os.path.join(tmp_output_dir, 'test.nii.gz')) assert compare_nifti( results['NII_FILE'], ground_thruth_filenames( test_data.PHILIPS_DTI_IMPLICIT_002)[0]) is True assert compare_bval( results['BVAL_FILE'], ground_thruth_filenames( test_data.PHILIPS_DTI_IMPLICIT_002)[2]) is True assert compare_bvec( results['BVEC_FILE'], ground_thruth_filenames( test_data.PHILIPS_DTI_IMPLICIT_002)[3]) is True self.assertRaises( ConversionError, convert_philips.dicom_to_nifti, read_dicom_directory(test_data.PHILIPS_ENHANCED_DTI_IMPLICIT), os.path.join(tmp_output_dir, 'test.nii.gz')) finally: shutil.rmtree(tmp_output_dir)