cooldude
cooldude

Reputation: 53

Not able to access JsonDicomConverter in .net core project

I am trying to extract data from Dicom files in JSON format using fo-Dicom but currently suffering from this error:

The type or namespace name 'JsonDicomConverter' could not be found (are you missing a using directive or an assembly reference?)

I am using:

string json = JsonConvert.SerializeObject(dataset, new JsonDicomConverter());

All the header files that I am using

using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System.Diagnostics;
using System.Net;
using System.Reflection;
using System.Text;
using Dicom;
using Dicom.Imaging;
using Dicom.IO.Buffer;

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

using Xunit;
using Xunit.Abstractions;

Why it's still saying I am missing reference?? Is JsonDicomConverter is not in the Dicom library or what am I doing wrong?? I am new in fo-Dicom and dotnet.

Upvotes: 1

Views: 597

Answers (2)

prinkpan
prinkpan

Reputation: 2247

Please ensure that you have the corresponding NuGet package installed depending on your requirement. The list of NuGet packages are given here

The JsonDicomConverter class is present in Dicom.Serialization namespace. You need to put it in your usings as using Dicom.Serialization; which should make your code work. Please check their GitHub here

Upvotes: 2

cooldude
cooldude

Reputation: 53

There is a fo-dicom.json library that I had to install using nuget package manager and now it's working.

Upvotes: 2

Related Questions