I am trying to parse dicom images using imebra sdk , But I cant open the app after propery coded the program http://ift.tt/1Fzp0Wi Help Me. Thanks In Advance
MainActivity.java
public class MainActivity extends Activity
{
// Called when the activity is first created.
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// LOAD THE LIBRARY
System.loadLibrary("imebra_lib");
}
// Called when the activity starts
public void onStart()
{
super.onStart();
// Open the dicom file from sdcard
Stream stream = new Stream();
stream.openFileRead("/sdcard/bluetooth/66377001/66377001.dcm");
// Build an internal representation of the Dicom file. Tags larger than 256 bytes
// will be loaded on demand from the file
DataSet dataSet = CodecFactory.load(new StreamReader(stream), 256);
// Get the first image
Image image = dataSet.getImage(0);
// Monochrome images may have a modality transform
if(ColorTransformsFactory.isMonochrome(image.getColorSpace()))
{
ModalityVOILUT modalityVOILUT = new ModalityVOILUT(dataSet);
if(!modalityVOILUT.isEmpty())
{
Image modalityImage = modalityVOILUT.allocateOutputImage(image, image.getSizeX(), image.getSizeY());
modalityVOILUT.runTransform(image, 0, 0, image.getSizeX(), image.getSizeY(), modalityImage, 0, 0);
image = modalityImage;
}
}
// Just for fun: get the color space and the patient name
String colorSpace = image.getColorSpace();
String patientName = dataSet.getString(0x0010, 0, 0x0010, 0);
String dataType = dataSet.getDataType(0x0010, 0, 0x0010);
// Allocate a transforms chain: contains all the transforms to execute before displaying
// an image
TransformsChain transformsChain = new TransformsChain();
// Monochromatic image may require a presentation transform to display interesting data
if(ColorTransformsFactory.isMonochrome(image.getColorSpace()))
{
VOILUT voilut = new VOILUT(dataSet);
int voilutId = voilut.getVOILUTId(0);
if(voilutId != 0)
{
voilut.setVOILUT(voilutId);
}
else
{
// No presentation transform is present: here we calculate the optimal window/width (brightness,
// contrast) and we will use that
voilut.applyOptimalVOI(image, 0, 0, image.getSizeX(), image.getSizeY());
}
transformsChain.addTransform(voilut);
}
// Let's find the DicomView and se the image
DicomView imageView = (DicomView)findViewById(R.id.imageView);
imageView.setImage(image, transformsChain);
}
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<com.imebra.dicom.DicomView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/imageView"/>
</LinearLayout>
And i added imebra library file to the dependecies and synced the project successfully But I Stucked with an error
LOGCAT
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.imebra/com.test.imebra.MainActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class com.imebra.dicom.DicomView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2314)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2388)
at android.app.ActivityThread.access$800(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5312)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class com.imebra.dicom.DicomView
at android.view.LayoutInflater.createView(LayoutInflater.java:633)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377)
at android.app.Activity.setContentView(Activity.java:2154)
at com.test.imebra.MainActivity.onCreate(MainActivity.java:19)
at android.app.Activity.performCreate(Activity.java:5953)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1128)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2267)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2388)
at android.app.ActivityThread.access$800(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5312)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:607)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377)
at android.app.Activity.setContentView(Activity.java:2154)
at com.test.imebra.MainActivity.onCreate(MainActivity.java:19)
at android.app.Activity.performCreate(Activity.java:5953)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1128)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2267)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2388)
at android.app.ActivityThread.access$800(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5312)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
Caused by: java.lang.UnsupportedOperationException: Can't convert to color: type=0x1
at android.content.res.TypedArray.getColor(TypedArray.java:404)
at com.imebra.dicom.DicomView.initializeParameters(DicomView.java:269)
at com.imebra.dicom.DicomView.<init>(DicomView.java:124)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:607)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377)
at android.app.Activity.setContentView(Activity.java:2154)
at com.test.imebra.MainActivity.onCreate(MainActivity.java:19)
at android.app.Activity.performCreate(Activity.java:5953)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1128)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2267)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2388)
at android.app.ActivityThread.access$800(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5312)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
Ce commentaire a été supprimé par l'auteur.
RépondreSupprimerI had the same issue, and then I realized that in the latest version of Imebra library, DicomView is not used anymore. In fact, it was deleted in the latest version. Get the lasted jar without DicomView class and update your code: https://imebra.com/wp-content/uploads/documentation/imebra_android_2015_20151022-001/html/add_imebra_to_project.html#add_studio
RépondreSupprimerI had the same issue, and then I realized that in the latest version of Imebra library, DicomView is not used anymore. In fact, it was deleted in the latest version. Get the lasted jar without DicomView class and update your code: https://imebra.com/wp-content/uploads/documentation/imebra_android_2015_20151022-001/html/add_imebra_to_project.html#add_studio
RépondreSupprimer