Saturday, February 04, 2012
Google Custom Search

ClearCanvas Highlights

Download our  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: johnnylimsk
New Today New Today: 7
New Yesterday New Yesterday: 26
User Count Overall: 20480

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

Online Now Online Now:
01: b3lad

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 4 of 4 << < 1234
Author Messages
steve
Senior Member
Senior Member
Posts:1884

--
2010-08-27 05:32 PM  
On the Bilinear Interpolation dll, we do have 32-bit and 64-bit compiled versions of this dll stored in the repository:

Trunk\ReferencedAssemblies\Interpolators\

and

Trunk\ReferencedAssemblies\Interpolators\x64

You should be able to just use the appropriate file. I believe that with the exception of the codecs, the rest of the assemblies are managed assemblies that can run under 32-bit or 64-bit operating systems, so you use the same assembly for both.

Steve


Real-time support available to Clinical Edition and Team Edition customers
postb99
Senior Member
Senior Member
Posts:160

--
2010-10-11 04:00 AM  
Hello,

I am developing a web viewer based on Julien Jay code, who posted in this thread a while ago. I upgraded the 1.5 CC libs he used to the 2.0 SP1 precompiled ones.

I have a funny problem.

In a nunit test project, I have no problem extracting a png file from a Dicom one (code below). In an asp.net web application, the same code doesn't work : I get "Failed to load provider type : ClearCanvas.Common.Configuration.StandardSettingsProvider (followed by assembly full name, version 2.0 something, so it looks for right version)".

I have included CC libraries in a class library project, used by my asp.net 3.5 application.

In the "bin" directory, I have the same dlls/files, here is the list :

- BilinearInterpolation
- CC Common
- CC Desktop
- CC Dicom
- CC Dicom codec *2
- CC ImageViewer
- log4net
- Logging.config

So I wonder whether I should do as Julien did, comment out some lines of code. Or better would be to correct what's wrong in my configuration.

In Logging.config, I indicated a full path for log file (c:/my/path/logfile.log), but there is no log file created.

Thank you for your help. if I have too much troubles, I will have to struggle with CC projects to fully compile etc to change code (since I use MS Visual Studio 2010 and framework 3.5).

Barbara

///
/// Extracts all the image files of DICOM file and stores them in compressed format besides Dicom file.
///

/// Dicom file path
/// Compressed file format
public static void ExtractAllBitmap(string strDicomFilePath_, ImageFormat ifFormat_)
{
Bitmap bBitmap;
LocalSopDataSource dataSource = new LocalSopDataSource(strDicomFilePath_);
ImageSop imageSop = new ImageSop(dataSource);
int iWidth = PluginDICOM.GetUShort(imageSop[DicomTags.Columns]);
int iHeight = PluginDICOM.GetUShort(imageSop[DicomTags.Rows]);
int i = 1;
foreach (IPresentationImage ipImage in PresentationImageFactory.Create(imageSop))
{
string strCompressedFilePath = PluginDICOM.GetCompressedFilePath(strDicomFilePath_, ifFormat_, i++);
FileStream fsStream = new FileStream(strCompressedFilePath, FileMode.Create);
bBitmap = ipImage.DrawToBitmap(iWidth, iHeight);
bBitmap.Save(fsStream, ifFormat_);
fsStream.Dispose();
}
imageSop.Dispose();

}


postb99
Senior Member
Senior Member
Posts:160

--
2010-10-11 04:10 AM  
Oops, follow-up of previous post. I have deleted and regenerated the png file using the web application, now I am rid of first error, but I get "The current configuration system does not support user-scoped settings". I will dig on this error...

Barbara


postb99
Senior Member
Senior Member
Posts:160

--
2010-10-11 05:11 AM  
How can I easily find the projects I have to change settings of and recompile, to replace every "settings" : "user" by "settings" : "application" in project's properties, settings tab ?

I have opened ImageViewer project, should I open another one ?

Finding my way... Thanks.


postb99
Senior Member
Senior Member
Posts:160

--
2010-10-11 06:17 AM  

I'm lost now : I changed the settings type for ImageViewer.Tools.Measurement project only, but got the error again. Then I did a search and replace in every project of ImageViewer solution app.config : now it doesn't compile ("could not find schema information for the element/attrubute XXX").

Did you do significant changes in trunk SVN so that it could solve my problem if I use trunk instead of 2.0 SP1 ?

Thanks,

Barbara



postb99
Senior Member
Senior Member
Posts:160

--
2010-10-11 08:55 AM  

Well, sorry for becoming a bit offtopic the more I post here, but this is the key to using CC in asp.net context : replace user settings in app.config by something else (quick and dirty : constants in classes that are currently serialized in user settings). However, I am not sure which modifications I should do to achieve this...

I would think of removing the userSettings section, and add properties to the classes which are serialized in this section. But I think I have to do something else...

[edit]

After thinking over, I went back to first idea : moving the declarations from userSettings section to applicationSettings one. But now I get a null reference exception. How come I have no error log, no log at all ?

Is the error not logged but only drawn on image as overlay text ?


Thanks.

Barbara



postb99
Senior Member
Senior Member
Posts:160

--
2010-10-12 04:00 AM  
I started a more specific topic here : http://www.clearcanvas.ca/dnn/tabid/69/afv/topic/aff/10/aft/14750/Default.aspx and entitled it "Using CC libraries in an asp.net application"


