Skip to content
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
1 change: 0 additions & 1 deletion DeviceAdapters/CNCMicroscope/RAMPSStage/XYStage.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ class RAMPSXYStage : public CXYStageBase<RAMPSXYStage>

int IsXYStageSequenceable(bool& isSequenceable) const;


// action interface
// ----------------
int OnPosition(MM::PropertyBase* pProp, MM::ActionType eAct);
Expand Down
3 changes: 3 additions & 0 deletions DeviceAdapters/Cephla/Squid.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ class SquidXYStage : public CXYStageBase<SquidXYStage>

int IsXYStageSequenceable(bool& isSequenceable) const { isSequenceable = false; return DEVICE_OK; }

int UsesOnXYStagePositionChanged(bool& result) const { result = true; return DEVICE_OK; }

// action interface
// ----------------
Expand Down Expand Up @@ -354,6 +355,8 @@ class SquidZStage : public CStageBase<SquidZStage>
}
bool IsContinuousFocusDrive() const { return false; };

int UsesOnStagePositionChanged(bool& result) const { result = true; return DEVICE_OK; }

int OnAcceleration(MM::PropertyBase* pProp, MM::ActionType eAct);
int OnMaxVelocity(MM::PropertyBase* pProp, MM::ActionType eAct);

Expand Down
1 change: 1 addition & 0 deletions DeviceAdapters/ChuoSeiki_MD5000/ChuoSeiki_MD_XYZ.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class MD_SingleStage:
// Checking device functions
int IsStageSequenceable(bool& isSequenceable) const {isSequenceable = false; return DEVICE_OK;}
bool IsContinuousFocusDrive() const {return DEVICE_OK;}
int UsesOnStagePositionChanged(bool& result) const { result = true; return DEVICE_OK; }
bool SupportsDeviceDetection(void);
MM::DeviceDetectionStatus DetectDevice(void);

Expand Down
3 changes: 3 additions & 0 deletions DeviceAdapters/DemoCamera/DemoCamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,8 @@ class CDemoStage : public CStageBase<CDemoStage>

bool IsContinuousFocusDrive() const {return false;}

int UsesOnStagePositionChanged(bool& result) const { result = true; return DEVICE_OK; }

// action interface
// ----------------
int OnPosition(MM::PropertyBase* pProp, MM::ActionType eAct);
Expand Down Expand Up @@ -636,6 +638,7 @@ class CDemoXYStage : public CXYStageBase<CDemoXYStage>

int IsXYStageSequenceable(bool& isSequenceable) const {isSequenceable = false; return DEVICE_OK;}

int UsesOnXYStagePositionChanged(bool& result) const { result = true; return DEVICE_OK; }

// action interface
// ----------------
Expand Down
2 changes: 2 additions & 0 deletions DeviceAdapters/ESP32/esp32.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ class CESP32XYStage : public CXYStageBase<CESP32XYStage>

int IsXYStageSequenceable(bool& isSequenceable) const { isSequenceable = false; return DEVICE_OK; }

int UsesOnXYStagePositionChanged(bool& result) const { result = true; return DEVICE_OK; }

int OnXStageMinPos(MM::PropertyBase* pProp, MM::ActionType eAct);
int OnXStageMaxPos(MM::PropertyBase* pProp, MM::ActionType eAct);
int OnYStageMinPos(MM::PropertyBase* pProp, MM::ActionType eAct);
Expand Down
1 change: 1 addition & 0 deletions DeviceAdapters/OpenFlexure/OpenFlexure.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ class ZStage : public CStageBase<ZStage>
int GetLimits(double& lower, double& upper) { return DEVICE_UNSUPPORTED_COMMAND;} // nah
int IsStageSequenceable(bool& isSequenceable) const { isSequenceable = false; return DEVICE_OK;}
bool IsContinuousFocusDrive() const { return false; }

bool Busy() { return false; }

