imagectn reports to many hits on C-Find and C-Move requests

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Erik
Posts: 3
Joined: Mon, 2005-01-31, 10:33

imagectn reports to many hits on C-Find and C-Move requests

#1 Post by Erik »

When issuing a C-Find or C-Move request on an array of SOP Instance UID:s the imagectn server finds/moves to many DICOM objects.

If you send a C-Find or C-Move request for SOP Instance UID

1.2.840.123 and 1.2.840.444

to a imagectn server with a database containing SOP Instance UID:

1.2.840.1
1.2.840.12
1.2.840.123

You will find/move SOP Instance UIDs:

1.2.840.1
1.2.840.12
1.2.840.123

The problem seems to be in the DB_MatchUID function in the dbfind.cc file:

Code: Select all

    /*** UID List comparaison.
    *** Match is successful if uid is found in model
    **/

    match = OFFalse ; ;
    for (pc = modl ; *pc ; ) {
	if (strncmp (pc, uid, strlen (uid)) == 0) {
	    match = OFTrue ;
	    break ;
	}
	else {
	    pc = strchr (pc, '\\') ;
	    if (pc == NULL)
		break ;
	    else
		pc++ ;
	}
    }
During string comparison the length of the uid in the database is used.
For instance the uid 1.2.840.1 will be compared with the nine first
characters in 1.2.840.123 which is equal to 1.2.840.1.
DB_MatchUID will therefore report true even if the uids is not identical.

A solution to the problem could be:

Code: Select all


    /*** UID List comparaison.
    *** Match is successful if uid is found in model
    **/

    match = OFFalse ; ;
    for (pc = modl ; *pc ; ) {
      /*
       * Calculate the length to next '\'-sign 
       * if no '\'-sign the length of pc is returned
       */
      unsigned int length = strcspn(pc, "\\");

      if ( (lenth == strlen(uid)) && 
	   strncmp (pc, uid, length) == 0) {
	    match = OFTrue ;
	    break ;
	}
	else {
	    pc = strchr (pc, '\\') ;
	    if (pc == NULL)
		break ;
	    else
		pc++ ;
	}
    }
Has this problem been reported before?
Is there an alternative solution to the problem?

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#2 Post by Jörg Riesmeier »

Thank you for your bug report. We will incorporate your suggested fix into the next release.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest