Hello,
we using the following code to read dicom images. This worked
well for all kind of images (color, grayscale, 8-16 Bit ...).
DicomImage *di = new DicomImage(dfile, xfer, CIF_AcrNemaCompatibility, 0, 1);
DicomImage::getString(di->getStatus();
Now we have some uncompressed dicom images on a CD that show the following error:
ERROR: invalid values for 'BitsAllocated' (16), 'BitsStored' (16) and/or 'HighBit' (11) !
So this file is buggy but we need to read it. Since it is uncompressed we just stripped of
the header and worked with the raw data - but this is ugly.
Is there any way to bypass the dcmtk check e.g. by setting the HighBit to 15 ?
Best regards,
Christian
Read buggy 16/11 Bit CT Image
Moderator: Moderator Team
-
- DCMTK Developer
- Posts: 2055
- Joined: Fri, 2004-11-05, 13:47
- Location: Oldenburg, Germany
- Contact:
Hi Christian,
As far as I know (and Jörg, the author of DcmImage, is not in the office currently
) would say there is no way of tweaking DcmImage for ignoring those wrong High Bit settings.
Actually you should correct the file before throwing it into DcmImage. You might use dcmodify to change the HighBit value to the value you need, e.g.
Regards,
Michael
As far as I know (and Jörg, the author of DcmImage, is not in the office currently
![Wink :wink:](./images/smilies/icon_e_wink.gif)
Actually you should correct the file before throwing it into DcmImage. You might use dcmodify to change the HighBit value to the value you need, e.g.
Code: Select all
dcmodfiy -m HighBit="15" your-file.dcm
Michael
[quote="Michael Onken"]Hi Christian,
As far as I know (and Jörg, the author of DcmImage, is not in the office currently
) would say there is no way of tweaking DcmImage for ignoring those wrong High Bit settings.
Actually you should correct the file before throwing it into DcmImage. You might use dcmodify to change the HighBit value to the value you need, e.g.
[code]dcmodfiy -m HighBit="15" your-file.dcm [/code]
thank you for your help. This works when I copy the files from the CD to the disk first.
But the application should be able to read the files from the CD.
Can this change be made in memory (within DcmFileFormat *dfile) as well ?
Best regards,
Christian
As far as I know (and Jörg, the author of DcmImage, is not in the office currently
![Wink :wink:](./images/smilies/icon_e_wink.gif)
Actually you should correct the file before throwing it into DcmImage. You might use dcmodify to change the HighBit value to the value you need, e.g.
[code]dcmodfiy -m HighBit="15" your-file.dcm [/code]
thank you for your help. This works when I copy the files from the CD to the disk first.
But the application should be able to read the files from the CD.
Can this change be made in memory (within DcmFileFormat *dfile) as well ?
Best regards,
Christian
-
- DCMTK Developer
- Posts: 2055
- Joined: Fri, 2004-11-05, 13:47
- Location: Oldenburg, Germany
- Contact:
Yes of course!
Take a look at the functions provided by DcmItem. Open the file, get the dataset (a DcmItem) and call the putAndInsert... functions to insert / modify tags and values.
A short example can be found in the DCMTK documentation of module dcmdata (online here).
This should do the trick:
Done
I did not compile that, but you see how it should work...
Have a nice weekend with DCMTK
Michael
Take a look at the functions provided by DcmItem. Open the file, get the dataset (a DcmItem) and call the putAndInsert... functions to insert / modify tags and values.
A short example can be found in the DCMTK documentation of module dcmdata (online here).
This should do the trick:
Code: Select all
DcmFileFormat fileformat;
OFCondition status = fileformat.loadFile("test.dcm");
if (status.good())
{
OFString patientsName;
if (fileformat.getDataset()->putAndInsertUint16(DCM_HighBit, 15)
{
cout << "Changed High Bit to 15, saving test.dcm" << OFendl;
fileFormat.saveFile("test.dcm");
} else
cerr << "Error: cannot insert/change value of High Bit" << OFendl;
} else
cerr << "Error: cannot read DICOM file (" << status.text() << ")" << OFendl;
![Smile :-)](./images/smilies/icon_e_smile.gif)
Have a nice weekend with DCMTK
![Laughing :lol:](./images/smilies/icon_lol.gif)
Michael
Who is online
Users browsing this forum: Bing [Bot] and 1 guest