Beispiel #1
0
BOOL CRunSlice::PrepareSrc()
{
   CImage* pSrcImage = m_pDocSrc->GetImage();
   IppiRect roi = pSrcImage->GetActualRoi();
   int height = roi.height & ~15;

   if (height == roi.height) return TRUE;
   if (height == 0) {
      if (pSrcImage->Height() >= 16) {
         roi.y -= 16 - roi.height;
         if (roi.y < 0) roi.y = 0;
         height = 16;
      } else {
         DEMO_APP->MessageBox(
             " Height of the image is too small for " + m_Func,
            MB_OK | MB_ICONEXCLAMATION);
         return FALSE;
      }
   }
   roi.height = height;
   if (DEMO_APP->MessageBox(
      (m_pDocSrc->GetImage()->GetRoi() ?
      " ROI will be updated in " :
      " ROI will be created in ") +
      m_pDocSrc->GetTitle(),
      MB_OKCANCEL) != IDOK) return FALSE;
   m_pDocSrc->GetImage()->SetRoi(&roi);
   return TRUE;
}
BOOL CRunDeconvFFT::PrepareSrc()
{
    CImage* kernelImage = m_pDocSrc2->GetImage();
    IppiRect kernelRoi = kernelImage->GetActualRoi();
    BOOL bRoi = kernelImage->IsRoi();
    if (kernelRoi.width != kernelRoi.height) {
        if (kernelRoi.width > kernelRoi.height)
            kernelRoi.width = kernelRoi.height;
        else
            kernelRoi.height = kernelRoi.width;
        CString message =
            (bRoi ? "ROI will be reduced to square in " :
                    "Square ROI will be created in ")
            + m_pDocSrc2->GetTitle() + " image";
        if (DEMO_APP->MessageBox(message, MB_OKCANCEL) == IDOK)
            kernelImage->SetRoi(&kernelRoi);
        else
            return FALSE;
    }
    return TRUE;
}