WakingDreamer
WakingDreamer

Reputation: 35

Add new tags on dcm4chee

I'm working with dcm4chee now,and I have the demand to add some custom fields,for example patient's ID card number,mobile fhone number and address. After googling some related information,I am still confused and don't know what to do.Has any one ever done this?

Upvotes: 0

Views: 2395

Answers (3)

Anders Gustafsson
Anders Gustafsson

Reputation: 15981

As already pointed out by @jap1968, you can add

Other Patient IDs (0010,1000)

to include any additional patient ID numbers. This attribute is part of the Patient Identification Module, which attributes are generally expected in most DICOM objects.

From the Patient Demographic Module, which is normally an optional set of attributes, you can then for example reuse these attributes:

Patient’s Telephone Numbers (0010,2154)
Patient’s Address (0010,1040)

Depending on which DICOM toolkit you are using to process your DICOM objects, there will be different methods for attribute insertion. In dcm4che, you should be able to use one of the available DicomObject.put... methods to insert a new value in your DICOM object. Just remember that for correctness, you should update the SOP Instance UID (and potentially other UID:s) for the modified object.

Upvotes: 0

Johan
Johan

Reputation: 21

i've done it on some other cases. In my case i've to modify existing tag with new value. Here the code, hope it give you some pointer.

public static void changementTag(File file, int tagChooser, String aModify, VR vr, String newString )
    {
        try
        {
            DicomInputStream dis = new DicomInputStream(file);
            DicomObject dio = dis.readDicomObject();
            dis.close();

        String fileName = file.getAbsolutePath() + ".ori";
        File originFile = new File(fileName);
        file.renameTo(originFile);

        boolean change = false;
        dio.putString(tagChooser, vr, newString);
        change = true;

        if(change)
        {
            FileOutputStream fos = new FileOutputStream( new File(file.getParent()+ "/" + file.getName()));
            BufferedOutputStream bos = new BufferedOutputStream(fos);
            DicomOutputStream dos = new DicomOutputStream(bos);
            dos.writeDicomFile(dio);
            dos.close();
            originFile.delete();
        }
    }
    catch(IOException ex)
    {
        ex.printStackTrace();
    }
}

Upvotes: 2

jap1968
jap1968

Reputation: 7763

Have a look at these Dicom fields:

Other Patient IDs   (0010,1000)
Other Patient IDs Sequence  (0010,1002)

Maybe you do not need to add custom fields (at least for the patient ID card), but just use some of the already existing ones.

Upvotes: 0

Related Questions