unable to load DICOM with imebra Android

400 Views Asked by At

I have tried to load DICOM files in android using imebra I have checked my code many times ( load .jar lib , permissions & ...) and I have no idea to check next !

in this link "https://bitbucket.org/binarno/imebra/commits/442896d56ebf8856ae8b02326bd44831626f0420" is also the same question was asked but I can't find out what the solution is.

System.loadLibrary("imebra_lib");
       try {
          DataSet loadedDataSet = com.imebra.CodecFactory.load(content.getPath(),2048);
          // File auxFile = new File(content.getPath());
           //auxFile.getAbsoluteFile();
           ((TextView)state).setText("openFile Successful");
       }catch(Exception e){
           Log.e("Imebra openFile", "failure :",e );
           //e.printStackTrace();
           ((TextView)state).setText("openFile failed");
       }

and my Error log is :

E/Imebra openFile: failure : java.io.IOException: [void imebra::implementation::fileStream::openFile(const std::wstring &, std::ios_base::openmode)]
 file: C:/FILES/WorkSpace/Programming/Android/projescts/Dicom/Imebra/imebra_4_0_15_1/wrappers/javaWrapper/jni/../../../library/implementation/fileStreamImpl.cpp  line: 129
 exception type: N6imebra15StreamOpenErrorE
 exception message: stream::openFile failure - error code: 2                                                                   
 [void imebra::implementation::fileStream::openFile(const std::wstring &, std::ios_base::openmode)]
 file: C:/FILES/WorkSpace/Programming/Android/projescts/Dicom/Imebra/imebra_4_0_15_1/wrappers/javaWrapper/jni/../../../library/implementation/fileStreamImpl.cpp  line: 132
 exception type: N6imebra15StreamOpenErrorE
 exception message: stream::openFile failure - error code: 2                                                                                                                                                                                       
 [imebra::implementation::fileStreamInput::fileStreamInput(const std::string &)]
 file: C:/FILES/WorkSpace/Programming/Android/projescts/Dicom/Imebra/imebra_4_0_15_1/wrappers/javaWrapper/jni/../../../library/implementation/fileStreamImpl.cpp  line: 199
 exception type: N6imebra15StreamOpenErrorE
 exception message: stream::openFile failure - error code: 2

 [static imebra::DataSet *imebra::CodecFactory::load(const std::string &, size_t)]
 file: C:/FILES/WorkSpace/Programming/Android/projescts/Dicom/Imebra/imebra_4_0_15_1/wrappers/javaWrapper/jni/../../../library/src/codecFactory.cpp  line: 63                                                                   
 exception type: N6imebra15StreamOpenErrorE
 exception message: stream::openFile failure - error code: 2

 at com.imebra.imebraJNI.CodecFactory_load__SWIG_2(Native Method)
 at com.imebra.CodecFactory.load(CodecFactory.java:49)
 at os.i.learnandtest.Dicom.openFile(Dicom.java:21)
 at os.i.learnandtest.Register.onActivityResult(Register.java:132)
1

There are 1 best solutions below

1
On

The error is probably due to the fact that you pass an url-encoded file name to Imebra (according to your comment you pass "/document/primary%3ADicom%20test%20Image%2FIM-0001-0002.dcm").

Try converting the url entities into chars and pass the file name "/document/primary:Dicom test Image/IM-0001-0002.dcm"