Hi Maxime,
I did not look in detail at your code but the message is just a warning
related to the fact that as there will be no progress report. It should
still produce the image as output of the writer filter.
Take care also as you're reading the first argument of the program as
the output image and not the input(constchar*inputFilename =argv[2];).
Not sure if you want to do this.
AFAIK, you're program should work and produce an image fill with zero
everywhere apart from pixels modify in the while loop.
Regards,
Le 18/08/2015 08:34, collin maxime a écrit :
> Hi !
>
> I try to create & to write an image, but I have no data in output image
> and the warning message :
> "ImageFileWriter could not get the source process object. Progress
> report might be buggy."
>
> I want to create an image with same geo-metadata of an input vector image.
> I fill all pixels to value 0, except for some (value 1).
>
> Thanks for your help,
> Best regards,
> Maxime
>
>
> My code :
> |
> #include"otbImage.h"
> #include"otbVectorImage.h"
> #include"otbImageFileReader.h"
> #include"otbImageFileWriter.h"
>
> constunsignedintDimension=2;
> typedeffloatPixel;
>
> typedefotb::VectorImage<Pixel,Dimension>ImageIn;
> typedefotb::Image<Pixel,Dimension>ImageOut;
>
> typedefotb::ImageFileReader<ImageIn>ReaderType;
> typedefotb::ImageFileWriter<ImageOut>WriterType;
>
>
> intmain(intargc,char*argv[]){
>
> constchar*outputFilename =argv[1];
> constchar*inputFilename =argv[2];
>
> ReaderType::Pointerreader =ReaderType::New();
> reader->SetFileName(inputFilename);
> reader->UpdateOutputInformation();
> reader->Update();
>
> ImageIn::PointerimageIn =reader->GetOutput();
>
> constImageIn::SpacingType&inputSpacing =imageIn->GetSpacing();
> constImageIn::PointType&inputOrigin =imageIn->GetOrigin();
> ImageIn::RegionTyperegion =imageIn->GetLargestPossibleRegion();
>
> ImageOut::PointerimageOut =ImageOut::New();
> imageOut->SetRegions(region);
> imageOut->SetSpacing(inputSpacing);
> imageOut->SetOrigin(inputOrigin);
> imageOut->Allocate();
> imageOut->FillBuffer(0);
>
> while(/*some condition*/){
> floatvalue =1;
> intx =// some value
> inty =// some value
>
> ImageOut::PixelTypepixelValue =value;
> ImageOut::IndexTypepixelIndex;
> pixelIndex[0]=x;
> pixelIndex[1]=y;
>
> imageOut->SetPixel(pixelIndex,pixelValue);
> }
>
> writer->SetFileName(outputFilename);
> writer->SetInput(imageOut);
>
> try{
> writer->Update();
> }
> catch(itk::ExceptionObject&e){
> std::cerr <<e <<std::endl;
> }
>
> returnEXIT_SUCCESS;
> }
> |
>
>
> --
> --
> Check the OTB FAQ at
> http://www.orfeo-toolbox.org/FAQ.html
>
> You received this message because you are subscribed to the Google
> Groups "otb-users" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/otb-users?hl=en
> ---
> You received this message because you are subscribed to the Google
> Groups "otb-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected]
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout.
--
Manuel GRIZONNET
--
--
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html
You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
---
You received this message because you are subscribed to the Google Groups
"otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.