I am using GDCM to read/write images. It works well normally.
However, while I was reading/writing a 3d image which size is 1xy, there is a problem. The codes looks like this:
{
// write image
gdcmImgPtr->setNumbersOfDimension(3);
const unsigned int dims[] = {1 , 2, 3};
gdcmImgPtr->setDimensions(dims);
...
// gdcmImgPtr->getNumberOfDimensions() // 3
gdcmImgWriter.write();
}
{
// read image
gdcmImgReader.setFileName("filename");
...
// 2, which should be 3!
const int numberOfDimensions = gdcmImgReader.getNumbersOfDimension();
}
From a user opinion, the behavior of SetNumberOfDimensions/GetNumberOfDimensions shall be CONSISTENT. And It is consistent before I reopened the file.
However, the image's dimension turn to be a different value(2 instead of 3) after it is REOPENED. This does make me confused.
@Mathieu Malaterre
I am familiar with C++ and git. So maybe I can help if you are busy.
Here is what I would do: put a hardware poitner on numberOfDimension in gdcm::PixmapReader and check from MediaStorage if Dimension is > 2 to decide wether to set 2 or 3 even when third dim is only 1.
Need to be idempotent Multiframe with 1 frame should remain a Multiframe object.