Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add onImageSnapped, onSequenceAcquisitionStarted, onSequenceAcquisitionStopped events #538

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions MMCore/MMCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2543,6 +2543,12 @@ void CMMCore::snapImage() throw (CMMError)
}
waitForDevice(shutter);
}

if (externalCallback_)
{
std::string cameraLabel = camera->GetLabel();
externalCallback_->onImageSnapped(cameraLabel.c_str());
}
}catch( CMMError& e){
throw e;
}
Expand Down Expand Up @@ -2856,6 +2862,11 @@ void CMMCore::startSequenceAcquisition(long numImages, double intervalMs, bool s
throw CMMError(getCoreErrorText(MMERR_CameraNotAvailable).c_str(), MMERR_CameraNotAvailable);
}
LOG_DEBUG(coreLogger_) << "Did start sequence acquisition from default camera";
if (externalCallback_)
{
std::string cameraLabel = camera->GetLabel();
externalCallback_->onSequenceAcquisitionStarted(cameraLabel.c_str(), numImages, intervalMs, stopOnOverflow);
}
}

/**
Expand Down Expand Up @@ -2889,6 +2900,10 @@ void CMMCore::startSequenceAcquisition(const char* label, long numImages, double

LOG_DEBUG(coreLogger_) <<
"Did start sequence acquisition from camera " << label;
if (externalCallback_)
{
externalCallback_->onSequenceAcquisitionStarted(label, numImages, intervalMs, stopOnOverflow);
}
}

/**
Expand Down Expand Up @@ -2994,6 +3009,11 @@ void CMMCore::startContinuousSequenceAcquisition(double intervalMs) throw (CMMEr
throw CMMError(getCoreErrorText(MMERR_CameraNotAvailable).c_str(), MMERR_CameraNotAvailable);
}
LOG_DEBUG(coreLogger_) << "Did start continuous sequence acquisition from current camera";
if (externalCallback_)
{
std::string cameraLabel = camera->GetLabel();
externalCallback_->onSequenceAcquisitionStarted(cameraLabel.c_str(), -1, intervalMs, false);
}
}

/**
Expand All @@ -3020,6 +3040,11 @@ void CMMCore::stopSequenceAcquisition() throw (CMMError)
}

LOG_DEBUG(coreLogger_) << "Did stop sequence acquisition from current camera";
if (externalCallback_)
{
std::string cameraLabel = camera->GetLabel();
externalCallback_->onSequenceAcquisitionStopped(cameraLabel.c_str());
}
}

/**
Expand Down
15 changes: 15 additions & 0 deletions MMCore/MMEventCallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,19 @@ class MMEventCallback
std::cout << "onSLMExposureChanged()" << name << " " << newExposure << '\n';
}

virtual void onImageSnapped(const char* name)
{
std::cout << "onImageSnapped()" << name << '\n';
}

virtual void onSequenceAcquisitionStarted(const char* name, long numImages, double intervalMs, bool stopOnOverflow)
{
std::cout << "onSequenceAcquisitionStarted()" << name << " " << numImages << " " << intervalMs << " " << stopOnOverflow << '\n';
}

virtual void onSequenceAcquisitionStopped(const char* name)
{
std::cout << "onSequenceAcquisitionEnded()" << name << '\n';
}

};
Loading