Hello,
I can display .jpg images in ImageWells but I am not able to display .dcm images…
Dim TheImage as folderitem
TheImage = SpecialFolder.Desktop.Child("myImage.dcm")
If TheImage <> nil and TheImage.exists then
Dim p As Picture
p = Picture.Open(TheImage)
ImageWell1.Image = p
end if
Any suggestions?
Thanks.
Lennox
You’ll need to convert the DCM to one of the image formats that Xojo supports.
Thanks Tim,
I visited that page and found this
Dim width As Integer = 2000
Dim height As Integer = 2000
// creates new picture
Dim pic As new Picture(width, height, 32)
Dim picFile As FolderItem
picFile = GetOpenFolderItem("image/jpeg")
If Picture.IsImportFormatSupported(Picture.FormatJPEG) Then
If f<> Nil Then
pic = Picture.Open(picFile)
ImageWell1.Image = pic
End If
End If
I am having difficulty with If f<> Nil Then, what is f? could you assist me with that
Thanks.
Lennox
[quote=396176:@Lennox Jacob]Thanks Tim,
I visited that page and found this
[/quote]
That is not why I linked the docs, that doc page has the list of supported formats. You won’t actually need that function in your final implementation.
You may have to find an outside source to convert DCM to one of the supported formats, or you’ll have to write your own DCM to XojoPicture reader. Christian has a plugin for just about everything, so checking through MBS may be worth a shot.
OK Tim,
I have a pushbutton with this code in the MouseDown event…
Dim TheImage as FolderItem
TheImage = SpecialFolder.Desktop.Child("IM-0014-0001.dcm")
Dim width As Integer = 1024
Dim height As Integer = 1024
// creates new picture
Dim p As Picture
p = new Picture(width, height, 32)
If Picture.IsImportFormatSupported(Picture.FormatJPEG) Then
Msgbox "Yessirree, "".dcm"" is supported!!!"
If TheImage <> Nil Then
p = Picture.Open(TheImage)
Msgbox "TheImage <> Nil"
ImageWell1.Image = p
Self.Refresh
End If
else
Msgbox """.dcm"" is not supported"
End If
Both messageboxes, Msgbox “Yessirree, “”.dcm”" is supported!!!" and Msgbox “TheImage <> Nil” are displayed but the image is not displayed in ImageWell1, any suggestions?
Thanks.
Lennox
You’re asking if JPEGs are supported, not DCMs.
Did you check if our MBS GraphicsMagick plugin supports DCM?
OK Anthony, I see. Thanks.
Hi Christian, I haven’t but 'll check. Thanks.
Lennox
Hi Christian,
Is there an example project or code snippet showing how to convert .dcm to .jpg with MBS GraphicsMagick plugin?
Thanks.
Lennox
I don’t have such a file.
But the GMImageMBS function has a constructor taking a folderitem, so you could just use that.
Although you could use GM16ImageMBS to use 16bit for the color depth.
Hi Christian, Tanks, I visited that link but am still having difficulties, I have this code…
Dim TheImage as FolderItem
TheImage = SpecialFolder.Desktop.Child("IM-0014-0001.dcm")
dim c as new GMColorMBS("white")
dim g as new GMGeometryMBS(100,100)
dim image as new GMImageMBS(g, c)
// creates new picture
Dim p As Picture
p = new Picture(width, height, 32)
p = Picture.Open(image)
ImageWell1.Image = p
Could you advise what is wrong or better could you modify it for me?
Thanks.
Lennox
Well, more like this:
[code]Dim file as FolderItem = SpecialFolder.Desktop.Child(“test.dcm”)
dim image as new GMImageMBS(file)
ImageWell1.Image = image.CopyPicture[/code]
Thanks Christian,
That works, but How do I resize the picture to fit a 100x100 ImageWell?
The .dcm picture is 1024 x 1024.
Thanks again.
Lennox
You could call scale function…