manishk
New Member
New Member
Posts:6

--
2010-12-29 08:48 PM  
Hi Norman,

I tried to use your code in my web application which is developed in asp.net 3.5, which is given below.

LocalImageSop sop = new LocalImageSop("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);

But am unable to find LocalImageSop class in my SDK, not sure which namespace am missing to include. So I unable to implement the same in my application.

I am done with reading DCM file information and also can show. But just am stuck with displaying DCM image in browser through my application.

So please help me on this. Or just post a code for it.

Thanks,
Manish.


stewart
Senior Member
Senior Member
Posts:2032

--
2011-01-10 02:39 PM  
The code snippet you're using is just out of date - I think I deleted LocalImageSop.

Try this:

Sop sop = Sop.Create("myfile.dcm");
IPresentationImage image = PresentationImageFactory.Create(sop);
Bitmap bitmap = image.DrawToBitmap();

Hope this helps,
Stewart



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

--
2011-01-11 01:13 PM  

Hi Stewart,

Thanks for the help and a code.

I used the same code and implemented the same in my web application.

But it gives me some error messages as,

Error    3    The best overloaded method match for 'ClearCanvas.ImageViewer.PresentationImageFactory.Create(ClearCanvas.ImageViewer.StudyManagement.ImageSop)' has some invalid arguments   

Error    4    Argument '1': cannot convert from 'ClearCanvas.ImageViewer.StudyManagement.Sop' to 'ClearCanvas.ImageViewer.StudyManagement.ImageSop'   

Error    5    No overload for method 'DrawToBitmap' takes '0' arguments

Below is my implemented code,

using ClearCanvas.Common;
using ClearCanvas.ImageViewer.Imaging;
using ClearCanvas.ImageViewer.Graphics;
using ClearCanvas.ImageViewer.StudyManagement;
using ClearCanvas.ImageViewer;
using ClearCanvas.Desktop;
using ClearCanvas.Dicom;
using ClearCanvas.Dicom.Codec;
using log4net;

Sop objSop = Sop.Create(HttpContext.Current.Server.MapPath("Files\\1.3.46.670589.6.1.0.98511171.2001010909322347.dcm"));

        IPresentationImage images = PresentationImageFactory.Create(objSop);
        Bitmap objBitMap = images.DrawToBitmap();

Please help me for this.

Thanks & Regards,

Manish.


 



stewart
Senior Member
Senior Member
Posts:2032

--
2011-01-17 10:28 AM  
The problem is just that the Sop.Create method is returning Sop objects, but the PresentationImageFactory.Create method accepts ImageSop objects. Just cast your Sop to an ImageSop.


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

--
2011-02-02 03:08 PM  
Hi Stewart,

Thanks for the help and guiding me.

Now am able to show bitmap in my web application.
But there is small problem that why image is showing such message in it, as "The current configuration system does not support user-scoped settings" in it..

Please let me know if you have any solution on it.

Thanks,
Manish


manishk
New Member
New Member
Posts:6

--
2011-02-02 03:10 PM  
Hi Stewart,

Thanks for the help and guiding me.

Now am able to show bitmap in my web application.
But there is small problem that why image is showing such message in it, as "The current configuration system does not support user-scoped settings" in it..

Please let me know if you have any solution on it.

Thanks,
Manish


postb99
Senior Member
Senior Member
Posts:160

--
2011-02-03 09:00 AM  
Please read here :

http://www.clearcanvas.ca/dnn/Community/Forums/tabid/69/aff/10/aft/14750/afv/topic/Default.aspx

and here :

http://www.clearcanvas.ca/dnn/tabid/69/afv/topic/aff/8/aft/14658/Default.aspx


dinesh123
New Member
New Member
Posts:2

--
2011-07-20 06:32 AM  

DicomFile _dfile = new DicomFile("DicomFileName.dcm");

I find Dicom File Path from open dicom image in imageviewer Before Import Dicom file.

Pls!Help for me........!

It is argent Work.....!


stewart
Senior Member
Senior Member
Posts:2032

--
2011-07-26 09:53 AM  
Sorry, but you'll have describe your problem in a little more detail before I can help you. What is it exactly that you are trying to do?


Real-time support available to Clinical Edition and Team Edition customers
obi_wan7
New Member
New Member
Posts:1

--
2011-07-29 05:26 AM  

Allow me to add some experience. If the output image shows error "No plugins could be found." You must change .NET Framework from 4.0 to 3.5. I don't now why won't work on 4.0 but on 3.5 works fine.  

I spend tree days to solve this out. I hope that helps someone.



cfdelaune
New Member
New Member
Posts:2

--
2011-09-13 04:56 PM  

Hello,

I have this working perfectly in a WinForms project running .net 3.5, but am wondering if anyone has found a way to work around the "no plugins could be found" and "The settings property 'FilteredLayoutSettingsXml' was not found." overlay errors in .net 4.0.  The capability is all there at thie point and it is great!  I just have to somehow get this working in 4.0.

UPDATE: I have spent a lot of time reading through this forum and can see that this is a well known issue that requires a few modifications and a recompile.  I am having trouble getting the source and was wondering if anyone has a compiled version of the dlls with these changes already applied.

Any help would be much appreciated.  Thanks!

Christian



You are not authorized to post a reply.
Page 4 of 4 << < 1234


Active Forums 4.1
Copyright 2011 ClearCanvas Inc.