// Helper functions
Expand Down
1 change: 1 addition & 0 deletions DeviceAdapters/PriorPureFocus/PureFocus.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class PureFocusOffset : public CStageBase<PureFocusOffset> {
bool IsContinuousFocusDrive() const {
return false;
};

void CallbackPositionSteps(long steps);
void RemoveHub() { pHub_ = 0; };

Expand Down
5 changes: 5 additions & 0 deletions DeviceAdapters/PyDevice/PyStage.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ class CPyXYStage : public PyXYStageClass {
return DEVICE_UNSUPPORTED_COMMAND;
}

int UsesOnXYStagePositionChanged(bool& result) const override {
result = false;
return DEVICE_OK;
}

protected:
double origin_x_ = 0.0;
double origin_y_ = 0.0;
Expand Down
1 change: 0 additions & 1 deletion DeviceAdapters/StandaStage/StandaStage.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ class CStandaXYStage : public CXYStageBase<CStandaXYStage>

int IsXYStageSequenceable(bool& isSequenceable) const {isSequenceable = false; return DEVICE_OK;}


// action interface
// ----------------

Expand Down
1 change: 0 additions & 1 deletion DeviceAdapters/WieneckeSinske/ZPiezoCanDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class ZPiezoCANDevice : public CStageBase<ZPiezoCANDevice>
int SetOrigin();
int IsStageSequenceable(bool& isSequenceable) const {isSequenceable = false; return DEVICE_OK;}


// action interface
// ----------------
int OnPort(MM::PropertyBase* pProp, MM::ActionType eAct);
Expand Down
1 change: 0 additions & 1 deletion DeviceAdapters/WieneckeSinske/ZPiezoWSDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class ZPiezoWSDevice : public CStageBase<ZPiezoWSDevice>
int SetOrigin();
int IsStageSequenceable(bool& isSequenceable) const {isSequenceable = false; return DEVICE_OK;}


// action interface
// ----------------
int OnPort(MM::PropertyBase* pProp, MM::ActionType eAct);
Expand Down
4 changes: 4 additions & 0 deletions DeviceAdapters/ZeissCAN29/ZeissCAN29.h
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,8 @@ class Axis : public CStageBase<Axis>, public ZeissAxis
int IsStageSequenceable(bool& isSequenceable) const {isSequenceable = false; return DEVICE_OK;}
bool IsContinuousFocusDrive() const {return false;}

int UsesOnStagePositionChanged(bool& result) const { result = true; return DEVICE_OK; }

// action interface
// ----------------
int OnPosition(MM::PropertyBase* pProp, MM::ActionType eAct);
Expand Down Expand Up @@ -890,6 +892,8 @@ class XYStage : public CXYStageBase<XYStage>, public ZeissAxis
double GetStepSizeYUm() {return stepSize_um_;}
int IsXYStageSequenceable(bool& isSequenceable) const {isSequenceable = false; return DEVICE_OK;}

int UsesOnXYStagePositionChanged(bool& result) const { result = true; return DEVICE_OK; }

// action interface
// ----------------
int OnMoveMode(MM::PropertyBase* pProp, MM::ActionType eAct);
Expand Down
12 changes: 3 additions & 9 deletions MMCore/CircularBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,18 +192,12 @@ static std::string FormatLocalTime(std::chrono::time_point<std::chrono::system_c
return buf;
}

/**
* Inserts a single image in the buffer.
*/
bool CircularBuffer::InsertImage(const unsigned char* pixArray, unsigned int width, unsigned int height, unsigned int byteDepth, const Metadata* pMd) MMCORE_LEGACY_THROW(CMMError)
{
return InsertImage(pixArray, width, height, byteDepth, 1, pMd);
}

/**
* Inserts a single image, possibly with multiple components, in the buffer.
*/
bool CircularBuffer::InsertImage(const unsigned char* pixArray, unsigned int width, unsigned int height, unsigned int byteDepth, unsigned int nComponents, const Metadata* pMd) MMCORE_LEGACY_THROW(CMMError)
bool CircularBuffer::InsertImage(const unsigned char* pixArray,
unsigned int width, unsigned int height, unsigned int byteDepth, unsigned int nComponents,
const Metadata* pMd) MMCORE_LEGACY_THROW(CMMError)
{
MMThreadGuard insertGuard(g_insertLock);

Expand Down
5 changes: 3 additions & 2 deletions MMCore/CircularBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ class CircularBuffer
unsigned int Height() const {MMThreadGuard guard(g_bufferLock); return height_;}
unsigned int Depth() const {MMThreadGuard guard(g_bufferLock); return pixDepth_;}

bool InsertImage(const unsigned char* pixArray, unsigned int width, unsigned int height, unsigned int byteDepth, const Metadata* pMd) MMCORE_LEGACY_THROW(CMMError);
bool InsertImage(const unsigned char* pixArray, unsigned int width, unsigned int height, unsigned int byteDepth, unsigned int nComponents, const Metadata* pMd) MMCORE_LEGACY_THROW(CMMError);
bool InsertImage(const unsigned char* pixArray,
unsigned int width, unsigned int height, unsigned int byteDepth, unsigned int nComponents,
const Metadata* pMd) MMCORE_LEGACY_THROW(CMMError);
const unsigned char* GetTopImage() const;
const unsigned char* GetNextImage();
const ImgBuffer* GetTopImageBuffer(unsigned channel) const;
Expand Down
43 changes: 9 additions & 34 deletions MMCore/CoreCallback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,38 +218,16 @@ CoreCallback::AddCameraMetadata(const MM::Device* caller, const Metadata* pMd)
return newMD;
}

int CoreCallback::InsertImage(const MM::Device* caller, const unsigned char* buf, unsigned width, unsigned height, unsigned byteDepth, const char* serializedMetadata, const bool doProcess)
int CoreCallback::InsertImage(const MM::Device* caller, const unsigned char* buf,
unsigned width, unsigned height, unsigned bytesPerPixel,
const char* serializedMetadata)
{
Metadata origMd;
if (serializedMetadata)
{
origMd.Restore(serializedMetadata);
}

try
{
Metadata md = AddCameraMetadata(caller, &origMd);

if(doProcess)
{
MM::ImageProcessor* ip = GetImageProcessor(caller);
if( NULL != ip)
{
ip->Process(const_cast<unsigned char*>(buf), width, height, byteDepth);
}
}
if (core_->cbuf_->InsertImage(buf, width, height, byteDepth, &md))
return DEVICE_OK;
else
return DEVICE_BUFFER_OVERFLOW;
}
catch (CMMError& /*e*/)
{
return DEVICE_INCOMPATIBLE_IMAGE;
}
return InsertImage(caller, buf, width, height, bytesPerPixel, 1, serializedMetadata);
}

int CoreCallback::InsertImage(const MM::Device* caller, const unsigned char* buf, unsigned width, unsigned height, unsigned byteDepth, unsigned nComponents, const char* serializedMetadata, const bool doProcess)
int CoreCallback::InsertImage(const MM::Device* caller, const unsigned char* buf,
unsigned width, unsigned height, unsigned bytesPerPixel, unsigned nComponents,
const char* serializedMetadata)
{
Metadata origMd;
if (serializedMetadata)
Expand All @@ -261,15 +239,12 @@ int CoreCallback::InsertImage(const MM::Device* caller, const unsigned char* buf
{
Metadata md = AddCameraMetadata(caller, &origMd);

if(doProcess)
{
MM::ImageProcessor* ip = GetImageProcessor(caller);
if( NULL != ip)
{
ip->Process(const_cast<unsigned char*>(buf), width, height, byteDepth);
ip->Process(const_cast<unsigned char*>(buf), width, height, bytesPerPixel);
}
}
if (core_->cbuf_->InsertImage(buf, width, height, byteDepth, nComponents, &md))
if (core_->cbuf_->InsertImage(buf, width, height, bytesPerPixel, nComponents, &md))
return DEVICE_OK;
else
return DEVICE_BUFFER_OVERFLOW;
Expand Down
8 changes: 6 additions & 2 deletions MMCore/CoreCallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,12 @@ class CoreCallback : public MM::Core
void Sleep(const MM::Device* caller, double intervalMs);

// continuous acquisition support
int InsertImage(const MM::Device* caller, const unsigned char* buf, unsigned width, unsigned height, unsigned byteDepth, const char* serializedMetadata, const bool doProcess = true);
int InsertImage(const MM::Device* caller, const unsigned char* buf, unsigned width, unsigned height, unsigned byteDepth, unsigned nComponents, const char* serializedMetadata, const bool doProcess = true);
int InsertImage(const MM::Device* caller, const unsigned char* buf,
unsigned width, unsigned height, unsigned bytesPerPixel,
const char* serializedMetadata);
int InsertImage(const MM::Device* caller, const unsigned char* buf,
unsigned width, unsigned height, unsigned bytesPerPixel, unsigned nComponents,
const char* serializedMetadata);
bool InitializeImageBuffer(unsigned channels, unsigned slices, unsigned int w, unsigned int h, unsigned int pixDepth);

int AcqFinished(const MM::Device* caller, int statusCode);
Expand Down
1 change: 1 addition & 0 deletions MMCore/Devices/StageInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ StageInstance::SetFocusDirection(MM::FocusDirection direction)
focusDirectionHasBeenSet_ = true;
}

int StageInstance::UsesOnStagePositionChanged(bool& result) const { RequireInitialized(__func__); return GetImpl()->UsesOnStagePositionChanged(result); }
int StageInstance::IsStageSequenceable(bool& isSequenceable) const { RequireInitialized(__func__); return GetImpl()->IsStageSequenceable(isSequenceable); }
int StageInstance::IsStageLinearSequenceable(bool& isSequenceable) const { RequireInitialized(__func__); return GetImpl()->IsStageLinearSequenceable(isSequenceable); }
bool StageInstance::IsContinuousFocusDrive() const { RequireInitialized(__func__); return GetImpl()->IsContinuousFocusDrive(); }
Expand Down
1 change: 1 addition & 0 deletions MMCore/Devices/StageInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class StageInstance : public DeviceInstanceBase<MM::Stage>
int GetLimits(double& lower, double& upper);
MM::FocusDirection GetFocusDirection();
void SetFocusDirection(MM::FocusDirection direction);
int UsesOnStagePositionChanged(bool& result) const;
int IsStageSequenceable(bool& isSequenceable) const;
int IsStageLinearSequenceable(bool& isSequenceable) const;
bool IsContinuousFocusDrive() const;
Expand Down
1 change: 1 addition & 0 deletions MMCore/Devices/XYStageInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ int XYStageInstance::SetYOrigin() { RequireInitialized(__func__); return GetImpl
int XYStageInstance::GetStepLimits(long& xMin, long& xMax, long& yMin, long& yMax) { RequireInitialized(__func__); return GetImpl()->GetStepLimits(xMin, xMax, yMin, yMax); }
double XYStageInstance::GetStepSizeXUm() { RequireInitialized(__func__); return GetImpl()->GetStepSizeXUm(); }
double XYStageInstance::GetStepSizeYUm() { RequireInitialized(__func__); return GetImpl()->GetStepSizeYUm(); }
int XYStageInstance::UsesOnXYStagePositionChanged(bool& result) const { RequireInitialized(__func__); return GetImpl()->UsesOnXYStagePositionChanged(result); }
int XYStageInstance::IsXYStageSequenceable(bool& isSequenceable) const { RequireInitialized(__func__); return GetImpl()->IsXYStageSequenceable(isSequenceable); }
int XYStageInstance::GetXYStageSequenceMaxLength(long& nrEvents) const { RequireInitialized(__func__); return GetImpl()->GetXYStageSequenceMaxLength(nrEvents); }
int XYStageInstance::StartXYStageSequence() { RequireInitialized(__func__); return GetImpl()->StartXYStageSequence(); }
Expand Down
1 change: 1 addition & 0 deletions MMCore/Devices/XYStageInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class XYStageInstance : public DeviceInstanceBase<MM::XYStage>
int GetStepLimits(long& xMin, long& xMax, long& yMin, long& yMax);
double GetStepSizeXUm();
double GetStepSizeYUm();
int UsesOnXYStagePositionChanged(bool& result) const;
int IsXYStageSequenceable(bool& isSequenceable) const;
int GetXYStageSequenceMaxLength(long& nrEvents) const;
int StartXYStageSequence();
Expand Down
40 changes: 39 additions & 1 deletion MMCore/MMCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ namespace mmi = mmcore::internal;
* (Keep the 3 numbers on one line to make it easier to look at diffs when
* merging/rebasing.)
*/
const int MMCore_versionMajor = 11, MMCore_versionMinor = 13, MMCore_versionPatch = 0;
const int MMCore_versionMajor = 11, MMCore_versionMinor = 14, MMCore_versionPatch = 0;


///////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -2265,6 +2265,24 @@ void CMMCore::loadExposureSequence(const char* cameraLabel, std::vector<double>
throw CMMError(getDeviceErrorText(ret, pCamera));
}

/**
* Queries whether this stage uses callbacks to signal position changes
* When false, use polling to stay updated about the positionf of the stage
*/
bool CMMCore::isStageUsingCallbacks(const char* label) MMCORE_LEGACY_THROW(CMMError)
{
std::shared_ptr<mmi::StageInstance> pStage =
deviceManager_->GetDeviceOfType<mmi::StageInstance>(label);

mmi::DeviceModuleLockGuard guard(pStage);

bool result;
int ret = pStage->UsesOnStagePositionChanged(result);
if (ret != DEVICE_OK)
throw CMMError(getDeviceErrorText(ret, pStage));
return result;
}


/**
* Queries stage if it can be used in a sequence
Expand Down Expand Up @@ -2417,6 +2435,26 @@ void CMMCore::setStageLinearSequence(const char* label, double dZ_um, int nSlice
throw CMMError(getDeviceErrorText(ret, pStage));
}


/**
* Queries whether this XYStage uses callbacks to signal position changes
* When false, use polling to stay updated about the positionf of the stage
*/
bool CMMCore::isXYStageUsingCallbacks(const char* label) MMCORE_LEGACY_THROW(CMMError)
{
std::shared_ptr<mmi::XYStageInstance> pStage =
deviceManager_->GetDeviceOfType<mmi::XYStageInstance>(label);

mmi::DeviceModuleLockGuard guard(pStage);

bool result;
int ret = pStage->UsesOnXYStagePositionChanged(result);
if (ret != DEVICE_OK)
throw CMMError(getDeviceErrorText(ret, pStage));

return result;
}

/**
* Queries XY stage if it can be used in a sequence
* @param label the XY stage device label
Expand Down
2 changes: 2 additions & 0 deletions MMCore/MMCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ class CMMCore
void setFocusDirection(const char* stageLabel, int sign);
int getFocusDirection(const char* stageLabel) MMCORE_LEGACY_THROW(CMMError);

bool isStageUsingCallbacks(const char* stageLabel) MMCORE_LEGACY_THROW(CMMError);
bool isStageSequenceable(const char* stageLabel) MMCORE_LEGACY_THROW(CMMError);
bool isStageLinearSequenceable(const char* stageLabel) MMCORE_LEGACY_THROW(CMMError);
void startStageSequence(const char* stageLabel) MMCORE_LEGACY_THROW(CMMError);
Expand Down Expand Up @@ -530,6 +531,7 @@ class CMMCore
double newXUm, double newYUm) MMCORE_LEGACY_THROW(CMMError);
void setAdapterOriginXY(double newXUm, double newYUm) MMCORE_LEGACY_THROW(CMMError);

bool isXYStageUsingCallbacks(const char* xyStageLabel) MMCORE_LEGACY_THROW(CMMError);
bool isXYStageSequenceable(const char* xyStageLabel) MMCORE_LEGACY_THROW(CMMError);
void startXYStageSequence(const char* xyStageLabel) MMCORE_LEGACY_THROW(CMMError);
void stopXYStageSequence(const char* xyStageLabel) MMCORE_LEGACY_THROW(CMMError);
Expand Down
2 changes: 1 addition & 1 deletion MMCoreJ_wrap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.micro-manager.mmcorej</groupId>
<artifactId>MMCoreJ</artifactId>
<version>11.13.0</version>
<version>11.14.0</version>

<name>MMCore Java API</name>
<description>Java bindings for MMCore, the device abstraction layer of Micro-Manager, the microscope control and acquisition platform.</description>
Expand Down
Loading
Loading