[Insight-users] Question about ManagedITK/TIF format/ SharpImage ...

christian.herrera at gmail.com christian.herrera at gmail.com
Fri May 13 17:21:19 EDT 2011


Dan,

I tried to recompile the ManagedITK from Source following the instructions
at Page 7 of IJ_151_ManagedITK-3.6.0.2.pdf article. I did the following:

1. Download ITK (Original) and Managed ITK both versioned as 3.20.0

2. Unzip them; Original to -> "C:/itk_2/InsightToolkit-3.20.0" and Managed
to -> "ManagedITK-src-3.20.0.0
"
3. Patch ITK (Original) with the Patch instructions at the ManagedITK folder
(Eg. C:\itk_2\ManagedITK-src-3.20.0.0\Patch>patch
C:\itk_2\InsightToolkit-3.20.0\Code
\Common\itkShapedNeighborhoodIterator.h <
itkShapedNeighborhoodIterator.h.patch), I did this for the 3  files to
patch.

4. Open CMAKE and Configure ITK (Original) with ITK_USE_REVIEW = ON. For
"Where to build the binaries" I set another folder called
"InsightToolkit-3.20.0-Binaries". I press configure and generate...
everything works fine. See picture attached..

5. I open Visual Studio 2005 and open the ITK.sln located at
"InsightToolkit-3.20.0-Binaries". It compiles withour problem after ~15
minutes.

6. Open CMAKE again but now configure ManagedITK (located at
".../ManagedITK-src-3.20.0.0"). I set the "Where to build binaries" to
".../ManagedITK-src-3.20.0.0-Binaries" similar to what I did for ITK
previously.  It automatically sets the ITK_DIR to -> 
"C:/itk_2/InsightToolkit-3.20.0-Binaries" . I press configure and
generate... everything works fine. See picture attached...

7. Before opening the "ManagedITK.sln" I run FinishCMake.bat file located in
the "C:/itk_2/InsightToolkit-3.20.0-Binaries" folder. The bat program runs
as expected.

8. I open the "ManagedITK.sln" and start Building all the projects. A few
seconds later the following errors appear repeateadly (See picture
attached):

1>itkManagedFlatStructuringElement_2.cxx
1>.\Common\itkManagedFlatStructuringElement_2.cxx(47) : fatal error C1083:
Cannot open include file: 'itkFlatStructuringElement.h': No such file or
directory1>itkManagedImage_VIF3.cxx
1>c:\itk_2\manageditk-src-3.20.0.0-binaries\source\common\itkManagedTypes.cxx(64)
: fatal error C1083: Cannot open include file: 'itkQuadEdgeMeshPoint.h': No
such file or directory

9. I searched on the web and in the Mailing list I found something related
to ITK_USE_REVIEW, but I used this option as indicated, even I tried using
when configuring ManagedITK, none of them worked.

Do you have any suggestions?

I suspect about the Patch you mentioned, which comes in ManagedITK and I
applied to ITK according to the Patch's Readme instructions. This patch just
run, apparently,  and it didn't give any feedback, I had to close the black
window that remained in my screen..... :-S

Thank you very much... for your support....



---------------------------------------------------------------------------------------------

Hi Christian,

You are correct: ManagedITK does not support US2 out-of-the-box.

However, the good (and bad) news is that ManagedITK can support US2 if
you recompile from source. To do this you need to follow the
instructions on page 7 of the ManagedITK article here:
   http://manageditk.googlecode.com/files/ManagedITK-article.pdf
At step 5 (Configure ManagedITK) you need to select the "unsigned
short" pixel type. If you are not familiar with Visual Studio + CMake
+ ITK, this process can be quite difficult. Good luck.

You may be able to get US2 support in SharpImage by replacing the
vanilla ManagedITK.Common.dll with the custom one you compile yourself
(no guarantees this will work though).

Let me know how you get on.

Cheers, Dan



christian.herrera at gmail.com wrote:
> 
> Hello,
> 
> I am a "newcomer"on the ITK area; I have been working tryng to execute
> some algorithms to a TIF image, and then display the TIF image output.
> When I re-create the Image to display it, the output is not good. It seems
> that I am loosing some data because of the way I use ManagedITK to
> read/write this format.
> 
>  All these in an application I developed. When I try to open the TIF image
> using the SharpImage 0.9.5, I get the following error message:
> 
>  "Unable to open image file." itk.itkInvalidWrappedTypeException: Could
> not create an instance of 'itk.itkImage_US2'. The given type may not be
> supported or may be invalid.--->System.NullReferenceException: The type
> 'itk.itkImage_US2' could not be found in ManagedITKCommon,
> Version=3.4.0.1, Culture=neutral, PublicKeyToken=null at
> itk.itkImage.CreateInstance() --- End of inner exception stack trace ---
> ar itk.itkImage.CreateInstance() at itk.itkImage.New(itkPixelType
> pixelTypr, UInt32 dim) at SharpImage.Main.siFormMain.OpenImage(Boolean
> display, itkPixelType pixelType, Int32 dim, String fullPath) at
> SharpImage.Main.siFormMain.OpenImage(Boolean display, String title).
> 
> So my understanding is that ManagedITK doesn't suport this type of Image
> (US2).  I would appreciate if you could tell me a "workaround" for this. I
> am using C# for my development I would like to continue using it .... :-)
> 
> Regards,
> 
> Christian Herrera,
> 

christian.herrera at gmail.com wrote:
> 
> Hello,
> 
> I am a "newcomer"on the ITK area; I have been working tryng to execute
> some algorithms to a TIF image, and then display the TIF image output.
> When I re-create the Image to display it, the output is not good. It seems
> that I am loosing some data because of the way I use ManagedITK to
> read/write this format.
> 
>  All these in an application I developed. When I try to open the TIF image
> using the SharpImage 0.9.5, I get the following error message:
> 
>  "Unable to open image file." itk.itkInvalidWrappedTypeException: Could
> not create an instance of 'itk.itkImage_US2'. The given type may not be
> supported or may be invalid.--->System.NullReferenceException: The type
> 'itk.itkImage_US2' could not be found in ManagedITKCommon,
> Version=3.4.0.1, Culture=neutral, PublicKeyToken=null at
> itk.itkImage.CreateInstance() --- End of inner exception stack trace ---
> ar itk.itkImage.CreateInstance() at itk.itkImage.New(itkPixelType
> pixelTypr, UInt32 dim) at SharpImage.Main.siFormMain.OpenImage(Boolean
> display, itkPixelType pixelType, Int32 dim, String fullPath) at
> SharpImage.Main.siFormMain.OpenImage(Boolean display, String title).
> 
> So my understanding is that ManagedITK doesn't suport this type of Image
> (US2).  I would appreciate if you could tell me a "workaround" for this. I
> am using C# for my development I would like to continue using it .... :-)
> 
> Regards,
> 
> Christian Herrera,
> 
http://itk-insight-users.2283740.n2.nabble.com/file/n6361284/CMAKE_ITK.jpg 
http://itk-insight-users.2283740.n2.nabble.com/file/n6361284/CMAKE_MANAGEDITK.jpg 
http://itk-insight-users.2283740.n2.nabble.com/file/n6361284/VS_ERRORS.jpg 

--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Question-about-ManagedITK-TIF-format-SharpImage-tp6349263p6361284.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.


More information about the Insight-users mailing list