Hi Bill,<div>this is my cmakelists.txt:</div><div><br></div><div><div># This is the root ITK CMakeLists file.</div><div>cmake_minimum_required(VERSION 2.4)</div><div>if(COMMAND CMAKE_POLICY)</div><div> cmake_policy(SET CMP0003 NEW)</div>
<div>endif(COMMAND CMAKE_POLICY)</div><div> </div><div> </div><div># This project is designed to be built outside the Insight source tree.</div><div>project(itktest)</div><div><br></div><div># Find ITK.</div><div>find_package(ITK REQUIRED)</div>
<div>include(${ITK_USE_FILE})</div><div> </div><div>add_executable(itktest main.cpp )</div><div><br></div><div>target_link_libraries(itktest ${ITK_LIBRARIES})</div><div><br></div><div>It is just the adjusted Hello World example file.</div>
<div><br></div><div><br></div><br><div class="gmail_quote">2012/5/22 Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
ooop[s. I see you posted your code. Please post your CMakeLists.txt file.<br>
<div class="HOEnZb"><div class="h5"><br>
On Tue, May 22, 2012 at 3:01 PM, Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>> wrote:<br>
> No need to change the reader output type. The reader will internnaly<br>
> convert to whatever type the user specifies.<br>
><br>
> Sebastien,<br>
><br>
> Please post your complete compilable example and your CMakeLists.txt file.<br>
><br>
> On Tue, May 22, 2012 at 12:11 PM, Cagatay Bilgin <<a href="mailto:bilgincc@gmail.com">bilgincc@gmail.com</a>> wrote:<br>
>> It is your input file that you are having problems<br>
>> with. PNG supports unsigned char or unsigned<br>
>> short but you are trying to read your input as<br>
>> double. You need to change this<br>
>><br>
>> typedef itk::ImageFileReader<DoubleImageType> ReaderType;<br>
>> to<br>
>> typedef itk::ImageFileReader<IntImageType> ReaderType;<br>
>> and modify the rest of your code keeping the imagetypes<br>
>> consistent.<br>
>><br>
>> Cheers,<br>
>> Cagatay<br>
>><br>
>><br>
>> On Tue, May 22, 2012 at 7:42 AM, Sebastian Losch <<a href="mailto:seb.losch@googlemail.com">seb.losch@googlemail.com</a>><br>
>> wrote:<br>
>>><br>
>>> hi Bill!<br>
>>><br>
>>> it is the same as in my first posting. Sorry, i thought i made that clear.<br>
>>><br>
>>> Description: Could not create IO object for file input.png<br>
>>><br>
>>> 2012/5/22 Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>><br>
>>>><br>
>>>> Pleases post the complete line for<br>
>>>> Description: Could not create IO object for fi<br>
>>>><br>
>>>><br>
>>>> On Tue, May 22, 2012 at 9:30 AM, Sebastian Losch<br>
>>>> <<a href="mailto:seb.losch@googlemail.com">seb.losch@googlemail.com</a>> wrote:<br>
>>>> > Hm okay, i just created a solution for visual studio using this<br>
>>>> > helloworld<br>
>>>> > cmake project as basis. The only difference is that there are more<br>
>>>> > Image<br>
>>>> > types he tried, but it is not working. I did try it with JPEG instead<br>
>>>> > of<br>
>>>> > PNG, i had to use a castimagefilter in order to use it with the canny<br>
>>>> > filter<br>
>>>> > which only support real values. No errors, but the output image is just<br>
>>>> > black.<br>
>>>> ><br>
>>>> > Some other ideas?<br>
>>>> ><br>
>>>> > This is the error:<br>
>>>> ><br>
>>>> > Description: Could not create IO object for fi<br>
>>>> > Tried to create one of the following:<br>
>>>> > JPEGImageIO<br>
>>>> > GDCMImageIO<br>
>>>> > BMPImageIO<br>
>>>> > LSMImageIO<br>
>>>> > PNGImageIO<br>
>>>> > TIFFImageIO<br>
>>>> > VTKImageIO<br>
>>>> > StimulateImageIO<br>
>>>> > BioRadImageIO<br>
>>>> > MetaImageIO<br>
>>>> > NiftiImageIO<br>
>>>> > NrrdImageIO<br>
>>>> > GiplImageIO<br>
>>>> > HDF5ImageIO<br>
>>>> > PNGImageIO<br>
>>>> > JPEGImageIO<br>
>>>> > You probably failed to set a file suffix, or<br>
>>>> > set the suffix to an unsupported type.<br>
>>>> ><br>
>>>> > 2012/5/22 Sebastian Losch <<a href="mailto:seb.losch@googlemail.com">seb.losch@googlemail.com</a>><br>
>>>> >><br>
>>>> >> Hi Brad,<br>
>>>> >><br>
>>>> >> thanks for your response. I should have mentioned in my first post<br>
>>>> >> that i<br>
>>>> >> am using Visual Studio 2010 on a Win7 32bit machine. I've read that<br>
>>>> >> this<br>
>>>> >> problem can be solved by adding include(${ITK_USE_FILE}) to the<br>
>>>> >> makefile.<br>
>>>> >> But what is the corresponding way to do it in visual studio?<br>
>>>> >><br>
>>>> >> Thanks, Sebastian<br>
>>>> >><br>
>>>> >><br>
>>>> >> 2012/5/22 Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>><br>
>>>> >>><br>
>>>> >>> Most likely this is a problem with how you are using CMake for ITK<br>
>>>> >>> and is<br>
>>>> >>> not related to the code you have included here.<br>
>>>> >>><br>
>>>> >>> There is an example of what a basic CMake project which uses ITK<br>
>>>> >>> should<br>
>>>> >>> like like int ITK/Examples/Installation/CMakeLists.txt<br>
>>>> >>><br>
>>>> >>><br>
>>>> >>><br>
>>>> >>> <a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Examples/Installation/CMakeLists.txt;h=5e1b9e7ae0a95430f5162e8ff435b98570c5ad6e;hb=HEAD" target="_blank">http://itk.org/gitweb?p=ITK.git;a=blob;f=Examples/Installation/CMakeLists.txt;h=5e1b9e7ae0a95430f5162e8ff435b98570c5ad6e;hb=HEAD</a><br>
>>>> >>><br>
>>>> >>> Hopefully, this will get you started in the right direction to solve<br>
>>>> >>> you<br>
>>>> >>> problem.<br>
>>>> >>><br>
>>>> >>> Brad<br>
>>>> >>><br>
>>>> >>><br>
>>>> >>> On May 22, 2012, at 4:35 AM, Sebastian Losch wrote:<br>
>>>> >>><br>
>>>> >>> Hi!<br>
>>>> >>><br>
>>>> >>> I am having problems getting the ImageFileReader and ImageFileWriter<br>
>>>> >>> to<br>
>>>> >>> work. I just want to read a PNG File, apply a filter and write it<br>
>>>> >>> back to<br>
>>>> >>> the harddrive. I found out that there is a problem in 4.1 with the<br>
>>>> >>> ImageIOFactory registration, so i register the PNGFactory manually.<br>
>>>> >>> The .png<br>
>>>> >>> file is in the same folder as the executable. Here is my Code:<br>
>>>> >>><br>
>>>> >>> #include "itkImage.h"<br>
>>>> >>> #include "itkImageFileReader.h"<br>
>>>> >>> #include "itkImageFileWriter.h"<br>
>>>> >>> #include "itkCannyEdgeDetectionImageFilter.h"<br>
>>>> >>> #include "itkObjectFactoryBase.h"<br>
>>>> >>> #include "itkPNGImageIOFactory.h"<br>
>>>> >>><br>
>>>> >>> int main(int argc, char *argv[])<br>
>>>> >>> {<br>
>>>> >>><br>
>>>> >>> itk::ObjectFactoryBase::RegisterFactory(itk::PNGImageIOFactory::New());<br>
>>>> >>><br>
>>>> >>><br>
>>>> >>> double variance = 2.0;<br>
>>>> >>> double upperThreshold = 0.0;<br>
>>>> >>> double lowerThreshold = 0.0;<br>
>>>> >>><br>
>>>> >>> typedef itk::Image<double, 2> DoubleImageType;<br>
>>>> >>><br>
>>>> >>> typedef itk::ImageFileReader<DoubleImageType> ReaderType;<br>
>>>> >>> ReaderType::Pointer reader = ReaderType::New();<br>
>>>> >>> reader->SetFileName("input.png");<br>
>>>> >>><br>
>>>> >>> typedef itk::CannyEdgeDetectionImageFilter <DoubleImageType,<br>
>>>> >>> DoubleImageType><br>
>>>> >>> CannyEdgeDetectionImageFilterType;<br>
>>>> >>><br>
>>>> >>> CannyEdgeDetectionImageFilterType::Pointer cannyFilter =<br>
>>>> >>> CannyEdgeDetectionImageFilterType::New();<br>
>>>> >>> cannyFilter->SetInput(reader->GetOutput());<br>
>>>> >>> cannyFilter->SetVariance( variance );<br>
>>>> >>> cannyFilter->SetUpperThreshold( upperThreshold );<br>
>>>> >>> cannyFilter->SetLowerThreshold( lowerThreshold );<br>
>>>> >>><br>
>>>> >>> typedef itk::ImageFileWriter<DoubleImageType> WriterType;<br>
>>>> >>> WriterType::Pointer writer = WriterType::New();<br>
>>>> >>><br>
>>>> >>> writer->SetFileName("test.png");<br>
>>>> >>> writer->SetInput(cannyFilter->GetOutput());<br>
>>>> >>><br>
>>>> >>> try {<br>
>>>> >>> writer->Update();<br>
>>>> >>> } catch (itk::ExceptionObject &e) {<br>
>>>> >>> std::cerr << e << std::endl;<br>
>>>> >>> }<br>
>>>> >>><br>
>>>> >>> std::cout << "ENDE" << std::endl;<br>
>>>> >>> }<br>
>>>> >>><br>
>>>> >>> and this is the error:<br>
>>>> >>><br>
>>>> >>> itk::ImageFileReaderException (0059E4A8)<br>
>>>> >>> Location: "void __thiscall itk::ImageFileReader<class<br>
>>>> >>> itk::Image<double,2>,class itk::DefaultConvertPixelTraits<double><br>
>>>> >>> >::GenerateOutputInformation(void)"<br>
>>>> >>> File: c:\libs\itk\include\itk-4.1\itkimagefilereader.hxx<br>
>>>> >>> Line: 143<br>
>>>> >>> Description: Could not create IO object for file input.png<br>
>>>> >>> Tried to create one of the following:<br>
>>>> >>> PNGImageIO<br>
>>>> >>> You probably failed to set a file suffix, or<br>
>>>> >>> set the suffix to an unsupported type.<br>
>>>> >>><br>
>>>> >>><br>
>>>> >>> What am i doing wrong?<br>
>>>> >>><br>
>>>> >>> Thanks in advance, Sebastian<br>
>>>> >>> _____________________________________<br>
>>>> >>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>>>> >>><br>
>>>> >>> Visit other Kitware open-source projects at<br>
>>>> >>> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>>>> >>><br>
>>>> >>> Kitware offers ITK Training Courses, for more information visit:<br>
>>>> >>> <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
>>>> >>><br>
>>>> >>> Please keep messages on-topic and check the ITK FAQ at:<br>
>>>> >>> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
>>>> >>><br>
>>>> >>> Follow this link to subscribe/unsubscribe:<br>
>>>> >>> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
>>>> >>><br>
>>>> >>><br>
>>>> >>> ========================================================<br>
>>>> >>><br>
>>>> >>> Bradley Lowekamp<br>
>>>> >>><br>
>>>> >>> Medical Science and Computing for<br>
>>>> >>><br>
>>>> >>> Office of High Performance Computing and Communications<br>
>>>> >>><br>
>>>> >>> National Library of Medicine<br>
>>>> >>><br>
>>>> >>> <a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a><br>
>>>> >>><br>
>>>> >>><br>
>>>> >>><br>
>>>> >>><br>
>>>> >><br>
>>>> ><br>
>>>> ><br>
>>>> > _____________________________________<br>
>>>> > Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>>>> ><br>
>>>> > Visit other Kitware open-source projects at<br>
>>>> > <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>>>> ><br>
>>>> > Kitware offers ITK Training Courses, for more information visit:<br>
>>>> > <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
>>>> ><br>
>>>> > Please keep messages on-topic and check the ITK FAQ at:<br>
>>>> > <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
>>>> ><br>
>>>> > Follow this link to subscribe/unsubscribe:<br>
>>>> > <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
>>>> ><br>
>>>><br>
>>>><br>
>>>><br>
>>>> --<br>
>>>> Unpaid intern in BillsBasement at noware dot com<br>
>>><br>
>>><br>
>>><br>
>>> _____________________________________<br>
>>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>>><br>
>>> Visit other Kitware open-source projects at<br>
>>> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>>><br>
>>> Kitware offers ITK Training Courses, for more information visit:<br>
>>> <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
>>><br>
>>> Please keep messages on-topic and check the ITK FAQ at:<br>
>>> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
>>><br>
>>> Follow this link to subscribe/unsubscribe:<br>
>>> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
>>><br>
>><br>
><br>
><br>
><br>
> --<br>
> Unpaid intern in BillsBasement at noware dot com<br>
<br>
<br>
<br>
--<br>
Unpaid intern in BillsBasement at noware dot com<br>
</div></div></blockquote></div><br></div>