Skip to content
Snippets Groups Projects
Commit 42ae6638 authored by payno's avatar payno
Browse files

app - stitching: set the stitching output as a full path relative to the current working directory

close #1244

# Conflicts:
#	src/tomwer/app/stitching/common.py

# Conflicts:
#	src/tomwer/app/stitching/common.py
parent 89ee2b20
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
from __future__ import annotations
import os
import argparse
import logging
import signal
......@@ -12,10 +13,10 @@ from tqdm import tqdm
import silx
from silx.gui import qt
from silx.io.url import DataUrl
from nabu.pipeline.config import generate_nabu_configfile
from nabu.stitching.config import get_default_stitching_config, SECTIONS_COMMENTS
import os
from nabu.stitching.config import StitchingType
from tomwer.core.volume.volumefactory import VolumeFactory
......@@ -30,6 +31,8 @@ from tomwer.gui.stitching.StitchingWindow import YStitchingWindow as _YStitching
from tomwer.gui.stitching import action as stitching_action
from tomwer.gui.cluster.slurm import SlurmSettingsWidget
from tomwer.core.scan.scanbase import TomwerScanBase
from tomwer.core.scan.nxtomoscan import NXtomoScan
from tomwer.core.volume import HDF5Volume
class MainWidget(qt.QTabWidget):
......@@ -223,6 +226,26 @@ class MainWindow(qt.QDialog):
self.layout().addWidget(self._buttons)
self._buttons.button(qt.QDialogButtonBox.Apply).setText("Launch stitching")
# set up
self._mainWindow._stitchingConfigWindow.setPreProcessingOutput(
NXtomoScan(
scan=os.path.join(os.getcwd(), "stitching", "stitched.nx"),
entry="entry0000",
)
.get_identifier()
.to_str()
)
self._mainWindow._stitchingConfigWindow.setPostProcessingOutput(
HDF5Volume(
file_path=os.path.join(
os.getcwd(), "stitching", "stitched_volume.hdf5"
),
data_path="stitched_volume",
)
.get_identifier()
.to_str()
)
# connect signal / slot
self._buttons.button(qt.QDialogButtonBox.Apply).clicked.connect(self.accept)
self._loadConfigurationAction.triggered.connect(
......@@ -301,6 +324,12 @@ class MainWindow(qt.QDialog):
def loadSettings(self, config_file: str):
self._mainWindow.loadSettings(config_file)
def setPreProcessingOutput(self, url: DataUrl) -> None:
self._mainWindow._stitchingConfigWindow.setPreProcessingOutput(url=url)
def setPostProcessingOutput(self, url: DataUrl) -> None:
self._mainWindow._stitchingConfigWindow.setPostProcessingOutput(url=url)
def main(argv, stitcher_name: str, stitching_axis: int, logger):
parser = argparse.ArgumentParser(description=__doc__)
......
......@@ -577,6 +577,12 @@ class _SingleAxisStitchingWindow(
level >= ConfigurationLevel.ADVANCED
)
def setPreProcessingOutput(self, *args, **kwargs):
self._outputWidget.setPreProcessingOutput(*args, **kwargs)
def setPostProcessingOutput(self, *args, **kwargs):
self._outputWidget.setPostProcessingOutput(*args, **kwargs)
class YStitchingWindow(_SingleAxisStitchingWindow, axis=1):
pass
......
......@@ -9,6 +9,7 @@ from tomwer.core.scan.nxtomoscan import NXtomoScan, NXtomoScanIdentifier
from tomwer.core.scan.scanfactory import ScanFactory
from tomwer.gui.utils.inputwidget import OutputVolumeDefinition
from tomwer.gui.qlefilesystem import QLFileSystem
from silx.io.url import DataUrl
_logger = logging.getLogger(__name__)
......@@ -22,9 +23,9 @@ class _PreProcessingOutput(qt.QWidget):
super().__init__(parent)
self.setLayout(qt.QFormLayout())
# TODO: check if the widget with output .nx file exists somewhere
self._outputFile = QLFileSystem("stitching/stitched.nx", self)
self._outputFile = QLFileSystem("", self)
self.layout().addRow("output nexus file", self._outputFile)
self._outputDataPath = qt.QLineEdit("entry0000", self)
self._outputDataPath = qt.QLineEdit("", self)
self.layout().addRow("output data path", self._outputDataPath)
def getUrl(self) -> str:
......@@ -160,3 +161,10 @@ class StitchingOutput(qt.QWidget):
if overwrite is not None:
overwrite = convert_str_to_bool(overwrite)
self._overwritePB.setChecked(overwrite)
# expose API
def setPreProcessingOutput(self, identifier: str) -> None:
self._preProcOutput.setUrl(identifier)
def setPostProcessingOutput(self, identifier: DataUrl) -> None:
self._postProcOutput.setUrl(identifier)
......@@ -437,7 +437,13 @@ class OutputVolumeDefinition(qt.QWidget):
# output file or folder
self._outputFileLabel = qt.QLabel("", self)
self.layout().addWidget(self._outputFileLabel, 1, 0, 1, 1)
self._outputFileQLE = QLFileSystem("stitched_volume.hdf5", parent=None)
self._outputFileQLE = QLFileSystem(
os.path.join(
os.getcwd(),
"stitched_volume.hdf5",
),
parent=None,
)
self.layout().addWidget(self._outputFileQLE, 1, 1, 1, 1)
self._selectPB = qt.QPushButton("select", self)
self.layout().addWidget(self._selectPB, 1, 2, 1, 1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment