Friday, February 10, 2012
Google Custom Search

ClearCanvas Highlights

Download our Open Source software
Watch some Videos
Get the Source
Check out our Licensing
Join our  Forums
Some Research: OICR IPP-Trials

Our Community

Membership Membership:
Latest New User Latest: rczlubin
New Today New Today: 5
New Yesterday New Yesterday: 27
User Count Overall: 20595

People Online People Online:
Visitors Visitors: 11
Members Members: 1
Total Total: 12

Online Now Online Now:
01: rczlubin

ClearCanvas Community Forums

Export DicomFile pixelData to JPEG or Image object
Last Post 2011-09-13 04:56 PM by cfdelaune. 77 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Page 2 of 4 << < 1234 > >>
Author Messages
parmedevakil
New Member
New Member
Posts:4

--
2008-08-23 12:08 PM  
To update my situation,

I have added your post-build events to my project properties. But whenever I build, my output directory looks like this

\common
    \ClearCanvas.Common.dll
    \ClearCanvas.Dicom.dll
    \ClearCanvas.Dicom.OffisWrapper.dll
    \ClearCanvas.log4net.dll
    \log4net.dll
    \nunit.framework.dll
\logs
\plugins
    \ClearCanvas.Desktop.dll
    \ClearCanavs.ImageViewer.dll
    \ClearCanvas.ImageViewer.Rendering.BilinearInterpolation.dll
DicomBitmap.exe
DicomBitmap.exe.config
DicomBitmap.pdb
DicomBitmap.vshost
Logging.config
ClearCanvas.Desktop.dll
ClearCanavs.ImageViewer.dll
ClearCanvas.Common.dll
ClearCanvas.Dicom.dll
ClearCanvas.Dicom.OffisWrapper.dll
ClearCanvas.log4net.dll
log4net.dll
nunit.framework.dll

And of course the output is a black file. I also notice the same thing happens on your project if I delete the refernces to ClearCanvas dlls, readd them, then re-build. I am quite lost. I guess what I would like to know is how you added the references

Parmede


norman
Senior Member
Senior Member
Posts:811

--
2008-08-23 12:21 PM  
Hi Parmede,

A few things:

1) Don't comment out the StartApp line...that has to be there for the plugins to load
2) Make sure you app.config has the "probing privatepath" line (see the app.config in the sample as an example)
3) I noticed you have a number of extra files in the same dir as the exe. In your list, everything from ClearCanvas.Desktop.dll and below should be removed, since they already exist in either the common or plugins directory. You can make sure this doesn't happen by making sure that the Copy Local property on the reference is set to false.

N.


steve
Senior Member
Senior Member
Posts:1885

--
2008-08-23 12:25 PM  
Parmede,

I would suggest looking at the developers guide here, and specifically at the section "I want to.. / Deployment / Create a new application".  This contains a discussion on the folder organization.

Also, the "Getting Started / File Organization / Binary Organization" sections discuss where files are located in the viewer install, which is useful to setup your build properly, to see how the viewer is organized.

Steve


Real-time support available to Clinical Edition and Team Edition customers
parmedevakil
New Member
New Member
Posts:4

--
2008-08-23 12:51 PM  
Steven and Norman,

Thank you both for your help! The problem was that I hadn't set the Copy Local value of the referenced DLLs to false. Everything has now worked.

Regards,
Parmede


zlf
Basic Member
Basic Member
Posts:14

--
2009-01-30 12:17 AM  

I load a multi-frame dcm file gotten from IVUS. Render them to bmp files by calling image.DrawToBitmap. But every file has no IVUS image but a line says "Unsupported transfer syntax". I am sure the dcm file is valid. Thanks



norman
Senior Member
Senior Member
Posts:811

--
2009-01-30 10:14 AM  
Hi,

The dcm file may well be valid, but the viewer may not support the transfer syntax, which is what that error is saying. Try looking in the log (located in [installdir]\logs) to see what the specific issue is.

N.


zlf
Basic Member
Basic Member
Posts:14

--
2009-02-05 11:25 PM  

Hi Norman
I am pasting exception log here

2009-02-06 13:24:24,828 [1] ERROR - Exception thrown
ClearCanvas.Dicom.Codec.DicomCodecException: Unsupported transfer syntax
at ClearCanvas.ImageViewer.StudyManagement.Frame.CreateNormalizedPixelData()
at ClearCanvas.ImageViewer.StudyManagement.Frame.GetNormalizedPixelData()
at ClearCanvas.ImageViewer.Imaging.PixelData.GetPixelData()
at ClearCanvas.ImageViewer.Rendering.ImageRenderer.Render(ImageGraphic imageGraphic, IntPtr pDstPixelData, Int32 dstWidth, Int32 dstBytesPerPixel, Rectangle clientRectangle)
at ClearCanvas.ImageViewer.Rendering.GdiRenderer.DrawImageGraphic(ImageGraphic imageGraphic)
at ClearCanvas.ImageViewer.Rendering.RendererBase.DrawSceneGraph(CompositeGraphic sceneGraph)
at ClearCanvas.ImageViewer.Rendering.RendererBase.DrawSceneGraph(CompositeGraphic sceneGraph)
at ClearCanvas.ImageViewer.Rendering.RendererBase.Render()
at ClearCanvas.ImageViewer.Rendering.GdiRenderer.Render()
at ClearCanvas.ImageViewer.Rendering.RendererBase.Draw(DrawArgs drawArgs)

EDIT: SOLVED by adding all plugins' dll into reference.



norman
Senior Member
Senior Member
Posts:811

--
2009-02-05 11:30 PM  
Thanks for the log. Try doing a dicom dump of the file, then post back here the transfer syntax.

N.


jasper.yeh
Senior Member
Senior Member
Posts:521
Avatar

--
2009-07-27 10:05 AM  
As a note for future reference: The code snippet at the very top of this thread works in versions 1.3 and earlier. In the coming release, the LocalImageSop class has been replaced with a basic ImageSop class for which you pass a LocalSopDataSource object. The resulting modified code for 1.5 and later is the following:


ImageSop sop = new ImageSop(new LocalSopDataSource("MyFile.dcm"));
IPresentationImage image = PresentationImageFactory.Create(sop);

Bitmap bmp = new Bitmap(width, height);
Graphics g = Graphics.FromImage(bmp);
IRenderingSurface surface = image.Renderer.GetRenderingSurface(null, width, height);
surface.ContextId = g.GetHdc();
DrawArgs drawArgs = new DrawArgs(surface, null, DrawMode.Render);
image.OnDraw(drawArgs);
drawArgs = new DrawArgs(surface, null, DrawMode.Refresh);
image.OnDraw(drawArgs);


// Jasper
Julien.Jay
New Member
New Member
Posts:6

--
2009-07-28 08:32 AM  

Hi,

I want to extract a bitmap from a dicom file. I've read some topics about that on your forums. Though i get an error.

Here is the classic sample piece of code

LocalSopDataSource lsdSource = new LocalSopDataSource(dfFile);

//dfFile is a DicomFile that has been loaded.

ImageSop isSop = new ImageSop(lsdSource);

Bitmap bBitmap = null;
IPresentationImage piImage = PresentationImageFactory.Create(isSop.Frames[1]);

bBitmap = piImage.DrawToBitmap(width,height);

bBitmap.Save("d:/test.bmp");

It works fine. However, there is an error message on the output bitmap  :

Echec lors du chargement du type de fournisseur (in English : Failed to load provider type ) : ClearCanvas.Common.Configuration.StandardSettingsProvider, ClearCanvas.Common , Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null;

I have a recent version of the framwork : checked out from the svn last week.

I can't solve the problem. Any help would be very appreciated.

 



stewart
Senior Member
Senior Member
Posts:2033

--
2009-08-11 03:05 PM  
Hi, sorry for the late reply. Are you by chance trying to use the CC framework in ASP.NET or as a library from your own application?

Best regards,
Stewart


Real-time support available to Clinical Edition and Team Edition customers
Julien.Jay
New Member
New Member
Posts:6

--
2009-08-12 03:21 AM  

I'm using the CC framework as a library from my own application.

I have now more precisions for the problem.

The problem occurs in RenderBase.cs : when Render() calls DrawTextOverlay(), accessing the AnnotationLayout  (or AnnotationBoxes, i don't remember very well) property throws an exception (the same as in my last post).

As i couldn't figure out how to solve the problem, I decided to comment DrawTextOverlay() in Render() for the moment.

I hope to find something better. Perhaps I should try with a more recent release of the framework.



stewart
Senior Member
Senior Member
Posts:2033

--
2009-08-12 01:24 PM  

Hi, can you try the same code, but using references to the binaries from our 1.5 SDK and see what happens?  It looks like an assembly versioning issue, so I want to try and rule that out.

Thanks,
Stewart



Real-time support available to Clinical Edition and Team Edition customers
Julien.Jay
New Member
New Member
Posts:6

--
2009-08-13 05:13 AM  

Hi,

Unfortunately I get the same error with the binaries from the 1.5 SDK

It's likely that I don't reference them the right way or something is wrong in my project structure. I wonder if i could just avoid getting the error message on the image. Is it possible to "catch" the error stream or something similar ?

Thanks for your help



stewart
Senior Member
Senior Member
Posts:2033

--
2009-08-13 03:51 PM  
You could probably just catch the exception, but it troubles me that it doesn't work. If I get a chance later, I'll try to put something together quickly that does the same thing and see if I can reproduce ... right now, I have no other ideas.

Best Regards,
Stewart


Real-time support available to Clinical Edition and Team Edition customers
Julien.Jay
New Member
New Member
Posts:6

--
2009-08-13 05:10 PM  

Since I'm not using the CC Framework extensively in my project I don't mind commenting a line so that text overlays don't get drawn on the bitmap. I was just curious about the error. However It doesn't seem that easy to get it solved.  

Anyway thanks again for your help,

And thanks a lot for the CC framework; Great Job

 



stewart
Senior Member
Senior Member
Posts:2033

--
2009-08-13 09:04 PM  
I tried it out and everything seems to work ok. Here's the steps I took:

1. Create a new WinForms Application (called it ViewerAsLibrary)
2. Added References to SDK binaries: Common, ImageViewer, Dicom, Desktop
3. Manually copied BilinearInterpolation.dll and logging.config
4. Added a button to the Form that executes the code you provided

Here's the list of files I needed for everything to run properly (all in the same folder, no plugins folder):

BilinearInterpolation.dll
ClearCanvas.Common.dll
ClearCanvas.Desktop.dll
ClearCanvas.Dicom.dll
ClearCanvas.ImageViewer.dll
log4net.dll
Logging.config
ViewerAsLibrary.exe

I loaded an x-ray image and saved it back out as a PNG and it was ok.

Try following exactly the same steps I took and see if it works ... if it doesn't please post back.

Hope this helps,
Stewart


Real-time support available to Clinical Edition and Team Edition customers
Julien.Jay
New Member
New Member
Posts:6

--
2009-08-14 04:20 AM  
I followed your steps and it works very well. No error message.

My mistake was not to add logging.config. I know it's in the developper guide but I missed it.

So I tried to add it in my project and now I get another error message on the image telling that the 'FilteredLayoutSettingsXML' property cannot be found.

Thanks for your help


stewart
Senior Member
Senior Member
Posts:2033

--
2009-08-14 09:27 AM  
Hmm, ok. I'm not sure what the problem is, but it seems as though the .NET configuration of your application is in a funny state. I'm going to guess that if you debugged the app, the exception would be thrown from the CC code here:

ImageViewer.Annotations.Dicom.DicomFilteredAnnotationLayoutStoreSettings.FilteredLayoutSettingsXml
Line 34: return ((string)(this["FilteredLayoutSettingsXml"]));

This indicates that your app is unable to load/find that user setting. Is there anything else that is different about your application? Does it use any other libraries or any additional CC plugins?


Real-time support available to Clinical Edition and Team Edition customers
stewart
Senior Member
Senior Member
Posts:2033

--
2009-08-14 09:30 AM  
Another question: what version(s) of the .NET Framework are installed on your machine?


Real-time support available to Clinical Edition and Team Edition customers
You are not authorized to post a reply.
Page 2 of 4 << < 1234 > >>


Active Forums 4.1
Copyright 2011 ClearCanvas Inc.