[Insight-developers] Re: 64 bytes for SOP Instance UID

David Clunie dclunie at dclunie.com
Sat Jan 22 16:19:51 EST 2005


Mathieu Malaterre wrote:

 >     The main problem I had here was not really the cross plateform
 > implementation on different -broken- platforms ...

Actually, I thought your work on getting a MAC address regardless
of what platform one is running on was most excellent, and must
have taken forever to research and test.

> Explanation of the size. GDCM is used with ITK(**) and thus I had to use
> the DICOM prefix we had after David Clunie send us the link for a free
> one(***). Already the size of this prefix was 27 bytes. AS we wanted a
> subspace of it (ex: ".1") the prefix ITK + GDCM is now 29 bytes.

As I think I pointed out earlier on the ITK mailing list, you could
choose a root from a source that is shorter.

You (well, ITK) is using one from Dave Harvey, which is long. Specifically
"1.2.826.0.1.3680043.2.1125", which is 27 bytes.

I suggested you use one from the IANA registry, which is relatively
short. E.g. mine is 17 characters before I start to subdivide the space.

The highest number in the IANA registry right now is 22233, so they
are only into 5 digits on top of the 12+period prefix, so if you
act quickly (some time in the next decade or so), you should probably
be able to get an 18 byte root.

That is 9 bytes better than what you are currently using.

> After the spatial identifier I needed a temporal identifier. This is far
> easier. I just used regular time function and coded something like:
...
> So I only have two bytes left for the random number.

Safest not ever to assume time is sufficient; if the granularity of time
is milliseconds (and it may not be that granular even if the return
value is in milliseconds), this could be too short on a modern fast
machine that can generate a lot of UIDs in a millisecond.

For example, I just ran a quick check on the Java UID generator in
one of my toolkits and it generates over 10 UIDs per millisecond if
the same system and time based prefix is used, and still over 5
UIDs per second if a new system and time based prefix is generated,
and that's on my laptop. Once it has been running for a while and
the JIT optimizer gets to it, it actually exceeds 20 UIDs per
millisecond for the latter scenario.

So a random number, or cache of counts per time increment is
definitely required I think (java.rmi.server.UID does the latter
for you).

David




More information about the Insight-developers mailing list