overlay - ClearCanvas DICOM - How to create a Tag with a 'VR' of 'OW' -
ok, doing adding new overlay existing dicom file & saving it(the dicom file has 2 overlays). saves without errors & both dicom viewers sante & clearcanvas-workstation open file, sante displays both overlays. when @ tags within dicom file, overlaydata(6000) 'vr' 'ow' & overlaydata(6002) 'vr' 'ob'. problem how create new tag 'vr' of 'ow' because correct 1 use overlaydata.
here code i'm using add new overlay dicomfile.dataset:: note, after create overlay write visible pixel data it.
void addoverlay() { int newoverlayindex = 0; for(int = 0; != 16; ++i) { if(!dicomfile.dataset.contains(getoverlaytag(i, 0x3000))) { newoverlayindex = i; break; } } //columns uint columnstag = getoverlaytag(newoverlayindex, 0x0011); dicomfile.dataset[columnstag].setuint16(0, (ushort)currentdata.width); //rows uint rowtag = getoverlaytag(newoverlayindex, 0x0010); dicomfile.dataset[rowtag].setuint16(0, (ushort)currentdata.height); //type uint typetag = getoverlaytag(newoverlayindex, 0x0040); dicomfile.dataset[typetag].setstring(0, "g"); //origin uint origintag = getoverlaytag(newoverlayindex, 0x0050); dicomfile.dataset[origintag].setuint16(0, 1); dicomfile.dataset[origintag].setuint16(1, 1); //bits allocted uint bitsallocatedtag = getoverlaytag(newoverlayindex, 0x0100); dicomfile.dataset[bitsallocatedtag].setuint16(0, 1); //bit position uint bitpositiontag = getoverlaytag(newoverlayindex, 0x0100); dicomfile.dataset[bitpositiontag].setuint16(0, 0); //data uint datatag = getoverlaytag(newoverlayindex, 0x3000); dicomfile.dataset[datatag].setnullvalue();//<<< needs else byte[] bits = new byte[(currentdata.width*currentdata.height)/8]; for(int = 0; != bits.length; ++i) bits[i] = 0; dicomfile.dataset[datatag].values = bits; } public static uint getoverlaytag(int overlayindex, short element) { short group = (short)(0x6000 + (overlayindex*2)); byte[] groupbits = bitconverter.getbytes(group); byte[] elementbtis = bitconverter.getbytes(element); return bitconverter.touint32(new byte[]{elementbtis[0], elementbtis[1], groupbits[0], groupbits[1]}, 0); }
so seem me there method 'dicomfile.dataset[datatag].setnullvalue();' create tag 'vr' of 'ow'. or maybe theres totally different way add overlay in clearcanvas idk...
ok, confusion accually caused bug in program. trying create "bit position" tag using element "0x0100" instead of "0x0102". ow vs ob irrelevant.
sorry that...
Comments
Post a Comment