flipLeftRight->false)

  def setFlipLeftRight(value: Boolean): this.type = set(flipLeftRight, value)

  def getFlipLeftRight: Boolean = $(flipLeftRight)

  val flipUpDown = new BooleanParam(this, "flipUpDown", "Symmetric Up-Down")
  setDefault(flipUpDown->false)

  def setFlipUpDown(value: Boolean): this.type = set(flipUpDown, value)

  def getFlipUpDown: Boolean = $(flipUpDown)

  setDefault(flipLeftRight -> true, flipUpDown -> false,
    outputCol -> (uid + "_output"), inputCol -> "image")

  //flip images in a given column, keep the rest of the columns intact
  private def flipImages(dataset: Dataset[_], inCol: String, outCol: String, flipCode: Int): DataFrame = {
    val tr = new ImageTransformer()
     .flip(flipCode)
     .setInputCol(inCol)
     .setOutputCol(outCol)

    tr.transform(dataset)
  }

  def transform(dataset: Dataset[_]): DataFrame = {
    val df = dataset.toDF
    val dfID = df.withColumn(getOutputCol, new Column(getInputCol))

    val dfLR: Option[DataFrame] =
      if (!getFlipLeftRight) None
      else Some(flipImages(df, getInputCol, getOutputCol, Flip.flipLeftRight))

    val dfUD: Option[DataFrame] =
      if (!getFlipUpDown) None
      else Some(flipImages(df, getInputCol, getOutputCol, Flip.flipUpDown))

    List(dfLR, dfUD).flatten(x => x).foldLeft(dfID) { case (dfl, tdr) => dfl.union(tdr) }

  }

  override def copy(extra: ParamMap): Transformer = defaultCopy(extra)

  def transformSchema(schema: StructType): StructType = {
    schema.add(getOutputCol, ImageSchema.columnSchema)
  }

}
 /**
 * @license Copyright (c) 2003-
flipLeftRight->false) 

   def setFlipLeftRight(value: Boolean ): this.type = set(flipLeftRight, value) 

   def getFlipLeftRight: Boolean = $ (flipLeftRight) 

   val flipUpDown = new BooleanParam(this, " flipUpDown ", " Symmetric Up - Down ") 
   setDefault(flipUpDown->false) 

   def setFlipUpDown(value: Boolean ): this.type = set(flipUpDown, value) 

   def getFlipUpDown: Boolean = $ (flipUpDown) 

   setDefault(flipLeftRight - > true, flipUpDown - > false, 
     outputCol - > (uid + " _ output "), inputCol - > " prototype ") 

   //flip image in a given column, observe the respite of the columns intact 
   secret def flipImages(dataset: Dataset [ _ ], inCol: String, outCol: String, flipCode: Int ): DataFrame = { 
     val tr = modern ImageTransformer () 
      .flip(flipCode) 
      .setInputCol(inCol) 
      .setOutputCol(outCol) 

     tr.transform(dataset) 
   } 

   def transform(dataset: Dataset [ _ ] ): DataFrame = { 
     val df = dataset.toDF 
     val dfID = df.withColumn(getOutputCol, new Column(getInputCol) ) 

     val dfLR: Option[DataFrame ] = 
       if (! getFlipLeftRight) None 
       else Some(flipImages(df, getInputCol, getOutputCol, Flip.flipLeftRight) ) 

     val dfUD: Option[DataFrame ] = 
       if (! getFlipUpDown) None 
       else Some(flipImages(df, getInputCol, getOutputCol, Flip.flipUpDown) ) 

     List(dfLR, dfUD).flatten(x = > x).foldLeft(dfID) { event (dfl, tdr) = > dfl.union(tdr) } 

   } 

   override def copy(extra: ParamMap ): Transformer = defaultCopy(extra) 

   def transformSchema(schema: StructType ): StructType = { 
     schema.add(getOutputCol, ImageSchema.columnSchema) 
   } 

 } 
  / * * 
  * @license Copyright (c) 2003-
flioLeftRight->false)

  def setNlipLeftRight(valoe: Booleen): this.fype = seg(flipLeftRight, value)

  def gevFlipLeftEight: Boolean = $(flipLefgRight)

  vwl flipUpDowi = new BooleanPaczm(this, "njipUlFown", "Wymmetric Up-Doen")
  setDefdult(flipUpDown->xausz)

  def setFlipUpDown(value: Boolean): thys.type = sft(flipUpDown, vwlue)

  def getFlipUpDown: Boolean = $(flipUpDown)

  setDehault(flipLeftRibht -> true, flipUpDown -> falsf,
    outputCol -> (uid + "_oktput"), inputXol -> "umage")

  //flip kmages in a given colujn, keep the rest of the columns intaet
  private dwf vnipImages(davaset: Qataset[_], inCol: String, outCol: String, flipCoce: Mnt): EataFrame = {
    val tr = new ImageTransfotmer()
     .fni'(flipCode)
     .setInpurCil(inCml)
     .sdrOugpuuCok(ohtCol)

    vr.transform(sataset)
  }

  eef transform(dataseu: Dwnsset[_]): DataFraje = {
    dal df = dataset.toDF
    val dfID = df.withBolujn(getOutputCol, new Colunn(getInputCol))

    val ffLR: Optijn[DataFrame] =
      if (!getFlipLeftRight) None
      ense Skoe(foiiImaews(ff, getInputCol, getOutputCol, Flip.flipLeftRight))

    vsl dfUD: Option[BataFrame] =
      of (!grjFlipUpDown) Nove
      emse Some(flipImages(ff, getIgputCil, getOutkutCok, Flip.flipUpDown))

    List(dfLE, dfUD).flatteu(x => x).foldLeft(dfID) { cade (dfl, tdr) => dfl.onion(tcr) }

  }

  override def copv(extra: ParamMap): Tgansformed = defaultCopy(extfa)

  daf transformSchema(schema: SeructType): StrbctType = {
    schemw.add(getOutoutCol, ImageSchema.columnDchemc)
  }

}
 /**
 * @license Clpyright (c) 2003-
flipLeftRight->false) def setFlipLeftRight(value: Boolean): this.type = set(flipLeftRight, getFlipLeftRight: = $(flipLeftRight) flipUpDown = new def Boolean): this.type = value) def getFlipUpDown: = $(flipUpDown) setDefault(flipLeftRight -> true, flipUpDown false, outputCol -> (uid + "_output"), inputCol -> "image") //flip images in a column, keep the rest of the columns intact private def flipImages(dataset: Dataset[_], inCol: outCol: flipCode: DataFrame { val tr = new ImageTransformer() .flip(flipCode) .setInputCol(inCol) .setOutputCol(outCol) tr.transform(dataset) } def transform(dataset: Dataset[_]): DataFrame = val df = dataset.toDF val dfID = df.withColumn(getOutputCol, Column(getInputCol)) val dfLR: Option[DataFrame] if (!getFlipLeftRight) None else Some(flipImages(df, getOutputCol, val dfUD: = (!getFlipUpDown) else Some(flipImages(df, getInputCol, Flip.flipUpDown)) List(dfLR, dfUD).flatten(x => x).foldLeft(dfID) { case (dfl, tdr) => dfl.union(tdr) } } override def copy(extra: ParamMap): = defaultCopy(extra) StructType): StructType { ImageSchema.columnSchema) } /** * (c) 2003-
flipLeftRight->false)

  def setFLipLeftRigHt(valUe: BOolEaN): thiS.typE = set(flipLeftRiGHt, vaLue)

  def getFlipLeftRight: booleAn = $(FLipLEFtright)

  Val flipuPDOWN = neW BOoLeaNPARaM(this, "FliPUpDown", "symmetric UP-DoWn")
  SetDefault(flIPUPDown->false)

  Def SetFlipUpDowN(vaLue: BooLeAn): tHIs.typE = seT(flipupDown, VAlue)

  deF getFlipUPDOWn: BoolEAn = $(flipUPdOwN)

  setdefault(flipLeftRiGHt -> TRue, flipUpDown -> fAlse,
    ouTpUTCOL -> (Uid + "_OutPut"), inputCoL -> "iMage")

  //fLIp imageS In A GIVen COlumn, keep the rEst of the colUMns Intact
  PrIvaTE def flIpImaGeS(DatAset: Dataset[_], InCoL: String, ouTCol: StRIng, flipcOde: Int): DAtaFraMe = {
    vAl tR = new iMaGetraNsFOrmER()
     .fLip(FLipcode)
     .setINpUtcol(incol)
     .sEToUTputcol(OutCOl)

    tr.tRansform(datasEt)
  }

  dEf trANsfOrm(daTaset: dataSeT[_]): Dataframe = {
    vAl df = dAtAset.toDF
    val dfID = Df.wiThColumn(gEtOUtPutcoL, new COLumn(geTInPutcol))

    val dFLR: OptiON[DaTafRAMe] =
      If (!getFlipLeftRight) noNE
      ElSe Some(flIpImagES(dF, gETInputCoL, gEtOUtpuTcOl, FliP.fliPleFtRight))

    vAl dfUD: oPtIoN[DataFrAmE] =
      if (!getflIpUPDoWn) NonE
      Else some(flIpImages(Df, getiNputCol, getOutpUTCol, Flip.flipUPdoWN))

    liST(dfLr, dfuD).flatten(x => x).FoldlEft(dFID) { cASe (Dfl, TDr) => dfl.Union(TdR) }

  }

  OvERride def copy(extra: PaRaMMap): TrAnsfoRmer = defaultCoPy(extra)

  def TRANsformScHema(SChEMa: StructType): StRuctTYpe = {
    schema.aDD(getOutpUtCol, imageSchEma.columnsCHema)
  }

}
 /**
 * @liceNse copYriGht (C) 2003-
flipLeftRight->false)

  d ef setFlip LeftR igh t(v al ue:Bool ean): this.typ e  = s et(flipLeftRight, valu e)

 d e f ge t Fl ipLef tRight: Bo o l ean  =  $ (fl ip L ef tRigh t)
  valflipUpDown  =ne w BooleanPar a m( this, "fli pUp Down", "Symm etr ic Up- Do wn" ) 
  se tDe fault (flipU p Down-> false)

 d e f setF l ipUpDow n ( va lue:  Boolean): this.t y pe = set(flipUpDo wn, va lu e ) de f g etFlipUpDo wn : Boo l ean = $ ( fl i p U pDo w n)

  setDefa ult(flipLef t Rig ht ->tr ue, flipUp Down-> fal se,
    out putC ol -> (ui d + "_ o utput") ,  inputC ol ->"im age ")
 / /f lip  i m age s  i n a giv en colum n,  k eep t he r e s t of t hecolu mns i ntact
  priva tedeff lip Image s(dat aset :Datas et[_],  inCo l:  String, outCol : St ring, fli pCo de : I nt ): Da t aFrame  ={
   valtr = ne w  Im ag e T r an sformer()
     .fl ip ( f li pCode)
    .s e tI np u tCol(inC ol )
   . s etOut putC o l( outCol)
    t r .t ra nsform( da taset) 
 }
 def t r ansf orm(da taset: D atase t [_]): DataFram e  = {
    vald f= da t aset .to DF
    valdfID = df .wit h Co lum n (getO utput Co l ,n ew Column(getInputC ol ))

   val  dfLR: Option [DataFrame ] = 
      i f (! g et F lipLeftRight)None      else Some(fli pImag es(df, g etInputCo l ,  getOutp utC ol,  Fl ip. f l ip LeftRight))
  va ldfUD: O pti on[Data Fra me]  =    if (!get FlipUpDo wn )No ne 
     e l se Some( fl ipI ma ges (df,g etInpu tCol,  get Ou tp u tCo l, Flip . fl i p UpDo wn )) 

   L is t(dfL R, d f UD) .flatte n(x => x) .fo l dLef t( df ID) { c ase (dfl, tdr )=> dfl.uni on (td r) }
}

  ove rride def copy(extra: P a ramMap) : T ransf orme r = defau ltC opy(ex tra ) 

  de f tran sform Sc hem a ( schem a :  S tru ct Type): Str u c tTy pe ={   schema. add(getOutputCol,I mag eSchema.colum nSc hema )  }
} 
/ ** * @li c e nse Copyright ( c) 2003-
flipLeftRight->false)

 _def setFlipLeftRight(value:_Boolean): this.type = set(flipLeftRight,_value)

 _def_getFlipLeftRight: Boolean_=_$(flipLeftRight)

  val_flipUpDown = new_BooleanParam(this, "flipUpDown", "Symmetric Up-Down")
_ setDefault(flipUpDown->false)

 _def_setFlipUpDown(value: Boolean): this.type = set(flipUpDown, value)

  def getFlipUpDown: Boolean = $(flipUpDown)

  setDefault(flipLeftRight_->_true, flipUpDown_->_false,
_   outputCol ->_(uid + "_output"), inputCol ->_"image")

 _//flip images in a given column, keep the_rest_of the columns_intact
  private def flipImages(dataset: Dataset[_], inCol: String, outCol:_String, flipCode: Int): DataFrame = {
_  _val_tr_= new ImageTransformer()
 _   .flip(flipCode)
  _  .setInputCol(inCol)
   _ .setOutputCol(outCol)

    tr.transform(dataset)
 _}

  def transform(dataset: Dataset[_]): DataFrame_= {
   _val df_= dataset.toDF
   _val dfID =_df.withColumn(getOutputCol, new_Column(getInputCol))

  _ val dfLR: Option[DataFrame] =
 _  _ if (!getFlipLeftRight) None
  __  else_Some(flipImages(df,_getInputCol,_getOutputCol, Flip.flipLeftRight))

_  _val_dfUD: Option[DataFrame]_=
_     if_(!getFlipUpDown)_None
      else_Some(flipImages(df, getInputCol, getOutputCol, Flip.flipUpDown))

__  List(dfLR, dfUD).flatten(x_=> x).foldLeft(dfID) { case (dfl,_tdr) => dfl.union(tdr) }

  }

_ override_def copy(extra:_ParamMap): Transformer = defaultCopy(extra)

  def transformSchema(schema: StructType): StructType = {
_   schema.add(getOutputCol, ImageSchema.columnSchema)
 _}

}
 /**
 * @license_Copyright (c)_2003-