25 #include <Base/Image/Image.hh>
29 #include <Base/Image/ImageIO.hh>
30 #include <Base/Image/ImageConvert.hh>
31 #include <Utils/Param.hh>
32 #include <Filter/Rescale.hh>
33 #include <Utils/IOUtils.hh>
42 cout<<
"Takes up to four image lists and creates new images containing all side by side"<<endl;
43 cout<<
"\n\n biasjoinimages imagelist1 imagelist2 <imagelist3 imagelist4>\n\n"<<endl;
53 int main (
int argc,
char *argv[])
56 bool bfourImages =
false;
57 string *list1 = params.
AddParamString(
"list1",
"First list of images",
"",
'1');
58 string *list2 = params.
AddParamString(
"list2",
"Second list of images",
"",
'2');
59 string *list3 = params.
AddParamString(
"list3",
"Third list of images",
"",
'3');
60 string *list4 = params.
AddParamString(
"list4",
"Forth list of images",
"",
'4');
61 double *rescaleFactor = params.
AddParamDouble(
"RescaleFactor",
"Rescale factor, 2 means half size",1.0,0.0,10000,
'r');
64 if(!r || *list1 ==
"" ||*list1 ==
""){
68 std::vector<std::string> images1,images2;
70 if(ret < 0){ BIASERR(
"Could not parse list file"<<*list1);
return 0;}
72 if(ret < 0){ BIASERR(
"Could not parse list file"<<*list2);
return 0;}
74 std::vector<std::string> images3, images4;
75 unsigned int width, height;
77 if(*list3 !=
"" && *list4!=
""){
80 if(ret < 0){ BIASERR(
"Could not parse list file"<<*list3);
return 0;}
82 if(ret < 0){ BIASERR(
"Could not parse list file"<<*list4);
return 0;}
90 for(
unsigned int i=0;i< images1.size();i++){
94 cout<<
"Image "<< dImageIndex<<endl;
119 rescale.
Upsample(image22,image2UC,width,height);
136 else image33 = image3;
140 rescale.
Upsample(image33,image3UC,width,height);
149 else image44 = image4;
176 destImage.
Init(destW,destH,3);
185 int xoffset1=0, yoffset1=0;
210 unsigned ulx=0,uly=0,lrx=0,lry=0;
239 if(*rescaleFactor != 1.0){
245 rescaler.
Filter(destImage,tmp);
250 cout<<
"saved:"<<name2.str()<<endl;
256 cout<<
"saved:"<<name.str()<<endl;
EColorModel
These are the most often used color models.
void Release()
reimplemented from ImageBase
bool IsEmpty() const
check if ImageData_ points to allocated image buffer or not
void SetColorModel(EColorModel Model)
double * AddParamDouble(const std::string &name, const std::string &help, double deflt=0.0, double min=-DBL_MAX, double max=DBL_MAX, char cmdshort=0, int Group=GRP_NOSHOW)
unsigned int GetWidth() const
void Usage(std::ostream &os=std::cout)
print Help-Information to stdout
static int ConvertST(const BIAS::ImageBase &source, BIAS::ImageBase &dest, ImageBase::EStorageType targetST)
Function to convert the storage type of images e.g.
virtual int Filter(const Image< InputStorageType > &src, Image< OutputStorageType > &dst)
scales the src to dst using the downsampling factor from SetFactor()
static std::string LeadingZeroString(const int &n, const unsigned int &digits=DEFAULT_LEADING_ZEROS)
Create a string with leading zeroes from number.
unsigned int GetHeight() const
int Upsample(const Image< InputStorageType > &src, Image< OutputStorageType > &dst)
generic upsample function
static int ParseListFile(const std::string &ListFileName, std::vector< std::string > &LinesInFile)
Extracts lines from passed file.
static bool ParseCommandLineEvalHelp(Param ¶ms, int argc, char *argv[])
parses the command line, adds parameter "help"
static int Save(const std::string &filename, const ImageBase &img, const enum TFileFormat FileFormat=FF_auto, const bool sync=BIAS_DEFAULT_SYNC, const int c_jpeg_quality=BIAS_DEFAULT_IMAGE_QUALITY, const bool forceNewID=BIAS_DEFAULT_FORCENEWID, const bool &writeMetaData=true)
Export image as file using extrnal libs.
void Init(unsigned int Width, unsigned int Height, unsigned int channels=1, enum EStorageType storageType=ST_unsignedchar, const bool interleaved=true)
calls Init from ImageBase storageType is ignored, just dummy argument
enum EColorModel GetColorModel() const
This class Param provides generic support for parameters.
static int Load(const std::string &FileName, ImageBase &img)
first tries a call to Read MIP image and if that fails, tries to Import Image with all other availabl...
static int Convert(BIAS::ImageBase &source, BIAS::ImageBase &dest, enum BIAS::ImageBase::EColorModel targetColorModel, bool bPlanar=false)
main general conversion function, calls desired specialized functions, always initializes the destIma...
enum EStorageType GetStorageType() const
(8bit) unsigned char image storage type
int Paste2ROI(const ImageBase &Image)
paste Image to current ROI
int SetROICorners(unsigned int UpperLeftX, unsigned int UpperLeftY, unsigned int LowerRightX, unsigned int LowerRightY)
This is the base class for images in BIAS.
std::string * AddParamString(const std::string &name, const std::string &help, std::string deflt="", char cmdshort=0, int Group=GRP_NOSHOW)
static int ToRGB(const Image< StorageType > &source, Image< StorageType > &dest)
Create a RGB converted copy of source image in this.
void SetFactor(double factor)
the downsampling factor
void UnsetROI()
deprecated, use GetROI()->UnsetROI()