<s> import os <EOL> from gzip import GzipFile <EOL> import django <EOL> import nibabel as nb <EOL> import neurovault . apps . statmaps . utils as nvutils <EOL> from neurovault . apps . statmaps . models import StatisticMap , BaseStatisticMap <EOL> os . environ . setdefault ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> django . setup ( ) <EOL> for image in StatisticMap . objects . filter ( map_type = BaseStatisticMap . OTHER ) : <EOL> image . file . open ( ) <EOL> gzfileobj = GzipFile ( filename = image . file . name , mode = '<STR_LIT:rb>' , fileobj = image . file . file ) <EOL> nii = nb . Nifti1Image . from_file_map ( { '<STR_LIT:image>' : nb . FileHolder ( image . file . name , gzfileobj ) } ) <EOL> map_type = nvutils . infer_map_type ( nii ) <EOL> if map_type != BaseStatisticMap . OTHER : <EOL> print "<STR_LIT>" % ( image . get_absolute_url ( ) , map_type ) <EOL> image . map_type = map_type <EOL> image . save ( ) <EOL> image . file . close ( ) </s>
