Ticket #9428 (closed: fixed)

Opened 6 years ago

Last modified 5 years ago

FindClusterFaces Algorithm

Reported by: Owen Arnold Owned by: Owen Arnold
Priority: major Milestone: Release 3.2
Component: Diffraction Keywords:
Cc: Blocked By:
Blocking: #9375, #9455 Tester:

Description (last modified by Owen Arnold) (diff)

This algorithm is a key component of #9375, which will be used to display cluster workspaces in the SliceViewer.

This algorithm inspects an image (MDHistoWorkspace) containing clusters, and takes an optional PeaksWorkspace as a filter. It then builds a table of all the edges of each cluster. The workings have been outline in #9375.

I have considered using MarchingCubes for this type of analysis, but the interpolation to generate polygons will not give the true region of the cluster.

Change History

comment:1 Changed 6 years ago by Owen Arnold

This algorithm may be very useful in its own right.

comment:2 Changed 6 years ago by Owen Arnold

  • Summary changed from FindClusterEdges to FindClusterFaces

comment:3 Changed 6 years ago by Owen Arnold

refs #9428. Basic algorithm with tests.

Changeset: 25a5ca6cbf16fe88a3082a70f556215e26349636

comment:4 Changed 6 years ago by Owen Arnold

refs #9428. Working on adding face-touching neighbour finding.

Changeset: c7d22a8267527bf12a504c1a9ee2d3dd0a6dfc4a

comment:5 Changed 6 years ago by Owen Arnold

refs #9428. Extend functional and performance tests.

Changeset: 6a182aab4d1455c34421e5e1993ebf3e541dc30e

comment:6 Changed 6 years ago by Owen Arnold

refs #9428. Extend interface to include new find signature.

Changeset: 3ffa9c4b5e54a55768bac804c4314a638e8549f2

comment:7 Changed 6 years ago by Owen Arnold

refs #9428. Use face neighbour finding and test.

Changeset: 20f239691b8fc1c27939ac703834dac7a040872f

comment:8 Changed 6 years ago by Owen Arnold

refs #9428. New utility PeakClusterProjection.

Changeset: 81804fe811becbcdaa729e68dee51f703594bf9d

comment:9 Changed 6 years ago by Owen Arnold

refs #9428. Extended tests for PeakClusterProjection.

Changeset: c7172bd32477ec54551e27e6a8b0270fda4f7786

comment:10 Changed 6 years ago by Owen Arnold

  • Description modified (diff)

comment:11 Changed 6 years ago by Nick Draper

  • Status changed from new to assigned
  • Summary changed from FindClusterFaces to FindClusterFaces Algorithm

comment:12 Changed 6 years ago by Owen Arnold

  • Status changed from assigned to inprogress

refs #9428. Fix errors and tests.

Error in IntegratePeaksUsingClusters test introduced (previously) and now fixed. Windows disambiguation of exact enum to use.

Changeset: 4a5a430bdc62ee714ba3d44cd3373abf9a551ef9

comment:13 Changed 6 years ago by Owen Arnold

refs #9428. Swap in PeakClusterProjection into integration.

refactoring step. Common code usage.

Changeset: 88d62a6e6fea114c46b220a344be174adac606ce

comment:14 Changed 6 years ago by Owen Arnold

refs #9428. More tests and performance tests.

Increase test coverage. Add performance tests, and refactor the implementation a little.

Changeset: c38ea5a71eb69e14c8f36a36f4a0a0c1328789f2

comment:15 Changed 6 years ago by Owen Arnold

refs #9428. Fix type conversion warnings.

Changeset: 7e27b82d8ef9623bb266172d0ce11dbd556d5593

comment:16 Changed 6 years ago by Owen Arnold

refs #9428. Fix SignalRangeTest.h Iterator usage.

Changeset: 9ad566c3e909e6b593e186adb3f0d3385f426dd4

comment:17 Changed 6 years ago by Owen Arnold

refs #9428. Fix cmakelists.txt for test.

Changeset: b66546a2675e11cdc00f8cbb955803aece9f9dd3

comment:18 Changed 6 years ago by Owen Arnold

refs #9428. Fix doxygen warning.

Changeset: 6b3db62ff92705106263b910e554c04e082b64e9

comment:19 Changed 6 years ago by Owen Arnold

refs #9428. Fix type comparison warning.

Changeset: 934fb6c9279bf5516e7303068f1978fc2259bc87

comment:20 Changed 6 years ago by Owen Arnold

refs #9428. Fix type doxygen warning.

Changeset: d2efdaf8a654103a504d27b30c144b2cbb88cbb5

comment:21 Changed 6 years ago by Owen Arnold

Tester:

1) There are extensive unit tests covering the workings of this new algorithm.

2) Running the following python script will also demonstrate this working.

ws_name = "TOPAZ_3132"
filename = ws_name +"_event.nxs"
ws = LoadEventNexus(Filename=filename,FilterByTofMin=3000, FilterByTofMax=16000)

