I could not get the above to work. I have the latest fo-dicom (fo-dicom.core 5.0.3.0). Im basically trying to convert a dicom file to json and back :
...
using Dicom;
using FellowOakDicom.IO.Buffer;
using FellowOakDicom.Serialization;
using Newtonsoft.Json;
using Dicom.Serialization;
....
private void TestFODJsonConversion(String filename)
{
byte[] buff = File.ReadAllBytes(filename);
var stream = new MemoryStream(buff);
DicomFile df = DicomFile.Open(stream, FileReadOption.SkipLargeTags);
String json = JsonConvert.SerializeObject(df, new Dicom.Serialization.JsonDicomConverter());
DicomDataset recoveredDs = JsonConvert.DeserializeObject<DicomDataset>(json, new JsonDicomConverter());
***EXCEPTION THROWN***
DicomFile recoveredDf = new DicomFile(recoveredDs);
}
Exception thrown: 'System.InvalidOperationException' in Newtonsoft.Json.dll
An exception of type 'System.InvalidOperationException' occurred in Newtonsoft.Json.dll but was not handled in user code
Cannot access child value on Newtonsoft.Json.Linq.JValue.
Also, looking at the created json file, it has a structure that I have not seen in other dicom json files, specifically, splitting the meta tags and image tags into separate blocks and other high level nestings. Am I missing some component ?
thx