Skip to content
Snippets Groups Projects
Commit 13da113b authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

ENH: setting the output size

parent 7bac4c50
Branches
Tags
No related merge requests found
......@@ -33,6 +33,10 @@ int main(int argc, char * argv[])
typedef otb::VectorDataToImageFilter<VectorDataType, ImageType> VectorDataToImageFilterType;
VectorDataToImageFilterType::Pointer vectorDataRendering = VectorDataToImageFilterType::New();
vectorDataRendering->SetInput(projection->GetOutput());
ImageType::SizeType size;
size[0]=100;
size[1]=100;
vectorDataRendering->SetSize(size);
//Save the image in a file
......
......@@ -69,6 +69,12 @@ template <class TVectorData, class TImage>
virtual void SetInput( const VectorDataType *input);
const VectorDataType * GetInput(void);
/** Set the size of the output image. */
itkSetMacro( Size, SizeType );
/** Get the size of the output image. */
itkGetConstReferenceMacro( Size, SizeType );
/** Set the origin of the vector data.
* \sa GetOrigin() */
itkSetMacro(Origin, OriginType);
......
......@@ -32,6 +32,11 @@ namespace otb
::VectorDataToImageFilter()
{
this->SetNumberOfRequiredInputs( 1 );
m_Spacing.Fill(1.0);
m_Origin.Fill(0.0);
m_Direction.SetIdentity();
m_Size.Fill( 0 );
m_StartIndex.Fill( 0 );
}
......@@ -130,27 +135,30 @@ namespace otb
VectorDataToImageFilter<TVectorData, TImage>
::GenerateOutputInformation()
{
// call the superclass' implementation of this method
Superclass::GenerateOutputInformation();
// get pointers to the input and output
// we can't call the superclass method here.
// get pointers to the input and output
ImagePointer outputPtr = this->GetOutput();
if ( !outputPtr )
{
return;
}
// Set the size of the output region
// Set the size of the output region
typename TImage::RegionType outputLargestPossibleRegion;
outputLargestPossibleRegion.SetSize( m_Size );
outputLargestPossibleRegion.SetIndex( m_StartIndex );
outputPtr->SetLargestPossibleRegion( outputLargestPossibleRegion );
// Set spacing and origin
// Set spacing and origin
outputPtr->SetSpacing( m_Spacing );
outputPtr->SetOrigin( m_Origin );
outputPtr->SetDirection( m_Direction );
//TODO update or check the projection information
return;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment