[Insight-users] Re: ITK Java [Bug 893]

Luis Ibanez luis.ibanez at kitware.com
Mon Jul 5 09:34:00 EDT 2004


Hi Uwe,

You are probably visualizing the output image with a naive viewer.

The output image is a 16bits PNG but with a 8bits actual range.
Many viewers do not rescale the intensities when they display 16bits
images, and therefore the image "looks" black even though it actually
contains data.

You should probably try the ImageViewer application distributed with
InsightApplications, or if you have access to ImageMagick, you can
simply normalize the image with those tools.

You could also, as an exercise, introduce a RescaleIntensityImageFilter
in the Java code and use it for converting the unsigned short image into
an unsigned char.

Please let us know if you have further questions.


   Thanks



     Luis


----------------------
Dr. Uwe Köhler wrote:

....
> The result of the MeanImageFilter, however, is always a 
> completely blank image when run on the cthead1.png. 
...
> Many thanks again
> 
> Uwe
> 
-------------------------------------------------------------
> Am Dienstag, 1. Juni 2004 20:11 schrieben Sie:
> 
>>Hi Uwe,
>>
>>Thanks for letting me know,
>>Any hint is always useful when tracking bugs.
>>
>>
>>We haven't discussed the option of taking advantage
>>of the new Java parameterized classes. It is certainly
>>tempting. It probably makes sense to wait and see how
>>well this is adopted by the Java Community.
>>
>>
>>   Regards,
>>
>>
>>     Luis
>>
>>
>>----------------------
>>
>>Dr. Uwe Köhler wrote:
>>
>>>-----BEGIN PGP SIGNED MESSAGE-----
>>>Hash: SHA1
>>>
>>>Hi Luis,
>>>
>>>enclosed is an email I got from Brian, whom I asked to run the java test
>>>programs on Windows. In essence: that works fine. The problem he has with
>>>the images is due to the fact that the examples read unsigned short
>>>images and the sample may not be. Hope this helps you narrowing down the
>>>problem.
>>>
>>>I believe the generic programming (templates) is a feature of Java 1.5.
>>>Am I right in assuming that will help the Java wrapper tremendously? Do
>>>you intend to use it in the future? Do you need people for testing?
>>>
>>>Many, many thanks for your help.
>>>
>>>Cheers
>>>
>>>Uwe
>>>
>>>- ----------  Weitergeleitete Nachricht  ----------
>>>
>>>Subject: Re: ITK Java
>>>Date: Freitag, 28. Mai 2004 17:36
>>>From: "Brian Eastwood" <beastwoo at email.unc.edu>
>>>To: <u.koehler at gmx.de>
>>>
>>>Hi Uwe,
>>>
>>>The code you sent seemed to run fine on my machine.  The only problem I
>>>had was that the image appeared black in most image viewers, as if for
>>>some reason the program rescaled all the intensities to the lower 8 bits
>>>of an unsigned short.  I usually get that behavior with the java
>>>wrappers, though.
>>>
>>>I used a different image (BrainT1Slice.png), since I couldn't find
>>>cthead1.png in the ITK data directory.
>>>
>>>I'm running a Windows XP machine, built ITK with Java wrapping using MS
>>>Visual Studio 7, and am running Eclipse as a Java IDE.  My most recent
>>>CVS update and rebuild was on Wednesday morning.  Sorry I couldn't be of
>>>more help, but maybe there is something missing with your java build.
>>>When was the last time you updated from CVS and rebuilt?
>>>
>>>I believe the build order for the java wrappers was incorrect until
>>>recently.  (Actually, I think they might still be out of order.)  I
>>>believe you should build all Java wrappers before the ITKJavaJar project
>>>builds--I think I was seeing ITKAlgorithmsJava and ITKIOJava building
>>>afterwards.  To solve this, either change the build order manually (what
>>>I did) or build twice--that way the jar should get the right contents
>>>the second time around.
>>>
>>>Cheers,
>>>Brian
>>>
>>>Dr. Uwe Köhler wrote:
>>>
>>>>-----BEGIN PGP SIGNED MESSAGE-----
>>>>Hash: SHA1
>>>>
>>>>Hi Brian,
>>>>
>>>>I read your email on the ITK mailing list with huge interest, since I am
>>>>trying to get the Java wrapper to work with Linux. I have the same
>>>>problem that someone else reported some time earlier. Not even the
>>>>examples excetute correctly (I had to adopt them to compile). I would be
>>>>very grateful if you could run the examples and let me know, if you get
>>>>the following error, as well.
>>>>
>>>>#java MeanImageFilter cthead1.png cthead1_Mean.png 5
>>>>MeanImageFilter Example
>>>>Exception in thread "main"
>>>>java.lang.RuntimeException:
>>>>/usr/local/src/Insight/Code/Common/itkImageBase.txx:167: itk::ERROR:
>>>>Image(0x8114478): itk::ImageBase::CopyInformation() cannot cast
>>>>PKN3itk10DataObjectE to PKN3itk9ImageBaseILj2EEE
>>>>      at
>>>>InsightToolkit.itkImageFileWriter_2DJNI.itkImageFileWriterUS2_Pointer_Upd
>>>>ate (Native Method)
>>>>      at
>>>>InsightToolkit.itkImageFileWriterUS2_Pointer.Update(itkImageFileWriterUS2
>>>>_Po inter.java:119) at MeanImageFilter.main(MeanImageFilter.java:34)
>>>>
>>>>Maybe we can help solving this problem. I included the source code.
>>>>
>>>>Many thanks in advance
>>>>
>>>>Uwe
>>>>
>>>>- --
>>>>
>>>>- -+-----------------------------------------------------------------+-
>>>>
>>>>|  Dr. Uwe Köhler              MR - Physics                       |
>>>>|                              German Heart Institute Berlin      |
>>>>|                              Augustenburger Platz 1             |
>>>>|                              D - 13353 Berlin                   |
>>>>|          ////                Germany                            |
>>>>|         (@ @)                Phone: +49 172 98 11 598           |
>>>>
>>>>- -+-----oOO--(_)--OOo-----------------------------------------------+-
>>>>
>>>>| <URL:http://www.ed.ac.uk/~ukoehler>   <mailto:UKoehler at dhzb.de> |
>>>>
>>>>-----BEGIN PGP SIGNATURE-----
>>>>Version: GnuPG v1.2.4 (GNU/Linux)
>>>>
>>>>iD8DBQFAtuU+zFGNh0avvlkRAjvkAJ96OyeWCvYZ6uiWvwz3e5L6KUswPgCgmTbP
>>>>nDgTGz2ZuFpfmKXl6SgYYvQ=
>>>>=dw9v
>>>>-----END PGP SIGNATURE-----
>>>
>>>- --
>>>________________________________________
>>>                      < brian eastwood >
>>>          < beastwoo at cs . unc . edu >
>>>       < beastwoo at email . unc . edu >
>>>     < http://www.cs.unc.edu/~beastwoo >
>>>                    < 919 . 962 . 1761 >
>>>
>>>- -------------------------------------------------------
>>>
>>>- --
>>>
>>>- -+-----------------------------------------------------------------+-
>>>
>>> |  Dr. Uwe Köhler              MR - Physics                       |
>>> |                              German Heart Institute Berlin      |
>>> |                              Augustenburger Platz 1             |
>>> |                              D - 13353 Berlin                   |
>>> |          ////                Germany                            |
>>> |         (@ @)                Phone: +49 172 98 11 598           |
>>>
>>>- -+-----oOO--(_)--OOo-----------------------------------------------+-
>>>
>>> | <URL:http://www.ed.ac.uk/~ukoehler>   <mailto:UKoehler at dhzb.de> |
>>>
>>>-----BEGIN PGP SIGNATURE-----
>>>Version: GnuPG v1.2.4 (GNU/Linux)
>>>
>>>iD8DBQFAvCSMzFGNh0avvlkRAnApAKCGW5ujjpguabkE1j8mYhO/pEVuxACdH8rh
>>>CaOHBobaFUwXHvRR4mZr+Nc=
>>>=7aIN
>>>-----END PGP SIGNATURE-----
> 
> 
> - -- 
>  |                                                                 |
> - -+-----------------------------------------------------------------+-
>  |  Dr. Uwe Köhler              MR - Physics                       | 
>  |                              German Heart Institute Berlin      |
>  |                              Augustenburger Platz 1             |
>  |                              D - 13353 Berlin                   |
>  |          ////                Germany                            |
>  |         (@ @)                Phone: +49 172 98 11 598           |
> - -+-----oOO--(_)--OOo-----------------------------------------------+-
>  | <URL:http://www.ed.ac.uk/~ukoehler>   <mailto:UKoehler at dhzb.de> |
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (GNU/Linux)
> 
> iD8DBQFA6PozzFGNh0avvlkRAuPUAKCAmoPyOYl1drNEu8e1MZSLA5mjSgCeK6XP
> nY0LyuU33LWNsIHQBeeSilM=
> =uG2m
> -----END PGP SIGNATURE-----
> 









More information about the Insight-users mailing list