Problems with Dictonary in Unity

97 weergaven
Naar het eerste ongelezen bericht

Alessandro Pierro

ongelezen,
10 mei 2017, 06:06:3110-05-2017
aan Fellow Oak DICOM
I am having this error :

using UnityEngine;
using System.Collections;
using Dicom.Imaging.Codec;
using Dicom;

public class Daje : MonoBehaviour {

   
// Use this for initialization
   
void Start () {
   
   
}
   
   
// Update is called once per frame
   
void Update () {
   
   
}

   
public void ClickOfTheButton() {
       
var file = DicomFile.Open(@"a.dcm");

       
var patientid = file.Dataset.Get<string>(DicomTag.PatientID);

        file
.Dataset.AddOrUpdate(DicomTag.PatientName, "DOE^JOHN");

       
// creates a new instance of DicomFile
       
var newFile = file.Clone(DicomTransferSyntax.JPEGProcess14SV1);

        file
.Save(@"output.dcm");
   
}
}

When Unity execute DicomFile.Open(@"a.dcm");

I got this error :
NullReferenceException: Object reference not set to an instance of an object
Dicom.DicomDictionary.EnsureDefaultDictionariesLoaded (Nullable`1 loadPrivateDictionary)
Rethrow as DicomDataException: Unable to load DICOM dictionary from resources.
Object reference not set to an instance of an object
Dicom.DicomDictionary.EnsureDefaultDictionariesLoaded (Nullable`1 loadPrivateDictionary)
Dicom.DicomDictionary.get_Default ()
Dicom.DicomTag.get_DictionaryEntry ()
Dicom.IO.Reader.DicomFileReader.Preprocess (IByteSource source, Dicom.DicomFileFormat& fileFormat, Dicom.DicomTransferSyntax& syntax)
Dicom.IO.Reader.DicomFileReader.Parse (IByteSource source, IDicomReaderObserver fileMetasetInfoObserver, IDicomReaderObserver datasetObserver, System.Func`2 stop)
Dicom.IO.Reader.DicomFileReader.Read (IByteSource source, IDicomReaderObserver fileMetaInfo, IDicomReaderObserver dataset, System.Func`2 stop)
Dicom.DicomFile.Open (System.String fileName, System.Text.Encoding fallbackEncoding, System.Func`2 stop)
Rethrow as DicomFileException: Unable to load DICOM dictionary from resources.
Object reference not set to an instance of an object
Dicom.DicomFile.Open (System.String fileName, System.Text.Encoding fallbackEncoding, System.Func`2 stop)
Dicom.DicomFile.Open (System.String fileName)
Daje.annamo () (at Assets/Scripts/Daje.cs:19)
UnityEngine.Events.InvokableCall.Invoke (System.Object[] args) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:153)
UnityEngine.Events.InvokableCallList.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:630)
UnityEngine.Events.UnityEventBase.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:765)
UnityEngine.Events.UnityEvent.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:53)
UnityEngine.UI.Button.Press () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:35)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:44)
UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:52)
UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerClickHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:269)
UnityEngine.EventSystems.EventSystem:Update()


I have downloaded also the Dictonary folder from GitHub but I don't know Where do I have to put it.


P.S. Is it possible to use 'await' code in Unity ?

Anders Gustafsson Cureos AB

ongelezen,
10 mei 2017, 07:39:0210-05-2017
aan Fellow Oak DICOM
Hi again Alessandro!

You should put the two .xml files in a sub-folder Resources in your Unity project. The .xml.gz files are not used by the Unity fo-dicom assembly.

Currently, since the public Unity scripting engine is based on Mono 2.0/3.5, async-await is not supported. Mono 4.5/4.6 support is currently in Beta; once this is publicly released it should be possible to use async-await as well.

Regards,
Anders
Allen beantwoorden
Auteur beantwoorden
Doorsturen
0 nieuwe berichten