Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/pyxrf_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ scikit-beam
tomopy
# These are required for installing the pyxrf-utils environment
hatchling
# Pandas needs to be pinned to prevent a bug in xrf-tomo, until
# it gets fixed and a new release comes out.
# See: https://github.com/NSLS-II-SRX/xrf-tomo/pull/10
pandas<3.0
2 changes: 1 addition & 1 deletion tomviz/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,7 @@ set(tomviz_python_modules
__init__.py
_internal.py
dataset.py
executor.py
external_dataset.py
fix_pdb.py
operators.py
Expand All @@ -635,7 +636,6 @@ set(tomviz_python_modules
utils.py
web.py
modules.py
views.py
)

file(MAKE_DIRECTORY "${tomviz_python_binary_dir}/tomviz")
Expand Down
2 changes: 1 addition & 1 deletion tomviz/DataPropertiesPanel.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ void DataPropertiesPanel::updateComponentsCombo()
auto blocked = QSignalBlocker(combo);

// Only make this editor visible if there is more than one component
bool visible = dsource->scalars()->GetNumberOfComponents() > 1;
bool visible = dsource->scalars() && dsource->scalars()->GetNumberOfComponents() > 1;
label->setVisible(visible);
combo->setVisible(visible);

Expand Down
15 changes: 15 additions & 0 deletions tomviz/DataSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ class DataSource : public QObject
/// Set/get the dark/white data, used in Data Exchange currently
vtkImageData* whiteData() const;

// Used to track if a volume visualization module was added
bool volumeModuleAutoAdded() const;
void setVolumeModuleAutoAdded(bool b);

/// Check to see if the data was subsampled while reading
bool wasSubsampled() const;

Expand Down Expand Up @@ -458,6 +462,7 @@ protected slots:
MetadataType m_metadata;

bool m_changingTimeStep = false;
bool m_volumeModuleAutoAdded = false;
};

inline void DataSource::clearTiltAngles()
Expand Down Expand Up @@ -495,6 +500,16 @@ inline void DataSource::setSubsampleVolumeBounds(int bs[6])
setSubsampleVolumeBounds(dataObject(), bs);
}

inline bool DataSource::volumeModuleAutoAdded() const
{
return m_volumeModuleAutoAdded;
}

inline void DataSource::setVolumeModuleAutoAdded(bool b)
{
m_volumeModuleAutoAdded = b;
}

} // namespace tomviz

#endif
2 changes: 1 addition & 1 deletion tomviz/ExternalPythonExecutor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Pipeline::Future* ExternalPythonExecutor::execute(vtkDataObject* data,
} else if (exitCode != 0) {
displayError(
"External Python Error",
QString("The external python return a non-zero exist code: %1\n\n "
QString("The external python returned a non-zero exit code: %1\n\n "
"command: %2 \n\n stderr:\n%3 \n\n stdout:\n%4 \n")
.arg(exitCode)
.arg(commandLine(this->m_process.data()))
Expand Down
5 changes: 5 additions & 0 deletions tomviz/Pipeline.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,11 @@ void Pipeline::branchFinished()
// doesn't already have an explicit child data source i.e.
// hasChildDataSource is true.
auto lastOp = start->operators().last();
if (!lastOp->isCompleted()) {
// Cannot continue
return;
}

if (!lastOp->hasChildDataSource()) {
DataSource* newChildDataSource = nullptr;
if (lastOp->childDataSource() == nullptr) {
Expand Down
57 changes: 56 additions & 1 deletion tomviz/PtychoDialog.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include <QBrush>
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QFileDialog>
#include <QFileInfo>
#include <QLabel>
#include <QMessageBox>
#include <QPointer>
Expand Down Expand Up @@ -83,6 +83,9 @@ class PtychoDialog::Internal : public QObject

connect(ui.filterSIDsString, &QLineEdit::editingFinished,
this, &Internal::updateFilteredSidList);
connect(ui.loadSidsFromTxt, &QPushButton::clicked, this,
&Internal::onLoadSidsFromTxtClicked);

connect(ui.selectOutputDirectory, &QPushButton::clicked, this,
&Internal::selectOutputDirectory);

Expand Down Expand Up @@ -535,6 +538,14 @@ class PtychoDialog::Internal : public QObject
return;
}

// If "recon_result" exists underneath the selected directory,
// it means the parent directory was selected.
// We should automatically select the child one.
auto possibleChildPath = QDir(file).filePath("recon_result");
if (QFile::exists(possibleChildPath)) {
file = possibleChildPath;
}

setPtychoDirectory(file);
ptychoDirEdited();
}
Expand Down Expand Up @@ -677,6 +688,50 @@ class PtychoDialog::Internal : public QObject
updateTable();
}

void onLoadSidsFromTxtClicked()
{
QString caption = "Select txt file";
QString filter = "*.txt";
auto startPath = ptychoDirectory();
auto filePath =
QFileDialog::getOpenFileName(parent.data(), caption, startPath, filter);

if (filePath.isEmpty()) {
return;
}

QFile file(filePath);
if (!file.exists()) {
qCritical() << QString("Txt file does not exist: %1").arg(filePath);
return;
}

if (!file.open(QIODevice::ReadOnly)) {
qCritical()
<< QString("Failed to open file \"%1\" with error: ").arg(filePath)
<< file.errorString();
return;
}

QTextStream reader(&file);

// Now load the SIDs
QStringList sids;
while (!reader.atEnd()) {
auto line = reader.readLine().trimmed();
if (line.isEmpty() || line.startsWith('#')) {
// Skip over it
continue;
}

sids.append(line.split(' ')[0]);
}

ui.filterSIDsString->setText(sids.join(", "));

updateFilteredSidList();
}

void selectLoadFromCSV()
{
QString caption = "Select CSV file to load Use and Version settings";
Expand Down
Loading