Iterator d = img.linkedDatasetIterator();
List<Dataset> d_list = img.linkedDatasetList(); Iterator d = d_list.iterator();
	public static Set invertPDI(Set imagesAll) {        Set cleared = new HashSet();		Set hierarchies = new HashSet();        Iterator i = imagesAll.iterator();        while (i.hasNext()) {            Image img = (Image) i.next();            Iterator d = img.linkedDatasetIterator();            if ( ! d.hasNext() ) {                hierarchies.add(img);            } else {                while (d.hasNext()) {                    Dataset ds = (Dataset) d.next();                                        if ( ! cleared.contains( ds ))                    {                        ds.clearImageLinks();                        cleared.add( ds );                    }                    ds.linkImage( img );                    Iterator p = ds.linkedProjectIterator();                    if ( ! p.hasNext() ) {                        hierarchies.add( ds );                    } else {                        while (p.hasNext()) {                            Project prj = (Project) p.next();                            if ( ! cleared.contains( p ))                            {                                prj.clearDatasetLinks();                                cleared.add( prj );                            }                            prj.linkDataset( ds );                            hierarchies.add(prj);                        }                    }                }            }        }		return hierarchies;	}