Skip to content

Conversation

@imikejackson
Copy link
Contributor

Also a fix for a bug in ImageGeom when calculating the index of a voxel from a set of 3D Floating point coordinates.

@imikejackson imikejackson added Enhancement Code added that makes life easier Feature Request labels Oct 13, 2019
Comment on lines 49 to 53
static const float epsijk = 1.0f;
// static const double epsijkd = 1.0;
#elif DREAM3D_ACTIVE_ROTATION
static const float epsijk = -1.0f;
static const double epsijkd = -1.0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid static global variables (not contained in class or function). As of C++17, global constants should be purely const as it implies a single variable for compiler optimization, but what I've seen most commonly agreed upon is that static const global variables are inherently unsafe. The most common understanding I've seen is that each translation unit (.cpp) will have their own version of the variable. Arguably, that's the same as const pre-17, but it looks like it's not, which can be dangerous.

I am not sure if static const globals post-17 break the assumptions for const globals, but there's a number of articles warning to not compare static const global variables with == operator due to differing memory addresses. The pre-17 way to ensure you only have one version of a global is to use everyone's all-time favorite keyword, extern.

This is also a .cpp file, so none of that applies. But we still should not be using static here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

DataContainerArray::Pointer dca = getDataContainerArray();

#ifdef SIMPL_USE_PARALLEL_ALGORITHMS
tbb::task_scheduler_init init;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use ParallelTaskAlgorithm here? Branching code paths is a code smell, and thread count is already checked in its execute as long as the algorithm object is created before the for loop. If SIMPL_USE_PARALLEL_ALGORITHMS is not supported, it is not performed in parallel.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we can use ParallelTaskAlgorithm due to how the loops are developed with the rotations. I will continue to look at the code to see if we can shoe horn the algorithm into the ParallelTaskAlgorithm class.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can't use ParallelTaskAlgorithm, how can multi-threading be supported? It's literally operating the same way as what's written in the loop? Surely, they'd both have the same issue?

Copy link
Contributor

@mmarineBlueQuartz mmarineBlueQuartz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good. There were two points of interest, but I am mostly interested in the multi-threading part due to branching code paths around #ifdef.

imikejackson added a commit to imikejackson/SIMPL that referenced this pull request Oct 21, 2019
imikejackson added a commit to imikejackson/SIMPL that referenced this pull request Oct 31, 2019
@imikejackson imikejackson force-pushed the topic/tilt-series-filter branch from 4eecce2 to 2c935a1 Compare October 31, 2019 00:08
imikejackson added a commit to imikejackson/SIMPL that referenced this pull request Nov 1, 2019
@imikejackson imikejackson force-pushed the topic/tilt-series-filter branch from 01a6e57 to 8f23060 Compare November 1, 2019 15:24
JDuffeyBQ pushed a commit to imikejackson/SIMPL that referenced this pull request Nov 4, 2019
@JDuffeyBQ JDuffeyBQ force-pushed the topic/tilt-series-filter branch from 8f23060 to 7a09916 Compare November 4, 2019 14:43
@imikejackson imikejackson force-pushed the topic/tilt-series-filter branch 2 times, most recently from e4abd43 to 24a5830 Compare November 5, 2019 16:10
imikejackson and others added 11 commits November 5, 2019 12:53
A deeper unit test that has exemplar output images needs to be created.
* GenerateTiltSeries::generateGrid() could try to create a grid
coordinates array with 0 elements and then access it depending on
the user input for the spacing.
* Changed the axis constants in GenerateTiltSeries to be static
constexpr
…eIds.

This allows the developer to more easily debug the rotated geometries
complete with the proper data.
The generic versions were to difficult and obtuse to get working.

Signed-off-by: Michael Jackson <[email protected]>
@JDuffeyBQ JDuffeyBQ force-pushed the topic/tilt-series-filter branch from 24a5830 to 03b85af Compare November 5, 2019 17:56
* Compares against GenerateTiltSeriesTest.dream3d from DREAM3D_Data repo
* Ran clang-format
@imikejackson imikejackson merged commit 2b175dd into BlueQuartzSoftware:develop Nov 13, 2019
@imikejackson imikejackson deleted the topic/tilt-series-filter branch November 13, 2019 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Code added that makes life easier Feature Request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants