Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 9a86200c authored by Edward Andò's avatar Edward Andò
Browse files

[skip-ci] spam-ereg PhiFile format and file names

parent 840068fc
......@@ -35,35 +35,36 @@ def main():
print("usage : spam-ereg BINNING [Im1 Im2 Phi]")
print("binning = 1")
binning = 1
try:
images = [tifffile.imread(sys.argv[2]), tifffile.imread(sys.argv[3])]
fileName1 = sys.argv[2]
fileName2 = sys.argv[3]
images = [tifffile.imread(fileName1), tifffile.imread(fileName2)]
except:
images = []
fileName = QFileDialog.getOpenFileName(
None, 'Open Image 1', os.getcwd())[0]
images.append(tifffile.imread(
fileName))
images.append(tifffile.imread(
QFileDialog.getOpenFileName(None, 'Open Image 2', os.path.dirname(os.path.realpath(fileName)))[0]))
fileName1 = QFileDialog.getOpenFileName(None, 'Open Image 1', os.getcwd())[0]
images.append(tifffile.imread(fileName1))
fileName2 = QFileDialog.getOpenFileName(None, 'Open Image 2', os.path.dirname(os.path.realpath(fileName1)))[0]
images.append(tifffile.imread(fileName2))
try:
f = numpy.genfromtxt(sys.argv[4], delimiter="\t", names=True)
Phi = numpy.array([[float(f["F11"]), float(f["F12"]), float(f["F13"]), float(f['Zdisp'])],
[float(f["F21"]), float(f["F22"]), float(f["F23"]), float(f['Ydisp'])],
[float(f["F31"]), float(f["F32"]), float(f["F33"]), float(f['Xdisp'])],
Phi = numpy.array([[float(f["Fzz"]), float(f["Fzy"] ), float(f["Fzx"]), float(f['Zdisp'])],
[float(f["Fyz"]), float(f["Fyy"]), float(f["Fyx"]), float(f['Ydisp'])],
[float(f["Fxz"]), float(f["Fxy"]), float(f["Fxx"]), float(f['Xdisp'])],
[0, 0, 0, 1]])
except:
try:
f = numpy.genfromtxt(QFileDialog.getOpenFileName(
None, '(optional) Open Phi TSV', os.path.dirname(os.path.realpath(fileName)))[0], delimiter="\t", names=True)
Phi = numpy.array([[float(f["F11"]), float(f["F12"]), float(f["F13"]), float(f['Zdisp'])],
[float(f["F21"]), float(f["F22"]), float(f["F23"]), float(f['Ydisp'])],
[float(f["F31"]), float(f["F32"]), float(f["F33"]), float(f['Xdisp'])],
f = numpy.genfromtxt(QFileDialog.getOpenFileName(None, '(optional) Open Phi TSV', os.path.dirname(os.path.realpath(fileName1)))[0], delimiter="\t", names=True)
Phi = numpy.array([[float(f["Fzz"]), float(f["Fzy"]), float(f["Fzx"]), float(f['Zdisp'])],
[float(f["Fyz"]), float(f["Fyy"]), float(f["Fyx"]), float(f['Ydisp'])],
[float(f["Fxz"]), float(f["Fxy"]), float(f["Fxx"]), float(f['Xdisp'])],
[0, 0, 0, 1]])
except:
Phi = numpy.eye(4, 4)
window = QWidget()
mainWindowGrid = QGridLayout(window)
eregWidget = visual.ereg(images, Phi, binning, ["image1", "image2"])
eregWidget = visual.ereg(images, Phi, binning, [fileName1, fileName2])
mainWindowGrid.addWidget(eregWidget, 1, 1)
window.show()
eregWidget.show()
......
......@@ -19,7 +19,6 @@ You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import sys
import subprocess
......@@ -114,27 +113,30 @@ class MainWindow(QWidget):
labelDilate=args.LABEL_DILATE, margin=args.margin,
maskOtherLabels=args.MASK)
# 2020-10-23: EA on Issue #186: using spam.helpers.slicePadded
REFsubvol = spam.helpers.slicePadded(REFgrey, REFgl['boundingBox']+numpy.array([0,1,0,1,0,1]))
if args.MASK:
# If mask asked, also flatten greylevels
REFsubvol[REFgl['subvol'] == 0] = 0
# 2020-10-23: EA on Issue #186: using spam.helpers.slicePadded
DEFsubvol = spam.helpers.slicePadded(DEFgrey, REFgl['boundingBox']+
numpy.array([0,1,0,1,0,1])+
numpy.array([displacementInt[0], displacementInt[0],
displacementInt[1], displacementInt[1],
displacementInt[2], displacementInt[2]]))
self.eregWidget = visual.ereg( [REFsubvol, DEFsubvol],
Phi, 1,
["{} - label {}".format(REFstr, nonConvergedGrain), "{} - label {}".format(DEFstr, nonConvergedGrain)], 0)
self.mainWindowGrid.addWidget(self.eregWidget, 1, 1)
self.nextLabelButton = QPushButton("Accept and move on to next grain", self)
self.nextLabelButton.clicked.connect(self.nextLabel)
self.mainWindowGrid.addWidget(self.nextLabelButton, 2, 1)
if REGgl is not None:
# 2020-10-23: EA on Issue #186: using spam.helpers.slicePadded
REFsubvol = spam.helpers.slicePadded(REFgrey, REFgl['boundingBox']+numpy.array([0,1,0,1,0,1]))
if args.MASK:
# If mask asked, also flatten greylevels
REFsubvol[REFgl['subvol'] == 0] = 0
# 2020-10-23: EA on Issue #186: using spam.helpers.slicePadded
DEFsubvol = spam.helpers.slicePadded(DEFgrey, REFgl['boundingBox']+
numpy.array([0,1,0,1,0,1])+
numpy.array([displacementInt[0], displacementInt[0],
displacementInt[1], displacementInt[1],
displacementInt[2], displacementInt[2]]))
self.eregWidget = visual.ereg( [REFsubvol, DEFsubvol],
Phi, 1,
["{} - label {}".format(REFstr, nonConvergedGrain), "{} - label {}".format(DEFstr, nonConvergedGrain)], 0)
self.mainWindowGrid.addWidget(self.eregWidget, 1, 1)
self.nextLabelButton = QPushButton("Accept and move on to next grain", self)
self.nextLabelButton.clicked.connect(self.nextLabel)
self.mainWindowGrid.addWidget(self.nextLabelButton, 2, 1)
else:
nextLabel()
def nextLabel(self):
#print("Phi:", self.eregWidget.output())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment