Skip to content

Commit

Permalink
ghost add both methods
Browse files Browse the repository at this point in the history
  • Loading branch information
iltommi committed Jan 13, 2025
1 parent 531b4ad commit b84378a
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 19 deletions.
31 changes: 20 additions & 11 deletions plugins/Ghost_fringes/Ghost_fringes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,28 +182,37 @@ void Ghost_fringes::doGhost () {

double lambda=sqrt(pow(cr*dx,2)+pow(sr*dy,2))/(M_PI*widthCarrier->value());

DEBUG(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << lambda);
double thick_norm= resolution->value()/M_PI;

DEBUG(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << lambda);

for (size_t x=0;x<dx;x++) {
for (size_t y=0;y<dy;y++) {
double xr = xx[x]*cr - yy[y]*sr;
double yr = xx[x]*sr + yy[y]*cr;
double e_tot = 1.0-exp(-pow(yr,2))/(1.0+exp(lambda-std::abs(xr)));
imageFFT.set(x,y,imageFFT.point(x,y) * e_tot);
if (filter_model->currentText()=="1") {
for (size_t x=0;x<dx;x++) {
for (size_t y=0;y<dy;y++) {
double xr = xx[x]*cr - yy[y]*sr;
double yr = xx[x]*sr + yy[y]*cr;
double e_tot = 1.0-exp(-pow(yr/thick_norm,2))/(1.0+exp(lambda-std::abs(xr)));
imageFFT.set(x,y,imageFFT.point(x,y) * e_tot);
}
}
} else if (filter_model->currentText()=="2") {
for (size_t x=0;x<dx;x++) {
for (size_t y=0;y<dy;y++) {
double xr = xx[x]*cr - yy[y]*sr;
double yr = xx[x]*sr + yy[y]*cr;
double e_tot = 1.0-exp(-pow(yr/thick_norm,2))*exp(-pow(std::abs(xr)/lambda-M_PI, 2));
imageFFT.set(x,y,imageFFT.point(x,y) * e_tot);
}
}
}

imageFFT = imageFFT.ft2(PHYS_BACKWARD);

nPhysD *deepcopy=new nPhysD(*imageShot);
deepcopy->setShortName("deghost");
deepcopy->setName("deghost("+imageShot->getName()+")");
deepcopy->setName("deghost("+imageShot->getName()+","+filter_model->currentText().toStdString()+","+QString::number(resolution->value()).toStdString()+")");

QRect geom=maskRegion->path().boundingRect().toRect();



QPolygonF regionPoly=maskRegion->poly(1);
regionPoly=regionPoly.translated(imageShot->get_origin().x(),imageShot->get_origin().y());
std::vector<vec2f> vecPoints(regionPoly.size());
Expand Down
56 changes: 48 additions & 8 deletions plugins/Ghost_fringes/Ghost_fringes.ui
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="angleCarrier">
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
</property>
<property name="suffix">
<string>˚</string>
Expand All @@ -75,7 +75,7 @@
<item row="0" column="0">
<widget class="QDoubleSpinBox" name="widthCarrier">
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
</property>
<property name="suffix">
<string> px</string>
Expand Down Expand Up @@ -106,7 +106,7 @@
<string>Frequency weight (&lt;0 for lower freq; &gt;0 for higher freq)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
</property>
<property name="decimals">
<number>3</number>
Expand Down Expand Up @@ -160,12 +160,15 @@
<property name="value">
<double>1.000000000000000</double>
</property>
<property name="neutrinoSave" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QWidget" name="widget_3" native="true">
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
Expand Down Expand Up @@ -254,10 +257,10 @@
</layout>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand All @@ -267,6 +270,44 @@
</property>
</spacer>
</item>
<item row="3" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Model</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QComboBox" name="filter_model">
<property name="NeutrinoSave" stdset="0">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>2</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusbar">
Expand Down Expand Up @@ -298,7 +339,7 @@
</widget>
<action name="actionRegion">
<property name="icon">
<iconset resource="../../../build-neutrino-Qt_6_3_2_6_3_2_temporary-Debug/src/qrc/icons.qrc">
<iconset>
<normaloff>:/icons/region.png</normaloff>:/icons/region.png</iconset>
</property>
<property name="text">
Expand Down Expand Up @@ -330,7 +371,6 @@
</tabstops>
<resources>
<include location="GhostFringes.qrc"/>
<include location="../../../build-neutrino-Qt_6_3_2_6_3_2_temporary-Debug/src/qrc/icons.qrc"/>
</resources>
<connections/>
</ui>

0 comments on commit b84378a

Please sign in to comment.