MoveCallback error

290 views
Skip to first unread message

Alberto Sueiro

unread,
Jun 8, 2018, 9:42:28 PM6/8/18
to Orthanc Users
Hi all,

I am developing (trying) a plugin. I need to check all the move request(find too) and, depending the modality that asks, index new studies from other dicom servers.
When I create a move request using dcmtk, i get this:
I:
E: Move Request Failed: 0006:020e DIMSE Failed to send message
E: 0006:031d TCP I/O Error (Connection reset by peer) occurred in routine: writeDataPDU
E: Move SCU Failed: 0006:020e DIMSE Failed to send message
E: 0006:031d TCP I/O Error (Connection reset by peer) occurred in routine: writeDataPDU
I: Aborting Association
F: Association Abort Failed: 0006:031d TCP I/O Error (Broken pipe) occurred in routine: sendAbortTCP

If I don't use the plugin this does not happen
My log file in verbose mode:

W0609 02:38:25.673379 main.cpp:683] Orthanc has started
W0609 02:38:25.673460 ServerScheduler.cpp:135] The server scheduler has started
E0609 02:39:02.907250 RunnableWorkersPool.cpp:74] Exception while handling some runnable object: Error encountered within the plugin engine

The server seems to works fine. .

At the moment my code is this (simply to check if it executes the callback function):
#include "orthanc/OrthancCPlugin.h"
#include <string.h>
#include <stdio.h>
static OrthancPluginContext* context = NULL;
static OrthancPluginGetMoveSize moveSize = NULL;
static OrthancPluginApplyMove applyMove = NULL;
static OrthancPluginFreeMove freeMove = NULL;
 
OrthancPluginMoveCallback * OnMoveCallback (OrthancPluginMoveCallback resourceType, const char *patientId, const char *accessionNumber, const char *studyInstanceUid, const char *seriesInstanceUid, const char *sopInstanceUid, const char *originatorAet, const char *sourceAet, const char *targetAet, uint16_t originatorId)
{
  OrthancPluginLogWarning(context, "Sample plugin is movecallback");
}
ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* c)
{
  context = c;
  OrthancPluginLogWarning(context, "Sample plugin is initializing");

  /* Register the callbacks */
  OrthancPluginRegisterMoveCallback(context, OnMoveCallback, moveSize, applyMove, freeMove);

  /* Declare several properties of the plugin */
  OrthancPluginSetRootUri(context, "/plugin/hello");
  OrthancPluginSetDescription(context, "This is the description of the TFG plugin that can be seen in Orthanc Explorer.");
}

ORTHANC_PLUGINS_API void OrthancPluginFinalize()
{
  OrthancPluginLogWarning(context, "Sample plugin is finalizing");
}

ORTHANC_PLUGINS_API const char* OrthancPluginGetName()
{
  return "sample";
}

ORTHANC_PLUGINS_API const char* OrthancPluginGetVersion()
{
  return "1.0";
}

 I compiled it just like any other plugin:
cmake .. -DSTATIC_BUILD=ON -DCMAKE_BUILD_TYPE=Release
make

and this warning shows:
/home/cli2/Escritorio/Basic/Plugin.c: In function ‘OrthancPluginInitialize’:
/home/cli2/Escritorio/Basic/Plugin.c:23:46: warning: passing argument 2 of ‘OrthancPluginRegisterMoveCallback’ from incompatible pointer type [-Wincompatible-pointer-types]
OrthancPluginRegisterMoveCallback(context, OnMoveCallback, moveSize, applyMove, freeMove);
^
In file included from /home/cli2/Escritorio/Basic/Plugin.c:1:0:
/home/cli2/Escritorio/Basic/orthanc/OrthancCPlugin.h:5501:48: note: expected ‘OrthancPluginMoveCallback {aka void * (*)(enum <anonymous>, const char *, const char *, const char *,
 const char *, const char *, const char *, const char *, const char *, short unsigned int)}’ but argument is of type ‘void * (** (*)(void * (*)(OrthancPluginResourceType, const char *,
 const char *, const char *, const char *, const char *, const char *, const char *, const char *, uint16_t), const char *, const char *, const char *, const char *, const char *,
 const char *, const char *, const char *, uint16_t))(OrthancPluginResourceType, const char *, const char *, const char *, const char *, const char *, const char *, const char *,
 const char *, uint16_t) {aka void * (** (*)(void * (*)(enum <anonymous>, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *,
 short unsigned int), const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, short unsigned int))(enum <anonymous>, const char *,
 const char *, const char *, const char *, const char *, const char *, const char *, const char *, short unsigned int)}’
ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterMoveCallback(

OI don't understand why the error occurs and why this warning, it says my callback is OrthancPluginResourceType but i define it as OrthancPluginMoveCallback* (tried without * too, same result).
Any help will be appreciated

Alberto Sueiro

unread,
Jun 9, 2018, 8:37:28 PM6/9/18
to Orthanc Users
After restart the machine, the warning dissapeared, but the callback still not working.

Sébastien Jodogne

unread,
Jul 26, 2018, 2:22:11 AM7/26/18
to Orthanc Users
Don't use DCMTK.

Check out my answer on the main thread:
Reply all
Reply to author
Forward
0 new messages