DatasetData d = (DatasetData) it.next(); i.linkDataset((Dataset) mapper.map(d));
DatasetData dd = (DatasetData) it.next(); Dataset d = (Dataset) mapper.map( dd ); if ( ! linked( d.findDatasetImageLink( i ))) i.linkDataset( d );
    public IObject fillIObject( IObject obj, ReverseModelMapper mapper)    {        if ( obj instanceof Image)        {            Image i = (Image) obj;                      if (super.fill(i)) {                i.setName(this.getName());                i.setDescription(this.getDescription());                i.setDescription(this.getDescription());                    Pixels pix = (Pixels) mapper.map(this.getDefaultPixels());                if ( pix != null) pix.setDefaultPixels( Boolean.TRUE );                                if (this.getAllPixels() != null){                    for (Iterator it = this.getAllPixels().iterator(); it.hasNext();)                    {                        PixelsData p = (PixelsData) it.next();                        i.addToPixels( (Pixels) mapper.map(p) );                    }                }                                if (this.getAnnotations() != null){                    for (Iterator it = this.getAnnotations().iterator(); it.hasNext();)                        {                        AnnotationData ann = (AnnotationData) it.next();                        i.addToAnnotations( (ImageAnnotation) mapper.map(ann) );                        }                }                                if (this.getDatasets() != null){                    for (Iterator it = this.getDatasets().iterator(); it.hasNext();)                    {                        DatasetData d = (DatasetData) it.next();                        i.linkDataset((Dataset) mapper.map(d));                    }                }            }            return i;        } else {            throw new IllegalArgumentException(                    "ImageData can only fill Image.");        }    }