def wizardBrowse(gui, var): if 'file' in var.tags.keys(): seltype="file" filterExt = var.tags['file'] else: seltype="folder" filterExt = '' files = showBrowseDialog(parent=gui.master, seltype=seltype, filter=filterExt) if files: var.setTkValue(', '.join([xmippRelpath(f) for f in files]))
def importImages(log, InputFile, WorkingDir, DoCopy, ImportAll, SubsetMode, Nsubset): imagesFn = getImagesFilename(WorkingDir) fnInput = FileName(InputFile) md = MetaData(InputFile) #check if micrographs or ctfparam exists doMic=False doCTFParam=False if md.containsLabel(MDL_MICROGRAPH): doMic = True if md.containsLabel(MDL_CTF_MODEL): doCTFParam = True if fnInput.isMetaData(): inputRelativePath = dirname(relpath(InputFile, '.')) projectPath = findProjectPath(InputFile) for id in md: imgFn = md.getValue(MDL_IMAGE, id) imgNo, imgFn = splitFilename(imgFn) imgFn = xmippRelpath(fixPath(imgFn, projectPath, inputRelativePath, '.')) if imgNo != None: imgFn = "%s@%s" % (imgNo, imgFn) md.setValue(MDL_IMAGE, imgFn, id) #micrograph if doMic: imgFn = md.getValue(MDL_MICROGRAPH, id) imgNo, imgFn = splitFilename(imgFn) imgFn = xmippRelpath(fixPath(imgFn, projectPath, inputRelativePath, '.')) if imgNo != None: imgFn = "%s@%s" % (imgNo, imgFn) md.setValue(MDL_MICROGRAPH, imgFn, id) #ctf param if doCTFParam: ctfFn = md.getValue(MDL_CTF_MODEL, id) ctfFn = xmippRelpath(fixPath(ctfFn, projectPath, inputRelativePath, '.')) md.setValue(MDL_CTF_MODEL, ctfFn, id) outExt = '.stk' else: outExt = '.%s' % fnInput.getExtension() imagesStk = imagesFn.replace('.xmd', outExt) writeImagesMd(log, md, ImportAll, SubsetMode, Nsubset, imagesFn, imagesStk, DoCopy)