48 lines
1.2 KiB
Python
48 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
Created on Fri Jun 1 15:28:19 2018
|
|
|
|
@author: Armando
|
|
"""
|
|
import os
|
|
import glob
|
|
|
|
|
|
#from skimage.filters.rank import mean_bilateral
|
|
#from skimage.morphology import disk
|
|
#import scipy.misc
|
|
|
|
|
|
working_directory = "D:\\python_processing\\imagesV2\\eauXG\\brut\\"
|
|
|
|
experiments = []
|
|
for root, dirs, files in os.walk(working_directory):
|
|
for name in dirs:
|
|
experiments.append(name)
|
|
break #exit after first subdirectories
|
|
|
|
del(dirs,files,root,name)
|
|
|
|
|
|
file_type = '.im7'
|
|
|
|
for e in range(len(experiments)):
|
|
|
|
#Search for all the images (they should finish in *.im7, if not change the) in the 'e' experiment
|
|
file_name = glob.glob(working_directory +experiments[e]+ "\\*"+file_type)
|
|
k=1
|
|
for i in range(len(file_name)):
|
|
|
|
if file_name[i][-1-4] == '0':
|
|
if len(str(k))<2 :
|
|
os.rename(file_name[i],file_name[i][0:-1-9]+'B0000' +str(k)+file_type)
|
|
else:
|
|
os.rename(file_name[i],file_name[i][0:-1-9]+'B000' +str(k)+file_type)
|
|
k+=1
|
|
elif file_name[i][-1-9:-1] == 'B00001.im':
|
|
k+=1
|
|
else:
|
|
os.remove(file_name[i])
|
|
|
|
|