From d2949bab2af39aa2a5c60449cb4ad7fe1c263b50 Mon Sep 17 00:00:00 2001 From: Manuel Grizonnet <manuel.grizonnet@orfeo-toolbox.org> Date: Thu, 12 Jul 2012 18:07:58 +0200 Subject: [PATCH] DOC: add comment about actual limitation of otbQuickLook app with jpeg2000 images --- Applications/Utils/otbQuicklook.cxx | 57 +++++++++++++++-------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/Applications/Utils/otbQuicklook.cxx b/Applications/Utils/otbQuicklook.cxx index 7289819b4a..fbf901e9a7 100644 --- a/Applications/Utils/otbQuicklook.cxx +++ b/Applications/Utils/otbQuicklook.cxx @@ -48,7 +48,7 @@ public: typedef ExtractROIFilterType::OutputImageType OutputImageType; typedef otb::StreamingShrinkImageFilter <ExtractROIFilterType::OutputImageType, ExtractROIFilterType::OutputImageType> ShrinkImageFilterType; - + private: void DoInit() { @@ -56,8 +56,9 @@ private: SetDescription("Generates a subsampled version of an image extract"); SetDocName("Quick Look"); SetDocLongDescription("Generates a subsampled version of an extract of an image defined by ROIStart and ROISize.\n " - "This extract is subsampled using the ratio OR the output image Size"); - SetDocLimitations("None"); + "This extract is subsampled using the ratio OR the output image Size."); + SetDocLimitations(" This application does not provide yet the optimal way to decode coarser level of resolution from JPEG2000 images (like in Monteverdi).\n" + "Trying to subsampled huge JPEG200 image with the application will lead to poor performances for now."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); @@ -65,10 +66,10 @@ private: AddParameter(ParameterType_InputImage, "in", "Input Image"); SetParameterDescription( "in", "The image to read" ); - + AddParameter(ParameterType_OutputImage, "out", "Output Image"); SetParameterDescription( "out" , "The subsampled image" ); - + AddParameter(ParameterType_ListView, "cl", "Channel List"); SetParameterDescription( "cl" , "Selected channels" ); MandatoryOff("cl"); @@ -76,52 +77,52 @@ private: AddParameter(ParameterType_Int, "rox", "ROI Origin X"); SetParameterDescription( "rox" , "first point of ROI in x-direction" ); MandatoryOff("rox"); - + AddParameter(ParameterType_Int, "roy", "ROI Origin Y"); SetParameterDescription( "roy" , "first point of ROI in y-direction" ); MandatoryOff("roy"); - + AddParameter(ParameterType_Int, "rsx", "ROI Size X"); SetParameterDescription( "rsx" , "size of ROI in x-direction" ); MandatoryOff("rsx"); - + AddParameter(ParameterType_Int, "rsy", "ROI Size Y"); SetParameterDescription( "rsy" , "size of ROI in y-direction" ); MandatoryOff("rsy"); - + AddParameter(ParameterType_Int, "sr", "Sampling ratio"); SetParameterDescription( "sr" , "Sampling Ratio, default is 2" ); SetDefaultParameterInt("sr", 2); SetMinimumParameterIntValue("sr", 1); MandatoryOff("sr"); - + AddParameter(ParameterType_Int, "sx", "Size X"); SetParameterDescription( "sx" , "quicklook size in x-direction (used if no sampling ration is given)" ); MandatoryOff("sx"); DisableParameter("sx"); - + AddParameter(ParameterType_Int, "sy", "Size Y"); SetParameterDescription( "sy" , "quicklook size in y-direction (used if no sampling ration is given)" ); MandatoryOff("sy"); DisableParameter("sy"); - + SetDefaultParameterInt("rox", 0); SetDefaultParameterInt("roy", 0); SetDefaultParameterInt("rsx", 0); SetDefaultParameterInt("rsy", 0); - + // Doc example parameter settings SetDocExampleParameterValue("in", "qb_RoadExtract.tif"); SetDocExampleParameterValue("out", "quicklookImage.tif"); } - + void DoUpdateParameters() { // Update the sizes only if the user does not defined a size if ( HasValue("in") ) { InputImageType::Pointer inImage = GetParameterImage("in"); - + InputImageType::RegionType largestRegion = inImage->GetLargestPossibleRegion(); // Update the values of the channels to be selected @@ -143,7 +144,7 @@ private: SetParameterInt("rsx", largestRegion.GetSize()[0]); SetParameterInt("rsy", largestRegion.GetSize()[1]); } - + // Put the limit of the index and the size relative the image SetMinimumParameterIntValue("rsx", 0); SetMaximumParameterIntValue("rsx", largestRegion.GetSize(0)); @@ -153,10 +154,10 @@ private: SetMinimumParameterIntValue("rox", 0); SetMaximumParameterIntValue("rox", largestRegion.GetSize(0)-1); - + SetMinimumParameterIntValue("roy", 0); SetMaximumParameterIntValue("roy", largestRegion.GetSize(1)-1); - + // Crop the roi region to be included in the largest possible // region if(!this->CropRegionOfInterest()) @@ -169,7 +170,7 @@ private: } } - + bool CropRegionOfInterest() { FloatVectorImageType::RegionType region; @@ -177,7 +178,7 @@ bool CropRegionOfInterest() region.SetSize(1, GetParameterInt("rsy")); region.SetIndex(0, GetParameterInt("rox")); region.SetIndex(1, GetParameterInt("roy")); - + if ( HasValue("in") ) { if (region.Crop(GetParameterImage("in")->GetLargestPossibleRegion())) @@ -191,14 +192,14 @@ bool CropRegionOfInterest() } return false; } - + void DoExecute() { InputImageType::Pointer inImage = GetParameterImage("in"); - + m_ExtractROIFilter = ExtractROIFilterType::New(); m_ResamplingFilter = ShrinkImageFilterType::New(); - + // The image on which the quicklook will be generated // Will eventually be the m_ExtractROIFilter output @@ -211,7 +212,7 @@ bool CropRegionOfInterest() m_ExtractROIFilter->SetStartY(GetParameterInt("roy")); m_ExtractROIFilter->SetSizeX(GetParameterInt("rsx")); m_ExtractROIFilter->SetSizeY(GetParameterInt("rsy")); - + if ((GetSelectedItems("cl").size() > 0)) { for (unsigned int idx = 0; idx < GetSelectedItems("cl").size(); ++idx) @@ -259,20 +260,20 @@ bool CropRegionOfInterest() } } } - + if ( Ratio < 1) { otbAppLogFATAL( << "Error in SizeX and/or SizeY : ratio must be greater than 1."); return; } otbAppLogINFO( << "Ratio used: "<<Ratio << "."); - + m_ResamplingFilter->SetShrinkFactor( Ratio ); m_ResamplingFilter->Update(); - + SetParameterOutputImage("out", m_ResamplingFilter->GetOutput()); } - + ExtractROIFilterType::Pointer m_ExtractROIFilter; ShrinkImageFilterType::Pointer m_ResamplingFilter; -- GitLab