Commit fc5e8dfa authored by Jan Burle's avatar Jan Burle
Browse files

This is release 2.0.3

parent 44ca7342
if [ "${CXX}" = "g++" ]; then export MKSPEC=macx-g++; export CC=gcc-4.8; export CXX=g++-4.8; fi
export QTDIR=/usr/local/opt/qt5
export PATH=$QTDIR/bin:$PATH
......
ver. 2.0.3 (Armistice), released 2016.11.11
-------------------------------------------
New features:
* check updates; optionally at startup
* loads TIFF data format
* loads Mar data format
* handles beam offset
* option to disable gamma-slicing
* option to disable neutron count averaging (experimental)
Improvements:
* optimized angle map calculation
* improved image display resizing
* image overlay shows beam centre crosshairs
* Metadata view is a table view
* more compact gui layout
* X button that clears reflections
* progress bar shows the progress of pole figure points interpolation
* gamma slicing shown in images
Bug fixes:
* #28 - a bug in vanadium correction
ver. 2.0.2a (hotfix), released 2016.08.29
--------------------------------
-----------------------------------------
Bug fixes:
......
# /CMakeLists.txt
# CMakeLists.txt
cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
......@@ -27,6 +27,7 @@ find_package (Qt5Multimedia REQUIRED)
add_subdirectory (lib)
add_subdirectory (LevMar)
add_subdirectory (core)
add_subdirectory (io)
add_subdirectory (gui)
add_subdirectory (tests)
......
# LevMar/CMakeLists.txt
# CMakeLists.txt
get_filename_component(lib ${CMAKE_CURRENT_SOURCE_DIR} NAME)
include_directories (
${CMAKE_HOME_DIRECTORY}/lib
${CMAKE_HOME_DIRECTORY}/core
)
set(source_files
......@@ -15,11 +16,11 @@ set(source_files
misc.cpp
)
add_library(LevMar
add_library(${lib}
${source_files}
)
target_link_libraries (LevMar
target_link_libraries (${lib}
Qt5::Core
)
......
......@@ -5,5 +5,12 @@ StressTextureCalculator, version 2.
## CI Status
### master:
[![Travis-CI Build Status](https://travis-ci.org/scgmlz/STeCa2.svg?branch=master)](https://travis-ci.org/scgmlz/STeCa2)
[![AppVeyor-CI Build Status](https://ci.appveyor.com/api/projects/status/github/scgmlz/steca2?branch=master&svg=true)](https://ci.appveyor.com/project/jburle/steca2)
### develop:
[![Travis-CI Build Status](https://travis-ci.org/scgmlz/STeCa2.svg?branch=develop)](https://travis-ci.org/scgmlz/STeCa2)
[![AppVeyor-CI Build Status](https://ci.appveyor.com/api/projects/status/github/scgmlz/steca2?branch=develop&svg=true)](https://ci.appveyor.com/project/jburle/steca2)
# core/CMakeLists.txt
# CMakeLists.txt
get_filename_component(lib ${CMAKE_CURRENT_SOURCE_DIR} NAME)
include_directories (
${CMAKE_HOME_DIRECTORY}/core
${CMAKE_HOME_DIRECTORY}/LevMar
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_HOME_DIRECTORY}/lib
${CMAKE_HOME_DIRECTORY}/LevMar
)
file (GLOB header_files
"*.h" "*/*.h" "*/*/*.h"
"*.h" "*/*.h"
)
file (GLOB source_files
"*.cpp" "*/*.cpp" "*/*/*.cpp"
"*.cpp" "*/*.cpp"
)
add_library (StecaCore
add_library (${lib}
${source_files}
${header_files}
)
target_link_libraries (StecaCore
target_link_libraries (${lib}
Qt5::Core
Qt5::Gui # TODO for QImage in tiffImage
)
#eof
......@@ -8,7 +8,7 @@
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2016
//! @authors Scientific Computing Group at MLZ Garching
//! @authors Rebecca Brydon, Jan Burle, Antti Soininen
//! @authors Rebecca Brydon, Jan Burle, Antti Soininen
//! @authors Based on the original STeCa by Christian Randau
//
// ************************************************************************** //
......@@ -46,45 +46,7 @@ size2d LensBase::transCutSize(size2d size) const {
return size;
}
//------------------------------------------------------------------------------
ImageLens::ImageLens(core::Session::rc session,
Image::rc image, Datasets::rc datasets,
bool trans, bool cut)
: super(session, datasets, trans, cut, session.imageTransform(), session.imageCut())
, image_(image)
{
}
size2d ImageLens::size() const {
return super::transCutSize(image_.size());
}
inten_t ImageLens::imageInten(uint i, uint j) const {
if (trans_) doTrans(i, j);
if (cut_) doCut(i, j);
inten_t inten = image_.inten(i, j);
if (intensCorr_)
inten *= intensCorr_->at(i, j);
return inten;
}
inten_rge::rc ImageLens::rgeInten(bool fixed) const {
if (fixed)
return datasets_.rgeFixedInten(session_, trans_, cut_);
if (!rgeInten_.isValid()) {
auto sz = size();
for_ij (sz.w, sz.h)
rgeInten_.extendBy(imageInten(i, j));
}
return rgeInten_;
}
void ImageLens::doTrans(uint& x, uint& y) const {
void LensBase::doTrans(uint& x, uint& y) const {
auto s = size();
uint w = s.w;
uint h = s.h;
......@@ -121,12 +83,50 @@ void ImageLens::doTrans(uint& x, uint& y) const {
}
}
void ImageLens::doCut(uint& i, uint& j) const {
void LensBase::doCut(uint& i, uint& j) const {
i += imageCut_.left; j += imageCut_.top;
}
//------------------------------------------------------------------------------
ImageLens::ImageLens(core::Session::rc session,
Image::rc image, Datasets::rc datasets,
bool trans, bool cut)
: super(session, datasets, trans, cut, session.imageTransform(), session.imageCut())
, image_(image)
{
}
size2d ImageLens::size() const {
return super::transCutSize(image_.size());
}
inten_t ImageLens::imageInten(uint i, uint j) const {
if (trans_) doTrans(i, j);
if (cut_) doCut(i, j);
inten_t inten = image_.inten(i, j);
if (intensCorr_)
inten *= intensCorr_->at(i, j);
return inten;
}
inten_rge::rc ImageLens::rgeInten(bool fixed) const {
if (fixed)
return datasets_.rgeFixedInten(session_, trans_, cut_);
if (!rgeInten_.isValid()) {
auto sz = size();
for_ij (sz.w, sz.h)
rgeInten_.extendBy(qreal(imageInten(i, j)));
}
return rgeInten_;
}
//------------------------------------------------------------------------------
DatasetLens::DatasetLens(core::Session::rc session,
data::Dataset::rc dataset, data::Datasets::rc datasets, eNorm norm,
bool trans, bool cut,
......@@ -144,6 +144,10 @@ gma_rge DatasetLens::rgeGma() const {
return dataset_.rgeGma(session_);
}
gma_rge DatasetLens::rgeGmaFull() const {
return dataset_.rgeGmaFull(session_);
}
tth_rge DatasetLens::rgeTth() const {
return dataset_.rgeTth(session_);
}
......@@ -154,12 +158,12 @@ inten_rge DatasetLens::rgeInten() const {
return dataset_.rgeInten();
}
Curve DatasetLens::makeCurve() const {
return makeCurve(rgeGma());
Curve DatasetLens::makeCurve(bool averaged) const {
return makeCurve(rgeGma(), averaged);
}
Curve DatasetLens::makeCurve(gma_rge::rc rgeGma) const {
inten_vec intens = dataset_.collectIntens(session_, intensCorr_, rgeGma);
Curve DatasetLens::makeCurve(gma_rge::rc rgeGma, bool averaged) const {
inten_vec intens = dataset_.collectIntens(session_, intensCorr_, rgeGma, averaged);
Curve res;
uint count = intens.count();
......@@ -168,7 +172,7 @@ Curve DatasetLens::makeCurve(gma_rge::rc rgeGma) const {
tth_rge rgeTth = dataset_.rgeTth(session_);
tth_t minTth = rgeTth.min, deltaTth = rgeTth.width() / count;
for_i (count)
res.append(minTth + deltaTth * i, intens.at(i) * normFactor_);
res.append(minTth + deltaTth * i, qreal(intens.at(i) * normFactor_));
}
return res;
......
......@@ -9,7 +9,7 @@
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2016
//! @authors Scientific Computing Group at MLZ Garching
//! @authors Rebecca Brydon, Jan Burle, Antti Soininen
//! @authors Rebecca Brydon, Jan Burle, Antti Soininen
//! @authors Based on the original STeCa by Christian Randau
//
// ************************************************************************** //
......@@ -49,6 +49,9 @@ public:
protected:
typ::size2d transCutSize(typ::size2d) const;
void doTrans(uint& i, uint& j) const;
void doCut(uint& i, uint& j) const;
core::Session const& session_;
data::Datasets::rc datasets_;
bool trans_, cut_;
......@@ -72,8 +75,6 @@ public:
inten_rge::rc rgeInten(bool fixed) const;
private:
void doTrans(uint& i, uint& j) const;
void doCut(uint& i, uint& j) const;
typ::Image const& image_;
......@@ -92,12 +93,13 @@ public:
typ::size2d size() const;
gma_rge rgeGma() const;
tth_rge rgeTth() const;
inten_rge rgeInten() const;
gma_rge rgeGma() const;
gma_rge rgeGmaFull() const;
tth_rge rgeTth() const;
inten_rge rgeInten() const;
typ::Curve makeCurve() const;
typ::Curve makeCurve(gma_rge::rc) const;
typ::Curve makeCurve(bool averaged) const;
typ::Curve makeCurve(gma_rge::rc, bool averaged) const;
data::Dataset::rc dataset() const { return dataset_; }
......
......@@ -8,7 +8,7 @@
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2016
//! @authors Scientific Computing Group at MLZ Garching
//! @authors Rebecca Brydon, Jan Burle, Antti Soininen
//! @authors Rebecca Brydon, Jan Burle, Antti Soininen
//! @authors Based on the original STeCa by Christian Randau
//
// ************************************************************************** //
......@@ -242,7 +242,8 @@ itf_t interpolateValues(deg searchRadius, ReflectionInfos::rc infos,
// Interpolates infos to equidistant grid in alpha and beta.
ReflectionInfos interpolate(ReflectionInfos::rc infos,
deg alphaStep, deg betaStep, deg idwRadius,
deg averagingAlphaMax, deg averagingRadius, qreal inclusionTreshold) {
deg averagingAlphaMax, deg averagingRadius, qreal inclusionTreshold,
Progress* progress) {
// Two interpolation methods are used here:
// If grid point alpha <= averagingAlphaMax, points within averagingRadius
// will be averaged.
......@@ -268,11 +269,17 @@ ReflectionInfos interpolate(ReflectionInfos::rc infos,
interpolatedInfos.reserve(numAlphas * numBetas);
for_int (i, numAlphas + 1) {
if (progress)
progress->setTotal(numAlphas * numBetas); // REVIEW + 1?
for_int (i, numAlphas + 1) { // REVIEW why + 1
deg const alpha = i * alphaStep;
for_int (j, numBetas) {
deg const beta = j * betaStep;
if (progress)
progress->step();
if (infos.isEmpty()) {
interpolatedInfos.append(ReflectionInfo(alpha, beta));
continue;
......
......@@ -9,7 +9,7 @@
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2016
//! @authors Scientific Computing Group at MLZ Garching
//! @authors Rebecca Brydon, Jan Burle, Antti Soininen
//! @authors Rebecca Brydon, Jan Burle, Antti Soininen
//! @authors Based on the original STeCa by Christian Randau
//
// ************************************************************************** //
......@@ -19,8 +19,7 @@
#include "calc_reflection_info.h"
#include "typ/typ_types.h"
class Progress;
#include "typ/typ_async.h"
namespace calc {
//------------------------------------------------------------------------------
......@@ -46,7 +45,8 @@ itf_t interpolateValues(typ::deg searchRadius, ReflectionInfos::rc infos,
ReflectionInfos interpolate(ReflectionInfos::rc,
typ::deg alphaStep, typ::deg betaStep, typ::deg idwRadius,
typ::deg averagingAlphaMax, typ::deg averagingRadius, qreal inclusionTreshold);
typ::deg averagingAlphaMax, typ::deg averagingRadius, qreal inclusionTreshold,
Progress*);
//------------------------------------------------------------------------------
}
......
......@@ -8,7 +8,7 @@
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2016
//! @authors Scientific Computing Group at MLZ Garching
//! @authors Rebecca Brydon, Jan Burle, Antti Soininen
//! @authors Rebecca Brydon, Jan Burle, Antti Soininen
//! @authors Based on the original STeCa by Christian Randau
//
// ************************************************************************** //
......
......@@ -9,7 +9,7 @@
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2016
//! @authors Scientific Computing Group at MLZ Garching
//! @authors Rebecca Brydon, Jan Burle, Antti Soininen
//! @authors Rebecca Brydon, Jan Burle, Antti Soininen
//! @authors Based on the original STeCa by Christian Randau
//
// ************************************************************************** //
......
......@@ -8,7 +8,7 @@
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2016
//! @authors Scientific Computing Group at MLZ Garching
//! @authors Rebecca Brydon, Jan Burle, Antti Soininen
//! @authors Rebecca Brydon, Jan Burle, Antti Soininen
//! @authors Based on the original STeCa by Christian Randau
//
// ************************************************************************** //
......
......@@ -9,7 +9,7 @@
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2016
//! @authors Scientific Computing Group at MLZ Garching
//! @authors Rebecca Brydon, Jan Burle, Antti Soininen
//! @authors Rebecca Brydon, Jan Burle, Antti Soininen
//! @authors Based on the original STeCa by Christian Randau
//
// ************************************************************************** //
......
......@@ -8,7 +8,7 @@
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2016
//! @authors Scientific Computing Group at MLZ Garching
//! @authors Rebecca Brydon, Jan Burle, Antti Soininen
//! @authors Rebecca Brydon, Jan Burle, Antti Soininen
//! @authors Based on the original STeCa by Christian Randau
//
// ************************************************************************** //
......@@ -171,6 +171,10 @@ gma_rge OneDataset::rgeGma(core::Session::rc session) const {
return session.angleMap(*this)->rgeGma();
}
gma_rge OneDataset::rgeGmaFull(core::Session::rc session) const {
return session.angleMap(*this)->rgeGmaFull();
}
tth_rge OneDataset::rgeTth(core::Session::rc session) const {
return session.angleMap(*this)->rgeTth();
}
......@@ -193,29 +197,35 @@ void OneDataset::collectIntens(core::Session::rc session, typ::Image const* inte
uint_vec const* gmaIndexes = nullptr;
uint gmaIndexMin = 0, gmaIndexMax = 0;
map.getGmaIndexes(rgeGma, gmaIndexes, gmaIndexMin, gmaIndexMax);
EXPECT(gmaIndexes)
EXPECT(gmaIndexMin <= gmaIndexMax)
EXPECT(gmaIndexMax <= gmaIndexes->count())
EXPECT(intens.count() == counts.count())
uint count = intens.count();
EXPECT(0 < deltaTth)
for (uint i = gmaIndexMin; i < gmaIndexMax; ++i) {
uint ind = gmaIndexes->at(i);
EXPECT(rgeGma.contains(map.at(ind).gma))
inten_t inten = image_.inten(ind);
if (qIsNaN(inten))
continue;
inten_t corr = intensCorr ? intensCorr->at(i) : 1;
inten_t corr = intensCorr ? intensCorr->at(ind) : 1;
if (qIsNaN(corr))
continue;
inten *= corr;
uint count = intens.count();
tth_t tth = map.at(ind).tth;
EXPECT(minTth <= tth && tth <= minTth + count*deltaTth)
uint ti = qMin(to_u(qFloor((tth - minTth) / deltaTth)), count-1); // bin index
// bin index
uint ti = to_u(qFloor((tth - minTth) / deltaTth));
EXPECT(ti <= count)
ti = qMin(ti, count-1); // it can overshoot due to floating point calculation
intens[ti] += inten;
counts[ti] += 1;
}
......@@ -297,7 +307,7 @@ Datasets::rc Dataset::datasets() const {
#define AVG_ONES(what) \
EXPECT(!isEmpty()) \
qreal avg = 0; \
for (auto &one : *this) \
for (auto& one : *this) \
avg += one->what(); \
avg /= count(); \
return avg;
......@@ -318,7 +328,7 @@ deg Dataset::chi() const {
#define RGE_COMBINE(combineOp, what) \
EXPECT(!isEmpty()) \
Range rge; \
for (auto &one : *this) \
for (auto& one : *this) \
rge.combineOp(one->what); \
return rge;
......@@ -326,6 +336,10 @@ gma_rge Dataset::rgeGma(core::Session::rc session) const {
RGE_COMBINE(extendBy, rgeGma(session))
}
gma_rge Dataset::rgeGmaFull(core::Session::rc session) const {
RGE_COMBINE(extendBy, rgeGmaFull(session))
}
tth_rge Dataset::rgeTth(core::Session::rc session) const {
RGE_COMBINE(extendBy, rgeTth(session))
}
......@@ -347,7 +361,8 @@ qreal Dataset::avgDeltaTime() const {
}
inten_vec Dataset::collectIntens(
core::Session::rc session, typ::Image const* intensCorr, gma_rge::rc rgeGma) const
core::Session::rc session, typ::Image const* intensCorr, gma_rge::rc rgeGma,
bool averaged) const
{
tth_rge tthRge = rgeTth(session);
tth_t tthWdt = tthRge.width();
......@@ -372,11 +387,12 @@ inten_vec Dataset::collectIntens(
for (auto& one : *this)
one->collectIntens(session, intensCorr, intens, counts, rgeGma, minTth, deltaTth);
for_i (numBins) {
auto cnt = counts.at(i);
if (cnt > 0)
intens[i] /= cnt;
}
if (averaged)
for_i (numBins) {
auto cnt = counts.at(i);
if (cnt > 0)
intens[i] /= cnt;
}
return intens;
}
......@@ -455,13 +471,13 @@ inten_rge::rc Datasets::rgeFixedInten(core::Session::rc session, bool trans, boo
return rgeFixedInten_;
}
Curve Datasets::avgCurve(core::Session::rc session) const {
Curve Datasets::avgCurve(core::Session::rc session, bool averaged) const {
if (avgCurve_.isEmpty()) {
// TODO invalidate when combinedDgram is unchecked
TakesLongTime __;
avgCurve_ = session.datasetLens(*combineAll(), *this, session.norm(), true, true)->makeCurve();
avgCurve_ = session.datasetLens(*combineAll(), *this, session.norm(), true, true)->makeCurve(averaged);
}
return avgCurve_;
......
......@@ -9,7 +9,7 @@
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2016
//! @authors Scientific Computing Group at MLZ Garching
//! @authors Rebecca Brydon, Jan Burle, Antti Soininen
//! @authors Rebecca Brydon, Jan Burle, Antti Soininen
//! @authors Based on the original STeCa by Christian Randau
//
// ************************************************************************** //
......@@ -106,6 +106,7 @@ public:
typ::deg chi() const { return md_->motorChi; }
gma_rge rgeGma(core::Session const&) const;
gma_rge rgeGmaFull(core::Session const&) const;
tth_rge rgeTth(core::Session const&) const;
inten_rge rgeInten() const;
......@@ -147,6 +148,7 @@ public:
typ::deg chi() const;
gma_rge rgeGma(core::Session const&) const;
gma_rge rgeGmaFull(core::Session const&) const;
tth_rge rgeTth(core::Session const&) const;
inten_rge rgeInten() const;
......@@ -156,7 +158,7 @@ public:
qreal avgDeltaTime() const;
inten_vec collectIntens(core::Session const&, typ::Image const* intensCorr,
gma_rge::rc) const;
gma_rge::rc, bool averaged) const;
private:
// all dataset(s) must have the same image size
......@@ -184,7 +186,7 @@ public:
inten_rge::rc rgeGma(core::Session const&) const;
inten_rge::rc rgeFixedInten(core::Session const&, bool trans, bool cut) const;
typ::Curve avgCurve(core::Session const&) const;
typ::Curve avgCurve(core::Session const&, bool averaged) const;
void invalidateAvgMutables() const;
......
......@@ -8,7 +8,7 @@
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2016
//! @authors Scientific Computing Group at MLZ Garching
//! @authors Rebecca Brydon, Jan Burle, Antti Soininen
//! @authors Rebecca Brydon, Jan Burle, Antti Soininen
//! @authors Based on the original STeCa by Christian Randau
//
// ************************************************************************** //
......
......@@ -9,7 +9,7 @@
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2016
//! @authors Scientific Computing Group at MLZ Garching
//! @authors Rebecca Brydon, Jan Burle, Antti Soininen
//! @authors Rebecca Brydon, Jan Burle, Antti Soininen
//! @authors Based on the original STeCa by Christian Randau
//
// ************************************************************************** //
......