From 5239fa6cffba3b6cf8a64a395907437a27febab4 Mon Sep 17 00:00:00 2001 From: Hazen Babcock Date: Sat, 12 Oct 2024 15:48:50 -0400 Subject: [PATCH 1/3] Add keyword 'g_Keyword_Metadata_Exposure' to replace 'g_Keyword_Meatdata_Expsoure'. Add comment to indicate that 'g_Keyword_Meatdata_Exposure' is deprecated. --- DeviceAdapters/Aravis/AravisCamera.cpp | 1 + DeviceAdapters/Basler/BaslerPylonCamera.cpp | 1 + DeviceAdapters/DahengGalaxy/ClassGalaxy.cpp | 3 ++- DeviceAdapters/Ximea/XIMEACamera.cpp | 3 ++- MMDevice/MMDeviceConstants.h | 3 ++- 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/DeviceAdapters/Aravis/AravisCamera.cpp b/DeviceAdapters/Aravis/AravisCamera.cpp index 7c740b3d3..dd90a80c3 100644 --- a/DeviceAdapters/Aravis/AravisCamera.cpp +++ b/DeviceAdapters/Aravis/AravisCamera.cpp @@ -172,6 +172,7 @@ void AravisCamera::AcquisitionCallback(ArvStreamCallbackType type, ArvBuffer *cb md.put(MM::g_Keyword_Metadata_ROI_X, CDeviceUtils::ConvertToString((long)img_buffer_width)); md.put(MM::g_Keyword_Metadata_ROI_Y, CDeviceUtils::ConvertToString((long)img_buffer_height)); md.put(MM::g_Keyword_Metadata_ImageNumber, CDeviceUtils::ConvertToString(counter)); + md.put(MM::g_Keyword_Metadata_Exposure, exposure_time); md.put(MM::g_Keyword_Meatdata_Exposure, exposure_time); md.put(MM::g_Keyword_PixelType, pixel_type); diff --git a/DeviceAdapters/Basler/BaslerPylonCamera.cpp b/DeviceAdapters/Basler/BaslerPylonCamera.cpp index c6403320e..4164acf33 100644 --- a/DeviceAdapters/Basler/BaslerPylonCamera.cpp +++ b/DeviceAdapters/Basler/BaslerPylonCamera.cpp @@ -2131,6 +2131,7 @@ void CircularBufferInserter::OnImageGrabbed(CInstantCamera& /* camera */, const md.put(MM::g_Keyword_Metadata_ROI_X, CDeviceUtils::ConvertToString((long)ptrGrabResult->GetWidth())); md.put(MM::g_Keyword_Metadata_ROI_Y, CDeviceUtils::ConvertToString((long)ptrGrabResult->GetHeight())); md.put(MM::g_Keyword_Metadata_ImageNumber, CDeviceUtils::ConvertToString((long)ptrGrabResult->GetImageNumber())); + md.put(MM::g_Keyword_Metadata_Exposure, dev_->GetExposure()); md.put(MM::g_Keyword_Meatdata_Exposure, dev_->GetExposure()); // Image grabbed successfully? if (ptrGrabResult->GrabSucceeded()) diff --git a/DeviceAdapters/DahengGalaxy/ClassGalaxy.cpp b/DeviceAdapters/DahengGalaxy/ClassGalaxy.cpp index 55414a544..70c43c735 100644 --- a/DeviceAdapters/DahengGalaxy/ClassGalaxy.cpp +++ b/DeviceAdapters/DahengGalaxy/ClassGalaxy.cpp @@ -1863,6 +1863,7 @@ void CircularBufferInserter::DoOnImageCaptured(CImageDataPointer& objImageDataPo md.put(MM::g_Keyword_Metadata_ROI_X, CDeviceUtils::ConvertToString((long)objImageDataPointer->GetWidth())); md.put(MM::g_Keyword_Metadata_ROI_Y, CDeviceUtils::ConvertToString((long)objImageDataPointer->GetHeight())); md.put(MM::g_Keyword_Metadata_ImageNumber, CDeviceUtils::ConvertToString((long)objImageDataPointer->GetFrameID())); + md.put(MM::g_Keyword_Metadata_Exposure, dev_->GetExposure()); md.put(MM::g_Keyword_Meatdata_Exposure, dev_->GetExposure()); // Image grabbed successfully ? if (objImageDataPointer->GetStatus()== GX_FRAME_STATUS_SUCCESS) @@ -2160,4 +2161,4 @@ void ClassGalaxy::SaveRaw(CImageDataPointer& objCImageDataPointer, const std::st ::WriteFile(hFile, pbuffer, dwImageSize, &dwBytesRead, NULL); CloseHandle(hFile); } -} \ No newline at end of file +} diff --git a/DeviceAdapters/Ximea/XIMEACamera.cpp b/DeviceAdapters/Ximea/XIMEACamera.cpp index 1c9a3e003..9c254d2e8 100644 --- a/DeviceAdapters/Ximea/XIMEACamera.cpp +++ b/DeviceAdapters/Ximea/XIMEACamera.cpp @@ -798,6 +798,7 @@ int XimeaCamera::InsertImage() // Important: metadata about the image are generated here: Metadata md; double exp_time = (double)image.GetExpTime() / 1000; + md.put(MM::g_Keyword_Metadata_Exposure, CDeviceUtils::ConvertToString(exp_time)); md.put(MM::g_Keyword_Meatdata_Exposure, CDeviceUtils::ConvertToString(exp_time)); md.put(MM::g_Keyword_Elapsed_Time_ms, CDeviceUtils::ConvertToString((timeStamp - sequenceStartTime_).getMsec())); md.put(MM::g_Keyword_Metadata_ImageNumber, CDeviceUtils::ConvertToString(imageCounter_)); @@ -1742,4 +1743,4 @@ int XiSequenceThread::svc(void) throw() return ret; } -/////////////////////////////////////////////////////////////////////////////// \ No newline at end of file +/////////////////////////////////////////////////////////////////////////////// diff --git a/MMDevice/MMDeviceConstants.h b/MMDevice/MMDeviceConstants.h index 62aa53ce6..e67217a68 100644 --- a/MMDevice/MMDeviceConstants.h +++ b/MMDevice/MMDeviceConstants.h @@ -144,7 +144,8 @@ namespace MM { // image annotations const char* const g_Keyword_Metadata_CameraLabel = "Camera"; - const char* const g_Keyword_Meatdata_Exposure = "Exposure-ms"; + const char* const g_Keyword_Metadata_Exposure = "Exposure-ms"; + const char* const g_Keyword_Meatdata_Exposure = "Exposure-ms"; // Deprecated, use g_Keyword_Metadata_Exposure. const char* const g_Keyword_Metadata_Score = "Score"; const char* const g_Keyword_Metadata_ImageNumber = "ImageNumber"; // Removed: g_Keyword_Metadata_StartTime = "StartTime-ms"; From c9242041d2edef823cb9d76f397128b2bbf757fe Mon Sep 17 00:00:00 2001 From: "Mark A. Tsuchida" Date: Wed, 18 Dec 2024 15:47:33 -0600 Subject: [PATCH 2/3] Use compiler deprecation for 'Meatdata' Also move the definition of MM_DEPRECATED to where we need it for this. --- MMDevice/MMDevice.h | 14 -------------- MMDevice/MMDeviceConstants.h | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/MMDevice/MMDevice.h b/MMDevice/MMDevice.h index cddfebd00..c674ac0b7 100644 --- a/MMDevice/MMDevice.h +++ b/MMDevice/MMDevice.h @@ -52,20 +52,6 @@ #include #include - -#ifdef MMDEVICE_CLIENT_BUILD -// Hide deprecation warnings when building MMCore -# define MM_DEPRECATED(prototype) prototype -#else -# ifdef _MSC_VER -# define MM_DEPRECATED(prototype) __declspec(deprecated) prototype -# elif defined(__GNUC__) -# define MM_DEPRECATED(prototype) prototype __attribute__((deprecated)) -# else -# define MM_DEPRECATED(prototype) prototype -# endif -#endif - // To be removed once the deprecated Get/SetModuleHandle() is removed: #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN diff --git a/MMDevice/MMDeviceConstants.h b/MMDevice/MMDeviceConstants.h index e67217a68..ddca4f97a 100644 --- a/MMDevice/MMDeviceConstants.h +++ b/MMDevice/MMDeviceConstants.h @@ -21,6 +21,19 @@ #pragma once +#ifdef MMDEVICE_CLIENT_BUILD +// Hide deprecation warnings when building MMCore +# define MM_DEPRECATED(prototype) prototype +#else +# ifdef _MSC_VER +# define MM_DEPRECATED(prototype) __declspec(deprecated) prototype +# elif defined(__GNUC__) +# define MM_DEPRECATED(prototype) prototype __attribute__((deprecated)) +# else +# define MM_DEPRECATED(prototype) prototype +# endif +#endif + /////////////////////////////////////////////////////////////////////////////// // Global error codes // @@ -145,7 +158,7 @@ namespace MM { // image annotations const char* const g_Keyword_Metadata_CameraLabel = "Camera"; const char* const g_Keyword_Metadata_Exposure = "Exposure-ms"; - const char* const g_Keyword_Meatdata_Exposure = "Exposure-ms"; // Deprecated, use g_Keyword_Metadata_Exposure. + MM_DEPRECATED(const char* const g_Keyword_Meatdata_Exposure) = "Exposure-ms"; // Typo const char* const g_Keyword_Metadata_Score = "Score"; const char* const g_Keyword_Metadata_ImageNumber = "ImageNumber"; // Removed: g_Keyword_Metadata_StartTime = "StartTime-ms"; From b8f089d5593c14b7435704efcdc9e1b2557ee68b Mon Sep 17 00:00:00 2001 From: "Mark A. Tsuchida" Date: Wed, 18 Dec 2024 16:02:13 -0600 Subject: [PATCH 3/3] Remove redundant metadata setting --- DeviceAdapters/Aravis/AravisCamera.cpp | 1 - DeviceAdapters/Basler/BaslerPylonCamera.cpp | 1 - DeviceAdapters/DahengGalaxy/ClassGalaxy.cpp | 1 - DeviceAdapters/Ximea/XIMEACamera.cpp | 1 - 4 files changed, 4 deletions(-) diff --git a/DeviceAdapters/Aravis/AravisCamera.cpp b/DeviceAdapters/Aravis/AravisCamera.cpp index dd90a80c3..ad492ba33 100644 --- a/DeviceAdapters/Aravis/AravisCamera.cpp +++ b/DeviceAdapters/Aravis/AravisCamera.cpp @@ -173,7 +173,6 @@ void AravisCamera::AcquisitionCallback(ArvStreamCallbackType type, ArvBuffer *cb md.put(MM::g_Keyword_Metadata_ROI_Y, CDeviceUtils::ConvertToString((long)img_buffer_height)); md.put(MM::g_Keyword_Metadata_ImageNumber, CDeviceUtils::ConvertToString(counter)); md.put(MM::g_Keyword_Metadata_Exposure, exposure_time); - md.put(MM::g_Keyword_Meatdata_Exposure, exposure_time); md.put(MM::g_Keyword_PixelType, pixel_type); // Pass data to MM. diff --git a/DeviceAdapters/Basler/BaslerPylonCamera.cpp b/DeviceAdapters/Basler/BaslerPylonCamera.cpp index 4164acf33..c0b71a755 100644 --- a/DeviceAdapters/Basler/BaslerPylonCamera.cpp +++ b/DeviceAdapters/Basler/BaslerPylonCamera.cpp @@ -2132,7 +2132,6 @@ void CircularBufferInserter::OnImageGrabbed(CInstantCamera& /* camera */, const md.put(MM::g_Keyword_Metadata_ROI_Y, CDeviceUtils::ConvertToString((long)ptrGrabResult->GetHeight())); md.put(MM::g_Keyword_Metadata_ImageNumber, CDeviceUtils::ConvertToString((long)ptrGrabResult->GetImageNumber())); md.put(MM::g_Keyword_Metadata_Exposure, dev_->GetExposure()); - md.put(MM::g_Keyword_Meatdata_Exposure, dev_->GetExposure()); // Image grabbed successfully? if (ptrGrabResult->GrabSucceeded()) { diff --git a/DeviceAdapters/DahengGalaxy/ClassGalaxy.cpp b/DeviceAdapters/DahengGalaxy/ClassGalaxy.cpp index 70c43c735..a06cfd0bf 100644 --- a/DeviceAdapters/DahengGalaxy/ClassGalaxy.cpp +++ b/DeviceAdapters/DahengGalaxy/ClassGalaxy.cpp @@ -1864,7 +1864,6 @@ void CircularBufferInserter::DoOnImageCaptured(CImageDataPointer& objImageDataPo md.put(MM::g_Keyword_Metadata_ROI_Y, CDeviceUtils::ConvertToString((long)objImageDataPointer->GetHeight())); md.put(MM::g_Keyword_Metadata_ImageNumber, CDeviceUtils::ConvertToString((long)objImageDataPointer->GetFrameID())); md.put(MM::g_Keyword_Metadata_Exposure, dev_->GetExposure()); - md.put(MM::g_Keyword_Meatdata_Exposure, dev_->GetExposure()); // Image grabbed successfully ? if (objImageDataPointer->GetStatus()== GX_FRAME_STATUS_SUCCESS) { diff --git a/DeviceAdapters/Ximea/XIMEACamera.cpp b/DeviceAdapters/Ximea/XIMEACamera.cpp index 9c254d2e8..d4410ef0a 100644 --- a/DeviceAdapters/Ximea/XIMEACamera.cpp +++ b/DeviceAdapters/Ximea/XIMEACamera.cpp @@ -799,7 +799,6 @@ int XimeaCamera::InsertImage() Metadata md; double exp_time = (double)image.GetExpTime() / 1000; md.put(MM::g_Keyword_Metadata_Exposure, CDeviceUtils::ConvertToString(exp_time)); - md.put(MM::g_Keyword_Meatdata_Exposure, CDeviceUtils::ConvertToString(exp_time)); md.put(MM::g_Keyword_Elapsed_Time_ms, CDeviceUtils::ConvertToString((timeStamp - sequenceStartTime_).getMsec())); md.put(MM::g_Keyword_Metadata_ImageNumber, CDeviceUtils::ConvertToString(imageCounter_)); md.put(MM::g_Keyword_Metadata_ROI_X, CDeviceUtils::ConvertToString((long)roiX_));