# Convert to Q space
LabQ = ConvertToDiffractionMDWorkspace(InputWorkspace=ws, LorentzCorrection='0',
        OutputDimensions='Q (lab frame)', SplitInto=2, SplitThreshold=150)
        
# Find peaks
PeaksLattice = FindPeaksMD(InputWorkspace=LabQ,MaxPeaks=100)

        
# Find the UB matrix using the peaks and known lattice parameters
FindUBUsingLatticeParameters(PeaksWorkspace=PeaksLattice, a=10.3522, b=6.0768, c=4.7276,
                alpha=90, beta=90, gamma=90, NumInitial=20, Tolerance=0.12)
                
# And index to HKL            
IndexPeaks(PeaksWorkspace=PeaksLattice, Tolerance=0.12)

HistoMDQLab = BinMD(InputWorkspace=LabQ,AlignedDim0='Q_lab_x, 2.7, 3, 50',AlignedDim1='Q_lab_y, -0.9, -0.6, 50',AlignedDim2='Q_lab_z, 9.2, 9.5,  50')   
PeaksLattice_Integrated_Clusters, ClusterImage = IntegratePeaksUsingClusters(InputWorkspace=HistoMDQLab, PeaksWorkspace=PeaksLattice, Threshold=100000)

# Show Cluster with Peak Overlayed. Only One point where a PeaksWorkspace intersects with a Cluster!
svw = plotSlice(ClusterImage)
sv = svw.getSlicer()
pp_all = sv.setPeaksWorkspaces([PeaksLattice_Integrated_Clusters])
pp = pp_all.getPeaksPresenter(PeaksLattice_Integrated_Clusters)
pp.zoomToPeak(30)
svw.zoomBy(0.03)

# So finding with the PeaksWorkspace as a filter should yield results that have the SAME value for 'ClusterId 'in all rows!
with_filter = FindClusterFaces(InputWOrkspace=ClusterImage, FilterWorkspace=PeaksLattice)
# No such restriction when filtering is not applied
no_filter = FindClusterFaces(InputWOrkspace=ClusterImage)

testRow = with_filter.row(0)
clusterId = testRow['ClusterId']
filtered_count = with_filter.rowCount()
unfiltered_count = 0
for i in range(no_filter.rowCount()):
        _row =  no_filter.row(i)
        if _row['ClusterId'] == clusterId:
                unfiltered_count += 1
print 'Target ClusterId occurances in Filtered Output', filtered_count
print 'Target ClusterId occurances in UnFiltered Output', unfiltered_count
  • Look at the OutputWorkspace called 'with_filter'. All entries for ClusterId should be the same!
  • Look at the OutputWorkspace called 'no_filter'. Not all entries should be the same, but 'with_filter' should be a subset of 'no_filter'
Last edited 6 years ago by Owen Arnold (previous) (diff)

comment:22 Changed 6 years ago by Owen Arnold

  • Status changed from inprogress to verify
  • Resolution set to fixed

comment:23 Changed 6 years ago by Owen Arnold

  • Blocking 9455 added

comment:24 Changed 6 years ago by Samuel Jackson

  • Status changed from verify to closed

Merge remote-tracking branch 'origin/feature/9428_find_cluster_edges'

Full changeset: 33b2e4f5b4ba0321166549c1f373854c6bb3b7bb

comment:25 Changed 6 years ago by Owen Arnold

  • Blocking 9375 added

comment:26 Changed 6 years ago by Owen Arnold

refs #9428. Extend solution to scaling RHSWS

Changeset: 64c42fb7b13200faae409ea48c1835cd4947d6c0

comment:27 Changed 6 years ago by Owen Arnold

refs #9428. Extend tests for multithreaded zero search

Changeset: c14d80f835abfff4d771cb2e519938fe8c696489

comment:28 Changed 6 years ago by Owen Arnold

refs #9428. Protect against bad scale factors.

Changeset: 8d356854f77dbf48a635437468d6de68fa5e4e93

comment:29 Changed 6 years ago by Owen Arnold

refs #9428. Add documentation and tests.

Incomplete functionality. Had to fix polynomial usage over Max's implementation in quick.

Changeset: 532039904a83d2fc6633c5e9efcadf773adfeddc

comment:30 Changed 6 years ago by Owen Arnold

refs #9428. Remove need for Params in workflow algs

Changeset: d6d43dabc3ea2e9a0a8c8b3c5a56451d1d4cd284

comment:31 Changed 6 years ago by Owen Arnold

refs #9428. Stitch as part of process.

If stitch is checked, then the stitched output workspace will be generated as part of the processing. If it is done after, then it is completed as part of the plot process

Changeset: 1c2277a435ba588be8fd13282ded508b3c08bccc

comment:32 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 10271

Note: See TracTickets for help on using tickets.