Skip to content

Commit

Permalink
add snap and sequence started/stopped events
Browse files Browse the repository at this point in the history
  • Loading branch information
tlambert03 committed Dec 16, 2024
1 parent 870fdb1 commit 310cdb8
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
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';
}

};

0 comments on commit 310cdb8

Please sign in to comment.