everytime i write the output of a filter, i get this warning. It doesn´t throw any error, and it writes well, but it is a bit annoying to get this warning as an output for each slice as i like to follow the ouputs of my code and with this it is impossible.
Any idea? Thank you
In C:\Users…\Desktop\itk\Modules\ThirdParty\GDCM\src\gdcm\Source\DataStructureAndEncodingDefinition\gdcmMediaStorage.cxx, line 516, function
Unknown/Unhandle MediaStorage, but Pixel Data element found
This sounds like an input problem, not an output problem. Do you have any Update() calls before writer2d->Update();? Can you add reader->Update(); near the beginning of your program? Do the warnings appear at reader->Update(); or writer2d->Update();?
IMHO (i guess) the warning can be ignored (at least very often), if the data doesn’t have Media Storage and Modality. GDCM takes default - Secondary Capture Storage. Everything is good, no idea why return “false” and give warning in this case, but it doesn’t hurt. Modality will be, i guess, “OT” (other).
/// Attempt to set the MediaStorage from a file:
/// WARNING: When no MediaStorage & Modality are found BUT a PixelData element is found
/// then MediaStorage is set to the default SecondaryCaptureImageStorage (return value is
/// false in this case)
Edit: IMHO, it is even better not to try to write MR, CT or whatever modality/storage class to reduce an amount of “bad” DICOM files hanging around. Secondary Capture is good.
Return false seems to be important here, because real media storage will be set by calling ImageHelper::ComputeMediaStorageFromModality, so Secondary Capture will be refined there
bool PixmapWriter::Write()
{
MediaStorage ms;
if( !ms.SetFromFile( GetFile() ) )
{
// Let's fix some old ACR-NAME stuff:
ms = ImageHelper::ComputeMediaStorageFromModality( ms.GetModality(),
PixelData->GetNumberOfDimensions(),
PixelData->GetPixelFormat(),
PixelData->GetPhotometricInterpretation(),
0, 1 );
}
Just for the sake of completeness, all above is still applicable