+ if (dialogGetCompare.ShowModal() == wxID_OK) {
+ ImageFile& rIF = GetDocument()->getImageFile();
+ ImageFileDocument* pRHSDoc = dialogGetCompare.getImageFileDocument();
+ const ImageFile& rRHSIF = pRHSDoc->getImageFile();
+ ImageFileDocument* pNewDoc = theApp->newImageDoc();
+ if (! pNewDoc) {
+ sys_error (ERR_SEVERE, "Unable to create image file");
+ return;
+ }
+ ImageFile& newImage = pNewDoc->getImageFile();
+ newImage.setArraySize (rIF.nx(), rIF.ny());
+ rIF.multiplyImages (rRHSIF, newImage);
+ std::ostringstream os;
+ os << "Multiply image " << GetDocument()->GetFirstView()->GetFrame()->GetTitle().c_str() << " and "
+ << pRHSDoc->GetFirstView()->GetFrame()->GetTitle().c_str();
+ wxString s = GetDocument()->GetFirstView()->GetFrame()->GetTitle() + ": ";
+ newImage.labelsCopy (rIF, s.c_str());
+ s = pRHSDoc->GetFirstView()->GetFrame()->GetTitle() + ": ";
+ newImage.labelsCopy (rRHSIF, s.c_str());
+ newImage.labelAdd (os.str().c_str());
+ *theApp->getLog() << os.str().c_str() << "\n";
+ if (theApp->getAskDeleteNewDocs())
+ pNewDoc->Modify (true);
+ pNewDoc->UpdateAllViews (this);
+ pNewDoc->getView()->setInitialClientSize();
+ pNewDoc->Activate();
+ }
+ }
+}
+
+void
+ImageFileView::OnDivide (wxCommandEvent& event)
+{
+ std::vector<ImageFileDocument*> vecIF;
+ theApp->getCompatibleImages (GetDocument(), vecIF);
+
+ if (vecIF.size() == 0) {
+ wxMessageBox ("There are no compatible image files open for comparision", "No comparison images");
+ } else {
+ DialogGetComparisonImage dialogGetCompare (getFrameForChild(), "Get Image to Divide", vecIF, false);
+
+ if (dialogGetCompare.ShowModal() == wxID_OK) {
+ ImageFile& rIF = GetDocument()->getImageFile();
+ ImageFileDocument* pRHSDoc = dialogGetCompare.getImageFileDocument();
+ const ImageFile& rRHSIF = pRHSDoc->getImageFile();
+ ImageFileDocument* pNewDoc = theApp->newImageDoc();
+ if (! pNewDoc) {
+ sys_error (ERR_SEVERE, "Unable to create image file");
+ return;
+ }
+ ImageFile& newImage = pNewDoc->getImageFile();
+ newImage.setArraySize (rIF.nx(), rIF.ny());
+ rIF.divideImages (rRHSIF, newImage);
+ std::ostringstream os;
+ os << "Divide image " << GetDocument()->GetFirstView()->GetFrame()->GetTitle().c_str() << " by "
+ << pRHSDoc->GetFirstView()->GetFrame()->GetTitle().c_str();
+ wxString s = GetDocument()->GetFirstView()->GetFrame()->GetTitle() + ": ";
+ newImage.labelsCopy (rIF, s.c_str());
+ s = pRHSDoc->GetFirstView()->GetFrame()->GetTitle() + ": ";
+ newImage.labelsCopy (rRHSIF, s.c_str());
+ newImage.labelAdd (os.str().c_str());
+ *theApp->getLog() << os.str().c_str() << "\n";
+ if (theApp->getAskDeleteNewDocs())
+ pNewDoc->Modify (true);
+ pNewDoc->UpdateAllViews (this);
+ pNewDoc->getView()->setInitialClientSize();
+ pNewDoc->Activate();
+ }
+ }
+}
+
+
+#ifdef HAVE_FFT
+void
+ImageFileView::OnFFT (wxCommandEvent& event)
+{
+ ImageFile& rIF = GetDocument()->getImageFile();
+ rIF.fft (rIF);
+ rIF.labelAdd ("FFT Image");
+ m_bMinSpecified = false;
+ m_bMaxSpecified = false;
+ if (theApp->getAskDeleteNewDocs())
+ GetDocument()->Modify (true);
+ GetDocument()->UpdateAllViews (this);
+ GetDocument()->Activate();
+}
+
+void
+ImageFileView::OnIFFT (wxCommandEvent& event)
+{
+ ImageFile& rIF = GetDocument()->getImageFile();
+ rIF.ifft (rIF);
+ rIF.labelAdd ("IFFT Image");
+ m_bMinSpecified = false;
+ m_bMaxSpecified = false;
+ if (theApp->getAskDeleteNewDocs())
+ GetDocument()->Modify (true);
+ GetDocument()->UpdateAllViews (this);
+ GetDocument()->Activate();
+}
+
+void
+ImageFileView::OnFFTRows (wxCommandEvent& event)
+{
+ ImageFile& rIF = GetDocument()->getImageFile();
+ rIF.fftRows (rIF);
+ rIF.labelAdd ("FFT Rows");
+ m_bMinSpecified = false;
+ m_bMaxSpecified = false;
+ if (theApp->getAskDeleteNewDocs())
+ GetDocument()->Modify (true);
+ GetDocument()->UpdateAllViews (this);
+ GetDocument()->Activate();
+}
+
+void
+ImageFileView::OnIFFTRows (wxCommandEvent& event)
+{
+ ImageFile& rIF = GetDocument()->getImageFile();
+ rIF.ifftRows (rIF);
+ rIF.labelAdd ("IFFT Rows");
+ m_bMinSpecified = false;
+ m_bMaxSpecified = false;
+ if (theApp->getAskDeleteNewDocs())
+ GetDocument()->Modify (true);
+ GetDocument()->UpdateAllViews (this);
+ GetDocument()->Activate();
+}
+
+void
+ImageFileView::OnFFTCols (wxCommandEvent& event)
+{
+ ImageFile& rIF = GetDocument()->getImageFile();
+ rIF.fftCols (rIF);
+ rIF.labelAdd ("FFT Columns");
+ m_bMinSpecified = false;
+ m_bMaxSpecified = false;
+ if (theApp->getAskDeleteNewDocs())
+ GetDocument()->Modify (true);
+ GetDocument()->UpdateAllViews (this);
+ GetDocument()->Activate();
+}
+
+void
+ImageFileView::OnIFFTCols (wxCommandEvent& event)
+{
+ ImageFile& rIF = GetDocument()->getImageFile();
+ rIF.ifftCols (rIF);
+ rIF.labelAdd ("IFFT Columns");
+ m_bMinSpecified = false;
+ m_bMaxSpecified = false;
+ if (theApp->getAskDeleteNewDocs())
+ GetDocument()->Modify (true);
+ GetDocument()->UpdateAllViews (this);
+ GetDocument()->Activate();
+}
+#endif
+
+void
+ImageFileView::OnFourier (wxCommandEvent& event)
+{
+ ImageFile& rIF = GetDocument()->getImageFile();
+ wxProgressDialog dlgProgress (wxString("Fourier"), wxString("Fourier Progress"), 1, getFrameForChild(), wxPD_APP_MODAL);
+ rIF.fourier (rIF);
+ rIF.labelAdd ("Fourier Image");
+ m_bMinSpecified = false;
+ m_bMaxSpecified = false;
+ if (theApp->getAskDeleteNewDocs())
+ GetDocument()->Modify (true);
+ GetDocument()->UpdateAllViews (this);
+ GetDocument()->Activate();
+}
+
+void
+ImageFileView::OnInverseFourier (wxCommandEvent& event)
+{
+ ImageFile& rIF = GetDocument()->getImageFile();
+ wxProgressDialog dlgProgress (wxString("Inverse Fourier"), wxString("Inverse Fourier Progress"), 1, getFrameForChild(), wxPD_APP_MODAL);
+ rIF.inverseFourier (rIF);
+ rIF.labelAdd ("Inverse Fourier Image");
+ m_bMinSpecified = false;
+ m_bMaxSpecified = false;
+ if (theApp->getAskDeleteNewDocs())
+ GetDocument()->Modify (true);
+ GetDocument()->UpdateAllViews (this);
+ GetDocument()->Activate();
+}
+
+void
+ImageFileView::OnShuffleNaturalToFourierOrder (wxCommandEvent& event)
+{
+ ImageFile& rIF = GetDocument()->getImageFile();
+ Fourier::shuffleNaturalToFourierOrder (rIF);
+ rIF.labelAdd ("Shuffle Natural To Fourier Order");
+ m_bMinSpecified = false;
+ m_bMaxSpecified = false;
+ if (theApp->getAskDeleteNewDocs())
+ GetDocument()->Modify (true);
+ GetDocument()->UpdateAllViews (this);
+ GetDocument()->Activate();
+}
+
+void
+ImageFileView::OnShuffleFourierToNaturalOrder (wxCommandEvent& event)
+{
+ ImageFile& rIF = GetDocument()->getImageFile();
+ Fourier::shuffleFourierToNaturalOrder (rIF);
+ rIF.labelAdd ("Shuffle Fourier To Natural Order");
+ m_bMinSpecified = false;
+ m_bMaxSpecified = false;
+ if (theApp->getAskDeleteNewDocs())
+ GetDocument()->Modify (true);
+ GetDocument()->UpdateAllViews (this);
+ GetDocument()->Activate();
+}
+
+void
+ImageFileView::OnMagnitude (wxCommandEvent& event)
+{
+ ImageFile& rIF = GetDocument()->getImageFile();
+ rIF.magnitude (rIF);
+ rIF.labelAdd ("Magnitude");
+ m_bMinSpecified = false;
+ m_bMaxSpecified = false;
+ if (theApp->getAskDeleteNewDocs())
+ GetDocument()->Modify (true);
+ GetDocument()->UpdateAllViews (this);
+ GetDocument()->Activate();
+}
+
+void
+ImageFileView::OnPhase (wxCommandEvent& event)
+{
+ ImageFile& rIF = GetDocument()->getImageFile();
+ if (rIF.isComplex()) {
+ rIF.phase (rIF);
+ rIF.labelAdd ("Phase of complex-image");
+ m_bMinSpecified = false;
+ m_bMaxSpecified = false;
+ if (theApp->getAskDeleteNewDocs())
+ GetDocument()->Modify (true);
+ GetDocument()->UpdateAllViews (this);
+ }
+ GetDocument()->Activate();
+}
+
+void
+ImageFileView::OnReal (wxCommandEvent& event)
+{
+ ImageFile& rIF = GetDocument()->getImageFile();
+ if (rIF.isComplex()) {
+ rIF.real (rIF);
+ rIF.labelAdd ("Real component of complex-image");
+ m_bMinSpecified = false;
+ m_bMaxSpecified = false;
+ if (theApp->getAskDeleteNewDocs())
+ GetDocument()->Modify (true);
+ GetDocument()->UpdateAllViews (this);
+ }
+ GetDocument()->Activate();
+}
+
+void
+ImageFileView::OnImaginary (wxCommandEvent& event)
+{
+ ImageFile& rIF = GetDocument()->getImageFile();
+ if (rIF.isComplex()) {
+ rIF.imaginary (rIF);
+ rIF.labelAdd ("Imaginary component of complex-image");
+ m_bMinSpecified = false;
+ m_bMaxSpecified = false;
+ if (theApp->getAskDeleteNewDocs())
+ GetDocument()->Modify (true);
+ GetDocument()->UpdateAllViews (this);
+ }
+ GetDocument()->Activate();