MrSIDImageStageManager help

For discussion of LizardTech's free Decode SDK for MrSID and JPEG 2000.

Moderator: jskiffington

MrSIDImageStageManager help

Postby pk4ever98 » Wed Jan 13, 2010 12:41 pm

I have a bunch of sid files that are of the same coordinate space and resolution.

What I want to do is pass that to the LTIMosaicFilter to created a single mosaicked image.

To do that, LTIMosaicFIlter requires a LTIImageStageManager of the set of sid files, and I have a hard time figuring out how to initialize the MrSIDImageStageManager with more than one sid file.
pk4ever98
 
Posts: 2
Joined: Wed Jan 13, 2010 12:31 pm

Postby mpg » Thu Jan 14, 2010 9:58 am

Let me see if I can put together an example for you. Give me a day or so --

-mpg
mpg
 
Posts: 29
Joined: Thu Jan 24, 2008 1:50 pm
Location: LizardTech

Postby gat » Thu Jan 14, 2010 2:09 pm

You will want to try something like this.

SimpleImageStageManager manager = new ...

MrSIDImageReader src1 = new ...
src1->initialize(...)
manager->addImageStage(src1)));

MrSIDImageReader src2 = new ...
src2->initialize(...)
manager->addImageStage(src2)));

LTIMosaicFilter> mosaic = new ...
mosaic->initialize(manager, NULL, false, false);
gat
 
Posts: 28
Joined: Mon Jan 12, 2009 12:41 pm

Postby pk4ever98 » Fri Jan 15, 2010 7:21 am

Looking at the Geo_DSDK-7.0.0.2167 reference manual, an ImageStageManager does not provide a class member function "addImageStage".
pk4ever98
 
Posts: 2
Joined: Wed Jan 13, 2010 12:31 pm

Postby gat » Fri Jan 15, 2010 10:20 am

Ah, I'm sorry about that. You will need to implement SimpleImageStageManager. Here is an example on how you could do that. This code comes from some inhouse validation code and is not public but shows how to do it.

/* $Id$ */
/* //////////////////////////////////////////////////////////////////////////
// //
// This code is Copyright (c) 2003 LizardTech, Inc, 1008 Western Avenue, //
// Suite 200, Seattle, WA 98104. Unauthorized use or distribution //
// prohibited. Access to and use of this code is permitted only under //
// license from LizardTech, Inc. Portions of the code are protected by //
// US and foreign patents and other filings. All Rights Reserved. //
// //
////////////////////////////////////////////////////////////////////////// */

#ifndef _SimpleImageStageManager_h
#define _SimpleImageStageManager_h

// lt_lib_utils
#include "lt_new.h"

// lt_lib_mrsid_imageFilters
#include "lti_imageStageManager.h"


LT_USE_NAMESPACE(LizardTech);

/**
* This LTIImageStageManager implementation holds an array of previously-
* instantiated LTIImageStage pointers and does not destroy them until the
* destructor. The createImageStage() a method is essentially accessor.
*
* Such a strategy for managing image stages should not be used in production,
* but it is useful for validation code.
*/
class SimpleImageStageManager : public LTIImageStageManager
{
LT_DISALLOW_COPY_CONSTRUCTOR(SimpleImageStageManager);
protected:
SimpleImageStageManager(void) :
m_images(NULL)
{
}

~SimpleImageStageManager(void)
{
if(m_images)
{
for(lt_uint32 i = 0; i < getNumImages(); i++)
LTI_RELEASE(m_images[i]);
::free(m_images);
}
}
public:
static SimpleImageStageManager *create(void)
{
LT_USE_MEMMGR;
return LT_NEW(SimpleImageStageManager, LT_NOP);
}

LT_STATUS addImageStage(LTIImageStage *imageStage)
{
lt_uint32 numImages = getNumImages();
lt_uint32 oldLen = (numImages + 0x1F) & ~0x1F;
lt_uint32 newLen = (numImages + 1 + 0x1F) & ~0x1F;
if(oldLen != newLen)
m_images = (LTIImageStage **)::realloc(m_images, newLen * sizeof(LTIImageStage *));

if(!m_images)
return LT_STS_OutOfMemory;

m_images[numImages] = LTI_RETAIN(imageStage);
setNumImages(numImages + 1);
return LT_STS_Success;
}

LT_STATUS createImageStage(lt_uint32 imageNumber,
LTIImageStage *&imageStage)
{
imageStage = LTI_RETAIN(m_images[imageNumber]);
return LT_STS_Success;
}

private:
LTIImageStage** m_images;
};

#endif // _SimpleImageStageManager_h
gat
 
Posts: 28
Joined: Mon Jan 12, 2009 12:41 pm

Postby rymc26 » Tue Jan 19, 2010 4:19 pm

[quote="gat"]
static SimpleImageStageManager *create(void)
{
LT_USE_MEMMGR;
return LT_NEW(SimpleImageStageManager, LT_NOP);
}
[/quote]

This was helpful, but I can't find these macros in the SDK (LT_USE_MEMMGR, LT_NEW, LT_NOP). Are they defined somewhere?
rymc26
 
Posts: 3
Joined: Tue Jan 19, 2010 2:15 pm

Postby gat » Tue Jan 19, 2010 4:48 pm

Those are not public - sorry for the confusion. Just drop the LT_USE_MEMMGR and LT_NOP and change LT_NEW to just the standard "new".
gat
 
Posts: 28
Joined: Mon Jan 12, 2009 12:41 pm


Return to SDKs

Who is online

Users browsing this forum: No registered users and 1 guest