+/**
+ * \brief Reads from disk the Pixel Data of JPEG Dicom encapsulated
+ * file and decompress it.
+ * @param fp File Pointer
+ * @return Boolean
+ */
+bool PixelReadConvert::ReadAndDecompressJPEGFile( std::ifstream *fp )
+{
+ if ( IsJPEG2000 )
+ {
+ gdcmVerboseMacro( "Sorry, JPEG2000 not yet taken into account" );
+ fp->seekg( (*JPEGInfo->Fragments.begin())->GetOffset(), std::ios::beg);
+// if ( ! gdcm_read_JPEG2000_file( fp,Raw ) )
+ gdcmVerboseMacro( "Wrong Blue LUT descriptor" );
+ return false;
+ }
+
+ if ( IsJPEGLS )
+ {
+ gdcmVerboseMacro( "Sorry, JPEG-LS not yet taken into account" );
+ fp->seekg( (*JPEGInfo->Fragments.begin())->GetOffset(), std::ios::beg);
+// if ( ! gdcm_read_JPEGLS_file( fp,Raw ) )
+ return false;
+ }
+
+ if ( ( ZSize == 1 ) && ( JPEGInfo->Fragments.size() > 1 ) )
+ {
+ // we have one frame split into several fragments
+ // we will pack those fragments into a single buffer and
+ // read from it
+ return ReadAndDecompressJPEGSingleFrameFragmentsFromFile( fp );
+ }
+ else if (JPEGInfo->Fragments.size() == (size_t)ZSize)
+ {
+ }
+// if ( ( ZSize == 1 ) && ( JPEGInfo->Fragments.size() > 1 ) )
+// {
+// // we have one frame split into several fragments
+// // we will pack those fragments into a single buffer and
+// // read from it
+// return ReadAndDecompressJPEGSingleFrameFragmentsFromFile( fp );
+// }
+// else if (JPEGInfo->Fragments.size() == (size_t)ZSize)
+// {
+ // suppose each fragment is a frame
+ return ReadAndDecompressJPEGFramesFromFile( fp );
+// }
+// else
+// {
+// // The dicom image contains frames containing fragments of images
+// // a more complex algorithm :-)
+// return ReadAndDecompressJPEGFragmentedFramesFromFile( fp );
+// }
+}
+