Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
458e31e1
Commit
458e31e1
authored
Apr 03, 2020
by
Mathieu Tillet
Browse files
Add option for single pixel mask
Adds the option to mask a single pixel of a detector, similarly to the pick option.
parent
1e5b1c25
Changes
2
Hide whitespace changes
Inline
Side-by-side
qt/widgets/instrumentview/inc/MantidQtWidgets/InstrumentView/InstrumentWidgetMaskTab.h
View file @
458e31e1
...
...
@@ -66,7 +66,8 @@ public:
DrawRectangle
,
DrawEllipticalRing
,
DrawRectangularRing
,
DrawFree
DrawFree
,
Pixel
};
explicit
InstrumentWidgetMaskTab
(
InstrumentWidget
*
instrWidget
);
...
...
@@ -114,6 +115,7 @@ protected slots:
void
toggleMaskGroup
();
void
enableApplyButtons
();
void
doubleChanged
(
QtProperty
*
/*prop*/
);
void
singlePixelPicked
(
size_t
);
protected:
void
showEvent
(
QShowEvent
*
/*unused*/
)
override
;
...
...
qt/widgets/instrumentview/src/InstrumentWidgetMaskTab.cpp
View file @
458e31e1
...
...
@@ -152,8 +152,6 @@ InstrumentWidgetMaskTab::InstrumentWidgetMaskTab(InstrumentWidget *instrWidget)
toolBox
->
addWidget
(
m_ring_rectangle
);
toolBox
->
addWidget
(
m_free_draw
);
toolBox
->
addWidget
(
m_pixel
);
toolBox
->
addStretch
();
toolBox
->
setSpacing
(
2
);
toolBox
->
setMargin
(
0
);
connect
(
m_move
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
setActivity
()));
...
...
@@ -359,7 +357,7 @@ InstrumentWidgetMaskTab::InstrumentWidgetMaskTab(InstrumentWidget *instrWidget)
* Initialize the tab when new projection surface is created.
*/
void
InstrumentWidgetMaskTab
::
initSurface
()
{
connect
(
m_instrWidget
->
getSurface
().
get
(),
SIGNAL
(
single
Pixel
Picked
(
size_t
)),
this
,
connect
(
m_instrWidget
->
getSurface
().
get
(),
SIGNAL
(
single
Component
Picked
(
size_t
)),
this
,
SLOT
(
singlePixelPicked
(
size_t
)));
connect
(
m_instrWidget
->
getSurface
().
get
(),
SIGNAL
(
shapeCreated
()),
this
,
SLOT
(
shapeCreated
()));
...
...
@@ -482,12 +480,40 @@ void InstrumentWidgetMaskTab::setActivity() {
m_activeTool
->
setText
(
"Tool: Free draw. "
+
whatIsBeingSelected
);
}
else
if
(
m_pixel
->
isChecked
())
{
m_activity
=
Pixel
;
m_instrWidget
->
getSurface
()
->
setInteractionMode
(
ProjectionSurface
::
PickSingleMode
);
m_activeTool
->
setText
(
"Tool: Pixel selection. "
+
whatIsBeingSelected
);
}
m_instrWidget
->
updateInfoText
();
}
/**
* Slot responding on the pick of a single detector pixel for masking.
*/
void
InstrumentWidgetMaskTab
::
singlePixelPicked
(
size_t
pickID
){
QApplication
::
setOverrideCursor
(
QCursor
(
Qt
::
WaitCursor
));
std
::
vector
<
long
unsigned
int
>
detectorId
{
static_cast
<
long
unsigned
int
>
(
pickID
)};
auto
&
actor
=
m_instrWidget
->
getInstrumentActor
();
actor
.
addMaskBinsData
(
detectorId
);
m_pointer
->
setChecked
(
true
);
setActivity
();
m_instrWidget
->
updateInstrumentView
();
// to refresh the pick image
auto
wsMask
=
actor
.
getMaskWorkspace
();
Mantid
::
detid_t
detId
=
actor
.
getDetID
(
pickID
);
// try to mask the detector, ignore any failure
try
{
wsMask
->
setMasked
(
detId
);
}
catch
(...)
{
}
// update detector colours
m_instrWidget
->
getInstrumentActor
().
updateColors
();
m_instrWidget
->
updateInstrumentDetectors
();
QApplication
::
restoreOverrideCursor
();
enableApplyButtons
();
}
/**
* Slot responding on creation of a new masking shape.
*/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment